Gamdom Rain Notifier Library

Library for my Gamdom Rain Notifier script

Ce script ne devrait pas être installé directement. C'est une librairie créée pour d'autres scripts. Elle doit être inclus avec la commande // @require https://update.greasyfork.org/scripts/39350/600414/Gamdom%20Rain%20Notifier%20Library.js

// ==UserScript==
// @name        Gamdom Rain Notifier Library
// @description Library for my Gamdom Rain Notifier script
// @namespace   https://greasyfork.org/users/173937
// @author      Boris Britva
// @version     1.11.0
// ==/UserScript==

window.GM_notification = window.GM_notification || function(options)
{
	try{
	var s = Notification.permission !== "granted" ? Notification.requestPermission() : Promise.resolve("granted");
	s.then(function(permission){
		if( permission === "granted" )
		{
			var n = new Notification(options.title, {body: options.text, icon: image()});
			setTimeout(function(){n.close();}, options.timeout);
		}
	});
	}catch(e){}
};
function notify_resume()
{
	GM_notification({
		title: info() + " starts..",
		text: "Just leave this page open, and you'll get all notifications. Press S key to stop recieving notifications",
		highlight: true,
		image: image(),
		timeout: 5e3,
	});
}
function notify_stop()
{
	GM_notification({
		title: info() + " stoped..",
		text: "Press R key to start recieving notifications",
		highlight: true,
		image: image(),
		timeout: 5e3,
	});
}
function notify(r)
{
	return !!r ? (GM_notification({
		title: "[" + info() + "]: IT IS RAINING!",
		text: "GO TO GAMDOM.COM AND CHASE IT",
		highlight: true,
		image: image(),
		timeout: 5e3,
	}), console.log("grn..", (Date.now() - time)/1e3, "sec, it's raining!, date: ", new Date()), !0) : !1;
}
console.log("start time: ", new Date());
function silent_stop(){clearInterval(timer); timer = -2;console.log("grn.. silent stop");}
function silent_resume(){timer = setInterval(get, 1e4);console.log("grn.. silent resume");}
function block(t)
{
	if(t)
	{
		silent_stop();
		btimer = setTimeout(silent_resume, 6e4);
	}
	return t;
}
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 = details.headers || {};
		h.Referer = details.href || detector(details.url);
		if( checkDets(details) )
		{
			GM_xmlhttpRequest(details);
			//console.log("ajax details: ", details);
		}else{
			var er = {msg: "error in request's details", details: extend({}, details) };
			checkH(er);
			reject(er);
		}
	});
}
function checkDets(dets)
{
	var h, u = dets.url;
	if( !(h = dets.headers) ) return !1;
	else if( h["Referer"].indexOf( detector(u) ) == -1 ) return !1;
	else if( h["Accept"] != "*/*" || h["X-Requested-With"] != "XMLHttpRequest" ) return !1;
	else if( dets.url.indexOf(uri(u)) == -1 ) return !1;
	else return !0;
}
function get(){url().then(dmial).then(checkR).then(len).then(notify).then(playback).then(block).catch(error);}
function dmial(u){return typeof u == "string" ? dmail({url: u}) : dmail(u);}
function len(a){console.log("r: ", a); a = a || ""; return (/true/i.test(a) && !/false/i.test(a));}
function main()
{
	if( location.hostname.indexOf("gamdom") != -1 )
		return mimic();
	console.log("start playing the game");
	yourlifeisntboring();
	timer = btimer = -1;
	instruction();
	window.addEventListener("message", recieve);
	window.addEventListener("keydown", function(e){
		var c = String.fromCharCode(e.keyCode || e.which).toUpperCase();
		if( c == 'I' )
			createDiv();
	});
}
function instruction()
{
	var isReg = GM_getValue("isReg", null);
	if( isReg ) return;
	GM_setValue("isReg", false);
	createDiv();
}
function createDiv()
{
	var div = document.querySelector("#instruction-div");
	if( div )
	{
		div.style.display = "initial";
		return;
	}
	div = document.createElement("div");
	var html = '';
	html += '' +
	'<div style="position:absolute; top: 0; width: 100%; height: 30px; font-weight: bold; background-color: #a0a0a0;">' +
		'<span style="margin:5px 0 0 5px;">Instructions</span>' +
	'</div>' +
	'<div style="position:absolute; top: 30px; bottom: 30px; width: 100%; overflow-y: auto;">' +
		'<ol>' +
			'<li> Register on the server: https://www.gamdomrain.com. It requires e-mail. Don\'t use your regular/main e-mail address for security reasons</li>' +
			'<li> Login on the server, don\'t forget to check "Remember me"</li>' +
			'<li> Install <a href="https://greasyfork.org/scripts/40314-gamdom-rain-notifier-helper" title="Gamdom Rain Notifier Helper" target="_blank">Gamdom Rain Notifier Helper</a></li>' +
			'<li> Allow your browser to open popup windows from greasyfork.org</li>' +
			'<li> Open <a href="https://greasyfork.org/scripts/39315-gamdom-rain-notifier" title="Gamdom Rain Notifier">https://greasyfork.org/scripts/39315-gamdom-rain-notifier</a></li>' +
			'<li> Click "click here to start" on bottom-right - it opens popup</li>' +
			'<li> If it requires captcha on the popup window, complete captcha, close the window, and go to the step 5</li>' +
			'<li> Wait a bit before popup window closes automatically</li>' +
			'<li> Enjoy life!</li>' +
		'</ol>' +
	'</div>' +
	'<div style="position:absolute; height: 30px; bottom: 0; width: 100%; background-color: #a0a0a0;">' +
		'<button id="close-button" style="cursor:pointer;font-weight:bold;margin:5px 0 0 5px;">Close</button>' +
	'</div>' +
	'';
	div.setAttribute("style", "position:fixed; top: 10px; left: 10px; width: 50%; height: 40%; background-color: #e0e0e0");
	div.innerHTML = html;
	div.id = "instruction-div";
	document.body.appendChild(div);
	div.addEventListener("click", function(e){
		var t = e.target;
		if( t.tagName == "BUTTON" && t.id == "close-button" )
			div.style.display = "none";
	}, false);
}
function recieve(e)
{
	if(typeof e.data == "object" && e.data.t == "start" && e.origin == "https://greasyfork.org")
	{
		GM_setValue("isReg", true);
		console.log("start..");
		var d = e.data.d, i = 0;
		window.details = null;
		for(; i < d.length; ++i)
		{
			if( d[i].difs.every(function(t){return t > 7.5 && t < 12.5;}) )
				break;
		}
		if( i != d.length )
		{
			window.details = fixDets(d[i]);
			start();
		}else
			console.error("can't choose ajax details: ", d);
		window.removeEventListener("message", recieve);
	}
}
function fixDets(d)
{
	var o = {},
		p = extend({}, d.d);
	o.url = p.u;
	o.data = p.d;
	o.method = p.m;
	var h = o.headers = extend({}, p.h);
	if( h )
		h.Referer = p.r || detector(p.u);
	return o;
}
function start()
{
	hotkeys();
	time = Date.now();
	console.log("grn-details: ", window.details);
	if( window.details )
		__start();
}
function __start()
{
	checkUPD().then(function(r){
		if(r) return;
		get();
		timer = setInterval(get, 1e4);
		console.log("just for lulz =)");
		notify_resume();
	});
}
function playback(r){if(r) interval(play, 970, 3); return !!r;}
function play()
{
	if( !(audio = document.querySelector("#coin-sound")) )
	{
		var base64audio = "UklGRlQqAABXQVZFZm10IBAAAAABAAEAESsAABErAAABAAgAZGF0YTAqAAB8fX19fn9/f4CAgICAgYGBgICAgICAgICAgICAgICAgICAgICAgIB/f39/f3+AgH9/gH6CfIdeOVdkc33EyLWoo39GW2Ryc7LBqp6XfT1OWWhooL6lnJKCPkdXZmeWwaefk4tHQ1hkZ43CrKOVkVBAV2JogsGwpZaWWj5VX2l5vbSnl5dmO1VdaXO3uaeamHE6Ulxpba+9p5yXfDxOWmhqpcGon5aEQEpYZ2ibw6qilo1HR1hlZ4/FraOVk1BCV2JnhcOvpZaWWj9XYWp8v7Sll5hkPFVfanW6t6eZmG87U1xqb7K8p5uYeTxRW2lrqb+onpaDQExaaWmewqiflYpFSVlmaJPEq6GVkE1EWWRoiMOto5WUVkBXYml/wbKklZVgPVZgane7taWYlms7VF1rcbS6ppqXdjxSXGpsrL+mnZWAPk5bammgw6iflIhDSVpoaZbEqqGUjkpEWGZpi8Sto5STU0FYY2qCwrCklJRdPFZganm+taWXl2g7VF5qcra5ppqXcjtRXGptrb6nnZd9PE5aaWqkwqmgloZBSlhnaJnDqqKVjUhFWGVojsStpJWSUEBXY2mDwrCllpZaPFZfaXq/taaYmGU6VF5qc7m5p5mYcTpRW2lusL2nnZd7PE5ZaWqmwaifl4RASllnaJvDqqGVi0ZGWGZnkMWso5aRTkFXY2iGxLCllpVYPlZgaHzAtKaXl2M8VV5pdLq4p5qYbjpSW2lvs7yonJh5O09aamypwKiel4I+TFloaZ7DqqGWiURIWGZolMSso5aQS0NYZGiJw6+llpRVP1ZhaYDBsqaXll88VV5peLy2ppiYajtTXGpxtbunm5h2O1Fbamysv6idln89TVppaqLCqJ+WiEJJWWdpl8SropaOSURZZWiMxK2jlZNSQFdiaYLCsaWWllw9VmBpfL20pZeXaT5WX2tzsrWkmJVzPlRda26quaWblX1AUFxra6K+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/f39/f39/f4CAgICAgICAgICAgIB/f39/f39/gICAgIGAgICAgICAgICAgICAgICAgICAgICAgICAf39/f39/f39/f39/f39/f3+AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIB/f39/f39/f39/f39/f39/f39/f39/f3+AgICAgICAf39/f39/f39/f39/f39/f39/f39/f39/f39/gICAgICAgICAgICAgICAgICAf39/f39/f4CAgICAgICAgICAgH+Af39/f3+AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgH9/f39/f39/f39/f39/f3+AgIB/f4CAgICAf39/f39/f39/f39/f39/f39/f39/f39/f3+AgH9/f39/f4CAgICAgICAgICAgICAgICAgICAgICAgICAgH9/f39/f39/f39/f39/f39/f4CAgICAgIB/f39/f39/f39/f39/f35/f3+AgH9/f39/gICAgICAgICAgICAgICAgICAgIB/f39/f39/gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAf39/f39/f39/f39/f39/f3+AgICAgICAf39/f39/f39/f39/f39/f39/f39/f39/f3+AgICAgICAgICAgICAgICAgIB/f39/f39/f39/f3+AgICAgICAgICAgICAgICAgICAgICAgICAgH9/f39/f39/f39/f39/f39/f39/gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAf39/f39/f39/f39/f39/f39/f39/f39/f39/gICAgICAgICAgICAgICAgH9/f39/f39/f39/f39/f39/f4CAgICAgICAgICAgICAgICAgICAgICAgICAf4B/f39/f3+AgICAgICBgICAgICAgIB/f39/f39/f39/f39/f39/f39/f39/f39/f4CAgICAgICAgICAgICAgICAf39/f3+AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAf39/f39/f39/f39/f39/f39/f39/f39/f39/gICAgICAgICAgICAgICAgH9/gIB/f39/f3+AgICAgICAgICAf39/f39/gICAgICAgICAgICAgICAgICAgICAgICAgICAf39/f3+AgICAgICAf39/f39/f39/f39/gH+AgICAgIB/f39/f39/f39/f39/f39/f39/f39/f39/f4CAgICAgICAgICAf39/f39/f4CAgICAgICAgICAgICAgICAgICAgICAgICAgH9/f39/f3+AgICAgICAf38=";
		audio = document.createElement("audio");
		audio.id = "coin-sound";
		audio.style.display = "none";
		audio.src = getURL(base64ToBlob(base64audio, "audio/wav"));
		audio = document.body.appendChild(audio);
	}
	audio.load();
	audio.play();//0.979592
}
function getURL(blob){return (window.URL||window.webkitURL).createObjectURL(blob);}
function interval(func, wait, times)
{
	var interv = function()
	{
		if( typeof times === 'undefined' || times-- > 0 )
			setTimeout(interv, wait);
		try{
			func.call(null);
		}catch(e){
			times = 0;
			console.error(e);
			throw e;
		}
	};
	setTimeout(interv, wait);
}
function base64ToBlob(base64String, contentType, sliceSize )
{
	sliceSize = sliceSize || 512;
	let bytes = [];
	for(let offset = 0, chars = atob(base64String), sliceChars, sliceBytes; offset < chars.length; offset += sliceSize)
	{
		sliceChars = chars.slice(offset, offset + sliceSize);
		sliceBytes = new Array(sliceChars.length);
		for(let i = 0; i < sliceChars.length; ++i)
			sliceBytes[i] = sliceChars.charCodeAt(i);
		bytes.push(new Uint8Array(sliceBytes));
	}
	return new Blob(bytes, {type: contentType});
}
async function url(){return window.details;}
function hotkeys(){window.addEventListener('keydown', handle);}
function stop()
{
	if( timer == -2 )
		clearTimeout(btimer);// clear silent_resume timeout
	clearInterval(timer);
	timer = -1;
	notify_stop();
}
function handle(e)
{
	var d = e.keyCode || e.which,
		c = String.fromCharCode(d).toUpperCase();
	if( c == 'S' )
	{
		stop();
		console.log("grn.. stoped");
	}
	else if( c == 'R' && timer < 0 )
	{
		start();
		console.log("grn.. resumed");
	}
}
function error_notify(r)
{
	GM_notification({
		title: info() + " error, stoped",
		text: "Some error occured. Please, contact me (Boris Britva) on https://greasyfork.org/scripts/39315-gamdom-rain-notifier/feedback. Error message: \"" + r + "\"",
		highlight: true,
		timeout: 3e4,
	});
}
function error_play(){update_play();}
function checkH(r)
{
	silent_stop();
	error_play();
	error_notify(r.msg || r);
}
function checkR(r)
{
	if( !/false/i.test(r) && !/true/i.test(r) )
	{
		error_play();
		error_notify(r);
		silent_stop();
		console.error("error: ", r);
		throw new Error(r);
	}
	return r;
}
function extend(t, o)
{
	if( !o ) return {};
	t = t || {};
	for( var k in o )
	{
		if( o.hasOwnProperty(k) && o[k] !== undefined )
			t[k] = o[k];
	}
	return t;
}
function _indexOf( vec, val, pos, prop )
{
	if( prop === undefined )
		return vec.indexOf(val, (pos|| 0));
	var i = pos || 0, len = vec.length;
	i = i < 0 ? 0 : i;
	for(; i < len; ++i)
	{
		if( vec[i][prop] == val )
			return i;
	}
	return -1;
}
function image(){return "https://imgur.com/A9QVGgws.jpg";}
function detector(u){return u.replace(/(https?\:)\/\/([^\/\?\#]+)([^\#]+)/, '$1//$2/detector/');}
function uri(u){return u.replace(/(https?\:)\/\/([^\/\?\#]+)([^\#]+)/, '$1//$2/voteme/api.php?key=');}
function error(e){console.error(e);}