diff --git a/app/includes/header-node-modal.tpl b/app/includes/header-node-modal.tpl index 45b361747b..54e6938185 100644 --- a/app/includes/header-node-modal.tpl +++ b/app/includes/header-node-modal.tpl @@ -48,11 +48,11 @@
- - - - - + + + + +
diff --git a/app/scripts/main.js b/app/scripts/main.js index fdc3e5054a..5355b474fd 100644 --- a/app/scripts/main.js +++ b/app/scripts/main.js @@ -131,6 +131,22 @@ if (IS_CX) { var mainPopCtrl = require("./controllers/CX/mainPopCtrl"); var quickSendCtrl = require("./controllers/CX/quickSendCtrl"); } + +// prepare some variables +var nodeList = {}; +if (typeof selectedNetworks !== 'undefined') { + var found = 0; + selectedNetworks.forEach(function(n) { + if (nodes.nodeList[n]) { + nodeList[n] = nodes.nodeList[n]; + found++; + } + }); + if (found > 0) { + nodes.nodeList = nodeList; + } +} + var app = angular.module("mewApp", [ "pascalprecht.translate", "ngSanitize", diff --git a/gulpfile.js b/gulpfile.js index d4d2fb932f..56bfe1884e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -30,6 +30,13 @@ const dist_CX = "./chrome-extension/"; // default Settings const Settings = require('./config.default.json'); +// get selected nodeList to override the nodes.nodeList +let selectedNetworks, i = process.argv.indexOf("--networks"); +if (i > -1 && process.argv[i + 1]) { + selectedNetworks = process.argv[i + 1].split(","); + console.log("Selected networks =", selectedNetworks); +} + // load custom settings try { let local = require('./config.json'); @@ -123,12 +130,22 @@ let js_srcFile = app + "scripts/main.js"; let js_destFolder = dist + "js/"; let js_destFolder_CX = dist_CX + "js/"; let js_destFile = "etherwallet-master.js"; -let browseOpts = { debug: true }; // generates inline source maps - only in js-debug +let js_opts = {}; // browserify opts let babelOpts = { presets: ["env"], compact: false }; +// have selected nodes ? +if (selectedNetworks) { + // setup browserify opts + js_opts.insertGlobalVars = { + selectedNetworks: function() { + return JSON.stringify(selectedNetworks); + } + }; +} + function bundle_js(bundler) { return bundler .bundle() @@ -154,21 +171,22 @@ function bundle_js_debug(bundler) { } gulp.task("js", function() { - let bundler = browserify(js_srcFile) + let bundler = browserify(js_srcFilei, js_opts) .transform(babelify) .transform(html2js); bundle_js(bundler); }); gulp.task("js-production", function() { - let bundler = browserify(js_srcFile) + let bundler = browserify(js_srcFile, js_opts) .transform(babelify, babelOpts) .transform(html2js); bundle_js(bundler); }); gulp.task("js-debug", function() { - let bundler = browserify(js_srcFile, browseOpts) + js_opts.debug = true; // generates inline source maps - only in js-debug + let bundler = browserify(js_srcFile, js_opts) .transform(babelify, babelOpts) .transform(html2js); bundle_js_debug(bundler);