<!doctype html>
<html>

<head data-live-domain="api.jquery.com">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">


<meta name="author" content="jQuery Foundation - jquery.org">
<meta name="description" content="jQuery: The Write Less, Do More, JavaScript Library">

<meta name="viewport" content="width=device-width">

<link rel="shortcut icon" href="//api.jquery.com/jquery-wp-content/themes/api.jquery.com/i/favicon.ico">

<link rel="stylesheet" href="//api.jquery.com/jquery-wp-content/themes/jquery/css/base.css?v=1">
<link rel="stylesheet" href="//api.jquery.com/jquery-wp-content/themes/api.jquery.com/style.css">
<link rel="pingback" href="//api.jquery.com/xmlrpc.php" />
<!--[if lt IE 7]><link rel="stylesheet" href="css/font-awesome-ie7.min.css"><![endif]-->

<script src="//api.jquery.com/jquery-wp-content/themes/jquery/js/modernizr.custom.2.6.2.min.js"></script>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>window.jQuery || document.write(unescape('%3Cscript src="//api.jquery.com/jquery-wp-content/themes/jquery/js/jquery-1.9.1.min.js"%3E%3C/script%3E'))</script>

<script src="//api.jquery.com/jquery-wp-content/themes/jquery/js/plugins.js"></script>
<script src="//api.jquery.com/jquery-wp-content/themes/jquery/js/main.js"></script>

<script src="//use.typekit.net/wde1aof.js"></script>
<script>try{Typekit.load();}catch(e){}</script>

<script type='text/javascript' src='//api.jquery.com/wp-includes/js/comment-reply.min.js?ver=3.8'></script>
<link href='//www.rjmprogramming.com.au/PHP/emboss_h1.css' rel='stylesheet' type='text/css'>
<title>Karaoke via YouTube API - RJM Programming - September, 2016</title>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=0.1, maximum-scale=8, user-scalable=yes" >
<script type='text/javascript' src='keep_parent_background.js'></script>
<style>
body {
background-color: lightblue;
padding-top: 20px;
background: -webkit-linear-gradient(center top , rgb(255, 255, 0), rgb(0, 255, 255)) repeat scroll 0% 0% transparent;
background: -o-linear-gradient(center top , rgb(255, 255, 0), rgb(0, 255, 255)) repeat scroll 0% 0% transparent;
background: -moz-linear-gradient(center top , rgb(255, 255, 0), rgb(0, 255, 255)) repeat scroll 0% 0% transparent;
background: linear-gradient(180deg, rgb(255, 255, 0), rgb(0, 255, 255)); /* linear-gradient(center top , rgb(255, 255, 0), rgb(0, 255, 255)) repeat scroll 0% 0% transparent */
}
input { z-index: 5; }
.emoji { border: 8px solid white; font-size: 20px; }
#youtubeid { width: 300px; }
</style>
<script type='text/javascript'>
var sstr='';
var emojisuffix='ej';
var firstsuffix="&playtime=0&start=0";
var firstprefix="";
var snippet=-1;
var ourvid=location.search.split('vid=')[1] ? decodeURIComponent(location.search.split('vid=')[1].split('&')[0]) : '';
var doemoji=location.search.split('emoji=')[1] ? location.search.split('emoji=')[1].split('&')[0] : 'on';
var doemj=false, ech='';
if (doemoji == 'on') {
doemj=true;
ech='checked';
}
var givefactor=0;
var givefifteen=-1;
var thisonetodo=0;
var onestodoprefix='';
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 onestodo=[];
var onestododur=[];
var morethanone=false;
var preselc='';
var defval='0';
var next=0;
var nextthing='mytbody';
var lastfinish=-1;
var next_thing='xx0';
var mbmode=false;
var nine=29;
var bcol='#f0f0f0';
var nextdelay=-1;
var lastokn='';
var okn='';
var morechanges=true;
var oko=null;
var cbut="<br><div style='text-align:center; width: 100%;'><div id='ddkaraoke' style='display:inline; visibility: hidden; '><input onclick=\"if (document.URL.indexOf('i0=') != -1) { alert(987); location.href=document.URL; } \" id='repeat' type='button' style='background-color:red;' value='Replay Karaoke Style YouTube Above'></input><br><input onclick=clickto(); id=karaokeshare value='Email Share to ' type='button'></input> <input style=width:60%; onblur=doto(this.value); type=text name=email id=karaokeemail value=></input></div><div id='dkaraoke' style='display:inline; visibility: hidden; '><input id='mousej' type='button' style='background-color:#f0f0f0; display:inline; visibility: hidden;' onclick=' mousebelowj(this);' value='Fill Table Below via Mouse Video Pauses Starting with '></input> <input id='mousei' type='button' style='background-color:#f5f5f5; display:inline; visibility: hidden;' onclick=' mousebelowi(this);' value='Fill Table Starting with 0 cell'></input> <input id='karaoke' onclick=\" mbmode=false; document.getElementById('ddkaraoke').style.visibility='visible'; if (document.URL.indexOf('i0=') != -1) { next=0; } queuenext();\" type='submit' style='background-color:orange;' value='Play Karaoke Style YouTube Via Entries Below'></input></div><div id='dkaraoke' style='display:inline; visibility: hidden; '></div></div>";
var cbutl="<div style=' text-align:center; width: 100%; height: 60px;'><div style=' text-align:center; width: 100%; height: 60px;'><div id='dkaraoke' style=' display:inline; visibility: hidden; '><div style='text-align:center; width: 100%;'><div style='text-align:center; width: 100%;'><input id='karaoke' onclick=\" mbmode=false; document.getElementById('ddkaraoke').style.visibility='visible'; if (document.URL.indexOf('i0=') != -1) { next=0; } queuenext();\" type='submit' style='background-color:orange;' value='Play Karaoke Style YouTube Via Entries Below'></input></div></div></div><br><div id='ddkaraoke' style='margin-top:-100px; visibility: hidden; text-align:center; width: 100%; '><div style='text-align:center; width: 100%;'><div style='text-align:center; width: 100%;'><input onclick=\"if (document.URL.indexOf('i0=') != -1) { location.href=document.URL; } \" id='repeat' type='button' style='background-color:red;' value='Replay Karaoke Style YouTube Above'></input><br><input onclick=clickto(); id=karaokeshare value='Email Share to ' type='button'></input><input onblur=doto(this.value); type=text name=email id=karaokeemail value=></input></div></div></div></div></div><br><br>✔ (<a target=_blank title='Thanks to https://webaudiodemos.appspot.com/AudioRecorder ... if it works for your browser. If not, you can consider using a desktop microphone recorder app such as Mac OS X QuickTime Player as an alternative perhaps.' href='https://webaudiodemos.appspot.com/AudioRecorder/index.html'>Record</a> own parts? <input onchanged='dorecord=!dorecord;' type=checkbox name=recown id=recown value='Record own parts?'></input>) ";
var cbutm="<div style='text-align:center; width: 100%; height: 60px;'><div id='dkaraokem' style='display:inline; visibility: hidden; '><input id='mousei' type='button' style='background-color:#f5f5f5; display:inline; visibility: hidden;' onclick=' mousebelowi(this);' value='Fill Table Below via Mouse Video Pauses'></input></div></div><br>Start time in seconds <span id=nm style='display:none;'>(negative means you will be singing or Prefix by Audio file URL or YouTube ID delimited by :)</span>";
var cbutr="<div style='text-align:center; width: 100%; height: 60px;'><div id='dkaraoker' style='display:inline; visibility: hidden; '>        <input id='mousej' type='button' style=' background-color:#f0f0f0; display:inline; visibility: hidden;' onclick=' mousebelowj(this);' value='Fill Table Starting with '></input></div></div><br><span style=text-align:right;width:100%;>Finish</span>";
var zeroplay=-1;
var ylastokn='';
var yokn='';
var yoko=null;
var donef=false;
var huhaudiow=false;
var audiow=null;
var audiof='';
var audioi=0;
var audioask=false;
var dorecord=false;
var ourrec=location.search.split('recown=')[1] ? location.search.split('recown=')[1].split('&')[0] : 'off';
var ioffset=0;

function putmorethanone(mto) {
morethanone=mto;
if (morethanone) {
document.getElementById('ajaxs').style.height='300px';
document.getElementById('ajaxs').multiple=true;
givefactor=0;
document.getElementById('dajaxs').innerHTML='<input title="Select Video(s) and then Click Here When Ready to Play them (with up to 20 seconds pause or time for your clicks between each)" type=button onclick=" givefactor=givefifteen; " style=display:inline;width:100px;background-color:yellow; value="Ready?" id=iajaxs></input>';
} else {
document.getElementById('ajaxs').multiple=false;
}
}

