diff --git a/controller/controller.js b/controller/controller.js index b203f85..c343239 100644 --- a/controller/controller.js +++ b/controller/controller.js @@ -13,6 +13,16 @@ function getRadioValue(buttons){ } } +function set_timer_font(){ + let new_choice = document.querySelector("#select-font").value; + if (new_choice == "default"){ + ipcRenderer.send("set-timer-font", ""); + } + else{ + ipcRenderer.send("set-timer-font", new_choice); + } +} + document.addEventListener('DOMContentLoaded', () => { showLogos(); @@ -48,17 +58,7 @@ document.addEventListener('DOMContentLoaded', () => { displayWindow.webContents.send("set-end-sound", document.querySelector("#end-sound").checked); }; - document.querySelector("#select-font").onchange = function(){ - let new_choice = document.querySelector("#select-font").value; - if (new_choice == "default"){ - // displayWindow.webContents.send("set-timer-font", ""); - ipcRenderer.send("set-timer-font", ""); - } - else{ - // displayWindow.webContents.send("set-timer-font", new_choice); - ipcRenderer.send("set-timer-font", new_choice); - } - }; + document.querySelector("#select-font").onchange = set_timer_font; document.querySelector("#logo-dir-picker").onchange = function(){ // console.log(document.querySelector("#logo-dir-picker").files); @@ -144,6 +144,8 @@ document.addEventListener('DOMContentLoaded', () => { document.querySelector("#spawn-extra-timer-window").onclick = function(){ // console.log("spawn extra timer window button clicked"); ipcRenderer.send("spawn-extra-timer-window"); + //terrible hack, I know + setTimeout(set_timer_font, 500); }; document.querySelector("#schedule-csv-picker").onchange = function(){ diff --git a/display/timer.js b/display/timer.js index 65149c1..1808473 100644 --- a/display/timer.js +++ b/display/timer.js @@ -262,6 +262,7 @@ ipcRenderer.on('set-timer-font', function(event, arg) { } else{ brick_font = false; + setTimerValue(secsToClock(count)); document.querySelector('.timer-text').style.fontFamily = arg; document.querySelector("#timer-text-wrapper").classList.remove("brick"); } diff --git a/extraTimer/extraTimer.html b/extraTimer/extraTimer.html index 2a3b50e..440456c 100644 --- a/extraTimer/extraTimer.html +++ b/extraTimer/extraTimer.html @@ -12,8 +12,8 @@
-
-
+
+
diff --git a/extraTimer/extraTimer.js b/extraTimer/extraTimer.js index 1284d1e..5eb2892 100644 --- a/extraTimer/extraTimer.js +++ b/extraTimer/extraTimer.js @@ -1,10 +1,46 @@ const { remote, ipcRenderer } = require('electron'); +var brick_font = false; + +function setTimerValue(text){ + document.querySelector('.timer-text').innerHTML = brick_font ? textToImage(text) : text; +} + +function textToImage(text){ + if (text.charAt(1) != ":" || text.length != 4){ + // if (text.length != 3){ + console.error("Format: x:yz"); + } + else{ + let left = text.charAt(0); + let mid = text.charAt(2); + let right = text.charAt(3); + + return ` + + + + ` + } +} + ipcRenderer.on("set-timer-text", function(event, arg){ - console.log("Setting timer text to " + arg); - document.querySelector(".timer-numbers").innerHTML = arg; + setTimerValue(arg); + // console.log("Setting timer text to " + arg); + // document.querySelector(".timer-text").innerHTML = arg; }); ipcRenderer.on("set-timer-font", function(event, arg){ - document.querySelector(".timer-numbers").style.fontFamily = arg; + // document.querySelector(".timer-text").style.fontFamily = arg; + if (arg == "bricks"){ + brick_font = true; + setTimerValue(secsToClock(count)); + document.querySelector("#timer-text-wrapper").classList.add("brick"); + } + else{ + brick_font = false; + setTimerValue(secsToClock(count)); + document.querySelector('.timer-text').style.fontFamily = arg; + document.querySelector("#timer-text-wrapper").classList.remove("brick"); + } }); \ No newline at end of file