Gamdom Rain Notifier

WORKABLE, NO BAN, NO MINER

目前为 2018-03-08 提交的版本。查看 最新版本

// ==UserScript==
// @name        Gamdom Rain Notifier
// @description WORKABLE, NO BAN, NO MINER
// @namespace   https://greasyfork.org/users/173937
// @include     *://greasyfork.org/*
// @version     0.1.0
// @grant       GM_xmlhttpRequest
// @grant       GM_notification
// @grant       GM_info
// @connect     gamdomrain.com
// ==/UserScript==

(function(){
	console.log("start playing the game");
	main();
	GM_notification({
		title: info() + " starts..",
		text: "The script starts working, just leave this page open, and you'll get all notifications",
		highlight: true,
		timeout: 15e3,
	});
})();
function notify(r)
{
	if( r && r == 4 )
	GM_notification({
		title: "[" + info() + "]: IT IS RAINING!",
		text: "GO TO GAMDOM.COM AND CHASE IT",
		highlight: true,
		timeout: 5e3,
	});
	console.log("grn..", (Date.now() - time)/1e3, "sec", r == 4 ? "it's raining!" : "");
}
function info(){return GM_info.script.name + " v" + GM_info.script.version;}
function dmail(details)
{
	return new Promise(function(resolve, reject){
		details.method = details.method || "GET";
		details.onload = function(r){
			if( r.status != 200 )
				reject(r.statusText);
			else
				resolve(r.response);
		};
		var h = details.headers = {};
		h.referer = details.url.replace(/(https?\:)\/\/([^\/\?\#]+)([^\?\#]+)/, '$1//$2/detector');
		GM_xmlhttpRequest(details);
	});
}
function get(){url().then(dmial).then(len).then(notify);}
function dmial(u){return dmail({url: u});}
function len(a){return a.length;}
async function url(){return "https://www.gamdomrain.com/voteme/dcomics.php";}
function main(){time = Date.now(); setInterval(get, 1e4); console.log("just for lulz =)");}