<!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=amBeingCalled';
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 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 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);
//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;
allowmove=true;
wois.focus();
}
if (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);
} else {
inarow=0;
console.log('Tracker Here ' + pwhx + ' ' + ws + ' ... ' + hs);
}
} else {
console.log('pretracker here ');
}
}
}

</script>
</head>
<body onclick=" if (wois) { wois.focus(); }" title="Click here to reshow popup">
<script type='text/javascript'>
if (callis == '') {
if (1 == 2) { window.onresize=function() { wois=null; location.href=document.URL; } }
document.write('<br><br><br><br><br><br><br><br><br><table style=display:none;margin-left:20%;width:60%;text-align:center;><tr><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></tr><tr><td><input 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></tr></table>');
domoveto();
setInterval(tracker, 100);
} else {
document.write('<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="margin-top:-10px;vertical-align:top;font-size:56px;">🙂</p><p style="word-wrap;break-word;width:' + incxn + 'px;font-size:8px;margin-top:-50px;">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>');
}
</script>
</body>
</html>