Under PPS Restart Script

restarts game automatically when you go too slow

Από την 07/02/2020. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το 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         Under PPS Restart Script
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  restarts game automatically when you go too slow
// @author       Oki
// @match        https://*.jstris.jezevec10.com/*
// @grant        none
// ==/UserScript==

/**************************
  Under PPS Restart Script         
**************************/
(function() {
    window.addEventListener('load', function(){

localStorage.restartOption = localStorage.restartOption || "0";
localStorage.restartThreshold = localStorage.restartThreshold || "0";

var pbOption = document.createElement("table");
pbOption.innerHTML = `<tbody><tr><td><input name='group'onclick="localStorage.restartOption=0"id='soundPPS'type="radio"><label for="soundPPS">Play a sound</label></td><td><input onclick="localStorage.restartOption=1" id='restartPPS' name='group' type="radio"><label for="restartPPS">Restart the run</label></td></tr><tr><td colspan="2"><span>when PPS goes below <input oninput='localStorage.restartThreshold=this.value'id='threshold'style="width:50px"></span></td></tr></tbody><br>`
tab_other.appendChild(pbOption)

document.getElementsByName("group")[+localStorage.restartOption].checked = 1
threshold.value = localStorage.restartThreshold

var trim=a=>{a=a.slice(0,-1);a=a.substr(a.indexOf("{")+1);return a}
if(typeof getParams != "function"){var getParams=a=>{var params=a.slice(a.indexOf("(")+1);params=params.substr(0,params.indexOf(")")).split(",");return params}}


function afterRoundStart() {
    window.soundAlreadyPlayed = false;
}

var placeBlockFunc = Game['prototype']["startReadyGo"].toString()
placeBlockFunc =  trim(placeBlockFunc) + trim(afterRoundStart.toString())
Game['prototype']["startReadyGo"] = new Function(placeBlockFunc);



function afterPlaceBlock() {

if(0<threshold.value&&this['clock']>5){
	if(this['getPPS']()<+threshold.value&&0!=this['getPPS']()){
		if(document.getElementsByName("group")[0].checked&&+localStorage.SE){
			var a=new Audio("https://jstris.jezevec10.com/res/se0/fault.wav");
			if(vol=document.getElementById("vol-control").value)
				a.volume=vol/100;
			if(!soundAlreadyPlayed) {
				a.play()
				soundAlreadyPlayed = true;
			}
		}
		else {
            this.GameOver();
            this['startPractice'](1)
		}
	}
};

};



var placeBlockFunc = Game['prototype']["placeBlock"].toString()
var params2 = getParams(placeBlockFunc)
placeBlockFunc =  trim(placeBlockFunc) + trim(afterPlaceBlock.toString())
Game['prototype']["placeBlock"] = new Function(...params2, placeBlockFunc);


    });
})();