2013-10-24 39 views
0

我在玩一個在線遊戲,它的按鈕有以下代碼。 我想用按鈕添加窗口的原因是因爲我必須在頁面出現/加載之前瀏覽幾個菜單(帶有我想單擊的按鈕)。因此,在我實際點擊該按鈕之前,不必通過多次點擊瀏覽菜單,我打算使用虛擬按鈕製作窗口,該按鈕將執行下面的相同代碼。我想添加一個自定義窗口的網頁上​​的按鈕

<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

在以上的動作鏈接,這是498的用戶ID是一個常數。

我不知道從哪裏開始。這是我的出發腳本:

// ==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. 創建一個虛擬按鈕,將執行我上面提到的代碼。
+0

開始[這裏](http://stackoverflow.com/q/6480082/331508)。當你工作時,搜索堆棧溢出或要求如何使窗口可拖動。 –

回答

0
//... 
//@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'); 

Demo

相關問題