我想在网站页面上添加一个带有按钮的自定义窗口

I want to add a custom window with buttons on a website page

本文关键字:一个 按钮 窗口 自定义 网站 添加      更新时间:2023-09-26

我正在玩一个在线游戏,它的按钮有以下代码。我想添加带有按钮的窗口的原因是因为我必须在页面(使用我要单击的按钮)出现/加载之前浏览多个菜单。因此,在我实际单击该按钮之前,不必通过多次单击浏览菜单,我计划制作一个带有虚拟按钮的窗口,它将执行与下面的相同代码。

<form accept-charset="utf-8" method="post" action="http://www.marketglory.com/account/fight/view_user/498">
    <input type="hidden" value="startFight" name="action"></input>
    <input type="hidden" value="trainer" name="username"></input>
    <input class="nd_submit_big mt13" type="submit" value="Atack now" name="test"></input>
</form>

游戏位于 http://goo.gl/YyvS5o

在上面的操作链接上,用户 ID 为 498 是一个常量。

我不知道从哪里开始。这是我的起始脚本:

// ==UserScript==
// @name        MarketGold In a New Look
// @namespace   http://userscripts.org/scripts/edit_src/180590
// @description This script is intended to enhance the playing experience with the strategy game at http://www.marketglory.com
// @author      Wind™
// @include     http://*.marketglory.com/*
// @exclude     http://*.marketglory.com/forum/*
// @exclude     http://forum.marketglory.com/*
// @grant       GM_addStyle
// @version     1.0.1
// ==/UserScript==
/* Still no idea how to start this */

总结一下:

  1. 创建一个可拖动的窗口(如 iframe 或其他东西)~ 大约 200x80 大小。
  2. 创建一个虚拟按钮,它将执行我上面提到的代码。
//...
//@require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
//@require http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js
//...
$('<table/>').wrapInner($('input[value="Atack now"]').parent()).draggable().css({'padding':'20px', 'background':'black', 'opacity':'0.5'}).appendTo('body');

演示