<html>
<head>
<title>getComputedStyle_plus.html - RJM Programming - June, 2022</title>
<!--script type='text/javascript' src='./slotin.js'></script-->
<script type='text/javascript'>
var rawhtml='';
var url=document.URL;
var zhr=null, zform=null;
var newscr=String.fromCharCode(10) + "<scr" + "ipt type='text/javascript'>" + String.fromCharCode(10) + "</scr" + "ipt>" + String.fromCharCode(10);

function relative_to_absolute(inth) {
var huhs, posthuhs, ii, m, delimis=" ";
var uubits=url.split("?");
if (uubits[0].indexOf("/") != -1) {
var uuubits=uubits[0].split("/");
if (uuubits[eval(uuubits.length - 1)] != "") {
if (uuubits[eval(uuubits.length - 1)].indexOf(".") != -1) {
uubits[0] = uubits[0].replace("/" + uuubits[eval(uuubits.length - 1)], "/");
} else {
uubits[0] += "/";
}
}
}
var uudirname=uubits[0];
var outth = inth;
var ideas = new Array(" action='", ' action="', " Action='", ' Action="', " ACTION='", ' ACTION="', " action=", " Action=", " ACTION=", " href='", ' href="', " Href='", ' Href="', " HREF='", ' HREF="', " href=", " Href=", " HREF=", " src='", ' src="', " Src='", ' Src="', " SRC='", ' SRC="', " src=", " Src=", " SRC=");
if (uudirname != "" && url != "") {
for (m=0; m<ideas.length; m++) {
huhs = inth.split(ideas[m]);
if (huhs.length > 1) {
for (ii=eval(huhs.length - 1); ii>=1; ii--) {
delimis=ideas[m].substring(eval(ideas[m].length - 1), eval(ideas[m].length));
if (delimis == "=") delimis=" ";
posthuhs=huhs[ii].trim().replace(">"," ").replace(/mailto:/g, "http:").replace(/javascript:none;/g, "http:").split(delimis);
if (posthuhs[0].length > 0) {
if (posthuhs[0].substring(0,1) == "#" || posthuhs[0].substring(0,4).toLowerCase().replace(/file/g, "http").toLowerCase() == "http") {
outth = outth;
} else if (posthuhs[0].substring(0,1) != "/" && posthuhs[0].substring(0,1) != "'" && posthuhs[0].substring(0,1) != '"') {
while (outth.indexOf(posthuhs[0]) != -1) {
outth=outth.replace(posthuhs[0], "youwill-never-ever-findthis");
}
outth=outth.replace(/youwill-never-ever-findthis/g, uudirname + posthuhs[0]);
//alert(posthuhs[0] + " To " + uudirname + posthuhs[0]);
} else if (posthuhs[0].substring(1,2) != "/" && posthuhs[0].substring(0,1) != "'" && posthuhs[0].substring(0,1) != '"') {
while (outth.indexOf(posthuhs[0]) != -1) {
outth=outth.replace(posthuhs[0], "youwill-never-ever-findthis");
}
outth=outth.replace(/youwill-never-ever-findthis/g, uudirname.substring(0, eval(uudirname.length - 1)) + posthuhs[0]);
//alert(posthuhs[0] + " to " + uudirname.substring(0, eval(uudirname.length - 1)) + posthuhs[0]);
}
}
}
}
}
}
return outth.replace(/https\:\/\/www\.rjmprogramming\.com\.au\/https/g, 'https').replace(/http\:\/\/www\.rjmprogramming\.com\.au\/http/g, 'http');
}

function stateChanged() {
if (zhr.readyState == 4) {
if (zhr.status == 200) {
rawhtml = zhr.response;
newscr=newscr.replace('</scr' + 'ipt>', String.fromCharCode(10) + " var lastogcs=null; " + String.fromCharCode(10) + " function gcstitleit() { " + "</scr" + "ipt>");

newscr=newscr.replace('</scr' + 'ipt>', String.fromCharCode(10) + " var iels=0, jone=0, delimc='', onecssps='', cssps='" + document.getElementById('csspty').value.trim().replace(/\ /g,',').replace(/\;/g,',').replace(/\:/g,',') + "'.split(','), elsare=document.getElementsByTagName('*'); " + "</scr" + "ipt>");
newscr=newscr.replace('</scr' + 'ipt>', String.fromCharCode(10) + " for (iels=0; iels<elsare.length; iels++) { " + "</scr" + "ipt>");
newscr=newscr.replace('</scr' + 'ipt>', String.fromCharCode(10) + " delimc=''; onecssps=''; lastogcs=window.getComputedStyle(elsare[iels]); " + "</scr" + "ipt>");
newscr=newscr.replace('</scr' + 'ipt>', String.fromCharCode(10) + " for (jone=0; jone<cssps.length; jone++) { if (cssps[jone].trim() != '') { onecssps+=delimc + cssps[jone] + ':' + lastogcs.getPropertyValue(cssps[jone]); ; delimc=';'; } } " + "</scr" + "ipt>");
newscr=newscr.replace('</scr' + 'ipt>', String.fromCharCode(10) + " if (('' + elsare[iels].title).replace('null','').replace('undefined','') == '') { " + "</scr" + "ipt>");
newscr=newscr.replace('</scr' + 'ipt>', String.fromCharCode(10) + " elsare[iels].title='' + onecssps; " + "</scr" + "ipt>");
newscr=newscr.replace('</scr' + 'ipt>', String.fromCharCode(10) + " } else if (elsare[iels].title.indexOf(onecssps) == -1) { " + "</scr" + "ipt>");
newscr=newscr.replace('</scr' + 'ipt>', String.fromCharCode(10) + " elsare[iels].title+=' ... ' + onecssps; " + "</scr" + "ipt>");
newscr=newscr.replace('</scr' + 'ipt>', String.fromCharCode(10) + " } " + "</scr" + "ipt>");
newscr=newscr.replace('</scr' + 'ipt>', String.fromCharCode(10) + " } " + String.fromCharCode(10) + "</scr" + "ipt>");

newscr=newscr.replace('</scr' + 'ipt>', String.fromCharCode(10) + " } " + String.fromCharCode(10) + "</scr" + "ipt>");

newscr=newscr.replace('</scr' + 'ipt>', String.fromCharCode(10) + " setTimeout(gcstitleit, 3000); " + "</scr" + "ipt>");
if (rawhtml.indexOf('</bo' + 'dy>') != -1) {
rawhtml=rawhtml.replace('</bo' + 'dy>', newscr + '</bo' + 'dy>');
} else {
rawhtml+=newscr;
}
if (document.getElementById('urlrel').value.trim().indexOf('/') == 0) {
url=decodeURIComponent(url.split('?')[0].split('#')[0]).replace('//','~~').split('/')[0].replace('~~','//') + document.getElementById('urlrel').value;
document.getElementById('myif').srcdoc=relative_to_absolute(rawhtml);
} else if (document.getElementById('urlrel').value.trim().indexOf('./') == 0) {
url=decodeURIComponent(url.split('?')[0].split('#')[0]).split('getComputedStyle_plus.')[0] + document.getElementById('urlrel').value.substring(2);
document.getElementById('myif').srcdoc=rawhtml;
} else if (document.getElementById('urlrel').value.trim().indexOf('../') == 0) {
if (decodeURIComponent(url.split('?')[0].split('#')[0]).indexOf('getComputedStyle_plus.') != -1) {
url=decodeURIComponent(url.split('?')[0].split('#')[0]).split('getComputedStyle_plus.')[0] + document.getElementById('urlrel').value;
document.getElementById('myif').srcdoc=relative_to_absolute(rawhtml);
} else if (decodeURIComponent(url.split('?')[0].split('#')[0]).slice(-1) == '/') {
url=decodeURIComponent(url.split('?')[0].split('#')[0]) + document.getElementById('urlrel').value;
document.getElementById('myif').srcdoc=relative_to_absolute(rawhtml);
} else {
url=decodeURIComponent(url.split('?')[0].split('#')[0]) + '/' + document.getElementById('urlrel').value;
document.getElementById('myif').srcdoc=relative_to_absolute(rawhtml);
}
} else {
url=document.getElementById('urlrel').value; //decodeURIComponent(url.split('?')[0].split('#')[0]);
if (url.indexOf('//') == -1) {
document.getElementById('myif').srcdoc=rawhtml;
} else {
document.getElementById('myif').srcdoc=relative_to_absolute(rawhtml);
}
}
document.getElementById('myif').style.display='block';
}
}
}

function doit() {
if (document.getElementById('urlrel').value.trim() == '' && document.getElementById('csspty').value.trim() != '') {
document.getElementById('urlrel').value='./getComputedStyle_plus.html';
}
if (document.getElementById('urlrel').value.trim() != '' && document.getElementById('csspty').value.trim() != '') {
zhr = new XMLHttpRequest();
zform = new FormData();
zform.append('calling', '');
zhr.responseType='Document';
zhr.onreadystatechange=stateChanged;
zhr.open('get', document.getElementById('urlrel').value, true);
zhr.send(zform);
}
}

// lasto=window.getComputedStyle(one);
// console.log(lasto.getPropertyValue(two));

</script>
</head>
<body>
<h1>Relative URL getComputedStyle Helper</h1>
<h3>RJM Programming - June, 2022</h3><br>
<input id=urlrel placeholder="Relative URL ( egs. ./colour_wheel.html or ./svg_clock.html or ./user_of_signature_signature.html )" value="" title="Relative URL" style="width:95%;"></input><br><br>
<input id=csspty placeholder="CSS property ( egs. height or font-size or color ) optionally comma separated" value="" title="CSS properties" style="width:95%;"></input><br><br><br>
<input type=button onclick="doit();" value="Show in Title Attributes Below" style="background-color:yellow;"></input><br>
<hr>
<br>
<iframe id=myif srcdoc='' style='display:none;width:100%;height:90vh;'></iframe>
</body>
</html>