function clickto() {
if (1 == 11) {
var ibitis=document.getElementById('emailer').src.split('?')[0].split('#')[0];
ibitis+='?to=' + encodeURIComponent(document.getElementById('to').value);
ibitis+='&cc=' + encodeURIComponent(document.getElementById('cc').value);
ibitis+='&bcc=' + encodeURIComponent(document.getElementById('bcc').value);
ibitis+='&url=' + encodeURIComponent(document.getElementById('url').value);
ibitis+='&urlbig=' + encodeURIComponent(document.getElementById('urlbig').value);
ibitis+='&subject=' + encodeURIComponent(document.getElementById('subject').value);
document.getElementById('emailer').src=ibitis;
} else {
document.getElementById('sendemail').click();
}
}

function doto(etv) {
document.getElementById('to').value=etv;
}

function closeaudio() {
try {
if (audiow != null) {
audiow.close();
audioask=false;
if (audiof == '') {
//audiof='';
var outaf=null;
if (dorecord) outaf=prompt('Please enter URL to access local audio you just captured. There is very little chance you will not need to change the default value. If it starts with file: you will have to double click these when prompted, else .wav ones are automated, and you can use local web servers like Mac OS X Apache/PHP MAMP (https://www.mamp.info) for a filename like //localhost:8888/myRecording00.wav that would work if you have copied the audio from the Downloads folder to /Applications/MAMP/htdocs/ for instance. Windows has Apache/PHP EasyPHP (//www.easyphp.org/) local web server.', 'file:///home/Downloads/myRecording00.wav');
if (outaf) {
if (outaf != '') {
morechanges=false;
document.getElementById('i' + audioi).value+=';' + outaf;
document.getElementById('trbutton').style.visibility='visible';
document.getElementById('dkaraoke').style.visibility='visible';
document.getElementById('dkaraokem').style.visibility='visible';
document.getElementById('dkaraoker').style.visibility='visible';
document.getElementById('trrhead').style.display='none';
document.getElementById('karaoke').style.visibility='visible';
if (document.getElementById('d' + emojisuffix + 'karaoke')) {
document.getElementById('d' + emojisuffix + 'karaoke').style.visibility='visible';
document.getElementById('d' + emojisuffix + 'karaokem').style.visibility='visible';
document.getElementById('d' + emojisuffix + 'karaoker').style.visibility='visible';
document.getElementById(emojisuffix + 'karaoke').style.visibility='visible';
// alert(emojisuffix + 'karaoke');
emojistuff();
}
}
} else {
ioffset=-1;
}
}
}
} catch (ee) { }
audiow=null;
}

function toms(inf) {
if (inf.value != '') {
if (inf.value.split(';')[0].substring(0,1) >= '0' && inf.value.split(';')[0].substring(0,1) <= '9') {
var secsare=eval(inf.value.split(';')[0]);
//alert(Math.floor(secsare / 3600.0));
//alert(('0' + Math.floor(secsare / 60.0)));
//alert(('0' + eval(secsare,60.0)));
//alert('take two off length of ' + ('0' + Math.floor(eval(secsare,60.0))));
inf.title=Math.floor(secsare / 3600.0) + ':' + ('0' + Math.floor(secsare / 60.0)).substring(eval(-2 + ('0' + Math.floor(secsare / 60.0)).length)) + ':' + ('0' + eval(secsare % 60.0)).substring(eval(-2 + ('0' + Math.floor((secsare % 60.0))).length));
//alert(secsare + ' ' + inf.title);
}
}
}

function andthe() {
var ii=eval(1 + eval(document.getElementById('updatethisplease').value.replace('i','').replace('j','')));
next_thing='xx' + ii;
document.getElementById(next_thing).style.visibility='visible';
document.getElementById(document.getElementById('updatethisplease').value).style.backgroundColor=bcol;
setTimeout(andthe, 1000);
}

function andth() {
document.getElementById('mousei').style.visibility='hidden';
document.getElementById('mousej').style.visibility='hidden';
}

function mousebelowj(omo) {
//alert(omo.id.replace('j','i'));
document.getElementById(omo.id.replace('j','i')).style.visibility='hidden';
//alert(9000);
mbmode=true;
omo.value='When finished with Table Settings click Orange button to Play your Table Settings';
//alert(90000);
bcol='#f0f0f0';
document.getElementById('updatethisplease').value='j0';
document.getElementById(document.getElementById('updatethisplease').value).style.backgroundColor=bcol;
//alert(900000);
document.getElementById('c0').checked=true;
document.getElementById('thft').innerHTML='Via Mouse Video Click Pauses ... <br>' + 'where Click, DoubleClick for the Finish entries <br>would mean no user Karaoke part ... <br>' + document.getElementById('thft').innerHTML;
//alert(9000000);
//document.getElementById('karaoke').click();
next=0;
queuenext();
setTimeout(andth, 5000);
andthe();
//alert(90000000);
}

function mousebelowi(omo) {
//alert(900);
document.getElementById(omo.id.replace('i','j')).style.visibility='hidden';
omo.value='When finished with Table Settings click Orange button to Play your Table Settings';
document.getElementById('updatethisplease').value='i0';
bcol='#f5f5f5';
document.getElementById(document.getElementById('updatethisplease').value).style.backgroundColor=bcol;
document.getElementById('thst').innerHTML='Via Mouse Video Click Pauses ... <br>' + document.getElementById('thst').innerHTML;
document.getElementById('c0').checked=true;
//document.getElementById('karaoke').click();
mbmode=true;
next=0;
queuenext();
setTimeout(andth, 5000);
andthe();
}

function ofc(iois) {
okn=iois.value;
oko=iois;
lastokn=okn;
}

function precval(iois) {
//okn=iois.value;
oko=iois;
lastokn=okn;
if (okn.indexOf(':x') != -1) {
var cvi=okn.split(':');
if (cvi.length > 1) {
var scs=0.0, factor=1.0;
for (var ij=eval(-1 + cvi.length); ij>=0; ij--) {
if (cvi[ij] == "") cvi[ij]="00";
scs+=eval(factor * eval(cvi[ij]));
factor*=60.0;
}
okn='' + scs;
oko.value=okn;
lastokn=okn.replace(':','');
//document.title=oko.value;
//setTimeout(fixval,30);
}
}
}

function fixval() {
if (okn != '') {
oko.value=okn;
} else if (lastokn != '') {
oko.value=lastokn;
lastokn='';
} //else {
//document.title='why';
//}
}

function cval(eiois) {
if (document.URL.indexOf('i0=') == -1) {
//alert(eiois.which);
//okn+=String.fromCharCode(eiois.which || eiois.keyCode);
if ((eiois.which || eiois.keyCode) == 8) {
okn='';
} else if ((eiois.which || eiois.keyCode) == 186 || (eiois.which || eiois.keyCode) == 900000016) {
okn=okn.replace(':','') + ':';
//document.title=okn + ' ' + (eiois.which || eiois.keyCode);
var cvi=okn.split(':');
if (cvi.length > 1) {
var scs=0.0, factor=1.0;
for (var ij=eval(-1 + cvi.length); ij>=0; ij--) {
if (cvi[ij] == "") cvi[ij]="00";
scs+=eval(factor * eval(cvi[ij]));
factor*=60.0;
}
//alert(scs + ' ' + okn);
okn='' + scs;
oko.value=okn;
lastokn=okn.replace(':','');
//document.title=okn + ' ' + (eiois.which || eiois.keyCode) + ' ' + oko.value;
//setTimeout(fixval,30);
}
} else if ((eiois.which || eiois.keyCode) < 46 || (eiois.which || eiois.keyCode) > 58) {
okn=okn;
} else {
okn+=String.fromCharCode(eiois.which || eiois.keyCode);
//document.title+='=' + okn + '+' + eiois.which + ' ' + eiois.keyCode + ' ... ';
}
}
}



function checkval(iois) {
if (document.URL.indexOf('i0=') == -1) {
var cvi=iois.value.split(':');
if (cvi.length > 1) {
var scs=0.0, factor=1.0;
for (var ij=eval(-1 + cvi.length); ij>=0; ij--) {
scs+=eval(factor * eval(cvi[ij]));
factor*=60.0;
}
iois.value='' + scs;
}
addrow();
} else {
snippet=eval(iois.id.replace('i','').replace('j','').replace('c',''));
snippet++;
document.getElementById('xx' + snippet).style.visibility='visible';
}
}



function yofc(iois) {
yokn=iois.value;
yoko=iois;
ylastokn=yokn;
}

function yprecval(iois) {
//yokn=iois.value;
yoko=iois;
ylastokn=yokn;
}

function yfixval() {
if (yokn != '') {
yoko.value=yokn;
} else if (ylastokn != '') {
yoko.value=ylastokn;
ylastokn='';
}
}

