// aboriginal_language_regions.js // Javascript to accompany aboriginal_language_regions.html // RJM Programming // June, 2015 // Audio via lead of https://www.google.com.au/search?q=warlpiri+audio&ie=utf-8&oe=utf-8&client=firefox-b-ab&gfe_rd=cr&ei=mj1BWJC-EtPr8AeniafgBw#q=warlpiri+audio&tbm=vid // YouTube via Iframe API //window.onload = doonload; var coords=new Array("979","176","1169","589","786","329","519","62","622","296","616","425","531","485","553","381","559","417","120","728","746","790","949","1065","906","900","880","886","888","858","977","814","1025","826","1045","766","1087","786","1103","756","1025","724","1093","700"); var places=new Array("Cooktown","Cooktown","Brisbane","Brisbane","Mount Isa","Mount Isa","Darwin","Darwin","Tennent Creek","Tennent Creek","Alice Springs","Alice Springs","Uluru","Uluru","Yuendemu","Yuendemu","Papunya","Papunya","Perth","Perth","Adelaide","Adelaide","Hobart","Hobart","Melbourne","Melbourne","Ballarat","Ballarat","Bendigo","Bendigo","Wagga Wagga","Wagga Wagga","Canberra","Canberra","Bathurst","Bathurst","Sydney","Sydney","Newcastle","Newcastle","Dubbo","Dubbo","Tamworth","Tamworth"); var geolls=new Array("145.2833","-15.4667","153.0333","-27.4667","139.5","-20.7333","130.8333","-12.45","134.2","-19.65","133.87","-23.7","131.0361","-25.345","131.7833","-22.25","131.9","-23.2167","115.8589","-31.9522","138.601","-34.929","147.325","-42.8806","144.9631","-37.8136","143.85","-37.55","144.2667","-36.75","147.3689","-35.1189","149.1244","-35.3075","149.5778","-33.42","151.2094","-33.865","151.75","-33.9167","148.6011","-32.2569","150.9167","-31.0833"); var cbmv=false; var cbbv=false; var url = "//www.rjmprogramming.com.au/PHP/Map/map.php?title=Dublin&label=['Lat',&value='Lon','Name']&data=,[53.3478,-6.2597,~Dublin~]"; var zhr = false; var xP, yP; var aurl; var myid; var myouru=""; var myu=""; var myusuffix=""; var globaltimer; var mapurl=""; var swin=null; var mytitle=""; var mytext=""; var mylatlong=""; var mylasttext=""; var popx=0, popy=0; var omode=0; var infois=""; // Thanks to https://www.liketly.com/forum/thread/24096/yql-and-javascript-failed/ for ideas var query = 'SELECT * FROM google.books WHERE q="kauri" AND maxResults=10'; var yqlAPI = '//query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent(query) + '&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=?'; var wasmyi='about:blank'; $(document).ready(function () { doonload(); getInfo(); }); function getInfo() { var dinfo=document.getElementById('infoWin'); $.getJSON(yqlAPI, function (r) { var first=true; //alert(98); $.each(r.query.results.json.items, function () { if (first) { infois=""; dinfo.style.border='2px blue dashed'; dinfo.style.backgroundColor='yellow'; } first=false; infois+=("" + this.volumeInfo.title); if (this.volumeInfo.imageLinks.thumbnail.indexOf("null") == -1) { infois+=(""); } infois+="

