Added modal to customize websocket url
This commit is contained in:
parent
35ffca5d8d
commit
a94967ab3f
1 changed files with 24 additions and 0 deletions
|
|
@ -239,6 +239,30 @@ class SpotiQueue {
|
|||
this.button.style.color = "";
|
||||
this.connect();
|
||||
});
|
||||
this.button.addEventListener("contextmenu", (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
const div = document.createElement("div");
|
||||
div.innerHTML = `
|
||||
<div style="display: flex; flex-direction: row; gap: 0.5em;">
|
||||
<input style="flex-grow: 1; box-sizing: border-box; padding: 8px;">
|
||||
<button style="background: #1db954; color: #fff; border: none; margin: 0; padding: 0px 12px; border-radius: 6px"> Save </button>
|
||||
</div>
|
||||
`;
|
||||
Spicetify.PopupModal.display({ title: "WebSocket URL", content: div });
|
||||
|
||||
div.querySelector("input").value = this.wsUrl
|
||||
div.querySelector("button").onclick = () => {
|
||||
const newUrl = div.querySelector("input").value.trim();
|
||||
if (!newUrl) return;
|
||||
|
||||
localStorage.setItem("spotiqueueUrl", newUrl);
|
||||
this.wsUrl = newUrl;
|
||||
this.stop();
|
||||
Spicetify.PopupModal.hide();
|
||||
Spicetify.showNotification("Saved!");
|
||||
};
|
||||
});
|
||||
|
||||
Spicetify.Player.addEventListener("songchange", (info) => {
|
||||
console.log(info);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue