<!doctype html>
<html>
<head>
<title>Monthly Chronicler - RJM Programming - June, 2018</title>
<style>
td { text-align: center; vertical-align: top; }
th { background-color: cyan; }
#thyear { background-color: pink; }
div { word-wrap: break-word; }
</style>
<script type='text/javascript'>
var months=["January","February","March","April","May","June","July","August","September","October","November","December"];
var daysinmonths=[31,28,31,30,31,30,31,31,30,31,30,31];
var daysofweek=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
var clearit=document.URL.indexOf('clear=');
var ourdate=new Date();
var hashto="";
var pdgh='Personal details go here ';
var pdghce=' contenteditable=true ';
var passwordrequired=false;
var passwordpassed=true;
var firstc=true;
var dyear=eval(ourdate.getFullYear());
var theyear=location.search.split('year=')[1] ? eval(location.search.split('year=')[1].split('&')[0]) : dyear;
var theopen=location.search.split('close=')[1] ? location.search.split('close=')[1].split('&')[0] : " open";
var thenextyear=eval(1 + theyear);
var yearo=new Date(theyear, 0, 1);
var compyearo=new Date(thenextyear, 0, 1);
//var yearlyo=new Date(theyear, 1, 28);
//var yearlyotwo=new Date(theyear, 2, 1);
var yearstartday=yearo.getDay();
var compyearstartday=compyearo.getDay();
var isLeapYear=false;
//alert(daysofweek[yearstartday]);

if (document.URL.indexOf('today=') != -1) {
hashto='#td' + dyear + ("0" + eval(1 + ourdate.getMonth())).slice(-2) + ("0" + eval(0 + ourdate.getDate())).slice(-2);
}

if (eval(compyearstartday - yearstartday) == 1 || eval(compyearstartday - yearstartday) == 6) {
//alert('Non Leap Year');
isLeapYear=false;
} else {
//alert('Leap Year');
isLeapYear=true;
daysinmonths[1]=29;
}
//alert(daysofweek[yearstartday]);


function populate() {
var vvd=vr_cookieVal('cpersonaldetails');
if (clearit != -1) {
vr_deleteCookie('cpersonaldetails');
}

document.getElementById('mctable').title+='' + theyear;
document.getElementById('thyear').innerHTML="<Year > <a onclick=\"location.href=(document.URL.split('#')[0] + '&aclear=').replace('.html&aclear=','.html?aclear=');\" style=\"text-decoration:none;cursor:pointer;\" title=\"Clear\">--</a> <" + theyear + "> <personal_details>";
var thedayindex=yearstartday;
var mstr="<table style='width:100%' border=1><tbody><tr><th colspan=7></th></tr><tr><td><" + daysofweek[0] + " ></td><td><" + daysofweek[1] + " ></td><td><" + daysofweek[2] + " ></td><td><" + daysofweek[3] + " ></td><td><" + daysofweek[4] + " ></td><td><" + daysofweek[5] + " ></td><td><" + daysofweek[6] + " ></td></tr></tbody></table>";
var moy=0, dmoy=0, tddaystr='' + theyear;
var tdprefix=tddaystr;
var seven=6;
var one=0;
var myearo;

for (moy=0; moy<5; moy++) {
mstr=mstr.replace('</tbody>', '<tr></tr></tbody>');
for (dmoy=one; dmoy<=seven; dmoy++) {
mstr=mstr.replace('</tr></tbody>', '<td title=' + dmoy + '></td></tr></tbody>');
}
seven+=7;
one+=7;
}
var tablestr=mstr;
for (moy=1; moy<=months.length; moy++) {
tddaystr=tdprefix + ("0" + eval(0 + moy)).slice(-2); // + ("0" + eval(0 + dmoy)).slice(-2);
mstr=tablestr;
//alert(tddaystr + ' ... ' + mstr);
if (moy > 1) {
myearo=new Date(theyear, eval(-1 + moy), 1);
thedayindex=myearo.getDay();
}
mstr=mstr.replace('><th colspan=7>', '><th colspan=7 id=th' + tddaystr + '><' + months[eval(-1 + moy)] + ' >');
for (dmoy=1; dmoy<=daysinmonths[eval(-1 + moy)]; dmoy++) {
tddaystr=tdprefix + ("0" + eval(0 + moy)).slice(-2) + ("0" + eval(0 + dmoy)).slice(-2);
//if (mstr.indexOf(' title=' + thedayindex + '>') == -1) alert(' title=' + thedayindex + '> ... ' + mstr);
mstr=mstr.replace(' title=' + thedayindex + '>', ' title=' + thedayindex + ' id=td' + tddaystr + '>' + alink(dmoy, tddaystr, daysofweek[eval(thedayindex % 7)]));
thedayindex++;
thedayindex=eval(thedayindex % 35);
}
document.getElementById('td' + months[eval(-1 + moy)].toLowerCase()).innerHTML=mstr;
}
clearit=-1;
if (parent.document !== document) {
clearit=clearit;
} else {
//var vvd=vr_cookieVal('cpersonaldetails');
if (vvd == '') vvd='Personal Details can Go Here';
if (document.URL.toLowerCase().replace('http://localhost','https://localhost').indexOf('http:') == 0) { // || (!passwordpassed && passwordrequired)) {
pdgh=pdgh.split(' (append ')[0];
//alert(13);
} else {
pdgh=pdgh.split(' (append ')[0] + ' (append with ?password=[yourPassword] to ask for a password to access from here on)';
//alert(14);
}
document.body.innerHTML=document.body.innerHTML.replace('<personal_details>','<div title="' + pdgh + '" onblur=makepd(this.innerHTML,""); id=pd ' + pdghce + '>' + vvd + '</div>').replace('&' + 'lt;' + theyear + '&' + 'gt;', selbit(theyear)).replace(/\<\;/g,'').replace(/\>\;/g,'');
if (document.getElementById('pd')) {
vvd=vvd;
}
}
if (hashto != '') {
location.href=hashto;
document.getElementById(hashto.substring(1)).style.backgroundColor='yellow';
document.getElementById(hashto.substring(1)).style.border='1px solid orange';
if (document.URL.indexOf('clicktoday=') != -1) {
setTimeout(andclick, 2000);
}
}
}

