diff --git a/css/main.css b/css/main.css index 50723ae..89dc0e7 100644 --- a/css/main.css +++ b/css/main.css @@ -182,6 +182,10 @@ div.row_val { float: right; } +div.total { + font-weight: bold; +} + /* Notifications */ div#notifications { diff --git a/script/room.js b/script/room.js index 46598db..a7b3f90 100644 --- a/script/room.js +++ b/script/room.js @@ -885,6 +885,7 @@ var Room = { updateIncomeView: function() { var stores = $('div#resources'); + var totalIncome = {}; if(stores.length === 0 || typeof $SM.get('income') == 'undefined') return; $('div.storeRow', stores).each(function(index, el) { el = $(el); @@ -900,10 +901,19 @@ var Room = { .addClass('row_val') .text(Engine.getIncomeMsg(income.stores[store], income.delay)) .appendTo(tt); + if (totalIncome[store] === undefined || totalIncome[store]['income'] === undefined) { + totalIncome[store] = {}; + totalIncome[store]['income'] = 0; + } + totalIncome[store]['income'] += Number(income.stores[store]); + totalIncome[store]['delay'] = income.delay; } } } if(tt.children().length > 0) { + var total = totalIncome[storeName]['income']; + $('
').addClass('total row_key').text(_('total')).appendTo(tt); + $('
').addClass('total row_val').text(Engine.getIncomeMsg(total, totalIncome[storeName]['delay'])).appendTo(tt); tt.appendTo(el); } });