now splash screen can be disabled...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2019-01-13 08:04:29 +03:00
parent e0b91abcb1
commit f23dc1f780
3 changed files with 24 additions and 25 deletions

View File

@ -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.

View File

@ -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...

View File

@ -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()
})