function andclick() {
document.getElementById('a' + hashto.substring(3)).click();
}

function selbit(tyear) {
var sbit='<select id=syear onchange="location.href=(document.URL.replace(/year/g,' + "'" + 'jhgraey' + "'" + ').split(' + "'" + '#' + "'" + ')[0] + ' + "'" + '&year=' + "'" + ' + this.value).replace(' + "'" + '.html&year=' + "'" + ',' + "'" + '.html?year=' + "'" + ');"></select>';
for (var iy=eval(-150 + eval('' + tyear)); iy<=eval(50 + eval('' + tyear)); iy++) {
if (iy == eval('' + tyear)) {
sbit=sbit.replace('</select>', '<option value=' + iy + ' selected>' + iy + '</option></select>');
} else {
sbit=sbit.replace('</select>', '<option value=' + iy + '>' + iy + '</option></select>');
}
}
return '' + sbit;
}

function makepd(nv, pw) {
if (passwordrequired && passwordpassed && pw == '' && nv.toLowerCase().replace('?password=','/password/').indexOf('/password/') == -1) {
var ppw=vr_cookieVal(' cpersonaldetails');
vr_setCookie('cpersonaldetails', nv + '/password/' + encodeURIComponent(encodeURIComponent(encodeURIComponent(theopen))));
theopen=' open';
} else if (pw != '') {
vr_setCookie('cpersonaldetails', nv + '/password/' + encodeURIComponent(encodeURIComponent(encodeURIComponent(pw))));
//document.title='0:' + nv.split('?password=')[0].split('/password/')[0];
document.getElementById('pd').innerHTML=nv.split('?password=')[0].split('/password/')[0];
} else if (nv.indexOf('?password=') != -1) {
vr_setCookie('cpersonaldetails', nv.split('?password=')[0] + '/password/' + encodeURIComponent(encodeURIComponent(encodeURIComponent(nv.split('?password=')[1]))));
//document.title='00:' + nv.split('?password=')[0].split('/password/')[0];
document.getElementById('pd').innerHTML=nv.split('?password=')[0].split('/password/')[0];
} else if (nv.indexOf('/password/') != -1) {
vr_setCookie('cpersonaldetails', nv.split('/password/')[0] + '/password/' + encodeURIComponent(encodeURIComponent(encodeURIComponent(nv.split('/password/')[1]))));
//document.title='000:' + nv.split('?password=')[0].split('/password/')[0];
document.getElementById('pd').innerHTML=nv.split('?password=')[0].split('/password/')[0];
} else if (!passwordpassed && passwordrequired) {
if (3 == 6) document.title='90000:' + nv.split('?password=')[0].split('/password/')[0];
} else {
vr_setCookie('cpersonaldetails', nv);
//document.title='0000:' + nv.split('?password=')[0].split('/password/')[0];
document.getElementById('pd').innerHTML=nv.split('?password=')[0].split('/password/')[0];
}
}

