mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-05-28 00:01:54 +08:00
Low-risk fixes suggested by JSHint.
This commit is contained in:
committed by
Blake Grotewold
parent
2efa9f1667
commit
67b3c7fb7e
+12
-12
@@ -97,14 +97,14 @@ var Path = {
|
||||
if($SM.get('character.perks')) {
|
||||
var perks = $('#perks');
|
||||
var needsAppend = false;
|
||||
if(perks.length == 0) {
|
||||
if(perks.length === 0) {
|
||||
needsAppend = true;
|
||||
perks = $('<div>').attr('id', 'perks');
|
||||
}
|
||||
for(var k in $SM.get('character.perks')) {
|
||||
var id = 'perk_' + k.replace(' ', '-');
|
||||
var r = $('#' + id);
|
||||
if($SM.get('character.perks["'+k+'"]') && r.length == 0) {
|
||||
if($SM.get('character.perks["'+k+'"]') && r.length === 0) {
|
||||
r = $('<div>').attr('id', id).addClass('perkRow').appendTo(perks);
|
||||
$('<div>').addClass('row_key').text(_(k)).appendTo(r);
|
||||
$('<div>').addClass('tooltip bottom right').text(Engine.Perks[k].desc).appendTo(r);
|
||||
@@ -137,7 +137,7 @@ var Path = {
|
||||
else if($SM.get('stores["l armour"]', true) > 0)
|
||||
armour = _("leather");
|
||||
var aRow = $('#armourRow');
|
||||
if(aRow.length == 0) {
|
||||
if(aRow.length === 0) {
|
||||
aRow = $('<div>').attr('id', 'armourRow').addClass('outfitRow').prependTo(outfit);
|
||||
$('<div>').addClass('row_key').text(_('armour')).appendTo(aRow);
|
||||
$('<div>').addClass('row_val').text(armour).appendTo(aRow);
|
||||
@@ -148,7 +148,7 @@ var Path = {
|
||||
|
||||
// Add the water row
|
||||
var wRow = $('#waterRow');
|
||||
if(wRow.length == 0) {
|
||||
if(wRow.length === 0) {
|
||||
wRow = $('<div>').attr('id', 'waterRow').addClass('outfitRow').insertAfter(aRow);
|
||||
$('<div>').addClass('row_key').text(_('water')).appendTo(wRow);
|
||||
$('<div>').addClass('row_val').text(World.getMaxWater()).appendTo(wRow);
|
||||
@@ -183,13 +183,13 @@ var Path = {
|
||||
var row = $('div#outfit_row_' + k.replace(' ', '-'), outfit);
|
||||
if((store.type == 'tool' || store.type == 'weapon') && have > 0) {
|
||||
total += num * Path.getWeight(k);
|
||||
if(row.length == 0) {
|
||||
if(row.length === 0) {
|
||||
row = Path.createOutfittingRow(k, num, store.name);
|
||||
|
||||
var curPrev = null;
|
||||
outfit.children().each(function(i) {
|
||||
var child = $(this);
|
||||
if(child.attr('id').indexOf('outfit_row_') == 0) {
|
||||
if(child.attr('id').indexOf('outfit_row_') === 0) {
|
||||
var cName = child.attr('id').substring(11).replace('-', ' ');
|
||||
if(cName < k && (curPrev == null || cName > curPrev)) {
|
||||
curPrev = cName;
|
||||
@@ -207,7 +207,7 @@ var Path = {
|
||||
$('div#' + row.attr('id') + ' > div.row_val > span', outfit).text(num);
|
||||
$('div#' + row.attr('id') + ' .tooltip .numAvailable', outfit).text(numAvailable - num);
|
||||
}
|
||||
if(num == 0) {
|
||||
if(num === 0) {
|
||||
$('.dnBtn', row).addClass('disabled');
|
||||
$('.dnManyBtn', row).addClass('disabled');
|
||||
} else {
|
||||
@@ -221,7 +221,7 @@ var Path = {
|
||||
$('.upBtn', row).removeClass('disabled');
|
||||
$('.upManyBtn', row).removeClass('disabled');
|
||||
}
|
||||
} else if(have == 0 && row.length > 0) {
|
||||
} else if(have === 0 && row.length > 0) {
|
||||
row.remove();
|
||||
}
|
||||
}
|
||||
@@ -269,7 +269,7 @@ var Path = {
|
||||
var maxExtraByStore = $SM.get('stores["'+supply+'"]', true) - cur;
|
||||
var maxExtraByBtn = btn.data;
|
||||
Path.outfit[supply] = cur + Math.min(maxExtraByBtn, Math.min(maxExtraByWeight, maxExtraByStore));
|
||||
$SM.set('outfit['+supply+']', Path.outfit[supply])
|
||||
$SM.set('outfit['+supply+']', Path.outfit[supply]);
|
||||
Path.updateOutfitting();
|
||||
}
|
||||
},
|
||||
@@ -281,7 +281,7 @@ var Path = {
|
||||
cur = typeof cur == 'number' ? cur : 0;
|
||||
if(cur > 0) {
|
||||
Path.outfit[supply] = Math.max(0, cur - btn.data);
|
||||
$SM.set('outfit['+supply+']', Path.outfit[supply])
|
||||
$SM.set('outfit['+supply+']', Path.outfit[supply]);
|
||||
Path.updateOutfitting();
|
||||
}
|
||||
},
|
||||
@@ -310,8 +310,8 @@ var Path = {
|
||||
},
|
||||
|
||||
handleStateUpdates: function(e){
|
||||
if(e.category == 'character' && e.stateName.indexOf('character.perks') == 0 && Engine.activeModule == Path){
|
||||
if(e.category == 'character' && e.stateName.indexOf('character.perks') === 0 && Engine.activeModule == Path){
|
||||
Path.updatePerks();
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user