function ycval(eiois) {
if (document.URL.indexOf('i0=') == -1) {
//alert(eiois.which);
//yokn+=String.fromCharCode(eiois.which || eiois.keyCode);
if ((eiois.which || eiois.keyCode) == 8) {
yokn='';
} else if ((eiois.which || eiois.keyCode) < 33 || (eiois.which || eiois.keyCode) > 126) {
yokn=yokn;
} else {
yokn+=String.fromCharCode(eiois.which || eiois.keyCode);
getytlist(yokn);
}
}
}


function addrow() {
var suffix='', vmode='visible';
snippet++;
var csnippet=location.search.split('c' + snippet + '=')[1] ? location.search.split('c' + snippet + '=')[1].split('&')[0] : 'off';
var isnippet=location.search.split('i' + snippet + '=')[1] ? decodeURIComponent(location.search.split('i' + snippet + '=')[1].split('&')[0]) : ' ';
var jsnippet=location.search.split('j' + snippet + '=')[1] ? decodeURIComponent(location.search.split('j' + snippet + '=')[1].split('&')[0]) : ' ';
if (isnippet == ' ' && jsnippet == ' ') {
if (defval != '') {
//alert(0);
for (var ii=1; ii<=nine; ii++) {
suffix+='<tr style=visibility:' + vmode + ';background-color:pink; id=xx' + eval(ii + snippet) + '><td><input type=checkbox id=c' + eval(ii + snippet) + ' name=c' + eval(ii + snippet) + '></input></td><td><input style=width:400px; onblur=checkval(this); type=text onmouseover=toms(this); id=i' + eval(ii + snippet) + ' name=i' + eval(ii + snippet) + ' value=></input></td><td><input style=width:100px; type=number onkeyup=cval(event); oninput=precval(this); onclick=ofc(this); onmouseover=toms(this); min=0 id=j' + eval(ii + snippet) + ' name=j' + eval(ii + snippet) + ' step=0.000001 value=></input></td></tr>';
vmode='hidden';
}
document.getElementById(nextthing).innerHTML+='<tr id=xx0 style=background-color:pink;><td><input onclick=andth(); type=checkbox id=c' + snippet + ' name=c' + snippet + '></input></td><td><input style=width:400px; onblur=checkval(this); type=text onmouseover=toms(this); id=i' + snippet + ' name=i' + snippet + ' value=' + defval + '></input></td><td><input style=width:100px; type=number onkeyup=cval(event); oninput=precval(this); onclick=ofc(this); onmouseover=toms(this); min=0 max=' + eval(document.getElementById('youtube_duration').value).toFixed(3) + ' id=j' + snippet + ' name=j' + snippet + ' step=0.000001 value=' + eval(document.getElementById('youtube_duration').value).toFixed(3) + '></input></td></tr>' + suffix;
} else {
//alert(90);
document.getElementById(nextthing).style.visibility='visible';
}
} else if (csnippet == 'off') {
if (defval != '') {
//alert(0);
for (var ii=1; ii<=nine; ii++) {
suffix+='<tr style=visibility:' + vmode + ';background-color:pink; id=xx' + eval(ii + snippet) + '><td><input type=checkbox id=c' + eval(ii + snippet) + ' name=c' + eval(ii + snippet) + '></input></td><td><input style=width:400px; onblur=checkval(this); type=text onmouseover=toms(this); id=i' + eval(ii + snippet) + ' name=i' + eval(ii + snippet) + ' value=></input></td><td><input style=width:100px; type=number onkeyup=cval(event); oninput=precval(this); onclick=ofc(this); onmouseover=toms(this); min=0 id=j' + eval(ii + snippet) + ' name=j' + eval(ii + snippet) + ' step=0.000001 value=></input></td></tr>';
vmode='hidden';
}
document.getElementById(nextthing).innerHTML+='<tr id=xx0 style=background-color:pink;><td><input onclick=andth(); type=checkbox id=c' + snippet + ' name=c' + snippet + '></input></td><td><input style=width:400px; onblur=checkval(this); type=text onmouseover=toms(this); id=i' + snippet + ' name=i' + snippet + ' value=' + isnippet + '></input></td><td><input style=width:100px; type=number onkeyup=cval(event); oninput=precval(this); onclick=ofc(this); onmouseover=toms(this); min=0 max=' + document.getElementById('youtube_duration').value + ' id=j' + snippet + ' name=j' + snippet + ' step=0.000001 value=' + jsnippet + '></input></td></tr>' + suffix;
} else {
//alert(90);
document.getElementById(nextthing).style.visibility='visible';
document.getElementById('i' + snippet).value=isnippet;
document.getElementById('j' + snippet).value=jsnippet;
}
} else {
if (defval != '') {
//alert(0);
for (var ii=1; ii<=nine; ii++) {
suffix+='<tr style=visibility:' + vmode + ';background-color:pink; id=xx' + eval(ii + snippet) + '><td><input type=checkbox id=c' + eval(ii + snippet) + ' name=c' + eval(ii + snippet) + '></input></td><td><input style=width:400px; onblur=checkval(this); type=text onmouseover=toms(this); id=i' + eval(ii + snippet) + ' name=i' + eval(ii + snippet) + ' value=></input></td><td><input style=width:100px; type=number onkeyup=cval(event); oninput=precval(this); onclick=ofc(this); onmouseover=toms(this); min=0 id=j' + eval(ii + snippet) + ' name=j' + eval(ii + snippet) + ' step=0.000001 value=></input></td></tr>';
vmode='hidden';
}
document.getElementById(nextthing).innerHTML+='<tr id=xx0 style=background-color:pink;><td><input onclick=andth(); type=checkbox id=c' + snippet + ' name=c' + snippet + ' checked></input></td><td><input style=width:400px; onblur=checkval(this); type=text onmouseover=toms(this); id=i' + snippet + ' name=i' + snippet + ' value=' + isnippet + '></input></td><td><input style=width:100px; type=number onkeyup=cval(event); oninput=precval(this); onclick=ofc(this); onmouseover=toms(this); min=0 max=' + document.getElementById('youtube_duration').value + ' id=j' + snippet + ' name=j' + snippet + ' step=0.000001 value=' + jsnippet + '></input></td></tr>' + suffix;
} else {
//alert(90);
document.getElementById(nextthing).style.visibility='visible';
document.getElementById('c' + snippet).checked=true;
document.getElementById('i' + snippet).value=isnippet;
document.getElementById('j' + snippet).value=jsnippet;
}
csnippet=location.search.split('c' + eval(1 + snippet) + '=')[1] ? location.search.split('c' + eval(1 + snippet) + '=')[1].split('&')[0] : 'off';
isnippet=location.search.split('i' + eval(1 + snippet) + '=')[1] ? location.search.split('i' + eval(1 + snippet) + '=')[1].split('&')[0] : ' ';
jsnippet=location.search.split('j' + eval(1 + snippet) + '=')[1] ? location.search.split('j' + eval(1 + snippet) + '=')[1].split('&')[0] : ' ';
//alert('isnippet=' + isnippet + '*and* jsnippet=' + jsnippet + '*');
if (isnippet.trim() == '' && jsnippet.trim() == '') {
//alert('isNippet=' + isnippet + '*and* snippet=' + snippet + '*');
queuenext(); //document.getElementById('dkaraoke').click();
return;
} else {
nextthing='xx' + eval(1 + snippet);
defval='';
document.getElementById('trbutton').style.visibility='visible';
document.getElementById('dkaraoke').style.visibility='visible';
document.getElementById('dkaraokem').style.visibility='visible';
document.getElementById('dkaraoker').style.visibility='visible';
document.getElementById('trrhead').style.display='none';
if (document.getElementById('dd' + emojisuffix + 'karaoke')) {
document.getElementById('d' + emojisuffix + 'karaoke').style.visibility='visible';
document.getElementById('d' + emojisuffix + 'karaokem').style.visibility='visible';
document.getElementById('d' + emojisuffix + 'karaoker').style.visibility='visible';
document.getElementById(emojisuffix + 'karaoke').style.visibility='visible'; // huh
emojistuff();
}
//alert('isnippet=' + isnippet + '*and* jsnippet=' + jsnippet + '*');
addrow();
return;
}
}
nextthing='xx' + eval(1 + snippet);
defval='';
document.getElementById('trbutton').style.visibility='visible';
document.getElementById('dkaraoke').style.visibility='visible';
document.getElementById('dkaraokem').style.visibility='visible';
document.getElementById('dkaraoker').style.visibility='visible';
document.getElementById('trrhead').style.display='none';
if (document.getElementById('dd' + emojisuffix + 'karaoke')) {
document.getElementById('d' + emojisuffix + 'karaoke').style.visibility='visible';
document.getElementById('d' + emojisuffix + 'karaokem').style.visibility='visible';
document.getElementById('d' + emojisuffix + 'karaoker').style.visibility='visible';
document.getElementById(emojisuffix + 'karaoke').style.visibility='visible'; // huh
emojistuff();
}
if (document.getElementById('j0').value.indexOf('.') == -1) {
document.getElementById('j0').value+='';
} else {
var xxqw=document.getElementById('j0').value.split('.');
if (xxqw[1].length > 3) {
document.getElementById('j0').value=xxqw[0] + '.' + xxqw[1].substring(0,3);
}
}

if (zeroplay == 0) {
document.getElementById('c0').checked=true;
//if (onestodo.length > 1) alert('hERe');
if (document.getElementById('dd' + emojisuffix + 'karaoke')) {
document.getElementById(emojisuffix + 'karaoke').click();
} else {
document.getElementById('karaoke').click();
}
} else if (top.document.title.indexOf("Country ") == 0 && top.document.title.indexOf(" Quiz") != -1 && document.getElementById('c0')) {
document.getElementById('c0').checked=true;
//if (onestodo.length > 1) alert('hERE');
if (document.getElementById('ejkaraoke')) {
document.getElementById('ejkaraoke').click();
}
} else if (((top.document.title.indexOf("Health ") == 0 && top.document.title.indexOf(" Meaning") != -1) || (top.document.URL.indexOf('rjmprogramming.com.au/wordpress') != -1 || top.document.URL.indexOf('rjmprogramming.com.au/ITblog') != -1)) && document.getElementById('c0')) {
document.getElementById('c0').checked=true;
//if (onestodo.length > 1) alert('HEre');
if (document.getElementById('ejkaraoke')) {
document.getElementById('ejkaraoke').click();
}
} else if (((top.document.title.indexOf("Indigenous ") == 0 && top.document.title.indexOf(" Australia") != -1) || (top.document.URL.indexOf('rjmprogramming.com.au/wordpress') != -1 || top.document.URL.indexOf('rjmprogramming.com.au/ITblog') != -1)) && document.getElementById('c0')) {
document.getElementById('c0').checked=true;
//if (onestodo.length > 1) alert('HEre');
if (document.getElementById('ejkaraoke')) {
document.getElementById('ejkaraoke').click();
}
} else if (((top.document.title.indexOf("Dams ") == 0 && top.document.title.indexOf(" United States") != -1) || (top.document.URL.indexOf('rjmprogramming.com.au/wordpress') != -1 || top.document.URL.indexOf('rjmprogramming.com.au/ITblog') != -1)) && document.getElementById('c0')) {
document.getElementById('c0').checked=true;
//if (onestodo.length > 1) alert('HEre');
if (document.getElementById('ejkaraoke')) {
document.getElementById('ejkaraoke').click();
}
} else if (((top.document.title.indexOf("Australian ") == 0) || (top.document.URL.indexOf('rjmprogramming.com.au/wordpress') != -1 || top.document.URL.indexOf('rjmprogramming.com.au/ITblog') != -1)) && document.getElementById('c0')) {
document.getElementById('c0').checked=true;
//if (onestodo.length > 1) alert('HEre');
if (document.getElementById('ejkaraoke')) {
document.getElementById('ejkaraoke').click();
}
} else if (top.document.title.indexOf("Nostalgia ") == 0 && document.getElementById('c0')) {
document.getElementById('c0').checked=true;
//if (onestodo.length > 1) alert('HEre');
if (document.getElementById('ejkaraoke')) {
document.getElementById('ejkaraoke').click();
}
} else if (top.document.title.indexOf("(at least on Google Chrome)") != -1 && document.getElementById('c0')) {
document.getElementById('c0').checked=true;
//if (onestodo.length > 1) alert('HEre');
if (document.getElementById('ejkaraoke')) {
document.getElementById('ejkaraoke').click();
}
} else if (top.document.title.indexOf("The Other Side of the World") == 0 && document.getElementById('c0')) {
document.getElementById('c0').checked=true;
//if (onestodo.length > 1) alert('HEre');
if (document.getElementById('ejkaraoke')) {
document.getElementById('ejkaraoke').click();
}
}
}

