From 8886d5111aa4ae75f54f46c93f09fa7548979969 Mon Sep 17 00:00:00 2001 From: Minteck <46352972+Minteck@users.noreply.github.com> Date: Fri, 9 Jul 2021 00:37:48 +0200 Subject: Fixes --- views/script/core_notification.js | 13 +++++++++++++ views/script/loader_global.js | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 views/script/core_notification.js (limited to 'views/script') diff --git a/views/script/core_notification.js b/views/script/core_notification.js new file mode 100644 index 0000000..118d19d --- /dev/null +++ b/views/script/core_notification.js @@ -0,0 +1,13 @@ +var ipcRenderer = require('electron').ipcRenderer; +ipcRenderer.on('notification', function (event, data) { + document.getElementById("notification-title").innerText = data.title; + document.getElementById("notification-message").innerText = data.message; + document.getElementById("notification").style.right = "20px"; + document.getElementById("notification").style.opacity = "1"; + new Audio("./sfx/notification.mp3").play(); + + setTimeout(() => { + document.getElementById("notification").style.right = "-300px"; + document.getElementById("notification").style.opacity = "0"; + }, 5000) +}); \ No newline at end of file diff --git a/views/script/loader_global.js b/views/script/loader_global.js index 6bde06c..7c89d0f 100644 --- a/views/script/loader_global.js +++ b/views/script/loader_global.js @@ -19,7 +19,7 @@ window.addEventListener('load', () => { document.getElementById('updates').style.backgroundColor = "lightgreen"; document.getElementById('updates').innerText = lang.updates.ok; } else { - document.getElementById('warning').style.opacity = "1"; + require('@electron/remote').getCurrentWindow().webContents.send("notification", {title: lang.updates.warn[0], message: lang.updates.warn[1]}); document.getElementById('updates').style.backgroundColor = "lightyellow"; document.getElementById('updates').innerText = lang.updates.available; } -- cgit