Skip to content

Instantly share code, notes, and snippets.

@ConorOBrien-Foxx
Forked from RikerW/tf2wiki.user.js
Created June 11, 2016 02:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ConorOBrien-Foxx/ebb21bcafddf00ab98c8bb361646e19a to your computer and use it in GitHub Desktop.
Save ConorOBrien-Foxx/ebb21bcafddf00ab98c8bb361646e19a to your computer and use it in GitHub Desktop.
// ==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