Difference between revisions of "User:Lexar/sandbox/Page.js"

From Team Fortress Wiki
Jump to: navigation, search
m (naming)
m (Protected "User:Lexar/sandbox/Page.js" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
(No difference)

Revision as of 16:16, 4 July 2015

//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 WeaponWearTable = {
	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-wear-table, .weapon-wear-table-2');
		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(){WeaponWearTable.tabSwitch($(this),tab,weapons,weapon);});
		});
		//
	}
};
$(WeaponWearTable.init);