Skip to content

Instantly share code, notes, and snippets.

@kuanyui
Last active February 9, 2021 07:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kuanyui/532fc8fbd14992ef7a2dce42cebca774 to your computer and use it in GitHub Desktop.
Save kuanyui/532fc8fbd14992ef7a2dce42cebca774 to your computer and use it in GitHub Desktop.
// ==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