<!doctype html>
<html>
<head>
<title>Show Scroll Percentage Status at top left - RJM Programming - June, 2016</title>
<script type='text/javascript'>

var scrollx=-1;
var scrolly=-1;
var prevdh=-1;
var prevdw=-1;
var dh=-1;
var dw=-1;
var thisdh=-1;
var thisdw=-1;
var hideScroll=5000;
var scrollDiv=null;
var cnt=0;
var elem1table=null;
var elem1img=null;
var isOkay=true;

function showScroll() {
var oif=document.getElementById('iframeshowscrollxy');
if (oif == null) {
if (document.URL.indexOf('noscroll' + 'check=') == -1 && document.head.innerHTML.indexOf('noscr' + 'ollcheck=') == -1) {
document.body.innerHTML+="<iframe id='iframeshowscrollxy' style='display:none;' src='scroll_check.html'></iframe>";
}
}
}

function checkscroll() {
var whattoshow='', ifs;
var elem1=top.document.body;
var elemx1=elem1;
var elemy1=elem1;
if (elem1table != null) {
var oifs=top.document.getElementsByTagName('table');
elemx1=oifs[0];
}
if (elem1img != null) {
var ooifs=top.document.getElementsByTagName('img');
elemy1=ooifs[0];
elemx1=ooifs[0];
}
if (isOkay && eval(("" + top.window.scrollX).replace('px','')) != scrollx) {
if (eval(("" + top.window.scrollY).replace('px','')) != scrolly) {
//alert("x=" + top.window.scrollX + " y=" + top.window.scrollY);
scrollx=eval(("" + top.window.scrollX).replace('px',''));
scrolly=eval(("" + top.window.scrollY).replace('px',''));
whattoshow = ' ';
} else {
//alert("x=" + top.window.scrollX);
scrollx=eval(("" + top.window.scrollX).replace('px',''));
whattoshow = ' ';
}
} else if (isOkay && eval(("" + top.window.scrollY).replace('px','')) != scrolly) {
//alert("y=" + top.window.scrollY);
scrolly=eval(("" + top.window.scrollY).replace('px',''));
whattoshow = ' ';
}
thisdh=eval(("" + top.window.innerHeight).replace('px','')); //"" + eval(top.window.getComputedStyle(top.document.body, null).getPropertyValue("height").replace('px',''));
thisdw=eval(("" + top.window.innerWidth).replace('px','')); //"" + eval(top.window.getComputedStyle(top.document.body, null).getPropertyValue("width").replace('px',''));
if (dh == -1 && dw == -1) {
ifs=top.document.getElementsByTagName('a');
if (ifs.length > 0) {
for (var jifs=0; jifs<ifs.length; jifs++) {
if (ifs[jifs].innerHTML == '@') {
ifs[jifs].onmousedown = function() { scrollDiv.innerHTML=''; scrollDiv.style.visibility = 'hidden'; isOkay=false; };
}
}
}
dh="" + eval(top.window.getComputedStyle(elemy1, null).getPropertyValue("height").replace('px',''));
dw="" + eval(top.window.getComputedStyle(elemx1, null).getPropertyValue("width").replace('px',''));
var altdw=dw;
ifs=top.document.getElementsByTagName('table');
if (ifs.length > 0) {
altdw="" + eval(top.window.getComputedStyle(ifs[0], null).getPropertyValue("width").replace('px',''));
if (eval(altdw) > eval(dw)) {
elem1table=ifs[0];
elemx1=ifs[0];
dw=altdw;
}
} else {
ifs=top.document.getElementsByTagName('img');
if (ifs.length > 0) {
altdw="" + eval(top.window.getComputedStyle(ifs[0], null).getPropertyValue("width").replace('px',''));
if (eval(altdw) > eval(dw)) {
elem1img=ifs[0];
elemx1=ifs[0];
dw=altdw;
}
altdh="" + eval(top.window.getComputedStyle(ifs[0], null).getPropertyValue("height").replace('px',''));
if (eval(altdh) > eval(dh)) {
elem1img=ifs[0];
elemy1=ifs[0];
dh=altdh;
}
}
}
if (document.URL.indexOf('noscroll' + 'check=') != -1 || top.document.URL.indexOf('nos' + 'croll' + 'check=') != -1) {
whattoshow='';
isOkay=false;
}
if (isOkay) {
whattoshow+='Scroll X% = ' + parseFloat(eval(eval(scrollx) * 100.0 / eval(dw))).toFixed(2) + '% (to ' + Math.min(100,parseFloat(eval((eval(scrollx) + eval(thisdw)) * 100.0 / eval(dw)))).toFixed(2) + '%)<br>';
whattoshow+='Scroll Y% = ' + parseFloat(eval(eval(scrolly) * 100.0 / eval(dh))).toFixed(2) + '% (to ' + Math.min(100,parseFloat(eval((eval(scrolly) + eval(thisdh)) * 100.0 / eval(dw)))).toFixed(2) + '%) ';
scrollDiv=top.document.getElementById('showscrollxy');
if (scrollDiv == null) {
top.document.body.innerHTML+='<div id="showscrollxy" style=" position: absolute; opacity: 0.3; display: inline-block; visibility: visible; background-color: #666; color: #fff; text-align: enter; margin: 1% auto; padding: 6px 6px; z-index: 8;"></div>';
scrollDiv=top.document.getElementById('showscrollxy');
}
}
prevdw=dw;
prevdh=dh;
} else if (whattoshow == ' ') {
whattoshow='';
dh="" + eval(top.window.getComputedStyle(elemy1, null).getPropertyValue("height").replace('px',''));
dw="" + eval(top.window.getComputedStyle(elemx1, null).getPropertyValue("width").replace('px',''));
whattoshow+='Scroll X% = ' + parseFloat(eval(eval(scrollx) * 100.0 / eval(dw))).toFixed(2) + '% (to ' + Math.min(100,parseFloat(eval((eval(scrollx) + eval(thisdw)) * 100.0 / eval(dw)))).toFixed(2) + '%)<br>';
whattoshow+='Scroll Y% = ' + parseFloat(eval(eval(scrolly) * 100.0 / eval(dh))).toFixed(2) + '% (to ' + Math.min(100,parseFloat(eval((eval(scrolly) + eval(thisdh)) * 100.0 / eval(dw)))).toFixed(2) + '%) ';
prevdw=dw;
prevdh=dh;
} else {
dh="" + eval(top.window.getComputedStyle(elemy1, null).getPropertyValue("height").replace('px',''));
dw="" + eval(top.window.getComputedStyle(elemx1, null).getPropertyValue("width").replace('px',''));
if (eval(eval(prevdh) - eval(dh)) != 0 || eval(eval(prevdw) - eval(dw)) != 0) {
whattoshow+='Scroll X% = ' + parseFloat(eval(eval(scrollx) * 100.0 / eval(dw))).toFixed(2) + '% (to ' + Math.min(100,parseFloat(eval((eval(scrollx) + eval(thisdw)) * 100.0 / eval(dw)))).toFixed(2) + '%)<br>';
whattoshow+='Scroll Y% = ' + parseFloat(eval(eval(scrolly) * 100.0 / eval(dh))).toFixed(2) + '% (to ' + Math.min(100,parseFloat(eval((eval(scrolly) + eval(thisdh)) * 100.0 / eval(dw)))).toFixed(2) + '%) ';
prevdw=dw;
prevdh=dh;
}
}
if (whattoshow != '') {
//alert(whattoshow);
cnt++;
if (elem1img != null) {
scrollDiv.innerHTML="<img onclick='window.open(\"" + elemy1.src + "\",\"_blank\",\"top=200,left=0,width=400,height=400\");' src='" + elemy1.src + "' style='width:150px;' title='Thumbnail'></img>";
scrollDiv.style.opacity = 0.7;
} else {
scrollDiv.innerHTML=whattoshow.replace('NaN','0.00').replace('NaN','0.00');
}
scrollDiv.style.left = eval(scrollx) + 'px';
scrollDiv.style.top = eval(scrolly) + 'px';
scrollDiv.style.visibility = 'visible';
setTimeout(function() {
if (cnt == 1) scrollDiv.style.visibility = 'hidden';
cnt--;
}, hideScroll);
}
if (isOkay) setTimeout(checkscroll, 200);
}

</script>
</head>
<body onload=' checkscroll(); '>
</body>
</html>