<!doctype html>
<!--[if IE 7 ]> <html class="no-js ie ie7 lte7 lte8 lte9" lang="en-US"> <![endif]-->
<!--[if IE 8 ]> <html class="no-js ie ie8 lte8 lte9" lang="en-US"> <![endif]-->
<!--[if IE 9 ]> <html class="no-js ie ie9 lte9>" lang="en-US"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->
<head data-live-domain="api.jquery.com">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

<title>Acronym Deciphering via jQuery.ajax() - RJM Programming - 2015</title>

<meta name="author" content="jQuery Foundation - jquery.org">
<meta name="description" content="jQuery: The Write Less, Do More, JavaScript Library">

<meta name="viewport" content="width=device-width">

<link rel="shortcut icon" href="HTTP://api.jquery.com/jquery-wp-content/themes/api.jquery.com/i/favicon.ico">

<link rel="stylesheet" href="HTTP://api.jquery.com/jquery-wp-content/themes/jquery/css/base.css?v=1">
<link rel="stylesheet" href="HTTP://api.jquery.com/jquery-wp-content/themes/api.jquery.com/style.css">
<link rel="pingback" href="//api.jquery.com/xmlrpc.php" />
<!--[if lt IE 7]><link rel="stylesheet" href="css/font-awesome-ie7.min.css"><![endif]-->

<script src="HTTP://api.jquery.com/jquery-wp-content/themes/jquery/js/modernizr.custom.2.6.2.min.js"></script>

<script src="HTTP://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>window.jQuery || document.write(unescape('%3Cscript src="HTTP://api.jquery.com/jquery-wp-content/themes/jquery/js/jquery-1.9.1.min.js"%3E%3C/script%3E'))</script>

<script src="HTTP://api.jquery.com/jquery-wp-content/themes/jquery/js/plugins.js"></script>
<script src="HTTP://api.jquery.com/jquery-wp-content/themes/jquery/js/main.js"></script>

<script src="//use.typekit.net/wde1aof.js"></script>
<script>try{Typekit.load();}catch(e){}</script>


<style>

table { border-collapse: collapse; }

