Forked from kuanyui/always-english-mozilla-doc.user.js
Last active
February 5, 2021 22:35
-
-
Save joeljuca/90a4977d8f6f48438145036cd2ba419f to your computer and use it in GitHub Desktop.
This file contains 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 MDN always in en-US | |
// @version 1 | |
// @grant none | |
// @match https://developer.mozilla.org/* | |
// @run-at document-start | |
// ==/UserScript== | |
(function () { | |
const url = document && document.location && document.location.host; | |
console.debug({ path }); | |
if (url !== "developer.mozilla.org") return; | |
const engLangTag = "en-US"; | |
const path = document.location.pathname; | |
console.debug({ path }); | |
if (path.substring(0, `/${engLangTag}`.length) === `/${engLangTag}`) return; | |
console.info("Changing MDN language to English"); | |
const newPath = "/" | |
.concat(engLangTag) | |
.concat(path.substring(path.split("/").filter(Boolean)[0].length + 1)); | |
console.debug({ newPath }); | |
window.location.replace(newPath); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment