show external link for hash-loaded songs

This commit is contained in:
Carlos Galindo 2026-01-23 23:46:38 +01:00
commit 50a250888d

View file

@ -206,6 +206,7 @@ function addSpecificSong(n) {
for (let opt of select.options) { for (let opt of select.options) {
if (opt.textContent.slice(0, opt.textContent.indexOf(".")) == n) { if (opt.textContent.slice(0, opt.textContent.indexOf(".")) == n) {
select.value = opt.value; select.value = opt.value;
select.dispatchEvent(new Event("change"));
break; break;
} }
} }
@ -306,7 +307,7 @@ function setSong(event) {
a.href = "" a.href = ""
a.classList = []; a.classList = [];
} }
regenHash(); if (loadComplete) regenHash();
} }
function toggleCols(event) { function toggleCols(event) {
@ -329,12 +330,14 @@ function toggleColSep(event) {
colsep.disabled = !input.checked; colsep.disabled = !input.checked;
} }
var loadComplete = false;
window.addEventListener("load", function () { window.addEventListener("load", function () {
if (window.location.hash) { if (window.location.hash) {
// Load songs // Load songs
for (let n of window.location.hash.slice(1).split(",")) for (let n of window.location.hash.slice(1).split(","))
addSpecificSong(n); addSpecificSong(n);
} }
loadComplete = true;
}); });
</script> </script>
</body> </body>