function nextv() {
if (thisonetodo < onestodo.length) {
ourvid=onestodo[thisonetodo];
//if (thisonetodo > 0) alert(ourvid);
document.getElementById('ajax').innerHTML='';
document.getElementById('youtubeid').value=ourvid;
document.getElementById('performance').innerHTML=ouriframe("<iframe id='myiframe' style='z-index:-4;width:720px;height:410px;' src='" + firstprefix + "stop_start_youtube.html?vid=" + ourvid + firstsuffix + onestodoprefix + encodeURIComponent(onestodosuffix) + "'></iframe>");
firstprefix="";
if (document.getElementById(emojisuffix + 'karaokeemail')) document.getElementById(emojisuffix + 'karaokeemail').value=document.getElementById('to').value;
document.getElementById('performance').style.display='block';
//if (onestodo.length > 1) {
// top.document.title+=" ; " + onestodosuffix;
// alert(eval(1000 * onestododur[thisonetodo]) + " ; " + onestodosuffix);
//}
setTimeout(showd, 200);
setTimeout(nextv, eval(1000 * onestododur[thisonetodo]));
thisonetodo++;
}
}

function postputy(sin) {
var retval='', oneto=true;
var aot,jaot=0,aotfactor=1.0,iaot,aotdur=0.0,faot=[60.0,60.0,24.0];
for (var i=0; i<sin.options.length; i++) {
if (sin.options[i].selected) {
if (sin.options[i].value != '') {
//alert(sin.options[i].value);
if (oneto) {
oneto=false;
onestodo=[];
onestododur=[];
}
aotdur=0.0;
aotfactor=1.0;
jaot=0;
aot=sin.options[i].text.split('(')[eval(-1 + sin.options[i].text.replace(')','').split('(').length)].replace(')','').split(':');
for (iaot=eval(-1 + aot.length); iaot>=0; iaot--) {
aotdur+=eval(aotfactor * aot[iaot]);
jaot++;
aotfactor *= faot[jaot];
}
thisonetodo=0;
if (onestodo.length <= 1) {
if (onestodo.length == 1) {
onestodoprefix='&andthen=';
onestodosuffix=onestododur[0] + ";" + sin.options[i].value + "," + aotdur;
}
} else {
onestodosuffix+=";" + sin.options[i].value + "," + aotdur;
}
onestodo.push(sin.options[i].value);
onestododur.push(aotdur);
//alert('Expected duration for ' + sin.options[i].value + ' (' + eval(i + 1) + ') is ' + aotdur + ' seconds');
}
}
}
if (onestodo.length > 0) {
if (onestodo.length > 1) {
if (prevonestodosuffix == "") {
document.getElementById('myformdiv').innerHTML="<input type=hidden name=andthen value='" + onestodosuffix + "'></input>";
}
//top.document.title+=" ; " + onestodosuffix;
}
nextv();
}
return retval;
}

function givethemfifteen() {
givefifteen-=givefactor;
if (givefifteen <= 0) {
postputy(document.getElementById('ajaxs'));
} else {
setTimeout(givethemfifteen,1000);
}
}

function puty(yt) {
var aot=yt.options[yt.selectedIndex].text.split('(')[eval(-1 + yt.options[yt.selectedIndex].text.replace(')','').split('(').length)].replace(')','').split(':'),jaot=0,aotfactor=1.0,iaot,aotdur=0.0,faot=[60.0,60.0,24.0];
if (morethanone) {
for (iaot=eval(-1 + aot.length); iaot>=0; iaot--) {
aotdur+=eval(aotfactor * aot[iaot]);
jaot++;
aotfactor *= faot[jaot];
}
//alert('Expected duration ' + aotdur + ' seconds');
if (givefifteen < 0) {
givefifteen=15;
givethemfifteen();
}
} else {
ourvid=yt.value;
document.getElementById('ajax').innerHTML='';
document.getElementById('youtubeid').value=ourvid;
document.getElementById('performance').innerHTML=ouriframe("<iframe id='myiframe' style='z-index:-4;width:720px;height:410px;' src='" + firstprefix + "stop_start_youtube.html?vid=" + ourvid + firstsuffix + onestodoprefix + encodeURIComponent(onestodosuffix) + "'></iframe>");
firstprefix="";
if (document.getElementById(emojisuffix + 'karaokeemail')) document.getElementById(emojisuffix + 'karaokeemail').value=document.getElementById('to').value;
document.getElementById('performance').style.display='block';
setTimeout(showd, 200);
}
}

