Skip to content

Instantly share code, notes, and snippets.

@ajhsu
Last active February 1, 2019 06:45
Show Gist options
  • Save ajhsu/5bc193ee8f89f5dd6f85daa9c12e861d to your computer and use it in GitHub Desktop.
Save ajhsu/5bc193ee8f89f5dd6f85daa9c12e861d to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Wikipedia Redirection
// @version 0.0.1
// @author AJ Hsu <im.ajhsu@gmail.com>
// @match https://zh.wikipedia.org/wiki/*
// @grant none
// ==/UserScript==
window.addEventListener('load', function handleLoaded() {
window.removeEventListener('load', handleLoaded);
const englishAnchor = document
.querySelector('li.interlanguage-link.interwiki-en')
.querySelector('a');
const span = document.createElement('span');
span.classList.add('mw-editsection');
span.appendChild(englishAnchor);
document.querySelector('h1#firstHeading').appendChild(span);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment