<!doctype html>
<html>
<head>
<title>Mac OS X Quarter Hour Timer via This Supervising Crontab 0,15,30,45 * * * * /usr/sbin/screencapture -Cd -tjpg /Applications/MAMP/htdocs/screen-`date +"\%Y\%m\%d-\%H\%M"`.jpg</title>
<script type='text/javascript'>
var odiv=null;
var hprefix="http://localhost:8888/"; // is same as /Applications/MAMP/htdocs/ for local MAMP on Mac OS X
var nexttableo=null;
var nexttdo=null;
var lasthm=-1;
var wo=null;
var thatsit=false;
var fifteen="15";
var cnt=0;
var lastone='#mybod';
var nexttdoid='';
var elem=null;
var context=null;
var img=null;
var isasnapshottodo=0;
var winois=null;
var sfrom='';
var sto='';
var iimgo=null;
var isMac = navigator.platform.toUpperCase().indexOf('MAC')>=0; // thanks to http://stackoverflow.com/questions/10527983/best-way-to-detect-mac-os-x-or-windows-computers-with-javascript-or-jquery
function closewinois() {
if (winois != null) {
winois.close();
winois=null;
}
if (isasnapshottodo == 1) isasnapshottodo = 2;
}
function aemail(ame) { // thanks to http://www.telerik.com/forums/proper-way-to-do-mailto-and-tel-links(
window.top.location = ame.href;
}
function unoops(imgo) {
//var imgo=document.getElementById(iimgo);
//document.title=imgo.id.replace('i','').replace('_',' ').replace('_',' ');
if (document.getElementById('sfrom').innerHTML.indexOf(imgo.id.replace('i','')) == -1) {
var wasfrom=sfrom;
document.getElementById('sfrom').innerHTML+="<option value='" + imgo.id.replace('i','') + "'>From " + fancy(imgo.id.replace('i','').replace('td_','').replace('_',' ').replace('_',' ')) + "</option>";
document.getElementById('sfrom').value=wasfrom;
}
var xsto=document.getElementById('sto').innerHTML;
if (document.getElementById('sto').innerHTML.indexOf(imgo.id.replace('i','')) == -1) {
var wasto=sto;
document.getElementById('sto').innerHTML=document.getElementById('sto').innerHTML.replace("</option>", "</option><option value='" + imgo.id.replace('i','') + "'>To " + fancy(imgo.id.replace('i','').replace('td_','').replace('_',' ').replace('_',' ')) + "</option>");
document.getElementById('sto').value=wasto;
}
}
function oops(imgo) {
document.getElementById(imgo.id.replace('i','').replace('x','')).style.display='none';
}
function andthenmove() {
if (isasnapshottodo == 0) location.href=lastone;
lastone='#mybod';
if (isasnapshottodo == 2) {
document.getElementById('aemail').click();
isasnapshottodo=0;
document.getElementById('bemail').innerHTML='Email Times';
}
}
function fillinmywork() {
//alert(document.URL);
var ih, iqh;
//alert(870);
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
var hh = today.getHours();
var minm = today.getMinutes(); //January is 0!
var ss = 0; //today.getSeconds();
var thirtythousand=30000;
if (("" + ("00" + hh).slice(-2) + "" + ("00" + minm).slice(-2)) == "0000") {
thirtythousand=60000;
odiv=null;
cnt++;
}
if (odiv == null) {
if (cnt == 0) {
if (!isMac) {
document.getElementById('myh1').innerHTML=document.getElementById('myh1').innerHTML.replace('Mac OS X ','');
document.getElementById('myh1').innerHTML=document.getElementById('myh1').innerHTML.replace(' Crontab ',' Screen Capture Creator ');
document.getElementById('myh1').innerHTML=document.getElementById('myh1').innerHTML.replace('Ideally suited for MAMP, and left running', 'Ideally suited to being left running');
document.getElementById('myh3').style.display='none';
document.title=document.title.replace('Mac OS X ','');
document.title=document.title.replace(' Crontab ',' Screen Capture Creator ');
document.title=document.title.replace('Ideally suited for MAMP, and left running', 'Ideally suited to being left running');
}
elem = document.getElementById('canvaselement');
context = elem.getContext("2d");
//context.drawImage(img,0,0);
fifteen=(location.search + '&').split('fifteen=')[1] ? location.search.split('fifteen=')[1].split('&')[0] : fifteen;
//alert(document.URL);
hprefix=(location.search + '&').split('localplace=')[1] ? location.search.split('localplace=')[1].split('&')[0] : hprefix;
if (hprefix != "http://localhost:8888/") {
document.getElementById('myh3').innerHTML=document.getElementById('myh3').innerHTML.replace('/Applications/MAMP/htdocs/',hprefix);
} else if (document.URL.indexOf('file:/') == 0) {
hprefix=(document.URL + '/?').substring(7).replace('quarter_hour_timer.html','').replace('//?','/?').split('?')[0];
if (hprefix != "http://localhost:8888/" && hprefix != "/Applications/MAMP/htdocs/") {
//alert(hprefix);
document.getElementById('myh3').innerHTML=document.getElementById('myh3').innerHTML.replace('/Applications/MAMP/htdocs/',hprefix);
}
} //else {
//alert(document.URL);
//}
if (hprefix.indexOf(':') == -1) hprefix='file://' + hprefix;
if (hprefix.indexOf('localhost:8888') == -1) {
document.getElementById('myh1').innerHTML=document.getElementById('myh1').innerHTML.replace('Ideally suited for MAMP, and left running', 'Ideally suited to being left running');
}
}
odiv=document.getElementById('mywork' + cnt);
} //else if (nexttdo != null) {
//alert(87000 + " " + ("" + hh + "" + minm) + " " + odiv.innerHTML.indexOf('</td>') + "isnot-1? zero=" + eval(eval("" + minm), eval(fifteen)) + "? " + nexttdo.id);
//}
//alert(8700);
//alert(87000);
var itableo = "table_" + yyyy + "" + mm + "" + dd;
var thisdatebit = "Quarter Hour Activities for " + dd + "/" + mm + "/" + yyyy;
var thistimefilename = hprefix + "screen-" + yyyy + "" + ("00" + mm).slice(-2) + "" + ("00" + dd).slice(-2) + "-" + ("00" + hh).slice(-2) + "" + ("00" + minm).slice(-2) + ".jpg";
var thistimebit = "td_" + yyyy + "" + ("00" + mm).slice(-2) + "" + ("00" + dd).slice(-2) + "_" + ("00" + hh).slice(-2) + "" + ("00" + minm).slice(-2);
var vstimefilename; // = hprefix + "screen-" + yyyy + "" + mm + "" + dd + "-" + hh + "" + minm + ".jpg";
var vstimebit; // = hprefix + "screen-" + yyyy + "" + mm + "" + dd + "-" + hh + "" + minm + ".jpg";
//alert(870000 + " " + odiv.innerHTML + " " + ("" + hh + "" + minm));
if (odiv.innerHTML.indexOf('</td>') != -1 && eval(eval("" + minm) % eval(fifteen)) == 0 && nexttdo != null) {
//alert(870000 + " " + odiv.innerHTML + " " + ("" + hh + "" + minm));
//alert(nexttdo.id);
thatsit=false;
for (ih=0; ih<24; ih++) {
for (iqh=0; iqh<=eval(eval(fifteen) * 3); iqh+=eval(fifteen)) {
vstimefilename = hprefix + "screen-" + yyyy + "" + ("00" + mm).slice(-2) + "" + ("00" + dd).slice(-2) + "-" + ("00" + ih).slice(-2) + "" + ("00" + iqh).slice(-2) + ".jpg";
vstimebit = "td_" + yyyy + "" + ("00" + mm).slice(-2) + "" + ("00" + dd).slice(-2) + "_" + ("00" + ih).slice(-2) + "" + ("00" + iqh).slice(-2);
if (!thatsit) {
if (vstimebit < thistimebit) {
//alert(nexttdo.id + " ... " + vstimefilename + " < " + thistimefilename);
vstimefilename=vstimefilename;
} else if (nexttdo == null) {
//alert("nexttdo.id = null");
nexttdoid=vstimebit;
nexttdo=document.getElementById(vstimebit);
//alert(nexttdo.id + " = " + vstimefilename);
thatsit=true;
} else if (vstimebit == nexttdoid) {
//alert(nexttdo.id + " === " + vstimebit + " ... " + dd + "/" + mm + "/" + yyyy + " " + ("00" + ih).slice(-2) + ":" + ("00" + iqh).slice(-2) + "<br>" + "<img id='i" + vstimebit + "' onerror='oops(this);' onclick='if (wo != null) { wo.close(); wo=null; } wo=window.open(\"" + vstimefilename + "\",\"" + dd + "/" + mm + "/" + yyyy + " " + ("00" + ih).slice(-2) + ":" + ("00" + iqh).slice(-2) + "\",\"top=50,left=50,width=600,height=600\");' style='width:150px;' src='" + vstimefilename + "'></img><br><textarea style='background-color:#f0f0f0;' rows=5 cols=20></textarea>");
lastone='#' + vstimebit;
nexttdo=document.getElementById(vstimebit);
if (sfrom != '' && sto != '') {
if (vstimebit < sfrom || vstimebit < sto) {
sfrom=sfrom;
} else {
nexttdo.innerHTML="" + dd + "/" + mm + "/" + yyyy + "<a id=x" + vstimebit + " onclick=oops(this); style=text-decoration:none; title=Delete><strike>-</strike></a>" + ("00" + ih).slice(-2) + ":" + ("00" + iqh).slice(-2) + "<br>" + "<img id='i" + vstimebit + "' onerror='oops(this);' onload='unoops(this);' onclick='if (wo != null) { wo.close(); wo=null; } wo=window.open(\"" + vstimefilename + "\",\"" + dd + "/" + mm + "/" + yyyy + " " + ("00" + ih).slice(-2) + ":" + ("00" + iqh).slice(-2) + "\",\"top=50,left=50,width=600,height=600\");' style='width:150px;' src='" + vstimefilename + "'></img><br><textarea style='background-color:#f0f0f0;' rows=5 cols=20></textarea>";
}
} else if (sfrom != '') {
if (vstimebit < sfrom) {
sfrom=sfrom;
} else {
nexttdo.innerHTML="" + dd + "/" + mm + "/" + yyyy + "<a id=x" + vstimebit + " onclick=oops(this); style=text-decoration:none; title=Delete><strike>-</strike></a>" + ("00" + ih).slice(-2) + ":" + ("00" + iqh).slice(-2) + "<br>" + "<img id='i" + vstimebit + "' onerror='oops(this);' onload='unoops(this);' onclick='if (wo != null) { wo.close(); wo=null; } wo=window.open(\"" + vstimefilename + "\",\"" + dd + "/" + mm + "/" + yyyy + " " + ("00" + ih).slice(-2) + ":" + ("00" + iqh).slice(-2) + "\",\"top=50,left=50,width=600,height=600\");' style='width:150px;' src='" + vstimefilename + "'></img><br><textarea style='background-color:#f0f0f0;' rows=5 cols=20></textarea>";
}
} else if (sto != '') {
if (vstimebit > sto) {
sfrom=sfrom;
} else {
nexttdo.innerHTML="" + dd + "/" + mm + "/" + yyyy + "<a id=x" + vstimebit + " onclick=oops(this); style=text-decoration:none; title=Delete><strike>-</strike></a>" + ("00" + ih).slice(-2) + ":" + ("00" + iqh).slice(-2) + "<br>" + "<img id='i" + vstimebit + "' onerror='oops(this);' onload='unoops(this);' onclick='if (wo != null) { wo.close(); wo=null; } wo=window.open(\"" + vstimefilename + "\",\"" + dd + "/" + mm + "/" + yyyy + " " + ("00" + ih).slice(-2) + ":" + ("00" + iqh).slice(-2) + "\",\"top=50,left=50,width=600,height=600\");' style='width:150px;' src='" + vstimefilename + "'></img><br><textarea style='background-color:#f0f0f0;' rows=5 cols=20></textarea>";
}
} else {
nexttdo.innerHTML="" + dd + "/" + mm + "/" + yyyy + "<a id=x" + vstimebit + " onclick=oops(this); style=text-decoration:none; title=Delete><strike>-</strike></a>" + ("00" + ih).slice(-2) + ":" + ("00" + iqh).slice(-2) + "<br>" + "<img id='i" + vstimebit + "' onerror='oops(this);' onload='unoops(this);' onclick='if (wo != null) { wo.close(); wo=null; } wo=window.open(\"" + vstimefilename + "\",\"" + dd + "/" + mm + "/" + yyyy + " " + ("00" + ih).slice(-2) + ":" + ("00" + iqh).slice(-2) + "\",\"top=50,left=50,width=600,height=600\");' style='width:150px;' src='" + vstimefilename + "'></img><br><textarea style='background-color:#f0f0f0;' rows=5 cols=20></textarea>";
}
thirtythousand=60000;
if (isasnapshottodo == 1) {
document.getElementById('myimage').src=vstimefilename;
}
setTimeout(andthenmove, 15000);
//alert(nexttdo.id + " =+= " + vstimebit);
nexttdo=null;
}
}
}
}
} else if (odiv.innerHTML == "" || ("" + ("00" + hh).slice(-2) + "" + ("00" + minm).slice(-2)) == "0000") {
odiv.innerHTML += "<div id='mywork" + eval(cnt + 1) + "' style='text-align:center; width:100%;'></div><br><h2 style='text-align:center; width:100%;'>" + thisdatebit + "</h2><table id='" + itableo + "' style='background-color:pink;text-align:center; width:100%;'><tr><tbody><th colspan=8>" + thisdatebit + "</th></tr></tbody></table>";
nexttableo=document.getElementById(itableo);
nexttdo=null;
for (ih=0; ih<24; ih++) {
if (eval(ih % 2) == 0) nexttableo.innerHTML=nexttableo.innerHTML.replace("</tbody>", "<tr></tr></tbody>");
for (iqh=0; iqh<=45; iqh+=15) {
vstimefilename = hprefix + "screen-" + yyyy + "" + ("00" + mm).slice(-2) + "" + ("00" + dd).slice(-2) + "-" + ("00" + ih).slice(-2) + "" + ("00" + iqh).slice(-2) + ".jpg";
vstimebit = "td_" + yyyy + "" + ("00" + mm).slice(-2) + "" + ("00" + dd).slice(-2) + "_" + ("00" + ih).slice(-2) + "" + ("00" + iqh).slice(-2);
if (vstimebit < thistimebit) {
nexttableo.innerHTML=nexttableo.innerHTML.replace("</tr></tbody>", "<td id='" + vstimebit + "'>" + dd + "/" + mm + "/" + yyyy + "<a id=x" + vstimebit + " onclick=oops(this); style=text-decoration:none; title=Delete><strike>-</strike></a>" + ("00" + ih).slice(-2) + ":" + ("00" + iqh).slice(-2) + "<br>" + "<img id='i" + vstimebit + "' onerror='oops(this);' onload='unoops(this);' onclick='if (wo != null) { wo.close(); wo=null; } wo=window.open(\"" + vstimefilename + "\",\"" + dd + "/" + mm + "/" + yyyy + " " + ("00" + ih).slice(-2) + ":" + ("00" + iqh).slice(-2) + "\",\"top=50,left=50,width=600,height=600\");' style='width:150px;' src='" + vstimefilename + "'></img><br><textarea style='background-color:#f0f0f0;' rows=5 cols=20></textarea></td></tr></tbody>");
lastone='#' + vstimebit;
} else if (vstimebit == thistimebit) {
lastone='#' + vstimebit;
nexttableo.innerHTML=nexttableo.innerHTML.replace("</tr></tbody>", "<td id='" + vstimebit + "'>" + dd + "/" + mm + "/" + yyyy + "<a id=x" + vstimebit + " onclick=oops(this); style=text-decoration:none; title=Delete><strike>-</strike></a>" + ("00" + ih).slice(-2) + ":" + ("00" + iqh).slice(-2) + "<br>" + "<img id='i" + vstimebit + "' onerror='oops(this);' onload='unoops(this);' onclick='if (wo != null) { wo.close(); wo=null; } wo=window.open(\"" + vstimefilename + "\",\"" + dd + "/" + mm + "/" + yyyy + " " + ("00" + ih).slice(-2) + ":" + ("00" + iqh).slice(-2) + "\",\"top=50,left=50,width=600,height=600\");' style='width:150px;' src='" + vstimefilename + "'></img><br><textarea style='background-color:#f0f0f0;' rows=5 cols=20></textarea></td></tr></tbody>");
} else if (nexttdo == null) {
nexttableo.innerHTML=nexttableo.innerHTML.replace("</tr></tbody>", "<td id='" + vstimebit + "'></td></tr></tbody>");
nexttdoid=vstimebit;
nexttdo=document.getElementById(vstimebit);
//alert(nexttdo.id + ' has innerHTML=' + nexttdo.innerHTML);
} else {
nexttableo.innerHTML=nexttableo.innerHTML.replace("</tr></tbody>", "<td id='" + vstimebit + "'></td></tr></tbody>");
}
}
}
setTimeout(andthenmove, 15000);
} //else {
//document.title=nexttdoid;
//}
setTimeout(fillinmywork, thirtythousand);
}
function fancy(inc) {
return inc.substring(6,8) + "/" + inc.substring(4,6) + "/" + inc.substring(0,4) + "-" + inc.slice(-4).substring(0,2) + ":" + inc.slice(-2);
}
function ionload(ithis) {
img=ithis; //document.getElementById('myimage');
elem = document.getElementById('canvaselement');
context = elem.getContext("2d");
elem.style.display='block';
context.drawImage(img,0,0);
var canvuri = elem.toDataURL("image/png",0);
elem.style.display='none';
alert('When new window with screen capture opens after this ... Command-A or Ctrl-A (for Select All) and Command-C or Ctrl-C (for Copy) ... new window will close in 5 seconds');
winois=window.open('','_blank','top=3,left=3,width=1600,height=1200');
winois.document.write('<html><body><img src=' + canvuri + '></img></body></html>');
setTimeout(closewinois, 5000);
}
function showhowevermany() {
if (sfrom != '' || sto != '') {
var tds=document.getElementsByTagName('td');
for (var itds=0; itds<tds.length; itds++) {
if (sfrom != '' && sto != '') {
if (tds[itds].id != '') {
if (tds[itds].id < sfrom || tds[itds].id > sto) {
tds[itds].style.display='none';
}
}
} else if (sfrom != '') {
if (tds[itds].id != '') {
if (tds[itds].id < sfrom) {
tds[itds].style.display='none';
}
}
} else if (sto != '') {
if (tds[itds].id != '') {
if (tds[itds].id > sto) {
tds[itds].style.display='none';
}
}
}
}
}
}
</script>
</head>
<body id='mybod' onload=" fillinmywork(); " style='background-color:yellow;'>
<h1 id='myh1' style='text-align:center; width:100%;'>Mac OS X Quarter Hour Timer via This Supervising Crontab (Ideally suited for MAMP, and left running) - RJM Programming - June, 2016</h1>
<h3 id='myh3' style='text-align:center; width:100%;'>0,15,30,45 * * * * /usr/sbin/screencapture -Cd -tjpg /Applications/MAMP/htdocs/screen-`date +"\%Y\%m\%d-\%H\%M"`.jpg</h3>
<h4 style='text-align:center; width:100%;'>Optionally fill in your Name: <input style='width:20%;' type='text' id='yourname' value=''></input> <a id="bemail" onclick=" isasnapshottodo=true; alert('Please be back here at ' + fancy(nexttdoid.replace('td_','').replace('_',':')) + ' and have showing whatever you want to email and you will be directed on how to select copy and paste this screencapture into an email.'); this.innerHTML='Email Times back here at ' + fancy(nexttdoid.replace('td_','').replace('_',':')); " style=' text-decoration:underline; '>Email Times</a> <select id=sfrom onchange=" sfrom=this.value; document.getElementById('myshow').style.display='inline'; "><option value=''>From Earliest Below ...</option></select> <select id=sto onchange=" sto=this.value; document.getElementById('myshow').style.display='inline'; "><option value=''>To Latest Below ...</option></select> <input onclick=showhowevermany(); type=button id=myshow value=Show style=display:none;></input></h4>
<div id='mywork0' style='text-align:center; width:100%;'></div>
<form id='iemail' src='http://www.rjmprogramming.com.au/HTMLCSS/quarter_hour_timer.php' method='POST' style='display:none;'>
<input type='submit' id='mysubmitemail' value='Email' style='display:none;'></input>
</form>
<canvas id="canvaselement" width=1600 height=1200 style="position: absolute; top:0; left:0; display:none; "></canvas>
<a id='aemail' onclick=' if (navigator.userAgent.match(/Android/i)) { aemail(this); } ' href='mailto:fillin@email.to?subject=My%20Times%20as%20Image%20Below' title='Email' style='display:none;'></a>
<img id='myimage' onload='ionload(this);' src='' onerror=' lastone=lastone; ' style='display:none; z-index:4; ' crossOrigin="Anonymous"></img>
</body>
</html>