|
|
|
@ -58,12 +58,85 @@ const updClose = document.getElementById("updClose")
|
|
|
|
|
const updSpan = document.getElementById("updSpan")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const favDialog = document.getElementById("favDialog")
|
|
|
|
|
const fav = document.getElementById("fav")
|
|
|
|
|
const favClose = document.getElementById("favClose")
|
|
|
|
|
const favClear = document.getElementById("favClear")
|
|
|
|
|
const favContent = document.getElementById("favContent")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fav.addEventListener("click", () => {
|
|
|
|
|
|
|
|
|
|
favDialog.showModal()
|
|
|
|
|
|
|
|
|
|
showFavoris()
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
favClear.addEventListener("click", () => {
|
|
|
|
|
|
|
|
|
|
const settings = getSettings()
|
|
|
|
|
settings.favoris = []
|
|
|
|
|
|
|
|
|
|
saveSettings(settings)
|
|
|
|
|
showFavoris()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
function showFavoris() {
|
|
|
|
|
|
|
|
|
|
const settings = getSettings()
|
|
|
|
|
|
|
|
|
|
var contentToPush = new Array()
|
|
|
|
|
|
|
|
|
|
for(var title of settings.favoris) {
|
|
|
|
|
|
|
|
|
|
contentToPush.push('<div class="song"> <img class="thumbnail" src="' + title.thumbnail + '"><div class="titleSong"> <p class="listTitle">' + title.title + '</p></div> <button style="margin : 0;" id="' + settings.favoris.indexOf(title) + '_fadd" class="buttonReduce"><i class="fa fa-plus"></i></button> <button id="' + settings.favoris.indexOf(title) + '_fdelete" class="buttonClose"><i class="fa fa-trash"></i></button> </div></div>')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(contentToPush.join("") == "") {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
favContent.innerHTML = '<p class="error">Aucun morceau dans les favoris !</p>'
|
|
|
|
|
|
|
|
|
|
} 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 = '<button style="margin-left: 25%;" id="updYes" class="bug"><i class="fas fa-power-off"></i> Mettre à jour</button>'
|
|
|
|
|
updSpan.innerHTML = '<button style="margin-left: 25%;" id="updYes" class="bug"><i class="fas fa-warning"></i> Mettre à jour</button>'
|
|
|
|
|
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(' <div class="ressong"> <img class="thumbnail" src="' + title.thumbnail + '"><div class="titleSong"> <p class="searchTitle">' + title.title + '</p></div> <button id="' + data.indexOf(title) + '_add" class="buttonReduce"><i class="fa fa-plus"></i></button></div>')
|
|
|
|
|
contentToPush.push(' <div class="ressong"> <img class="thumbnail" src="' + title.thumbnail + '"><div class="titleSong"> <p class="searchTitle">' + title.title + '</p></div><button id="' + data.indexOf(title) + '_sfav" class="buttonFav"><i class="fa fa-star"></i></button> <button id="' + data.indexOf(title) + '_sadd" class="buttonReduce"><i class="fa fa-plus"></i></button></div>')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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(' <div class="song"> <img class="thumbnail" src="' + title.thumbnail + '"><div class="titleSong"> <p class="listTitle">' + title.title + '</p></div> <button id="' + data.queue.indexOf(title) + '_delete" class="buttonClose"><i class="fa fa-trash"></i></button> <button id="' + data.queue.indexOf(title) + '_move" class="buttonReduce"><i class="fa fa-arrow-up"></i></button> </div></div>')
|
|
|
|
|
contentToPush.push(' <div class="song"> <img class="thumbnail" src="' + title.thumbnail + '"><div class="titleSong"> <p class="listTitle">' + title.title + '</p></div> <button id="' + data.queue.indexOf(title) + '_lmove" class="buttonReduce"><i class="fa fa-arrow-up"></i></button> <button id="' + data.queue.indexOf(title) + '_ldelete" class="buttonClose"><i class="fa fa-trash"></i></button> </div></div>')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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", ""))
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|