Glowslinging hotkey script

Use 1-5 to select an attack, 1-5 or f to begin a fight or duel again

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

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το 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           Glowslinging hotkey script
// @namespace      Conster
// @description    Use 1-5 to select an attack, 1-5 or f to begin a fight or duel again
// @version        1.2
// @history	   1.2 New domain - animecubedgaming.com - Channel28
// @history        1.1 Now https compatible (Updated by Channel28)
// @include        http*://*animecubed.com/billy/bvs/billycon-glowslingfight.html
// @include        http*://*animecubed.com/billy/bvs/billycon-glowslinging.html
// @include        http*://*animecubed.com/billy/bvs/billycon-register.html
// @include        http*://*animecubedgaming.com/billy/bvs/billycon-glowslingfight.html
// @include        http*://*animecubedgaming.com/billy/bvs/billycon-glowslinging.html
// @include        http*://*animecubedgaming.com/billy/bvs/billycon-register.html
// @grant          none
// ==/UserScript==

function process_event(event) {
	if (event.keyCode>=49 && event.keyCode<=53) {		//1-5
		if (document.forms.namedItem( "startsling2" ) ) {
			document.forms.namedItem("startsling2").submit();
		} else if (document.forms.namedItem( "slingact" ) ) {
			var pickthis = event.keyCode-49;
			var str = "//input [@id='gslact"+pickthis+"']";
			var v = document.evaluate(str, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
			v.snapshotItem(0).checked = true;
			document.forms.namedItem("slingact").submit();
		} else if (document.forms.namedItem( "goslinag" ) ) {
			document.forms.namedItem("goslinag").submit();
		} else if (document.forms.namedItem( "gosling" ) ) {
			document.forms.namedItem("gosling").submit();
		} else if (document.forms.namedItem( "glowsling" ) ) {
			document.forms.namedItem("glowsling").submit();
		}
	} else if (event.keyCode==70) {	//f
		if (document.forms.namedItem( "startsling2" ) ) {
			document.forms.namedItem("startsling2").submit();
		} else if (document.forms.namedItem( "slingact" ) ) {
			document.forms.namedItem("slingact").submit();
		} else if (document.forms.namedItem( "goslinag" ) ) {
			document.forms.namedItem("goslinag").submit();
		} else if (document.forms.namedItem( "gosling" ) ) {
			document.forms.namedItem("gosling").submit();
		} else if (document.forms.namedItem( "glowsling" ) ) {
			document.forms.namedItem("glowsling").submit();
		}
	}
}

window.addEventListener("keyup", process_event, false);