Skip to content

Instantly share code, notes, and snippets.

@matheusfaustino
Last active July 22, 2017 14:04
Show Gist options
  • Save matheusfaustino/318df292843e25d71346082f8f8f938e to your computer and use it in GitHub Desktop.
Save matheusfaustino/318df292843e25d71346082f8f8f938e to your computer and use it in GitHub Desktop.
php.net always in English (UserScript)
// ==UserScript==
// @name php.net always in English
// @namespace php.net.english
// @author matheusfaustino
// @description set always english for php.net
// @include *php.net/manual/*/*
// @exclude *php.net/manual/en/*
// @version 1
// @grant none
// ==/UserScript==
var regexEn = new RegExp('en\/.+', 'i');
var formChangeLang = document.getElementById('changelang');
var selectChangeLang = document.getElementById('changelang-langs');
var englishValue = '';
for(i = 0; i < selectChangeLang.options.length && !englishValue; i++)
if (regexEn.test(selectChangeLang.options[i].value)) {
englishValue = selectChangeLang.options[i].value;
}
// use window.replace here. Works better with back button browser
selectChangeLang.value = englishValue;
formChangeLang.submit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment