NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Clean Wikipedia
// @namespace http://tampermonkey.net/wikipedia
// @version 0.4
// @description Remove citations and links and make it easy to copy paste content
// @author navchandar
// @match https://en.wikipedia.org/wiki/*
// @match https://*.wikipedia.org/wiki/*
// @match http://*.wikipedia.org/wiki/*
// @run-at document-end
// @license MIT
// @grant none
// @updateURL https://openuserjs.org/meta/navchandar/Clean_Wikipedia.meta.js
// @downloadURL https://openuserjs.org/install/navchandar/Clean_Wikipedia.user.js
// @homepage https://navchandar.github.io/
// @homepage https://github.com/navchandar/
// @homepageURL https://navchandar.github.io/
// @contributionURL https://paypal.me/navchandar
// @contributionAmount $1.00
// @copyright 2021, navchandar (https://openuserjs.org/users/navchandar)
// @icon https://en.wikipedia.org/static/favicon/wikipedia.ico
// ==/UserScript==
function has(String, search) {
try {
if (String.indexOf(search) > -1) {
return true;
}
}
catch (err) {}
return false;
}
function removeCitations() {
var elems = document.getElementsByTagName('sup');
for (var i = 0; i < elems.length; i++) {
var elem = document.getElementsByTagName('sup')[i];
if (elem != null) {
elem.remove();
}
}
}
function cleanLinks() {
const links = document.getElementsByTagName('a')
for (var a of links) {
if (a.href && !has(a.className, 'image') && !has(a.className, 'logo') && !has(a.className, 'external')) {
if (!has(a.href, 'jpg') && !has(a.href, 'png') && !has(a.href, 'svg') && !has(a.href, 'jpeg')) {
const el = document.createElement('span')
el.textContent = a.textContent
a.parentNode.replaceChild(el, a)
}
}
}
}
(function () {
'use strict';
document.onreadystatechange = function () {
if (document.readyState == "complete") {
setInterval(cleanLinks, 1000);
setInterval(removeCitations, 1000);
}
}
})();