aboutsummaryrefslogtreecommitdiff
path: root/src/app/browser.js
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2022-01-20 13:45:57 +0100
committer0neGal <mail@0negal.com>2022-01-20 13:45:57 +0100
commitfd967f570985339905c52238ead049555c5efcdc (patch)
tree9a4d1c0bf1ab7f3e32ecfa4c5416d190933a243f /src/app/browser.js
parent20bf62f42f41638733e0b02affe90c04b1cb2938 (diff)
downloadViper-fd967f570985339905c52238ead049555c5efcdc.tar.gz
Viper-fd967f570985339905c52238ead049555c5efcdc.zip
added fallback icon, and ways to close the browser
You can either click "Escape" or simply click on the darkened background and it'll then close it. Ideally the fallback icon should never be shown, and it is more for testing. I also added a search bar that does nothing currently.
Diffstat (limited to 'src/app/browser.js')
-rw-r--r--src/app/browser.js21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/app/browser.js b/src/app/browser.js
index 1fe6930..ae3e453 100644
--- a/src/app/browser.js
+++ b/src/app/browser.js
@@ -1,11 +1,28 @@
-function Browser() {
+function Browser(state) {
+ if (state) {
+ overlay.classList.add("shown")
+ browser.classList.add("shown")
+ return
+ } else if (! state) {
+ if (state != undefined) {
+ overlay.classList.remove("shown")
+ browser.classList.remove("shown")
+ return
+ }
+ }
+
+ overlay.classList.toggle("shown")
browser.classList.toggle("shown")
};Browser()
+document.body.addEventListener("keyup", (e) => {
+ if (e.key == "Escape") {Browser(false)}
+})
+
function BrowserEl(properties) {
properties = {
title: "No name",
- image: "",
+ image: "icons/no-image.png",
author: "Unnamed Pilot",
description: "No description",
...properties