From 269d2ad9a9ee8dadc84e1aaf1a461acd20ea8cb8 Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Sat, 11 Apr 2020 09:12:01 +0800 Subject: [PATCH] theme: show progress bar before navigating to another page --- theme/default/static/script.js | 5 +++++ theme/default/static/style.css | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/theme/default/static/script.js b/theme/default/static/script.js index 41e1cd0..a4435d6 100644 --- a/theme/default/static/script.js +++ b/theme/default/static/script.js @@ -6,4 +6,9 @@ avatar.onmouseover = (ev) => { }; avatar.onanimationend = (ev) => { ev.target.className = ""; +}; + +// Trigger progress bar when loading new page +window.onbeforeunload = (ev) => { + document.getElementsByClassName("loading-progress")[0].className = "loading-progress force-visible"; }; \ No newline at end of file diff --git a/theme/default/static/style.css b/theme/default/static/style.css index ddf5b9e..72fc39d 100644 --- a/theme/default/static/style.css +++ b/theme/default/static/style.css @@ -24,6 +24,10 @@ html { display: none !important; } +.loading-progress.force-visible { + display: block !important; +} + .hidden { display: none; }