From f23dc1f780ca7813676e09d4e9be56fc9f9c2baa Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 13 Jan 2019 08:04:29 +0300 Subject: [PATCH] now splash screen can be disabled... Signed-off-by: Alex A. Naanou --- ui (gen4)/e.js | 13 ++++++++++--- ui (gen4)/features/app.js | 17 ++++++++++++++--- ui (gen4)/ui.js | 19 ------------------- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/ui (gen4)/e.js b/ui (gen4)/e.js index 72659267..1c7cccfc 100644 --- a/ui (gen4)/e.js +++ b/ui (gen4)/e.js @@ -14,6 +14,7 @@ var BrowserWindow = electron.BrowserWindow var path = require('path') var url = require('url') +//var fs = require('fs') //--------------------------------------------------------------------- @@ -29,6 +30,8 @@ var url = require('url') var win function createWindow(){ + // NOTE: this is done here as this does not depend on code loading, + // thus showing the splash significantly faster... // XXX move this to splash.js and use both here and in app.js... // XXX also show load progress here... var splash = global.splash = new BrowserWindow({ @@ -40,7 +43,6 @@ function createWindow(){ center: true, width: 800, height: 500, - //backgroundColor: '#333333', alwaysOnTop: true, @@ -60,8 +62,13 @@ function createWindow(){ slashes: true })) splash.once('ready-to-show', function(){ - splash.show() - }) + this.webContents + // see if the splash screen is disabled... + .executeJavaScript('localStorage.disableSplashScreen') + .then(function(disabled){ + disabled ? + splash.destroy() + : splash.show() }) }) //*/ // Create the browser window. diff --git a/ui (gen4)/features/app.js b/ui (gen4)/features/app.js index a50a59d4..be57664b 100755 --- a/ui (gen4)/features/app.js +++ b/ui (gen4)/features/app.js @@ -281,14 +281,13 @@ var ElectronHostActions = actions.Actions({ // XXX move this to splash.js and use both here and in e.js... new electron.remote.BrowserWindow({ // let the window to get ready before we show it to the user... - //show: false, + show: false, transparent: true, frame: false, center: true, width: 800, height: 500, - //backgroundColor: '#333333', alwaysOnTop: true, @@ -310,6 +309,9 @@ var ElectronHostActions = actions.Actions({ protocol: 'file:', slashes: true })) + splash.once('ready-to-show', function(){ + splash.show() + }) } else if(action != 'on' && splash){ splash.destroy() @@ -523,7 +525,16 @@ var WindowedAppControlActions = actions.Actions({ }], toggleSplashScreenShowing: ['Interface/Splash screen on start', - core.makeConfigToggler('show-splash-screen', ['on', 'off'])], + core.makeConfigToggler('show-splash-screen', + ['on', 'off'], + function(action){ + if(action == 'on'){ + delete localStorage.disableSplashScreen + + } else if(action == 'off'){ + localStorage.disableSplashScreen = true + } + })], }) // XXX store/load window state... diff --git a/ui (gen4)/ui.js b/ui (gen4)/ui.js index bb280776..909f3a41 100755 --- a/ui (gen4)/ui.js +++ b/ui (gen4)/ui.js @@ -176,25 +176,6 @@ $(function(){ // setup the viewer... ig .load({ viewer: $('.viewer') }) - /* XXX load the intro index... - .on('ready', function(){ - // load some testing data if nothing else loaded... - if(!this.url_history || Object.keys(this.url_history).length == 0){ - // NOTE: we can (and do) load this in parts... - this - .loadDemoIndex() - // this is needed when loading legacy sources that do not have tags - // synced... - // do not do for actual data... - .syncTags('both') - } - }) - //*/ - /* XXX should this be here??? - .run(function(){ - this.toggleSplashScreen - && this.toggleSplashScreen('on') }) - //*/ .start() })