User:Edward.81/vector.js

From Team Fortress Wiki
Jump to: navigation, search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
var intcodes =["ru","fr","de","pl","pt-br","fi","es","nl","zh-hans","zh-hant","ar","cs","da","hu","it","ja","ko","no","pt","ro","sv","tr"];
if (!Array.prototype.indexOf) {
  Array.prototype.indexOf = function(elt /*, from*/) {
    var len = this.length;

    var from = Number(arguments[1]) || 0;
    from = (from < 0)
         ? Math.ceil(from)
         : Math.floor(from);
    if (from < 0){
      from += len;
    }
    for (; from < len; from++) {
      if (from in this && this[from] === elt){
        return from;
      }
    }
    return -1;
  };
}




//location.href.lastIndexOf("/");
//location.href.length

var loc = location.href.substring(location.href.lastIndexOf("/")+1,location.href.length);

if (intcodes.indexOf(loc)){
    x = document.getElementById('n-mainpage-description').children[0];
    x.href = x.href + "/" + intcodes[loc];
}