function getytlist(whytid) {
var selname = "", qsel="";
if (whytid != '') {
selname = whytid;
} else {
selname = document.getElementById('youtubeid').value;
}
if (selname.indexOf('v=') == 0) {
//qsel=encodeURIComponent(selname);
qsel=selname;
//alert("//localhost:8888/legend_via_map.php?url=" + encodeURIComponent("//www.youtube.com/results?search_query=" + qsel));
} else {
sstr="";
qsel='"' + selname + '"';
while (qsel.indexOf(' ') != -1) {
qsel=qsel.replace(" ","+");
}
}
//if (selname != "" && (selname.length > "URuOw1Pi58Y".length || selname.trim().indexOf(' ') != -1 || selname.indexOf('v=') == 0)) {
if (selname != "" && (selname.replace('v=','').split('&')[0].match(/^[a-zA-Z0-9_-]*$/) == false || (selname.replace('v=','').split('&')[0].length < "URuOw1Pi58Y".length || selname.replace('v=','').split('&')[0].length > 12) || selname.trim().indexOf(' ') != -1 || selname.indexOf('v=') == 0)) {
var dprefix="ht" + "tp://www.youtube.com/results?search_query=";
var dp="ht" + "tp://www.rjmprogramming.com.au/HTMLCSS/";
if (document.URL.indexOf('ht' + 'tps:') == 0) dp=dp.replace('tp:','tps:');
if (document.URL.indexOf('ht' + 'tps:') == 0) dprefix=dprefix.replace('tp:','tps:');
//dp="//localhost:8888/";
$.ajax({ url: dp + "legend_via_map.php",
data: {"url":dprefix + qsel},
type: 'get',
success: function(output) {
var selc='', fosecs=0.0, afosecs=[], ifo=0, fofactor=1.0;
var qqbits=output.split('v=');
var qqtbits=output.split('-describedby=');
var qdelim=' ', tqbits, ttqqbits='', attqqbits=[], durbits='', adurbits;
var q11=11;
var fgs='findings are ', sze='';
for (var ifgs=1; ifgs<qqtbits.length; ifgs++) {
fosecs=0.0;
fofactor=1.0;
tqbits=qqtbits[eval(-1 + ifgs)].split(' title="');
ttqqbits=qqtbits[eval(-1 + ifgs)].split('v=')[eval(-1 + qqtbits[eval(-1 + ifgs)].split('v=').length)].substring(0,q11);
if (selc == '') {
if (zeroplay == 0) {
document.getElementById("myh1").innerHTML=document.getElementById("myh1").innerHTML.replace('Karaoke via ',ourvid + ' Video Lookup via ');
if (ttqqbits.indexOf('<') != -1) {
sze=" size=" + eval(-1 + qqtbits.length) + " ";
} else {
sze=" size=" + qqtbits.length + " ";
}
document.getElementById("myform").innerHTML+="<input type=hidden name=justplay id=justplay value=y></input>";
}
if (ttqqbits.indexOf('<') == -1) selc=preselc + "<select" + sze + " id=ajaxs onchange=puty(this);><option value=>Optionally choose YouTube title below ...</option></select>";
}
durbits=' (' + qqtbits[eval(-1 + ifgs)].split(' class="video-time"')[eval(-1 + qqtbits[eval(-1 + ifgs)].split(' class="video-time"').length)].split('<')[0].split('>')[1] + ')';
//selc=selc.replace('</select>','<option value=' + qqbits[eval(2 * ifgs)].substring(0,q11) + '>' + tqbits[eval(-1 + tqbits.length)].split('"')[0] + '</option></select>');
selc=selc.replace('</select>','<option value=' + ttqqbits + '>' + tqbits[eval(-1 + tqbits.length)].split('"')[0] + durbits + '</option></select>');
qdelim=',';
q11=11;
if (sstr != "") {
adurbits=durbits.substring(2).replace(')','').split(':');
for (ifo=eval(-1 + adurbits.length); ifo>=0; ifo--) {
fosecs+=eval(adurbits[ifo] * fofactor);
fofactor*=60.0;
}
attqqbits.push(ttqqbits);
afosecs.push(fosecs);
////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=
//sstr='';
//location.href='//www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?youtubeid=' + ttqqbits + '&youtube_duration=' + fosecs + '&c0=on&i0=0&j0=' + fosecs;
}
if (sstr != '') {
var thisois=Math.floor(Math.random() * eval(0 + afosecs.length)) + 0;
//if (onestodo.length > 1) alert('Here');
location.href='//www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?youtubeid=' + attqqbits[thisois] + '&youtube_duration=' + afosecs[thisois] + '&c0=on&i0=0&j0=' + afosecs[thisois];
sstr='';
selc='';
}
}
document.getElementById('ajax').innerHTML=selc;
}
});
} else {
document.getElementById('ajax').innerHTML='';
}
}


function findduration(vidiso,vtxt) {
if (vtxt != '') {
// if (vtxt.length > "URuOw1Pi58Y".length || vtxt.trim().indexOf(' ') != -1) {
// Don't count on 11 for ever ... so add in 12 below ... https://webapps.stackexchange.com/questions/13854/are-youtube-codes-guaranteed-to-always-be-11-characters
// Count out characters instead ... help from https://stackoverflow.com/questions/3028642/regular-expression-for-letters-numbers-and ... 2*26 letters (lowercase and uppercase) + 10 for the digits, + 2 for "_" and "-" chars
//alert(vtxt.match(/^[a-zA-Z0-9_-]*$/));
if (vtxt.match(/^[a-zA-Z0-9_-]*$/) == false || (vtxt.length < "URuOw1Pi58Y".length || vtxt.length > 12) || vtxt.trim().indexOf(' ') != -1) {
getytlist(vtxt);
} else {
ourvid=vtxt;
//alert("onestodosuffix=" + onestodosuffix + ' top.document.title=' + top.document.title);
document.getElementById('performance').innerHTML=ouriframe("<iframe id='myiframe' style='z-index:-4;width:720px;height:410px;' src='" + firstprefix + "stop_start_youtube.html?vid=" + ourvid + firstsuffix + onestodoprefix + encodeURIComponent(onestodosuffix) + "'></iframe>");
firstprefix="";
if (document.getElementById(emojisuffix + 'karaokeemail')) document.getElementById(emojisuffix + 'karaokeemail').value=document.getElementById('to').value;
document.getElementById('performance').style.display='block';
setTimeout(showd, 200);
}
} else if (vidiso.value.indexOf('v=') != -1) {
ourvid=vidiso.value.split('v=')[1].split('&')[0].split('#')[0];
vidiso.value=ourvid;
//alert("onesTodosuffix=" + onestodosuffix);
document.getElementById('performance').innerHTML=ouriframe("<iframe id='myiframe' style='z-index:-4;width:720px;height:410px;' src='" + firstprefix + "stop_start_youtube.html?vid=" + ourvid + firstsuffix + onestodoprefix + encodeURIComponent(onestodosuffix) + "'></iframe>");
firstprefix="";
if (document.getElementById(emojisuffix + 'karaokeemail')) document.getElementById(emojisuffix + 'karaokeemail').value=document.getElementById('to').value;
document.getElementById('performance').style.display='block';
setTimeout(showd, 200);
} else if (vidiso.value.match(/^[a-zA-Z0-9_-]*$/) == false || (vidiso.value.length < "URuOw1Pi58Y".length || vidiso.value.length > 12) || vidiso.value.trim().indexOf(' ') != -1) {
//} else if (vidiso.value.length > "URuOw1Pi58Y".length || vidiso.value.trim().indexOf(' ') != -1) {
// Don't count on 11 for ever ... so add in 12 below ... https://webapps.stackexchange.com/questions/13854/are-youtube-codes-guaranteed-to-always-be-11-characters
// Count out characters instead ... help from https://stackoverflow.com/questions/3028642/regular-expression-for-letters-numbers-and ... 2*26 letters (lowercase and uppercase) + 10 for the digits, + 2 for "_" and "-" chars
if (donef && document.getElementById('youtube_duration').value != '' && ourvid != vidiso.value) {
//if (onestodo.length > 1) alert('HerE');
location.href=document.URL.split('?')[0].split('#')[0] + '?youtubeid=' + encodeURIComponent(vidiso.value);
} else {
getytlist(vidiso.value);
}
} else {
ourvid=vidiso.value;
//alert("onestodosufFix=" + onestodosuffix);
document.getElementById('performance').innerHTML=ouriframe("<iframe id='myiframe' style='z-index:-4;width:720px;height:410px;' src='" + firstprefix + "stop_start_youtube.html?vid=" + ourvid + firstsuffix + onestodoprefix + encodeURIComponent(onestodosuffix) + "'></iframe>");
firstprefix="";
if (document.getElementById(emojisuffix + 'karaokeemail')) document.getElementById(emojisuffix + 'karaokeemail').value=document.getElementById('to').value;
document.getElementById('performance').style.display='block';
setTimeout(showd, 200);
}
donef=true;
}

