1) { $outstuff=$instuff; for ($ii=1; $ii 3) { $outstuff=str_replace('.' . explode(',', explode(' ', $dotbits[$ii])[0])[0], '.' . substr(explode(',', explode(' ', $dotbits[$ii])[0])[0],0,3), $outstuff); } } return urlencode($outstuff); } return urlencode($instuff); } if (isset($_GET['zoom'])) { if (strlen(str_replace('+','',urldecode($_GET['zoom']))) > 0) { $factor=str_replace('+','',urldecode($_GET['zoom'])); } } if (isset($_GET['uselatlaong'])) { $dolatlong=true; $longoff=0.0; $latoff=0.0; } else if (file_exists('regions.html')) { if ($factor != 1.0) { echo str_replace("function onl() {", "function onl() { \n document.body.style.zoom=((izoom == 1.0) ? ('' + eval(izoom * 100.0) + '%') : '" . (100.0 * $factor) . "%'); \n ", file_get_contents('regions.html')); exit; } else { echo file_get_contents('regions.html'); exit; } } if (file_exists('population.geojson')) { $rbits=explode(']}}', file_get_contents('./population.geojson')); for ($irr=1; $irr<(-1 + sizeof($rbits)); $irr++) { $hdrbit=explode('{"type":"Feature', $rbits[-1 + $irr])[-1 + sizeof(explode('{"type":"Feature', $rbits[-1 + $irr]))]; $hbits=explode(',"NAME":"', $hdrbit); if (sizeof($hbits) > 1) { if (strpos($sih, ' id=' . str_replace('+','%20',urlencode(explode('"', $hbits[1])[0])) . ' ') === false) { $sih.=''; } } } } if (file_exists('rivers.geojson')) { $rbits=explode(']]}}', file_get_contents('./rivers.geojson')); for ($irr=1; $irr<(-1 + sizeof($rbits)); $irr++) { $hdrbit=explode('{"type":"Feature', $rbits[-1 + $irr])[-1 + sizeof(explode('{"type":"Feature', $rbits[-1 + $irr]))]; $hbits=explode(',"name":"', $hdrbit); if (sizeof($hbits) > 1) { if (strpos($sih, 'id=river' . str_replace('+','%20',urlencode(explode('"', $hbits[1])[0])) . '>') === false) { $rih.=''; } else { $rih=str_replace(' id=river' . str_replace('+','%20', oururlencode(explode('"', $hbits[1])[0])) . '>', str_replace('+','%20', urlencode(str_replace('[','', str_replace(']','', str_replace('],[', ',', str_replace(']],[[', ' ', explode(']]}', explode(':[[',$hdrbit)[1])[0])))))) . ' id=river' . str_replace('+','%20',urlencode(explode('"', $hbits[1])[0])) . '>', $rih); } } } } // Create a transparent image thanks to https://www.php.net/manual/en/function.imagecolortransparent.php $im = imagecreatetruecolor((360.0 * $factor), (180.0 * $factor)); $black = imagecolorallocate($im, 0, 0, 0); // Make the background transparent imagecolortransparent($im, $black); // Save the image $udirnameprebimg='/tmp/imagecolortransparent.png'; imagepng($im, $udirnameprebimg); $duis='data:image/' . str_replace('jpg','jpeg',strtolower(explode('.',$udirnameprebimg)[-1 + sizeof(explode('.',$udirnameprebimg))])) . ';base64,' . base64_encode(file_get_contents($udirnameprebimg)); imagedestroy($im); unlink($udirnameprebimg); $htmlis="Display GeoJSON Coastline var jzoom=1.0, izoom=location.search.split('zoom=')[1] ? eval(decodeURIComponent(location.search.split('zoom=')[1].split('&')[0])) : 1.0; var lastl='', longlastl='', elem=null, context=null, thislat=0.0, thisong=0.0, mapwo=null; var yourtzlist=''; var rivers='', arivers=[], iguess=-1, isofar=' ', jscore=0, jgoes=0, elema=null, contexta=null, rectisleft=0, rectistop=0; var populations='', apopulations=[], jguess=-1, jsofar=' ', isokto=true, both=false, jlastn='', idone=false; function onl() { if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) document.getElementById('srivs').innerHTML=''; if (izoom != 1.0) document.body.style.zoom=('' + eval(izoom * 100.0) + '%'); elem = document.getElementById('mycanvas'); elem.style.cursor='progress'; elema = document.getElementById('myacanvas'); context = elem.getContext('2d'); contexta = elema.getContext('2d'); context.strokeStyle = '#000000'; context.lineWidth = 0.4; } "; $midbit=" const confirm = (cblurb) => { if (cblurb.indexOf('Answer was ') != -1 && cblurb.indexOf('. ') != -1) { var resp=prompt(cblurb.replace(cblurb.split('Answer was ')[1].split('. ')[0] + '. ', cblurb.split('Answer was ')[1].split('. ')[0] + ' (answer W to see more information on Wikipedia). '), ''); if (resp != null) { if (resp.toLowerCase() == 'w') { window.open('//en.wikipedia.org/wiki/' + cblurb.split('Answer was ')[1].split('. ')[0].replace(/\ /g,'_'), '_blank', 'top=70,left=70,width=650,height=650'); return true; } return true; } else { return false; } } return window.confirm(cblurb); }; function ouralert(inclist) { if (inclist.indexOf(',') != -1) { var cls=inclist.replace('Longitude,Latitude coordinates are ','').split(','); longlastl=inclist; document.getElementById('ntz').value=''; //document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent(cls[1]) + '&longitude=' + encodeURIComponent(cls[0]) + '&ntztontz=y'; //setTimeout(lookforntz, 1000); } } function drawc(centerX, centerY) { var topllong=-180.0; var topllat=90.0; var onepixelequals=izoom; if (centerX > eval(izoom * elem.width) || centerY > eval(izoom * elem.height)) return false; context.beginPath(); context.globalAlpha = 0.5; context.arc(centerX, centerY, 1, 0, 2 * Math.PI, false); context.fillStyle = 'green'; context.fill(); context.lineWidth = 5; context.lineWidth = 2; context.strokeStyle = '#003300'; context.stroke(); return true; } function callmap(inintzl) { var intzl=inintzl; var thisplace=-1; var places=['', '', '']; var mapurl=\"//www.rjmprogramming.com.au/PHP/Map/map.php?title=Nearby%20TimeZone%20Places&onclick=y&label=['Lat',&value='Lon','Name']&data=,[\" + thislat + \",\" + thislong + \",~Your%20Place~]\"; var tzs=['', '', '']; var lats=[0, 0, 0]; var longs=[0, 0, 0]; var ioff=0, joff=0; var wasp=''; var prefix=''; var tzls=intzl.split('/'); if (eval('' + tzls.length) > 3) { for (var ih=0; ih<3; ih++) { if (tzls[eval(1 + ih + ioff)].indexOf(' ') == -1) { prefix='/' + tzls[eval(1 + ih + ioff)] + '/'; joff++; } else { prefix='/'; } thisplace=-1; while (tzls[eval(0 + ih + ioff)].slice(thisplace).substring(0,1) != '.' && tzls[eval(0 + ih + ioff)].slice(thisplace).substring(0,1) != ' ') { wasp=prefix; prefix=tzls[eval(0 + ih + ioff)].slice(thisplace).substring(0,1) + wasp; //alert('IH=' + ih + ' and prefix=' + prefix + ' ' + tzls[eval(0 + ih + ioff)].slice(thisplace)); thisplace--; } //alert('ih=' + ih + ' and prefix=' + prefix); places[ih]=prefix; tzs[ih]=prefix; thisplace=1; ioff=joff; while (tzls[eval(1 + ih + ioff)].substring(0,thisplace).slice(-1) != '.' && tzls[eval(1 + ih + ioff)].substring(0,thisplace).slice(-1) != ' ') { places[ih]+=tzls[eval(1 + ih + ioff)].substring(0,thisplace).slice(-1); tzs[ih]+=tzls[eval(1 + ih + ioff)].substring(0,thisplace).slice(-1); thisplace++; } //alert('ih=' + ih + ' and thisplace=' + thisplace + ' and tzs[]=' + tzs[eval(0 + ih)] + ' and yourtzlist=' + yourtzlist); if (tzls[eval(1 + ih + ioff)].indexOf(' is ') != -1) { places[ih]+=(' in ' + ('' + tzls[eval(1 + ih + ioff)].substring(thisplace).split(' is ')[0]).replace(' in ','').replace(' in ','').replace(' in ','').replace(' in ','')).replace(' in in ',' in '); } if (yourtzlist.indexOf(tzs[ih]) != -1) { mapurl+=',[' + yourtzlist.split(tzs[ih])[1].split('=')[1].split(',')[0].replace(String.fromCharCode(34),'') + ',' + yourtzlist.split(tzs[ih].replace(/America\!Argentina\//g, 'America/Argentina/'))[1].split('=')[1].split(',')[1].replace(String.fromCharCode(34),'') + ',~' + encodeURIComponent(places[ih].replace(/America\!Argentina\//g, 'America/Argentina/')) + '~]'; } } if (mapwo) { if (!mapwo.closed) { mapwo.close(); mapwo=null; } //alert(mapurl); var rectm=document.getElementById('mycanvas').getBoundingClientRect(); document.getElementById('geomaps').style.position='absolute'; document.getElementById('geomaps').style.left='0px'; document.getElementById('geomaps').style.top='' + eval(50 + rectm.height) + 'px'; document.getElementById('geomaps').style.display='block'; document.getElementById('mapchart').style.display='block'; document.getElementById('lpcwheel').style.width='500px'; document.getElementById('pcwheel').style.width='' + eval(-520 + screen.width) + 'px'; document.getElementById('mapchart').src=mapurl; //mapwo=window.open(mapurl, 'mapchart'); //, 'top=20,left=20,width=' + eval(-40 + screen.width) + ',height=' + eval(-40 + screen.height)); } else { var rectmm=document.getElementById('mycanvas').getBoundingClientRect(); document.getElementById('geomaps').style.position='absolute'; document.getElementById('geomaps').style.left='0px'; document.getElementById('geomaps').style.top='' + eval(50 + rectmm.height) + 'px'; document.getElementById('geomaps').style.display='block'; document.getElementById('mapchart').style.display='block'; document.getElementById('lpcwheel').style.width='500px'; document.getElementById('pcwheel').style.width='' + eval(-520 + screen.width) + 'px'; document.getElementById('mapchart').src=mapurl; //mapwo=window.open(mapurl, 'mapchart'); //, 'top=20,left=20,width=' + eval(-40 + screen.width) + ',height=' + eval(-40 + screen.height)); } } } function withinit(abi) { var outi=''; var putin=true; for (var ii=0; ii') { putin=true; if (outi != '') { outi+=' '; } } else if (putin) { outi+=abi.substring(ii).substring(0,1); } } return outi.replace('rror :', 'rror:'); } function checkif(iois) { var morehuh=false; var what='', ourabi=''; var ourl=lastl; var ourlong=longlastl; if (iois.src.indexOf('tz_places.php') != -1) { var aconto = (iois.contentWindow || iois.contentDocument); if (aconto != null) { if (aconto.document) { aconto = aconto.document; } ourabi='' + aconto.body.innerHTML; if (aconto.body != null) { lastl=''; longlastl=''; if (ourlong != '') { what=withinit(ourabi).replace(/\)/g,') '); if (what.indexOf('rror:') != -1) { alert(what + ' ' + ourlong); } else if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { morehuh=confirm(what + ' See these on a map? ' + ourlong); } else { morehuh=confirm(what + ' See these on a map? '); } } else { what=withinit(ourabi).replace(/\)/g,') '); if (what.indexOf('rror:') != -1) { alert(what.replace(/\)/g,') ') + ' ' + ourl); } else if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { morehuh=confirm(what.replace(/\)/g,') ') + ' See these on a map? ' + ourl); } else { morehuh=confirm(what.replace(/\)/g,') ') + ' See these on a map? '); } } } } } if (morehuh) { callmap(what); } } function oldcanvasclick(e) { var topllong=-180.0; var topllat=90.0; var onepixelequals=izoom; //document.title='canvasclick'; e = e || window.event; e.preventDefault(); if (e.touches) { if (e.touches[0].pageX) { //lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.touches[0].pageX * onepixelequals) + ',' + eval(topllat - e.touches[0].pageY * onepixelequals); drawc(e.touches[0].pageX, e.touches[0].pageY); thislat=eval(topllat - e.touches[0].pageY * onepixelequals); thislong=eval(topllong + e.touches[0].pageX * onepixelequals); document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + eval(topllat - e.touches[0].pageY * onepixelequals)) + '&longitude=' + encodeURIComponent('' + eval(topllong + e.touches[0].pageX * onepixelequals)) + '&ntztontz=y'; } else { //lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.touches[0].clientX * onepixelequals) + ',' + eval(topllat - e.touches[0].clientY * onepixelequals); drawc(e.touches[0].clientX, e.touches[0].clientY); thislat=eval(topllat - e.touches[0].clientY * onepixelequals); thislong=eval(topllong + e.touches[0].clientX * onepixelequals); document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + eval(topllat - e.touches[0].clientY * onepixelequals)) + '&longitude=' + encodeURIComponent('' + eval(topllong + e.touches[0].clientX * onepixelequals)) + '&ntztontz=y'; } } else if (e.clientX || e.clientY) { //lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.clientX * onepixelequals) + ',' + eval(topllat - e.clientY * onepixelequals); drawc(e.pageX, e.pageY); thislat=eval(topllat - e.pageY * onepixelequals); thislong=eval(topllong + e.pageX * onepixelequals); document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + eval(topllat - e.clientY * onepixelequals)) + '&longitude=' + encodeURIComponent('' + eval(topllong + e.clientX * onepixelequals)) + '&ntztontz=y'; } else { //lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.pageX * onepixelequals) + ',' + eval(topllat - e.pageY * onepixelequals); drawc(e.clientX, e.clientY); thislat=eval(topllat - e.clientY * onepixelequals); thislong=eval(topllong + e.clientX * onepixelequals); document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + eval(topllat - e.pageY * onepixelequals)) + '&longitude=' + encodeURIComponent('' + eval(topllong + e.pageX * onepixelequals)) + '&ntztontz=y'; } } function canvasclick(e) { var topllong=-180.0; var topllat=90.0; var onepixelequals=izoom; //document.title='canvasclick'; e = e || window.event; e.preventDefault(); if (e.touches) { if (e.touches[0].pageX) { //lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.touches[0].pageX * onepixelequals) + ',' + eval(topllat - e.touches[0].pageY * onepixelequals); if (drawc(e.touches[0].pageX, e.touches[0].pageY)) { //thislat=eval(topllat - e.touches[0].pageY * onepixelequals); //thislong=eval(topllong + e.touches[0].pageX * onepixelequals); thislat=eval(topllat - eval(-rectistop + e.touches[0].pageY) * onepixelequals); thislong=eval(topllong + eval(-rectisleft + e.touches[0].pageX) * onepixelequals); document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + thislat) + '&longitude=' + encodeURIComponent('' + thislong) + '&ntztontz=y'; } } else { //lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.touches[0].clientX * onepixelequals) + ',' + eval(topllat - e.touches[0].clientY * onepixelequals); if (drawc(e.touches[0].clientX, e.touches[0].clientY)) { //thislat=eval(topllat - e.touches[0].clientY * onepixelequals); //thislong=eval(topllong + e.touches[0].clientX * onepixelequals); thislat=eval(topllat - eval(-rectis.top + e.touches[0].clientY) * onepixelequals); thislong=eval(topllong + eval(-rectis.left + e.touches[0].clientX) * onepixelequals); document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + thislat) + '&longitude=' + encodeURIComponent('' + thislong) + '&ntztontz=y'; } } } else if (e.pageX || e.pageY) { //lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.clientX * onepixelequals) + ',' + eval(topllat - e.clientY * onepixelequals); if (drawc(e.pageX, e.pageY)) { //thislat=eval(topllat - e.pageY * onepixelequals); //thislong=eval(topllong + e.pageX * onepixelequals); thislat=eval(eval(eval(topllat * onepixelequals - eval(-rectistop + e.pageY) * 1)) / onepixelequals); thislong=eval(eval(eval(topllong * onepixelequals + eval(-rectisleft + e.pageX) * 1)) / onepixelequals); document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + thislat) + '&longitude=' + encodeURIComponent('' + thislong) + '&ntztontz=y'; } } else { //lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.pageX * onepixelequals) + ',' + eval(topllat - e.pageY * onepixelequals); if (drawc(e.clientX, e.clientY)) { thislat=eval(topllat - e.clientY * onepixelequals); thislong=eval(topllong + e.clientX * onepixelequals); document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + thislat) + '&longitude=' + encodeURIComponent('' + thislong) + '&ntztontz=y'; } } } function defclick(e) { canvasclick(e); return true; var topllong=-180.0; var topllat=90.0; var onepixelequals=izoom; //document.title='defclick'; e = e || window.event; e.preventDefault(); if (e.touches) { if (e.touches[0].pageX) { lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.touches[0].pageX * onepixelequals) + ',' + eval(topllat - e.touches[0].pageY * onepixelequals); drawc(e.touches[0].pageX, e.touches[0].pageY); thislat=eval(topllat - e.touches[0].pageY * onepixelequals); thislong=eval(topllong + e.touches[0].pageX * onepixelequals); document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + eval(topllat - e.touches[0].pageY * onepixelequals)) + '&longitude=' + encodeURIComponent('' + eval(topllong + e.touches[0].pageX * onepixelequals)) + '&ntztontz=y'; } else { lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.touches[0].clientX * onepixelequals) + ',' + eval(topllat - e.touches[0].clientY * onepixelequals); drawc(e.touches[0].clientX, e.touches[0].clientY); thislat=eval(topllat - e.touches[0].clientY * onepixelequals); thislong=eval(topllong + e.touches[0].clientX * onepixelequals); document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + eval(topllat - e.touches[0].clientY * onepixelequals)) + '&longitude=' + encodeURIComponent('' + eval(topllong + e.touches[0].clientX * onepixelequals)) + '&ntztontz=y'; } } else if (e.clientX || e.clientY) { lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.clientX * onepixelequals) + ',' + eval(topllat - e.clientY * onepixelequals); drawc(e.pageX, e.pageY); thislat=eval(topllat - e.pageY * onepixelequals); thislong=eval(topllong + e.pageX * onepixelequals); document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + eval(topllat - e.clientY * onepixelequals)) + '&longitude=' + encodeURIComponent('' + eval(topllong + e.clientX * onepixelequals)) + '&ntztontz=y'; } else { lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.pageX * onepixelequals) + ',' + eval(topllat - e.pageY * onepixelequals); drawc(e.clientX, e.clientY); thislat=eval(topllat - e.clientY * onepixelequals); thislong=eval(topllong + e.clientX * onepixelequals); document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + eval(topllat - e.pageY * onepixelequals)) + '&longitude=' + encodeURIComponent('' + eval(topllong + e.pageX * onepixelequals)) + '&ntztontz=y'; } } function areado() { var ars=document.getElementsByTagName('area'); var cs=[]; for (var ij=0; ij= 2) { ars[ij].coords+=',' + cs[0] + ',' + cs[1]; } } } function plotarivervia(aname, thecontent) { var found=-1, ifnd=0; var rbits=thecontent.split(']]}}'); var murraytotal=0.0; llist=''; thecontent=''; var hdrbit='', hbits=[]; lastn=''; for (var irr=1; irr<(-1 + rbits.length); irr++) { hdrbit=rbits[-1 + irr].split('{' + String.fromCharCode(34) + 'type' + String.fromCharCode(34) + ':' + String.fromCharCode(34) + 'Feature')[eval(-1 + rbits[-1 + irr].split('{' + String.fromCharCode(34) + 'type' + String.fromCharCode(34) + ':' + String.fromCharCode(34) + 'Feature').length)] + ''; //alert(hdrbit); hbits=hdrbit.split(',' + String.fromCharCode(34) + 'name' + String.fromCharCode(34) + ':' + String.fromCharCode(34) + aname + String.fromCharCode(34)); if (hbits.length > 1) { //if ((!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i) || eval('' + arivers.length) <= 200)) { if (lastn != aname) { lastn=aname; found=-1; if (arivers.length > 0) { for (ifnd=0; ifnd= 0) { //if (lastn == 'Murray') { // console.log(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); //} if (1 == 1 || !navigator.userAgent.match(/Android|BlackBerry|iPhone|iPaJUNJKd|iPod|Opera Mini|IEMobile/i)) { llist+=' ' + lessit(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); } } else { //if (lastn == 'Murray') { // console.log(lastn + ':' + hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); //} llist=(lastn + ':' + lessit(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,''))); } } else if (1 == 1 || !navigator.userAgent.match(/Android|BlackBerry|iPhone|iPaJUNKd|iPod|Opera Mini|IEMobile/i)) { //if (lastn == 'Murray') { // console.log(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); //} llist+=' ' + lessit(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); } //} } } plottheriver(found, llist) } function populateriversvia(ts) { if (document.getElementById('srivs').innerHTML.trim() == '') { var found=-1, ifnd=0; var rbits=ts.split(']]}}'); var murraytotal=0.0; var hdrbit='', hbits=[]; lastn=''; for (var irr=1; irr<(-1 + rbits.length); irr++) { hdrbit=rbits[-1 + irr].split('{' + String.fromCharCode(34) + 'type' + String.fromCharCode(34) + ':' + String.fromCharCode(34) + 'Feature')[eval(-1 + rbits[-1 + irr].split('{' + String.fromCharCode(34) + 'type' + String.fromCharCode(34) + ':' + String.fromCharCode(34) + 'Feature').length)] + ''; //alert(hdrbit); hbits=hdrbit.split(',' + String.fromCharCode(34) + 'name' + String.fromCharCode(34) + ':' + String.fromCharCode(34)); if (hbits.length > 1) { if ((!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPaJUNKd|iPod|Opera Mini|IEMobile/i) || eval('' + arivers.length) <= 200)) { if (lastn != hbits[1].split(String.fromCharCode(34))[0]) { lastn=hbits[1].split(String.fromCharCode(34))[0]; found=-1; if (arivers.length > 0) { for (ifnd=0; ifnd= 0) { //if (lastn == 'Murray') { // console.log(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); //} if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPaJUNKd|iPod|Opera Mini|IEMobile/i)) { arivers[found]+=' ' + lessit(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); } } else { //if (lastn == 'Murray') { // console.log(lastn + ':' + hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); //} arivers.push(lastn + ':' + lessit(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,''))); } } else if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPaJUNKd|iPod|Opera Mini|IEMobile/i)) { //if (lastn == 'Murray') { // console.log(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); //} arivers[-1 + arivers.length]+=' ' + lessit(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); } } } } rbits=[]; if (document.getElementById('srivs').innerHTML.trim() != '') { arivers=[]; } } lastn=''; //if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { // alert(arivers.length); //} //return; //plotariver(getariver()); if (!idone) { idone=true; if (document.getElementById('srivs').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { getapopulation(); } else { getariver(); } } } function populaterivers() { if (document.getElementById('srivs').innerHTML.trim() == '') { var found=-1, ifnd=0; var rbits=rivers.split(']]}}'); var murraytotal=0.0; rivers=''; var hdrbit='', hbits=[]; lastn=''; for (var irr=1; irr<(-1 + rbits.length); irr++) { hdrbit=rbits[-1 + irr].split('{' + String.fromCharCode(34) + 'type' + String.fromCharCode(34) + ':' + String.fromCharCode(34) + 'Feature')[eval(-1 + rbits[-1 + irr].split('{' + String.fromCharCode(34) + 'type' + String.fromCharCode(34) + ':' + String.fromCharCode(34) + 'Feature').length)] + ''; //alert(hdrbit); hbits=hdrbit.split(',' + String.fromCharCode(34) + 'name' + String.fromCharCode(34) + ':' + String.fromCharCode(34)); if (hbits.length > 1) { if ((!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPaJUNKd|iPod|Opera Mini|IEMobile/i) || eval('' + arivers.length) <= 200)) { if (lastn != hbits[1].split(String.fromCharCode(34))[0]) { lastn=hbits[1].split(String.fromCharCode(34))[0]; found=-1; if (arivers.length > 0) { for (ifnd=0; ifnd= 0) { //if (lastn == 'Murray') { // console.log(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); //} if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPaJUNKd|iPod|Opera Mini|IEMobile/i)) { arivers[found]+=' ' + lessit(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); } } else { //if (lastn == 'Murray') { // console.log(lastn + ':' + hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); //} arivers.push(lastn + ':' + lessit(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,''))); } } else if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPaJUNKd|iPod|Opera Mini|IEMobile/i)) { //if (lastn == 'Murray') { // console.log(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); //} arivers[-1 + arivers.length]+=' ' + lessit(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); } } } } rbits=[]; if (document.getElementById('srivs').innerHTML.trim() != '') { arivers=[]; } } lastn=''; //if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { // alert(arivers.length); //} //return; //plotariver(getariver()); if (!idone) { idone=true; if (document.getElementById('srivs').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { getapopulation(); } else { getariver(); } } } function lessitp(maybe) { var altmaybe='', altmaybed=''; if (document.getElementById('spops').innerHTML.trim() != '' || navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { var acsvs=maybe.split(','); for (var ic=0; ic'; } return ''; //altmaybe; } altmaybed=','; } acsvs=[]; return ''; //altmaybe; } return maybe; } function lessit(maybe) { var altmaybe='', xaltmaybe='', altmaybed='', sls=[], isls=0; if (document.getElementById('srivs').innerHTML.trim() != '' || navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { var acsvs=maybe.split(','); for (var ic=0; ic 1) { document.getElementById(encodeURIComponent('river' + lastn)).value+=encodeURIComponent(' ' + altmaybed + sls[0] + ' ' + sls[1]); } else { document.getElementById(encodeURIComponent('river' + lastn)).value+=encodeURIComponent(' ' + altmaybed + xaltmaybe); } } else if (eval('' + sls.length) > 1) { document.getElementById('srivs').innerHTML+=''; } else { document.getElementById('srivs').innerHTML+=''; } } else { if (ic == 1) { acsvs=[]; return altmaybe; } } altmaybed=','; } acsvs=[]; if (document.getElementById('srivs').innerHTML.trim() != '') { return ''; } return altmaybe; } return maybe; } function populatepopulationsvia(ts) { console.log('here in populatepopulationsvia'); if (document.getElementById('spops').innerHTML.trim() == '') { var found=-1, ifnd=0; var rbits=ts.split(']}}'); //populations=''; var hdrbit='', hbits=[]; jlastn=''; for (var irr=1; irr<(-1 + rbits.length); irr++) { hdrbit=rbits[-1 + irr].split('{' + String.fromCharCode(34) + 'type' + String.fromCharCode(34) + ':' + String.fromCharCode(34) + 'Feature')[eval(-1 + rbits[-1 + irr].split('{' + String.fromCharCode(34) + 'type' + String.fromCharCode(34) + ':' + String.fromCharCode(34) + 'Feature').length)] + ''; //alert(hdrbit); hbits=hdrbit.split(',' + String.fromCharCode(34) + 'NAME' + String.fromCharCode(34) + ':' + String.fromCharCode(34)); if (hbits.length > 1) { if (jlastn != hbits[1].split(String.fromCharCode(34))[0]) { jlastn=hbits[1].split(String.fromCharCode(34))[0]; found=-1; if (apopulations.length > 0) { for (ifnd=0; ifnd= 0) { //if (jlastn == 'Sydney') { console.log(hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); } apopulations[found]+=' ' + lessitp(hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); } else { //if (jlastn == 'Sydney') { console.log(jlastn + ':' + hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); } apopulations.push(jlastn + ':' + lessitp(hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,''))); } } else { //if (jlastn == 'Sydney') { console.log(hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); } apopulations[-1 + apopulations.length]+=' ' + lessitp(hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); } } } if (document.getElementById('spops').innerHTML.trim() != '') { //console.log(document.getElementById('spops').innerHTML); apopulations=[]; } rbits=[]; } jlastn=''; //return; //plotariver(getariver()); } function populatepopulations() { var found=-1, ifnd=0; var rbits=populations.split(']}}'); populations=''; var hdrbit='', hbits=[]; jlastn=''; for (var irr=1; irr<(-1 + rbits.length); irr++) { hdrbit=rbits[-1 + irr].split('{' + String.fromCharCode(34) + 'type' + String.fromCharCode(34) + ':' + String.fromCharCode(34) + 'Feature')[eval(-1 + rbits[-1 + irr].split('{' + String.fromCharCode(34) + 'type' + String.fromCharCode(34) + ':' + String.fromCharCode(34) + 'Feature').length)] + ''; //alert(hdrbit); hbits=hdrbit.split(',' + String.fromCharCode(34) + 'NAME' + String.fromCharCode(34) + ':' + String.fromCharCode(34)); if (hbits.length > 1) { if (jlastn != hbits[1].split(String.fromCharCode(34))[0]) { jlastn=hbits[1].split(String.fromCharCode(34))[0]; found=-1; if (apopulations.length > 0) { for (ifnd=0; ifnd= 0) { //if (jlastn == 'Sydney') { console.log(hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); } apopulations[found]+=' ' + lessit(hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); } else { //if (jlastn == 'Sydney') { console.log(jlastn + ':' + hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); } apopulations.push(jlastn + ':' + lessit(hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,''))); } } else { //if (jlastn == 'Sydney') { console.log(hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); } apopulations[-1 + apopulations.length]+=' ' + lessit(hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); } } } if (document.getElementById('spops').innerHTML.trim() != '') { apopulations=[]; } rbits=[]; jlastn=''; //return; //plotariver(getariver()); } function getariver() { console.log('here in getariver'); //for (var ih=0; ih 0 || document.getElementById('srivs').innerHTML.trim() != '') { if (document.getElementById('srivs').innerHTML.trim() != '') { // || navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { iguess=Math.floor(Math.random() * eval(-1 + eval('' + document.getElementById('srivs').innerHTML.split('')[0].replace(String.fromCharCode(34),'').replace(String.fromCharCode(34),'')).replace(/^river/g,''); } else { lastn=arivers[iguess].split(':')[0]; } if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPaJUNKd|iPod|Opera Mini|IEMobile/i)) { document.getElementById('ifriverstwo').src='./rivers.geojson?name=' + encodeURIComponent(lastn); } else { plotariver(iguess); } setTimeout(askariver, 8000); return iguess; } } function getapopulation() { console.log('here in getapopulation jsofar=' + jsofar + ' opt count=' + document.getElementById('spops').innerHTML.split('')[0].replace(String.fromCharCode(34),'').replace(String.fromCharCode(34),'')); if (!document.getElementById(encodeURIComponent(jlastn))) { while (jsofar.indexOf(',' + jguess + ',') != -1) { if (document.getElementById('spops').innerHTML.trim() != '' || navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { jguess=Math.floor(Math.random() * eval(-1 + eval('' + document.getElementById('spops').innerHTML.split('')[0].replace(String.fromCharCode(34),'').replace(String.fromCharCode(34),'')); } } else { jlastn=apopulations[jguess].split(':')[0]; } plotapopulation(jguess); setTimeout(askapopulation, 9000); return jguess; } function askariver() { var another=false; var midbit=''; var origboth=both; var thing='river'; if (!both) { midbit='Append spaces to also answer a question regarding the Populations Quiz, or P to just do Populations Quiz.'; } else { thing='population'; } var retthis=null; if (document.getElementById(encodeURIComponent('river' + lastn))) { retthis=prompt('What is the name of this new blue river plotted on the world map? ' + midbit + ' Enter ? to get given more time looking at (longitude,latitude) = (' + decodeURIComponent(document.getElementById(encodeURIComponent('river' + lastn)).value).split(',')[0] + ',' + decodeURIComponent(document.getElementById(encodeURIComponent('river' + lastn)).value).split(',')[1].split(' ')[0] + ')', ''); } else { retthis=prompt('What is the name of this new blue river plotted on the world map? ' + midbit + ' Enter ? to get given more time looking at (longitude,latitude) = (' + arivers[iguess].split(':')[1].split(',')[0] + ',' + arivers[iguess].split(':')[1].split(',')[1] + ')', ''); } if (retthis == null) { both=false; jgoes++; another=confirm('Bad luck. Answer was ' + lastn + '. Score ' + jscore + '/' + jgoes + '. Another go with a new ' + thing + '?'); } else if (retthis.toLowerCase().trim() == 'p') { both=false; isokto=true; if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { document.getElementById('ifrivers').src='./population.geojson'; } setTimeout(getapopulation, 9000); return ''; } else if (retthis.trim() == '?') { if (retthis.trim() != retthis && !origboth) { if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { document.getElementById('ifrivers').src='./population.geojson'; } both=true; } setTimeout(askariver, 8000); return ''; } else if (retthis.trim() == '') { if (retthis != '' && !origboth) { thing='population'; } jgoes++; another=confirm('Bad luck. Answer was ' + lastn + '. Score ' + jscore + '/' + jgoes + '. Another go with a new ' + thing + '?'); if (retthis != '' && !origboth) { isokto=true; both=true; if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { if (document.getElementById('spops').innerHTML.trim() == '') { document.getElementById('ifrivers').src='./population.geojson'; } setTimeout(getapopulation, 9000); } else { getapopulation(); } } } else if (lastn.toLowerCase().indexOf(retthis.toLowerCase()) != -1 && lastn.toLowerCase() == retthis.toLowerCase() && retthis.trim().length >= 1) { if (retthis.trim() != retthis && !origboth) { both=true; thing='population'; if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { document.getElementById('ifrivers').src='./population.geojson'; } } jgoes++; jscore++; another=confirm('Will pay that. Answer was ' + lastn + '. Score ' + jscore + '/' + jgoes + '. Another go with a new ' + thing + '?'); } else if (lastn.toLowerCase().indexOf(retthis.toLowerCase()) == -1) { if (retthis.trim() != retthis && !origboth) { both=true; thing='population'; if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { document.getElementById('ifrivers').src='./population.geojson'; } } jgoes++; another=confirm('Bad luck. Answer was ' + lastn + '. Score ' + jscore + '/' + jgoes + '. Another go with a new ' + thing + '?'); } else if (lastn.toLowerCase() == retthis.toLowerCase()) { if (retthis.trim() != retthis && !origboth) { both=true; thing='population'; if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { document.getElementById('ifrivers').src='./population.geojson'; } } jgoes++; jscore++; another=confirm('Well done! Answer was ' + lastn + '. Score ' + jscore + '/' + jgoes + '. Another go with a new ' + thing + '?'); } else if (retthis.trim().length >= 1) { if (retthis.trim() != retthis && !origboth) { both=true; thing='population'; if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { document.getElementById('ifrivers').src='./population.geojson'; } } jgoes++; another=confirm('Bad luck. Answer was ' + lastn + '. Score ' + jscore + '/' + jgoes + '. Another go with a new ' + thing + '?'); } else { if (retthis.trim() != retthis && !origboth) { both=true; thing='population'; if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { document.getElementById('ifrivers').src='./population.geojson'; } } jgoes++; jscore++; another=confirm('Will pay that. Answer was ' + lastn + '. Score ' + jscore + '/' + jgoes + '. Another go with a new ' + thing + '?'); } if (both && !origboth) { isitok=true; setTimeout(getapopulation, 9000); return ''; } else if (both) { setTimeout(getapopulation, 9000); return ''; } if (another) { if (both) { getariver(); getapopulation(); } else { getariver(); } } else { contexta.clearRect(0,0,360,180); } return ''; } function plottheriver(ariverswhich) { if (both) { isokto=true; } if (isokto) { contexta.clearRect(0,0,360,180); } if (both) { isokto=false; } lastn=ariverswhich.split(':')[0]; var rest=ariverswhich.split(':')[1]; var consolelog=''; //console.log(rest); var restlonglat=[]; //rest.split(','); var therest=rest.split(' '); //alert(eval(180.0 + eval('' + restlonglat[0])) + ',' + eval(90.0 - eval('' + restlonglat[1]))); for (var jrrr=0; jrrr= eval('' + restlonglat.length)) { context.stroke(); } } } contexta.stroke(); } } function plotariver(which) { var rest=''; if (both) { isokto=true; } if (isokto) { contexta.clearRect(0,0,360,180); } if (both) { isokto=false; } if (document.getElementById(encodeURIComponent('river' + lastn))) { rest=decodeURIComponent(document.getElementById(encodeURIComponent('river' + lastn)).value); //.split(' ')[0]; } else { lastn=arivers[which].split(':')[0]; rest=arivers[which].split(':')[1]; } var consolelog=''; //console.log(rest); var restlonglat=[]; //rest.split(','); var therest=rest.split(' '); //alert(eval(180.0 + eval('' + restlonglat[0])) + ',' + eval(90.0 - eval('' + restlonglat[1]))); for (var jrrr=0; jrrr= eval('' + restlonglat.length)) { context.stroke(); } } } contexta.stroke(); } } function getthejson(iois) { if (iois.src.indexOf('.geojson') != -1) { var aconto = (iois.contentWindow || iois.contentDocument); if (aconto != null) { if (aconto.document) { aconto = aconto.document; } if (aconto.body != null) { if (iois.src.indexOf('rivers.geojson?name=') != -1) { plotarivervia(lastn, aconto.body.innerHTML); } else if (iois.src.indexOf('rivers.geojson') != -1) { if (1 == 1) { populateriversvia(aconto.body.innerHTML); } else { rivers='' + aconto.body.innerHTML; setTimeout(populaterivers, 500); } if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { iois.src='./population.geojson'; } } else if (iois.src.indexOf('population.geojson') != -1) { // && !navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { if (1 == 1) { populatepopulationsvia(aconto.body.innerHTML); if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { getapopulation(); } } else { populations='' + aconto.body.innerHTML; setTimeout(populatepopulations, 500); } } } } } } function getthejsontwo(iois) { if (iois.src.indexOf('.geojson') != -1) { var aconto = (iois.contentWindow || iois.contentDocument); if (aconto != null) { if (aconto.document) { aconto = aconto.document; } if (aconto.body != null) { if (iois.src.indexOf('rivers.geojson?name=') != -1) { plotarivervia(lastn, aconto.body.innerHTML); } else if (iois.src.indexOf('rivers.geojson') != -1) { rivers='' + aconto.body.innerHTML; setTimeout(populaterivers, 500); iois.src='./population.geojson'; } else if (iois.src.indexOf('population.geojson') != -1) { // && !navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { populations='' + aconto.body.innerHTML; setTimeout(populatepopulations, 500); } } } } } function askapopulation() { var another=false; var origboth=both; var midbit=''; var thing='population'; if (!both) { midbit='Append spaces to also answer a question regarding the Rivers Quiz, or R to just do Rivers Quiz.'; } else { thing='river'; } var retthis=''; if (document.getElementById(encodeURIComponent(jlastn))) { retthis=prompt('What is the name of this new red population area plotted on the world map? ' + midbit + ' Enter ? to get given more time looking at (longitude,latitude) = (' + decodeURIComponent(document.getElementById(encodeURIComponent(jlastn)).value) + ')', ''); } else { retthis=prompt('What is the name of this new red population area plotted on the world map? ' + midbit + ' Enter ? to get given more time looking at (longitude,latitude) = (' + apopulations[jguess].split(':')[1].split(',')[0] + ',' + apopulations[jguess].split(':')[1].split(',')[1] + ')', ''); } if (retthis == null) { both=false; jgoes++; another=confirm('Bad luck. Answer was ' + jlastn + '. Score ' + jscore + '/' + jgoes + '. Another go with a new ' + thing + '?'); } else if (retthis.toLowerCase().trim() == 'r') { both=false; isokto=true; getariver(); return ''; } else if (retthis.trim() == '?') { if (retthis.trim() != retthis && !origboth) { both=true; if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { document.getElementById('ifrivers').src='./population.geojson'; } } setTimeout(askapopulation, 9000); return ''; } else if (retthis.trim() == '') { if (retthis != '' && !origboth) { thing='river'; } jgoes++; another=confirm('Bad luck. Answer was ' + jlastn + '. Score ' + jscore + '/' + jgoes + '. Another go with a new ' + thing + '?'); if (retthis != '' && !origboth) { isokto=true; both=true; if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { document.getElementById('ifrivers').src='./population.geojson'; } getariver(); } } else if (jlastn.toLowerCase().indexOf(retthis.toLowerCase()) != -1 && jlastn.toLowerCase() == retthis.toLowerCase() && retthis.trim().length >= 1) { if (retthis.trim() != retthis && !origboth) { both=true; thing='river'; if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { document.getElementById('ifrivers').src='./population.geojson'; } } jgoes++; jscore++; another=confirm('Will pay that. Answer was ' + jlastn + '. Score ' + jscore + '/' + jgoes + '. Another go with a new ' + thing + '?'); } else if (jlastn.toLowerCase().indexOf(retthis.toLowerCase()) == -1) { if (retthis.trim() != retthis && !origboth) { both=true; thing='river'; if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { document.getElementById('ifrivers').src='./population.geojson'; } } jgoes++; another=confirm('Bad luck. Answer was ' + jlastn + '. Score ' + jscore + '/' + jgoes + '. Another go with a new ' + thing + '?'); } else if (jlastn.toLowerCase() == retthis.toLowerCase()) { if (retthis.trim() != retthis && !origboth) { both=true; thing='river'; if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { document.getElementById('ifrivers').src='./population.geojson'; } } jgoes++; jscore++; another=confirm('Well done! Answer was ' + jlastn + '. Score ' + jscore + '/' + jgoes + '. Another go with a new ' + thing + '?'); } else if (retthis.trim().length >= 1) { if (retthis.trim() != retthis && !origboth) { both=true; thing='river'; if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { document.getElementById('ifrivers').src='./population.geojson'; } } jgoes++; another=confirm('Bad luck. Answer was ' + jlastn + '. Score ' + jscore + '/' + jgoes + '. Another go with a new ' + thing + '?'); } else { if (retthis.trim() != retthis && !origboth) { both=true; thing='river'; if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { document.getElementById('ifrivers').src='./population.geojson'; } } jgoes++; jscore++; another=confirm('Will pay that. Answer was ' + jlastn + '. Score ' + jscore + '/' + jgoes + '. Another go with a new ' + thing + '?'); } if (both) { contexta.clearRect(0,0,360,180); } if (both && (!origboth || 6 == 6)) { isitok=true; getariver(); return ''; } if (another) { if (both) { getariver(); getapopulation(); } else { getapopulation(); } } else { contexta.clearRect(0,0,360,180); } return ''; } function plotapopulation(which) { var rest='', restlonglat=[]; if (isokto) { contexta.clearRect(0,0,360,180); } //if (both) { isokto=true; } if (document.getElementById(encodeURIComponent(jlastn))) { rest=decodeURIComponent(document.getElementById(encodeURIComponent(jlastn)).value).split(' ')[0]; } else { jlastn=apopulations[which].split(':')[0]; rest=apopulations[which].split(':')[1].split(' ')[0]; } restlonglat=rest.split(','); if (eval('' + restlonglat.length) >= 2) { contexta.fillStyle = 'red'; console.log(rest + ': ' + restlonglat[0] + ',' + restlonglat[1]); contexta.fillRect(eval(180.0 + eval('' + restlonglat[0])), eval(90.0 - eval('' + restlonglat[1])),2,2); contexta.fill(); } } function zoomin() { if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { jzoom*=2; document.getElementById('myviewport').setAttribute('content', 'width=device-width, initial-scale=' + eval(jzoom * izoom) + ', minimum-scale=0.1, maximum-scale=8, user-scalable=yes'); window.scrollTo(0,0); //izoom*=2; } else { //if (1 == 1) { // alert('Please use your web browser View Menu options Zoom In or Zoom Out'); //} else { document.body.style.zoom=('' + eval(izoom * 200.0) + '%'); izoom*=2; //location.href=document.URL.split('?')[0].split('#')[0] + '?zoom=' + encodeURIComponent('' + eval(2 * izoom)); //} } } function derivethislong(xco) { var rectis=document.body.getBoundingClientRect(); var topllong=-180.0; var topllat=90.0; //var onepixelequals=izoom; thislong=eval(topllong + eval(eval(eval(-rectis.left * izoom) + xco) / izoom)); return thislong; } function derivethislat(yco) { var rectis=document.body.getBoundingClientRect(); var topllong=-180.0; var topllat=90.0; //var onepixelequals=izoom; thislat=eval(topllat - eval(eval(eval(-rectis.top * izoom) + yco) / izoom)); return thislat; } function getzoom() { if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { return jzoom; } return izoom; } function windowopentwo(p1,p2,p3) { if (1 == 1 && navigator.userAgent.match(/iPad/i)) { if (p1 != 'cn' + 't.ht' + 'm') { document.getElementById('ifxtr').src=p1; } document.getElementById('ifxtr').style.width='60px'; //'80px'; document.getElementById('ifxtr').style.height='60px'; //'60px'; document.getElementById('ifxtr').style.zIndex='345'; // document.getElementById('ifxtr').style.backgroundColor='transparent'; if (9 == 99) { alert(document.getElementById('iftr').outerHTML.replace('if' + 'tr', 'ifxtr').replace('none;', 'block:')); document.getElementById('ipadpin').innerHTML=document.getElementById('iftr').outerHTML.replace('if' + 'tr', 'ifxtr').replace('none;', 'block:'); } else { document.getElementById('ifxtr').srcdoc=document.getElementById('iftr').srcdoc; document.getElementById('ifxtr').style.display='block'; //'inline-block'; //alert('iPad ' + document.getElementById('ifxtr').srcdoc); //document.getElementById('iftr').style.position='absolute'; //document.getElementById('iftr').style.left='' + eval(-80 + screen.width); //document.getElementById('iftr').style.top='0px'; //document.getElementById('iftr').style.position='fixed'; //document.getElementById('iftr').style.left='0px'; //'' + eval(-80 + screen.width); //document.getElementById('iftr').style.top='calc(100vh - 60px)'; // '' + eval(-60 + screen.height) + 'px'; //'calc(100vh - 60px)'; // //alert('' + eval(-60 + screen.height) + 'px'); } } else if (6 == 6) { if (p1 != 'cn' + 't.ht' + 'm') { // || navigator.userAgent.match(/iPad/i)) { document.getElementById('iftr').src=p1; } document.getElementById('iftr').style.width='60px'; //'80px'; document.getElementById('iftr').style.height='60px'; //'60px'; document.getElementById('iftr').style.zIndex='345'; document.getElementById('iftr').style.display='block'; document.getElementById('iftr').style.backgroundColor='transparent'; if (1 == 1 && navigator.userAgent.match(/iPad/i)) { //alert('iPad'); document.getElementById('iftr').style.position='fixed'; document.getElementById('iftr').style.left='0px'; //'' + eval(-80 + screen.width); document.getElementById('iftr').style.top='0px'; // + eval(-60 + screen.height) + 'px'; } else { document.getElementById('ipadpin').innerHTML=''; document.getElementById('iftr').style.position='fixed'; document.getElementById('iftr').style.left='0px'; //'' + eval(-80 + screen.width); document.getElementById('iftr').style.top='calc(100% - 60px)'; // + eval(-60 + screen.height) + 'px'; } } return null; } "; $htmlis.="  

 GeoJSON World Coastline

