From fea54cd97fbe5db9bf90fdf5689c4c9e4a4110b1 Mon Sep 17 00:00:00 2001 From: Sebring Date: Wed, 29 Jul 2015 16:57:26 +0200 Subject: [PATCH 1/3] Add total to tooltip --- script/room.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/script/room.js b/script/room.js index 46598db..aefb418 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,18 @@ var Room = { .addClass('row_val') .text(Engine.getIncomeMsg(income.stores[store], income.delay)) .appendTo(tt); + totalIncome[store] = Number(totalIncome[store]) || 0; + totalIncome[store] += Number(income.stores[store]); } } } if(tt.children().length > 0) { + var total = totalIncome[storeName]; + if (total > 0) { + total = '+'+total; + } + $('
').addClass('total row_key').text(_('total')).appendTo(tt); + $('
').addClass('total row_val').text(''+total).appendTo(tt); tt.appendTo(el); } }); From 100ff277ff67e4978f41d41eaae2f8fffb7cb4f0 Mon Sep 17 00:00:00 2001 From: Sebring Date: Wed, 29 Jul 2015 16:59:16 +0200 Subject: [PATCH 2/3] Styles for total in tooltip --- css/main.css | 4 ++++ 1 file changed, 4 insertions(+) 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 { From 1e37f455305e6f807406f1a9900bdf34de58a554 Mon Sep 17 00:00:00 2001 From: Sebring Date: Wed, 29 Jul 2015 20:08:09 +0200 Subject: [PATCH 3/3] Display time delay on total row in tooltip --- script/room.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/script/room.js b/script/room.js index aefb418..a7b3f90 100644 --- a/script/room.js +++ b/script/room.js @@ -901,18 +901,19 @@ var Room = { .addClass('row_val') .text(Engine.getIncomeMsg(income.stores[store], income.delay)) .appendTo(tt); - totalIncome[store] = Number(totalIncome[store]) || 0; - totalIncome[store] += Number(income.stores[store]); + 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]; - if (total > 0) { - total = '+'+total; - } + var total = totalIncome[storeName]['income']; $('
').addClass('total row_key').text(_('total')).appendTo(tt); - $('
').addClass('total row_val').text(''+total).appendTo(tt); + $('
').addClass('total row_val').text(Engine.getIncomeMsg(total, totalIncome[storeName]['delay'])).appendTo(tt); tt.appendTo(el); } });