aboutsummaryrefslogtreecommitdiff
path: root/src/app/browser.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/browser.js')
-rw-r--r--src/app/browser.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/app/browser.js b/src/app/browser.js
new file mode 100644
index 0000000..ae3e453
--- /dev/null
+++ b/src/app/browser.js
@@ -0,0 +1,46 @@
+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: "icons/no-image.png",
+ author: "Unnamed Pilot",
+ description: "No description",
+ ...properties
+ }
+
+ browser.innerHTML += `
+ <div class="el">
+ <div class="image">
+ <img src="${properties.image}">
+ </div>
+ <div class="text">
+ <div class="title">${properties.title}</div>
+ <div class="description">${properties.description} - by ${properties.author}</div>
+ </div>
+ </div>
+ `
+}
+
+new BrowserEl()
+new BrowserEl()
+new BrowserEl()