From e130e2c7614f1da946e0054c326dd60cfab43ab7 Mon Sep 17 00:00:00 2001 From: Raphix Date: Mon, 1 May 2023 23:39:49 +0200 Subject: [PATCH] 2.1.2 Offical Version --- infoupdate.html | 10 +++ package.json | 2 +- templates/app/app.css | 5 ++ templates/app/app.html | 14 ++++ templates/app/app.js | 154 +++++++++++++++++++++++++++++++++--- templates/common/common.css | 32 +++++++- 6 files changed, 202 insertions(+), 15 deletions(-) diff --git a/infoupdate.html b/infoupdate.html index 82d35d7..c40ad1b 100644 --- a/infoupdate.html +++ b/infoupdate.html @@ -1,3 +1,13 @@ +

Subsonics 2.1.2

+

Sortie le : 02/05/2022

+

Ajouts & Fixes :

+ +
+

Subsonics 2.1.1

Sortie le : 31/04/2022

Ajouts & Fixes :

diff --git a/package.json b/package.json index 42e0c91..c0f4365 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "subsonics-manager", - "version": "2.1.1", + "version": "2.1.2", "description": "Manager for subsonics", "main": "main.js", "scripts": { diff --git a/templates/app/app.css b/templates/app/app.css index d17ef24..e3207cc 100644 --- a/templates/app/app.css +++ b/templates/app/app.css @@ -66,6 +66,10 @@ margin-top: 5px; } +.searchTitle { + margin: 0; + word-break: break-all; +} .signout { @@ -506,6 +510,7 @@ input[type=range] { display: flex; flex-direction: row; margin: 0; + margin-bottom: 5px; vertical-align: middle; align-items: center; justify-content: space-between; diff --git a/templates/app/app.html b/templates/app/app.html index b416e37..a64f547 100644 --- a/templates/app/app.html +++ b/templates/app/app.html @@ -34,6 +34,7 @@
+
@@ -55,6 +56,19 @@ + + +
+
+
') + } + + if(contentToPush.join("") == "") { + + + favContent.innerHTML = '

Aucun morceau dans les favoris !

' + + } else { + + favContent.innerHTML = contentToPush.join("") + } + + for(var title of settings.favoris) { + + const titleBtn = document.getElementById(settings.favoris.indexOf(title) + "_fdelete") + const addBtn = document.getElementById(settings.favoris.indexOf(title) + "_fadd") + + addBtn.addEventListener("click", () => { + + ipc.send("addQueue", settings.favoris[addBtn.id.replace("_fadd", "")].uri) + favDialog.close() + + }) + + titleBtn.addEventListener("click", () => { + + settings.favoris.splice(titleBtn.id.replace("_fdelete", ""), 1) + saveSettings(settings) + showFavoris() + }) + + } +} + +favClose.addEventListener("click", () => { + + favDialog.close() +}) + + upd.addEventListener("click", () => { updDialog.showModal() updSpan.innerHTML = "" setTimeout(() => { - updSpan.innerHTML = '' + updSpan.innerHTML = '' const updYes = document.getElementById("updYes") updYes.addEventListener("click", () => { ipc.send("forceUpdate") @@ -93,10 +166,10 @@ if(packageJson.dev == true) { sendB.addEventListener("click", () => { - sendInfo.innerHTML = "" - sendText.value = "" - sendChos.value = "Bug" - sendDialog.showModal() + sendInfo.innerHTML = "" + sendText.value = "" + sendChos.value = "Bug" + sendDialog.showModal() }) @@ -302,7 +375,7 @@ ipc.on("findResult", (ev, list) => { for(var title of data) { - contentToPush.push('

' + title.title + '

') + contentToPush.push('

' + title.title + '

') } if(contentToPush.join("") == "") { @@ -318,12 +391,51 @@ ipc.on("findResult", (ev, list) => { - const titleBtn = document.getElementById(data.indexOf(title)+ "_add") + const titleBtn = document.getElementById(data.indexOf(title)+ "_sadd") + + const favBtn = document.getElementById(data.indexOf(title)+ "_sfav") titleBtn.addEventListener("click", () => { searchcontent.innerHTML = "" searchBar.value = "" - ipc.send("addQueue", data[titleBtn.id.replace("_add", "")].uri) + ipc.send("addQueue", data[titleBtn.id.replace("_sadd", "")].uri) + }) + + favBtn.addEventListener("click", () => { + + const settings = getSettings() + + if(settings.favoris == null) { + + settings["favoris"] = [] + + + } + + var check = false + + for(var song of settings.favoris) { + + + if(song.uri == data[favBtn.id.replace("_sfav", "")].uri) { + + check = true + } + } + + if(check == false) { + + settings.favoris.push(data[favBtn.id.replace("_sfav", "")]) + } else { + + console.log("ALREADY ADDED") + } + + saveSettings(settings) + + searchDialog.close() + + }) } @@ -336,6 +448,20 @@ ipc.on("findResult", (ev, list) => { }) +const path = require("path") + +function getSettings() { + + return require("../../settings.json") + +} + +function saveSettings(doc) { + + fs.writeFileSync(__dirname.replace("templates" + path.sep + "app", "settings.json"), JSON.stringify(doc, null, 2)) + +} + list.addEventListener("click", () => { listDialog.showModal() @@ -351,6 +477,8 @@ listClose.addEventListener("click", () => { search.addEventListener("click", () => { searchDialog.showModal() + searchcontent.innerHTML = "" + searchBar.value = "" }) @@ -473,7 +601,7 @@ ipc.on("actualize", (ev, data) => { queueNum += 1 console.log(queueNum) console.log(data.queue.indexOf(title) + " - " + title.title) - contentToPush.push('

' + title.title + '

') + contentToPush.push('

' + title.title + '

') } if(contentToPush.join("") == "") { @@ -491,17 +619,17 @@ ipc.on("actualize", (ev, data) => { console.log(data.queue.indexOf(title) + " - " + title.title) - const titleBtn = document.getElementById(data.queue.indexOf(title)+ "_delete") - const moveBtn = document.getElementById(data.queue.indexOf(title)+ "_move") + const titleBtn = document.getElementById(data.queue.indexOf(title)+ "_ldelete") + const moveBtn = document.getElementById(data.queue.indexOf(title)+ "_lmove") titleBtn.addEventListener("click", () => { - ipc.send("deleteQueue", titleBtn.id.replace("_delete", "")) + ipc.send("deleteQueue", titleBtn.id.replace("_ldelete", "")) }) moveBtn.addEventListener("click", () => { - ipc.send("moveQueue", moveBtn.id.replace("_move", "")) + ipc.send("moveQueue", moveBtn.id.replace("_lmove", "")) }) } diff --git a/templates/common/common.css b/templates/common/common.css index 0f4f00a..a6bdb42 100644 --- a/templates/common/common.css +++ b/templates/common/common.css @@ -99,4 +99,34 @@ header { padding: 5%; padding-top: 0; -} \ No newline at end of file +} + +.buttonFav { + + background-color: transparent; + border: none; + border-radius: 15px; + cursor: pointer; + transition: all 0.3s ease 0s; + font-family: 'noto Sans', sans-serif; + font-weight: 500; + font-size: 13px; + color: white; + text-decoration: none; + -webkit-app-region: no-drag; + margin: 0; + outline: none; + + +} + +.buttonFav:hover { + + color: rgb(242, 255, 53); +} + +.buttonFav:active { + + color: rgb(255, 255, 255); +} +