Twilight Heroes Autobox

This script adds a button for getting and equipping black box in the web game Twilight Heroes.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name            Twilight Heroes Autobox
// @description     This script adds a button for getting and equipping black box in the web game Twilight Heroes.
// @namespace       Twilight Heroes
// @match           https://www.twilightheroes.com/criminology.php*
// @match           https://twilightheroes.com/criminology.php*
// @match  	        https://www.twilightheroes.com/main.php*
// @match  	        https://twilightheroes.com/main.php*
// @version         2
// @history         v2: The script broke when the game switched over to HTTPS. v2 fixes this issue. also replaced include with match for wider compatibility
// @history         v1: Initial script by Heather Robinson, whose scrips can be found here https://userscripts-mirror.org/users/110369
// ==/UserScript==

function zz(){
	var t='https://'+location.host+'/criminology.php';
	localStorage.setItem('gfb','true');
	location.href=t;}

if(/main/.exec(location.href)){
	var c=document.getElementsByTagName('center')[0];
	var b=document.createElement('button');
	b.innerHTML='Get & Equip Black Box';
	c.parentNode.insertBefore(b,c);
	b.addEventListener('click',zz,true);}
else if(localStorage.getItem('gfb')){
	var a=document.getElementsByTagName('form');
	if(a.length>3)
		a[2].submit();
	else{
		a=document.getElementsByTagName('a')[0];
		localStorage.removeItem('gfb');
		location.href=a.href;}}