Hide/Show ListenBrainz settings

This commit is contained in:
Mar0xy 2023-07-30 21:17:03 +02:00
parent d81912db0c
commit e9434cc5ea
No known key found for this signature in database
GPG Key ID: 56569BBE47D2C828
3 changed files with 19 additions and 12 deletions

View File

@ -8,7 +8,7 @@ const ListenBrainzStore = new Store({name: "listenbrainz"});
export class ListenBrainz {
/**
* Call the ListenBrainz API and create playing now payload
* Call the ListenBrainz API and create playing now payload and scrobble old song
* @param title
* @param artists
* @param status

View File

@ -144,6 +144,10 @@ window.addEventListener("DOMContentLoaded", () => {
} else {
settingsStore.set(key, source.value);
}
// Live update the view for ListenBrainz input, hide if disabled/show if enabled
if (source.value === "on" && source.id === "enableListenBrainz") {
source.checked ? document.getElementById("listenbrainz__options").hidden = false : document.getElementById("listenbrainz__options").hidden = true;
}
ipcRenderer.send(globalEvents.storeChanged);
});
}
@ -195,6 +199,7 @@ window.addEventListener("DOMContentLoaded", () => {
ListenBrainzToken = get("ListenBrainzToken");
refreshSettings();
enableListenBrainz.checked ? document.getElementById("listenbrainz__options").hidden = false : document.getElementById("listenbrainz__options").hidden = true;
addInputListener(adBlock, settings.adBlock);
addInputListener(api, settings.api);

View File

@ -221,6 +221,7 @@
<span class="switch__slider"></span>
</label>
</div>
<div id="listenbrainz__options" hidden="true">
<div class="group__option">
<div class="group__description">
<h4>ListenBrainz API Url</h4>
@ -236,6 +237,7 @@
</div>
<textarea id="ListenBrainzToken" class="textarea" cols="1" rows="1" spellcheck="false"></textarea>
</div>
</div>
</section>
<section id="advanced-section" class="tabs__section">