diff options
Diffstat (limited to 'views/script')
-rw-r--r-- | views/script/core_fullscreen.js | 60 | ||||
-rw-r--r-- | views/script/core_music.js | 187 | ||||
-rw-r--r-- | views/script/core_viewer.js | 7 | ||||
-rw-r--r-- | views/script/loader_global.js | 6 |
4 files changed, 135 insertions, 125 deletions
diff --git a/views/script/core_fullscreen.js b/views/script/core_fullscreen.js index f2c540d..d45cccf 100644 --- a/views/script/core_fullscreen.js +++ b/views/script/core_fullscreen.js @@ -1,40 +1,42 @@ window.addEventListener("load", () => { require('@electron/remote').getCurrentWindow().show(); - const Nest = require("./nest/abi"); + if (location.hash === "#ready") { + const Nest = require("./nest/abi"); - $(document).keydown(function(e) { - if (e.keyCode === 122 || e.keyCode === 121 || e.keyCode === 112) { // F11/F1/F10 - if (!require('@electron/remote').getCurrentWindow().fullScreen && require('@electron/remote').getCurrentWindow().fullScreenable) { - require('@electron/remote').getCurrentWindow().setFullScreen(true); - } else { - require('@electron/remote').getCurrentWindow().setFullScreen(false); + $(document).keydown(function(e) { + if (e.keyCode === 122 || e.keyCode === 121 || e.keyCode === 112) { // F11/F1/F10 + if (!require('@electron/remote').getCurrentWindow().fullScreen && require('@electron/remote').getCurrentWindow().fullScreenable) { + require('@electron/remote').getCurrentWindow().setFullScreen(true); + } else { + require('@electron/remote').getCurrentWindow().setFullScreen(false); + } } - } - }) + }) - $(document).keydown(function(e) { - currentNest = Nest.load(homedir + "/.kartik/current.kfn"); + $(document).keydown(function(e) { + currentNest = Nest.load(homedir + "/.kartik/current.kfn"); - if (e.keyCode === 122 || e.keyCode === 121 || e.keyCode === 112) { - if (currentNest.config.fullscreen) { - currentNest.config.fullscreen = false; - Nest.export(homedir + "/.kartik/current.kfn", currentNest); - require('electron').ipcRenderer.send("reloadNest") - } else { - currentNest.config.fullscreen = true; - Nest.export(homedir + "/.kartik/current.kfn", currentNest); - require('electron').ipcRenderer.send("reloadNest"); + if (e.keyCode === 122 || e.keyCode === 121 || e.keyCode === 112) { + if (currentNest.config.fullscreen) { + currentNest.config.fullscreen = false; + Nest.export(homedir + "/.kartik/current.kfn", currentNest); + require('electron').ipcRenderer.send("reloadNest") + } else { + currentNest.config.fullscreen = true; + Nest.export(homedir + "/.kartik/current.kfn", currentNest); + require('electron').ipcRenderer.send("reloadNest"); + } } - } - }) + }) - currentNest = Nest.load(homedir + "/.kartik/current.kfn"); - if (currentNest.config.fullscreen) { - require('@electron/remote').getCurrentWindow().setFullScreen(true); - } else { - currentNest.config.fullscreen = false; - Nest.export(homedir + "/.kartik/current.kfn", currentNest); - require('electron').ipcRenderer.send("reloadNest") + currentNest = Nest.load(homedir + "/.kartik/current.kfn"); + if (currentNest.config.fullscreen) { + require('@electron/remote').getCurrentWindow().setFullScreen(true); + } else { + currentNest.config.fullscreen = false; + Nest.export(homedir + "/.kartik/current.kfn", currentNest); + require('electron').ipcRenderer.send("reloadNest") + } } })
\ No newline at end of file diff --git a/views/script/core_music.js b/views/script/core_music.js index 464fc85..99d5455 100644 --- a/views/script/core_music.js +++ b/views/script/core_music.js @@ -1,116 +1,115 @@ -/*global.csng = null; -global.csp1 = null; -global.csp2 = null; -global.cspn = 1;*/ -global.musicElement = new Audio(); -const musicIpc = require('electron').ipcRenderer; +if (location.hash === "#ready") { + global.musicElement = new Audio(); + const musicIpc = require('electron').ipcRenderer; -musicIpc.on('setmusic', (event, args) => { - musicElement.src = args; - musicElement.play(); - musicElement.volume = 1; - musicElement.loop = true; - /*if (!musicElement.paused) { - csi1 = setInterval(() => { - if (musicElement.volume <= 0.05) { - clearInterval(csi1); - musicElement.src = args; - musicElement.play(); - musicElement.volume = 0; + musicIpc.on('setmusic', (event, args) => { + musicElement.src = args; + musicElement.play(); + musicElement.volume = 1; + musicElement.loop = true; + /*if (!musicElement.paused) { + csi1 = setInterval(() => { + if (musicElement.volume <= 0.05) { + clearInterval(csi1); + musicElement.src = args; + musicElement.play(); + musicElement.volume = 0; + csi2 = setInterval(() => { + if (musicElement.volume >= 0.95) { + clearInterval(csi2); + return; + } + musicElement.volume = musicElement.volume + 0.05; + }, 100) + return; + } + musicElement.volume = musicElement.volume - 0.05; + }, 100) + } else { + musicElement.src = args; + musicElement.play(); + }*/ + /*try { csp1.volume = 0; } catch (e) {} + try { csp2.volume = 0; } catch (e) {} + song = args; + + if (song !== null && song !== "" && csng !== song) { + if (cspn === 1) { + if (csp1 !== null) { + csi1 = setInterval(() => { + if (csp1.volume <= 0.05) { + csp1.pause(); + csp1.volume = 0; + clearInterval(csi1); + return; + } + csp1.volume = csp1.volume - 0.05; + }, 100) + } + csp2 = new Audio(song); + csp2.volume = 0; + csp2.loop = true; + csp2.play(); csi2 = setInterval(() => { - if (musicElement.volume >= 0.95) { + if (csp2.volume >= 0.95) { clearInterval(csi2); return; } - musicElement.volume = musicElement.volume + 0.05; + csp2.volume = csp2.volume + 0.05; }, 100) - return; - } - musicElement.volume = musicElement.volume - 0.05; - }, 100) - } else { - musicElement.src = args; - musicElement.play(); - }*/ - /*try { csp1.volume = 0; } catch (e) {} - try { csp2.volume = 0; } catch (e) {} - song = args; - - if (song !== null && song !== "" && csng !== song) { - if (cspn === 1) { - if (csp1 !== null) { + csng = song; + cspn = 2; + } else { + if (csp2 !== null) { + csi2 = setInterval(() => { + if (csp2.volume <= 0.05) { + csp2.pause(); + csp2.volume = 0; + clearInterval(csi2); + return; + } + csp2.volume = csp2.volume - 0.05; + }, 100) + } + csp1 = new Audio(song); + csp1.volume = 0; + csp1.loop = true; + csp1.play(); csi1 = setInterval(() => { - if (csp1.volume <= 0.05) { - csp1.pause(); - csp1.volume = 0; + if (csp1.volume >= 0.95) { clearInterval(csi1); return; } - csp1.volume = csp1.volume - 0.05; + csp1.volume = csp1.volume + 0.05; }, 100) + csng = song; + cspn = 1; } - csp2 = new Audio(song); - csp2.volume = 0; - csp2.loop = true; - csp2.play(); - csi2 = setInterval(() => { - if (csp2.volume >= 0.95) { - clearInterval(csi2); + }*/ + }) + + musicIpc.on('fademusic', (event) => { + if (!musicElement.paused) { + csi1 = setInterval(() => { + if (musicElement.volume <= 0.3) { + clearInterval(csi1); return; } - csp2.volume = csp2.volume + 0.05; + musicElement.volume = musicElement.volume - 0.05; }, 100) - csng = song; - cspn = 2; - } else { - if (csp2 !== null) { - csi2 = setInterval(() => { - if (csp2.volume <= 0.05) { - csp2.pause(); - csp2.volume = 0; - clearInterval(csi2); - return; - } - csp2.volume = csp2.volume - 0.05; - }, 100) - } - csp1 = new Audio(song); - csp1.volume = 0; - csp1.loop = true; - csp1.play(); + } + }) + + musicIpc.on('unfademusic', (event) => { + if (!musicElement.paused) { csi1 = setInterval(() => { - if (csp1.volume >= 0.95) { + if (musicElement.volume >= 0.95) { clearInterval(csi1); return; } - csp1.volume = csp1.volume + 0.05; + musicElement.volume = musicElement.volume + 0.05; }, 100) - csng = song; - cspn = 1; } - }*/ -}) + }) -musicIpc.on('fademusic', (event) => { - if (!musicElement.paused) { - csi1 = setInterval(() => { - if (musicElement.volume <= 0.3) { - clearInterval(csi1); - return; - } - musicElement.volume = musicElement.volume - 0.05; - }, 100) - } -}) - -musicIpc.on('unfademusic', (event) => { - if (!musicElement.paused) { - csi1 = setInterval(() => { - if (musicElement.volume >= 0.95) { - clearInterval(csi1); - return; - } - musicElement.volume = musicElement.volume + 0.05; - }, 100) - } -}) +}
\ No newline at end of file diff --git a/views/script/core_viewer.js b/views/script/core_viewer.js index eac3766..a538b99 100644 --- a/views/script/core_viewer.js +++ b/views/script/core_viewer.js @@ -2,9 +2,14 @@ const webview = document.getElementById('wb'); try { webview.addEventListener('dom-ready', () => { - document.getElementById('dummyloader').style.display = "none"; + setTimeout(() => { + document.getElementById('dummyloader').style.display = "none"; + }, 5000) require('@electron/remote').getCurrentWindow().log(" * " + webview.getURL()); require('@electron/remote').getCurrentWindow().focus(); + if (location.hash === "#ready") { + require('@electron/remote').webContents.fromId(webview.getWebContentsId()).send("ready", true); + } webview.focus(); try { if (require('@electron/remote').getCurrentWindow().debug) { diff --git a/views/script/loader_global.js b/views/script/loader_global.js index 3a35d54..81b4dd7 100644 --- a/views/script/loader_global.js +++ b/views/script/loader_global.js @@ -1,4 +1,8 @@ -window.addEventListener('load', () => {
+const $ = require('jquery');
+
+require('electron').ipcRenderer.on('ready', (e, a) => {
+ document.getElementById("banner-decoration").style.display = "";
+
setTimeout(() => {
if (native) {
setTimeout(() => {
|