<html>
<head>
<title>Returning to where you started - RJM Programming - February, 2021</title>
<script type='text/javascript'>
var cgcols=['lime','maroon','lightblue','purple','navy','teal','fuchsia','olive','red','lightgreen','darkorange','pink','orange'];
var zcgcols=location.search.split('alist=')[1] ? eval("['" + decodeURIComponent(location.search.split('alist=')[1].split('&')[0]).replace(/\,/g,"','") + "']") : ['lime','maroon','lightblue','purple','navy','teal','fuchsia','olive','red','lightgreen','darkorange','pink','orange'];
var bordstr='border: 5px solid yellow;';
var bigs=[];
var lastb=''; //zcgcols[0].replace(/\ /g,'-');
var lasti=0;
var nogo=false;
var documentreferrer=('' + document.referrer);
function ourdecodeURIComponent(untriminstuff) {
var instuff=decodeURIComponent(untriminstuff).trim();
if (eval(2 + eval('' + instuff.length)) == eval('' + decodeURIComponent(untriminstuff).length)) { keeporder=true; } else { keeporder=false; }
instuff=encodeURIComponent(decodeURIComponent(untriminstuff).trim());
var arrback=[];
var dl=('' + decodeURIComponent(instuff)).replace(/\'/g,'').replace(/\"/g,'').length;
var instuffs=decodeURIComponent(instuff).replace(/\'/g,'').replace(/\"/g,'').split(',');
if (instuffs.length == 1 && eval(eval('' + dl) % 11) == 0) {
for (var iii=0; iii<eval('' + dl); iii+=11) {
arrback.push(('' + decodeURIComponent(instuff)).replace(/\'/g,'').replace(/\"/g,'').substring(iii).substring(0,11));
}
} else {
for (var ii=0; ii<instuffs.length; ii++) {
arrback.push(instuffs[ii].replace(/\'/g,'').replace(/\"/g,''));
}
}
return arrback;
}
function checkscroll(od) {
console.log('here');
var ourdiv=od.id, k, allok=false;
var rect=document.getElementById(ourdiv).getBoundingClientRect();
var sl=eval(eval(('0' + od.scrollLeft).replace('px','')) * factor);
var st=eval(eval(('0' + od.scrollTop).replace('px','')) * factor);
//alert("document.getElementById('" + ourdiv + "') scrollTop = " + st + " and bigs[0].top=" + bigs[0].top + " and bigs[0].y=" + bigs[0].y);
}
function huhhuh() {
//if (Math.abs(leftdesc[ourdiv] - sl) <= eval(leftout) && Math.abs(topdesc[ourdiv] - st) <= eval(topout)) {
if (Math.abs(rect.left) <= eval(leftout) && Math.abs(rect.top) <= eval(topout)) {
okdesc[ourdiv] = 1;
document.title=rect.left + ' ' + rect.top; // + ' ' + od.id + ' ' + od.offsetX + ' ' + ' ' + sl + ' ' + st + ' ' + rect.left;
//alert(9);
od.style.border = '5px solid yellow';
} else {
document.title=rect.left + ' ' + rect.top; // + ' ' + od.id + ' ' + od.offsetX + ' ' + sl + ' ' + st + ' ' + rect.left;
okdesc[ourdiv] = 0;
od.style.border = '0px solid yellow';
}
allok=true;
var huh=' ';
for (k=0; k<9; k++) {
huh+=okdesc[k];
if (okdesc[k] == 0) allok=false;
}
document.title+=huh;
if (allok) {
score++;
if (goes == 0) goes=1;
var more=prompt('Congratulations! That is Score: ' + score + ' from Goes: ' + goes + ' with Take Taken in Seconds: ' + seconds + '. Another go with the image URL below?', imageis);
if (more) {
if (more == '') more = imageis;
location.href = './scroll_touch.htm?image=' + encodeURIComponent(more) + '&score=' + score + '&goes=' + goes + '&seconds=' + seconds;
}
}
}
function settd(sio) {
var tdid=sio.id.replace('s','');
for (var ii=0; ii<zcgcols.length; ii++) {
if (tdid == zcgcols[ii].replace(/\ /g,'-')) {
//alert(tdid);
nogo=true;
if (lastb == '') {
lastb=zcgcols[0].replace(/\ /g,'-');
}
document.getElementById(lastb).style.border=''; //console.log("sticky: " + window.pageYOffset + " > " + sticky);
document.getElementById('s' + lastb).style.border=''; //console.log("sticky: " + window.pageYOffset + " > " + sticky);
lasti=ii;
lastb=zcgcols[lasti].replace(/\ /g,'-');
document.getElementById(lastb).style.border="5px solid yellow";
document.getElementById('s' + lastb).style.border="5px solid yellow";
location.hash='#' + lastb;
}
}
}
function onl() {
var ourrect;
if (('' + location.hash) != '' && ('' + documentreferrer) == '') {
location.href=document.URL.split('#')[0];
}
for (var ii=0; ii<zcgcols.length; ii++) {
document.getElementById('mytable').innerHTML+="<tr><td class=big onscroll='checkscroll(this);' onmousewheel='checkscroll(this);' id=" + zcgcols[ii].replace(/\ /g,'-') + " style='text-align:center;vertical-align:middle;width:100%;height:400px;" + bordstr + "background-color:" + cgcols[eval(ii % cgcols.length)] + ";'><a onclick=\"settd(document.getElementById('s" + zcgcols[ii].replace(/\ /g,'-') + "'));\" style='background-color:white;padding: 5 5 5 5;' href='//wikipedia.org/wiki/" + zcgcols[ii].replace(/\ /g,'-') + "'>" + zcgcols[ii] + "</a></td></tr>";
document.getElementById('rhs').innerHTML+="<tr><td onclick='settd(this);' class=small id=s" + zcgcols[ii].replace(/\ /g,'-') + " style='text-align:center;width:100%;height:40px;" + bordstr + "background-color:" + cgcols[eval(ii % cgcols.length)] + ";'>" + zcgcols[ii] + "</td></tr>";
bordstr="";
}
var ourbigs=document.getElementsByTagName('td');
for (var iii=0; iii<ourbigs.length; iii++) {
if (('' + ourbigs[iii].className) == 'big') {
bigs.push(ourbigs[iii].getBoundingClientRect());
}
}
documentreferrer='x';
window.onscroll = function() {myFunction()};
var header = document.getElementById(zcgcols[0].replace(/\ /g,'-'));
var sticky = bigs[0].bottom;
var stickyt = bigs[0].top;
function myFunction() {
//bigs[0]=document.getElementById(cgcols[0]).getBoundingClientRect();
if (!nogo) {
if (window.pageYOffset > bigs[lasti].bottom || window.pageYOffset < bigs[lasti].top) {
for (var iiii=eval(0 * eval(1 + lasti)); iiii<bigs.length; iiii++) {
sticky = bigs[iiii].bottom;
stickyt = bigs[iiii].top;
if (window.pageYOffset <= sticky) {
if (lastb == '') {
lastb=zcgcols[0].replace(/\ /g,'-');
}
document.getElementById(lastb).style.border=''; //console.log("sticky: " + window.pageYOffset + " > " + sticky);
document.getElementById('s' + lastb).style.border=''; //console.log("sticky: " + window.pageYOffset + " > " + sticky);
lasti=iiii;
lastb=zcgcols[lasti].replace(/\ /g,'-');
document.getElementById(lastb).style.border="5px solid yellow";
document.getElementById('s' + lastb).style.border="5px solid yellow";
location.hash='#' + lastb;
return;
} else if (1 == 5 && window.pageYOffset >= stickyt) {
if (lastb == '') {
lastb=zcgcols[0].replace(/\ /g,'-');
}
document.getElementById(lastb).style.border=''; //console.log("sticky: " + window.pageYOffset + " > " + sticky);
document.getElementById('s' + lastb).style.border=''; //console.log("sticky: " + window.pageYOffset + " > " + sticky);
lasti=iiii;
lastb=zcgcols[lasti].replace(/\ /g,'-');
document.getElementById(lastb).style.border="5px solid yellow";
document.getElementById('s' + lastb).style.border="5px solid yellow";
location.hash='#' + lastb;
return;
} else {
console.log("not sticky: " + window.pageYOffset + " <= " + sticky);
}
}
}
}
nogo=false;
}
}
function askcontent() {
var askfor=prompt('Please enter comma separated list of content items.', location.search.split('alist=')[1] ? (decodeURIComponent(location.search.split('alist=')[1].split('&')[0]).replace(/\,/g,"','") + "']").replace(/\[/g,'').replace(/\]/g,'') : "'lime','maroon','lightblue','purple','navy','teal','fuchsia','olive','red','lightgreen','darkorange','pink','orange'");
if (askfor == null) { askfor=''; }
if (askfor.trim() != '' && askfor != (location.search.split('alist=')[1] ? (decodeURIComponent(location.search.split('alist=')[1].split('&')[0]).replace(/\,/g,"','") + "']").replace(/\[/g,'').replace(/\]/g,'') : "'lime','maroon','lightblue','purple','navy','teal','fuchsia','olive','red','lightgreen','darkorange','pink','orange'")) {
//cgcols=eval("['" + decodeURIComponent(askfor).replace(/\,/g,"','") + "']");
//onl();
location.href=document.URL.split('?')[0].split('#')[0] + '?alist=' + encodeURIComponent(askfor.replace(/\'\,\'/g,',').replace(/^\'/g,'').replace(/\'$/g,''));
}
}
</script>
</head>
<body onload=onl(); onscroll='checkscroll(this);'>
<h1>Returning to where you started</h1>
<h3>RJM Programming <a onclick=askcontent(); style="text-decoration:underline;cursor:pointer;" title="Set your own comma separated list array content">-</a> February, 2021</h3>
<table id=mytable style='width:80%;'>
</table>
<table style='position:fixed;top:0px;left:80%;width:20%;' id=rhs>
</table>
</body>
</html>