function queuenext() {
var which=next, thisd=0.0, more=false, thisstart=0.0, audios, somethingtodo=false;
//if (onestodo.length > 1) {
// top.document.title+=" ; " + onestodosuffix;
// alert(onestodo[1] + " ; " + onestodosuffix);
//}
if (document.getElementById('j0').value.indexOf('.') == -1) {
document.getElementById('j0').value+='';
} else {
var xxqw=document.getElementById('j0').value.split('.');
if (xxqw[1].length > 3) {
document.getElementById('j0').value=xxqw[0] + '.' + xxqw[1].substring(0,3);
}
}
if (audiof != '' && document.getElementById('audiofiles').innerHTML != '') {
document.getElementById('audiofiles').innerHTML="";
audiof='';
ioffset=-1;
} else if (audioask) {
audioask=false;
try {
if (audiow !=- null) {
audiow.close();
}
} catch (ee) { }
audiow=null;
if (audiof == '') {
var outaf=null;
if (dorecord) outaf=prompt('Please enter URL to access local audio you just captured. There is very little chance you will not need to change the default value. If it starts with file: you will have to double click these when prompted, else .wav ones are automated, and you can use local web servers like Mac OS X Apache/PHP MAMP (https://www.mamp.info) for a filename like //localhost:8888/myRecording00.wav that would work if you have copied the audio from the Downloads folder to /Applications/MAMP/htdocs/ for instance. Windows has Apache/PHP EasyPHP (//www.easyphp.org/) local web server.', 'file:///home/Downloads/myRecording00.wav');
if (outaf) {
if (outaf != '') {
morechanges=false;
document.getElementById('i' + audioi).value+=';' + outaf;
document.getElementById('trbutton').style.visibility='visible';
document.getElementById('dkaraoke').style.visibility='visible';
document.getElementById('dkaraokem').style.visibility='visible';
document.getElementById('dkaraoker').style.visibility='visible';
document.getElementById('trrhead').style.display='none';
document.getElementById('karaoke').style.visibility='visible';
if (document.getElementById('d' + emojisuffix + 'karaoke')) {
document.getElementById('d' + emojisuffix + 'karaoke').style.visibility='visible';
document.getElementById('d' + emojisuffix + 'karaokem').style.visibility='visible';
document.getElementById('d' + emojisuffix + 'karaoker').style.visibility='visible';
document.getElementById(emojisuffix + 'karaoke').style.visibility='visible'; // huh
// alert(emojisuffix + 'karaoke');
emojistuff();
}
}
}
}
audiof='';
}
if (huhaudiow) document.title+=" here again with next=" + next + " and ioffset=" + ioffset + " ";
//alert('snippet=' + snippet + '*and* snippet=' + snippet + '*');
document.getElementById('areyousinging').innerHTML='';
if (eval(snippet) >= 0) {
if (document.URL.indexOf('i0=') == -1) {
if (mbmode == false) {
document.getElementById('trbutton').style.visibility='visible';
document.getElementById('dkaraoke').style.visibility='hidden';
document.getElementById('dkaraokem').style.visibility='hidden';
document.getElementById('dkaraoker').style.visibility='hidden';
document.getElementById('trrhead').style.display='none';
document.getElementById('ddkaraoke').style.visibility='visible';
if (document.getElementById('dd' + emojisuffix + 'karaoke')) {
document.getElementById('d' + emojisuffix + 'karaoke').style.visibility='hidden';
document.getElementById('d' + emojisuffix + 'karaokem').style.visibility='hidden';
document.getElementById('d' + emojisuffix + 'karaoker').style.visibility='hidden';
document.getElementById('d' + emojisuffix + 'dkaraoke').style.visibility='visible';
document.getElementById(emojisuffix + 'dkaraoke').style.visibility='hidden'; // huh
emojistuff();
}
} else {
document.getElementById('trbutton').style.visibility='visible';
document.getElementById('ddkaraoke').style.visibility='hidden';
document.getElementById('dkaraoke').style.visibility='visible';
document.getElementById('dkaraokem').style.visibility='visible';
document.getElementById('dkaraoker').style.visibility='visible';
document.getElementById('trrhead').style.display='none';
if (document.getElementById('dd' + emojisuffix + 'karaoke')) {
document.getElementById('dd' + emojisuffix + 'karaoke').style.visibility='hidden';
document.getElementById('d' + emojisuffix + 'karaoke').style.visibility='visible';
document.getElementById('d' + emojisuffix + 'karaokem').style.visibility='visible';
document.getElementById('d' + emojisuffix + 'karaoker').style.visibility='visible';
document.getElementById(emojisuffix + 'karaoke').style.visibility='visible'; // huh
emojistuff();
}
}
} else if (morechanges) {
document.getElementById('trbutton').style.visibility='visible';
document.getElementById('dkaraoke').style.visibility='hidden';
document.getElementById('dkaraokem').style.visibility='hidden';
document.getElementById('dkaraoker').style.visibility='hidden';
document.getElementById('trrhead').style.display='none';
document.getElementById('ddkaraoke').style.visibility='visible';
if (document.getElementById('dd' + emojisuffix + 'karaoke')) {
document.getElementById('d' + emojisuffix + 'karaoke').style.visibility='hidden';
document.getElementById('d' + emojisuffix + 'karaokem').style.visibility='hidden';
document.getElementById('d' + emojisuffix + 'karaoker').style.visibility='hidden';
document.getElementById('dd' + emojisuffix + 'karaoke').style.visibility='visible';
document.getElementById(emojisuffix + 'karaoke').style.visibility='hidden'; //
emojistuff();
}
}
for (var i=0; i<=snippet; i++) {
if (document.getElementById('c' + i).checked) {
if (i == eval(ioffset + which)) {
somethingtodo=true;
if (huhaudiow) document.title+=" chose i=" + i + " ";
next=i;
audioi=i;
audios=document.getElementById('i' + i).value.split(';');
if (audios.length > 1 && eval(ioffset) == 0) {
if (audiof == "") {
document.getElementById('url').value=audios[1];
}
audiof=audios[1];
dorecord=false;
} else if (audios.length > 1) {
if (dorecord) closeaudio();
audiof='';
} else if (audiow) {
if (dorecord) closeaudio();
}
if (huhaudiow) document.title+=" and audiof=" + audiof + " ";
thisstart=eval(audios[0]);
if (huhaudiow) document.title+=" well now thisstart=" + thisstart + " and lastfinish=" + lastfinish + " and thisd=" + thisd;
if (eval(lastfinish) >= 0.0) {
//if (Math.round(eval(lastfinish)) < Math.round(eval(thisstart))) {
if ((eval(0.3 + lastfinish)) < (eval(thisstart))) {
if (huhaudiow) document.title+=" gap detected ";
if (document.getElementById('conduit').value.indexOf('-') != -1 || eval(1.0 + eval(document.getElementById('conduit').value)) > eval(lastfinish)) {
//alert(thisstart + ' ... ' + lastfinish);
more=true;
if (audiof != '') {
if (audiof.indexOf('file') == 0) {
document.getElementById('areyousinging').innerHTML='<h1>Are you hearing your singing, by double clicking it in Finder or Windows Explorer etcetera, recorded in ' + audiof + ' along with ' + document.getElementById('myh1').innerHTML + ' yet?</h1>';
} else {
document.getElementById('areyousinging').innerHTML='<h1>Are you hearing your singing recorded in ' + audiof + ' along with ' + document.getElementById('myh1').innerHTML + ' yet?</h1>';
}
//closeaudio();
//alert(audiof);
if (1 == 10) {
if (document.getElementById('audiofiles').innerHTML == '') {
document.getElementById('audiofiles').innerHTML="<iframe id=audioif src='//www.rjmprogramming.com.au/HTMLCSS/legend_via_map.php?url=" + encodeURIComponent(audiof) + "' title='Audio'></iframe>";
} else {
document.getElementById('audioif').src="//www.rjmprogramming.com.au/HTMLCSS/legend_via_map.php?url=" + encodeURIComponent(audiof);
}
//audiow=new Audio();
//audiow.src=audiof;
//audiow.autoplay=true;
//audiow.play();
} else {
if (audiof.indexOf('file') != 0) {
if (audiof.indexOf('.wav') != -1) {
audiow=window.open(audiof, '_blank', 'top=60,left=0,width=240,height=80');
} else {
audiow=window.open(audiof, '_blank', 'top=100,left=0,width=420,height=590');
}
}
if (document.URL.indexOf('debug=') != -1) huhaudiow=true;
if (dorecord) setTimeout(closeaudio, Math.min(25000, eval(1000 * eval(eval(thisstart) + 5 - eval(lastfinish)))));
}
if (huhaudiow) document.title+=" h:setTimeout(queuenext, eval(1000 * eval(eval(thisstart) - eval(lastfinish)))); via thisstart=" + thisstart + " and lastfinish=" + lastfinish;
setTimeout(queuenext, eval(1000 * eval(eval(thisstart) - eval(lastfinish))));
next++;
} else if (dorecord) {
document.getElementById('areyousinging').innerHTML='<h1>Are you recording your singing along with ' + document.getElementById('myh1').innerHTML + ' yet?</h1>';
audioask=true;
closeaudio();
audiow=window.open('https://webaudiodemos.appspot.com/AudioRecorder/index.html', '_blank', 'top=300,left=0,width=900,height=300');
if (document.URL.indexOf('debug=') != -1) huhaudiow=true;
document.title+=" a:setTimeout(queuenext, eval(1000 * eval(eval(thisstart) - eval(lastfinish)))); b:setTimeout(closeaudio, Math.min(25000, eval(1000 * eval(eval(thisstart) + 5 - eval(lastfinish))))); ";
setTimeout(queuenext, eval(1000 * eval(eval(thisstart) - eval(lastfinish))));
setTimeout(closeaudio, Math.min(25000, eval(1000 * eval(eval(thisstart) + 5 - eval(lastfinish)))));
} else {
document.getElementById('areyousinging').innerHTML='<h1>Are you singing along with ' + document.getElementById('myh1').innerHTML + ' yet?</h1>';
if (huhaudiow) document.title+=" c:setTimeout(queuenext, eval(1000 * eval(eval(thisstart) - eval(lastfinish)))); ";
setTimeout(queuenext, eval(1000 * eval(eval(thisstart) - eval(lastfinish))));
}
lastfinish=thisstart;
if (audiof != '') ioffset=-1;
if (audiof == '') ioffset=0;
return;
} else {
if (huhaudiow) document.title+=" j:setTimeout(queuenext, 1000); ";
setTimeout(queuenext, 1000);
return;
}
}
}
lastfinish=eval(document.getElementById('j' + i).value);
if (huhaudiow) document.title+=" and now thisstart=" + thisstart + " and lastfinish=" + lastfinish + " and thisd=" + thisd;
thisd = eval(eval(document.getElementById('j' + i).value) - eval(document.getElementById('i' + i).value.split(';')[0]));
//alert(thisd);
if (huhaudiow) document.title+=" now thisstart=" + thisstart + " and lastfinish=" + lastfinish + " and thisd=" + thisd;
document.getElementById('xx' + i).style.backgroundColor='lightgreen';
//alert('xx' + i);
var ndt=new Date();
//if (onestodo.length > 1) alert('HEREsz');
//alert("onestodosuffiX=" + onestodosuffix);
document.getElementById('myiframe').src="stop_start_youtube.html?vid=" + ourvid + "&playtime=" + thisd + "&start=" + document.getElementById('i' + i).value.split(';')[0] + '&ct=' + encodeURIComponent(ndt.toUTCString()) + onestodoprefix + encodeURIComponent(onestodosuffix);
if (huhaudiow) document.title+=" " + document.getElementById('myiframe').src + " ";
//alert(" " + document.getElementById('myiframe').src + " ");
next++;
more=true;
if (3 == 3) {
document.getElementById('conduit').value='0';
nextdelay=eval(1000 * thisd);
xqn();
} else {
if (huhaudiow) document.title+=" f:setTimeout(queuenext, eval(1000 * thisd)); ";
setTimeout(queuenext, eval(1000 * thisd));
}
}
}
}
}
if (audiof != '') ioffset=-1;
if (audiof == '') ioffset=0;
if (!more) next=0;
if (!somethingtodo && audiow != null) closeaudio();
}