tr.even { background-color: #C2C8D4; }

tr.over { background-color: #8797B7; }

td {
border-bottom: 1px solid #C2C8D4;
padding: 5px;
}

th {
border-right: 2px solid #FFF;
color: #FFF;
padding-right: 40px;
padding-left: 20px;
background-color: #626975;

}

th.sortUp {
background: #626975 url(//www.rjmprogramming.com.au/Javascript/jQuery/SortableTable/jquery/images/asc.gif) no-repeat right center;
}

th.sortDown {
background: #626975 url(//www.rjmprogramming.com.au/Javascript/jQuery/SortableTable/jquery/images/desc.gif) no-repeat right center;
}

td { vertical-align: top; }
th { vertical-align: top; }

</style>

<script type="text/javascript" src="//www.rjmprogramming.com.au/Javascript/jQuery/SortableTable/jquery/jquery-latest.js"></script>
<script type="text/javascript" src="//www.rjmprogramming.com.au/Javascript/jQuery/SortableTable/jquery/jquery.tablesorter.js"></script>


<script type='text/javascript' src='//api.jquery.com/wp-includes/js/comment-reply.min.js?ver=3.8'></script>
<meta name="generator" content="WordPress 3.8" />

<link href='//www.rjmprogramming.com.au/PHP/emboss_h1.css' rel='stylesheet' type='text/css'>

<script type="text/javascript">
var lastvs='';

var trclass="odd";

var f400 = location.search.split('topoff=')[1] ? location.search.split('topoff=')[1].split('&')[0] : '400';

$(document).ready(function() {
$('tr').mouseover(function() {
$(this).addClass('over');
});
$('tr').mouseout(function() {
$(this).removeClass('over');
});
$('tr:even').addClass('even');
$('#myt').tablesorter({
sortList:[[1,0]],
cssAcc: 'sortUp',
cssDesc: 'sortDown',
widgets: ['zebra']
});
});

function bwikifv() {
document.getElementById('wikif').style.visibility='visible';
location.href='#awikif';
}

function windowopen(a, b) {
bwikifv();
return window.open(a, b);
}

function wikilinkit(inwds) {
return "<a target=wikif onclick=bwikifv(); onmouseover=\"window.open('//en.wikipedia.org/wiki/" + inwds.toLowerCase().replace(/\ /g,'_') + "','wikif');\" href='//en.wikipedia.org/wiki/" + inwds.toLowerCase().replace(/\ /g,'_') + "'>" + inwds + "</a>";
}

function getacronym(vsselname) {
if (window.opener) {
window.opener.document.getElementById('acronym').value=vsselname;
window.opener.getacronym(vsselname);
//alert('here being supervised');
} else {
var stable=document.getElementById('content').innerHTML;
var goes=stable.split("<table");
if (stable.indexOf("</tbody>" + "</table>") == -1) stable = goes[0];
if (vsselname != "" && vsselname.toUpperCase() != lastvs.toUpperCase()) {
lastvs=vsselname;
vsselname = vsselname.replace(/[.]/g, "").toUpperCase();
$.ajax({ url: "getacronymdata.php",
data: {"SELNAME":vsselname},
type: 'get',
success: function(output) {
if (output.replace(" type='text/javascript'", "").indexOf("script>") != -1) {
var w = window.open();
w.document.open();
var bits=output.split('</td><td>');
for (var ij=(-2 + bits.length); ij>1; ij--) {
if ((bits[ij] + ' ').substring(0,1).toUpperCase() >= 'A' && (bits[ij] + ' ').substring(0,1).toUpperCase() <= 'Z') {
output=output.replace('</td><td>' + bits[ij] + '</td><td>', '</td><td>' + wikilinkit(bits[ij]) + '</td><td>');
}
}
//alert(output.split('<bo' + 'dy')[1]);
w.document.write(output.replace('vis' + 'ible','VIS' + 'ible').replace('hid' + 'den','VIS' + 'IBLE').replace('hid' + 'den','VIS' + 'IBLE').replace('hid' + 'den','VIS' + 'IBLE').replace('hid' + 'den','VIS' + 'IBLE'));
w.document.close();
//document.write(output);
//var bits=output.replace(" type='text/javascript'", "").replace("</" + "script>", "script>").split("script>");
//eval(bits[1].replace("var ", " ").replace("function onl() {", "").replace("}", ""));
//document.getElementById('content').innerHTML = stable;
} else {
var objJSON = JSON.parse(output.replace("}]}]}]", "}]}]}").replace("[",""));
var i;
if (output != "[]") {
if (stable.indexOf("</tbody>" + "</table>") == -1) stable = stable + "<table id='myt' class='tablesorter' cellpadding=5 cellspacing=5 style='border: 3px solid green;vertical-align:top;'><thead><tr class='even'><th class='header'>Title</th><th class='header'>Frequency</th><th class='header sortDown'>Since</th></tr></thead><tbody></tbody>" + "</table>";
for (i=0; i<objJSON.lfs.length; i++) {
if (stable.indexOf(">" + objJSON.lfs[i].lf + "</td") == -1) {
stable = stable.replace("</tbody>" + "</table>" , "<tr class='" + trclass + "'><td>" + wikilinkit(objJSON.lfs[i].lf) + "</td><td>" + objJSON.lfs[i].freq + "</td><td>" + objJSON.lfs[i].since + "</td></tr></tbody>" + "</table>");
trclass = trclass.replace("even", "oxdd").replace("odd", "exven").replace("x", "");
}
}
}
document.getElementById('content').innerHTML = stable;
}
}
});
}
document.getElementById('content').innerHTML = stable;
}
}

function okd(event) { // thanks to https://stackoverflow.com/questions/15355948/preventing-tab-to-cycle-through-address-bar
if ((event.keyCode == 9 || event.keyCode == 13 || event.keyCode == 10) && event.shiftKey == false) {
getacronym(event.target.value); // rejoin onblur event logic
}
}

function checkhs() {
var ltr=document.getElementById('myt').getBoundingClientRect();
var rtr=document.getElementById('wikif').getBoundingClientRect();
if (rtr.height < ltr.height) {
document.getElementById('wikif').style.height='' + eval(-10 + ltr.height) + 'px';
}
}


$(document).ready(function() {
$("tr").mouseover(function() {
$(this).addClass("over");
});
$("tr").mouseout(function() {
$(this).removeClass("over");
});
$("tr:even").addClass("even");
$("#myt").tablesorter({
sortList:[[0,0]],
cssAcc: "sortUp",
cssDesc: "sortDown",
widgets: ["zebra"]
});
});

</script>
</head>
<body onload=" checkhs(); document.getElementById('acronym').focus(); " style=" background-color: yellow;" class="api jquery single single-post postid-291 single-format-standard single-author singular">
<div align="center" style=" width:100%; background-color: lightblue; background: url('getacronym.jpg') repeat;">
<h1 id=myh1 align="center"> Acronym Lookup</h1>
<!--form method="post" style=" background-color: yellow;"-->
<div align="center"> <a target=_blank title='NaCTeM dictionary' href='//www.nactem.ac.uk/software/acromine/'>Acronym</a><a target=_blank title='NaCTeM' href='//www.nactem.ac.uk/'>:</a> <input placeholder="Add space for AppML" style=" background-color: pink; visibility:visible;" type="text" name="acronym" id="acronym" onkeydown="okd(event);" onblur=" getacronym(this.value);" /></div><br><br>
<!--/form-->
</div>
<div align="center" id="content" style=" width:100%; height: 600px; background-color: yellow; vertical-align: top;">

Results go below ...<br>


<table id='myt' class='tablesorter' cellpadding=5 cellspacing=5 style='border: 3px solid green; display: inline-block; visibility:hidden;vertical-align:top;'><thead><tr class='even'><th class='header'></th><th class='header sortDown'>Meaning</th><th class='header'>Frequency</th><th class='header'>Since</th></tr></thead><tbody id='tbody'></tbody></table><table style='display:inline-block;width:60%;'><tr><td><td style='vertical-align:top;'><a id=awikif href=#myh1 title=Top>^</a><br><iframe name=wikif id=wikif src='' style='display:inline-block;height:580px;width:600px;vertical-align:top;visibility:hidden;'></iframe></td></tr></table>
</div>
<input type=text style='position:absolute;top:-200px;left:-200px;' value=''></input>
</body>

</html>