Skip to content

Instantly share code, notes, and snippets.

@Capaverde
Created August 7, 2015 22:09
Show Gist options
  • Save Capaverde/0b1e812c5ed6afeb58dd to your computer and use it in GitHub Desktop.
Save Capaverde/0b1e812c5ed6afeb58dd to your computer and use it in GitHub Desktop.
De Volta Ao Papo-Cabeça
// ==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