function ouriframe(ift) {
if (!doemj) {
return ift;
}
emojistuff();
//return '<table style="text-align:center;width:100%;"><tbody style="text-align:center;width:100%"><tr><td>' + ift + '</td><td style="vertical-align:top;">' + document.getElementById('dkaraoke').outerHTML.replace(' style="',' style="margin-top:-600px;').replace('background-color:','margin-top:-600px;background-color:').replace(' value=',' value=\"🎮 Play as below\" title=').replace('<input ','<input class=emoji ').replace(/karaoke/g, emojisuffix + "karaoke") + '<br>' + document.getElementById('dkaraokem').outerHTML.replace(' style="',' style="margin-top:-600px;').replace('background-color:','margin-top:-600px;background-color:').replace(' value=', ' value=\"📼 ⏸ > 0 cell\" title=').replace('<input ','<input class=emoji ').replace(/karaoke/g, emojisuffix + "karaoke") + '<br>' + '<br>' + document.getElementById('dkaraoker').outerHTML.replace(' style="',' style="margin-top:-600px;').replace('background-color:','margin-top:-600px;background-color:').replace(' value=', ' value=\"📼 ⏸ < \" title=').replace('<input ','<input class=emoji ').replace(/karaoke/g, emojisuffix + "karaoke") + '<br>' + document.getElementById('karaoke').outerHTML.replace(' style="',' style="margin-top:-600px;').replace(' value=',' value=\"🎮 Play as below\" title=').replace('<input ','<input class=emoji ').replace(/karaoke/g, emojisuffix + "karaoke") + '<br>' + document.getElementById('ddkaraoke').outerHTML.replace(/margin-top/g,'column-gap').replace(' style="',' style="margin-top:-600px;').replace(/<input /g,'<input class=emoji ').replace(' value=',' VALUE=\"🔂 Replay as above\" title=').replace(' value=',' VALUE=\"📧 Share Email to \" title=').replace(/karaoke/g, emojisuffix + "karaoke") + '</td></tr></tbody></table>';
return '<table style="text-align:center;width:100%;"><tbody style="text-align:center;width:100%"><tr><td>' + ift + '</td><td style="vertical-align:top;">' + '' + document.getElementById('ddkaraoke').outerHTML.replace(/margin-top/g,'column-gap').replace(/<input /g,'<input class=emoji ').replace(' value=',' VALUE=\"🔂 Replay as above\" title=').replace(' value=',' VALUE=\"📧 Share Email to \" title=').replace(/karaoke/g, emojisuffix + "karaoke") + document.getElementById('dkaraoke').outerHTML.replace(' value=',' value=\"🎮 Play as below\" title=').replace('<input ','<input class=emoji ').replace(/karaoke/g, emojisuffix + "karaoke") + '<br>' + document.getElementById('dkaraokem').outerHTML.replace(' value=', ' value=\"📼 ⏸ > 0 cell\" title=').replace('<input ','<input class=emoji ').replace(/karaoke/g, emojisuffix + "karaoke") + '' + document.getElementById('dkaraoker').outerHTML.replace(' value=', ' value=\"📼 ⏸ < \" title=').replace('<input ','<input class=emoji ').replace(/karaoke/g, emojisuffix + "karaoke") + '<br>' + document.getElementById('karaoke').outerHTML.replace(' value=',' value=\"🎮 Play as below\" title=').replace('<input ','<input class=emoji ').replace(/karaoke/g, emojisuffix + "karaoke") + '</td></tr></tbody></table>';
}

function emojistuff() {
document.getElementById('pretrbutton').style.display='none';
document.getElementById('trbutton').style.visibility='hidden';
document.getElementById('trrhead').style.display='table-row';
document.getElementById('ddkaraoke').style.visibility='hidden';
document.getElementById('dkaraoke').style.visibility='hidden';
document.getElementById('dkaraokem').style.visibility='hidden';
document.getElementById('dkaraoker').style.visibility='hidden';
document.getElementById('karaoke').style.visibility='hidden';
}

function xqn() {
if (document.getElementById('conduit').value.indexOf('-') != -1 || eval(1.0 + eval(document.getElementById('conduit').value)) > eval(lastfinish)) {
nextdelay=-1;
queuenext();
} else if (eval(nextdelay) > 200) {
nextdelay-=500;
setTimeout(xqn, 200);
} else {
nextdelay=-1;
queuenext();
}
}

function showd() {
if (document.getElementById('youtube_duration').value == '') {
if ((location.search.split('youtube_duration=')[1] ? decodeURIComponent(location.search.split('youtube_duration=')[1].split('&')[0]) : '') != "") {
document.getElementById('youtube_duration').value=(location.search.split('youtube_duration=')[1] ? decodeURIComponent(location.search.split('youtube_duration=')[1].split('&')[0]) : '');
firstprefix=""; //"#";
}
}
if (document.getElementById('youtube_duration').value == '') {
setTimeout(showd, 200);
} else {
if (document.getElementById('youtube_duration').value.indexOf('.') == -1) {
document.getElementById('youtube_duration').value+='.0';
} else {
var xqw=document.getElementById('youtube_duration').value.split('.');
if (xqw[1].length > 3) {
document.getElementById('youtube_duration').value=xqw[0] + '.' + xqw[1].substring(0,3);
}
}
document.getElementById('myspan').style.visibility='visible';
addrow();
if (document.URL.indexOf('i0=') == -1) {
document.getElementById('mousei').style.visibility='visible';
document.getElementById('mousej').value=document.getElementById('mousej').value.replace(document.getElementById('youtube_duration').value + ' cell','') + eval('' + document.getElementById('youtube_duration').value).toFixed(2) + ' cell';
document.getElementById('mousej').style.visibility='visible';
}
}
}

