Created
December 22, 2011 16:08
-
-
Save mad/1510823 to your computer and use it in GitHub Desktop.
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 Hide banner in wikipedia | |
// @namespace wikipedia.org/ | |
// @include http://*.wikipedia.org/* | |
// @match http://*.wikipedia.org/* | |
// ==/UserScript== | |
if (typeof hideBanner == "function") { | |
console.log("hiding banner"); | |
hideBanner(); | |
} | |
// thx http://stackoverflow.com/questions/2246901/how-can-i-use-jquery-in-greasemonkey-scripts-in-google-chrome | |
function addJQuery(callback) { | |
var script = document.createElement("script"); | |
script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"); | |
script.addEventListener('load', function() { | |
var script = document.createElement("script"); | |
script.textContent = "(" + callback.toString() + ")();"; | |
document.body.appendChild(script); | |
}, false); | |
document.body.appendChild(script); | |
} | |
// remove SOPA banner | |
// XXX: check for en.wikipedia.org url? | |
addJQuery(function() { | |
setTimeout(function() { | |
if ($("#mw-sopaOverlay").length != 0) { | |
$("*").show(); | |
$("#mw-sopaOverlay").hide(); | |
} | |
}, 500); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment