diff --git a/assets/scripts/dashboard.js b/assets/scripts/dashboard.js index 6ce85e7..4ab68ea 100644 --- a/assets/scripts/dashboard.js +++ b/assets/scripts/dashboard.js @@ -295,7 +295,7 @@ function ShowCoinHistory(getData) { ClearOnLogout(true, true); } if ( JSON.parse(CheckLoginData).status === 'unlocked' ) { - //console.log(getData.vals['coin']); + console.log(getData.vals['coin']); $.ajax({ type: 'POST', data: JSON.stringify(getData), @@ -326,28 +326,32 @@ function ShowCoinHistory(getData) { var show_coin_history = CoinHistoryData; //Enable to get history from each coins's wallet address. //var show_coin_history = testhistory; //Enable to get history from just test variable. - $.each(show_coin_history.history.reverse(), function(coin_history_index){ - //console.log(coin_history_index); - //console.log(show_coin_history.history[coin_history_index].details.vout); - - var label_class = ''; - var icon_arrow_direction = ''; - var balance_text_color = ''; - - if ('vin' in show_coin_history.history[coin_history_index].details) { label_class = 'label-danger'; icon_arrow_direction = 'fa-arrow-right'; balance_text_color = '#f44336'; } - if ('vout' in show_coin_history.history[coin_history_index].details) { label_class = 'label-success'; icon_arrow_direction = 'fa-arrow-left'; balance_text_color = '#4caf50'; } - - - wallettblContent += ''; - wallettblContent += ''; - wallettblContent += '' + show_coin_history.history[coin_history_index].address + ''; - wallettblContent += '' + secondsToString(show_coin_history.history[coin_history_index].numseconds) + ''; - wallettblContent += '' + show_coin_history.history[coin_history_index].amount + ''; - wallettblContent += ''; - $('table[data-currency="' + getData.vals['coin'] + '"][id="currency-tbl"] tbody').html(wallettblContent); - //$('#currency-tbl tbody').html(wallettblContent); - }); + if ( sessionStorage.getItem('PrevHistoryLength_'+getData.vals['coin']) != CoinHistoryData.history.length ) { + $.each(show_coin_history.history.reverse(), function(coin_history_index){ + //console.log(coin_history_index); + //console.log(show_coin_history.history[coin_history_index].details.vout); + + var label_class = ''; + var icon_arrow_direction = ''; + var balance_text_color = ''; + + if ('vin' in show_coin_history.history[coin_history_index].details) { label_class = 'label-danger'; icon_arrow_direction = 'fa-arrow-right'; balance_text_color = '#f44336'; } + if ('vout' in show_coin_history.history[coin_history_index].details) { label_class = 'label-success'; icon_arrow_direction = 'fa-arrow-left'; balance_text_color = '#4caf50'; } + + + wallettblContent += ''; + wallettblContent += ''; + wallettblContent += '' + show_coin_history.history[coin_history_index].address + ''; + wallettblContent += '' + secondsToString(show_coin_history.history[coin_history_index].numseconds) + ''; + wallettblContent += '' + show_coin_history.history[coin_history_index].amount + ''; + wallettblContent += ''; + $('table[data-currency="' + getData.vals['coin'] + '"][id="currency-tbl"] tbody').html(wallettblContent); + //$('#currency-tbl tbody').html(wallettblContent); + sessionStorage.setItem('PrevHistoryLength_'+getData.vals['coin'], CoinHistoryData.history.length); + }); + } + //console.log(show_coin_history.history.length); $('span[data-currency="' + getData.vals['coin'] + '"][id="currency-nooftransactions"]').text(show_coin_history.history.length); },