function makeit(nl, nv) {
vr_setCookie(nl, nv);
}

function ask(towhat, dwo) {
var retval=document.getElementById(towhat).innerHTML.split('</div></details>')[0].split('</details>')[0].split('</div>')[0];
if (retval.indexOf('</summary>') != -1) {
retval=retval.split('</summary>')[1];
if (retval.indexOf('">') != -1) {
retval=retval.replace(retval.split('">')[0] + '">','');
while (retval.indexOf(String.fromCharCode(10)) != -1) {
retval=retval.replace(String.fromCharCode(10), ' ');
}
while (retval.indexOf('<br>') != -1) {
retval=retval.replace('<br>', ' ');
}
while (retval.indexOf('<div>') != -1) {
retval=retval.replace('<div>', ' ');
}
while (retval.indexOf('</div>') != -1) {
retval=retval.replace('</div>', ' ');
}
while (retval.indexOf(' ') != -1) {
retval=retval.replace(' ', ' ');
}
}
} else if (retval.indexOf('<div') != -1 && retval.indexOf('">') != -1) {
retval=retval.replace(retval.split('">')[0] + '">','');
while (retval.indexOf(String.fromCharCode(10)) != -1) {
retval=retval.replace(String.fromCharCode(10), ' ');
}
while (retval.indexOf('<br>') != -1) {
retval=retval.replace('<br>', ' ');
}
while (retval.indexOf('<div>') != -1) {
retval=retval.replace('<div>', ' ');
}
while (retval.indexOf('</div>') != -1) {
retval=retval.replace('</div>', ' ');
}
while (retval.indexOf(' ') != -1) {
retval=retval.replace(' ', ' ');
}
}
var newretval;
if (document.URL.toLowerCase().replace('http://localhost','https://localhost').indexOf('http:') == 0 || (!passwordpassed && passwordrequired)) {
newretval=prompt('What do you want to chronicle for date ' + dwo + ', ' + towhat.substring(1).substring(6) + ' ' + months[eval(-1 + eval(towhat.substring(1).substring(4,6)))] + ' ' + towhat.substring(1).substring(0,4) + '? (NB: <br> is line feed)', retval);
} else {
newretval=prompt('What do you want to chronicle for date ' + dwo + ', ' + towhat.substring(1).substring(6) + ' ' + months[eval(-1 + eval(towhat.substring(1).substring(4,6)))] + ' ' + towhat.substring(1).substring(0,4) + '? (NB: <br> is line feed) (append with ?password=[yourPassword] to ask for a password to access from here on)', retval);
}
if (newretval == null) {
return retval;
}
if (newretval.indexOf('?password=') != -1) {
//document.getElementById('pd').innerHTML=newretval.split('?password=')[0];
makepd(document.getElementById('pd').innerHTML, newretval.split('?password=')[1]);
}
if (newretval.indexOf('/password/') != -1) {
//document.getElementById('pd').innerHTML=newretval.split('/password/')[0];
makepd(document.getElementById('pd').innerHTML, newretval.split('/password/')[1]);
}
if (newretval.split('?password=')[0].split('/password/')[0] != retval) {
vr_setCookie('c' + towhat.substring(1), newretval.split('?password=')[0].split('/password/')[0]);
}
document.getElementById(towhat).innerHTML='<div onblur="makeit(' + "'c" + towhat.substring(1) + "',this.innerHTML" + ');" contenteditable="true">' + newretval + '</div>';
return newretval;
}


