Skip to content

Instantly share code, notes, and snippets.

@mad
Created December 22, 2011 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mad/1510823 to your computer and use it in GitHub Desktop.
Save mad/1510823 to your computer and use it in GitHub Desktop.
// ==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