From 38f979c17d5f0846afd91cfa0f2a000914816ced Mon Sep 17 00:00:00 2001 From: Satinder Grewal Date: Sat, 4 Mar 2017 18:21:41 +1300 Subject: [PATCH] Jumblr section updated with bug fixes --- assets/scripts/jumblr.js | 46 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/assets/scripts/jumblr.js b/assets/scripts/jumblr.js index 8142b39..dac2c9d 100644 --- a/assets/scripts/jumblr.js +++ b/assets/scripts/jumblr.js @@ -5,9 +5,14 @@ var Jumblr = function() { //clearInterval(CheckIfIguanaRunning); //console.log('=> No wallet logged in, or Dashboard not ative. No need to Run History.'); } else { - Jumblr_DisplayAddresses(); - Jumblr_DisplayStatus(); - Jumblr_ShowHideAlert(); + Jumblr_CheckIfConnected().then(function(result){ + console.log(result) + if (result == 'connected') { + Jumblr_DisplayAddresses(); + Jumblr_DisplayStatus(); + Jumblr_ShowHideAlert(); + } + }) } $('#jumblr_actions_header').click(function(){ @@ -98,6 +103,41 @@ function Jumblr_LookforNativeKomodo() { }); } + +function Jumblr_CheckIfConnected() { + return new Promise((resolve) => { + var extcoin = $('[data-extcoin]').attr('data-extcoin'), + passthru_agent = getPassthruAgent(), + tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + ajax_data = { + 'userpass': tmpIguanaRPCAuth, + 'agent': passthru_agent, + 'method': 'passthru', + 'function': 'getinfo', + 'hex': '' + }; + + //console.log(ajax_data); + $.ajax({ + type: 'POST', + data: JSON.stringify(ajax_data), + url: 'http://127.0.0.1:7778' + }).done(function(data){ + data = JSON.parse(data) + if ( data.errors != undefined ) { + resolve('connected'); + } else if (data.errors == '' ) { + resolve('connected'); + } else if ( data.errors == undefined) { + resolve('not active'); + } else { + resolve(data.errors); + } + }) + }) +} + + jQuery(document).ready(function() { Jumblr.init(); }); \ No newline at end of file