diff options
author | 0neGal <mail@0negal.com> | 2022-05-17 02:02:46 +0200 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2022-05-17 02:02:46 +0200 |
commit | 08b9d0db360736454186a08cdb5b4630522e55c7 (patch) | |
tree | 03fe33b70be69194f517fe63b665b8be626cea2b /src/app/browser.js | |
parent | bb5446be8164176219784290f18751c6f35c4047 (diff) | |
download | Viper-08b9d0db360736454186a08cdb5b4630522e55c7.tar.gz Viper-08b9d0db360736454186a08cdb5b4630522e55c7.zip |
preview <webview> now fades in and out seamlessly
Instead of instantly flashing when it's done loading and so on, it now
fades in, instead, without any problems.
Diffstat (limited to 'src/app/browser.js')
-rw-r--r-- | src/app/browser.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/app/browser.js b/src/app/browser.js index 138aef8..acced69 100644 --- a/src/app/browser.js +++ b/src/app/browser.js @@ -251,10 +251,10 @@ function openExternal(url) { var view = document.querySelector(".popup#preview webview"); var Preview = { show: () => { - preview.classList.add("shown") + preview.classList.add("shown"); }, hide: () => { - preview.classList.remove("shown") + preview.classList.remove("shown"); }, set: (url, autoshow) => { if (autoshow != false) {Preview.show()} @@ -450,6 +450,18 @@ view.addEventListener("dom-ready", () => { view.insertCSS(css.join(" ")); }) +view.addEventListener("did-stop-loading", () => { + view.style.display = "flex"; + setTimeout(() => { + view.classList.remove("loading"); + }, 200) +}) + +view.addEventListener("did-start-loading", () => { + view.style.display = "none"; + view.classList.add("loading"); +}) + let checks = document.querySelectorAll(".check"); for (let i = 0; i < checks.length; i++) { checks[i].setAttribute("onclick", "this.classList.toggle('checked');Browser.loadfront();search.value = ''") |