Browse Source

loading html page and conditional redirect added

loading screen will redirect when it finds that iguana api is
accessible.
ca333-dev
Satinder Grewal 8 years ago
parent
commit
bd0a475700
  1. 68
      gui/index.html
  2. BIN
      gui/loading.gif
  3. 4
      main.js

68
gui/index.html

@ -0,0 +1,68 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>
<script type="text/javascript" src="EasyDEX-GUI/assets/global/vendor/jquery/jquery.min.js"></script>
<script>if (window.module) module = window.module;</script>
</head>
<body>
<script type"text/javascript">
function Iguana_activehandle() {
var result = [];
//comment
var ajax_data = {"agent":"SuperNET","method":"activehandle"};
//console.log(ajax_data);
$.ajax({
async: false,
type: 'POST',
data: JSON.stringify(ajax_data),
url: 'http://127.0.0.1:7778',
//dataType: 'text',
success: function(data, textStatus, jqXHR) {
var AjaxOutputData = JSON.parse(data);
//console.log('== ActiveHandle Data OutPut ==');
//console.log(AjaxOutputData);
result.push(AjaxOutputData);
},
error: function(xhr, textStatus, error) {
console.log(xhr.statusText);
if ( xhr.readyState == 0 ) {
//Iguana_ServiceUnavailable();
result.push('error')
}
console.log(textStatus);
console.log(error);
}
});
//return 'Executed Iguana_activehandle. Check Iguana_activehandle_output var value.';
return result;
}
$(document).ready( function() {
//var check = Iguana_activehandle();
//console.log(check[0]) // here I invoke the checking function
const remote = require('electron').remote;
var window = remote.getCurrentWindow();
var portcheck;
function sartcheck() {
portcheck = setTimeout(function(){
var check = Iguana_activehandle();
console.log(check[0])
if (check[0] !== 'error') {
stopcheck();
window.close();
}
},2000);
}
function stopcheck() {
clearTimeout(portcheck);
}
sartcheck();
//setTimeout(function(){ window.close(); }, 15000);
});
</script>
<div style="text-align: center;"><img src="loading.gif"></div>
</body>
</html>

BIN
gui/loading.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

4
main.js

@ -70,10 +70,10 @@ function createLoadingWindow() {
loadingWindow = new BrowserWindow({width: 500, height: 300, frame: false})
// load our index.html (i.e. easyDEX GUI)
loadingWindow.loadURL('http://localhost:17777/');
loadingWindow.loadURL('http://localhost:17777/gui/');
// DEVTOOLS - only for dev purposes - ca333
//loadingWindow.webContents.openDevTools()
loadingWindow.webContents.openDevTools()
// if window closed we kill iguana proc
loadingWindow.on('closed', function () {

Loading…
Cancel
Save