<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=0.1, maximum-scale=8, user-scalable=yes" >
<title>Move Around Edge Window Open - RJM Programming - May, 2019</title>
<script type='text/javascript'>
var callis=location.search.split('call=')[1] ? decodeURIComponent(location.search.split('call=')[1].split('&')[0]) : '';
var wois=null, pmodewin='_blank', pinurl=document.URL.split('?') + '?call=%26%23128578%3b';
var deviceWidth = window.orientation == 0 ? window.screen.height: window.screen.width;
var deviceHeight = window.orientation == 0 ? window.screen.width : window.screen.height;
var incxn=Math.floor(eval(deviceWidth / Math.floor(eval(eval(deviceWidth / 200) + 1))));
var incyn=Math.floor(eval(deviceHeight / Math.floor(eval(eval(deviceHeight / 200) + 1))));
var incx=Math.floor(eval(deviceWidth / incxn));
var incy=Math.floor(eval(deviceHeight / incyn));
var jncx=incxn;
var jncy=incyn;
jncx/=10;
jncy/=10;
var isc=1;
var topx=0, topy=0;
var pwh='width=' + incxn + ',height=' + incyn;
var movetosx=[Math.floor(eval(eval(deviceWidth / 2) - eval(incxn / 2)))];
var movetosy=[Math.floor(eval(eval(deviceHeight / 2) - eval(incyn / 2)))];
var pindex=0;
var pwhx='';
var allowmove=true;
var inarow=0;
var draw_back_as_is=false;
var draw_back_your_interventions_only=false;
var draw_back_default_moves_only=false;
var penup=true;
var lastx=-1, lasty=-1;
var elem=null;
var content=null;
var ss='#000000';
var nomoveinarow=0;
var butp=null;
// var windows=[]; // thanks to https://medium.com/@bluepnume/every-known-way-to-get-references-to-windows-in-javascript-223778bede2d
function domoveto() {
var ij=0, ix=0, iy=0;
topx=0;
topy=0;
if (navigator.userAgent.indexOf("Firefox") != -1) {
pwhx=pwh + ',top=' + eval('' + ('' + topy).split('.')[0]) + ',left=' + eval('' + ('' + topx).split('.')[0]);
} else {
pwhx=pwh + ',screenY=' + eval('' + ('' + topy).split('.')[0]) + ',screenX=' + eval('' + ('' + topx).split('.')[0]);
}
//if (wois) { document.title+='~'; }
if (wois == null) {
//document.title+='`';
movetosx.push(topx);
movetosy.push(topy);
for (ij=0; ij<incx; ij++) {
topx+=incxn;
movetosx.push('' + topx + '.0');
movetosy.push(topy);
}
for (ij=1; ij<incy; ij++) {
topy+=incyn;
movetosx.push(topx);
movetosy.push(topy);
}
for (ij=0; ij<incx; ij++) {
topx-=incxn;
movetosx.push(topx);
movetosy.push(topy);
}
for (ij=1; ij<incx; ij++) {
topy-=incyn;
movetosx.push('' + topx + '.0');
movetosy.push(topy);
}
if (navigator.userAgent.indexOf("Firefox") != -1) {
pwhx=pwh + ',top=' + eval('' + ('' + movetosy[0]).split('.')[0]) + ',left=' + eval('' + ('' + movetosx[0]).split('.')[0]);
} else {
pwhx=pwh + ',screenY=' + eval('' + ('' + movetosy[0]).split('.')[0]) + ',screenX=' + eval('' + ('' + movetosx[0]).split('.')[0]);
}
//document.title='preopen' + pindex;
wois=window.open(pinurl, pmodewin, pwhx);
pinurl=document.URL.split('?') + '?call=%26%239999%3b';
//if (wois) { document.title='postopen' + pindex; }
//pwhx=pwh + ',screenY=' + wois.screenY + ',screenX=' + wois.screenX;
//wois.focus();
pindex++;
//setTimeout(domoveto, 2000);
} else if (document.URL.toLowerCase().replace('//localhost','//www.rjmprogramming.com.au').indexOf('rjmprogramming.com.au') == -1 && allowmove) {
//document.title+='|';
topx=movetosx[eval(pindex % movetosx.length)];
topy=movetosy[eval(pindex % movetosy.length)];
//if (document.URL.toLowerCase().replace('//localhost','//www.rjmprogramming.com.au').indexOf('rjmprogramming.com.au') == -1) {
if (wois != null) { wois.close(); wois=null; }
if (navigator.userAgent.indexOf("Firefox") != -1) {
pwhx=pwh + ',top=' + eval('' + ('' + movetosy[eval(pindex % movetosx.length)]).split('.')[0]) + ',left=' + eval('' + ('' + movetosx[eval(pindex % movetosx.length)]).split('.')[0]);
} else {
pwhx=pwh + ',screenY=' + eval('' + ('' + movetosy[eval(pindex % movetosx.length)]).split('.')[0]) + ',screenX=' + eval('' + ('' + movetosx[eval(pindex % movetosx.length)]).split('.')[0]);
}
wois=window.open(pinurl, pmodewin, pwhx);
//wois.focus();
pindex++;
//setTimeout(domoveto, 2000);
//}
} else if (allowmove) {
//document.title+='@';
if (navigator.userAgent.indexOf("Firefox") != -1) {
pwhx=pwh + ',top=' + eval('' + ('' + movetosy[eval(pindex % movetosx.length)]).split('.')[0]) + ',left=' + eval('' + ('' + movetosx[eval(pindex % movetosx.length)]).split('.')[0]);
} else {
pwhx=pwh + ',screenY=' + eval('' + ('' + movetosy[eval(pindex % movetosx.length)]).split('.')[0]) + ',screenX=' + eval('' + ('' + movetosx[eval(pindex % movetosx.length)]).split('.')[0]);
}
//if (wois) { document.title='premove'; }
//alert('wois.moveTo()');
//alert("eval(('' + movetosx[eval(pindex % movetosx.length)]).split('.')[0])=" + eval(('' + movetosx[eval(pindex % movetosx.length)]).split('.')[0]));
//alert("eval(('' + movetosy[eval(pindex % movetosy.length)]).split('.')[0])=" + eval(('' + movetosy[eval(pindex % movetosy.length)]).split('.')[0]));
ix=eval('' + ('' + movetosx[eval(pindex % movetosx.length)]).split('.')[0]);
//ix*=isc;
iy=eval('' + ('' + movetosy[eval(pindex % movetosy.length)]).split('.')[0]);
//iy*=isc;
wois.moveTo(ix, iy);
//if (wois) { document.title='postmove ' + ix + ',' + iy + ':' + window.devicePixelRatio; }
wois.resizeTo(incxn, incyn);
//wois.focus();
pindex++;
//setTimeout(domoveto, 2000);
} else {
// document.title+='%';
if (navigator.userAgent.indexOf("Firefox") != -1) {
pwhx=pwh + ',top=' + eval('' + ('' + movetosy[eval(pindex % movetosx.length)]).split('.')[0]) + ',left=' + eval('' + ('' + movetosx[eval(pindex % movetosx.length)]).split('.')[0]);
} else {
pwhx=pwh + ',screenY=' + eval('' + ('' + movetosy[eval(pindex % movetosx.length)]).split('.')[0]) + ',screenX=' + eval('' + ('' + movetosx[eval(pindex % movetosx.length)]).split('.')[0]);
}
//wois.moveTo(eval(('' + topx).split('.')[0]), eval(('' + topy).split('.')[0]));
//wois.focus();
pindex++;
//setTimeout(domoveto, 2000);
}
//}
setTimeout(domoveto, 2800);
}
function tracker() {
if (wois) {
if (eval('' + pindex) > 0) {
var ws='';
var hs='';
try {
ws=('' + wois.screenX);
} catch(wert) {
ws=pwhx.replace(pwh,'').replace('screenX=','left=').split('left=')[1].split(',')[0];
}
try {
hs=('' + wois.screenY);
} catch(wert) {
hs=pwhx.replace(pwh,'').replace('screenY=','top=').split('top=')[1].split(',')[0];
}
if (!allowmove && ws == '0') {
inarow=0;
nomoveinarow=0;
if (draw_back_your_interventions_only) { penup=true; }
allowmove=true;
wois.focus();
}
if ((draw_back_default_moves_only && ('' + ws + '~').indexOf('0~') != -1) || (pwhx.replace(pwh,'').indexOf('' + ws) == -1 && ('' + movetosx[eval(pindex % movetosx.length)]).indexOf('.0') != -1)) { // || pwhx.replace(pwh,'').indexOf('' + wois.screenY) == -1) {
inarow++;
if (inarow > 10 && ('' + ws + '~').indexOf('0~') == -1) { allowmove=false; }
console.log('tracker here ' + pwhx + ' ' + ws + ' ... ' + hs);
if (draw_back_as_is || draw_back_default_moves_only) {
if (penup || ss != '#000000') {
if (!penup) { if (nomoveinarow > 30) { nomoveinarow=0; elem.style.zIndex='7'; setTimeout(ssback, 2900); } }
lastx=Math.floor(eval('' + wois.screenX) + jncx);
lasty=Math.floor(eval('' + wois.screenY) + jncy);
if (!draw_back_your_interventions_only) {
//document.title+='!';
context.beginPath();
context.moveTo(lastx, lasty);
}
penup=false;
} else {
if (Math.floor(eval('' + wois.screenX) + jncx) != lastx || Math.floor(eval('' + wois.screenY) + jncy) != lasty) {
nomoveinarow=0;
elem.style.zIndex='7';
//setTimeout(ssback, 900);
//document.title='' + eval('' + wois.screenX) + ';' + eval('' + wois.screenY) + ' ' + Math.floor(eval('' + wois.screenX) + jncx) + ',' + Math.floor(eval('' + wois.screenY) + jncy) + ' to ' + lastx + ',' + lasty;
//document.title+=ss;
lastx=Math.floor(eval('' + wois.screenX) + jncx);
lasty=Math.floor(eval('' + wois.screenY) + jncy);
if (draw_back_default_moves_only && !allowmove) {
lastx=lastx;
} else if (!draw_back_your_interventions_only || draw_back_default_moves_only) {
//document.title+='~' + lastx + ',' + lasty;
context.strokeStyle=ss; //'#000000';
context.lineTo(lastx, lasty);
context.stroke();
}
}
}
}
} else {
inarow=0;
if (draw_back_as_is || draw_back_your_interventions_only) {
if (penup || ss != '#000000') {
if (!penup) { if (nomoveinarow > 30) { nomoveinarow=0; elem.style.zIndex='7'; setTimeout(ssback, 2900); } }
context.beginPath();
lastx=Math.floor(eval('' + wois.screenX) + jncx);
lasty=Math.floor(eval('' + wois.screenY) + jncy);
//document.title+='?' + lastx + ',' + lasty;
context.moveTo(lastx, lasty);
penup=false;
} else {
if (Math.floor(eval('' + wois.screenX) + jncx) != lastx || Math.floor(eval('' + wois.screenY) + jncy) != lasty) {
elem.style.zIndex='7';
nomoveinarow=0;
//setTimeout(ssback, 900);
//document.title='' + eval('' + wois.screenX) + ';' + eval('' + wois.screenY) + ' ' + Math.floor(eval('' + wois.screenX) + jncx) + ',' + Math.floor(eval('' + wois.screenY) + jncy) + ' to ' + lastx + ',' + lasty;
//document.title=ss;
lastx=Math.floor(eval('' + wois.screenX) + jncx);
lasty=Math.floor(eval('' + wois.screenY) + jncy);
if (draw_back_your_interventions_only && allowmove) {
allowmove=allowmove;
} else {
//if (!draw_back_default_moves_only) {
//document.title+='#' + lastx + ',' + lasty;
context.strokeStyle=ss; //'#000000';
context.lineTo(lastx, lasty);
context.stroke();
//}
}
} else {
if (!allowmove) { nomoveinarow++; }
if (nomoveinarow > 30) {
elem.style.zIndex='-1';
ss='rgba(255, 255, 255, 0.0)';
document.title='Can move now';
if (butp) {
butp.value=butp.value.split(' ... ')[0] + ' ... ' + document.title;
}
context.strokeStyle=ss; //'#000000';
}
}
}
}
console.log('Tracker Here ' + pwhx + ' ' + ws + ' ... ' + hs);
}
} else {
console.log('pretracker here ');
}
}
}
function ssback() {
ss='#000000';
elem.style.zIndex='7';
document.title='Pen down again';
if (butp) {
butp.value=butp.value.split(' ... ')[0] + ' ... ' + document.title;
}
}
function nondefaults(buto) {
//event.stopPropagation();
switch(buto.value) {
case 'Draw Back As Is':
butp=buto;
butp.style.border='2px dashed yellow';
draw_back_as_is=true;
elem.style.zIndex='7';
document.title='Pen down again';
if (butp) {
butp.value=butp.value.split(' ... ')[0] + ' ... ' + document.title;
}
wois.close();
wois=window.open(pinurl, pmodewin, pwhx);
wois.focus();
break;
case 'Draw Back Your Interventions Only':
butp=buto;
butp.style.border='2px dashed yellow';
draw_back_your_interventions_only=true;
elem.style.zIndex='7';
if (!allowmove) {
document.title='Pen down again';
if (butp) {
butp.value=butp.value.split(' ... ')[0] + ' ... ' + document.title;
}
}
wois.close();
wois=window.open(pinurl, pmodewin, pwhx);
wois.focus();
break;
case 'Draw Back Default Moves Only':
butp=buto;
butp.style.border='2px dashed yellow';
draw_back_default_moves_only=true;
elem.style.zIndex='7';
if (allowmove) {
document.title='Pen down again';
if (butp) {
butp.value=butp.value.split(' ... ')[0] + ' ... ' + document.title;
}
}
wois.close();
wois=window.open(pinurl, pmodewin, pwhx);
wois.focus();
break;
case 'Stop Drawing':
if (butp != null) {
butp.value=butp.value.split(' ... ')[0];
butp=null;
}
draw_back_default_moves_only=false;
draw_back_default_moves_only=false;
draw_back_as_is=false;
elem.style.zIndex='-1';
//wois.focus();
document.title='Move Around Edge Window Open - RJM Programming - May, 2019';
event.stopProagation();
break;
default:
break;
}
}
function laterf() {
if (wois) { wois.focus(); }
}
function cfc() {
elem = document.getElementById('mycanvas');
if (elem) {
elem.width = elem.offsetWidth;
elem.height = elem.offsetHeight;
context = elem.getContext("2d");
}
}
</script>
</head>
<body onload="cfc();" title="Click here to reshow popup" style="opacity:0.9;">
<script type='text/javascript'>
if (callis == '') {
if (1 == 2) { window.onresize=function() { wois=null; location.href=document.URL; } }
document.write('<div id=noncanvas style="z-index:1;"><br><br><br><br><br><br><br><br><br><table style= style=z-index:1;margin-left:20%;width:60%;text-align:center;><tr style=display:none;><td><input type=button onclick=nondefaults(this); value="Play Back As Is"></input></td><td><input type=button onclick=nondefaults(this); value="Play Back Your Interventions Only"></input></td><td><input type=button onclick=nondefaults(this); value="Play Back Default Moves Only"></input></td><td><input type=button onclick=nondefaults(this); value="Stop Playing"></input></td></tr><tr><td><input style=z-index:5; type=button onclick="nondefaults(this);" value="Draw Back As Is"></input></td><td><input type=button onclick=nondefaults(this); value="Draw Back Your Interventions Only"></input></td><td><input type=button onclick=nondefaults(this); value="Draw Back Default Moves Only"></input></td><td><input style=width:200px; type=text onclick=nondefaults(this); placeholder="Stop Drawing by Closing Popup" value=""></input></td></tr></table></div><canvas onclick=" setTimeout(laterf, 50);" id=mycanvas style="z-index:-2;width:100%;height:100vh;position:absolute;top:0px;left:0px;border:1px solid red;background-color:transparent;opacity:0.9;"></canvas>');
domoveto();
setInterval(tracker, 100);
} else {
document.write('<div style="background-color:transparent;opacity:0.7;"><p title="In some places you can move this to take the controls from the automated screen edge movements. If so to relinquish control place at left hand edge again." style="background-color:transparent;opacity:0.7;margin-top:-10px;vertical-align:top;font-size:56px;">' + callis + '</p><p style="word-wrap;break-word;width:' + incxn + 'px;font-size:8px;margin-top:-50px;background-color:transparent;opacity:0.7;">In some places you can move this to take the <br>controls from the automated screen edge <br>movements. If so to relinquish control <br>place at left hand edge again.</p></div>');
}
</script>
</body>
</html>