summaryrefslogtreecommitdiff
path: root/static/scripts
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <david@luevano.xyz>2022-05-28 05:11:10 -0600
committerDavid Luevano Alvarado <david@luevano.xyz>2022-05-28 05:11:10 -0600
commit71ab4a120db05e055de864efd09d43e901ef8aaa (patch)
treee88f579b2f90eae66daefb916126d6949e16d55e /static/scripts
parent1c4d6ec6b49e8f80ccc46ee619caf5eba082f1e0 (diff)
add support for gdscript for hljs, add wip flappy bird devlog
Diffstat (limited to 'static/scripts')
-rw-r--r--static/scripts/hljs_gdscript_class.js7
-rw-r--r--static/scripts/theme.js9
2 files changed, 13 insertions, 3 deletions
diff --git a/static/scripts/hljs_gdscript_class.js b/static/scripts/hljs_gdscript_class.js
new file mode 100644
index 0000000..3feb099
--- /dev/null
+++ b/static/scripts/hljs_gdscript_class.js
@@ -0,0 +1,7 @@
+// this is a dirty solution as I wasn't able to add actual gdscript functionality as described
+// in the hljs documentation... I'm too dumb I guess
+// no longer required, i'm directly using what i found here: https://joshanthony.info/2021/07/01/how-to-add-gdscript-syntax-highlighting-to-your-blog/
+document.addEventListener("DOMContentLoaded", function(event) {
+ let a = document.getElementsByClassName("language-gdscript");
+ [...a].forEach(x => x.className = "hljs gdscript");
+}) \ No newline at end of file
diff --git a/static/scripts/theme.js b/static/scripts/theme.js
index 9036698..a107101 100644
--- a/static/scripts/theme.js
+++ b/static/scripts/theme.js
@@ -1,7 +1,10 @@
-// refactored code for a better solution found in https://medium.com/@haxzie/dark-and-light-theme-switcher-using-css-variables-and-pure-javascript-zocada-dd0059d72fa2
+// refactored code for a better solution found in:
+// https://medium.com/@haxzie/dark-and-light-theme-switcher-using-css-variables-and-pure-javascript-zocada-dd0059d72fa2
var local_storage = window.localStorage;
-window.onload = () => {
+// changed window.onload to document.addEventListener, as suggested here:
+// https://stackoverflow.com/a/800010
+document.addEventListener("DOMContentLoaded", function(event) {
let theme = local_storage.getItem('theme');
if(theme == null){
@@ -15,7 +18,7 @@ window.onload = () => {
setTheme('theme-light');
}
}
-}
+})
function setTheme(themeName){
local_storage.setItem('theme', themeName)