function vr_setCookie(thisl, thisg) { // thanks to JavaScript and Ajax by Tom Negrino and Dori Smith
if (thisg != " ") {
if (!passwordpassed && passwordrequired) {
passwordrequired=passwordrequired;
} else {
var expireDate = new Date();
expireDate.setMonth(expireDate.getMonth()+6);
document.cookie = "" + thisl + "=" + encodeURIComponent(thisg) + "; expires=" + expireDate.toGMTString();
}
}
}

function vr_deleteCookie(thisl) { // thanks to JavaScript and Ajax by Tom Negrino and Dori Smith
if (!passwordpassed && passwordrequired) {
passwordrequired=passwordrequired;
} else {
var expireDate = new Date();
expireDate.setMonth(expireDate.getMonth()-6);
document.cookie = "" + thisl + "=; expires=" + expireDate.toGMTString();
}
}

function vr_cookieVal(thisl) {
if (document.cookie != '') {
var tCookie=document.cookie.split("; ");
for (var j=0; j<tCookie.length; j++) {
if (("" + thisl.trim()) == tCookie[j].split("=")[0]) {
if (decodeURIComponent(tCookie[j].split("=")[1]).indexOf('/password/') != -1) {
if (firstc && thisl == 'cpersonaldetails') {
firstc=false;
if (document.URL.toLowerCase().replace('http://localhost','https://localhost').indexOf('http:') == 0) { // || passwordrequired) {
firstc=false;
} else {
pdgh+=' (append with ?password=[yourPassword] to ask for a password to access from here on)';
}
passwordrequired=true;
theopen='';
passwordpassed=false;
if (document.URL.toLowerCase().replace('http://localhost','https://localhost').indexOf('http:') == 0) {
location.href='https:' + document.URL.substring(('http:').length);
}
var cp='';
var huh=decodeURIComponent(tCookie[j].split("=")[1]).split('/password/')[0];
if (decodeURIComponent(decodeURIComponent(tCookie[j].split("=")[1]).split('/password/')[1]) != '') {
huh=prompt("What are your personal details immediately followed by correct password. To get this wrong does not stop the web application, just the access to HTTP Cookies to store and restore your entries.", "");
if (huh == null) huh='';
}
if (huh.replace('Personal Details can Go Here','').indexOf(decodeURIComponent(tCookie[j].split("=")[1]).split('/password/')[0].replace('Personal Details can Go Here','')) == 0) {
cp=decodeURIComponent(decodeURIComponent(tCookie[j].split("=")[1]).split('/password/')[1]);
//alert(cp);
if (huh.replace('Personal Details can Go Here','') == (decodeURIComponent(tCookie[j].split("=")[1]).split('/password/')[0].replace('Personal Details can Go Here','') + cp)) {
//document.getElementById('pd').innerHTML=decodeURIComponent(tCookie[j].split("=")[1]).split('/password/')[0];
passwordpassed=true;
theopen=' open';
//alert('ok');
} else {
//alert(cp);
passwordrequired=true;
theopen='';
//document.body.innerHTML='Sorry ... No can do.';
}
} else {
//alert(decodeURIComponent(tCookie[j].split("=")[1]).split('/password/')[0] + ' bAd ' + cp);
passwordrequired=true;
theopen='';
//document.body.innerHTML='Sorry ... no can do.';
}
if (document.URL.toLowerCase().replace('http://localhost','https://localhost').indexOf('http:') == 0 || (!passwordpassed && passwordrequired)) {
pdgh=pdgh.split(' (append ')[0];
} else {
pdgh=pdgh.split(' (append ')[0] + ' (append with ?password=[yourPassword] to ask for a password to access from here on)';
}
} else {
if (firstc && thisl == 'cpersonaldetails') {
//document.title='1' + thisl;
//alert(1);
firstc=false;
if (thisl == 'cpersonaldetails') {
// alert(2);
//document.title='11';
if (document.URL.toLowerCase().replace('http://localhost','https://localhost').indexOf('http:') == 0) { // || (!passwordpassed && passwordrequired)) {
pdgh=pdgh.split(' (append ')[0];
//document.title='111';
//alert(3);
} else {
pdgh=pdgh.split(' (append ')[0] + ' (append with ?password=[yourPassword] to ask for a password to access from here on)';
//document.title='1111';
//alert(4);
}
}
}
if (thisl == ' cpersonaldetails') theopen=decodeURIComponent(decodeURIComponent(tCookie[j].split("=")[1]).split('/password/')[1]);
//alert('bad ' + cp);
//passwordrequired=true;
//theopen='';
}
}
if (!passwordpassed && passwordrequired) pdgh='Personal details go here ';
if (!passwordpassed && passwordrequired) pdghce=' ';
if (!passwordpassed && passwordrequired) clearit=false;
if (!passwordpassed && passwordrequired) return " ";
return decodeURIComponent(tCookie[j].split("=")[1]).split('/password/')[0];
}
}
}
if (firstc && thisl == 'cpersonaldetails') {
//document.title='0' + thisl;
//alert(11);
firstc=false;
if (thisl == 'cpersonaldetails') {
//document.title='00';
//alert(12);
if (document.URL.toLowerCase().replace('http://localhost','https://localhost').indexOf('http:') == 0) { // || (!passwordpassed && passwordrequired)) {
pdgh=pdgh.split(' (append ')[0];
//document.title='000';
//alert(13);
} else {
pdgh=pdgh.split(' (append ')[0] + ' (append with ?password=[yourPassword] to ask for a password to access from here on)';
//document.title='0000';
//alert(14);
}
}
}
return '';
}

