Skip to content

Instantly share code, notes, and snippets.

@silvasur
Last active December 12, 2023 04:51
Show Gist options
  • Save silvasur/227c01524ffa5eeff74032d95fff8cc5 to your computer and use it in GitHub Desktop.
Save silvasur/227c01524ffa5eeff74032d95fff8cc5 to your computer and use it in GitHub Desktop.
Userscript to hide Wikipedia donation nagscreen
// ==UserScript==
// @name Hide wikipedia donation nagscreen
// @description Wikimedia, I already give you money, leave me alone!
// @version 3
// @grant GM.setValue
// @grant GM.getValue
// @match https://*.wikipedia.org/*
// ==/UserScript==
(async function() {
console.log("hello")
var styles = `
.cn-fundraising, .cn-frthankyou {
display: none;
}
#mw-page-base {
padding-top: 0 !important;
}
#mw-head {
top: 0 !important;
}
#mw-panel {
top: 0 !important;
}
`
let agreed = await GM.getValue("agreed");
console.log(agreed);
if (agreed === undefined) {
agreed = confirm("This userscript is meant for people who already donate regularly to Wikipedia. Do you donate regularly or promise to do so?")
await GM.setValue("agreed", agreed);
}
if (!agreed)
return;
document.head.appendChild((function(){
let s = document.createElement("style");
s.innerText = styles;
return s;
})());
})();
@silvasur
Copy link
Author

Had the time ro investigate now, and have changed it from @include to @match.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment