From f5348d4ad109533d6c55c31ad017e317ab2f172c Mon Sep 17 00:00:00 2001 From: pbca26 Date: Tue, 14 Mar 2017 10:02:15 +0300 Subject: [PATCH] reduce dashboard func duplicate to one copy --- assets/scripts/dashboard.js | 32 +- assets/scripts/dashboard/DashboardEDEX.js | 369 +--------------------- 2 files changed, 18 insertions(+), 383 deletions(-) diff --git a/assets/scripts/dashboard.js b/assets/scripts/dashboard.js index 28467e5..0f3ec7d 100644 --- a/assets/scripts/dashboard.js +++ b/assets/scripts/dashboard.js @@ -746,7 +746,7 @@ var Dashboard = function() { coinname = 'SpaceMesh'; break; case 'USD': - coinlogo = 'USD'; + coinlogo = 'usd'; coinname = 'US Dollar'; break; case 'RON': @@ -875,19 +875,20 @@ var Dashboard = function() { break; } - walletDivContent += '' + - '
' + - '
' + - '' + - '
' + - '
' + - ''; + walletDivContent += + '' + + '
' + + '
' + + '' + + '
' + + '
' + + ''; $('.wallet-widgets-row').html(walletDivContent); $('.scrollbar-dynamic').scrollbar(); // Make sure widget-body has scrollbar for transactions history @@ -1196,7 +1197,8 @@ var Dashboard = function() { //console.log('Get Rates (every 60 seconds)'); } }, 60000);*/ - } + }, + handleWalletWidgets: handleWalletWidgets }; }(); diff --git a/assets/scripts/dashboard/DashboardEDEX.js b/assets/scripts/dashboard/DashboardEDEX.js index fb4522d..502c140 100644 --- a/assets/scripts/dashboard/DashboardEDEX.js +++ b/assets/scripts/dashboard/DashboardEDEX.js @@ -64,374 +64,7 @@ function EdexfillTxHistory(coin) { } function refreshEDEXCoinWalletList() { - var walletDivContent = '', - AddColumnDiv = 0; - - $.each([ - 'native', - 'basilisk', - 'full' - ],function( index, value ) { - var tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), - ajax_data = { - 'userpass': tmpIguanaRPCAuth, - 'agent': 'InstantDEX', - 'method': 'allcoins' - }; - - $.ajax({ - type: 'POST', - data: JSON.stringify(ajax_data), - url: 'http://127.0.0.1:' + config.iguanaPort, - success: function(data, textStatus, jqXHR) { - var AllcoinsDataOutput = JSON.parse(data); - - $.each(AllcoinsDataOutput[value], function(index) { - var coinlogo = '', - coinname = '', - modecode = '', - modetip = '', - modecolor = ''; - - switch (value) { - case 'native': - modecode = 'Native'; - modetip = 'Native'; - modecolor = 'primary'; - break; - case 'basilisk': - modecode = 'Basilisk'; - modetip = 'Basilisk'; - modecolor = 'info'; - break; - case 'full': - modecode = 'Full'; - modetip = 'Full'; - modecolor = 'success'; - break; - case 'virtual': - modecode = 'Virtual'; - modetip = 'Virtual'; - modecolor = 'danger'; - break; - case 'notarychains': - modecode = 'Notarychains'; - modetip = 'Notarychains'; - modecolor = 'dark'; - break; - } - - switch (AllcoinsDataOutput[value][index]) { - case 'BTC': - coinlogo = 'bitcoin'; - coinname = 'Bitcoin'; - break; - case 'BTCD': - coinlogo = 'bitcoindark'; - coinname = 'BitcoinDark'; - break; - case 'LTC': - coinlogo = 'litecoin'; - coinname = 'Litecoin'; - break; - case 'VPN': - coinlogo = 'vpncoin'; - coinname = 'VPNcoin'; - break; - case 'SYS': - coinlogo = 'syscoin'; - coinname = 'Syscoin'; - break; - case 'ZEC': - coinlogo = 'zcash'; - coinname = 'Zcash'; - break; - case 'NMC': - coinlogo = 'namecoin'; - coinname = 'Namecoin'; - break; - case 'DEX': - coinlogo = 'dex'; - coinname = 'DEX'; - break; - case 'DOGE': - coinlogo = 'dogecoin'; - coinname = 'Dogecoin'; - break; - case 'DGB': - coinlogo = 'digibyte'; - coinname = 'Digibyte'; - break; - case 'MZC': - coinlogo = 'mazacoin'; - coinname = 'Mazacoin'; - break; - case 'UNO': - coinlogo = 'unobtanium'; - coinname = 'Unobtanium'; - break; - case 'ZET': - coinlogo = 'zetacoin'; - coinname = 'Zetacoin'; - break; - case 'KMD': - coinlogo = 'komodo'; - coinname = 'Komodo'; - break; - case 'BTM': - coinlogo = 'bitmark'; - coinname = 'Bitmark'; - break; - case 'CARB': - coinlogo = 'carboncoin'; - coinname = 'Carboncoin'; - break; - case 'ANC': - coinlogo = 'anoncoin'; - coinname = 'AnonCoin'; - break; - case 'FRK': - coinlogo = 'franko'; - coinname = 'Franko'; - break; - case 'SUPERNET': - coinlogo = 'SUPERNET'; - coinname = 'SUPERNET'; - break; - case 'REVS': - coinlogo = 'REVS'; - coinname = 'REVS'; - break; - case 'WIRELESS': - coinlogo = 'WIRELESS'; - coinname = 'WIRELESS'; - break; - case 'DEX': - coinlogo = 'DEX'; - coinname = 'DEX'; - break; - case 'PANGEA': - coinlogo = 'PANGEA'; - coinname = 'PANGEA'; - break; - case 'JUMBLR': - coinlogo = 'JUMBLR'; - coinname = 'JUMBLR'; - break; - case 'BET': - coinlogo = 'BET'; - coinname = 'BET'; - break; - case 'CRYPTO': - coinlogo = 'CRYPTO'; - coinname = 'CRYPTO'; - break; - case 'HODL': - coinlogo = 'HODL'; - coinname = 'HODL'; - break; - case 'SHARK': - coinlogo = 'SHARK'; - coinname = 'SHARK'; - break; - case 'BOTS': - coinlogo = 'BOTS'; - coinname = 'BOTS'; - break; - case 'MGW': - coinlogo = 'MGW'; - coinname = 'MGW'; - break; - case 'MVP': - coinlogo = 'MVP'; - coinname = 'MVP'; - break; - case 'KV': - coinlogo = 'KV'; - coinname = 'KV'; - break; - case 'CEAL': - coinlogo = 'CEAL'; - coinname = 'CEAL'; - break; - case 'MESH': - coinlogo = 'MESH'; - coinname = 'MESH'; - break; - case 'USD': - coinlogo = 'USD'; - coinname = 'USD'; - break; - case 'RON': - coinlogo = 'RON'; - coinname = 'RON'; - break; - case 'EUR': - coinlogo = 'EUR'; - coinname = 'Euro'; - break; - case 'JPY': - coinlogo = 'JPY'; - coinname = 'Japanese Yen'; - break; - case 'GBP': - coinlogo = 'GBP'; - coinname = 'British Pound'; - break; - case 'AUD': - coinlogo = 'AUD'; - coinname = 'Australian Dollar'; - break; - case 'CAD': - coinlogo = 'CAD'; - coinname = 'Canadian Dollar'; - break; - case 'CHF': - coinlogo = 'CHF'; - coinname = 'Swiss Franc'; - break; - case 'NZD': - coinlogo = 'NZD'; - coinname = 'New Zealand Dollar'; - break; - case 'CNY': - coinlogo = 'CNY'; - coinname = 'Chinese Yuan'; - break; - case 'RUB': - coinlogo = 'RUB'; - coinname = 'Russian Ruble'; - break; - case 'MXN': - coinlogo = 'MXN'; - coinname = 'Mexican peso'; - break; - case 'BRL': - coinlogo = 'BRL'; - coinname = 'Brazilian Real'; - break; - case 'INR': - coinlogo = 'INR'; - coinname = 'Indian Rupee'; - break; - case 'HKD': - coinlogo = 'HKD'; - coinname = 'Hong Kong Dollar'; - break; - case 'TRY': - coinlogo = 'TRY'; - coinname = 'Turkish Lira'; - break; - case 'ZAR': - coinlogo = 'ZAR'; - coinname = 'South African Rand'; - break; - case 'PLN': - coinlogo = 'PLN'; - coinname = 'Polish Zloty'; - break; - case 'NOK': - coinlogo = 'NOK'; - coinname = 'Norwegian Krone'; - break; - case 'SEK': - coinlogo = 'SEK'; - coinname = 'Swedish Krona'; - break; - case 'DKK': - coinlogo = 'DKK'; - coinname = 'Danish Krone'; - break; - case 'CZK': - coinlogo = 'CZK'; - coinname = 'Czech Koruna'; - break; - case 'HUF': - coinlogo = 'HUF'; - coinname = 'Hungarian Forint'; - break; - case 'ILS': - coinlogo = 'ILS'; - coinname = 'Israeli Shekel'; - break; - case 'KRW': - coinlogo = 'KRW'; - coinname = 'Korean Won'; - break; - case 'MYR': - coinlogo = 'MYR'; - coinname = 'Malaysian Ringgit'; - break; - case 'PHP': - coinlogo = 'PHP'; - coinname = 'Philippine Peso'; - break; - case 'SGD': - coinlogo = 'SGD'; - coinname = 'Singapore Dollar'; - break; - case 'THB': - coinlogo = 'THB'; - coinname = 'Thai Baht'; - break; - case 'BGN': - coinlogo = 'BGN'; - coinname = 'Bulgarian Lev'; - break; - case 'IDR': - coinlogo = 'IDR'; - coinname = 'Indonesian Rupiah'; - break; - case 'HRK': - coinlogo = 'HRK'; - coinname = 'Croatian Kuna'; - break; - } - - walletDivContent += - '' + - '
' + - '
' + - '
' + - '' + - '
' + coinname + '
' + - '
' + - '
' + - '
' + - ''; - - $('.wallet-widgets-row').html(walletDivContent); - //getCoinBalance(AllcoinsDataOutput[value][index]); - //getCoinBalance_altfn('KMD'); - //getCoinBalance('KMD'); - /*if ( modecode == 'Basilisk' ) { - $('span[data-edexcoincode="' + AllcoinsDataOutput[value][index] + '"][id="edexcoin-balance"]').parent().hide(); - //getBasiliskCoinBalance(AllcoinsDataOutput[value][index]) - }*/ - - $('.scrollbar-dynamic').scrollbar(); //Make sure widget-body has scrollbar for transactions history - $('[data-toggle="tooltip"]').tooltip(); //Make sure tooltips are working for wallet widgets and anywhere else in wallet. - edexCoinBtnAction(); - }); - }, - error: function(xhr, textStatus, error) { - console.log('failed starting BitcoinDark.'); - console.log(xhr.statusText); - if ( xhr.readyState == 0 ) { - Iguana_ServiceUnavailable(); - } - console.log(textStatus); - console.log(error); - - if (xhr.readyState == '0' ) { - toastr.error(_lang[defaultLang].TOASTR.IGUANA_CONN_ERR, _lang[defaultLang].TOASTR.ACCOUNT_NOTIFICATION); - } - } - }); - }); + Dashboard.handleWalletWidgets(); } function EdexGetTxList(coin) {