User:Lexar/sandbox/Page.js

From Team Fortress Wiki
< User:Lexar‎ | sandbox
Revision as of 06:01, 4 July 2015 by Lexar (talk | contribs)
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.
//my js page for general screwin around
$('head').append('<link href="https://dl.dropboxusercontent.com/u/32668357/wiki_stuff/tempres/style.css" rel="stylesheet" type="text/css" />');
var WeaponGradesTable = {
	tabSwitch: function(th,tab,weapons,weapon) {
		if (!th.hasClass('current')) {
			var tabIndex = th.index();
			th.parent().find('.current').removeClass('current');
			th.addClass('current');
			weapons.find('.current').removeClass('current');
			weapon.eq(tabIndex).addClass('current');
		}
	},
	init: function() {
		var container = $('.weapon-grade-table');
		container.each(function(){
			var th = $(this), tabs = th.children('.tabs'), tab = tabs.children('li'), weapons = th.children('.weapons'), weapon = weapons.children('li');
			tab.first().addClass('current');
			weapon.first().addClass('current');
			tab.click(function(){WeaponGradesTable.tabSwitch($(this),tab,weapons,weapon);});
		});
		//
	}
};
$(WeaponGradesTable.init);