button for me tetr.js short

20-07-25

Version au 24/07/2020. Voir la dernière version.

// ==UserScript==
// @name         button for me tetr.js short
// @namespace    http://tampermonkey.net/
// @version      1.0
// @author       ore100
// @description  20-07-25
// @match        http://farter*/t*
// @match        http*://*/tetr.js*
// @match        https://doktorocelot.com/tetr.js/
// @grant        none
// ==/UserScript==


(function() {
    window.addEventListener('load', function(){

settings = `
p"122"47"70"22 // ⇓⥙⥕
c"115"47"69"22 // ↷
w"142"22"69"22 // ↶
r"-181"-20"69"22 // →
l"-59"-20"70"22 // ←
d"120"-111"69"22 // ↓
h"-132"-118"69"22 // ⇄
o"-36"-80"69"22 // ⟳ 180°
`
lines = settings.split("\n")
ids = ["", "touchDrop", "touchRotRight", "touchRotLeft", "touchRight", "touchLeft", "touchDown", "touchHold", "touchRot180"]

for (var i = 0; i < lines.length; i++) {
    if(lines[i]){
        pos = lines[i].split("\"")
        x = document.getElementById(ids[i]).style
        x.marginLeft= pos[1] + "px";
        x.marginTop= pos[2] +"px";
        x.maxWidth= pos[3] + "px";
        x.paddingBottom= pos[4] + "px";
        x.backgroundColor="#777";
        console.log(x)
    }
}
});
})();