"; if (dinfo != null) { dinfo.innerHTML=infois; } }); //preInit(infois); }); } function reloadInfo(qis) { infois=""; yqlAPI = '//query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('SELECT * FROM google.books WHERE q="' + qis.toLowerCase() + '" AND maxResults=10') + ' &format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback='; getInfo(); } function preInit(pi) { infois=pi; myInit(); } function myInit() { var dinfo=document.getElementById('infoWin'); if (dinfo != null) { if (infois != "") { dinfo.innerHTML = infois; } } } function showIt(evt) { //if (mapurl != '') alert(mapurl); if (navigator.userAgent.toLowerCase().indexOf("ie") != (0 - 1)) { myu = mapurl; } else { try { myid = this; //evt.srcElement; myu = mapurl; } catch (eee) { myu = ""; } } //if (navigator.userAgent.toLowerCase().indexOf("ie") != (0 - 1)) alert(myid.value); getIt(evt); return false; } function hideIt(evt) { var pwis=document.getElementById("pWin"); if (pwis != null) { document.getElementById("pWin").style.visibility = "hidden"; //document.title='hidden'; if (navigator.userAgent.toLowerCase().indexOf("ie") != (0 - 1)) { var ps = document.getElementById('ppos'); ps.innerHTML = " "; } } } function getXMLHttpRequest() { if (window.XMLHttpRequest) { return new window.XMLHttpRequest; } else { try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (othermicrosoft) { try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (failed) { return false; } } } } function preshowIt(ev) { //alert('here'); globaltimer=setTimeout(function(){showIt(ev)}, 1000); } function posthideIt() { hideIt(); clearTimeout(globaltimer); } function getIt(evt) { if (myu.length > 0) { var myurl = myu; myu = ""; } else if (evt) { var myurl = mapurl; //"http://www.rjmprogramming.com.au/wordpress/?p=" + evt.id; } else { evt = window.event; var myurl = mapurl; //"http://www.rjmprogramming.com.au/wordpress/?p=" + myid.id; } myu = ""; aurl = myurl; if (navigator.userAgent.toLowerCase().indexOf("ie") != (0 - 1)) { xP = window.event.clientX; yP = window.event.clientY; popx = eval(xP.toString().replace("px","")); popy = eval(yP.toString().replace("px","")); popx += 250; //document.title=popx; } else { xP = evt.clientX; yP = evt.clientY; popx = eval(xP.toString().replace("px","")); popy = eval(yP.toString().replace("px","")); popx += 250; //document.title=popx; } zhr = getXMLHttpRequest(); if (zhr != null) { zhr = zhr; } else { try { zhr = new ActiveXObject("Msxml2.XMLHTTP"); } catch (othermicrosoft) { try { zhr = new ActiveXObject("Microsoft.XMLHTTP"); } catch (failed) { zhr = false; } } } //if (window.XMLHttpRequest) { // zhr = new XMLHttpRequest(); //} else { // if (window.ActiveXObject) { // try { // zhr = new ActiveXObject("Microsoft.XMLHTTP"); // } catch (ee) { } // } //} if (zhr) { myouru = myurl; zhr.open("GET", myurl, true); zhr.onreadystatechange = showMore; zhr.send(null); } else { alert("Sorry ... no XMLHttpRequest possible"); } } function showMore() { var pWin = document.getElementById('pWin'); if (pWin == null) { document.body.innerHTML += pWinIs(); pWin = document.getElementById('pWin'); } if (pWin != null) { var cbmoa=document.getElementById('cbma'); var cbmav=cbmoa.checked; if (zhr.readyState == 4) { if (zhr.status == 200 && mytext != "" && mytitle != "") { //document.title=zhr.responseText.substring(0,10); pWin.innerHTML = "



" + mytitle + "
" + mylatlong + "

"; //zhr.responseText; mytext=zhr.responseText; if (cbmav) setTimeout(swinit,3000); } else if (mytext != "" && mytitle != "") { pWin.innerHTML = "Problem " + aurl; } else if (zhr.status == 200) { mytext=zhr.responseText; if (cbmav) setTimeout(swinit,3000); } } if (navigator.userAgent.toLowerCase().indexOf("ie") != (0 - 1)) { pWin.style.top = parseInt(yP) + "px"; pWin.style.height = parseInt(xP) + "px"; } else { pWin.style.top = parseInt(yP) + "px"; } pWin.style.left = parseInt(xP) + "px"; //document.title='on'; if (pWin.innerHTML != "") pWin.style.visibility = "visible"; //document.title='on2'; pWin.onmouseout = hideIt; //document.title=aurl; } } function doit() { var cbmoa=document.getElementById('cbma'); var cbmav=cbmoa.checked; if (cbmav) { if (mytext.indexOf("html") != -1 && mytext != mylasttext) { if (swin != null) { swin.close(); swin=null; } if (document.URL.indexOf("localhost:8888") != -1 && 1 == 2) { swin=window.open("", mytitle, "top=" + popy + ",left=" + popx + ",height=450,width=410"); swin.document.write(mytext); } else { swin=window.open(myouru, mytitle, "top=" + popy + ",left=" + popx + ",height=450,width=410"); } //document.title="top=" + popy + ",left=" + popx; mylasttext=mytext; mytext=""; mytitle=""; } } } function swinit() { var pWin = document.getElementById('pWin'); if (pWin == null) { document.body.innerHTML += pWinIs(); pWin = document.getElementById('pWin'); } if (pWin != null) { if (pWin.style.visibility != 'hidden') { if (pWin.innerHTML.indexOf(mytitle) != -1) { doit(); } else if (mytitle != "" && mytext != "") { pWin.innerHTML = "