function getinfo(bb) {
if ((document.URL.split('#')[0] + '&').indexOf('close=&') != -1) theopen='';
var rv='', sparerv='';
rv=vr_cookieVal('c' + bb);
if (rv != '') {
//alert(rv);
sparerv=rv.replace(/\'/g,'`').replace(/\"/g,'`');
while (sparerv.indexOf(String.fromCharCode(10)) != -1) {
sparerv=sparerv.replace(String.fromCharCode(10), ' ');
}
while (sparerv.indexOf('<br>') != -1) {
sparerv=sparerv.replace('<br>', ' ');
}
while (sparerv.indexOf('<div>') != -1) {
sparerv=sparerv.replace('<div>', ' ');
}
while (sparerv.indexOf('</div>') != -1) {
sparerv=sparerv.replace('</div>', ' ');
}
while (sparerv.indexOf(' ') != -1) {
sparerv=sparerv.replace(' ', ' ');
}
return '<details title="' + sparerv.split('<')[0] + '" id=dt' + bb + theopen + '><summary title="' + sparerv.split('<')[0] + '" id=sy' + bb + '></summary><div onblur="makeit(' + "'c" + bb + "',this.innerHTML" + ');" contenteditable="true">' + rv + '</details>';
}
return rv;
}

function alink(aa, bb, dow) {
//alert('<a onclick="ask(' + "'" + 'd' + bb + "');" + '" style="text-decoration:none;cursor:pointer;" id="a' + bb + '">' + aa + '</a><br><div id=d' + bb + '></div>');
if (clearit != -1) {
vr_deleteCookie('c' + bb);
}
return '<a title="Click me to enter information for ' + bb + '" onclick="ask(' + "'" + 'd' + bb + "','" + dow + "');" + '" style="text-decoration:none;cursor:pointer;" id="a' + bb + '">' + aa + '</a><br><div id=d' + bb + '>' + getinfo(bb) + '</div>';
}

</script>
</head>
<body onload="populate();">
<table id=mctable title='Monthly Chronicler for Year ' cellpadding=5 cellspacing=5 style="width:100%;">
<tr><th id=thyear colspan=7><Year > <a onclick="location.href=(document.URL.split('#')[0] + '&aclear=').replace('.html&aclear=','.html?aclear=');" style="text-decoration:none;cursor:pointer;" title="Clear">--</a> <thisyear> <personal_details></th></tr>
<tr><td id=tdjanuary></td><td id=tdfebruary></td></tr>
<tr><td id=tdmarch></td><td id=tdapril></td></tr>
<tr><td id=tdmay></td><td id=tdjune></td></tr>
<tr><td id=tdjuly></td><td id=tdaugust></td></tr>
<tr><td id=tdseptember></td><td id=tdoctober></td></tr>
<tr><td id=tdnovember></td><td id=tddecember></td></tr>
</table>
</body>
</html>