diff --git a/src/index.html b/src/index.html index f69b29fb..ce634cb9 100644 --- a/src/index.html +++ b/src/index.html @@ -73,7 +73,7 @@ - gallery + gallery
@@ -91,7 +91,8 @@
-

+          
+

           
diff --git a/src/js/browser.js b/src/js/browser.js index 3983f742..a8c10ed7 100644 --- a/src/js/browser.js +++ b/src/js/browser.js @@ -29,4 +29,13 @@ function filter(f) { } const searchElem = document.querySelector('#search input[type=text]'); -searchElem.addEventListener('input', () => filter(searchElem.value)); \ No newline at end of file +searchElem.addEventListener('input', () => filter(searchElem.value)); + +{ + const s = new URLSearchParams(window.location.search); + const q = s.get('q'); + if (q) { + searchElem.value = q; + filter(q); + } +} \ No newline at end of file diff --git a/src/js/main.js b/src/js/main.js index 877ab0ea..2bc1de6b 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -980,12 +980,13 @@ define([ }; } - $("#gallery").addEventListener('click', function(event) { - if (parent) { - parent.location.href = this.href; - } + document.querySelectorAll('.parentLink').forEach(elem => { + elem.addEventListener('click', function(event) { + if (parent) { + parent.location.href = this.href; + } + }); }); - var notifier = new Notifier({ timeout: 7.5, @@ -2122,6 +2123,23 @@ define([ const art = await res.json(); settings = art.settings; options.screenshotURL = `../${art.screenshotURL}`; + + const userInfoElem = document.querySelector('#userInfo'); + { + const elem = document.createElement('a'); + elem.className = 'parentLink'; + elem.href = `../../?q=${art.owner.username}`; + elem.textContent = `by: ${art.owner.username}`; + userInfoElem.appendChild(elem); + } + if (art.origId) { + const elem = document.createElement('a'); + elem.className = 'parentLink'; + elem.href = `../art/${art.origId}`; + elem.textContent = `based on`; + userInfoElem.appendChild(elem); + } + } catch { settings = s.sets.default; }