MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
(StatCalc update)
No edit summary
Line 297: Line 297:
function equipmentChange (statTable, toggleSlot){
function equipmentChange (statTable, toggleSlot){
toggleSlot = (typeof toggleSlot !== 'undefined') ? toggleSlot : false //default false, ES5 does not support function defaults
toggleSlot = (typeof toggleSlot !== 'undefined') ? toggleSlot : false //default false, ES5 does not support function defaults
//console.log('changing equipment in table '+statTable.attr('id'));
console.log('changing equipment in table '+statTable.attr('id'));


//console.log(toggleSlot);
console.log(toggleSlot);
if (toggleSlot) {
if (toggleSlot) {
var item_slot = statTable.find(".equipment-"+toggleSlot);
var item_slot = statTable.find(".equipment-"+toggleSlot);
Line 314: Line 314:
weapon[statTable.attr('id')].rarity = (rarity > 5) ? rarity-5 : 0;
weapon[statTable.attr('id')].rarity = (rarity > 5) ? rarity-5 : 0;
statTable.find(".stattable-rarity-selector").children().each(function(index){
statTable.find(".stattable-rarity-selector").children().each(function(){
($(this).attr('data-rarity') <= rarity) ? $(this).addClass('active').removeClass('inactive') : $(this).addClass('inactive').removeClass('active');
($(this).attr('data-rarity') <= rarity) ? $(this).addClass('active').removeClass('inactive') : $(this).addClass('inactive').removeClass('active');
});
});