" + mytitle + "
" + mylatlong + "

"; pWin.style.visibility = "visible"; doit(); } } else if (mytitle != "" && mytext != "") { pWin.innerHTML = "

" + mytitle + "
" + mylatlong + "

"; pWin.style.visibility = "visible"; doit(); } //else { //alert(mytitle + " 99 " + mytext); //} } } function youtubeit() { wasmyi=document.getElementById('myij').src; document.getElementById('myij').src='//www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm'; } function doonload() { var was=document.body.innerHTML; var ah, ahspare, j; var is=""; if (was.indexOf("<" + "table") == -1) { var bits=was.split("Images  Videos  Books  Map (onclick)  Map (onhover)  Audio Search  YouTube  " + bits[0]; for (var i=1; i"); //alert(ah[0]); if (ah[0].indexOf(">") != -1) { ahspare = ah[0].split(">"); is += " 1) is += ah[1]; } else { is += "' + ah[1]; } } is += ""; document.body.innerHTML = is; myInit(); // Ajax functionality at onload } } function iframeurl(atitle, inx, iny, mode) { var ii=0, jj, vsdist=-1.0, thisdist=0.0, closestis=-1, nextis=-1, closestc="", nextc=""; var closestx, closesty, closestlong, closestlat; var nextx, nexty, nextlong, nextlat; for (ii=0; ii 1) { mytitle=atitle[1]; var geog=atitle[0].split(","); //alert(geog); var geos=iframeurl(atitle[1], geog[0], geog[1], 1); //alert(geos); var geol=geos.split(","); if (eval(geol[0]) >= 0.0) prelat = "+"; if (eval(geol[1]) >= 0.0) preling = "+"; mapurl="//maps.google.com/maps?z=15&t=m&q=loc:" + prelat + geol[0] + prelong + geol[1]; if (document.URL.indexOf("localhost:8888") != -1) { mapurl="http://localhost:8888/PHP/Map/map.php?title=" + atitle[1].replace(/\ /g, "%20") + "&label=['Lat',&value='Lon','Name']&data=,[" + geol[0] + "," + geol[1] + ",~" + atitle[1].replace(/\ /g, "%20") + "~]"; } else { mapurl="//www.rjmprogramming.com.au/PHP/Map/map.php?title=" + atitle[1].replace(/\ /g, "%20") + "&label=['Lat',&value='Lon','Name']&data=,[" + geol[0] + "," + geol[1] + ",~" + atitle[1].replace(/\ /g, "%20") + "~]"; } mylatlong="Latitude: " + eval(geol[0]).toFixed(4) + "°
" + " Longitude: " + eval(geol[1]).toFixed(4) + "°"; //mylatlong="Latitude: " + eval(geol[0]) + "°" + " Longitude: " + eval(geol[1]) + "°"; //var cbmoa=document.getElementById('cbma'); //var cbmav=cbmo.checked; //if (cbmav) { showIt(evt); //} } } } function oc(coordsare) { var ii=0, jj=3, kk=2; if (1 == 2) alert(coordsare); var words=coordsare.split(" "), avx=0.0, avy=0.0; for (ii=0; ii= 4) { var cbmaav, cbmaao=document.getElementById('cbmaa'); var cbmayv, cbmayo=document.getElementById('cbmay'); cbmayv=cbmayo.checked; cbmaav=cbmaao.checked; var tsuffix=""; if (cbmaav) tsuffix+=' audio'; var cbmo=document.getElementById('cbm'); cbmv=cbmo.checked; var care=words[jj].replace(/\ /g,"").replace("coords_~", "").replace("~ ", ",").replace("~", ",").split(","); var title=words[1].replace("title_~", "").replace("alt_~", "").replace(/\~/g, ' '); //alert(words[1]); while (words[kk].indexOf("_~") == -1 && kk < words.length && kk > 0) { if (words[kk].replace(/\~/g, '') != "") title+=(" " + words[kk].replace(/\~/g, '')); kk++; if (kk >= words.length) kk = 0; } if (cbmv && 1 == 2) alert(words[jj].replace("coords_~", "").replace("~ ", ",").replace("~", ",") + " " + care[0] + "," + care[1]); for (ii=0; ii