Last active
July 22, 2017 14:04
-
-
Save matheusfaustino/5f3582e234f3d142ff8df2db4ce4f472 to your computer and use it in GitHub Desktop.
Mozilla Dev Website Always Eng (UserScript)
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 Mozilla Dev Website Always Eng | |
// @namespace mozilla.dev.docs.always.eng | |
// @author matheusfaustino | |
// @description Always change the language of mozilla docs to English | |
// @include https://developer.mozilla.org/*/docs/* | |
// @exclude https://developer.mozilla.org/en*/docs/* | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
function changeToEnglish() { | |
let languages = [].slice.call(document.querySelectorAll('#languages-menu-submenu ul li a')); | |
let english_url = ''; | |
for(let i=0; i < languages.length && !english_url; i++) | |
if (languages[i].getAttribute('href').indexOf('en-US') != -1) | |
english_url = languages[i].getAttribute('href'); | |
window.location.replace(english_url); | |
} | |
document.addEventListener('DOMContentLoaded', () => changeToEnglish() ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment