User:Equazcion/switch.js

if ($('.infoExpert').length > 0){ $('.statTitle').remove; var $infoNormal = $('.infoNormal'); var $infoExpert = $('.infoExpert'); var $switchNormal = $('.switchNormal').append('[Normal]'); var $switchExpert = $('.switchExpert').append('[Expert]'); $switchNormal.css('font-weight','bold').css('color','#063B5E'); $switchExpert.css('font-weight','200').css('color','#063B5E');

var stats = ['Life', 'Money', 'Damage', 'Knockback', 'AI', 'Defense', 'Stack', 'Power', 'Drops'];

$('.switchNormal').click(function{   	$.each($('.infoNormal'), function(key, value){ var NPCname = $(this).data('npcname'); $.each(stats, function(data, stat){	       	var npcSelect = '[data-npcname="'+NPCname+'"]';	            if ($('.expert' + stat + npcSelect).length > 0){	            	var expValue = $('.expert' + stat + npcSelect).html;	            	var normValue = $('.normal' + stat + npcSelect).html;	            	$('.normal' + stat + npcSelect).html(expValue).css('background','#D7EEFD');	            	$('.expert' + stat + npcSelect).html(normValue);	            }	        }); $switchNormal.css('font-weight','bold'); $switchExpert.css('font-weight','200'); });   });    $('.switchExpert').click(function{    	$.each($('.infoNormal'), function(key, value){ var NPCname = $(this).data('npcname'); $.each(stats, function(data, stat){	       	var npcSelect = '[data-npcname="'+NPCname+'"]';	            if ($('.expert' + stat + npcSelect).length > 0){ 	            	var expValue = $('.expert' + stat + npcSelect).html;	            	var normValue = $('.normal' + stat + npcSelect).html;	            	$('.normal' + stat + npcSelect).html(expValue).css('background','#FFE6E6');	                $('.expert' + stat + npcSelect).html(normValue);	            }	        }); $switchNormal.css('font-weight','200'); $switchExpert.css('font-weight','bold'); });	}); }