PT Auto Thanks

Auto thanks in TTG and NexusPHP.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @id             PT_Auto_Thanks@jiayiming
// @name           PT Auto Thanks
// @version        1.2
// @namespace      jiayiming
// @author         jiayiming
// @description    Auto thanks in TTG and NexusPHP. 
// @include        http://ttg.im/t/*/
// @include        http://*details.php*
// @run-at         document-end
// ==/UserScript==


(function() {

	function $(css, contextNode) {
		return (contextNode || document).querySelector(css);
	}

	function Thanks() {
		var url = location.href;
		var btn = '';

		if (url.indexOf('ttg') > 0) {
			btn = $('#ajaxthanks');
		} else if (url.indexOf('details') > 0) {
			btn = $('#saythanks');
		}
		if (btn != undefined && btn.disabled != true) {
			//alert(url);
			//btn.onclick = undefined;
			btn.click();
		}
	}

	window.addEventListener('load', Thanks(), false);
})();