<!DOCTYPE html>
<html>
<title>Clicking on YouTube Embedded Iframe - RJM Programming - June, 2016 - via Google YouTube API https://developers.google.com/youtube/iframe_api_reference</title>
<link href='//www.rjmprogramming.com.au/PHP/emboss_h1.css' rel='stylesheet' type='text/css'>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=0.1, maximum-scale=8, user-scalable=yes" >
<script type='text/javascript'>
var endcnt=-1;
var onestodourl='';
var onespause=20;
var onestodoprefix=location.search.split('andthen=')[1] ? ('&andthen=' + decodeURIComponent(location.search.split('andthen=')[1].split('&')[0])).substring(0,9) : '';
var onestodosuffix=location.search.split('andthen=')[1] ? decodeURIComponent(location.search.split('andthen=')[1].split('&')[0]) : '';
var prevonestodosuffix=onestodosuffix;
var iframegridmode=false;
var urlis='';
var dostumps=true;
var vwidth=640;
var vheight=390;
var hone=1;
var vidarr;
var one=0;
var cntpause=0;
var onepause=0;
var tobechecked=null;
var thistext='';
var nexttext='2';
var nextvid='';
var prevvid='';
var nexturl='';
var prevurl='';
var of=' 1 of 1 ';
var cnt=0;
var toggle=1;
var secscnt=location.search.split('start=')[1] ? location.search.split('start=')[1].split('&')[0] : 0;
var oursecscnt=secscnt; // for Karaoke purposes ... September, 2016
var suffix="#t=00m00s";
var presuffix="";
var wo=null;
var yturl='';
var playtime=4000;
var delay=1300;
var vlen=0;
var eventtarget=null;
var duration=-1;
var previd="7o9wvYXR3n0";
var vid="7o9wvYXR3n0";
var play_list_id='';
var hm=2;
var anymore='';
var oknow=true;
var gtn="Go to next on the list";
var pgtn="Go to previous on the list";
var kpi=-9;
var player;
function sendoff() {
if (urlis != '') {
//alert(urlis);
document.getElementById('fgrid').submit();
//location.href=urlis;
//urlis='';
}
}
function iframemode(inoup) {
// ?total=9&tag=div&period=4000&from=%3ciframe src%3d%22hb11.jpg%22%3e%3c/iframe%3e&to=%3ciframe src%3d%22bb11.jpg%22%3e%3c/iframe%3e
urlis='';
var suff='?', total=0;
retval=inoup;
vidarr=inoup.split(',');
for (var jk=0; jk<9; jk+=1) { //2) {
if (jk < vidarr.length) {
total++;
} else {
total++;
document.getElementById('p' + eval(eval(jk + 1) / 1)).value='?total=9&tag=div&period=4' + eval(eval(jk + 1) / 1) + '00&from=&to=';
}
}
for (var ik=0; ik<9; ik+=1) { //2) {
if (ik < vidarr.length) {
//if (urlis == '') urlis='http://www.rjmprogramming.com.au/HTMLCSS/reveal_div.php';
if (urlis == '') urlis='//www.rjmprogramming.com.au/HTMLCSS/reveal_div.php';
if (eval(10 + ik) < vidarr.length) {
document.getElementById('p' + eval(eval(ik + 1) / 1)).value='?total=' + total + '&tag=div&period=4' + eval(eval(ik + 1) / 1) + '00&from=' + vidarr[ik] + '&to=' + vidarr[eval(10 + ik)];
urlis+=suff + 'p' + + eval(eval(ik + 1) / 1) + '=' + encodeURIComponent('?total=' + total + '&tag=div&period=4' + eval(eval(ik + 1) / 1) + '00&from=' + vidarr[ik] + '&to=' + vidarr[eval(10 + ik)]);
suff='&';
retval=retval.replace(vidarr[ik] + ',' + vidarr[eval(1 + ik)], '');
} else {
document.getElementById('p' + eval(eval(ik + 1) / 1)).value='?total=' + total + '&tag=div&period=4' + eval(eval(ik + 1) / 1) + '00&from=' + vidarr[ik] + '&to=' + vidarr[ik];
urlis+=suff + 'p' + + eval(eval(ik + 1) / 1) + '=' + encodeURIComponent('?total=' + total + '&tag=div&period=4' + eval(eval(ik + 1) / 1) + '00&from=' + vidarr[ik] + '&to=' + vidarr[ik]);
suff='&';
retval=retval.replace(vidarr[ik], '');
}
if (retval != '') {
if (retval.substring(0,1) == ',') {
retval=retval.replace(',','');
}
}
}
}
if (retval != inoup) {
if (retval == '') {
setTimeout(sendoff,500);
//document.getElementById('fgrid').submit();
} else {
setTimeout(sendoff,500);
document.getElementById('fgrid').target='_blank';
//document.getElementById('fgrid').submit();
}
} else {
urlis='';
}
return retval;
}
function force_next() {
if (nexturl == '') {
if (prevurl.indexOf('this=') != -1) {
pgtn="Go to previous Video on the list";
if (("" + prevvid).length > ('cGdz3GNhEQ4').length) pgtn="Go to previous Playlist on the list";
return "<br><a target='_self' href='" + prevurl + "' title='Go to previous'>" + pgtn + "</a>";
}
return "<br><a target='_self' href='" + drhuh(document.referrer) + "' title='Go to previous'>Go to previous</a>";
}
gtn="Go to next Video on the list";
if (("" + nextvid).length > ('cGdz3GNhEQ4').length) gtn="Go to next Playlist on the list";
if (prevurl.indexOf('this=') != -1) {
pgtn="Go to previous Video on the list";
if (("" + prevvid).length > ('cGdz3GNhEQ4').length) pgtn="Go to previous Playlist on the list";
return "<br><a target='_self' href='" + prevurl + "' title='Go to previous'>" + pgtn + "</a>" + "<br><a target='_self' href='" + nexturl + "' title='Go to next'>" + gtn + "</a>";
}
if (document.referrer.indexOf('this=') != -1) {
return "<br><a target='_self' href='" + drhuh(document.referrer) + "' title='Go to previous'>Go to previous</a>" + "<br><a target='_self' href='" + nexturl + "' title='Go to next'>" + gtn + "</a>";
}
return "<br><a target='_self' href='" + nexturl + "' title='Go to next'>" + gtn + "</a>";
}
function etc_quality() {
return "<br>Quality <select id=iqty onchange=' player.setPlaybackQuality(this.value); '><option value='highres'>highres</option><option value='hd1080'>hd1080</option><option value='hd720'>hd720</option><option value='large'>large</option><option value='medium' selected>medium</option><option value='small'>small</option><option value='unknown'>unknown</option></select>" + force_next();
}
function etc_playbackrate() {
return "<br>Playback Rate <select id=ipbr onchange=' player.setPlaybackRate(this.value); '><option value='0.25'>x 0.25</option><option value='0.5'>x 0.5</option><option value='1.5'>x 1.5</option><option value='1' selected>x 1</option><option value='2'>x 2</option></select>" + etc_quality();
}
function etc_volume() {
return "<br>Volume <input id=ivol onchange=' player.setVolume(this.value); ' type=number min=0 max=100 step=1 value=0></input>" + etc_playbackrate();
}
function postprompt(inp) {
if (inp == null) return "";
if (inp.indexOf('+') != -1) iframegridmode=true;
var oup=inp;
while (oup.indexOf('+') != -1) {
oup=oup.replace('+','');
}
while (oup.indexOf(' ') != -1) {
oup=oup.replace(' ','');
}
if (oup.indexOf(';') != -1) {
var ous=oup.split(';');
oup=ous[eval(-1 + ous.length)];
if (ous[0].indexOf(',') != -1) {
var ouss=ous[0].split(',');
vwidth=eval(ouss[0].replace('[','').replace(']',''));
vheight=eval(ouss[1].replace('[','').replace(']',''));
if (vwidth != 640 || vheight != 390) hone=0;
} else {
vwidth=eval(ous[0].replace('[','').replace(']',''));
if (ous.length >= 3) vheight=eval(ous[1].replace('[','').replace(']',''));
if (vwidth != 640 || vheight != 390) hone=0;
}
}
if (iframegridmode) {
oup=iframemode(oup);
}
return oup;
}
function offerform() {
offerdform(hm);
}
function offerdform(howmany) {
var iid="id=i2 onblur=\"document.getElementById('vid').value=this.value;\"";
var odivc="<form id='oform' target='_self' action='./stop_start_youtube.html' method='GET'><input type='hidden' value='2' name='this'></input><input type='hidden' value='-1' name='playtime'></input><input type='hidden' value='" + vidarr[0] + "' id='vid' name='vid'></input><input id='bsubmit' type='submit' value='Play' style='display:none;'></input><br>Current Video Playing 1 of " + howmany + " <input type='text' readonly value='" + vid + "' name='next'></input> ... and then ...";
for (var ij=2; ij<=howmany; ij++) {
odivc+="<br>Video to Play Later " + ij + " of " + howmany + " <input " + iid + " type='text' value='" + vidarr[eval(-1 + ij)] + "' name='next" + ij + "'></input>";
iid='';
}
odivc+="</form>";
document.getElementById('dform').innerHTML = odivc;
tobechecked=document.getElementById('i2');
}
function updatesc() {
cnt+=one;
cntpause+=onepause;
if (toggle == 0) secscnt+=one;
var ours="00" + eval(secscnt % 60);
var ourm="00" + eval((secscnt - ours) / 60);
suffix="#t=" + ourm.substring(eval(ourm.length - 2)) + "m" + ours.substring(eval(ours.length - 2)) + "s";
if (presuffix != "") presuffix=suffix;
if (eval(eval(cnt) - eval(cntpause)) >= duration && eval(duration) > 0) { // && eval(playtime) < 0) {
if (tobechecked != null) {
if (tobechecked.value != '') {
document.getElementById('oform').submit();
}
} else if (nexturl != '') {
if (urlis == '') location.href=nexturl;
} else {
secscnt=cnt;
stopVideo();
}
}
}
function dolaterthis() {
if (onestodourl != '') {
parent.location.href=onestodourl;
onestodourl='';
}
}
function dothislater(afterhowlong, nexturlisthistime) {
onestodourl=nexturlisthistime;
setTimeout(dolaterthis, Math.floor(eval(1000 * eval(onespause + eval('' + afterhowlong)))));
}
function drhuh(indr) {
var outdr=indr;
if (onestodosuffix != '') {
var drhbits=outdr.split('&andthen=')[0].split('#')[0];
if (prevonestodosuffix != onestodosuffix) {
return drhbits[0] + '&andthen=' + prevonestodosuffix;
} else {
var nexties=onestodosuffix.split(';');
var nextdetails=nexties[1].split(',');
if (onestodosuffix.replace(nexties[0] + ";" + nextdetails[0],"") == '') return outdr;
return drhbits[0] + '&andthen=' + onestodosuffix.replace(nexties[0] + ";" + nextdetails[0],"");
}
}
return outdr;
}
function followup() {
var lb='', ilb=2, prevtext=' ', theon='on';
if (top.document.title.indexOf(' ; ') != -1) {
alert("top.document.title=" + top.document.title);
} else if (onestodoprefix != "") { // multiple dropdown selections
console.log('11: onestodoprefix=' + onestodoprefix + ' onestodosuffix=' + onestodosuffix);
//var nexties=["",""], nextdetails=["",""];
//if (onestodosuffix.indexOf(';') != -1) {
//try {
var nexties=onestodosuffix.split(';');
var nextdetails=nexties[1].split(',');
//} catch(hjgfjh) {
//nexties=["",""];
//nextdetails=["",""];
//}
//}
onestodosuffix=onestodosuffix.replace(nexties[0] + ";" + nextdetails[0] + ",","");
if (onestodosuffix == "") onestodoprefix="";
prevonestodosuffix=onestodosuffix;
theon='on';
if (window.parent) {
if (parent.document.URL.indexOf('c0=on') == -1) { theon='off&ezj=1'; }
}
dothislater(nexties[0], document.referrer.split('?')[0].split('#')[0] + "?youtubeid=" + nextdetails[0] + "&youtube_duration=" + nextdetails[1] + "&email=&email=&emoji=on&c0=" + theon + "&i0=0&j0=" + nextdetails[1] + "&i1=&j1=&i2=&j2=&i3=&j3=&i4=&j4=&i5=&j5=&i6=&j6=&i7=&j7=&i8=&j8=&i9=&j9=&i10=&j10=&i11=&j11=&i12=&j12=&i13=&j13=&i14=&j14=&i15=&j15=&i16=&j16=&i17=&j17=&i18=&j18=&i19=&j19=&i20=&j20=&i21=&j21=&i22=&j22=&i23=&j23=&i24=&j24=&i25=&j25=&i26=&j26=&i27=&j27=&i28=&j28=&i29=&j29=" + onestodoprefix + encodeURIComponent(onestodosuffix));
}
if (kpi == -9) {
//alert(99);
if (document.URL.indexOf('start=') != -1 && document.URL.indexOf('playtime=') != -1) {
//alert(990);
//parent.document.getElementById('myh1').innerHTML='zxkpi' + document.URL;
if (document.URL.indexOf('start=0') == -1 || document.URL.indexOf('playtime=0') == -1) {
//alert(9900);
kpi=-8;
kpi=0; //player.getCurrentTime();
setTimeout(keepParentInformed,1000);
}
}
}
thistext=location.search.split('this=')[1] ? location.search.split('this=')[1].split('&')[0] : '';
if (thistext != '') {
of = ' ' + thistext + ' of ';
nexttext=eval(1 + eval(thistext));
if (nexttext >= 2) prevtext=eval(-1 + eval(thistext));
if (("" + prevtext) == "1") prevtext="";
} else if (document.URL.indexOf('next2=') != -1) {
of = ' 1 of ';
nexttext=2;
}
nextvid=location.search.split('next' + nexttext + '=')[1] ? location.search.split('next' + nexttext + '=')[1].split('&')[0] : '';
if (nextvid != '') {
//alert(nextvid + " " + 'vid=' + vid + " NEWvid=" + nextvid + " " + document.URL);
nexturl=document.URL.replace('this=' + thistext + '&', 'this=' + nexttext + '&').replace('vid=' + vid + play_list_id, 'vid=' + nextvid);
//alert(nexturl);
}
if (prevtext != ' ') {
prevvid=location.search.split('next' + prevtext + '=')[1] ? location.search.split('next' + prevtext + '=')[1].split('&')[0] : '';
if (prevvid != '') {
prevurl=document.URL.replace('this=' + thistext + '&', 'this=' + prevtext + '&').replace('vid=' + vid + play_list_id, 'vid=' + prevvid);
}
}
//alert(nexttext + '=nexttext nextvid=' + nextvid + ' nexturl=' + nexturl);
if (document.URL.indexOf('next2=') != -1) {
while (document.URL.indexOf('next' + ilb + '=') != -1) {
ilb++;
}
lb=eval(ilb - 1);
of+=lb + ' ';
}
}
function analyzemaybe(playing, paused, isdone) {
if (document.URL.indexOf('start=') != -1 && document.URL.indexOf('playtime=') != -1) {
if (document.URL.indexOf('start=0') == -1 || document.URL.indexOf('playtime=0') == -1) {
if (paused != 0) {
var urp=parent.document.getElementById('updatethisplease');
if (urp) {
if (urp.value != '') {
var urpvalue=urp.value;
parent.document.getElementById(urpvalue).value=eval(player.getCurrentTime()).toFixed(3);
if (urpvalue.indexOf('i') == 0) {
urpvalue=urpvalue.replace('i','j');
parent.document.getElementById('updatethisplease').value=urpvalue;
} else {
urpvalue=urpvalue.replace('j','');
urpvalue=eval(1 + eval(urpvalue));
urpvalue='i' + urpvalue;
if (parent.document.getElementById(urpvalue).value == "") {
parent.document.getElementById(urpvalue.replace('i','c')).checked=true;
}
parent.document.getElementById('updatethisplease').value=urpvalue;
}
//alert(urpvalue);
}
}
}
}
}
}
function yeswell() {
if (eval('' + endcnt) == 1) {
endcnt=5;
var sufx='';
var capitalloop=top.document.getElementById('listeleven').getAttribute('data-title');
if ((capitalloop + 'a').substring(0,1) == 'X') {
sufx='^' + top.document.getElementById('listeleven').innerHTML.split('^')[0].replace(' ','').replace(' ','').trim();
}
if (top.document.getElementById('listeleven').innerHTML.indexOf('^') != -1) {
window.top.focus();
sufx='';
//alert('pre 1');
top.document.getElementById('listeleven').innerHTML=top.document.getElementById('listeleven').innerHTML.replace(top.document.getElementById('listeleven').innerHTML.split('^')[0] + '^','') + sufx; //.replace(top.document.getElementById('listeleven').innerHTML.split('^')[0],'');
//alert('1:' + top.document.getElementById('listeleven').innerHTML);
//top.document.title+=' ' + top.document.getElementById('listeleven').innerHTML.toUpperCase() + ' ';
//if (sufx != '') { alert(top.document.getElementById('listeleven').innerHTML); }
//top.document.title+=' 4';
} else {
window.top.focus();
//alert('pre 2');
var capitalloopx=top.document.getElementById('listeleven').getAttribute('data-title');
sufx=top.document.getElementById('listeleven').title; //sufx.replace('^','');
top.document.getElementById('listeleven').innerHTML=top.document.getElementById('listeleven').innerHTML.replace(top.document.getElementById('listeleven').innerHTML.split('^')[0] + '','') + sufx; //.replace(top.document.getElementById('listeleven').innerHTML.split('^')[0],'');
//alert('2:' + top.document.getElementById('listeleven').innerHTML);
//top.document.title+=' ' + top.document.getElementById('listeleven').innerHTML.toLowerCase() + ' ';
if ((capitalloopx + 'a').substring(0,1) == 'X') {
if (top.document.emojirestart) {
top.document.emojirestart();
} else {
var topifs=top.document.getElementsByTagName('iframe');
for (var itop=0; itop<topifs.length; itop++) {
if (itop != -1) { topifs[itop].src=topifs[itop].src.split('&rnd=')[0] + '&rnd=' + itop + '' + Math.floor(Math.random() * 1234567); }
}
//top.document.title+=' 1';
top.document.getElementById('myh1').style.marginLeft='1px';
//top.document.title+='2';
window.top.scrollTo(0,0);
//top.document.title+='3';
}
}
}
}
}
function consolelog(inm) {
if (window.top) {
//alert(1);
if (top.document.getElementById('postlist') && top.document.URL.indexOf('debug=') != -1) {
//alert(101);
top.document.getElementById('postlist').style.display='block';
top.document.getElementById('postlist').innerHTML+='<br>' + inm;
} else if (('' + typeof window.top.consolelog) == 'function' && top.document.URL.indexOf('debug=') != -1) {
//alert(201);
window.top.consolelog(inm);
} else {
//alert('11 ' + typeof window.top.consolelog);
console.log(inm);
}
} else {
//alert(111);
console.log(inm);
}
}
</script>
</head>
<body onload=' followup(); setInterval(updatesc,1000);' style='background-color: transparent;'>
<form id='fgrid' method='POST' target='_self' action='//www.rjmprogramming.com.au/HTMLCSS/reveal_div.php'>
<input style='display:none' type='submit' value='Show in Grid' id='bgrid'></input>
<input type='hidden' value='' id='p1' name='p1'></input>
<input type='hidden' value='' id='p2' name='p2'></input>
<input type='hidden' value='' id='p3' name='p3'></input>
<input type='hidden' value='' id='p4' name='p4'></input>
<input type='hidden' value='' id='p5' name='p5'></input>
<input type='hidden' value='' id='p6' name='p6'></input>
<input type='hidden' value='' id='p7' name='p7'></input>
<input type='hidden' value='' id='p8' name='p8'></input>
<input type='hidden' value='' id='p9' name='p9'></input>
</form>
<!-- 1. The <iframe> (and video player) will replace this <div> tag. -->
<div id="player"></div>
<script>
// 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);
vwidth=location.search.split('width=')[1] ? eval(location.search.split('width=')[1].split('&')[0]) : vwidth;
vheight=location.search.split('height=')[1] ? eval(location.search.split('height=')[1].split('&')[0]) : vheight;
// 3. This function creates an <iframe> (and YouTube player)
// after the API code downloads.
//var player;
if (document.URL.indexOf('vid=') != -1) {
vid=location.search.split('vid=')[1] ? location.search.split('vid=')[1].split('&')[0] : postprompt(prompt('Please enter YouTube video id or playlist id (or a comma separated list of these, that can include a + to have up to 18 of them occur in a parent iframe grid), and optionally prefix by [640;][390;] which is [width;][height;]', previd));
vidarr=vid.split(',');
var splaytime="";
if (vid.indexOf(',') != -1) {
vid=vidarr[0];
splaytime=eval(-vidarr.length);
} else if (urlis != '' && document.URL.indexOf('playtime=') == -1) {
//location.href='./stop_start_youtube.html?vid=' + vid + '&playtime=-1000';
splaytime="-1";
oknow=false;
setTimeout(sendoff,2000);
} else if (vid.length > ('cGdz3GNhEQ4').length && document.URL.indexOf('playtime=') == -1) {
if (urlis == '') location.href='./stop_start_youtube.html?vid=' + vid + '&playtime=-1000';
splaytime="-1";
oknow=false;
} else if (document.URL.indexOf('start=') != -1) {
splaytime=location.search.split('playtime=')[1] ? eval(1000.0 * eval(location.search.split('playtime=')[1].split('&')[0])) : prompt('Please enter YouTube video ' + vid + ' playtime snippets in seconds (-1 to play whole video in one session, -2 (or -n) to play whole video and perhaps more (n in total) to follow in one session)', playtime / 1000);
} else {
splaytime=location.search.split('playtime=')[1] ? location.search.split('playtime=')[1].split('&')[0] : prompt('Please enter YouTube video ' + vid + ' playtime snippets in seconds (-1 to play whole video in one session, -2 (or -n) to play whole video and perhaps more (n in total) to follow in one session)', playtime / 1000);
}
if (document.URL.indexOf('playtime=') != -1) {
playtime=eval(eval("" + splaytime) * 1);
} else if (("" + splaytime) != "-1" && ("" + splaytime).indexOf("-") == 0) {
playtime=eval(-1 * 1000);
hm=eval(("" + splaytime).replace('-',''))
of=' 1 of up to ' + hm + ' ';
if (oknow) setTimeout(offerform,2000);
} else {
playtime=eval(eval("" + splaytime) * 1000);
}
} else {
vid=location.search.split('vid=')[1] ? location.search.split('vid=')[1].split('&')[0] : postprompt(prompt('Please enter YouTube video id or playlist id (or a comma separated list of these, that can include a + to have up to 18 of them occur in a parent iframe grid), and optionally prefix by [640;][390;] which is [width;][height;]', previd));
vidarr=vid.split(',');
var ssplaytime="";
if (vid.indexOf(',') != -1) {
vid=vidarr[0];
ssplaytime=eval(-vidarr.length);
} else if (urlis != '' && document.URL.indexOf('playtime=') == -1) {
//location.href='./stop_start_youtube.html?vid=' + vid + '&playtime=-1000';
ssplaytime="-1";
oknow=false;
setTimeout(sendoff,2000);
} else if (vid.length > ('cGdz3GNhEQ4').length && document.URL.indexOf('playtime=') == -1) {
if (urlis == '') location.href='./stop_start_youtube.html?vid=' + vid + '&playtime=-1000';
ssplaytime="-1";
oknow=false;
} else {
ssplaytime=location.search.split('playtime=')[1] ? location.search.split('playtime=')[1].split('&')[0] : prompt('Please enter YouTube video ' + vid + ' playtime snippets in seconds (-1 to play whole video in one session, -2 (or -n) to play whole video and perhaps more (n in total) to follow in one session)', playtime / 1000);
}
if (document.URL.indexOf('playtime=') != -1) {
playtime=eval(eval("" + ssplaytime) * 1);
} else if (("" + ssplaytime) != "-1" && ("" + ssplaytime).indexOf("-") == 0) {
playtime=eval(-1 * 1000);
hm=eval(("" + ssplaytime).replace('-',''))
if (hm > hone) {
anymore='&this=&width=' + vwidth + '&height=' + vheight + '&next=' + vid;
for (var iu=2; iu<=hm; iu++) {
anymore+='&next' + iu + '=' + vidarr[eval(-1 + iu)];
}
}
of=' 1 of up to ' + hm + ' ';
//alert(vid + " " + ssplaytime + " " + ("" + ssplaytime).indexOf("-") + " " + hm);
if (oknow) setTimeout(offerform,2000);
} else if (hone == 0) {
anymore='&this=&width=' + vwidth + '&height=' + vheight + '&next=' + vid;
playtime=eval(eval("" + ssplaytime) * 1000);
} else {
playtime=eval(eval("" + ssplaytime) * 1000);
}
if (urlis == '' && ((vid != previd && vid.indexOf(',') == -1) || vwidth != 640 || vheight != 390)) location.href='./stop_start_youtube.html?vid=' + vid + '&playtime=' + playtime + anymore;
}
function onYouTubeIframeAPIReady() {
if (vid.length > ('cGdz3GNhEQ4').length) {
play_list_id=vid;
vid='';
player = new YT.Player('player', {
width: vwidth,
height: vheight,
playerVars:
{
listType: 'playlist',
list: play_list_id,
index: 0
},
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
//player.playVideoAt(0);
} else {
player = new YT.Player('player', {
height: vheight,
width: vwidth,
videoId: vid,
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
}
}
// 4. The API will call this function when the video player is ready.
function onPlayerReady(event) {
var oktoplay=true;
if (document.URL.indexOf('start=0') != -1 && document.URL.indexOf('playtime=0') != -1) {
if (parent.document.getElementById('youtube_duration')) {
if (parent.document.getElementById('youtube_duration').value != "") {
if (parent.document.getElementById('myh1')) {
parent.document.getElementById('myh1').innerHTML=event.target.getVideoData().title;
oktoplay=false;
}
}
}
}
if (oktoplay) {
event.target.playVideo();
toggle=eval(1 - toggle);
if (play_list_id != '' && play_list_id.length > ('cGdz3GNhEQ4').length && document.URL.indexOf('playtime=') != -1) {
//window.open('./stop_start_youtube.html','_blank');
//location.href=player.getVideoUrl();
var yturlis=player.getVideoUrl();
if (document.URL.indexOf('nowo=') == -1 && urlis == '') window.open(yturlis,'_blank','top=50,left=650,width=700,height=800');
}
}
}
// 5. The API calls this function when the player's state changes.
// The function indicates that when playing a video (state=1),
// the player should play for six seconds and then stop.
var done = false;
function onPlayerStateChange(event) {
one=0;
onepause=0;
if (window.top) {
if (top.document.getElementById('listeleven') && eval('' + vid.trim().length) == 11) {
if (top.document.getElementById('listeleven').innerHTML != '') {
if (top.document.getElementById('listeleven').innerHTML.indexOf(vid + '##') != -1) {
if (top.document.getElementById('listeleven').innerHTML.indexOf(vid + '##') < 11) {
if (event.data == YT.PlayerState.PLAYING) {
if (eval('' + endcnt) <= 0) { endcnt=1; }
consolelog('playing event.data=' + event.data + ' was=' + top.document.getElementById('listeleven').innerHTML);
//if (top.document.getElementById('listeleven').innerHTML.indexOf(vid + '##') == 0) {
top.document.getElementById('listeleven').innerHTML=' ' + top.document.getElementById('listeleven').innerHTML.replace(' ',' ').trim();
consolelog('Playing event.data=' + event.data + ' is=' + top.document.getElementById('listeleven').innerHTML);
//} else if (top.document.getElementById('listeleven').innerHTML.indexOf(vid + '##') == 2) {
// top.document.getElementById('listeleven').innerHTML=' ' + top.document.getElementById('listeleven').innerHTML.trim();
//}
} else if (event.data == YT.PlayerState.PAUSED) {
consolelog('paused event.data=' + event.data + ' was=' + top.document.getElementById('listeleven').innerHTML);
endcnt=2;
//alert('paused event.data=' + event.data);
//if (top.document.getElementById('listeleven').innerHTML.indexOf(vid + '##') == 0) {
top.document.getElementById('listeleven').innerHTML=' ' + top.document.getElementById('listeleven').innerHTML.replace(' ',' ').trim();
consolelog('Paused event.data=' + event.data + ' is=' + top.document.getElementById('listeleven').innerHTML);
//} else if (top.document.getElementById('listeleven').innerHTML.indexOf(vid + '##') == 1) {
// top.document.getElementById('listeleven').innerHTML=' ' + top.document.getElementById('listeleven').innerHTML.trim();
//}
} else if (event.data == YT.PlayerState.ENDED) {
consolelog('ended event.data=' + event.data + ' was=' + top.document.getElementById('listeleven').innerHTML);
if (eval('' + endcnt) < 5) {
//alert('ended event.data=' + event.data);
endcnt=3;
var sufx='';
var capitalloop=top.document.getElementById('listeleven').getAttribute('data-title');
if ((capitalloop + 'a').substring(0,1) == 'X') {
sufx='^' + top.document.getElementById('listeleven').innerHTML.split('^')[0].replace(' ','').replace(' ','').trim();
}
if (top.document.getElementById('listeleven').innerHTML.indexOf('^') != -1) {
window.top.focus();
sufx='';
//alert('pre 1');
top.document.getElementById('listeleven').innerHTML=top.document.getElementById('listeleven').innerHTML.replace(top.document.getElementById('listeleven').innerHTML.split('^')[0] + '^','') + sufx; //.replace(top.document.getElementById('listeleven').innerHTML.split('^')[0],'');
//alert('1:' + top.document.getElementById('listeleven').innerHTML);
//top.document.title+=' ' + top.document.getElementById('listeleven').innerHTML.toUpperCase() + ' ';
//if (sufx != '') { alert(top.document.getElementById('listeleven').innerHTML); }
//top.document.title+=' 4';
} else {
window.top.focus();
//alert('pre 2');
var capitalloopx=top.document.getElementById('listeleven').getAttribute('data-title');
sufx=top.document.getElementById('listeleven').title; //sufx.replace('^','');
top.document.getElementById('listeleven').innerHTML=top.document.getElementById('listeleven').innerHTML.replace(top.document.getElementById('listeleven').innerHTML.split('^')[0] + '','') + sufx; //.replace(top.document.getElementById('listeleven').innerHTML.split('^')[0],'');
//alert('2:' + top.document.getElementById('listeleven').innerHTML);
//top.document.title+=' ' + top.document.getElementById('listeleven').innerHTML.toLowerCase() + ' ';
if ((capitalloopx + 'a').substring(0,1) == 'X') {
if (top.document.emojirestart) {
top.document.emojirestart();
} else {
var topifs=top.document.getElementsByTagName('iframe');
for (var itop=0; itop<topifs.length; itop++) {
if (itop != -1) { topifs[itop].src=topifs[itop].src.split('&rnd=')[0] + '&rnd=' + itop + '' + Math.floor(Math.random() * 1234567); }
}
//top.document.title+=' 1';
top.document.getElementById('myh1').style.marginLeft='1px';
//top.document.title+='2';
window.top.scrollTo(0,0);
//top.document.title+='3';
}
}
}
consolelog('Ended event.data=' + event.data + ' is=' + top.document.getElementById('listeleven').innerHTML);
}
//} else {
//alert('event.data=' + event.data);
}
}
}
}
}
}
if (event.data == YT.PlayerState.PLAYING) one=1;
if (event.data == YT.PlayerState.PAUSED) onepause=1;
analyzemaybe(one, onepause, done);
if (event.data == YT.PlayerState.PLAYING && !done) {
duration=player.getDuration();
endcnt=0;
setTimeout(yeswell, eval(eval(10 + eval('' + duration)) * 1000));
console.log('0:' + (new Date()) + ' duration=' + duration);
if (document.URL.indexOf('start=') != -1 && document.URL.indexOf('playtime=') != -1) parent.document.getElementById('myh1').innerHTML=player.getVideoData().title;
if (document.URL.indexOf('start=0') != -1 && document.URL.indexOf('playtime=0') != -1) {
//alert(duration);
oursecscnt=-1;
setTimeout(stopVideo, 10);
console.log('00:' + (new Date()) + ' duration=' + duration);
parent.document.getElementById('youtube_duration').value='' + duration;
//parent.document.getElementById('myh1').innerHTML=player.getVideoData().title;
if (kpi == -9) {
//alert(99);
if (document.URL.indexOf('start=') != -1 && document.URL.indexOf('playtime=') != -1) {
//alert(990);
if (document.URL.indexOf('start=0') == -1 || document.URL.indexOf('playtime=0') == -1) {
//alert(9900);
kpi=-8;
kpi=player.getCurrentTime();
keepParentInformed();
}
}
}
//stopVideo();
return;
} else {
if (playtime < 0) playtime=duration * 1000;
document.title='Playing YouTube ' + vid + of + ' for ' + playtime / 1000 + ' seconds ... is ' + duration + ' seconds altogether.';
document.getElementById('ptitle').innerHTML='Playing YouTube ' + vid + of + ' for ' + playtime / 1000 + ' seconds ... is ' + duration + ' seconds altogether.' + etc_volume();
document.getElementById('ivol').value=player.getVolume();
document.getElementById('ipbr').value=player.getPlaybackRate();
document.getElementById('iqty').value=player.getPlaybackQuality();
setTimeout(stopVideo, playtime + delay);
done = true;
eventtarget=event.target;
if (eval(oursecscnt) > 0) {
document.getElementById('ptitle').innerHTML='Playing YouTube ' + vid + ' starting at ' + oursecscnt + ' seconds ' + of + ' for ' + playtime / 1000 + ' seconds ... is ' + duration + ' seconds altogether.' + etc_volume();
document.title='Playing YouTube ' + vid + ' starting at ' + oursecscnt + ' seconds ' + of + ' for ' + playtime / 1000 + ' seconds ... is ' + duration + ' seconds altogether.';
if (kpi == -9) {
//alert(909);
if (document.URL.indexOf('start=') != -1 && document.URL.indexOf('playtime=') != -1) {
//alert(90900);
if (document.URL.indexOf('start=0') == -1 || document.URL.indexOf('playtime=0') == -1) {
//alert(909000);
kpi=-8;
kpi=player.getCurrentTime();
//alert(kpi);
keepParentInformed();
}
}
}
//alert("+" + oursecscnt + ' ... ' + playtime);
eventtarget.loadVideoById(vid, eval('' + oursecscnt), eval('' + oursecscnt) + eval(eval('' + playtime) / 1000.0), "medium");
oursecscnt=-1;
}
}
}
}
function keepParentInformed() {
if (eval(kpi) < 0) {
parent.document.getElementById('conduit').value=kpi;
} else {
var xkpi=player.getCurrentTime();
//top.document.title=xkpi;
if (('' + xkpi).indexOf('undefined') == -1) kpi=eval(xkpi);
parent.document.getElementById('conduit').value=kpi;
//parent.document.getElementById('myh1').innerHTML+=' ' + kpi;
}
if (eval(kpi) != -1) {
//alert(kpi);
setTimeout(keepParentInformed, 600);
} //else {
//alert('why is kpi=' + kpi);
//}
}
function stopVideo() {
if (cntpause > 0) {
setTimeout(stopVideo, cntpause * 1000);
cntpause=0;
} else {
var dorest=true;
toggle=1;
secscnt=player.getCurrentTime();
duration=player.getDuration();
if (eval('' + endcnt) == 1) {
endcnt=0;
setTimeout(yeswell, eval(eval(10 + eval('' + duration)) * 1000));
}
//alert('preone' + playtime);
if (playtime < 0) playtime=duration * 1000;
//alert('Preone' + dorest);
player.stopVideo();
if (document.URL.indexOf('start=') != -1 && document.URL.indexOf('playtime=') != -1) {
if (document.URL.indexOf('start=0') == -1 || document.URL.indexOf('playtime=0') == -1) {
//alert(secscnt);
kpi=-1;
keepParentInformed();
}
}
if (eval(oursecscnt) < 0) { // new Karaoke ideas in this "if"
//alert(9);
secscnt = duration;
tobechecked=null;
dorest=false;
}
//alert(secscnt);
if (secscnt >= duration) {
if (tobechecked != null) {
if (tobechecked.value != '') {
dorest=false;
document.getElementById('oform').submit();
//document.getElementById('bsubmit').click();
}
}
if (dorest) {
if (nexturl != "") {
if (urlis == '') location.href=nexturl;
} else if ('old' == 'new') {
if (document.URL.indexOf('nowo=') == -1 && document.URL.indexOf('start=') == -1) alert("Stumps has been called. End of play.");
} else if (dostumps && document.URL.indexOf('nowo=') == -1) {
dostumps=false;
var donext=null;
if (document.URL.indexOf('start=') == -1) prompt("Stumps has been called. End of play. Is there a YouTube video id to play next?", "");
if (donext == null) donext='';
if (donext != '' && urlis == '') location.href='./stop_start_youtube.html?vid=' + donext;
}
}
} else {
setTimeout(startVideo, playtime + delay);
}
}
}
function startVideo() {
var dorest=true;
//alert('PREone ' + secscnt + ' ' + duration + ':' + dorest);
if (secscnt >= duration) {
if (tobechecked != null) {
if (tobechecked.value != '') {
dorest=false;
document.getElementById('oform').submit();
//document.getElementById('bsubmit').click();
}
}
if (dorest) {
if (nexturl != "") {
if (urlis == '') location.href=nexturl;
} else if ('old' == 'new') {
if (document.URL.indexOf('nowo=') == -1) alert("Stumps is called. End of play.");
} else if (dostumps && document.URL.indexOf('nowo=') == -1) {
dostumps=false;
var donext=prompt("Stumps is called. End of play. Is there a YouTube video id to play next?", "");
if (donext == null) donext='';
if (donext != '' && urlis == '') location.href='./stop_start_youtube.html?vid=' + donext;
}
}
} else {
//alert('two');
if (document.URL.indexOf('start=0') != -1 && document.URL.indexOf('playtime=0') != -1) {
//alert('+' + duration);
oursecscnt=-1;
setTimeout(stopVideo, 10);
parent.document.getElementById('youtube_duration').value='' + duration;
parent.document.getElementById('myh1').innerHTML=player.getVideoData().title;
if (kpi == -9) {
//alert(99000);
if (document.URL.indexOf('start=') != -1 && document.URL.indexOf('playtime=') != -1) {
//alert(990000);
if (document.URL.indexOf('start=0') == -1 || document.URL.indexOf('playtime=0') == -1) {
//alert(9900000);
kpi=-8;
kpi=player.getCurrentTime();
keepParentInformed();
}
}
}
//stopVideo();
return;
} else {
document.title='Playing YouTube ' + vid + ' starting at ' + secscnt + ' seconds to ' + Math.min(duration, eval(secscnt + (playtime / 1000))) + ' seconds for up to ' + playtime / 1000 + ' seconds ... is ' + duration + ' seconds altogether.';
document.getElementById('ptitle').innerHTML='Playing YouTube ' + vid + ' starting at ' + secscnt + ' seconds to ' + Math.min(duration, eval(secscnt + (playtime / 1000))) + ' seconds for up to ' + playtime / 1000 + ' seconds ... is ' + duration + ' seconds altogether.' + etc_volume();
document.getElementById('ivol').value=player.getVolume();
document.getElementById('ipbr').value=player.getPlaybackRate();
document.getElementById('iqty').value=player.getPlaybackQuality();
eventtarget.cueVideoById(vid, secscnt, secscnt + playtime / 1000, "medium");
if (eval(oursecscnt) > 0) {
//alert(oursecscnt);
document.getElementById('ptitle').innerHTML='Playing YouTube ' + vid + ' starting at ' + oursecscnt + ' seconds to ' + Math.min(duration, eval(secscnt + (playtime / 1000))) + ' seconds for up to ' + playtime / 1000 + ' seconds ... is ' + duration + ' seconds altogether.' + etc_volume();
document.title='Playing YouTube ' + vid + ' starting at ' + oursecscnt + ' seconds ' + of + ' for ' + playtime / 1000 + ' seconds ... is ' + duration + ' seconds altogether.';
if (kpi == -9) {
//alert(909);
if (document.URL.indexOf('start=') != -1 && document.URL.indexOf('playtime=') != -1) {
//alert(9090);
if (document.URL.indexOf('start=0') == -1 || document.URL.indexOf('playtime=0') == -1) {
//alert(90900);
kpi=-8;
kpi=player.getCurrentTime();
//alert(kpi + ".");
keepParentInformed();
}
}
}
//eventtarget.loadVideoById(vid, eval(oursecscnt), eval(oursecscnt + playtime / 1000), "medium");
eventtarget.loadVideoById(vid, eval('' + oursecscnt), eval('' + oursecscnt) + eval(eval('' + playtime) / 1000.0), "medium");
oursecscnt=-1;
}
toggle=0;
player.playVideo();
setTimeout(stopVideo, playtime + delay);
}
}
}
</script>
<h1 style='align:right;'>YouTube Embedded Iframe API Usage</h1>
<h3 style='align:right;'>RJM Programming - June, 2016</h3>
<div id='ptitle'></div>
<div id='dform' style='background-color:yellow;'></div>
</body>
</html>