Version 0.9.0b - Ajout du Home Menu V2
This commit is contained in:
parent
f4e0017671
commit
7fe2add7a3
@ -185,7 +185,11 @@ function IOConnection(io) {
|
|||||||
|
|
||||||
var utoken = ucookies.token
|
var utoken = ucookies.token
|
||||||
const online_users_data = auth.getSimpleUser(utoken)
|
const online_users_data = auth.getSimpleUser(utoken)
|
||||||
usersOnline.push(online_users_data)
|
if(online_users_data) {
|
||||||
|
|
||||||
|
usersOnline.push(online_users_data)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
io.sockets.emit("ALWAYS/ALL_CONNECTED_USER", usersOnline)
|
io.sockets.emit("ALWAYS/ALL_CONNECTED_USER", usersOnline)
|
||||||
@ -201,7 +205,10 @@ function IOConnection(io) {
|
|||||||
|
|
||||||
var utoken = ucookies.token
|
var utoken = ucookies.token
|
||||||
const online_users_data = auth.getSimpleUser(utoken)
|
const online_users_data = auth.getSimpleUser(utoken)
|
||||||
usersOnline.splice(usersOnline.indexOf(online_users_data), 1)
|
if(online_users_data) {
|
||||||
|
usersOnline.splice(usersOnline.indexOf(online_users_data), 1)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
io.sockets.emit("ALWAYS/ALL_CONNECTED_USER", usersOnline)
|
io.sockets.emit("ALWAYS/ALL_CONNECTED_USER", usersOnline)
|
||||||
|
@ -53,6 +53,7 @@ const playlistContent = document.getElementById("playlist-content")
|
|||||||
|
|
||||||
|
|
||||||
var wasOnPlaylist = false
|
var wasOnPlaylist = false
|
||||||
|
var wasOnHome = false
|
||||||
|
|
||||||
var playlistSelected = null
|
var playlistSelected = null
|
||||||
var playlistValue = null
|
var playlistValue = null
|
||||||
@ -127,6 +128,7 @@ function showToolTip(id, text, e) {
|
|||||||
|
|
||||||
homeBtn.addEventListener("click", () => {
|
homeBtn.addEventListener("click", () => {
|
||||||
|
|
||||||
|
wasOnHome = true
|
||||||
loadHome()
|
loadHome()
|
||||||
|
|
||||||
})
|
})
|
||||||
@ -151,22 +153,28 @@ function loadHome() {
|
|||||||
|
|
||||||
socket.on("ALWAYS/ALL_CONNECTED_USER", (resp) => {
|
socket.on("ALWAYS/ALL_CONNECTED_USER", (resp) => {
|
||||||
|
|
||||||
const website_list = document.getElementById("website_list")
|
if(wasOnHome) {
|
||||||
const userToPush = new Array()
|
|
||||||
|
|
||||||
userToPush.push("<p style='font-family: Gunship, sans-serif;'><i class='fa fa-users'></i> Personnes en ligne</p>")
|
const website_list = document.getElementById("website_list")
|
||||||
|
const userToPush = new Array()
|
||||||
|
|
||||||
for(var user of resp ) {
|
userToPush.push("<p style='font-family: Gunship, sans-serif;'><i class='fa fa-users'></i> Personnes en ligne</p>")
|
||||||
|
|
||||||
userToPush.push(`<div id='${resp.indexOf(user)}' style='padding-bottom: 1%; padding-top: 1%;' class="set_user_info"><img style='margin-right: 3%;' src="https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}"><div style="display: flex; flex-direction: column; justify-content: center;"><p class="INDEX_gbname">${user.global_name}</p><p class="INDEX_usrname">${user.username}</p></div></div>`)
|
for(var user of resp ) {
|
||||||
|
|
||||||
|
userToPush.push(`<div id='${resp.indexOf(user)}' style='padding-bottom: 1%; padding-top: 1%;' class="set_user_info"><img style='margin-right: 3%;' src="https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}"><div style="display: flex; flex-direction: column; justify-content: center;"><p class="INDEX_gbname">${user.global_name}</p><p class="INDEX_usrname">${user.username}</p></div></div>`)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
website_list.innerHTML = userToPush.join("")
|
||||||
}
|
}
|
||||||
|
|
||||||
website_list.innerHTML = userToPush.join("")
|
|
||||||
})
|
})
|
||||||
|
|
||||||
socket.on("ALWAYS/ALL_RADIO", (resp) => {
|
socket.on("ALWAYS/ALL_RADIO", (resp) => {
|
||||||
|
|
||||||
|
if(wasOnHome) {
|
||||||
|
|
||||||
const radio_list = document.getElementById("radio_list")
|
const radio_list = document.getElementById("radio_list")
|
||||||
const radioToPush = new Array()
|
const radioToPush = new Array()
|
||||||
|
|
||||||
@ -210,6 +218,9 @@ socket.on("ALWAYS/ALL_RADIO", (resp) => {
|
|||||||
|
|
||||||
radio_list.innerHTML = radioToPush.join("")
|
radio_list.innerHTML = radioToPush.join("")
|
||||||
|
|
||||||
|
if(isAdmin) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const radio_dialog = document.getElementById("radio_dialog")
|
const radio_dialog = document.getElementById("radio_dialog")
|
||||||
const radio_close = document.getElementById("radio_close")
|
const radio_close = document.getElementById("radio_close")
|
||||||
@ -218,29 +229,35 @@ socket.on("ALWAYS/ALL_RADIO", (resp) => {
|
|||||||
const radio_info = document.getElementById("radio_info")
|
const radio_info = document.getElementById("radio_info")
|
||||||
const radio_host = document.getElementById("radio_host")
|
const radio_host = document.getElementById("radio_host")
|
||||||
|
|
||||||
radio_add.addEventListener("click", () => {
|
if(radio_add) {
|
||||||
radio_info.innerHTML = ""
|
radio_add.addEventListener("click", () => {
|
||||||
radio_host.value = ""
|
radio_info.innerHTML = ""
|
||||||
radio_dialog.showModal()
|
radio_host.value = ""
|
||||||
})
|
radio_dialog.showModal()
|
||||||
|
})
|
||||||
|
|
||||||
radio_close.addEventListener("click", () => {
|
radio_close.addEventListener("click", () => {
|
||||||
radio_info.innerHTML = ""
|
radio_info.innerHTML = ""
|
||||||
radio_dialog.close()
|
|
||||||
})
|
|
||||||
|
|
||||||
radio_send.addEventListener("click", () => {
|
|
||||||
if(radio_host.value != '') {
|
|
||||||
|
|
||||||
send("RADIO/ADD", radio_host.value)
|
|
||||||
radio_dialog.close()
|
radio_dialog.close()
|
||||||
} else {
|
})
|
||||||
|
|
||||||
radio_info.innerHTML = "Remplissez une URL !"
|
radio_send.addEventListener("click", () => {
|
||||||
}
|
if(radio_host.value != '') {
|
||||||
|
|
||||||
})
|
send("RADIO/ADD", radio_host.value)
|
||||||
|
radio_dialog.close()
|
||||||
|
} else {
|
||||||
|
|
||||||
|
radio_info.innerHTML = "Remplissez une URL !"
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
for(var title of resp ) {
|
for(var title of resp ) {
|
||||||
|
|
||||||
@ -254,7 +271,7 @@ socket.on("ALWAYS/ALL_RADIO", (resp) => {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
loadHome()
|
loadHome()
|
||||||
@ -423,6 +440,8 @@ socket.on("ANSWER/GET/PLAYLIST", (data) => {
|
|||||||
|
|
||||||
function loadPlaylist(key, value) {
|
function loadPlaylist(key, value) {
|
||||||
|
|
||||||
|
wasOnHome = false
|
||||||
|
|
||||||
var playlistToPush = new Array()
|
var playlistToPush = new Array()
|
||||||
var playlist_songs = new Array()
|
var playlist_songs = new Array()
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@ var wasOnNodes = false
|
|||||||
|
|
||||||
settingsBtn.addEventListener("click", () => {
|
settingsBtn.addEventListener("click", () => {
|
||||||
|
|
||||||
|
wasOnHome = false
|
||||||
|
|
||||||
mainView.innerHTML = `
|
mainView.innerHTML = `
|
||||||
<div class="SETTINGS">
|
<div class="SETTINGS">
|
||||||
<div class='ssidebar'>
|
<div class='ssidebar'>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user