diff options
author | Minteck <nekostarfan@gmail.com> | 2021-06-05 19:27:48 +0200 |
---|---|---|
committer | Minteck <nekostarfan@gmail.com> | 2021-06-05 19:27:48 +0200 |
commit | 8cf5cefe6e91a5a1ed6eeaae4d94760d84c304a6 (patch) | |
tree | 7096b67b189c0220826123c7d5b121752545d140 /views/script/core_head.js | |
download | kartik-client-8cf5cefe6e91a5a1ed6eeaae4d94760d84c304a6.tar.gz kartik-client-8cf5cefe6e91a5a1ed6eeaae4d94760d84c304a6.tar.bz2 kartik-client-8cf5cefe6e91a5a1ed6eeaae4d94760d84c304a6.zip |
Presque sortie du jeu
Diffstat (limited to 'views/script/core_head.js')
-rw-r--r-- | views/script/core_head.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/views/script/core_head.js b/views/script/core_head.js new file mode 100644 index 0000000..be27c87 --- /dev/null +++ b/views/script/core_head.js @@ -0,0 +1,31 @@ +if (native) {global.$ = require('jquery');} else {var script = document.createElement('script');script.src = './webinit/jquery.js';script.type = 'text/javascript';document.getElementsByTagName('head')[0].appendChild(script);} + +if (native && require('@electron/remote').getCurrentWindow().debug) { + document.write('<link rel="stylesheet" href="' + atob("Li92aWV3cy9jb21tb24vZGVidWcuY3Nz") + '">'); +} + +if (native) { + var ipcRenderer = require('electron').ipcRenderer; + ipcRenderer.on('scenario', function (event,obj) { + try { + console.log(kresources.scenario.voice[obj.lang] + "/" + obj.namespace + obj.id + ".mp3"); + a = new Audio(kresources.scenario.voice[obj.lang] + "/" + obj.namespace + obj.id + ".mp3"); + a.onended = () => { + setTimeout(() => { + $("#message").fadeOut(200); + if (typeof obj.cb == "function") { + obj.cb(); + } + }, 3000) + } + a.play(); + } catch (e) { + console.error(e); + obj.cb(); + } + + document.getElementById('message-text').innerText = obj.message; + document.getElementById('message-character-inner').src = kresources.scenario.averi[obj.emote]; + $("#message").fadeIn(200); + }); +} |