makes the song index behave properly
This commit is contained in:
parent
319ff01051
commit
5ca3aaa44f
@ -1,9 +1,6 @@
|
|||||||
function getAnchor() {
|
|
||||||
return (document.URL.split('#').length > 1) ? document.URL.split('#')[1] : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
window.addEventListener('load', (event) => {
|
window.addEventListener('load', (event) => {
|
||||||
const preclicked = getAnchor();
|
const preclicked = window.location.hash.slice(1);
|
||||||
|
console.log(preclicked);
|
||||||
if (! preclicked) return;
|
if (! preclicked) return;
|
||||||
const radiobutton = document.getElementById(preclicked);
|
const radiobutton = document.getElementById(preclicked);
|
||||||
if (radiobutton){
|
if (radiobutton){
|
||||||
@ -21,13 +18,20 @@ function albumselect(code){
|
|||||||
label.scrollIntoView();
|
label.scrollIntoView();
|
||||||
}
|
}
|
||||||
document.getElementById('search-input').value = '';
|
document.getElementById('search-input').value = '';
|
||||||
|
document.getElementById('search-results').innerHTML = '';
|
||||||
};
|
};
|
||||||
|
|
||||||
function collapse(clickevent){
|
function albumHeaderClick(clickevent){
|
||||||
const radiobutton = document.getElementById(clickevent.target.htmlFor);
|
const radiobutton = document.getElementById(clickevent.target.htmlFor);
|
||||||
if (radiobutton.checked){
|
if (radiobutton.checked){
|
||||||
radiobutton.checked = false;
|
radiobutton.checked = false;
|
||||||
clickevent.preventDefault();
|
clickevent.preventDefault();
|
||||||
|
history.replaceState(null, document.title, `${window.location.origin}${window.location.pathname}${window.location.search}`);
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
window.location.hash = radiobutton.id;
|
||||||
|
const label = clickevent.target;
|
||||||
|
label.scrollIntoView();
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
{% for album_id, name, date, code in album_info %}
|
{% for album_id, name, date, code in album_info %}
|
||||||
<div class="sort-box album">
|
<div class="sort-box album">
|
||||||
<input type="radio" name="album" id="{{ code }}" class="collapse">
|
<input type="radio" name="album" id="{{ code }}" class="collapse">
|
||||||
<label for="{{ code }}" id="{{ code }}_label" class="sort-header album" onclick="collapse(event)">
|
<label for="{{ code }}" id="{{ code }}_label" class="sort-header album" onclick="albumHeaderClick(event)">
|
||||||
<img src="{{ url_for('static', filename='albumicons/') }}{{ code }}.svg" alt="{{ code }}" class="album-icon"/>
|
<img src="{{ url_for('static', filename='albumicons/') }}{{ code }}.svg" alt="{{ code }}" class="album-icon"/>
|
||||||
<h2>{{ name }}</h2>
|
<h2>{{ name }}</h2>
|
||||||
</label>
|
</label>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user