Skip to content

Instantly share code, notes, and snippets.

@Maartyl
Last active June 8, 2021 03:46
Show Gist options
  • Save Maartyl/ac842d7c8a7876dc09b43396d98dc954 to your computer and use it in GitHub Desktop.
Save Maartyl/ac842d7c8a7876dc09b43396d98dc954 to your computer and use it in GitHub Desktop.
tampermonkey script to replace wikiwand extension, which slows down browser: this works /almost/ as good, with just a small delay and doesn't slow down anything but loading of wiki pages
// ==UserScript==
// @name wikiwand
// @namespace maa
// @description like wikiwand plugin, but cheaper
// @include https://*.wikipedia.org/wiki/*
// @run-at document-start
// @version 1
// @grant none
// @noframes
// ==/UserScript==
(function(){
const domains = window.location.host.split('.'); // en.wikipedia.org
if (domains[0] === "www") domains.shift();
const lang = domains.length <= 2 ? 'en' : domains[0];
const base = 'https://www.wikiwand.com/' + lang + '/';
const article = location.pathname.replace('/wiki/','');
const hash = location.hash;
const url = (base + article + hash);
location.href = url;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment