diff --git a/assets/scripts/kmd_wallet_dashboard.js b/assets/scripts/kmd_wallet_dashboard.js index 261d5b5..89dde50 100644 --- a/assets/scripts/kmd_wallet_dashboard.js +++ b/assets/scripts/kmd_wallet_dashboard.js @@ -2,7 +2,8 @@ var KMDWalletDashboard = function() { var handle_KMD_Dashboard = function() { - $('#btn_kmd_wallet_dashboard').click(function() { + var action_btn_code = getHeaderActionMenuButtonCoinCode(); + $('#btn_'+action_btn_code+'_wallet_dashboard').click(function() { console.log('kmd wallet dashbaord button clicked...'); console.log($(this).data()); $('#kmd_wallet_dashoard_section').show(); @@ -17,8 +18,8 @@ var KMDWalletDashboard = function() { } var handle_KMD_Send = function() { - - $('#btn_kmd_wallet_send').click(function() { + var action_btn_code = getHeaderActionMenuButtonCoinCode(); + $('#btn_'+action_btn_code+'_wallet_send').click(function() { KMDListAllOPIDs(); //console.log('kmd wallet send button clicked...'); var tmpoptions = ''; @@ -31,7 +32,7 @@ var KMDWalletDashboard = function() { var kmd_addr_list_with_balance = KMDlistunspentT(); //console.log(kmd_addr_list_with_balance); - tmpoptions += ''; + tmpoptions += ''; $.each(kmd_addr_list_with_balance, function(index) { tmpoptions += ''; $('#kmd_wallet_send_from').html(tmpoptions); @@ -184,7 +185,8 @@ var KMDWalletDashboard = function() { }; var KMDWalletSettings = function() { - $('#btn_kmd_wallet_settings').click(function() { + var action_btn_code = getHeaderActionMenuButtonCoinCode(); + $('#btn_'+action_btn_code+'_wallet_settings').click(function() { console.log('wallet settings button clicked...'); $('#kmd_wallet_dashboardinfo').hide(); $('#kmd_wallet_dashoard_section').hide(); @@ -198,7 +200,8 @@ var KMDWalletDashboard = function() { var KMDWalletRecieve = function() { - $('#btn_kmd_wallet_recieve').click(function() { + var action_btn_code = getHeaderActionMenuButtonCoinCode(); + $('#btn_'+action_btn_code+'_wallet_recieve').click(function() { //console.log('wallet recieve button clicked...'); $('#kmd_wallet_dashboardinfo').hide(); $('#kmd_wallet_dashoard_section').hide(); @@ -255,6 +258,23 @@ function RunInitFunctions() { NProgress.done(); } + +function getHeaderActionMenuButtonCoinCode() { + var extcoin = $('#extcoin-wallet').data('extcoin'); + var action_menu_button_code = ''; + if ( extcoin == 'KMD') { action_menu_button_code = 'kmd'; }; + if ( extcoin == 'ZEC') { action_menu_button_code = 'zec'; }; + return action_menu_button_code; +} + +function getPassthruAgent() { + var extcoin = $('#extcoin-wallet').data('extcoin'); + var passthru_agent = ''; + if ( extcoin == 'KMD') { passthru_agent = 'komodo'; }; + if ( extcoin == 'ZEC') { passthru_agent = 'zcash'; }; + return passthru_agent; +} + function getTotalKMDBalance() { console.log($('#extcoin-wallet').data('extcoin')); var extcoin = $('#extcoin-wallet').data('extcoin'); @@ -290,7 +310,8 @@ function getTotalKMDBalance() { } function getKMDBalanceT() { - var ajax_data = {"agent":"komodo","method":"passthru","function":"getbalance","hex":""} + var passthru_agent = getPassthruAgent(); + var ajax_data = {"agent":passthru_agent,"method":"passthru","function":"getbalance","hex":""} console.log(ajax_data); $.ajax({ type: 'POST', @@ -317,7 +338,8 @@ function getKMDBalanceT() { function getKMDBalanceZ() { - var ajax_data = {"agent":"komodo","method":"passthru","function":"z_getbalance","hex":""} + var passthru_agent = getPassthruAgent(); + var ajax_data = {"agent":passthru_agent,"method":"passthru","function":"z_getbalance","hex":""} console.log(ajax_data); $.ajax({ type: 'POST', @@ -344,7 +366,8 @@ function getKMDBalanceZ() { function getKMDWalletInfo() { - var ajax_data = {"agent":"komodo","method":"passthru","function":"getwalletinfo","hex":""} + var passthru_agent = getPassthruAgent(); + var ajax_data = {"agent":passthru_agent,"method":"passthru","function":"getwalletinfo","hex":""} console.log(ajax_data); $.ajax({ type: 'POST', @@ -375,7 +398,8 @@ function getKMDWalletInfo() { function getKMDInfo() { - var ajax_data = {"agent":"komodo","method":"passthru","function":"getinfo","hex":""} + var passthru_agent = getPassthruAgent(); + var ajax_data = {"agent":passthru_agent,"method":"passthru","function":"getinfo","hex":""} console.log(ajax_data); $.ajax({ type: 'POST', @@ -420,7 +444,8 @@ function KMDlistunspentT() { NProgress.start(); var result = []; - var ajax_data = {"agent":"komodo","method":"passthru","function":"listunspent","hex":""} + var passthru_agent = getPassthruAgent(); + var ajax_data = {"agent":passthru_agent,"method":"passthru","function":"listunspent","hex":""} //console.log(ajax_data); $.ajax({ async: false, @@ -471,7 +496,8 @@ function KMDlistunspentT() { function KMDListaddrZ() { var result = []; - var ajax_data = {"agent":"komodo","method":"passthru","function":"z_listaddresses","hex":""} + var passthru_agent = getPassthruAgent(); + var ajax_data = {"agent":passthru_agent,"method":"passthru","function":"z_listaddresses","hex":""} //console.log(ajax_data); $.ajax({ async: false, @@ -547,7 +573,8 @@ function KMDGetPublicTransactions() { NProgress.start(); var result = []; - var ajax_data = {"agent":"komodo","method":"passthru","function":"listtransactions","hex":""} + var passthru_agent = getPassthruAgent(); + var ajax_data = {"agent":passthru_agent,"method":"passthru","function":"listtransactions","hex":""} //console.log(ajax_data); $.ajax({ async: false, @@ -621,7 +648,8 @@ function KMDGetProtectedTransactions() { var tmpzaddr_hex_input = Iguana_HashHex(ajax_data_to_hex) //console.log(tmpzaddr_hex_input); - var ajax_data = {"agent":"komodo","method":"passthru","function":"z_listreceivedbyaddress","hex":tmpzaddr_hex_input} + var passthru_agent = getPassthruAgent(); + var ajax_data = {"agent":passthru_agent,"method":"passthru","function":"z_listreceivedbyaddress","hex":tmpzaddr_hex_input} //console.log(ajax_data); $.ajax({ async: false, @@ -723,7 +751,8 @@ function KMDListAddresses(pubpriv) { //console.log(tmpzaddr_hex_input); - var ajax_data = {"agent":"komodo","method":"passthru","function":ajax_function_input,"hex":tmplistaddr_hex_input} + var passthru_agent = getPassthruAgent(); + var ajax_data = {"agent":passthru_agent,"method":"passthru","function":ajax_function_input,"hex":tmplistaddr_hex_input} //console.log(ajax_data); $.ajax({ async: false, @@ -769,7 +798,8 @@ function KMDGetNewAddresses(pubpriv) { ajax_function_input = 'z_getnewaddress'; } - var ajax_data = {"agent":"komodo","method":"passthru","function":ajax_function_input,"hex":""} + var passthru_agent = getPassthruAgent(); + var ajax_data = {"agent":passthru_agent,"method":"passthru","function":ajax_function_input,"hex":""} //console.log(ajax_data); $.ajax({ async: false, @@ -809,11 +839,11 @@ function KMDListAllAddr() { var listTaddr = KMDListAddresses('public'); var listZaddr = KMDListAddresses('private'); var listAlladdr = $.merge( listTaddr, listZaddr ); - console.log(listAlladdr[5].slice(0, 2)); + //console.log(listAlladdr[5].slice(0, 2)); $.each(listAlladdr, function(index, value) { tmp_addr_label = ' public'; - if ( listAlladdr[index].slice(0, 2) == 'zc' ) { tmp_addr_label = ' private'; } + if ( listAlladdr[index].slice(0, 2) == 'zc' || listAlladdr[index].slice(0, 2) == 'zt' ) { tmp_addr_label = ' private'; } //var tmp_addr_action_button = ''; only_reciving_addr_data.push([tmp_addr_label, listAlladdr[index]]); }); @@ -886,7 +916,8 @@ function KMDGetOPIDInfo(opid) { //console.log(tmpopid_output); } - var ajax_data_txid_input = {"agent":"komodo","method":"passthru","function":"z_getoperationstatus","hex":tmpopid_output} + var passthru_agent = getPassthruAgent(); + var ajax_data_txid_input = {"agent":passthru_agent,"method":"passthru","function":"z_getoperationstatus","hex":tmpopid_output} //console.log(ajax_data_txid_input); $.ajax({ async: false, @@ -935,6 +966,10 @@ function KMDListAllOPIDs() { tmp_id = listOPIDs[0][index].id; tmp_creation_time = secondsToString(listOPIDs[0][index].creation_time); + if (listOPIDs[0][index].status === 'queued') { + tmp_status_label = ' Queued'; + tmp_results = 'Please press refresh button in a minute or so to see updated status...'; + } if (listOPIDs[0][index].status === 'executing') { tmp_status_label = ' Executing'; tmp_results = 'Please press refresh button in a minute or so to see updated status...'; @@ -994,7 +1029,8 @@ function KMDZSendManyTransaction() { var zsendmoney_output = Iguana_HashHex(ajax_data_to_hex) //console.log(zsendmoney_output); - var ajax_data_txid_input = {"agent":"komodo","method":"passthru","function":"z_sendmany","hex":zsendmoney_output} + var passthru_agent = getPassthruAgent(); + var ajax_data_txid_input = {"agent":passthru_agent,"method":"passthru","function":"z_sendmany","hex":zsendmoney_output} //console.log(ajax_data_txid_input); $.ajax({ async: false, diff --git a/assets/scripts/sidebar.js b/assets/scripts/sidebar.js index 60a36ad..355c23d 100644 --- a/assets/scripts/sidebar.js +++ b/assets/scripts/sidebar.js @@ -85,6 +85,8 @@ $('#nav-komodo-wallet').on('click', function() { $('#nav-about-iguana').removeClass( " active open" ).addClass( "" ); //$.each($('[data-extcoin="KMD"]'), function(index, value) {console.log($('[data-extcoin="KMD"]').data()); $('[data-extcoin="KMD"]').attr("data-extcoin","ZEC"); }); $.each($('[data-extcoin]'), function(index, value) {$('[data-extcoin]').attr("data-extcoin","KMD"); $('[data-extcoin="KMD"]')}); + $.each($('[data-extcoinname]'), function(index, value) {$('[data-extcoinname]').text("KMD"); $('[data-extcoinname="KMD"]')}); + $.each($('[data-extcointitle]'), function(index, value) {$('[data-extcointitle]').text("Komodo"); $('[data-extcointitle="Komodo"]')}); KMDWalletDashboard.init(); //Initiate Komodo Dashbaord sript applyKMDWalletStyle(); //removeZECWalletStyle(); @@ -101,7 +103,8 @@ $('#nav-zcash-wallet').on('click', function() { $('#header-dashboard').hide(); $('#section-easydex').hide(); $('#section-extcoin').hide(); - $('#section-zcash').show(); + //$('#section-zcash').show(); + $('#section-extcoin').show(); $('#section-about-iguana').hide(); $('#section-iguana-atomic-explorer').hide(); $('#section-iguana-wallet-settings').hide(); @@ -114,6 +117,9 @@ $('#nav-zcash-wallet').on('click', function() { $('#nav-about-iguana').removeClass( " active open" ).addClass( "" ); $(".header-easydex-section").text("Zcash Wallet"); $.each($('[data-extcoin]'), function(index, value) {$('[data-extcoin]').attr("data-extcoin","ZEC"); $('[data-extcoin="ZEC"]')}); + $.each($('[data-extcoinname]'), function(index, value) {$('[data-extcoinname]').text("ZEC"); $('[data-extcoinname="ZEC"]')}); + $.each($('[data-extcointitle]'), function(index, value) {$('[data-extcointitle]').text("Zcash"); $('[data-extcointitle="Zcash"]')}); + KMDWalletDashboard.init(); //Initiate Komodo Dashbaord sript applyZECWalletStyle(); //removeKMDWalletStyle(); CommonSidebarActionsSet02(); diff --git a/index.html b/index.html index 77097b6..ff977d9 100755 --- a/index.html +++ b/index.html @@ -380,7 +380,6 @@