minor cleanups
Some checks reported errors
continuous-integration/drone/pr Build was killed
continuous-integration/drone/push Build was killed

Signed-off-by: Christian Richter <crichter@owncloud.com>
This commit is contained in:
Christian Richter
2022-07-30 16:46:59 +02:00
parent 8bc0539032
commit 4840619908
2 changed files with 8 additions and 16 deletions

View File

@@ -13,7 +13,7 @@ firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
// after the API code downloads. // after the API code downloads.
var player; var player;
function onYouTubeIframeAPIReady() { function onYouTubeIframeAPIReady() {
currentVideoID = "Wch3gJG2GJ4"; currentVideoID = "tbnLqRW9Ef0";
player = new YT.Player("player", { player = new YT.Player("player", {
//height: "390", //height: "390",
//width: "100%", //width: "100%",
@@ -95,19 +95,11 @@ function connectSocket() {
} }
function updateListeners(data) { function updateListeners(data) {
document.getElementById("listeners").innerHTML = data.listeners; document.getElementById("listeners").innerHTML = data.listeners;
} }
function removeFromPlaylist(videoId) { function removeFromPlaylist(videoId) {
tmp = []; delete playlist[currentVideoID];
playlist.forEach((item) => {
if (item.videoId != videoId) {
tmp.push(item);
} else {
console.log(`removing ${videoId}`);
}
});
playlist = tmp;
// remove from DOM // remove from DOM
rm = document.getElementById(videoId); rm = document.getElementById(videoId);
if (rm != null) { if (rm != null) {
@@ -117,10 +109,7 @@ function removeFromPlaylist(videoId) {
} }
function playNext() { function playNext() {
console.log(playlist); removeFromPlaylist(currentVideoID);
delete playlist[currentVideoID];
console.log(playlist);
//removeFromPlaylist(currentVideoID);
if (playlist[0] != null && playlist[0] != "") { if (playlist[0] != null && playlist[0] != "") {
player.loadVideoById(playlist[0].videoId); player.loadVideoById(playlist[0].videoId);
player.playVideo(); player.playVideo();
@@ -138,7 +127,7 @@ function addToPlaylist(data) {
<a target="_blank" href="${data.link}">${data.link}</a> <a target="_blank" href="${data.link}">${data.link}</a>
</div> </div>
<div class="controls"> <div class="controls">
<div class="control">Remove</div> <div class="control" onclick="removeFromPlaylist('${data.videoId}')">Remove</div>
<div class="control">Play</div> <div class="control">Play</div>
</div> </div>
</div>`; </div>`;

View File

@@ -21,6 +21,7 @@ div.body > div.listeners {
width: 20%; width: 20%;
padding: 2pc 2pc 0 0; padding: 2pc 2pc 0 0;
font-size: xx-small; font-size: xx-small;
font-weight: bold;
text-align: right; text-align: right;
} }
@@ -50,6 +51,7 @@ div.playlist > div.playlistrow:nth-child(odd) {
div.playlist > div.playlistrow > div.title{ div.playlist > div.playlistrow > div.title{
font-weight: bold; font-weight: bold;
font-size: medium;
} }
div.playlist > div.playlistrow > div.ytlink{ div.playlist > div.playlistrow > div.ytlink{
@@ -66,6 +68,7 @@ div.playlist > div.playlistrow > div.controls > div.control {
float: right; float: right;
background-color: #aaa; background-color: #aaa;
margin: 1pc 0.5pc 0 0; margin: 1pc 0.5pc 0 0;
cursor: pointer;
} }
div.playerframe { div.playerframe {