powerline.io

Replaces inline JS on powerline.io

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το 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         powerline.io
// @namespace    http://tampermonkey.net/
// @version      0.7
// @description  Replaces inline JS on powerline.io
// @author       Shaun Mitchell <guy#4962>
// @match        *://powerline.io/*
// @grant        unsafeWindow
// @run-at       document-start
// ==/UserScript==

var evilJSRegex = /SpaceWars/;
var replacementJSUrl = "http://test.shitchell.com/powerline/custom.js";

function removeInlineJS(e) {
    if (evilJSRegex.test(e.target.innerText)) {
        // Stop the default JS from running
        e.stopPropagation();
        e.preventDefault();

        // Create a new script tag for our custom JS
        var awesomeJS = document.createElement("script");
        awesomeJS.type = "text/javascript";
        awesomeJS.src = replacementJSUrl;

        // Replace the old JS with our custom shiznit
        var parentNode = e.target.parentNode;
        parentNode.removeChild(e.target);
        parentNode.appendChild(awesomeJS);

        // Remove the event listener
        unsafeWindow.removeEventListener("beforescriptexecute", removeInlineJS, true);
    }
}

(function() {
    'use strict';
    Object.defineProperty(unsafeWindow, "debug", {
        get: function() {
            return true;
        },
        set: function(x) {
            console.log("Cannot change value of debug variable.");
        }
    });

    unsafeWindow.addEventListener("beforescriptexecute", removeInlineJS, true);
})();