RJM Programming 🔎 January, 2023

Thanks to https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_110m_coastline.geojson



"; $geojsonis=file_get_contents('coastline.geojson'); $parts=explode("]]", $geojsonis); for ($i=0; $i<(-1 + sizeof($parts)); $i++) { $coords=str_replace('[','',str_replace(']','',explode('[[' , $parts[$i])[-1 + sizeof(explode('[[' , $parts[$i]))])); $newcoords=$coords; if (!$dolatlong || 1 == 1) { $lls=explode(",", $coords); $newcoords=""; for ($j=0; $j\n"; //echo "\n"; } $bitsare=explode("}", $htmlis); $onebit=$bitsare[0] . "}"; $newh=str_replace($onebit, substr($onebit,0,(-1 + strlen($onebit))) . " context.stroke(); \n elem.style.cursor='pointer'; \n} \n " . $midbit, str_replace("", $abit . "", $htmlis)); if (strpos($newh, "function ouralert(") === false) { $newh=str_replace("", "\n" . $midbit . "\n" . "", $newh); } if (!file_exists('regions.html') && strpos(('' . $_SERVER['QUERY_STRING']), 'zoom=') === false && strpos(('' . $_SERVER['QUERY_STRING']), 'uselatlaong=') === false) { file_put_contents('regions.html', $newh); } echo $newh; ?>