Last active
February 9, 2021 07:17
-
-
Save kuanyui/532fc8fbd14992ef7a2dce42cebca774 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Always English in Mozilla Doc | |
// @version 1 | |
// @grant none | |
// @match https://developer.mozilla.org/* | |
// @run-at document-start | |
// ==/UserScript== | |
const matched = location.pathname.match(/[/](.*)[/]docs[/]/) | |
if (matched && | |
document.referrer && | |
!document.referrer.startsWith('https://developer.mozilla.org/')) { | |
const pathname = location.pathname.replace(new RegExp(`^/${matched[1]}/`, 'gi'), '/en/') | |
location.replace(pathname) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment