-
-
Save ConorOBrien-Foxx/ebb21bcafddf00ab98c8bb361646e19a 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 TF2 Wiki Englishifier | |
// @namespace Riker Wachtler | |
// @version 1.1 | |
// @description Redirects a non-English TF2 Wiki page to the English one. | |
// @author You | |
// @match https://wiki.teamfortress.com/wiki/* | |
// @grant none | |
// ==/UserScript== | |
// When linked to a TF2 Wiki pages that isn't in english (i.e. "...wiki/Rocket_Launcher/cs") redirects to the english version (i.e ".../wiki/Rocket_Launcher"). | |
// Makes the random page button more useful. | |
// Set the extension var (TODO: get from cookie) to choose the specific language. | |
extension = ""; // Set to "/es" for spanish, "/zh-hant" for chinese, etc. Make sure to include the / though. (i.e. `... = "/es";`) | |
(function() { | |
'use strict'; | |
function init(){ | |
if (window.location.href.replace(/(wiki\/.+?)\/.+/, "$1") != window.location.href){ | |
window.open(window.location.href.replace(/(wiki\/.+?)\/.+/, ("$1" + extension),"_self")); | |
} | |
} | |
document.body.addEventListener("load", init(), false); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment