diff --git a/iguana/app/coin_mgmt.js b/iguana/app/coin_mgmt.js index 05bc6385c..fdeef78aa 100644 --- a/iguana/app/coin_mgmt.js +++ b/iguana/app/coin_mgmt.js @@ -1,6 +1,4 @@ var coinManagement = {}; - - // Classes coinManagement.Coin = function (_id, _symbol, _description, _statusId) { @@ -38,6 +36,18 @@ coinManagement.Initialize = function () { ]; }; +coinManagement.getCoinSymbols=function(){ + var coins=[]; + + if (coinManagement.Coins === null || coinManagement.Coins === undefined) { + return []; + } + for (var index = 0; index < coinManagement.Coins.length; index++) { + coins.push(coinManagement.Coins[index].Symbol); + } + return coins; +}; + coinManagement.GetCoinIndex = function (id) { if (coinManagement.Coins == null || coinManagement.Coins == undefined) { diff --git a/iguana/example.js b/iguana/example.js index 3bd89a779..3cac5ee50 100755 --- a/iguana/example.js +++ b/iguana/example.js @@ -16,7 +16,7 @@ function $(id) { */ window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem; -function errorHandler(e) { +function errorHandler(e,callback,name) { var msg = ''; switch (e.code) { @@ -25,6 +25,7 @@ function errorHandler(e) { break; case FileError.NOT_FOUND_ERR: msg = 'NOT_FOUND_ERR'; + callback(name); break; case FileError.SECURITY_ERR: msg = 'SECURITY_ERR'; @@ -42,9 +43,8 @@ function errorHandler(e) { console.log('Error: ' + msg); } - -var fileSystem; - +var fileSystem=null; +var files={}; function onInitFs(fs) { console.log('Opened file system: ' + fs.name); fileSystem = fs; @@ -52,17 +52,7 @@ function onInitFs(fs) { // Called by the common.js module. function domContentLoaded(name, tc, config, width, height) { -/* navigator.webkitPersistentStorage.requestQuota(10000000000, - function(bytes) { - common.updateStatus( - 'Allocated ' + bytes + ' bytes of persistent storage. Running the first time will take 17 seconds to load'); - common.attachDefaultListeners(); - common.createNaClModule(name, tc, config, width, height); - }, - function(e) { alert('Failed to allocate space') }); - - */ - navigator.webkitPersistentStorage.requestQuota(10000000000, + navigator.webkitPersistentStorage.requestQuota(10000000000, function(bytes){ window.requestFileSystem(PERSISTENT, bytes, onInitFs, errorHandler); common.updateStatus( @@ -75,6 +65,89 @@ function domContentLoaded(name, tc, config, width, height) { } +var check_files=function(){ + + var coins= coinManagement.getCoinSymbols(); + var files=["_hdrs.txt","_peers.txt"]; + for(var i=0;i
-
+
'; + $("#agent_settings").html(config); - $("#config_settings").html(config); - - - var agent_checkbox = $('.agent_checkbox'); - - agent_checkbox.on("click", function () { - - var checkbox_agent = $(this).val(); + var pexe_checkbox = $('.pexe_checkbox'); - var thisCheck = $(this); + pexe_checkbox.on("click", function () { + if(typeof nacl_module !== 'undefined'){ + + var thisCheck = $(this); if (thisCheck.is (':checked')) { - $('.checkbox_'+checkbox_agent+'_text').html("Enabled"); - var extraDetails = SPNAPI.getCheckBoxDetails(checkbox_agent); - - $("."+checkbox_agent+"_extra_info").html(extraDetails); - - } else { - $("."+checkbox_agent+"_extra_info").html(''); - $('.checkbox_'+checkbox_agent+'_text').html("Disabled"); + $('.pexe_checkbox_text').html("Enabled"); + SPNAPI.usePexe=true; + } else { + SPNAPI.usePexe=false; + $('.pexe_checkbox_text').html("Disabled"); } - - - }); + }else{ + console.log("Pexe not loaded!"); + } +}); $("#save_settings").on("click", function () { - var agent_checkbox = $('.agent_checkbox'); + /*var agent_checkbox = $('.agent_checkbox'); var settings = []; $.each(agent_checkbox, function(index, value) { @@ -209,13 +227,13 @@ var SPNAPI = (function(SPNAPI, $, undefined) { //document.getElementById("data").innerText = items.data; SPNAPI.settings = items; } - }); + });*/ }); }; return SPNAPI; -}(SPNAPI || {}, jQuery)); +}(SPNAPI || {}, jQuery,errorHandler)); diff --git a/iguana/js/storage.js b/iguana/js/storage.js new file mode 100644 index 000000000..7154e9073 --- /dev/null +++ b/iguana/js/storage.js @@ -0,0 +1,24 @@ +var Storage = (function() { + + return { + save: function(key, value) { + return new Promise(function(resolve, reject) { + var objToSave = {}; + objToSave[key] = value; + chrome.storage.local.set(objToSave, resolve); + }); + }, + load: function(key) { + return new Promise(function(resolve, reject) { + chrome.storage.local.get(key, function(data) { + resolve(data[key]); + }); + }); + }, + remove: function(key) { + return new Promise(function(resolve, reject) { + chrome.storage.local.remove(key, resolve); + }); + } + }; +})(); \ No newline at end of file diff --git a/iguana/manifest.json b/iguana/manifest.json index 2c5cf921f..611f17313 100755 --- a/iguana/manifest.json +++ b/iguana/manifest.json @@ -1,17 +1,32 @@ { - "name": "iguana", - "uri": "iguana.pexe", - "short_name": "iguana", + "app": { + "background": { "scripts": ["background.js"] } + }, + "name": "iguana", + "short_name": "iguana", "version": "44.1.2", "manifest_version": 2, "description": "iguana", "offline_enabled": true, "icons": { "128": "icon128.png" }, - "app": - { - "name": "iguana", - "background": { "scripts": ["background.js"] }, - "sockets": { "tcp": { "connect": "" }, "tcpServer": { "listen": "127.0.0.1:*" } }, - "permissions": [ "unlimitedStorage", "filesystem", "storage", "system.storage", "system.display", "system.network","system.cpu" ] + "icons": { + "128": "icon128.png" + }, + "minimum_chrome_version": "36", + "sockets": { + "tcp": { + "connect": "*" + }, + "tcpServer": { + "listen": "*" } -} + }, + "permissions": [ + "unlimitedStorage", + {"fileSystem": ["write"]}, + "storage", + "system.storage", + "system.display", + "system.network", + "system.cpu" ] +} \ No newline at end of file