Created
August 7, 2015 22:09
-
-
Save Capaverde/0b1e812c5ed6afeb58dd to your computer and use it in GitHub Desktop.
De Volta Ao Papo-Cabeça
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name De Volta Ao Papo-Cabeça | |
// @namespace http://forum.jogos.uol.com.br/ | |
// @description De Volta Ao Papo-Cabeça | |
// @version 1 | |
// @grant none | |
// @run-at document-start | |
// ==/UserScript== | |
function starting(e) { | |
var firstScript = e.target; | |
if (/window.location/.test(firstScript.textContent)){ | |
var newScript = document.createElement('script'); | |
newScript.innerHTML = removeRedirect(firstScript.innerHTML); | |
e.stopPropagation(); | |
e.preventDefault(); | |
firstScript.parentNode.insertBefore(newScript, firstScript.nextSibling); | |
firstScript.parentNode.removeChild(firstScript); | |
} | |
} | |
document.addEventListener("beforescriptexecute", starting, true); | |
function removeRedirect(s){ | |
var t = s.split('\n'); | |
for (var i = 0; i < t.length; i++){ | |
var line = t[i]; | |
if (line.indexOf("window.location")!=-1){ | |
t[i] = ";"; | |
} | |
} | |
s2 = t.join("\n") | |
return s2; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment