Skip to content

Commit

Permalink
add user and based on links
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Apr 29, 2024
1 parent 41b2210 commit 528bb3e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<input type="text" id="sound" value="sound" inputmode="verbatim" autocapitalize="none" />
<button class="play"></button>
<button style="display: none;" class="icon playlock tooltip-bottom" data-tooltip="lock music"><img src="/static/resources/images/unlock.svg"/></button>
<a href="/" id="gallery">gallery</a>
<a href="/" class="parentLink" id="gallery">gallery</a>
<button id="help">help</button>
</div>
<div id="centerWrap">
Expand All @@ -91,7 +91,8 @@
</div>
</div>
<div id="bottom">
<!--template=userinfo--><pre></pre>
<div id="userInfo"></div>
<pre></pre>
<div id="soundInfo">
<a target="_blank" id="soundcloud"><img src="https://developers.soundcloud.com/assets/logo_white-af5006050dd9cba09b0c48be04feac57.png" /></a>
<a target="_blank" class="shrink" id="bandLink"></a>
Expand Down
11 changes: 10 additions & 1 deletion src/js/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,13 @@ function filter(f) {
}

const searchElem = document.querySelector('#search input[type=text]');
searchElem.addEventListener('input', () => filter(searchElem.value));
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);
}
}
28 changes: 23 additions & 5 deletions src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 528bb3e

Please sign in to comment.