function checkemailbits() {
document.getElementById('to').value=(location.search.split('email=')[1] ? decodeURIComponent(location.search.split('email=')[1].split('&')[0]) : '');
document.getElementById('karaokeemail').value=document.getElementById('to').value;
if (document.getElementById(emojisuffix + 'karaokeemail')) document.getElementById(emojisuffix + 'karaokeemail').value=document.getElementById('to').value;
}

function playrandom() {
var choices=['_','-'];
sstr='v=';
for (var lp=0; lp<=9; lp++) choices.push('' + lp);
for (var clp='a'.charCodeAt(0); clp<='z'.charCodeAt(0); clp++) choices.push(String.fromCharCode(eval('' + clp)));
for (var clp='A'.charCodeAt(0); clp<='Z'.charCodeAt(0); clp++) choices.push(String.fromCharCode(eval('' + clp)));
document.getElementById('myform').innerHTML+='<input type=hidden name=random id=random value=></input>';
// More to do
for (var iwq=0; iwq<3; iwq++) sstr+=choices[Math.floor(Math.random() * eval(0 + choices.length))];
getytlist(sstr);
}

</script>
</head>
<body style='background-color: lightblue;' onunload=" closeaudio(); " onload=" preselc='<br><div id=dajaxs style=display:inline;>>1x <input onchange=putmorethanone(this.checked); type=checkbox id=cajaxs></input></div>'; if (document.URL.indexOf('nokaraoke=') != -1 || (top.document.title.indexOf('Country ') == 0 && top.document.title.indexOf(' Quiz') != -1) || top.document.title.indexOf('The Other Side of the World') == 0 || top.document.title.indexOf('(at least on Google Chrome)') != -1 || top.document.title.indexOf('Nostalgia ') == 0 || (top.document.title.indexOf('Dams ') == 0 && top.document.title.indexOf(' United States') != -1) || (top.document.title.indexOf('Health ') == 0 && top.document.title.indexOf(' Meaning') != -1) || (top.document.title.indexOf('Australian ') == 0) || (top.document.title.indexOf('Indigenous ') == 0 && top.document.title.indexOf(' Australia') != -1) || top.document.URL.indexOf('rjmprogramming.com.au/wordpress') != -1 || top.document.URL.indexOf('rjmprogramming.com.au/ITblog') != -1) { document.getElementById('myh1').innerHTML=document.getElementById('myh1').innerHTML.replace('Karaoke via ',ourvid + ' Video Lookup via '); } zeroplay=ourvid.replace('%20',' ').indexOf(' '); if (document.URL.indexOf('?random=') != -1) { playrandom(); } else { checkemailbits(); document.getElementById('urlbig').value=document.URL; document.getElementById('emailform').action=document.getElementById('emailer').src; if (doemoji != 'on') { document.getElementById('emoji').checked=false; } if (ourrec != 'off') { document.getElementById('recown').checked=true; dorecord=true; } if (ourvid == '') { ourvid=(location.search.split('youtubeid=')[1] ? decodeURIComponent(location.search.split('youtubeid=')[1].split('&')[0]) : ''); } if (ourvid != '') { document.getElementById('youtubeid').value=ourvid; findduration(null,ourvid); } } ">
<script>
var h1bit="Karaoke via ";
zeroplay=ourvid.replace('%20',' ').indexOf(' ');
if (zeroplay == 0 || document.URL.indexOf('justplay=') != -1) h1bit="Research via ";
document.write("<h1 id='myh1' style='text-align:center; width: 100%;'>" + h1bit + "YouTube API - RJM Programming - September, 2016</h1><form id='myform' style='margin-top:-15px;' action='" + document.URL.split('?')[0].split('#')[0] + "' method='GET'><div style='text-align:center; width: 100%;'><span>YouTube URL or <a target=_blank title='Start again' href='" + document.URL.split('?')[0].split('#')[0] + "'>Video ID</a> or Search Words: <input onblur=\"findduration(this,'');\" name='youtubeid' id='youtubeid' type='text' value='' onkeyup='ycval(event);' oninput=yprecval(this); onclick='yofc(this);'></input> <div style='display:inline;' id='ajax'></div><div id='myspan' style='display:inline; visibility: hidden;'> Duration in seconds: <input onmouseover='toms(this);' type='text' name='youtube_duration' id='youtube_duration' value=''></input></div></span></div><input type=text onmouseover='toms(this);' style='margin-left:-9000px;' value=''></input>");
</script>
<script>
if (1 == 7 && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
document.write(cbut);
}
</script>
<div id='performance' style='text-align:center; width:100%;height:410px;display:none;overflow-y:hidden;'></div>
<div id='areyousinging' style='text-align:center; width: 100%; font-size:36px; font-color='red;'></div>
<script>
if (1 == 7 && !navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
document.write(cbut);
}
</script>
<!--br><div style='text-align:center; width: 100%;'><div id='ddkaraoke' style='display:inline; visibility: hidden; '></input><input onclick="if (document.URL.indexOf('i0=') != -1) { location.href=document.URL; } " id='repeat' type='button' style='background-color:red;' value='Replay Karaoke Style YouTube Above'></input></div><div id='dkaraoke' style='display:inline; visibility: hidden; '><input id='mousej' type='button' style='background-color:#f0f0f0; display:inline; visibility: hidden;' onclick=' mousebelowj(this);' value='Fill Table Below via Mouse Video Pauses Starting with '></input><input id='mousei' type='button' style='background-color:#f5f5f5; display:inline; visibility: hidden;' onclick=' mousebelowi(this);' value='Fill Table Starting with 0 cell'></input><input id='karaoke' onclick=" mbmode=false; document.getElementById('ddkaraoke').style.visibility='visible'; if (document.URL.indexOf('i0=') != -1) { next=0; } queuenext();" type='submit' style='background-color:orange;' value='Play Karaoke Style YouTube Via Entries Below'></input></div></div-->
<div style='text-align:center; width: 100%; display:block;' id='pretrbutton'>
<script>
document.write("<div id='trbutton' style='visibility:hidden;background-color:yellow; width:100%;' ><div style=' display:table-cell; left:3%; width: 33%; height: 60px;'>" + cbutl.replace('<br>','') + "</div><div id='thst' style=' display:table-cell; left:36%; width: 33%; height: 60px;'>" + cbutm.replace('<br>','') + "</div><div style=' display:table-cell; left:69%; width: 30%; height: 60px; text-align: right;'>" + cbutr.replace('<br>','') + "</div></div>");
</script>
</div>
<table border=10 style='text-align:center; width: 100%;'>
<thead style='text-align:center; width: 100%;'>
<script>
document.write("<tr id='trrhead' style='background-color:yellow;'><th>✔ (<a target=_blank title='Thanks to https://webaudiodemos.appspot.com/AudioRecorder ... if it works for your browser. If not, you can consider using a desktop microphone recorder app such as Mac OS X QuickTime Player as an alternative perhaps.' href='https://webaudiodemos.appspot.com/AudioRecorder/index.html'>Record</a> own parts? <input onchanged='dorecord=!dorecord;' type='checkbox' name='recown' id='recown'></input>) <input onchanged='doemj=!doemj;' type='checkbox' name='emoji' id='emoji' style='visibility:hidden;' " + ech + "></input></th><th>Start time in seconds <span id=nm style='display:none;'>(negative means you will be singing or Prefix by Audio file URL or YouTube ID delimited by :)</span></th><th id='thft'>Finish</th>");
</script>
</thead>
<tbody id='mytbody' style='text-align:center; width: 100%;'>
</tbody>
</table>
<input id='conduit' type='hidden' value='-1'></input><input id='updatethisplease' type='hidden' value=''></input>
<div id='audiofiles' style='position:absolute;z-index:7;top:0;left:0;'></div>
<script>
if (onestodoprefix != "") {
document.write("<input type=hidden name=andthen value='" + onestodosuffix + "'></input>");
}
</script>
<div id='myformdiv'></div>
</form>
<form target='emailer' id=emailform style=display:none; method='POST' action='//www.rjmprogramming.com.au/HTMLCSS/legend_via_map.php'>
<input type='hidden' name=to id=to value=></input>
<input type='hidden' name=cc id=cc value=></input>
<input type='hidden' name=bcc id=bcc value=></input>
<input type='hidden' name=url id=url value=></input>
<input type='hidden' name=urlbig id=urlbig value=></input>
<input type='hidden' name=subject id=subject value='Karaoke via YouTube API and RJM Programming'></input>
<input type='submit' style=display:none; value='Email' id='sendemail'></input>
</form>
<iframe name=emailer id=emailer style=display:none; src='//www.rjmprogramming.com.au/HTMLCSS/legend_via_map.php'></iframe>
</body>
</html>