Auto-Fill Voting Page

Automatically types your account name and clicks on the vote button.

目前為 2014-11-28 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name       Auto-Fill Voting Page
// @version    a1.01
// @description  Automatically types your account name and clicks on the vote button.
// @match      http://hotmople.com/ms/?base=main&page=vote
// @match      http://hotmople.com/vote/jag/vote.php
// @match      http://hotmople.com/vote/top200/vote.php
// @match      http://hotmople.com/vote/ups/vote.php
// @match      http://hotmople.com/vote/topg/vote.php
// @match      http://hotmople.com/vote/gtop100/vote.php
// @require  http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @copyright  tps242 (IGN : Yume)
// @namespace https://greasyfork.org/users/7211
// ==/UserScript==

// calculates a new time whenever the first website voted is launched, we assume the user has voted when this page is launched //
if(location.pathname == "/vote/gtop100/vote.php") {
var newTime = new Date;
localStorage["newTime"] = newTime;
}

// calculates the current time and difference in time in minutes from when the first voting website was launched //
var curTime = new Date;
diffTime = ((curTime.getTime() - Date.parse(localStorage["newTime"])) / 60000);

// auto-closes sites that were already deemed to be voted //
if(document.getElementsByTagName('body')[0].innerHTML.indexOf("You have voted") != -1) {
    window.close()
}

// prompts the user for an account name, and puts it into the local Storage on the web browser, which can be cleared at any time, this only occurs if the user has never putted an account name before //
if ((localStorage["HotName"] === "null" || isNaN(localStorage["HotName"])) && location.pathname !== "/vote/jag/vote.php" && location.pathname !== "/vote/top200/vote.php" && location.pathname !== "/vote/ups/vote.php" && location.pathname !== "/vote/topg/vote.php") {
    r_vote = prompt("Enter your account name that you wish to automatically vote with on this page.", "");
    localStorage["HotName"] = r_vote;
    if (r_vote !== null && localStorage.getItem("HotName") === undefined) {
        localStorage["HotName"] = r_vote;
    }
};


// populates all fields with the account name //
$('.form-control').val(localStorage["HotName"]);

// the first website requires a difference of 12 hours since last launch to be launched again //
if (diffTime > 721) { setTimeout(function(){ $("#content form:nth-child(2) button:submit").click(); }, 2000) };

// subsequent voting sites are clicked with a 1 second delay //
 setTimeout(function(){ $("#content form:nth-child(3) button:submit").click(); }, 4000);
 setTimeout(function(){ $("#content form:nth-child(4) button:submit").click(); }, 5000);
 setTimeout(function(){ $("#content form:nth-child(5) button:submit").click(); }, 6000);
 setTimeout(function(){ $("#content form:nth-child(6) button:submit").click(); }, 7000);
setTimeout(function(){ localStorage["HotName"] = r_vote; }, 8000);

// reload the page to launch to the voting sites every 6 hours if necessary //
if (location.pathname == "/ms/?base=main&page=vote") {
setTimeout(function(){
   window.location.reload(1);
    }, 21600000) }; 

// store the rounded calculated difference in time for reference //
localStorage["diffTime"] = Math.round(diffTime);