Skip to content

Instantly share code, notes, and snippets.

@RikerW
Last active June 11, 2016 18:01
Show Gist options
  • Save RikerW/5041037ae04e1d28c6f001243b4a256a to your computer and use it in GitHub Desktop.
Save RikerW/5041037ae04e1d28c6f001243b4a256a to your computer and use it in GitHub Desktop.
'use strict';
// ==UserScript==
// @name TF2 Wiki Englishifier
// @namespace Riker Wachtler
// @version 1.2
// @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.
(function () {
'use strict';
extension = ""; // Set to "/es" for spanish, "/zh-hant" for chinese, etc. Make sure to include the / though. (i.e. `... = "/es";`)
if (window.location.href.replace(/(wiki\/.+?)\/.+/, "$1") != window.location.href) {
window.open(window.location.href.replace(/(wiki\/.+?)\/.+/, "$1" + extension), "_self");
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment