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.js29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/app/browser.js b/src/app/browser.js
index 4d14885..b3b1b59 100644
--- a/src/app/browser.js
+++ b/src/app/browser.js
@@ -83,6 +83,7 @@ var Browser = {
Browser.filters.toggle(false);
overlay.classList.remove("shown")
browser.classList.remove("shown")
+ preview.classList.remove("shown")
return
}
}
@@ -243,6 +244,20 @@ var Browser = {
}
}
+var view = document.querySelector(".popup#preview webview");
+var Preview = {
+ show: () => {
+ preview.classList.add("shown")
+ },
+ hide: () => {
+ preview.classList.remove("shown")
+ },
+ set: (url, autoshow) => {
+ if (autoshow != false) {Preview.show()}
+ view.src = url;
+ }
+}
+
function BrowserElFromObj(obj) {
let pkg = {...obj, ...obj.versions[0]};
@@ -325,7 +340,7 @@ function BrowserEl(properties) {
<div class="title">${properties.title}</div>
<div class="description">${properties.description}</div>
<button class="install" onclick='installFromURL("${properties.download}", ${JSON.stringify(properties.dependencies)}, true)'>${installstr}</button>
- <button class="info" onclick="require('electron').shell.openExternal('${properties.url}')">${lang('gui.browser.info')}</button>
+ <button class="info" onclick="Preview.set('${properties.url}')">${lang('gui.browser.info')}</button>
<button class="visual">${properties.version}</button>
<button class="visual">${lang("gui.browser.madeby")} ${properties.author}</button>
</div>
@@ -413,8 +428,16 @@ search.addEventListener("keyup", () => {
}
})
-browser.addEventListener("scroll", () => {
- Browser.filters.toggle(false);
+let events = ["scroll", "mousedown", "touchdown"];
+events.forEach((event) => {
+ browser.addEventListener(event, () => {
+ Preview.hide();
+ Browser.filters.toggle(false);
+ })
+});
+
+view.addEventListener("dom-ready", () => {
+ view.insertCSS(fs.readFileSync(__dirname + "/css/webview.css", "utf8"));
})
let checks = document.querySelectorAll(".check");