Commit 48178bbf authored by Murukesh Mohanan's avatar Murukesh Mohanan

- remove entries from queue

- play one immediately
parent 7b45f1a9
...@@ -71,10 +71,21 @@ ...@@ -71,10 +71,21 @@
text-decoration: none; text-decoration: none;
} }
.overlay { #play-area div {
position: relative;
}
#play-area div.overlay {
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
position:absolute; position: absolute;
} background-color: rgba(32,32,32,0.6);
\ No newline at end of file }
.playthis, .removethis {
font-size: 10em;
padding: 0.5em;
}
...@@ -2,6 +2,7 @@ var autoplay = true; ...@@ -2,6 +2,7 @@ var autoplay = true;
function playlistAppend() { function playlistAppend() {
var playlist = $('#play-area'); var playlist = $('#play-area');
var next_box = document.createElement('div');
var next_frame = document.createElement('iframe'); var next_frame = document.createElement('iframe');
next_frame.id = this.id + ' iframe'; next_frame.id = this.id + ' iframe';
next_frame.width = Math.floor(playlist.width() * 0.9); next_frame.width = Math.floor(playlist.width() * 0.9);
...@@ -13,35 +14,66 @@ function playlistAppend() { ...@@ -13,35 +14,66 @@ function playlistAppend() {
if (autoplay) { if (autoplay) {
url += '&autoplay=1'; url += '&autoplay=1';
} else {
var overlay = document.createElement('div');
var play = document.createElement('span');
var remove = document.createElement('span');
play.className = 'playthis';
play.innerHTML = '►'
play.onclick = playNow;
remove.innerText = '-';
remove.className = 'removethis';
remove.onclick = removeEntry;
overlay.appendChild(play);
overlay.appendChild(remove);
overlay.className = 'overlay';
next_box.appendChild(overlay);
} }
next_frame.src = url; next_frame.src = url;
playlist.append(next_frame); next_box.appendChild(next_frame);
playlist.append(next_box);
if (autoplay) { if (autoplay) {
console.log(time); console.log(time);
window.setTimeout(playNext, time); currentTimeout = window.setTimeout(playNext, time);
autoplay = false; autoplay = false;
} }
} }
function playNext () { function playNext () {
$('#play-area iframe:first').remove(); $('#play-area div:first').remove();
next_frame = $('#play-area iframe:first'); next_box = $('#play-area div:first');
if (next_frame.length == 0) { if (next_box.length == 0) {
autoplay = true; autoplay = true;
return false; return false;
} }
next_box.children('div').remove();
next_frame = next_box.children('iframe');
src = next_frame.prop('src'); src = next_frame.prop('src');
time = parseInt(next_frame.prop('id').split(' ')[1]) + 2000; time = parseInt(next_frame.prop('id').split(' ')[1]) + 2000;
next_frame.prop('src', src + '&autoplay=1'); next_frame.prop('src', src + '&autoplay=1');
console.log('next', time); console.log('next', time);
window.setTimeout(playNext, time); currentTimeout = window.setTimeout(playNext, time);
}
function removeEntry() {
this.parentNode.parentNode.remove();
}
function playNow() {
var next_div = this.parentNode.parentNode;
var play_area = document.getElementById('play-area');
play_area.insertBefore(next_div, play_area.children[1]);
play_area.scrollTop = 0;
window.clearTimeout(currentTimeout);
playNext();
} }
function parseResults(data) { function parseResults(data) {
var resultsArea = $('#results'); var resultsArea = $('#results');
resultsArea.empty(); resultsArea.empty();
resultsArea.scrollTop(0);
for (result of data.d.results) { for (result of data.d.results) {
url = result.MediaUrl; url = result.MediaUrl;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment