diff --git a/iguana/app/startup.js b/iguana/app/startup.js index bf289a88d..fe252ba32 100644 --- a/iguana/app/startup.js +++ b/iguana/app/startup.js @@ -94,7 +94,57 @@ $(function () { else if(e.className && e.className.indexOf('clear-response-coin') != -1){ $(".coin_result").text("JSON response"); } - ///clear-response-coin + else if(e.className && e.className.indexOf('instantdex_set_userid') != -1){ + InstantDEX_setuserid(); + } + else if(e.className && e.className.indexOf('Tradebot_set_method_table') != -1){ + tradebot_set_method_table(e.getAttribute("data-method")); + } + else if(e.className && e.className.indexOf('Tradebot_monitorall') != -1){ + Tradebot_monitorall_api(); + } + else if(e.className && e.className.indexOf('Tradebot_monitor') != -1){ + Tradebot_monitor_api(); + } + else if(e.className && e.className.indexOf('Tradebot_unmonitor_api') != -1){ + Tradebot_unmonitor_api(); + } + else if(e.className && e.className.indexOf('Tradebot_accumulate') != -1){ + Tradebot_accumulate_api(); + } + else if(e.className && e.className.indexOf('Tradebot_divest') != -1){ + Tradebot_divest_api(); + } + + else if(e.className && e.className.indexOf('Tradebot_activebots') != -1){ + Tradebot_activebots_api(); + } + else if(e.className && e.className.indexOf('Tradebot_status') != -1){ + Tradebot_status_api(); + } + + else if(e.className && e.className.indexOf('Tradebot_pause') != -1){ + Tradebot_pause_api(); + } + else if(e.className && e.className.indexOf('Tradebot_stop') != -1){ + Tradebot_stop_api(); + } + else if(e.className && e.className.indexOf('Tradebot_resume') != -1){ + Tradebot_resume_api(); + } + else if(e.className && e.className.indexOf('instantdex_allpairs') != -1){ + InstantDEX_allpairs(); + + } + // }; + + $("div .btn-primary").on("click",function(){ + $("div .btn-primary").each(function(){ + $(this).removeClass('btn-raised'); + }); + $(this).addClass("btn-raised"); + }); + }); \ No newline at end of file diff --git a/iguana/example.js b/iguana/example.js index 3cac5ee50..1556f9cc5 100755 --- a/iguana/example.js +++ b/iguana/example.js @@ -244,6 +244,7 @@ function ArrayBufferToString(buf) { return String.fromCharCode.apply(null, new U function handleMessage(message_event) { var data = message_event.data; if ((typeof(data) === 'string' || data instanceof String)) { + check_if_pexe_7778_working(data); common.logMessage(data); } else if (data instanceof Object) @@ -279,3 +280,47 @@ function handleMessage(message_event) { common.logMessage('Error: Unknow message `' + data + '` received from NaCl module.'); } } + +var APPLICATION={pexe:"not loaded",port7778:"Not binded"}; + + +var check_if_pexe_7778_working=function(string){ + var if_changed=0; +if(string.indexOf("iguana_rpcloop")>-1 && string.indexOf("bind sock")>-1 ){ + + APPLICATION.port7778="successfully binded"; + if_changed=1; +}else if(string.indexOf("finished DidCreate iguana")>-1){ + APPLICATION.pexe="Loaded"; + if_changed=1; +}else if(string.indexOf("ERROR BINDING PORT.7778")>-1){ + //APPLICATION.state="Loading.."; + APPLICATION.port7778="Retrying"; + /*if(APPLICATION.pexe.indexOf("not loaded")>-1 || APPLICATION.pexe.indexOf("crashed")>-1){ + APPLICATION.state="not working"; + }*/ + if_changed=1; +}else if(string.indexOf("NaCl module crashed")>-1){ + APPLICATION.pexe="crashed"; + if_changed=1; +}else if(string.indexOf("try again: Address already in use")>-1){ + APPLICATION.port7778="bind failed"; + if_changed=1; +} +if(if_changed){change_app_status();} +//finished DidCreate iguana +// ERROR BINDING PORT.7778. will exit. wait up to a minute and try again. dont worry, this is normal +// NativeClient: NaCl module crashed +//string.indexOf(substring) > -1 +//bind(127.0.0.1) port.7778 try again: Address already in use sock.4. errno.98 + + +}; + +var change_app_status=function(){ + var html="
- ** Awaiting specific requirements ** -
+ +