<!doctype html>
<html>
<head>
<title>YouTube List - RJM Programming - December, 2018 ... thanks to https://developers.google.com/youtube/player_parameters</title>
<script type='text/javascript'>
var hurl='//www.youtube.com/embed';
var hurlv='https://www.youtube.com/v';
//var eurl='M7lc1UVf-VE?autoplay=1&origin=https://www.rjmprogramming.com.au&enablejsapi=1';
var eurl=location.search.split('eurl=')[1] ? location.search.split('eurl=')[1].split('&')[0] + '?autoplay=1&origin=https://www.rjmprogramming.com.au&enablejsapi=1' : 'M7lc1UVf-VE?autoplay=1&origin=https://www.rjmprogramming.com.au&enablejsapi=1';
var eurlv=location.search.split('eurlv=')[1] ? decodeURIComponent(location.search.split('eurlv=')[1].split('&')[0]) : '';
var atend=location.search.split('atend=')[1] ? decodeURIComponent(location.search.split('atend=')[1].split('&')[0]) : '';
var sval=location.search.split('sval=')[1] ? decodeURIComponent(location.search.split('sval=')[1].split('&')[0]) : '/';
var murl=sval;
var gij=location.search.split('ij=')[1] ? decodeURIComponent(location.search.split('ij=')[1].split('&')[0]) : '';
var clicktwo=0;
var lastmo='';
var plakurl=[];
var pla=[];
var plas=[], plae=[];
var orok=false;
var player = null;
var done = false;
var startTime = -1;
var evtar = null;
var eventtarget = null;
var icur=0, lasticur=0, szero=0;
var lastsumsis=0, times=1;
var lastplakurl=0;
var et=null, kkij=0;
function setupkurl() {
document.getElementById('kurl').src=plakurl[lastplakurl];
document.getElementById('skurl').innerHTML='' + eval(1 + lastplakurl) + ' of ' + plakurl.length;
}
function dolastplakurl(othis) {
var waitmore=eval(10 + eval('' + plakurl[lastplakurl].split('&youtube_duration=')[1].split('&')[0].split('.')[0]));
waitmore *= 1000;
//alert(waitmore);
lastplakurl++;
if (plakurl.length > lastplakurl) {
setTimeout(setupkurl, waitmore);
}
}
function plasupdate() {
var ip=0, allokay=false, sumsis=0, tds=0.00, usuffix='';
var ikj=plakurl.length;
while (document.getElementById('prog' + ip)) {
if (ip == 0) { allokay=true; }
if (('' + document.getElementById('prog' + ip).max).replace(/0/g,'') != '') {
plae[ip]=eval(('' + document.getElementById('prog' + ip).max).split('.')[0]);
} else {
allokay=false;
}
if (document.getElementById('sele' + ip)) {
sumsis+=eval(('' + document.getElementById('sele' + ip).value).split('.')[0]);
plas[ip]=eval(('' + document.getElementById('sele' + ip).value).split('.')[0]);
if (ikj <= 1) {
usuffix+='&c' + eval(times * ip) + '=on&i' + eval(times * ip) + '=' + plas[ip] + '&j' + eval(times * ip) + '=' + plae[ip];
tds+=eval('' + eval('' + plae[ip]) - eval('' + plas[ip]));
plakurl.push('//www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?youtubeid=' + pla[ip] + '&recown=on&youtube_duration=' + tds + usuffix);
usuffix='';
tds=0.00;
times=0;
}
} else {
sumsis+=eval(('' + document.getElementById('prog' + ip).value).split('.')[0]);
plas[ip]=eval(('' + document.getElementById('prog' + ip).value).split('.')[0]);
if (ikj <= 1) {
usuffix+='&c' + eval(times * ip) + '=on&i' + eval(times * ip) + '=' + plas[ip] + '&j' + eval(times * ip) + '=' + plae[ip];
tds+=eval('' + eval('' + plae[ip]) - eval('' + plas[ip]));
plakurl.push('//www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?youtubeid=' + pla[ip] + '&recown=on&youtube_duration=' + tds + usuffix);
tds=0.00;
times=0;
}
}
if (plas[ip] == 0) { allokay=false; }
ip++;
}
// http://www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?youtubeid=CPMpeNDIGdk
// &recown=on&youtube_duration=449.00
// &c0=on&i0=0&j0=60
// &c1=on&i1=80%3Bhttp%3A%2F%2Flocalhost%3A8888%2FmyRecording00.wav&j1=124
// &c2=on&i2=144&j2=396&c3=on&i3=416&j3=449
// &i4=&j4=&i5=&j5=&i6=&j6=&i7=&j7=&i8=&j8=&i9=&j9=
if (sumsis != 0 && lastsumsis == sumsis && (allokay || orok)) {
lastsumsis=sumsis;
if (lastsumsis != 0) {
if (ikj <= 1) {
var ihuh=0;
while (plae[ihuh] == 0) {
ihuh++;
lastplakurl++;
}
document.getElementById('divright').innerHTML='<table><tr><td><iframe onload="dolastplakurl(this);" style="width:900px;height:900px;" id=kurl name=kurl src="' + plakurl[ihuh] + '"></iframe></td><td id=skurl>' + eval(1 + ihuh) + ' of ' + plakurl.length + '</td></tr></table>';
location.href='#skurl';
}
} else {
if (lastplakurl == 0) { plakurl=[]; }
setTimeout(plasupdate, 2000);
}
} else {
if (lastplakurl == 0) { plakurl=[]; }
lastsumsis=sumsis;
if (!allokay) {
var thist='';
try {
thist=eventtarget.getVideoData().title;
if (thist != pla[icur]) {
for (var iu=0; iu<pla.length; iu++) {
if (thist == pla[icur]) {
icur=iu;
document.title='Jump to ' + icur;
}
}
}
} catch(erw) {
}
setTimeout(plasupdate, 2000);
}
}
}
function onYouTubeIframeAPIReady() {
var nn=false;
if (evtar != null) {
nn=true;
//document.getElementById('player').innerHTML='';
//player = null;
//evtar=null;
}
if (document.URL.indexOf('playlist=') != -1) {
player = new YT.Player('player', {
height: '390',
width: '640',
videoId: eurl.split('?')[0],
playerVars: {
listType:'playlist',
list: eurlv,
start: szero,
autoplay: 0,
controls: 1
},
events: {
'onReady': onReady,
'onStateChange': onStateChange
}
});
} else {
player = new YT.Player('player', {
height: '390',
width: '640',
videoId: eurl.split('?')[0],
playerVars: {
autoplay: 0,
controls: 1
},
events: {
'onReady': onReady,
'onStateChange': onStateChange
}
});
}
//document.title='player not null';
//if (nn) {
// setTimeout(andthen, 3000); //loadVideo(eurl.split('?')[0]);
//}
}
function andthen() {
//loadVideo(eurl.split('?')[0]);
}
function submitLoadVideoById() {
var videoId = document.getElementById("loadVideoById").value;
player.loadVideoById({videoId: videoId});
}
function submitLoadVideoByURL() {
var url = document.getElementById("loadVideoByUrl").value;
player.loadVideoByUrl({mediaContentUrl: url});
}
function submitLoadPlaylist() {
var playlistString = document.getElementById("loadPlaylist").value;
var playlist = playlistString.split(',');
//if (player) { alert(playlist[0]); }
//document.getElementById('player').style.display='block';
player.loadPlaylist({playlist: playlist});
}
function submitCueVideoById() {
var videoId = document.getElementById("cueVideoById").value;
player.cueVideoById({videoId: videoId});
}
function submitCueVideoByURL() {
var url = document.getElementById("cueVideoByUrl").value;
player.cueVideoByUrl({mediaContentUrl: url});
}
function submitCuePlaylist() {
var playlistString = document.getElementById("cuePlaylist").value;
var playlist = playlistString.split(',');
//document.getElementById('player').style.display='block';
player.cuePlaylist({playlist: playlist});
}
function getTime() {
var d = new Date();
var currentTime = d.getTime();
if (startTime == -1)
startTime = currentTime;
var elapsed = currentTime - startTime;
var theTime = " (" + elapsed + " ms)";
return theTime;
}
function statelaterbuffering() {
var ki=0, ski='';
var vt='', gd='';
try {
vt=eventtarget.getVideoData().title;
} catch(rew) {
vt='';
}
try {
gd='' + eventtarget.getDuration();
} catch(rewf) {
gd='';
}
if (gij != '' && (vt == '' || gd == '')) {
if (parent.document) {
if (parent.document.getElementById('sums' + gij)) {
if (parent.document.getElementById('prog' + gij)) {
if (parent.document.getElementById('star' + gij).innerHTML == '0') {
setTimeout(statelaterbuffering, 1000);
}
}
}
}
}
if (gij != '' && vt != '' && gd != '') {
if (parent.document) {
if (parent.document.getElementById('sums' + gij)) {
if (parent.document.getElementById('prog' + gij)) {
try {
//parent.document.title+='' + gij + 'b: ' + gd;
if (parent.document.getElementById('star' + gij).innerHTML == '0') {
var pmax='' + ('' + gd).split('.')[0];
if (pmax.replace(/0/g,'') != '') {
parent.document.getElementById('prog' + gij).max=pmax;
ski='<select onclick="noopen(event);" id=sele' + gij + ' onchange=prespanize(this);></select>';
for (ki=0; ki<=eval(('' + gd).split('.')[0]); ki++) {
ski=ski.replace('</select>','<option value=' + ki + '>' + ki + '</option></select>');
}
//alert(ski);
parent.document.getElementById('star' + gij).innerHTML=ski;
}
parent.document.getElementById('sums' + gij).innerHTML+='<input type=button title=Finish onclick=orok=true; value="' + (' ' + gd).split('.')[0] + '"></input>';
}
} catch(ee) {
if (parent.document.getElementById('sums' + gij).innerHTML.indexOf(' -0 ') == -1) {
parent.document.getElementById('sums' + gij).innerHTML+=' -0 ';
}
}
}
try {
if (parent.document.getElementById('sums' + gij).innerHTML.indexOf(' ' + vt) == -1) {
parent.document.getElementById('sums' + gij).innerHTML+=' ' + vt;
}
} catch(eee) {
}
//gij='';
}
}
}
}
function noopen(event) {
et=event.target;
setTimeout(myown, 1000);
}
function statelaterpaused() {
var ki=0, ski='';
if (gij != '' && 1 == 1) {
if (parent.document) {
if (parent.document.getElementById('sums' + gij)) {
if (parent.document.getElementById('prog' + gij)) {
try {
//parent.document.title+='' + gij + 'p: ' + eventtarget.getDuration();
if (parent.document.getElementById('star' + gij).innerHTML == '0') {
var pmax='' + ('' + eventtarget.getDuration()).split('.')[0];
if (pmax.replace(/0/g,'') != '') {
parent.document.getElementById('prog' + gij).max=pmax;
ski='<select id=sele' + gij + ' onchange=prespanize(this);></select>';
for (ki=0; ki<=eval(('' + eventtarget.getDuration()).split('.')[0]); ki++) {
ski=ski.replace('</select>','<option value=' + ki + '>' + ki + '</option></select>');
}
//alert(ski);
parent.document.getElementById('star' + gij).innerHTML=ski;
}
parent.document.getElementById('sums' + gij).innerHTML+='<input type=button title=Finish onclick=orok=true; value="' + (' ' + eventtarget.getDuration()).split('.')[0] + '"></input>'; //(' ' + eventtarget.getDuration()).split('.')[0] + ' ';
}
} catch(ee) {
if (parent.document.getElementById('sums' + gij).innerHTML.indexOf(' -0 ') == -1) {
parent.document.getElementById('sums' + gij).innerHTML+=' -0 ';
}
}
}
try {
if (parent.document.getElementById('sums' + gij).innerHTML.indexOf(' ' + eventtarget.getVideoData().title) == -1) {
parent.document.getElementById('sums' + gij).innerHTML+=' ' + eventtarget.getVideoData().title;
}
} catch(eee) {
}
//gij='';
}
}
}
}
function statelaterplaying() {
var ki=0, ski='';
var vt='', gd='';
try {
vt=eventtarget.getVideoData().title;
} catch(rew) {
vt='';
}
try {
gd='' + eventtarget.getDuration();
} catch(rewf) {
gd='';
}
if (((lasticur == 0 && icur == 0) || (Math.abs(icur) == Math.abs(lasticur) && icur != lasticur)) && pla.length > icur) {
//document.title+=" Playing " + vt + " " + icur + "." + plas[icur];
lasticur=icur;
if (plas[icur] > 0) {
//document.title+=" tried seek to " + plas[icur];
//eventtarget.seekTo(plas[icur], true);
try {
if (lasticur == 0 && icur == 0) {
document.getElementById('player').innerHTML='';
player=null;
szero=plas[0];
player = new YT.Player('player', {
height: '390',
width: '640',
videoId: eurl.split('?')[0],
playerVars: {
listType:'playlist',
list: eurlv,
start: szero,
autoplay: 1,
controls: 1
},
events: {
'onReady': onReady,
'onStateChange': onStateChange
}
});
//alert('szero = ' + szero);
// eventtarget.cuePlaylist({
// listType: 'playlist',
// list: eurlv,
// startSeconds: plas[icur]
// });
} else {
eventtarget.seekTo(plas[icur],false);
}
} catch(rewf) {
//document.title+=" not done";
setTimeout(statelaterplaying, 2000);
}
try {
//document.title+=" am at " + eventtarget.getCurrentTime();
} catch(revwf) {
}
}
}
if (gij != '' && (vt == '' || gd == '')) {
if (parent.document) {
if (parent.document.getElementById('sums' + gij)) {
if (parent.document.getElementById('prog' + gij)) {
if (parent.document.getElementById('star' + gij).innerHTML == '0') {
//parent.document.title+=' p' + gij + ' ';
setTimeout(statelaterplaying, 1000);
}
}
}
}
}
if (gij != '' && vt != '' && gd != '') {
if (parent.document) {
if (parent.document.getElementById('sums' + gij)) {
if (parent.document.getElementById('prog' + gij)) {
if (parent.document.getElementById('sums' + gij).innerHTML.indexOf(' ' + vt) == -1 || parent.document.getElementById('sums' + gij).innerHTML.indexOf(' -0 ') != -1) {
//parent.document.title+='' + gij + ': ' + gd;
if (parent.document.getElementById('star' + gij).innerHTML == '0') {
var pmax='' + ('' + gd).split('.')[0];
if (pmax.replace(/0/g,'') != '') {
parent.document.getElementById('prog' + gij).max=pmax;
ski='<select id=sele' + gij + ' onchange=prespanize(this);></select>';
for (ki=0; ki<=eval(('' + gd).split('.')[0]); ki++) {
ski=ski.replace('</select>','<option value=' + ki + '>' + ki + '</option></select>');
}
//alert(ski);
parent.document.getElementById('star' + gij).innerHTML=ski;
}
if (parent.document.getElementById('sums' + gij).innerHTML.indexOf(' -0 ') != -1) {
parent.document.getElementById('sums' + gij).innerHTML=parent.document.getElementById('sums' + gij).innerHTML.replace(' -0 ', ' <input type=button title=Finish onclick=orok=true; value="' + (' ' + gd).split('.')[0] + '"></input>');
gij='';
} else if (parent.document.getElementById('sums' + gij).innerHTML.indexOf(' ' + vt) == -1) {
parent.document.getElementById('sums' + gij).innerHTML+=' <input type=button title=Finish onclick=orok=true; value="' + (' ' + gd).split('.')[0] + '"></input>';
parent.document.getElementById('sums' + gij).innerHTML+=' ' + vt;
parent.document.getElementById('sums' + gij).innerHTML=parent.document.getElementById('sums' + gij).innerHTML.replace(' -0 ', ' ');
gij='';
}
}
} else {
gij='';
}
}
}
}
}
}
// Log state changes
function onStateChange(event) {
var ki=0, ski='';
var time = getTime();
var state = "undefined";
switch (event.data) {
case YT.PlayerState.UNSTARTED:
state= "unstarted";
//document.title+=" " + state + icur;
if (Math.abs(icur) != Math.abs(lasticur)) {
lasticur=0;
lasticur-=icur;
}
break;
case YT.PlayerState.ENDED:
state = "ended";
//document.title+=" " + state + icur;
icur++;
break;
case YT.PlayerState.PLAYING:
state = "playing";
eventtarget=event.target;
if (((lasticur == 0 && icur == 0) || (Math.abs(icur) == Math.abs(lasticur) && icur != lasticur)) && pla.length > icur) {
//document.title+=" PlayinG " + " " + icur + "." + plas[icur];
lasticur=icur;
if (plas[icur] > 0) {
//document.title+=" tried Seek to " + plas[icur];
//event.target.seekTo(plas[icur], true);
try {
if (lasticur == 0 && icur == 0) {
document.getElementById('player').innerHTML='';
player=null;
szero=plas[0];
player = new YT.Player('player', {
height: '390',
width: '640',
videoId: eurl.split('?')[0],
playerVars: {
listType:'playlist',
list: eurlv,
start: szero,
autoplay: 1,
controls: 1
},
events: {
'onReady': onReady,
'onStateChange': onStateChange
}
});
//alert('szero=' + szero);
// event.target.cuePlaylist({
// listType: 'playlist',
// list: eurlv,
// startSeconds: plas[icur]
// });
} else {
event.target.seekTo(plas[icur],false);
}
} catch(rewf) {
//document.title+=" not Done";
}
try {
//document.title+=" am at " + eventtarget.getCurrentTime();
} catch(revwf) {
}
}
}
if (1 == 1) {
setTimeout(statelaterplaying,1000);
} else {
if (((lasticur == 0 && icur == 0) || (Math.abs(icur) == Math.abs(lasticur) && icur != lasticur)) && pla.length > icur) {
//document.title+=" " + state + icur + "." + plas[icur];
lasticur=icur;
if (plas[icur] > 0) {
//document.title+=" tried seek to " + plas[icur];
//document.title+=" am at " + event.target.getCurrentTime();
//eventtarget.seekTo(plas[icur], true);
event.target.seekTo(plas[icur],false);
}
}
if (gij != '') {
if (parent.document) {
if (parent.document.getElementById('sums' + gij)) {
if (parent.document.getElementById('prog' + gij)) {
if (parent.document.getElementById('sums' + gij).innerHTML.indexOf(' ' + event.target.getVideoData().title) == -1 || parent.document.getElementById('sums' + gij).innerHTML.indexOf(' -0 ') != -1) {
//parent.document.title+='' + gij + ': ' + event.target.getDuration();
parent.document.getElementById('prog' + gij).max=('' + event.target.getDuration()).split('.')[0];
if (parent.document.getElementById('star' + gij).innerHTML == '0') {
ski='<select id=sele' + gij + ' onchange=prespanize(this);></select>';
for (ki=0; ki<=eval(('' + event.target.getDuration()).split('.')[0]); ki++) {
ski=ski.replace('</select>','<option value=' + ki + '>' + ki + '</option></select>');
}
//alert(ski);
parent.document.getElementById('star' + gij).innerHTML=ski;
}
if (parent.document.getElementById('sums' + gij).innerHTML.indexOf(' -0 ') != -1) {
parent.document.getElementById('sums' + gij).innerHTML=parent.document.getElementById('sums' + gij).innerHTML.replace(' -0 ', ' <input type=button title=Finish onclick=orok=true; value="' + (' ' + event.target.getDuration()).split('.')[0] + '"></input>'); //(' ' + event.target.getDuration()).split('.')[0] + ' ');
gij='';
} else if (parent.document.getElementById('sums' + gij).innerHTML.indexOf(' ' + event.target.getVideoData().title) == -1) {
parent.document.getElementById('sums' + gij).innerHTML+=' <input type=button title=Finish onclick=orok=true; value="' + (' ' + event.target.getDuration()).split('.')[0] + '"></input>';
parent.document.getElementById('sums' + gij).innerHTML+=' ' + event.target.getVideoData().title;
parent.document.getElementById('sums' + gij).innerHTML=parent.document.getElementById('sums' + gij).innerHTML.replace(' -0 ', ' ');
gij='';
}
} else {
gij='';
}
}
}
}
}
}
break;
case YT.PlayerState.PAUSED:
state = "paused";
eventtarget=event.target;
//document.title+=" " + state + icur;
if (1 == 1) {
setTimeout(statelaterpaused,1000);
} else {
if (gij != '' && 1 == 1) {
if (parent.document) {
if (parent.document.getElementById('sums' + gij)) {
if (parent.document.getElementById('prog' + gij)) {
try {
//parent.document.title+='' + gij + ': ' + event.target.getDuration();
parent.document.getElementById('prog' + gij).max=('' + event.target.getDuration()).split('.')[0];
if (parent.document.getElementById('star' + gij).innerHTML == '0') {
ski='<select id=sele' + gij + ' onchange=prespanize(this);></select>';
for (ki=0; ki<=eval(('' + event.target.getDuration()).split('.')[0]); ki++) {
ski=ski.replace('</select>','<option value=' + ki + '>' + ki + '</option></select>');
}
//alert(ski);
parent.document.getElementById('star' + gij).innerHTML=ski;
}
parent.document.getElementById('sums' + gij).innerHTML+=(' ' + event.target.getDuration()).split('.')[0] + ' ';
} catch(ee) {
if (parent.document.getElementById('sums' + gij).innerHTML.indexOf(' -0 ') == -1) {
parent.document.getElementById('sums' + gij).innerHTML+=' -0 ';
}
}
}
try {
if (parent.document.getElementById('sums' + gij).innerHTML.indexOf(' ' + event.target.getVideoData().title) == -1) {
parent.document.getElementById('sums' + gij).innerHTML+=' ' + event.target.getVideoData().title;
}
} catch(eee) {
}
//gij='';
}
}
}
}
break;
case YT.PlayerState.BUFFERING:
state = "buffering";
eventtarget=event.target;
//document.title+=" " + state + icur;
if (1 == 1) {
setTimeout(statelaterbuffering,1000);
} else {
if (gij != '' && 1 == 1) {
if (parent.document) {
if (parent.document.getElementById('sums' + gij)) {
if (parent.document.getElementById('prog' + gij)) {
try {
//parent.document.title+='' + gij + ': ' + event.target.getDuration();
parent.document.getElementById('prog' + gij).max=('' + event.target.getDuration()).split('.')[0];
if (parent.document.getElementById('star' + gij).innerHTML == '0') {
ski='<select id=sele' + gij + ' onchange=prespanize(this);></select>';
for (ki=0; ki<=eval(('' + event.target.getDuration()).split('.')[0]); ki++) {
ski=ski.replace('</select>','<option value=' + ki + '>' + ki + '</option></select>');
}
//alert(ski);
parent.document.getElementById('star' + gij).innerHTML=ski;
}
parent.document.getElementById('sums' + gij).innerHTML+=(' ' + event.target.getDuration()).split('.')[0] + ' ';
} catch(ee) {
if (parent.document.getElementById('sums' + gij).innerHTML.indexOf(' -0 ') == -1) {
parent.document.getElementById('sums' + gij).innerHTML+=' -0 ';
}
}
}
try {
if (parent.document.getElementById('sums' + gij).innerHTML.indexOf(' ' + event.target.getVideoData().title) == -1) {
parent.document.getElementById('sums' + gij).innerHTML+=' ' + event.target.getVideoData().title;
}
} catch(eee) {
}
//gij='';
}
}
}
}
break;
case YT.PlayerState.CUED:
state = "video cued";
if (gij == '') { document.getElementById('ytplayer').style.display='none'; }
document.getElementById('player').style.display='block';
eventtarget=event.target;
//document.title+=" " + state + icur;
if (1 == 1) {
setTimeout(statelater, 1000);
} else {
var wo=null;
pla=event.target.getPlaylist(); // thanks to https://stackoverflow.com/questions/32973650/getplaylist-returns-an-array-with-only-one-video-when-using-the-youtube-iframe-a
var jsuff=' ... ';
for (var ij=0; ij<pla.length; ij++) {
plas.push(0);
plae.push(0);
if (navigator.appName == 'Microsoft Internet Explorer' || (navigator.appName == "Netscape" && navigator.appVersion.indexOf('Edge') > -1)) {
document.getElementById('tdright').innerHTML+='<div id=dtls' + ij + '><div id=sums' + ij + '>Start at (seconds): <span id=star' + ij + '>0</span> <progress ondblclick=myownfractiontwo(event); onclick=myownfraction(event); title="Can click here to set value or double click if last one to do" id=prog' + ij + ' value=0 min=0 max=0></progress></div><br><iframe width="640" height="560" id=ifra' + ij + ' src="' + document.URL.split('#')[0].split('?')[0] + '?ij=' + ij + '&eurl=' + pla[ij] + '" title=""></iframe></div><hr>';
} else {
document.getElementById('tdright').innerHTML+='<details id=dtls' + ij + '><summary id=sums' + ij + '>Start at (seconds): <span id=star' + ij + '>0</span> <progress ondblclick=myownfractiontwo(event); onclick=myownfraction(event); title="Can click here to set value or double click if last one to do" id=prog' + ij + ' value=0 min=0 max=0></progress></summary><iframe width="640" height="560" id=ifra' + ij + ' src="' + document.URL.split('#')[0].split('?')[0] + '?ij=' + ij + '&eurl=' + pla[ij] + '" title=""></iframe></details><hr>';
}
//wo=window.open(document.URL.split('#')[0].split('?')[0] + '?eurl=' + pla[ij],'_blank','top=50,left=50,width=900,height=600');
jsuff+=pla[ij] + ' ... ';
}
//document.title+=jsuff;
}
plasupdate();
break;
default:
state = "unknown (" + event.data + ")";
}
//document.title=state;
//if (gij != '') {
// if (parent.document) {
// parent.document.title+=' ' + gij + '; ' + state;
// }
//}
}
function gradual() {
for (var ij=0; ij<pla.length; ij++) {
if (ij == kkij) {
plas.push(0);
plae.push(0);
if (navigator.appName == 'Microsoft Internet Explorer' || (navigator.appName == "Netscape" && navigator.appVersion.indexOf('Edge') > -1)) {
document.getElementById('tdright').innerHTML+='<div id=dtls' + ij + '><div id=sums' + ij + '>Start at (seconds): <span id=star' + ij + '>0</span> <progress ondblclick=myownfractiontwo(event); onclick=myownfraction(event); title="Can click here to set value or double click if last one to do" id=prog' + ij + ' value=0 min=0 max=0></progress></div><br><iframe width="640" height="560" id=ifra' + ij + ' src="' + document.URL.split('#')[0].split('?')[0] + '?ij=' + ij + '&eurl=' + pla[ij] + '" title=""></iframe></div><hr>';
} else {
document.getElementById('tdright').innerHTML+='<details id=dtls' + ij + '><summary id=sums' + ij + '>Start at (seconds): <span id=star' + ij + '>0</span> <progress ondblclick=myownfractiontwo(event); onclick=myownfraction(event); title="Can click here to set value or double click if last one to do" id=prog' + ij + ' value=0 min=0 max=0></progress></summary><iframe width="640" height="560" id=ifra' + ij + ' src="' + document.URL.split('#')[0].split('?')[0] + '?ij=' + ij + '&eurl=' + pla[ij] + '" title=""></iframe></details><hr>';
}
if (eval(1 + ij) == pla.length) {
setTimeout(plasupdate, 500);
} else {
setTimeout(gradual, 400);
}
}
}
kkij++;
}
function statelater() {
try {
pla=eventtarget.getPlaylist(); // thanks to https://stackoverflow.com/questions/32973650/getplaylist-returns-an-array-with-only-one-video-when-using-the-youtube-iframe-a
if (1 == 1) {
kkij=0;
gradual();
} else {
var jsuff=' ... ';
for (var ij=0; ij<pla.length; ij++) {
plas.push(0);
plae.push(0);
if (navigator.appName == 'Microsoft Internet Explorer' || (navigator.appName == "Netscape" && navigator.appVersion.indexOf('Edge') > -1)) {
document.getElementById('tdright').innerHTML+='<div id=dtls' + ij + '><div id=sums' + ij + '>Start at (seconds): <span id=star' + ij + '>0</span> <progress ondblclick=myownfractiontwo(event); onclick=myownfraction(event); title="Can click here to set value or double click if last one to do" id=prog' + ij + ' value=0 min=0 max=0></progress></div><br><iframe width="640" height="560" id=ifra' + ij + ' src="' + document.URL.split('#')[0].split('?')[0] + '?ij=' + ij + '&eurl=' + pla[ij] + '" title=""></iframe></div><hr>';
} else {
document.getElementById('tdright').innerHTML+='<details id=dtls' + ij + '><summary id=sums' + ij + '>Start at (seconds): <span id=star' + ij + '>0</span> <progress ondblclick=myownfractiontwo(event); onclick=myownfraction(event); title="Can click here to set value or double click if last one to do" id=prog' + ij + ' value=0 min=0 max=0></progress></summary><iframe width="640" height="560" id=ifra' + ij + ' src="' + document.URL.split('#')[0].split('?')[0] + '?ij=' + ij + '&eurl=' + pla[ij] + '" title=""></iframe></details><hr>';
}
//wo=window.open(document.URL.split('#')[0].split('?')[0] + '?eurl=' + pla[ij],'_blank','top=50,left=50,width=900,height=600');
jsuff+=pla[ij] + ' ... ';
}
plasupdate();
}
} catch(ewq) {
setTimeout(statelater, 2000);
}
}
function spanize(pob) {
document.getElementById(pob.id.replace('prog','star')).innerHTML=('' + pob.value).split('.')[0];
}
function prespanize(pob) {
document.getElementById(pob.id.replace('sele','prog')).value=('' + pob.value).split('.')[0];
}
function onReady(event) {
var time = getTime();
//theHistory = "player ready " + time + "<br/>" + theHistory;
//document.getElementById("history_div").innerHTML = theHistory;
//console.log("player ready");
// make the interface visible since we're now ready to go
//document.getElementById('ux').style.visibility = 'visible';
if (evtar == null) {
evtar=event.target;
//loadVideo(eurl.split('?')[0], event);
if (document.URL.indexOf('playlist=') == -1) { loadVideo(eurl.split('?')[0], event); }
if (atend == '' || player == null || document.URL.indexOf('playlist=') != -1) {
//if (gij != '') {
// if (parent.document) {
// parent.document.title+=' ' + gij + '- ';
// }
//}
if (document.URL.indexOf('playlist=') != -1) {
var jsuff=' ';
//document.title='playlist not null' + jsuff;
loadVideo(eurl.split('?')[0],event);
if (plas.length > 0) {
if (plas[0] > 0) {
event.target.cuePlaylist({
listType: 'playlist',
list: eurlv,
startSeconds: plas[0]
});
event.target.playVideo();
} else {
event.target.cuePlaylist({
listType: 'playlist',
list: eurlv,
startSeconds: 0
});
event.target.playVideo();
}
} else {
event.target.cuePlaylist({
listType: 'playlist',
list: eurlv,
startSeconds: 0
});
event.target.playVideo();
}
//setTimeout(submitCuePlaylist, 8000);
} else {
//if (gij != '') {
// if (parent.document) {
// parent.document.title+=' ' + gij + '` ';
// }
//}
loadVideo(eurl.split('?')[0], event);
//if (gij != '') {
// if (parent.document) {
// parent.document.title+=' ' + gij + '~ ';
// }
//}
event.target.playVideo();
//if (gij != '') {
// if (parent.document) {
// parent.document.title+=' ' + gij + '% ';
// }
//}
}
} else if (atend != '' && document.URL.indexOf('playlist=') == -1) {
//if (gij != '') {
// if (parent.document) {
// parent.document.title+=' ' + gif + '! ';
// }
//}
//alert(hurlv.replace('/v?','/embed/?').replace('/v','/embed') + atend);
//document.getElementById("loadVideoByUrl").value = hurlv.replace('/v?','/embed/?').replace('/v','/embed') + atend;
loadVideo(eurl.split('?')[0],event);
//player.loadVideoByUrl({mediaContentUrl: hurlv.replace('/v?','/embed/?').replace('/v','/embed') + atend}); //submitLoadVideoByURL();
} else {
//if (gij != '') {
// if (parent.document) {
// parent.document.title+=' ' + gij + '= ';
// }
//}
if (document.URL.indexOf('playlist=') != -1) {
loadVideo(eurl.split('?')[0], event);
if (plas.length > 0) {
if (plas[0] > 0) {
event.target.cuePlaylist({
listType: 'playlist',
list: eurlv,
startSeconds: plas[0]
});
event.target.playVideo();
} else {
event.target.cuePlaylist({
listType: 'playlist',
list: eurlv,
startSeconds: 0
});
event.target.playVideo();
}
} else {
event.target.cuePlaylist({
listType: 'playlist',
list: eurlv,
startSeconds: 0
});
event.target.playVideo();
}
} else {
event.target.playVideo();
}
}
} else {
//evtar.stopVideo();
//alert(eurl);
loadVideo(eurl.split('?')[0], event);
evtar.playVideo();
}
}
function onPlayerReady(event) {
event.target.playVideo();
}
function onPlayerStateChange(event) {
if (event.data == YT.PlayerState.PLAYING && !done) {
setTimeout(stopVideo, 6000);
done = true;
}
}
function stopVideo() {
player.stopVideo();
//document.title='done';
done = false;
}
function domurl(what) {
murl=what;
document.getElementById('isuffix').value='';
if (murl == '/') {
document.getElementById('isuffix').placeholder='Ei_VUl8qdRU';
} else if (murl == '?listType=playlist&list=') {
document.getElementById('isuffix').placeholder='PLjsR7WjAKSPU-6URvzZ552o5cvQ2p2GYE';
} else if (murl == '?listType=user_uploads&list=') {
document.getElementById('isuffix').placeholder='rmetcalfeify';
} else if (murl == '?listType=search&list=') {
document.getElementById('isuffix').placeholder='rjmprogramming';
}
}
function loadVideo(videoID, evt) {
if (player) { evt.target.loadVideoById({videoId: videoID}); }
}
function goplay(what) {
eurl=encodeURIComponent(what);
if (player != null) {
eurlv=hurlv + (murl + eurl).replace(("/" + eurl),("/" + eurl + "?autoplay=1")).replace('?listType=','?autoplay=1&listType=') + '&origin=https://www.rjmprogramming.com.au&enablejsapi=1';
if (murl == '/') {
//document.getElementById("loadVideoById").value = what;
//onReady(this);
//player.loadVideoById({videoId: what}); //submitLoadVideoById();
//evtar=null;
location.href=document.URL.split('#')[0].split('?')[0] + '?eurl=' + eurl; //onYouTubeIframeAPIReady();
} else if (murl == '?listType=playlist&list=') {
//document.getElementById('isuffix').placeholder='PLjsR7WjAKSPU-6URvzZ552o5cvQ2p2GYE';
//document.getElementById("loadVideoByUrl").value = what;
//submitLoadVideoByURL();
location.href=document.URL.split('#')[0].split('?')[0] + '?playlist=y&eurlv=' + eurl + '&sval=' + encodeURIComponent(document.getElementById('basis').value) + '&atend=' + encodeURIComponent(eurlv.split(hurlv)[1]); //onYouTubeIframeAPIReady();
} else if (murl == '?listType=user_uploads&list=') {
//document.getElementById('isuffix').placeholder='rmetcalfeify';
location.href=document.URL.split('#')[0].split('?')[0] + '?user=y&eurlv=' + eurl + '&sval=' + encodeURIComponent(document.getElementById('basis').value) + '&atend=' + encodeURIComponent(eurlv.split(hurlv)[1]); //onYouTubeIframeAPIReady();
} else if (murl == '?listType=search&list=') {
//document.getElementById('isuffix').placeholder='rjmprogramming';
location.href=document.URL.split('#')[0].split('?')[0] + '?search=y&eurlv=' + eurl + '&sval=' + encodeURIComponent(document.getElementById('basis').value) + '&atend=' + encodeURIComponent(eurlv.split(hurlv)[1]); //onYouTubeIframeAPIReady();
}
} else if (murl == '?listType=playlist&list=') {
if (gij == '') { document.getElementById('ytplayer').src=hurl + (murl + eurl.split(',')[0]).replace(("/" + eurl.split(',')[0]),("/" + eurl.split(',')[0] + "?autoplay=1")).replace('?listType=','?autoplay=1&listType=') + '&origin=https://www.rjmprogramming.com.au&enablejsapi=1'; }
} else {
if (gij == '') { document.getElementById('ytplayer').src=hurl + (murl + eurl).replace(("/" + eurl),("/" + eurl + "?autoplay=1")).replace('?listType=','?autoplay=1&listType=') + '&origin=https://www.rjmprogramming.com.au&enablejsapi=1'; }
}
}
function onl() {
if (eurl != 'M7lc1UVf-VE?autoplay=1&origin=https://www.rjmprogramming.com.au&enablejsapi=1') {
document.getElementById('isuffix').placeholder=location.search.split('eurl=')[1].split('&')[0];
if (gij == '') { document.getElementById('ytplayer').style.display='none'; }
} else if (atend != '') {
//alert(hurlv + atend);
document.getElementById('player').style.display='none';
if (gij == '') {
if (document.URL.indexOf('playlist=') != -1) {
document.getElementById('ytplayer').src=hurl + atend.split(',')[0];
} else {
document.getElementById('ytplayer').src=hurl + atend;
}
}
document.getElementById('basis').value=sval;
document.getElementById('isuffix').placeholder=decodeURIComponent(atend.split('&origin=')[0].split('=')[eval(-1 + atend.split('&origin=')[0].split('=').length)]);
if (document.URL.indexOf('playlist=') != -1) {
document.getElementById('loadPlaylist').value=eurlv;
document.getElementById('cuePlaylist').value=eurlv;
//setTimeout(submitLoadPlaylist, 8000);
}
} else {
if (gij == '') { document.getElementById('ytplayer').style.display='none'; }
}
// 2. This code loads the IFrame Player API code asynchronously.
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
setTimeout(onYouTubeIframeAPIReady,3000);
}
function wipeout() {
lastmo='';
}
function myownfractiontwo(event) {
orok=true;
lastmo='';
myownfraction(event);
}
function myownfraction(event) {
if (lastmo == event.target.id) {
orok=true;
lastmo='';
} else {
lastmo=event.target.id;
setTimeout(wipeout, 700);
var x=0, y=0;
if (event.clientX || event.clientY) {
x = event.clientX;
y = event.clientY;
} else {
x = event.pageX;
y = event.pageY;
}
var rect = event.target.getBoundingClientRect(), varn=0, vard=0, iv=0;
if (eval('' + x) >= eval('' + rect.left) && eval('' + x) <= eval('' + eval('' + Math.round(rect.left)) + eval('' + Math.round(rect.width)))) {
varn = eval('' + eval('' + x) - eval('' + Math.round(rect.left)));
vard = eval('' + Math.round(rect.width));
if (eval('' + vard) > 0) {
for (iv=Math.min(Math.abs(varn),Math.abs(vard)); iv>=2; iv--) {
if (eval(Math.abs(varn) % iv) == 0 && eval(Math.abs(vard) % iv) == 0) {
varn /= iv;
vard /= iv;
}
}
document.getElementById(event.target.id.replace('prog','sele')).value='' + Math.round(eval('' + event.target.max) * (eval('' + varn) / eval('' + vard)));
event.target.value='' + Math.round(eval('' + event.target.max) * (eval('' + varn) / eval('' + vard)));
}
}
et=event.target;
setTimeout(myown, 1000);
}
}
function myown() {
try {
document.getElementById(et.id.replace('sele','dtls').replace('prog','dtls')).removeAttribute('open');
} catch(ewq) {
}
}
function poisout() {
clicktwo=0;
}
function onclicktwo(pois) {
clicktwo++;
if (clicktwo >= 2) {
clicktwo=0;
pois.value=pois.placeholder;
} else {
setTimeout(poisout, 2000);
}
}
</script>
</head>
<body onload=" onl(); ">
<h1>YouTube List of <select id=basis onchange='domurl(this.value);'><option value='/'>Video ID</option><option value='?listType=playlist&list='>Playlist ID</option><option value='?listType=user_uploads&list='>Uploaded Videos of a User ID</option><option value='?listType=search&list='>Search Word(s)</option></select> <input type=text title='Double click for suggestion' onclick='onclicktwo(this);' ondblclick='clicktwo=0; this.value=this.placeholder;' style=width:30%; onblur=goplay(this.value); id=isuffix placeholder='M7lc1UVf-VE'></input></h1>
<h3>RJM Programming - December, 2018</h3>
<h3>Thanks to <a target=_blank title='YouTube Embedded Iframe information' href='https://developers.google.com/youtube/player_parameters'>https://developers.google.com/youtube/player_parameters</a></h3>
<table><tbody><tr><td id=tdleft>
<div id="player"></div>
<div id='ux' style='display:none;'>
<p>
<label>loadVideoById</label>
<input id='loadVideoById' value='Xz0eS-npK0k' />
<button onclick='submitLoadVideoById()'>Submit</button>
</p>
<p>
<label>loadVideoByURL</label>
<input id='loadVideoByUrl' value='https://www.youtube.com/v/dL0QsC5vZXg' />
<button onclick='submitLoadVideoByURL()'>Submit</button>
</p>
<p>
<label>loadPlaylist</label>
<input id='loadPlaylist' value='kPmkHYppC9M, hm2nb3acl2o, pfaw3j2dwxk' />
<button onclick='submitLoadPlaylist()'>Submit</button>
</p>
<p>
<label>cueVideoById</label>
<input id='cueVideoById' value='Xz0eS-npK0k' />
<button onclick='submitCueVideoById()'>Submit</button>
</p>
<p>
<label>cueVideoByURL</label>
<input id='cueVideoByUrl' value='https://www.youtube.com/v/dL0QsC5vZXg' />
<button onclick='submitCueVideoByURL()'>Submit</button>
</p>
<p>
<label>cuePlaylist</label>
<input id='cuePlaylist' value='kPmkHYppC9M, hm2nb3acl2o, pfaw3j2dwxk' />
<button onclick='submitCuePlaylist()'>Submit</button>
</p>
</div>
<script type='text/javascript'>
if ((location.search.split('ij=')[1] ? decodeURIComponent(location.search.split('ij=')[1].split('&')[0]) : '') == '') {
document.write('<iframe id="ytplayer" type="text/html" width="640" height="360" src="//www.youtube.com/embed/M7lc1UVf-VE?autoplay=1&origin=https://www.rjmprogramming.com.au&enablejsapi=1" frameborder="0"></iframe>');
}
</script>
</td><td id=tdright><div id=divright></div></td></tr></tbody></table>
</body>
</html>