Event Calendar Collaboration Tutorial

Event Calendar Collaboration Tutorial

Event Calendar Collaboration Tutorial

The Event Calendar web application project, of Event Calendar PHP Bookmark Tutorial, from last year is worth a revisit, the reason being …

  • it did not have a fully fleshed out collaboration or sharing set of functionalities … at the time, probably, because …
  • each Monthly calendar filled out, and wanting to be saved, could involve much more than the 850 characters available to previous “mailto:” or “sms:” communication conduits, back to when we first tackled this project … but now …
  • hashtagging parts to the “mailto:” URLs (and maybe sometimes the “sms:” URL) might cover the data length needs

… so that this Event Calendar could be a web application at the center of a collaboration network of people working on that event organization. Much more useful, we figure!

Timing became really important with this integration of …

  • email
  • SMS

… communication conduit possibilities. With its design we have to wait until the point where the user is filling in textarea elements regarding a designated …

  1. Month
  2. Year

… of relevance, before we allow the email 📧 and SMS 📟 emoji buttons be shown. In the code …

Amended HTML h1 element static HTML to add, later shown, perhaps, email 📧 and SMS 📟 emoji buttons

<h1>Events in Month &nbsp;&nbsp;<button style=display:none; title='Share via Email' id=semail onclick="doemail('');">&#128231;</button> <button style=display:none; title='Share via SMS' id=ssms onclick=dosms();>&#128223;</button> </h1>
New static HTML div element placed to the bottom of the body element …

<div id=divas></div>
New Javascript global variables (picking up hashtagging parts of the address bar URL, perhaps linked off an email or SMS link clicked) …

var bigbih=('' + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'')).split('bih=')[1] ? (decodeURIComponent(('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'')).split('bih=')[1].split('&')[0]) : '';
if (bigbih != '' && bigbih.indexOf('xae' + 'mail') == -1) {
bigbih+='<a target=_blank id=xae' + 'mail style=display:none; href="mailto:"></a>';
}
if (bigbih != '' && bigbih.indexOf('xas' + 'ms') == -1) {
bigbih+='<a target=_blank id=xas' + 'ms style=display:none; href="sms:"></a>';
}
var viatext='', smallbih='', wes=null, sparewes=null;
On or around document.body onload event we can analyze any such location.hash hashtagging data …

if (bigbih.indexOf('</he' + 'ad>') != -1 || bigbih.indexOf('<b' + 'o' + 'dy') != -1 || bigbih.indexOf('<h' + '1') == 0) {
//bigbih=bigbih.replace('" id="eventcalendar"', 'margin-top:50px;" id="eventcalendar"');
viatext=' (via contact at ' + ('' + new Date()) + ')';
if (bigbih.indexOf('<h' + '1') == 0) {
smallbih=bigbih;
} else {
smallbih=bigbih.split('<b' + 'o' + '')[1].split('</b' + 'o' + 'd' + 'y>')[0].replace(bigbih.split('<b' + 'o' + '')[1].split('</b' + 'o' + 'd' + 'y>')[0].split('>')[0] + '>', '');
}
wes=windowopen('./events_in_month.htm','_blank','top=40,left=40,width=800,height=800');
//alert(bigbih);
if (wes) {
setTimeout(function(){
wes.document.write(bigbih);
}, 3000);
//document.body.innerHTML=bigbih;
setTimeout(function(){
wes.document.getElementById('semail').style.display='inline-block';
wes.document.getElementById('ssms').style.display='inline-block';
wes.document.getElementsByTagName('h1')[0].style.display='none';
wes.document.getElementsByTagName('h3')[0].style.display='none';
//wes.setviatext(viatext);
//wes.setphpthere(' ');
//wes.togglewords();
}, 5000);
}
}
A window.open wrapper windowopen Javascript function …

function windowopen(poneis, ptwois, pthreeis) {
document.getElementById('divas').innerHTML='<iframe name=ovif id=ovif style="position:absolute;top:140px;left:0px;width:100%;height:100%;z-index:99;" src="' + poneis + '" onload=wopencheck(this);></iframe>';
//document.getElementsByTagName('h1')[0].style.opacity='0.0';
//document.getElementsByTagName('h3')[0].style.opacity='0.0';
sparewes=window.open(poneis.split('.htm')[0] + '.php', 'ovif');
//sparewes=window.open(poneis, 'ovif');
sparewes.document.write(bigbih);
setTimeout(function(){
sparewes.document.getElementById('semail').style.display='inline-block';
sparewes.document.getElementById('ssms').style.display='inline-block';
var sdem=sparewes.document.getElementById('semail').outerHTML;
var sdss=sparewes.document.getElementById('ssms').outerHTML;
sparewes.document.getElementsByTagName('h1')[0].innerHTML=sparewes.document.getElementsByTagName('h1')[0].innerHTML.replace(sdss,'');
sparewes.document.getElementsByTagName('h1')[0].innerHTML=sparewes.document.getElementsByTagName('h1')[0].innerHTML.replace(sdem,'');
sparewes.document.getElementsByTagName('h1')[0].style.display='none';
sparewes.document.getElementsByTagName('h3')[0].style.display='none';
sparewes.document.getElementById('dmore').innerHTML+=(' ' + sdem.replace('doeJUNKmail(', 'parent.doe' + 'mail(') + ' ' + sdss.replace('dosJUNKms(', 'parent.dos' + 'ms(') + '<br>');
//sparewes.setviatext(viatext);
//sparewes.setphpthere(' ');
//sparewes.togglewords();
}, 5000);
return null;
}
Is augmented by other new Javascript functions …

function hfanalyze() {
var fio=document.getElementById('ecform');
if (forceit) { forceit=false; return true; }
var delm='?';
var fioih=fio.innerHTML;
var fions=fioih.split(' name="');
var testurl=documentURL.split('?')[0].split('#')[0];
//alert(fions.length);
for (var ijk=1; ijk<fions.length; ijk++) {
testurl+=delm + fions[ijk].split('"')[0] + '=' + encodeURIComponent(document.getElementById(fions[ijk].split('"')[0]).value.replace(/\?\>/g,'? >'));
delm='&';
}
//alert(testurl.length);
//if (eval('' + testurl.length) < 750) { return true; }
//if (lastbut.value.indexOf('New') == 0 || 11 == 11) {
if (22 == 22) {
//wo=window.open('', '_blank', 'top=50,left=50,height=600,width=600');
//wo.document.write('<html><head>' + hih.replace("=docum" + "ent.URL", "='" + testurl.replace(/\'/g, "' + String.fromCharCode(39) + '") + "'") + boh + '</html>');
return ('<html><head>' + hih.replace("=docum" + "ent.URL", "='" + testurl.replace(/\'/g, "' + String.fromCharCode(39) + '") + "'") + boh + '</html>');
} else if (phpthere != '') {
if (1 == 1) {
postit(fio, false, testurl);
} else {
fio.target='phpif';
fio.method='POST';
fio.action='./events_in_month.php';
if (!document.getElementById('dmore')) {
document.getElementById('ddmore').innerHTML='<input type=hidden id=caltitle name=caltitle value="' + document.getElementById('myoldsel').options[document.getElementById('myoldsel').selectedIndex].innerText + '"></input><input type=hidden id=phpthere name=phpthere value="' + phpthere + '"></input><input type=hidden id=bigurl name=bigurl value="' + testurl + '"></input>';
} else {
document.getElementById('dmore').innerHTML='<input type=hidden id=phpthere name=phpthere value="' + phpthere + '"></input><input type=hidden id=bigurl name=bigurl value="' + testurl + '"></input>';
}
}
return 'true';
}
return 'false';
}

function doemail(inidea) {
var azx=document.getElementById('xae' + 'mail');
if (!azx) { azx=document.createElement("a"); }
//if (1 == 1) {
//document.getElementById('divas').appendChild(azx);
//} else {
document.body.appendChild(azx);
//}
azx.style = "display: none";
azx.id = 'xaem' + 'ail';
azx.href = 'mailto:' + inidea + '?subject=' + encodeURIComponent(document.getElementsByTagName('h2')[0].innerHTML.split('&')[0].split('<')[0].replace(/\`/g,'').replace(/^Events\ in\ /g, 'Events in Month ').substring(0)) + '&body=' + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + '#bih=' + encodeURIComponent(hfanalyze())); //encodeURIComponent(document.URL.split('#')[0] + '<h2' + document.body.innerHTML.split('<h2')[1]));
azx.click();
return '';
}

function dosms() {
//alert('' + eval('' + ('sms:' + snum + '&body=' + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + '#bih=' + encodeURIComponent(hfanalyze()))).length));
if (eval('' + ('sms:' + snum + '&body=' + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + '#bih=' + encodeURIComponent(hfanalyze()))).length) >= 18000) {
snum=('' + prompt('Please enter SMS number to send to. We suspect message is too long for an SMS and if you enter an email address here instead, we will try to send an email instead.', snum)).replace(/^null/g,'');
} else {
snum=('' + prompt('Please enter SMS number to send to.', snum)).replace(/^null/g,'');
}
if (snum.indexOf('@') != -1) {
return doemail(snum);
} else if (snum.trim() != '') {
alert('Snum=' + snum + '?');
var azx=document.getElementById('xas' + 'ms');
if (azx == null) { azx=document.createElement("a"); }
//if (1 == 1) {
// document.getElementById('divas').appendChild(azx);
//} else {
document.body.appendChild(azx);
// }
azx.id = 'xas' + 'ms';
azx.style = "display: none";
azx.href = 'sms:' + snum + '&body=' + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + '#bih=' + encodeURIComponent(hfanalyze()));
azx.click();
}
return '';
}

function wopencheck(iois) {
var aconto = null;
aconto = (iois.contentWindow || iois.contentDocument);
if (aconto != null) {
if (aconto.document) { aconto = aconto.document; }
if (aconto.body != null) {
aconto.body.innerHTML=smallbih;
aconto.setviatext(viatext);
}
}
}

function setviatext(towhat) {
viatext=towhat;
}

… to help bed down this new sharing and collaboration functionality in a changed events_in_month.htm parent of the Events in Month web application.


Previous relevant Event Calendar PHP Bookmark Tutorial is shown below.

Event Calendar PHP Bookmark Tutorial

Event Calendar PHP Bookmark Tutorial

Client meets server today, allowing the PHP data storage talents in yesterday’s Event Calendar PHP Tutorial‘s work to meet a “clientside” way to


Record to Remember via Bookmark

… use the web browser Bookmarks to help you recall an Events in Month report with long entries.

Involving a Bookmark still needs those “get” ? and & arguments, and we allow the PHP to lookup for us the data underscoring an address bar URL such as …


https://www.rjmprogramming.com.au/HTMLCSS/events_in_month.php?exactlabel=August__2023_00000__1

… that mapping being possible, now, making use of a pseudo hashtag arrangement … your Clayton‘s hashtag, if you will!

To start to use a hashtag suits, as your hashtag navigation only makes sense in the “clientside” woooorrrrrllllddd, and even there, really using one only tries to position a webpage where an element with an ID matching the hashtag sits (and we are never going to have this ID element in our work), and in the meantime we’ve passed across from the child PHP to the parent HTML a valuable piece of information helping the link to the Bookmark system be possible. The Javascript codeline (you may have noticed) …


var documentURL=document.URL;

… as stupid and simple looking as it is, is crucial for us. We get child webpage parts (like our PHP) to change document.URL to a far too long in normal circumstances address bar URL the rest of the code feeds off. It’s just that now, that far too long in normal circumstances address bar URL has a #[hashtag] appended such as …


#August__2023_00000__1

… uniquifying a Month, Year Events in Month identifier part with a version of the user’s IP address (so that they only see what is relevant to them).

Address bar URLs such as “https://www.rjmprogramming.com.au/HTMLCSS/events_in_month.php?exactlabel=August__2023_00000__1” are Bookmarkable, and so we allow for similar outcomes with less concern about how much data is being “recorded” and recallable (via that web browser’s Bookmark system).

Also, today, a lot of CSS tweaks, so that the CSS styling now looks like …


<style>
#eventcalendar {
background-color: #fcfcfc;
}

td {
padding-top: 2px;
padding-left: 2px;
padding-right: 2px;
padding-bottom: 12px;
}

.dayb {
color: white;
background-color: red;
padding: 5 5 5 5;
border-radius: 80px;
margin-bottom: 15px;
}

.dow {
color: purple;
font-style: bold;
}

.selday {
margin-left: 8px;
background-color: rgba(255,0,0,0.7);
display: inline-block;
width: 50px;
border-color: transparent;
text-overflow: ellipsis;
}

.tablurb {
background: linear-gradient(to right, white, lightpink, pink);
}

input[type="submit"] {
margin-bottom: 3px;
border-radius: 180px;
}

input[type="number"] {
margin-left: 3px;
margin-right: 3px;
border-radius: 180px;
background-color: #f3f3f3;
padding: 2 2 2 2;
}

#smonth {
margin-left: 3px;
margin-right: 3px;
border-radius: 180px;
background-color: #f9f9f9;
padding: 2 2 2 2;
}

.boldtitle {
background-color: rgba(0, 211, 107, 0.2);
}

.boldtitle + .tablurb {
margin-top: 8px;
}


.selhistory {
border-radius: 180px;
background-color: lightpink;
padding: 2 2 2 2;
}
</style>

… and we thank this webpage for the heads up regarding how to calculate week numbers within a year data item displays now available in …


Previous relevant Event Calendar PHP Tutorial is shown below.

Event Calendar PHP Tutorial

Event Calendar PHP Tutorial

Let’s face it. Serverside PHP is just great! It opens up so many opportunities regarding data in your web applications.

As such, onto yesterday’s Event Calendar New Window Tutorial logic we now have a …


Record to Remember

… form submit button (toggling) value to start involving PHP with those longer datasets of Event in Month descriptions, in our most recent project. What do we use as the data conduit? No, not a database. No, not a serverside flat file. No, not clientside window.localStorage nor window.sessionStorage nor HTTP Cookies. We store long Event in Month description data in our new events_in_month.php PHP itself. And this same PHP can populate options in a new dropdown element in the parent to facilitate the recalling of any relevant “Record to Remember” recordings.

The PHP is kind of short, so we will show it below, including one MAMP example of that “self storage” …


<?php
// events_in_month.php
// RJM Programming
// August, 2023
// Help out events_in_month.htm

$hcont=file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'events_in_month.htm');
$cont=file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'events_in_month.php');
$ipad=server_remote_addr();
$ipadless=$ipad;
$js='';

function server_remote_addr() {
global $ipadless;
$rma = $_SERVER['REMOTE_ADDR'];
$ua = strtolower($_SERVER['HTTP_USER_AGENT']);
// you can add different browsers with the same way ..
$ipadless=str_replace(".", "_", str_replace(":", "_", $rma));
if(preg_match('/(chromium)[ \/]([\w.]+)/', $ua))
$rma = '000000'.$rma;
elseif(preg_match('/(chrome)[ \/]([\w.]+)/', $ua))
$rma = '00000'.$rma;
elseif(preg_match('/(safari)[ \/]([\w.]+)/', $ua))
$rma = '0000'.$rma;
elseif(preg_match('/(opera)[ \/]([\w.]+)/', $ua))
$rma = '000'.$rma;
elseif(preg_match('/(msie)[ \/]([\w.]+)/', $ua))
$rma = '00'.$rma;
elseif(preg_match('/(mozilla)[ \/]([\w.]+)/', $ua))
$rma = '0'.$rma;
return str_replace(".", "_", str_replace(":", "_", $rma));
}

$itdone=false;
if (isset($_GET['init'])) {
if (strpos($cont, '_' . $ipad . '=') !== false) {
$things=explode('_' . $ipad . '=', $cont);
for ($it=1; $it<sizeof($things); $it++) {
if ($it == 1 && !$itdone) {
$itdone=true;
$js.="\n parent.document.getElementById('myoldsel').style.display='inline-block'; \n";
}
$js.="\n parent.document.getElementById('myoldsel').innerHTML+='<option value=\"" . explode("\n", $things[$it])[0] . "\">" . explode('__', explode(' ' . ' ' . ' ', $things[-1 + $it])[-1 + sizeof(explode(' ' . ' ' . ' ', $things[-1 + $it]))])[0] . ', ' . explode('_', explode('__', explode(' ' . ' ' . ' ', $things[-1 + $it])[-1 + sizeof(explode(' ' . ' ' . ' ', $things[-1 + $it]))])[1])[0] . "</option>'; \n";
}
}
if (strpos($cont, '0' . $ipadless . '=') !== false) {
$things=explode('0' . $ipadless . '=', $cont);
for ($it=1; $it<sizeof($things); $it++) {
if ($it == 1 && !$itdone) {
$itdone=true;
$js.="\n parent.document.getElementById('myoldsel').style.display='inline-block'; \n";
}
$js.="\n parent.document.getElementById('myoldsel').innerHTML+='<option value=\"" . explode("\n", $things[$it])[0] . "\">" . explode('__', explode(' ' . ' ' . ' ', $things[-1 + $it])[-1 + sizeof(explode(' ' . ' ' . ' ', $things[-1 + $it]))])[0] . ', ' . explode('_', explode('__', explode(' ' . ' ' . ' ', $things[-1 + $it])[-1 + sizeof(explode(' ' . ' ' . ' ', $things[-1 + $it]))])[1])[0] . "</option>'; \n";
}
}
echo "<html><head><script type='text/javascript'> " . $js . " </script></head><body><p>" . $ipad . "</p></body></html>";
} else if (isset($_POST['phpthere']) && isset($_POST['bigurl']) && isset($_POST['caltitle'])) {
//file_put_contents('xz.xz', 'l');
if (strpos($cont, '// ' . str_replace(' ','_',str_replace(',','_',str_replace('+',' ',urldecode($_POST['caltitle'])))) . '_' . str_replace('+',' ',urldecode($_POST['phpthere'])) . '=' . $_POST['bigurl'] . "\n") === false) {
//file_put_contents('xz.xzz', 'l');
$cont=str_replace('?' . '>', '// ' . str_replace(' ','_',str_replace(',','_',str_replace('+',' ',urldecode($_POST['caltitle'])))) . '_' . str_replace('+',' ',urldecode($_POST['phpthere'])) . '=' . $_POST['bigurl'] . "\n" . '?' . '>', $cont);
file_put_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'events_in_month.php', $cont);
}
if (strpos($cont, '_' . $ipad . '=') !== false) {
$things=explode('_' . $ipad . '=', $cont);
for ($it=1; $it<sizeof($things); $it++) {
if ($it == 1 && !$itdone) {
$itdone=true;
$js.="\n parent.document.getElementById('myoldsel').style.display='inline-block'; \n";
}
$js.="\n parent.document.getElementById('myoldsel').innerHTML+='<option value=\"" . explode("\n", $things[$it])[0] . "\">" . explode('__', explode(' ' . ' ' . ' ', $things[-1 + $it])[-1 + sizeof(explode(' ' . ' ' . ' ', $things[-1 + $it]))])[0] . ', ' . explode('_', explode('__', explode(' ' . ' ' . ' ', $things[-1 + $it])[-1 + sizeof(explode(' ' . ' ' . ' ', $things[-1 + $it]))])[1])[0] . "</option>'; \n";
}
}
if (strpos($cont, '0' . $ipadless . '=') !== false) {
$things=explode('0' . $ipadless . '=', $cont);
for ($it=1; $it<sizeof($things); $it++) {
if ($it == 1 && !$itdone) {
$itdone=true;
$js.="\n parent.document.getElementById('myoldsel').style.display='inline-block'; \n";
}
$js.="\n parent.document.getElementById('myoldsel').innerHTML+='<option value=\"" . explode("\n", $things[$it])[0] . "\">" . explode('__', explode(' ' . ' ' . ' ', $things[-1 + $it])[-1 + sizeof(explode(' ' . ' ' . ' ', $things[-1 + $it]))])[0] . ', ' . explode('_', explode('__', explode(' ' . ' ' . ' ', $things[-1 + $it])[-1 + sizeof(explode(' ' . ' ' . ' ', $things[-1 + $it]))])[1])[0] . "</option>'; \n";
}
}
//file_put_contents('xz.xzzz', "<html><head><script type='text/javascript'> " . $js . "\n parent.checkif(parent.document.getElementById('phpif')); \n" . " </script></head><body><p>" . str_replace(' ','%20',str_replace('+',' ',urldecode($_POST['bigurl']))) . "</p></body></html>");
echo "<html><head><script type='text/javascript'> " . $js . "\n parent.checkif(parent.document.getElementById('phpif')); \n" . " </script></head><body><p>" . str_replace(' ','%20',str_replace('+',' ',urldecode($_POST['bigurl']))) . "</p></body></html>";
} else {
echo $hcont;
}
exit;

//
//
// January__1970_00000__1=http://localhost:8888/events_in_month.htm?caltitle=January%2C%201970&i01.00=&ta01.00=kgjfjhf%20jhgfjhf%20jhkgkjhg%20jhgkjhg%20jkghhg%20jkhgkjhg%20kjhgkjhg&i02.00=&ta02.00=kjhgkjh%20kjhgkjhg%20jkhgkjhg%20kjhgkjhg%20kjhgkjhg%20jhkgkjhg%20kjgkjhg&i03.00=&ta03.00=kjhgkjhg%20kjhgkjhg%20kjhgkjhg%20kjhgkjhg%20kjhgkjhg%20jhkgkjhg&i04.00=&ta04.00=&i05.00=&ta05.00=&i06.00=&ta06.00=&i07.00=&ta07.00=&i08.00=&ta08.00=&i09.00=&ta09.00=&i10.00=&ta10.00=&i11.00=&ta11.00=&i12.00=&ta12.00=&i13.00=&ta13.00=&i14.00=&ta14.00=&i15.00=&ta15.00=&i16.00=&ta16.00=&i17.00=&ta17.00=&i18.00=&ta18.00=&i19.00=&ta19.00=&i20.00=&ta20.00=&i21.00=&ta21.00=&i22.00=&ta22.00=&i23.00=&ta23.00=&i24.00=&ta24.00=&i25.00=&ta25.00=&i26.00=&ta26.00=&i27.00=&ta27.00=&i28.00=&ta28.00=&i29.00=&ta29.00=&i30.00=&ta30.00=&i31.00=&ta31.00=
?>

Yes, the parent needed to change for our events_in_month.htm parent of Events in Month web application role.


Previous relevant Event Calendar New Window Tutorial is shown below.

Event Calendar New Window Tutorial

Event Calendar New Window Tutorial

Onto yesterday’s Event Calendar Remembered Tutorial‘s “Mystery Dilemma”

But, there’s an inherent weakness with the design, we’ll go into more into the future.

… well … it’s a perennial for us, regarding how if you stick with clientside thinking, only, web applications, when the amount of data to remember starts adding up, the “get arguments approach” ( ie. use ? and & arguments at the address bar ) is restricted by length restrictions regarding URL lengths.

Rather than jump to PHP serverside ideas just yet, we wanted to show some more ideas, staying with “clientside only thinking”, today, as well as improving the UX (user experience) and small steps forward regarding styling.

Okay then, regarding the idea to remember an Event in Month form, when there is a lot of data, and staying “just clientside”, we’ve coded for a “New Window” idea, albeit not as memorable as the default “Remember in Bookmark” possible for your smaller datasets. However, in saying that, we found that within this new window, with our Google Chrome web browser, we could …

  1. bring up Context Menu with a right click or two finger gesture within the popup window webpage content …
  2. pick Inspect option …
  3. be in Elements tab of your Web Inspector … and …
  4. highlight top <html> tag …
  5. Context Menu with a right click or two finger gesture …
  6. pick Copy -> Copy outerHTML … so that …
  7. your Event Calendar for your Events in Month choice is in a text buffer … ready for you to …
  8. Paste into a Text Editor that Events in Month webpage to store (perhaps in a MAMP local Apache/PHP/mySql web server environment, where you can further look at and develop your own ideas)

The user is told when the switch to “New Window” compromise becomes active, decided upon by reconstructing the proposed address bar URL regularly and when too long …


function formanalyze() {
var fio=document.getElementsByTagName('form')[0];
var delm='?';
var fioih=fio.innerHTML;
var fions=fioih.split(' name="');
var testurl=documentURL.split('?')[0].split('#')[0];
for (var ijk=1; ijk<fions.length; ijk++) {
testurl+=delm + fions[ijk].split('"')[0] + '=' + encodeURIComponent(document.getElementById(fions[ijk].split('"')[0]).value);
delm='&';
}
setTimeout(formanalyze, 3000);
if (eval('' + testurl.length) >= 750) {
if (document.getElementById('remember')) { document.getElementById('remember').value='New window'; }
if (document.getElementById('rememberme')) { document.getElementById('rememberme').value='New window'; }
if (document.getElementById('remembermoi')) { document.getElementById('remembermoi').value='New window'; }
} else {
if (document.getElementById('remember')) { document.getElementById('remember').value=document.getElementById('remember').value.replace(/^Remember$/g, 'Remember via Bookmark'); }
if (document.getElementById('rememberme')) { document.getElementById('rememberme').value=document.getElementById('rememberme').value.replace(/^Remember$/g, 'Remember via Bookmark'); }
if (document.getElementById('remembermoi')) { document.getElementById('remembermoi').value=document.getElementById('remembermoi').value.replace(/^Remember$/g, 'Remember via Bookmark'); }
}
return eval('' + testurl.length);
}

… the form submit buttons are reworded accordingly.

Another idea from this blog thread’s inspiration …

… we’ve now addressed in today’s “second draft” is allowing for an optional bold Event Day Blurb Title, available to the user via a new dropdown “Bold Title” option.

And, how can we do more with colour, to help the right bits stand out, and be consistent? We thought …

  • text shadow means by which the text of Event Calendar can be more impactive

    <div style="text-shadow:-1px 1px 1px #ff2d95;" id=eventcalendar></div>
  • dropdown element conditional styling

    <style>
    .dayb {
    color: white;
    background-color: red;
    padding: 5 5 5 5;
    }


    .dow {
    color: purple;
    font-style: bold;
    }

    .selday {
    margin-left: 8px;
    background-color: rgba(255,0,0,0.7);
    display: inline-block;
    width: 50px;
    }
    </style>



    if (thislabel.substring(0,1) == 'i') {
    if (thisval.trim() != '') {
    document.getElementById(thislabel.replace('i', 'sel')).style.color='white';
    document.getElementById(thislabel.replace('i', 'sel')).style.backgroundColor='red';

    }
    document.getElementById(thislabel.replace('i', 'opt')).innerText=thisval.replace(/\+/g, ' ').replace(/\ \ \ /g, ' + '); //.replace(/\+$/g, ' ');
    document.getElementById(thislabel).value=thisval.replace(/\+$/g, ' ');
    } else {
    document.getElementById(thislabel).value=thisval.replace(/\+/g, ' ').replace(/\ \ \ /g, ' + ');
    }
    }
  • placeholder on Blurb conditional existence

    var ourdata='';
    // ...
    if (documentURL.indexOf('?') != -1) {
    if (documentURL.indexOf('?caltitle=') != -1) { ourdata='data-'; }
    // ...
    trtemplate='<tr id=tr01.00><td style=width:22%;><span id=sone01.00 class=dow>' + dotw[adate.getDay()].toUpperCase().substring(0,3) + '</span><br><br><span id=stwo01.00 class=dayb>1<span onblur=sepit(this); contenteditable=true id=sp01.00></span><input type=hidden id=i01.00 name=i01.00 value=""></input><select data-dow=' + dotw[adate.getDay()].toUpperCase().substring(0,3) + ' class=selday onchange="selit(this);" id=sel01.00><option id=opt01.00 value=""></option><option title="All such in month (ie. weekly)" value="...">...</option><option title="And ..." value="&...">&</option><option value=Bold>Bold Title</option><option value=Clone>Clone</option></select></span></td><td class=blurb title="What is on?" id=tb01.00><span title="Event title" style="font-style:bold;color:blue;" id=bd01.00></span><textarea name=ta01.00 id=ta01.00 style="width:100%;height=100%;" ' + ourdata + 'placeholder="Blurb ..." class=tablurb></textarea></td></tr>';
    // ...
    }
    // ...
    }

… for our “second draft” events_in_month.htm Events in Month web application.


Previous relevant Event Calendar Remembered Tutorial is shown below.

Event Calendar Remembered Tutorial

Event Calendar Remembered Tutorial

We were inspired by an Event Calendar pamplette we saw the other day …

… to write a new “proof of concept” Events in Month web application, whose content can be recalled via the web browser’s Bookmark methodologies.

We liked the ideas for day of week and/or date of month grouping arrangements we included, being, the way we interpreted it …

  • just on this day in this month … default
  • on this day of the week throughout the month in question … “
  • on this day and some others in that month in question … “&” … to start with and further amendments available via contenteditable=true span element
  • “Clone” value allows for multiple separated “blurbs” for the one signature day

But, there’s an inherent weakness with the design, we’ll go into more into the future. For now, you can try it yourself below …

Stop Press

This is where we get to for a “second draft” we’ll get into, further, tomorrow …

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

Posted in eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Linked Sentence Story Sharing Tutorial

Linked Sentence Story Sharing Tutorial

Linked Sentence Story Sharing Tutorial

Today’s work, adding some sharing functionality, onto yesterday’s Linked Sentence Story Primer Tutorial‘s “proof of concept” work with our new “Linked Sentence Creator” web application was made that much easier now that …

  • “mailto:” emailing “a” links … and …
  • “sms:” SMS “a” links

… can incorporate hashtagging methodologies, with our “midair feeling” code …


function doemail() {
var azx=document.getElementById('aemail');
if (!azx) { azx=document.createElement("a"); }
document.body.appendChild(azx);
azx.style = "display: none";
azx.id = 'aemail';
azx.href = 'mailto:' + inidea + '?subject=' + encodeURIComponent('My Linked Sentence Story') + '&body=' + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + '#span=' + encodeURIComponent(document.getElementById('span0').innerHTML));
azx.click();
return '';
}

function dosms() {
snum=('' + prompt('Please enter SMS number to send to.', snum)).replace(/^null/g,'');
if (snum.indexOf('@') != -1) {
return doemail(snum);
} else if (snum.trim() != '') {
var azx=document.getElementById('asms');
if (!azx) { azx=document.createElement("a"); }
document.body.appendChild(azx);
azx.id = 'asms';
azx.href = 'sms:' + snum + '&body=' + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + '#span=' + encodeURIComponent(document.getElementById('span0').innerHTML));
azx.click();
}
return '';
}

… so that even if there is a long Linked Sentence Story (perhaps) created we have …

  • less to worry about this sharing functionality working … as well as …
  • not needing to involve PHP (mail server) functionality … as well as …
  • the email actually sent by the emailer (with their email address) explicitly (the opposite being one of the symptoms of Phishing)

A few nuances with the link processing, for non-mobile, add an improvement …


function analyze(athis) {
var retval=true, wincont='';
if (('' + athis.href + '#').substring(0,1) != '#') {
athisih=athis.innerHTML;
if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i) && ('' + location.hash).indexOf('=') != -1) {
var arect=athis.getBoundingClientRect();
if (wo) {
if (!wo.closed) {
wo.close();
wo=null;
}
}
var proposedw=eval(eval('' + screen.width) - eval('' + arect.right));
var proposedh=eval(eval('' + screen.height) - eval('' + arect.bottom));
//alert('' + proposedw + ',' + proposedh + ' for ' + athis.href + ' ... ' + ('top=' + arect.bottom).split('.')[0] + (',left=' + arect.right).split('.')[0] + (',width=' + proposedw).split('.')[0] + (',height=' + proposedh).split('.')[0]);
//try {
if (proposedw > 0 && proposedh > 0 && 5 == 5) {
//wo=window.open(athis.href,'_blank', ('top=' + arect.bottom).split('.')[0] + (',left=' + arect.right).split('.')[0] + (',width=' + proposedw).split('.')[0] + (',height=' + proposedh).split('.')[0]);
thirdparam=('top=' + arect.bottom).split('.')[0] + (',left=' + arect.right).split('.')[0] + (',width=' + proposedw).split('.')[0] + (',height=' + proposedh).split('.')[0];
} else if (proposedw > 0 && 5 == 5) {
//wo=window.open(athis.href,'_blank', ('top=' + arect.bottom).split('.')[0] + (',left=' + arect.right).split('.')[0] + (',width=' + proposedw).split('.')[0]);
thirdparam=('top=' + arect.bottom).split('.')[0] + (',left=' + arect.right).split('.')[0] + (',width=' + proposedw).split('.')[0];
} else if (proposedh > 0 && 5 == 5) {
//wo=window.open(athis.href,'_blank', ('top=' + arect.bottom).split('.')[0] + (',left=' + arect.right).split('.')[0] + (',height=' + proposedh).split('.')[0]);
thirdparam=('top=' + arect.bottom).split('.')[0] + (',left=' + arect.right).split('.')[0] + (',height=' + proposedh).split('.')[0];
} else if (5 == 5) {
//wo=window.open(athis.href,'_blank', ('top=' + arect.bottom).split('.')[0] + (',left=' + arect.right).split('.')[0]);
thirdparam=('top=' + arect.bottom).split('.')[0] + (',left=' + arect.right).split('.')[0];
}
//alert(('' + athis.href) + ' in ' + athis.outerHTML);
if (document.URL.split('//')[1].split('/')[0].toLowerCase().indexOf('rjmprogramming.com.au') != -1 && ('' + athis.href).indexOf('youtube.com/watch?v=') != -1) {
var athishref=document.URL.split(':')[0] + '://www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?youtubeid=' + ('' + athis.href).split('youtube.com/watch?v=')[1].split('&')[0].split('#')[0] + '&youtube_duration=11202.221&email=&email=&emoji=on&c0=on&i0=0&j0=11202.221&i1=&j1=&i2=&j2=&i3=&j3=&i4=&j4=&i5=&j5=&i6=&j6=&i7=&j7=&i8=&j8=&i9=&j9=&i10=&j10=&i11=&j11=&i12=&j12=&i13=&j13=&i14=&j14=&i15=&j15=&i16=&j16=&i17=&j17=&i18=&j18=&i19=&j19=&i20=&j20=&i21=&j21=&i22=&j22=&i23=&j23=&i24=&j24=&i25=&j25=&i26=&j26=&i27=&j27=&i28=&j28=&i29=&j29=';
wincont='<html><body><iframe width="420" height="315" src="https://www.youtube.com/embed/' + ('' + athis.href).split('youtube.com/watch?v=')[1].split('&')[0].split('#')[0] + '" frameborder="0" allowfullscreen></iframe><br><iframe src="' + athishref + '" style="width:100%;height:800px;"></iframe></body></html>';
athis.href=document.URL.split(':')[0] + '://www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?youtubeid=' + ('' + athis.href).split('youtube.com/watch?v=')[1].split('&')[0].split('#')[0] + '&youtube_duration=11202.221&email=&email=&emoji=on&c0=on&i0=0&j0=11202.221&i1=&j1=&i2=&j2=&i3=&j3=&i4=&j4=&i5=&j5=&i6=&j6=&i7=&j7=&i8=&j8=&i9=&j9=&i10=&j10=&i11=&j11=&i12=&j12=&i13=&j13=&i14=&j14=&i15=&j15=&i16=&j16=&i17=&j17=&i18=&j18=&i19=&j19=&i20=&j20=&i21=&j21=&i22=&j22=&i23=&j23=&i24=&j24=&i25=&j25=&i26=&j26=&i27=&j27=&i28=&j28=&i29=&j29=';
} // 202.221
//alert(thirdparam + ' ... ' + wincont);
if (athis.href.indexOf('wikipedia.org') == -1 && athis.href.indexOf(document.URL.split('//')[1].split('/')[0].replace(/^www\./g, '')) == -1) {
thirdparam='';
}
//alert(thirdparam + ' .+. ' + athis.href);
//} catch(reytre) {
//alert(0);
//}
// if (wo) {
// alert(1);
// if (wo.closed) {
// alert(11);
// wo=null;
// } else {
// alert(111);
// }
// }
if (!wo) {
if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i) && ('' + location.hash).indexOf('=') != -1 && thirdparam != '') {
if (wincont != '') {
wo=window.open('','_blank', thirdparam);
wo.document.write(wincont);
setTimeout(function(){ wo.document.title=athisih; }, 3000);
} else {
wo=window.open(athis.href,'_blank', thirdparam); //, ('top=' + arect.bottom).split('.')[0] + (',left=' + arect.right).split('.')[0]);
setTimeout(function(){ wo.document.title=athisih; }, 3000);
}
} else {
if (wincont != '') {
wo=window.open('','_blank');
wo.document.write(wincont);
setTimeout(function(){ wo.document.title=athisih; }, 3000);
} else {
wo=window.open(athis.href,'_blank');
setTimeout(function(){ wo.document.title=athisih; }, 3000);
}
}
}
lastahref=athis.href;
lasta=athis;
athis.href='#';
setTimeout(putback, 2000);
retval=false;
}
}
return retval;
}

It’s not just sharing that benefits from hashtagging. We can place the email contents into the href attribute of an “a” element as below, to share with you what we did to create today’s tutorial picture …

… in a changed linked_sentence_creator.html Linked Sentence Creator web application.


Previous relevant Linked Sentence Story Primer Tutorial is shown below.

Linked Sentence Story Primer Tutorial

Linked Sentence Story Primer Tutorial

We don’t know what amazes you … doh! But we get amazed by web application “kludges” that end up working … well, you had to be there! Let me explain! In yesterday’s Google Geo Chart and Map Chart Hashtag SMS Tutorial … assuming …

  1. you were aware of it …
  2. you visited it …
  3. your eyes were not glazed over …
  4. a pet was not barfing on the floor (or elsewhere) … at the crucial time when … doopy doopy doop doop, doop doop doop, doop doop doop doop, doopy doopy doop doop …
  5. there it was … what?! … I’m about to tell you …

    .
    ..
    ….
    .
    ……..
    ..
    …—…
    —…— … huh?! …

    ……..
    .
    …. the codeline …

    document.getElementById(‘remail’).innerHTML=’&#128231;</a> ‘ + inplace.split(‘>’)[0] + ‘>&#128223;’;

    (unassumingly 9px but, still …) gleaming, in the morning’s first rays, within the safety of its code element …
    what?! … I’m about to tell you …

    .
    ..
    ….
    .
    ……..
    ..
    …—…
    —…— … huh?! …

    ……..
    .
    … “the kludge” … and not just any old “Clayton’s Kludge” (sorry, you’re too late … we’ve patented it already)

Yes, regarding Javascript DOM thinking, we still usually encase a “display:inline” type of scenario in an all encompassing div or span before the contemplation of appending content. But the implication of this codeline is that for the HTML example …


<a id="remail" href="mailto:blah" title="First a element">Email link ... This is roughly the wording of our "a" link</a>
// looking like
Email link … This is roughly the wording of our “a” link


document.getElementById('remail').innerHTML='&#128231;</a> ' + inplace.split('>')[0] + '>&#128223;';

… could cause one “a” element to be spliced into two … and become …


<a id="remail" href="mailto:blah" title="First a element">&#128231;>/a> </a><a id="rsms" href="sms:blah">&#128223;</a>
// looking like
📧 📟

… without using any overseeing nesting element of any sort!

Anyway, we were gobsmacked, and today we write a proof of concept Linked Sentence web application making heavy use of this principle.

We thought with this Linked Sentence it could be like a “piecing together” of a story type of thing, with some similarities to the web application of Fairy Story Chrome Dictation Punctuation Tutorial times, with this first draft Linked Sentence Creator web application also “playable” below …

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

Posted in eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Linked Sentence Story Primer Tutorial

Linked Sentence Story Primer Tutorial

Linked Sentence Story Primer Tutorial

We don’t know what amazes you … doh! But we get amazed by web application “kludges” that end up working … well, you had to be there! Let me explain! In yesterday’s Google Geo Chart and Map Chart Hashtag SMS Tutorial … assuming …

  1. you were aware of it …
  2. you visited it …
  3. your eyes were not glazed over …
  4. a pet was not barfing on the floor (or elsewhere) … at the crucial time when … doopy doopy doop doop, doop doop doop, doop doop doop doop, doopy doopy doop doop …
  5. there it was … what?! … I’m about to tell you …

    .
    ..
    ….
    .
    ……..
    ..
    …—…
    —…— … huh?! …

    ……..
    .
    …. the codeline …

    document.getElementById(‘remail’).innerHTML=’&#128231;</a> ‘ + inplace.split(‘>’)[0] + ‘>&#128223;’;

    (unassumingly 9px but, still …) gleaming, in the morning’s first rays, within the safety of its code element …
    what?! … I’m about to tell you …

    .
    ..
    ….
    .
    ……..
    ..
    …—…
    —…— … huh?! …

    ……..
    .
    … “the kludge” … and not just any old “Clayton’s Kludge” (sorry, you’re too late … we’ve patented it already)

Yes, regarding Javascript DOM thinking, we still usually encase a “display:inline” type of scenario in an all encompassing div or span before the contemplation of appending content. But the implication of this codeline is that for the HTML example …


<a id="remail" href="mailto:blah" title="First a element">Email link ... This is roughly the wording of our "a" link</a>
// looking like
Email link … This is roughly the wording of our “a” link


document.getElementById('remail').innerHTML='&#128231;</a> ' + inplace.split('>')[0] + '>&#128223;';

… could cause one “a” element to be spliced into two … and become …


<a id="remail" href="mailto:blah" title="First a element">&#128231;>/a> </a><a id="rsms" href="sms:blah">&#128223;</a>
// looking like
📧 📟

… without using any overseeing nesting element of any sort!

Anyway, we were gobsmacked, and today we write a proof of concept Linked Sentence web application making heavy use of this principle.

We thought with this Linked Sentence it could be like a “piecing together” of a story type of thing, with some similarities to the web application of Fairy Story Chrome Dictation Punctuation Tutorial times, with this first draft Linked Sentence Creator web application also “playable” below …

If this was interesting you may be interested in this too.

Posted in eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , | Leave a comment

Google Geo Chart and Map Chart Hashtag SMS Tutorial

Google Geo Chart and Map Chart Hashtag SMS Tutorial

Google Geo Chart and Map Chart Hashtag SMS Tutorial

We’ve reached limits! Yes, researching for SMS sharing conduits within the macOS arrangement here, we believe for iMessage SMS messages there may be a length limit that kicks in around the 18k mark. Anyway, along the line, with SMS messaging (via hashtagging) in …

  • Google Charts Map Chart
  • Google Charts Geo Chart

… further to the hashtag emailing in yesterday’s Google Geo Chart and Map Chart Hashtag Emailing Tutorial we ask for a mobile number to send to, and forewarn the user if we suspect it may not work, which our testing showed happens, even though the iPhone Message app declares the SMS “Delivered”, sometimes it isn’t, when the SMS messages are very long.

For a few days now, there seemed to be “no limits”, and that can be an uneasy way to go about software development. It is advantageous to know what might be a problem down the track.

The changes feature …

Collect a method=POST (and now a method=GET) (perhaps large data set) into a potentially useful (later) PHP variable hashtag part to an “a” “mailto:” href …
<?php

$shto="";
$gshto="";

if (isset($_POST['title'])) {
foreach ($_POST as $name => $val) {
if (strpos($val, 'data:') !== false) {
$fval=urlencode($val); //str_replace(" ", "%20", str_replace("'", urlencode("'"), str_replace('"', urlencode('"'), str_replace('=', urlencode('='), str_replace('>', urlencode('>'), str_replace('<', urlencode('<'), str_replace('?', urlencode('?'), str_replace('&', urlencode('&'), $val)))))))); } else { $fval=str_replace('+','%20',urlencode(str_replace(' ',' + ',str_replace('+',' ',$val)))); //str_replace(" ", "%20", str_replace("'", urlencode("'"), str_replace('"', urlencode('"'), str_replace('=', urlencode('='), str_replace('>', urlencode('>'), str_replace('<', urlencode('<'), str_replace('?', urlencode('?'), str_replace('&', urlencode('&'), $val)))))))); } if ($shto == "") { $shto="#" . $name . "=" . $fval; //str_replace(" ", "%20", str_replace("'", urlencode("'"), str_replace('"', urlencode('"'), str_replace('=', urlencode('='), str_replace('>', urlencode('>'), str_replace('<', urlencode('<'), str_replace('?', urlencode('?'), str_replace('&', urlencode('&'), $val)))))))); } else { $shto.="&" . $name . "=" . $fval; //str_replace(" ", "%20", str_replace("'", urlencode("'"), str_replace('"', urlencode('"'), str_replace('=', urlencode('='), str_replace('>', urlencode('>'), str_replace('<', urlencode('<'), str_replace('?', urlencode('?'), str_replace('&', urlencode('&'), $val)))))))); } } } if (isset($_GET['data'])) {
foreach ($_GET as $name => $val) {
if (strpos($val, 'data:') !== false) {
$fval=urlencode($val); //str_replace(" ", "%20", str_replace("'", urlencode("'"), str_replace('"', urlencode('"'), str_replace('=', urlencode('='), str_replace('>', urlencode('>'), str_replace('<', urlencode('<'), str_replace('?', urlencode('?'), str_replace('&', urlencode('&'), $val))))))));
} else {
//$fval=str_replace('+','%20',urlencode($val)); //str_replace(" ", "%20", str_replace("'", urlencode("'"), str_replace('"', urlencode('"'), str_replace('=', urlencode('='), str_replace('>', urlencode('>'), str_replace('<', urlencode('<'), str_replace('?', urlencode('?'), str_replace('&', urlencode('&'), $val))))))));
$fval=str_replace('+','%20',urlencode(str_replace(' ',' + ',str_replace('+',' ',$val)))); //str_replace(" ", "%20", str_replace("'", urlencode("'"), str_replace('"', urlencode('"'), str_replace('=', urlencode('='), str_replace('>', urlencode('>'), str_replace('<', urlencode('<'), str_replace('?', urlencode('?'), str_replace('&', urlencode('&'), $val))))))));
}
if ($shto == "") {
$gshto="#" . $name . "=" . $fval; //str_replace(" ", "%20", str_replace("'", urlencode("'"), str_replace('"', urlencode('"'), str_replace('=', urlencode('='), str_replace('>', urlencode('>'), str_replace('<', urlencode('<'), str_replace('?', urlencode('?'), str_replace('&', urlencode('&'), $val))))))));
} else {
$gshto.="&" . $name . "=" . $fval; //str_replace(" ", "%20", str_replace("'", urlencode("'"), str_replace('"', urlencode('"'), str_replace('=', urlencode('='), str_replace('>', urlencode('>'), str_replace('<', urlencode('<'), str_replace('?', urlencode('?'), str_replace('&', urlencode('&'), $val))))))));
}
}
}


?>
Rework the existant “Email …” link wording into an Email 📧 and SMS 📟 emoji link combination arrangement …
<?php

if ($shto != "") {
echo " setTimeout(function(){
if (document.getElementById('remail')) {
if (document.getElementById('remail').innerHTML.indexOf('Email') == 0) {
//alert(document.getElementById('remail').href);
var inplace=document.getElementById('remail').outerHTML.replace(document.getElementById('remail').outerHTML.split(' href=\"')[1].split('body=')[0], 'sms:&').replace('To email ', 'To SMS (and if it fails for lengthy messages the email methodology may work better) ').replace('remail','rsms');
//alert('inplace=' + inplace);
if (document.getElementById('slineof')) {
document.getElementById('slineof').innerHTML=document.getElementById('slineof').innerHTML.replace(document.getElementById('remail').outerHTML, document.getElementById('remail').outerHTML.replace(document.getElementById('remail').innerHTML, '&#128231;') + ' ' + inplace.split('>')[0] + '>&#128223;</a>');
} else {
document.getElementById('remail').innerHTML='&#128231;</a> ' + inplace.split('>')[0] + '>&#128223;';
}
}
}
}, 5000); " . "\n";
} else if ($gshto != "") {
echo " if (typeof sethash == \"function\") { sethash(encodeURIComponent(\"" . $gshto . "\")); } " . "\n";
echo " setTimeout(function(){
if (document.getElementById('remail')) {
if (document.getElementById('remail').innerHTML.indexOf('Email') == 0) {
//alert(document.getElementById('remail').href);
var inplace=document.getElementById('remail').outerHTML.replace(document.getElementById('remail').outerHTML.split(' href=\"')[1].split('body=')[0], 'sms:&').replace('To email ', 'To SMS (and if it fails for lengthy messages the email methodology may work better) ').replace('remail','rsms');
//alert('inplace=' + inplace);
if (document.getElementById('slineof')) {
document.getElementById('slineof').innerHTML=document.getElementById('slineof').innerHTML.replace(document.getElementById('remail').outerHTML, document.getElementById('remail').outerHTML.replace(document.getElementById('remail').innerHTML, '&#128231;') + ' ' + inplace.split('>')[0] + '>&#128223;</a>');
} else {
document.getElementById('remail').innerHTML='&#128231;</a> ' + inplace.split('>')[0] + '>&#128223;';
}
}
}
}, 5000); " . "\n";
}

?>
Some email returns involve a double encoding
<?php echo ”

var lhpassed=('' + location.hash);
if (decodeURIComponent(lhpassed).indexOf('%20') != -1) {
lhpassed=decodeURIComponent(lhpassed);
}


“; ?>
Just about totally reworked Javascript function ahdepends function …
<?php echo ”

function smsprompt(inbv, indv) {
var lprval=null;
if (eval('' + decodeURIComponent(document.getElementById('remail').href.split('&body=')[1]).length) >= 18000) {
lprval=prompt(inbv + ' We suspect data is too long for an SMS and if you enter an email address instead, we shall try to email that recipient.', indv);
} else {
lprval=prompt(inbv, indv);
}
if (lprval != null) {
if (lprval.indexOf('@') != -1) {
glprval=document.getElementById('rsms').href;
setTimeout(function() { document.getElementById('rsms').href=glprval; }, 4000);
document.getElementById('remail').href=document.getElementById('remail').href.replace(document.getElementById('remail').href.split('?')[0], 'mailto:' + lprval);
document.getElementById('rsms').href=document.getElementById('remail').href; //'#'; // + glprval;
//document.getElementById('remail').click();
return '';
} else {
return lprval;
}
} else {
glprval=document.getElementById('rsms').href;
document.getElementById('rsms').href='#'; // + glprval;
setTimeout(function() { document.getElementById('rsms').href=glprval; }, 4000);
return lprval;
}
return '';
}

function ahdepends(ahoe) {
var aho=ahoe.target;
if (document.getElementById('remail')) {
var thistitle='';
if (document.getElementById('remail').href.indexOf('title=') != -1) {
thistitle=decodeURIComponent(document.getElementById('remail').href.split('title=')[1].split('&')[0]);
//alert('thistitle=' + thistitle);
} else if (document.getElementById('remail').href.indexOf(encodeURIComponent('title=')) != -1) {
thistitle=decodeURIComponent(decodeURIComponent(document.getElementById('remail').href.split(encodeURIComponent('title='))[1].split(encodeURIComponent('&'))[0]));
//alert('Thistitle=' + thistitle);
} //else {
//alert(document.getElementById('remail').href);
//}
if (thistitle.indexOf(';') == 2) {
thistitle=thistitle.substring(3);
}
if (document.getElementById('remail').href.indexOf('Google%20Chart%20Snapshot') != -1 && thistitle != '') {
if (document.getElementById('remail').href.indexOf(encodeURIComponent(thistitle)) == -1) {
document.getElementById('remail').href=document.getElementById('remail').href.replace('Google%20Chart%20Snapshot' + document.getElementById('remail').href.split('Google%20Chart%20Snapshot')[1].split('&')[0], encodeURIComponent('Google Chart Snapshot ... ' + thistitle));
}
}
if (aho.id == 'rsms') {
ahoe.stopPropagation();
if (aho.href.split('&body=')[1] != document.getElementById('remail').href.split('&body=')[1]) {
aho.href=aho.href.replace('&body=' + aho.href.split('&body=')[1], '&body=' + document.getElementById('remail').href.split('&body=')[1]);
}
}
}
if (aho.id == 'rsms' && aho.href.indexOf(':&') != -1) {
var smsp=('' + smsprompt('Please enter SMS number to send to.',''));
if (('' + smsp).indexOf('@') == -1) {
aho.href=aho.href.replace(':&', ':' + smsp + '&').replace(':null&', ':&');
//document.title=aho.href.substring(0,100);
}
if (aho.href.replace(/^\#/g,':&').indexOf(':&') != -1 || ('' + smsp) == 'null') {
//document.title='2:' + aho.href.substring(0,100);
ahoe.stopPropagation();
ahoe.preventDefault();
} else if (aho.href.indexOf('@') == -1) {
document.getElementById('remail').click();
}
}
if (dependssuffix != '') {
if (aho.href.indexOf(encodeURIComponent(dependssuffix)) == -1) {
//alert(dependssuffix);
aho.href+=encodeURIComponent(dependssuffix);
}
if (1 == 7 && aho.href.indexOf(encodeURIComponent('&data=')) != -1 && top.document.URL.indexOf('dams_usa.htm') != -1) {
if (aho.href.split(encodeURIComponent('&data='))[1].indexOf('%2520') != -1) {
//aho.href=aho.href.replace(aho.href.split('&body=')[1], decodeURIComponent(aho.href.split('&body=')[1]));
aho.href=aho.href.replace(aho.href.split(encodeURIComponent('&data='))[1], decodeURIComponent(aho.href.split(encodeURIComponent('&data='))[1]));
//aho.href=aho.href.replace(/\%2520/g, '%20');
}
}
}
//alert(aho.href);
}

“; ?>

And codewise …

… to make this happen.


Previous relevant Google Geo Chart and Map Chart Hashtag Emailing Tutorial is shown below.

Google Geo Chart and Map Chart Hashtag Emailing Tutorial

Google Geo Chart and Map Chart Hashtag Emailing Tutorial

Before we got sidetracked, but along the same “where of life” themes, before the latest recent web application predilections …

… we were delving into passing on work from the Google Chart‘s Map Chart to the Google Chart Geo Chart and Image Chart Map Chart more often, where we started that thread (at Google Chart Image Chart Map Chart Mainstream Primer Tutorial at the end of last year) with a three point plan (which became four point two days later)

  1. Help itself … map.php … phase 1
  2. Redirect to Image Chart Map Chart … map.php and/or geo_chart.php … just after first prompt … phase 2
  3. Caller form method=POST map.php action interventions at onsubmit event … non map.php … phase 3
  4. Transfer the onclick prompt window functionality over to geo_chart.php … phase 4

And then yesterday’s work in Earth Bearing Distance Missing Two Earth Scanner Integration Tutorial involving the Missing Two web application’s interfacing to the Google Chart Map Chart saw a more happy interfacing with this Map Chart, and reminding us with both …

  • Google Charts Map Chart
  • Google Charts Geo Chart

… how on occasions we could have large data set scenarios relying on PHP $_POST data (via form method=POST (or you can use Ajax FormData post) arrangements) that had not passed on their data parts when the user clicked the “Email” link down the bottom. But ever since that happy discovery from around about the time of Earth Scanner Sharing Itinerary Detail Tutorial that …

  • hashtagging … was the friend of …
  • “a” “mailto:” and/or “sms:” link hrefs … replacing the need for …
  • PHP mail via a local mail server methodologies … when the email body is a single link whose length was greater than about 850 (ie. no such stringent limitations with “just clientside” hashtagging (which we’re yet to know what the limit is, but it seems huge))

… and … spoiler alert … we could not break (where we do not count as broken the clicking of a “Message clipped” message link, which we always click to fully show the whole link, as a warning from your email client application (eg. Gmail)) it with any large amounts of data from our PHP Wikipedia Australian List Integration Tutorial “peer to peer” suite of linked PHP web applications passing large amounts of data to those Google Charts and emailing that on to an emailee recipient. Good news indeed!

The changes feature …

Collect a method=POST (perhaps large data set) into a potentially useful (later) PHP variable hashtag part to an “a” “mailto:” href …
<?php

$shto="";

if (isset($_POST['title'])) {
foreach ($_POST as $name => $val) {
if (strpos($val, 'data:') !== false) {
$fval=urlencode($val); //str_replace(" ", "%20", str_replace("'", urlencode("'"), str_replace('"', urlencode('"'), str_replace('=', urlencode('='), str_replace('>', urlencode('>'), str_replace('<', urlencode('<'), str_replace('?', urlencode('?'), str_replace('&', urlencode('&'), $val)))))))); } else { $fval=str_replace('+','%20',urlencode(str_replace(' ',' + ',str_replace('+',' ',$val)))); //str_replace(" ", "%20", str_replace("'", urlencode("'"), str_replace('"', urlencode('"'), str_replace('=', urlencode('='), str_replace('>', urlencode('>'), str_replace('<', urlencode('<'), str_replace('?', urlencode('?'), str_replace('&', urlencode('&'), $val)))))))); } if ($shto == "") { $shto="#" . $name . "=" . $fval; //str_replace(" ", "%20", str_replace("'", urlencode("'"), str_replace('"', urlencode('"'), str_replace('=', urlencode('='), str_replace('>', urlencode('>'), str_replace('<', urlencode('<'), str_replace('?', urlencode('?'), str_replace('&', urlencode('&'), $val)))))))); } else { $shto.="&" . $name . "=" . $fval; //str_replace(" ", "%20", str_replace("'", urlencode("'"), str_replace('"', urlencode('"'), str_replace('=', urlencode('='), str_replace('>', urlencode('>'), str_replace('<', urlencode('<'), str_replace('?', urlencode('?'), str_replace('&', urlencode('&'), $val)))))))); } } }

?>
Up the top of where PHP is writing out the Javascript, checking for an email derived URL with huge hashtag we turn into a form method=POST scenario for the user clicking the email body huge link ...

var dependssuffix='';
if (('' + location.hash).indexOf('&data=') != -1) {
dependssuffix=('' + location.hash);
}
<?php
if ($shto != "") {
echo " if (typeof sethash == \"function\") { sethash(encodeURIComponent(\"" . $shto . "\")); } " . "\n";
}

echo "
var lhpassed=('' + location.hash);
if ((1 == 1 || document.URL.split('#')[0].indexOf('?') == -1) && lhpassed.indexOf('&data=') != -1) {
if (3 == 3) { // good for new style of hashtagged email
var gformoh='<iframe name=lastgif id=lastgif style=\"position:absolute;width:100%;height:100%;z-index:897;top:0px;left:0px;\" src=></iframe><br><form style=display:none; target=_self method=POST action=\"' + document.URL.split('#')[0] + '\"><input id=gformsubis type=submit value=Submit style=display:none;></input></form>';
var fldsare=lhpassed.replace(/^\#/g,'').split('=');
for (var ifldsare=1; ifldsare<fldsare.length; ifldsare++) {
gformoh=gformoh.replace('</form>','<input type=hidden name=\"' + fldsare[eval(-1 + ifldsare)].split('&')[eval(-1 + fldsare[eval(-1 + ifldsare)].split('&').length)] + '\" value=\"' + (fldsare[ifldsare].split('&')[0]) + '\"></input></form>');
}
setTimeout(function() {
document.body.innerHTML+=gformoh;
document.getElementById('gformsubis').click(); }, 7000);
} else {
var gzhr = new XMLHttpRequest();
var gzform=new FormData();
var fldsare=lhpassed.replace(/^\#/g,'').split('=');
for (var ifldsare=1; ifldsare<fldsare.length; ifldsare++) {
gzform.append(fldsare[eval(-1 + ifldsare)].split('&')[eval(-1 + fldsare[eval(-1 + ifldsare)].split('&').length)], decodeURIComponent(fldsare[ifldsare].split('&')[0]));
}
gzhr.open('post', document.URL.split('#')[0], true);
gzhr.send(gzform);
}
}
";

?>
All location.search. strings become, for example ...
<?php echo "

var ansis=(location.search + '" . $shto . "').split('val' + pnum + '=')[1] ? decodeURIComponent(decodeURIComponent((location.search + '" . $shto . "').split('val' + pnum + '=')[1].split('&')[0]).replace(/\+/g,' ')) : '';

"; ?>
Javascript functions that are wrappers to Javascript prompt window scenarios need ...
<?php echo "

function ourprompt(ourp1, ourp2) {
if (('' + location.hash).replace('&data=') != ('' + location.hash)) { return ourp2; }
var iop=0;
tzpn='';
// more code here
thisris=prompt(ourp1, ourp2);
// more code here
return thisris;
}

"; ?>
New if for code involving no data passed in $_GET[] nor $_POST[] but huge hashtag (via email) ...
<?php

echo ' if (("" + location.hash).replace("&data=") == ("" + location.hash)) { ' . "\n";

echo ' datalineprefix = " "; ' . "\n";
echo ' datalinesuffix = ""; ' . "\n";
echo ' var prethisline = "", fti=false, extra = ""; ' . "\n";
echo ' var thisline = 1, gc_m="", gtitle="", glabel="", gvalue=""; ' . "\n";
// more code here going on to interactive Javascript prompt window asks
// more code here
echo "} \n";

echo "} \n";

?>
New Javascript function helpers ...
<?php echo "

var dependssuffix='';

function sethash(towhat) {
if (towhat.indexOf(encodeURIComponent('#')) == 0) {
dependssuffix=decodeURIComponent(towhat);
} else {
dependssuffix=towhat;
}
}

function depends(ins) {
if (ins.indexOf('?') == -1 && ins.indexOf('#') == -1 && dependssuffix != '') {
if (dependssuffix.indexOf('?') == 0) {
return (ins + '#' + dependssuffix.substring(1));
} else if (dependssuffix.indexOf('#') == 0) {
return (ins + dependssuffix);
} else {
return (ins + '#' + dependssuffix);
}
}
return ins;
}

"; ?>
Add hashtag suffix to "a" "mailto:" link href attribute as applicable ...
<?php

echo '<a id="amapid" title="Another Map" href="' . $https . 'www.rjmprogramming.com.au/PHP/Map/map.php">Another</a> <a id="amapidgeo" title="Another Geo Map" style="text-decoration:underline;cursor:pointer;" onclick=gogeo("' . $https . 'www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php");>Geo</a> <a id="amapidtwo" title="Another Map" href="' . $https . 'www.rjmprogramming.com.au/PHP/Map/map.php">Map?</a>' . '  <a onclick=ahdepends(this); href="MAILTO:fillin.email@address?subject=Google%' . '20Chart%' . '20Snapshot&body=' . urlencode("HTTP://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] . $shto) . '" style="display:inline;" title="To email a snapshot of this Google Chart click me." id="remail">Email snapshot of Google Chart ...</a>' . " \n";

?>

Codewise ...

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

Posted in eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Google Geo Chart and Map Chart Hashtag Emailing Tutorial

Google Geo Chart and Map Chart Hashtag Emailing Tutorial

Google Geo Chart and Map Chart Hashtag Emailing Tutorial

Before we got sidetracked, but along the same “where of life” themes, before the latest recent web application predilections …

… we were delving into passing on work from the Google Chart‘s Map Chart to the Google Chart Geo Chart and Image Chart Map Chart more often, where we started that thread (at Google Chart Image Chart Map Chart Mainstream Primer Tutorial at the end of last year) with a three point plan (which became four point two days later)

  1. Help itself … map.php … phase 1
  2. Redirect to Image Chart Map Chart … map.php and/or geo_chart.php … just after first prompt … phase 2
  3. Caller form method=POST map.php action interventions at onsubmit event … non map.php … phase 3
  4. Transfer the onclick prompt window functionality over to geo_chart.php … phase 4

And then yesterday’s work in Earth Bearing Distance Missing Two Earth Scanner Integration Tutorial involving the Missing Two web application’s interfacing to the Google Chart Map Chart saw a more happy interfacing with this Map Chart, and reminding us with both …

  • Google Charts Map Chart
  • Google Charts Geo Chart

… how on occasions we could have large data set scenarios relying on PHP $_POST data (via form method=POST (or you can use Ajax FormData post) arrangements) that had not passed on their data parts when the user clicked the “Email” link down the bottom. But ever since that happy discovery from around about the time of Earth Scanner Sharing Itinerary Detail Tutorial that …

  • hashtagging … was the friend of …
  • “a” “mailto:” and/or “sms:” link hrefs … replacing the need for …
  • PHP mail via a local mail server methodologies … when the email body is a single link whose length was greater than about 850 (ie. no such stringent limitations with “just clientside” hashtagging (which we’re yet to know what the limit is, but it seems huge))

… and … spoiler alert … we could not break (where we do not count as broken the clicking of a “Message clipped” message link, which we always click to fully show the whole link, as a warning from your email client application (eg. Gmail)) it with any large amounts of data from our PHP Wikipedia Australian List Integration Tutorial “peer to peer” suite of linked PHP web applications passing large amounts of data to those Google Charts and emailing that on to an emailee recipient. Good news indeed!

The changes feature …

Collect a method=POST (perhaps large data set) into a potentially useful (later) PHP variable hashtag part to an “a” “mailto:” href …
<?php

$shto="";

if (isset($_POST['title'])) {
foreach ($_POST as $name => $val) {
if (strpos($val, 'data:') !== false) {
$fval=urlencode($val); //str_replace(" ", "%20", str_replace("'", urlencode("'"), str_replace('"', urlencode('"'), str_replace('=', urlencode('='), str_replace('>', urlencode('>'), str_replace('<', urlencode('<'), str_replace('?', urlencode('?'), str_replace('&', urlencode('&'), $val)))))))); } else { $fval=str_replace('+','%20',urlencode(str_replace(' ',' + ',str_replace('+',' ',$val)))); //str_replace(" ", "%20", str_replace("'", urlencode("'"), str_replace('"', urlencode('"'), str_replace('=', urlencode('='), str_replace('>', urlencode('>'), str_replace('<', urlencode('<'), str_replace('?', urlencode('?'), str_replace('&', urlencode('&'), $val)))))))); } if ($shto == "") { $shto="#" . $name . "=" . $fval; //str_replace(" ", "%20", str_replace("'", urlencode("'"), str_replace('"', urlencode('"'), str_replace('=', urlencode('='), str_replace('>', urlencode('>'), str_replace('<', urlencode('<'), str_replace('?', urlencode('?'), str_replace('&', urlencode('&'), $val)))))))); } else { $shto.="&" . $name . "=" . $fval; //str_replace(" ", "%20", str_replace("'", urlencode("'"), str_replace('"', urlencode('"'), str_replace('=', urlencode('='), str_replace('>', urlencode('>'), str_replace('<', urlencode('<'), str_replace('?', urlencode('?'), str_replace('&', urlencode('&'), $val)))))))); } } }

?>
Up the top of where PHP is writing out the Javascript, checking for an email derived URL with huge hashtag we turn into a form method=POST scenario for the user clicking the email body huge link ...

var dependssuffix='';
if (('' + location.hash).indexOf('&data=') != -1) {
dependssuffix=('' + location.hash);
}
<?php
if ($shto != "") {
echo " if (typeof sethash == \"function\") { sethash(encodeURIComponent(\"" . $shto . "\")); } " . "\n";
}

echo "
var lhpassed=('' + location.hash);
if ((1 == 1 || document.URL.split('#')[0].indexOf('?') == -1) && lhpassed.indexOf('&data=') != -1) {
if (3 == 3) { // good for new style of hashtagged email
var gformoh='<iframe name=lastgif id=lastgif style=\"position:absolute;width:100%;height:100%;z-index:897;top:0px;left:0px;\" src=></iframe><br><form style=display:none; target=_self method=POST action=\"' + document.URL.split('#')[0] + '\"><input id=gformsubis type=submit value=Submit style=display:none;></input></form>';
var fldsare=lhpassed.replace(/^\#/g,'').split('=');
for (var ifldsare=1; ifldsare<fldsare.length; ifldsare++) {
gformoh=gformoh.replace('</form>','<input type=hidden name=\"' + fldsare[eval(-1 + ifldsare)].split('&')[eval(-1 + fldsare[eval(-1 + ifldsare)].split('&').length)] + '\" value=\"' + (fldsare[ifldsare].split('&')[0]) + '\"></input></form>');
}
setTimeout(function() {
document.body.innerHTML+=gformoh;
document.getElementById('gformsubis').click(); }, 7000);
} else {
var gzhr = new XMLHttpRequest();
var gzform=new FormData();
var fldsare=lhpassed.replace(/^\#/g,'').split('=');
for (var ifldsare=1; ifldsare<fldsare.length; ifldsare++) {
gzform.append(fldsare[eval(-1 + ifldsare)].split('&')[eval(-1 + fldsare[eval(-1 + ifldsare)].split('&').length)], decodeURIComponent(fldsare[ifldsare].split('&')[0]));
}
gzhr.open('post', document.URL.split('#')[0], true);
gzhr.send(gzform);
}
}
";

?>
All location.search. strings become, for example ...
<?php echo "

var ansis=(location.search + '" . $shto . "').split('val' + pnum + '=')[1] ? decodeURIComponent(decodeURIComponent((location.search + '" . $shto . "').split('val' + pnum + '=')[1].split('&')[0]).replace(/\+/g,' ')) : '';

"; ?>
Javascript functions that are wrappers to Javascript prompt window scenarios need ...
<?php echo "

function ourprompt(ourp1, ourp2) {
if (('' + location.hash).replace('&data=') != ('' + location.hash)) { return ourp2; }
var iop=0;
tzpn='';
// more code here
thisris=prompt(ourp1, ourp2);
// more code here
return thisris;
}

"; ?>
New if for code involving no data passed in $_GET[] nor $_POST[] but huge hashtag (via email) ...
<?php

echo ' if (("" + location.hash).replace("&data=") == ("" + location.hash)) { ' . "\n";

echo ' datalineprefix = " "; ' . "\n";
echo ' datalinesuffix = ""; ' . "\n";
echo ' var prethisline = "", fti=false, extra = ""; ' . "\n";
echo ' var thisline = 1, gc_m="", gtitle="", glabel="", gvalue=""; ' . "\n";
// more code here going on to interactive Javascript prompt window asks
// more code here
echo "} \n";

echo "} \n";

?>
New Javascript function helpers ...
<?php echo "

var dependssuffix='';

function sethash(towhat) {
if (towhat.indexOf(encodeURIComponent('#')) == 0) {
dependssuffix=decodeURIComponent(towhat);
} else {
dependssuffix=towhat;
}
}

function depends(ins) {
if (ins.indexOf('?') == -1 && ins.indexOf('#') == -1 && dependssuffix != '') {
if (dependssuffix.indexOf('?') == 0) {
return (ins + '#' + dependssuffix.substring(1));
} else if (dependssuffix.indexOf('#') == 0) {
return (ins + dependssuffix);
} else {
return (ins + '#' + dependssuffix);
}
}
return ins;
}

"; ?>
Add hashtag suffix to "a" "mailto:" link href attribute as applicable ...
<?php

echo '<a id="amapid" title="Another Map" href="' . $https . 'www.rjmprogramming.com.au/PHP/Map/map.php">Another</a> <a id="amapidgeo" title="Another Geo Map" style="text-decoration:underline;cursor:pointer;" onclick=gogeo("' . $https . 'www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php");>Geo</a> <a id="amapidtwo" title="Another Map" href="' . $https . 'www.rjmprogramming.com.au/PHP/Map/map.php">Map?</a>' . '  <a onclick=ahdepends(this); href="MAILTO:fillin.email@address?subject=Google%' . '20Chart%' . '20Snapshot&body=' . urlencode("HTTP://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] . $shto) . '" style="display:inline;" title="To email a snapshot of this Google Chart click me." id="remail">Email snapshot of Google Chart ...</a>' . " \n";

?>

Codewise ...

If this was interesting you may be interested in this too.

Posted in eLearning, Event-Driven Programming, Software, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Earth Bearing Distance Missing Two Earth Scanner Integration Tutorial

Earth Bearing Distance Missing Two Earth Scanner Integration Tutorial

Earth Bearing Distance Missing Two Earth Scanner Integration Tutorial

Today we’re combining precedents from …

… where we integrate the first into the second. Yes, you can code for a web application, to start with, normally, as a “topmost” one, but when it is asked to be “called upon” as a tool for another web application, lots of surprises can happen. Our surprise in this integration above, a bit different to a lot we do, was …

  • the Earth Scanner performs well in a popup window … but …
  • the Earth Scanner does not perform well in an iframe

… we guess, because of those calculations for the variables screenwidth and screenheight which are so crucial to the scrolling required for that Earth Scanner.

At first we thought we’d just whack into a popup window from the Missing Two host, a URL to the Earth Scanner relevant to the two places in the Missing Two web application. But then we had some time to think about it, and remembered how the work of Earth Scanner Map Image Margin Tutorial introduced …

  • a sliver of margin applied to the map image (big img element) … and we wondered “who owns that sliver?” … so, in case it was the document.body element, as we hoped, we’d try …
  • img element onclick event arrangement amendment

    document.getElementById('myimg').onclick=function(event) { event.stopPropagation(); movesallowed=false; gmovesallowed=false; if (gdefv != '') { askfor=ourprompt(event,'Earth Scanner - RJM Programming - February, 2024 ... ' + String.fromCharCode(10) + 'Thanks to https://github.com/nvkelso/natural-earth-raster/blob/master/50m_rasters/HYP_50M_SR_W/HYP_50M_SR_W.README.html ... ' + String.fromCharCode(10) + 'Currently top left of screen is (Longitude,Latitude) ' + '(' + eval(-180 + xp * 360 / 100) + ',' + eval(90 - yp * 180 / 100) + ') and bottom right is (' + eval(-180 + screenlong + xp * 360 / 100) + ',' + eval(90 - screenlat - yp * 180 / 100) + ') and around the middle is (' + eval(-180 + eval(screenlong / 2) + xp * 360 / 100) + ',' + eval(90 - eval(screenlat / 2) - yp * 180 / 100) + ').' + String.fromCharCode(10) + 'Where do you want middle of screen to be in terms of Longitude,Latitude? Suffix with space to show meridians and/or prefix with space to not show meridians.', gdefv); gdefv=''; } else { askfor=ourprompt(event,'Earth Scanner - RJM Programming - February, 2024 ... ' + String.fromCharCode(10) + 'Thanks to https://github.com/nvkelso/natural-earth-raster/blob/master/50m_rasters/HYP_50M_SR_W/HYP_50M_SR_W.README.html ... ' + String.fromCharCode(10) + 'Currently top left of screen is (Longitude,Latitude) ' + '(' + eval(-180 + xp * 360 / 100) + ',' + eval(90 - yp * 180 / 100) + ') and bottom right is (' + eval(-180 + screenlong + xp * 360 / 100) + ',' + eval(90 - screenlat - yp * 180 / 100) + ') and around the middle is (' + eval(-180 + eval(screenlong / 2) + xp * 360 / 100) + ',' + eval(90 - eval(screenlat / 2) - yp * 180 / 100) + ').' + String.fromCharCode(10) + 'Where do you want middle of screen to be in terms of Longitude,Latitude? Suffix with space to show meridians and/or prefix with space to not show meridians.', ''); } if (('' + askfor).replace('(','').replace(')','').replace('[','').replace(']','').indexOf(',') != -1) {
    ameridian='';
    acircleoflatitude='';
    enforcedlong=false;
    enforcedxp=-999; } movesallowed=true; gmovesallowed=true; };

    … augmented by …
  • positive action around the “equivalent of document.body onload event” for the Earth Scanner …

    var thecss='';
    var earth_scanner_css=location.search.split('css=')[1] ? (decodeURIComponent(location.search.split('css=')[1].split('&')[0]).replace(/\+/g,' ')) : '';
    thecss=earth_scanner_css;
    var atendest='<input type=hidden id=posturl style=display:none; value=""></input><input type=button id=dbutton onclick=checkforstt(); style=display:none;></input>';
    var atend='<br><br><div id=dc><canvas title="" id=ourcanvas width=' + ('' + eval(-15 + (window.orientation == 0 ? window.screen.height: window.screen.width)) + 'px').replace('pxpx','').replace('px','') + ' height=660 style="width:' + ('' + eval(-15 + (window.orientation == 0 ? window.screen.height: window.screen.width)) + 'px').replace('pxpx','px') + ';height:660px;border:1px solid red;background-color:' + bcol + ';' + extrastyle + '"></canvas></div><div id=xdscriptstuff></div><div id=xdstylestuff></div><textarea id=myta style=display:none; value=""></textarea><iframe onload=scranal(this); id=scrmytaif style=display:none; src=></iframe><iframe onload=styanal(this); id=stymytaif style=display:none; src=></iframe><iframe class="spag" scrolling="no" data-onload="iifopen(this);" id="cbi" frameborder="0" style="position:fixed;top:0px;left:150px;width:173px;height:218px;margin-top:-204px;display:none;" src="/HTMLCSS/client_browsing.htm?straighttext=312160562686"></iframe><textarea id=result1 style=display:none;></textarea><textarea id=result2 style=display:none;></textarea>' + exdstylestuff + exdscriptstuff + atendest;
    var parentiframe='';
    var iol='';
    if (window.opener) {
    var pu=window.opener.document.URL;
    if (pu.indexOf('#') == -1 && ('' + window.opener.location.hash).replace(/^null/g,'').replace(/^undefined/g,'') != '') {
    pu+=('#' + ('' + window.opener.location.hash)).replace(/^\#\#/g, '#');
    }
    thecss+='display:block;';
    parentiframe='<br><iframe id=mtif style="width:100%;height:800px;z-index:987;margin:0 0 0 0;margin-left:10px;margin-top:10px;background-color:rgba(0,0,255,0.5);" src="' + pu + '"></iframe><div id=dhiddens style=display:none;><div id=goagain></div><input type=hidden id=ltf value=></input><input type=hidden id=lgf value=></input><input type=hidden id=ltt value=></input><input type=hidden id=lgt value=></input><div id=slong></div><iframe id=niframe src=></iframe></div>';

    iol=' onload="document.body.onclick=function(){ document.getElementById(' + "'myimg'" + ').style.display=document.getElementById(' + "'myimg'" + ').style.display.replace(' + "'block','NONE'" + ').replace(' + "'none','block'" + ').replace(' + "'NONE','none'" + '); if (1 == 2) { document.getElementById(' + "'dstyle'" + ').style.display=document.getElementById(' + "'dstyle'" + ').style.display.replace(' + "'visible','HIDDEN'" + ').replace(' + "'hidden','visible'" + ').replace(' + "'HIDDEN','hidden'" + '); } if (document.getElementById(' + "'myimg'" + ').style.display == ' + "'none'" + ') { window.scrollTo(0,0); document.body.style.backgroundColor=' + "'rgba(255,0,0,0.5)'" + '; } else { window.scrollTo(cspx, cspy); document.body.style.backgroundColor=' + "'rgba(0,0,255,0.5)'" + '; } } " ';
    setInterval(getcsp, 5000);
    }

    document.write("<img" + iol + " src='/HTMLCSS/HYP_50M_SR_W.jpg' id=myimg width=" + eval(zoomf * 10800) + " height=" + eval(zoomf * 5400) + " style='margin:0 0 0 0;margin-left:10px;margin-top:10px;" + thecss + "'></img><div id=dstyle style=visibility:visible;></div><input id=sdtitle type=hidden value='Earth Scanner'></input><input id=sdtext type=hidden value='Earth Scanner - RJM Programming'></input><input id=sdurl type=hidden value='" + document.URL.split('#')[0] + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'') + "'></input><iframe scrolling=no farmeborder=0 style='z-index:3456;position:fixed;top:55px;left:15px;width:30px;height:24px;' onload='storeshare(this);' src='/HTMLCSS/web_share_api_test.html?emojize=128231'></iframe><input type=hidden id=itworked value=''></input><iframe onload=coordit(this); id=wif style=display:none;margin-left:50px; src='//wikipedia.org/wiki/Saint_George,_Antigua_and_Barbuda'></iframe><iframe onload=coordittwo(this); id=wiftwo style=display:none; src=></iframe><input type=hidden id=placegeo title='' value=''></input>" + atend + parentiframe);

    … calling …

    var cspx=0, cspy=0;

    function getcsp() {
    // Thanks to https://stackoverflow.com/questions/31712287/get-scroll-position-in-javascript
    var ourcspx = eval('' + (document.body.scrollX || document.body.scrollLeft || document.getElementsByTagName("html")[0].scrollLeft));
    var ourcspy = eval('' + (document.body.scrollY || document.body.scrollTop || document.getElementsByTagName("html")[0].scrollTop));
    if (ourcspx > 100) {
    cspx=ourcspx;
    cspy=ourcspy;
    }
    //document.title='cspx=' + cspx + ' and cspy=' + cspy + ' ourcspx=' + ourcspx + ' and ourcspy=' + ourcspy;
    }

… surprising us regarding how much could be done at the “child” to make this popup window arrangement be fitting into the integration so that …

  • user calls the “parent” Missing Two web application …
  • user fills in the two places … now a clickable details/summary “reveal” “Earth Scanner …” arrangement, if clicked …
  • opens new Earth Scanner popup window with the calling URL hosted in a popup window iframe element below it … so that …
  • clicking in the left hand “document.body” element’s “sliver” which might involve “user scrolling to”, to find (and yes, that is where the ownership lies, luckily) toggles the Earth Scanner topmost with Missing Two “clone” topmost …
  • with the scrolling remembered (our testing shows … “for the main part”) … or the user can choose to …
  • close the popup window in order to fall back to calling “parent” Missing Two web application window, only (still with the “Earth Scanner …” details/summary “reveal” arrangement showing)

Codewise …


Previous relevant Earth Bearing Distance Missing Two Trip Geolocation Elevation Tutorial is shown below.

Earth Bearing Distance Missing Two Trip Geolocation Elevation Tutorial

Earth Bearing Distance Missing Two Trip Geolocation Elevation Tutorial

Onto yesterday’s Earth Bearing Distance Missing Two Trip Geolocation Tutorial and its Geolocation progress we started the day with a different course of action to how we ended it. The day’s motivation was to automate a Place Name elevation knowledge in order to help with that …

What’s out there in the distance?

… thinking we talked about, first, at Earth Bearing Distance Missing Two Place Name and Horizon Tutorial.

We suspected that we were naive in our thinking because Google searches lead to nothing with our theory, that theory being that we could combine …

… could derive for us a semi reliable elevation value. There’s theory, though, and then there’s empirical application, and we could not get the application of the former match the aims with the latter, but will leave you with our Javascript attempt via …


function elevviaz(inlat) { // thanks to https://www.physicsclassroom.com/class/circles/Lesson-3/The-Value-of-g
var dsq=0.0, ddsql=0.0;
if (eval('' + zalpha) != 0) {
var cone=0.0000000000667430;
var mone=5980000000000000000000000.0;
var rone=get_radius_at_lat(inlat); //6380000.0000;
//for (var ii=1; ii<=24; ii++) {
// mone*=10.0;
//}
dsq=eval('' + mone);
alert('dsq(1 is big const)=' + dsq);
dsq*=eval('' + cone);
alert('dsq(2 times small const vs 398600441800000.0)=' + dsq);
dsq=398600441800000.0;
dsq/=9.8; //eval('' + zalpha);
alert('dsq(3 divide by iphone ' + zalpha + ')=' + dsq);
dsq=Math.pow(dsq, 0.5);
alert('dsq(4 square root)=' + dsq);
rone=dsq; //dsq-=rone;
alert('dsq(5 minus sea level earth radius ' + rone + ')=' + dsq);

dsq=eval('' + mone);
alert('dsq(1 is big const)=' + dsq);
dsq*=eval('' + cone);
alert('dsq(2 times small const vs 398600441800000.0)=' + dsq);
dsq=398600441800000.0;
dsq/=eval('' + zalpha);
alert('dsq(3 divide by iphone ' + zalpha + ')=' + dsq);
dsq=Math.pow(dsq, 0.5);
alert('dsq(4 square root)=' + dsq);
dsq-=rone;
alert('dsq(5 minus sea level earth radius ' + rone + ')=' + dsq);

}
return dsq;
}

After abandoning this approach, sadly, later in the day some sporadically happier news was that we discovered that the Geolocation API can sometimes pass across a decent elevation value, which we applied as below into our code’s thinking in our changed missing_two.html‘s “Missing Two” web application.


var appendz="";
var iinb=0;


function showPosition(position) {
if (userlatitude == 0.0 && userlongitude == 0.0) {
userlatitude=eval('' + position.coords.latitude);
userlongitude=eval('' + position.coords.longitude);
//alert('' + position.coords.heading);
if (('' + position.coords.altitude).replace('null','') != '' && iinb == -1) {
appendz=";" + ('' + position.coords.altitude).replace('null','');
}

if (userlatitude != 0.0 || userlongitude != 0.0) {
//document.getElementById('you').innerHTML='(0,0)';
if (document.getElementById('spfr').innerHTML.indexOf('rom') != -1) {
if (document.getElementById('latf') && document.getElementById('longf')) {
document.getElementById('latf').focus();
document.getElementById('latf').value=userlatitude;
document.getElementById('longf').focus();
document.getElementById('longf').value=userlongitude;
document.getElementById('latf').focus();
userlatitude=0.0;
userlongitude=0.0;
document.getElementById('ssf').innerHTML='Here';
if (appendz != '') {
fplacen='Here (elevation ' + appendz.substring(1) + ' m)';
document.getElementById('ssf').innerHTML=fplacen;
} else {

fplacen='Here';
}
gllentry='' + document.getElementById('latf').value + ',' + document.getElementById('longf').value + ',' + fplacen;
askit();
//document.getElementById('spfr').innerHTML='to';
}
} else {
if (document.getElementById('latt') && document.getElementById('longt')) {
document.getElementById('latt').focus();
document.getElementById('latt').value=userlatitude;
document.getElementById('longt').focus();
document.getElementById('longt').value=userlongitude;
document.getElementById('latt').focus();
userlatitude=0.0;
userlongitude=0.0;
document.getElementById('sst').innerHTML='Here';
if (appendz != '') {
tplacen='Here (elevation ' + appendz.substring(1) + ' m)';
document.getElementById('sst').innerHTML=tplacen;
} else {

tplacen='Here';
}
gllentry='' + document.getElementById('latt').value + ',' + document.getElementById('longt').value + ',' + tplacen;
askit();
}
}
}
}
}

function getLocation(inb) {
iinb=inb.indexOf(';');
if (navigator.geolocation) {
try {
navigator.geolocation.getCurrentPosition(showPosition);
//setTimeout(later, 1000);
if (appendz != "" && iinb != -1) { appendz=""; }
if (inb != inb.trim() && document.getElementById('spfr').innerHTML.indexOf('rom') != -1) { fplacen+=' '; }
if (inb != inb.trim() && document.getElementById('spfr').innerHTML.indexOf('rom') == -1) { tplacen+=' '; }
if (document.getElementById('spfr').innerHTML.indexOf('rom') != -1) {
document.getElementById('ipn').value=fplacen;
} else {
document.getElementById('ipn').value=tplacen;
}
gid = navigator.geolocation.watchPosition(gsuccess, gerror, goptions);
return false;
} catch(err) {
//setTimeout(later, 1000);
}
} else if (userlatitude != 0.0 || userlongitude != 0.0) {
//document.getElementById('you').innerHTML='(0,0)';
if (document.getElementById('spfr').innerHTML.indexOf('rom') != -1) {
if (document.getElementById('latf') && document.getElementById('longf')) {
document.getElementById('latf').focus();
document.getElementById('latf').value=userlatitude;
document.getElementById('longf').focus();
document.getElementById('longf').value=userlongitude;
document.getElementById('latf').focus();
userlatitude=0.0;
userlongitude=0.0;
document.getElementById('ssf').innerHTML='Here';
if (appendz != '') {
fplacen='Here (elevation ' + appendz.substring(1) + ' m)';
document.getElementById('ssf').innerHTML=fplacen;
} else {

fplacen='Here';
}
gllentry='' + document.getElementById('latf').value + ',' + document.getElementById('longf').value + ',' + fplacen;
askit();
//document.getElementById('spfr').innerHTML='to';
return false;
}
} else {
if (document.getElementById('latt') && document.getElementById('longt')) {
document.getElementById('latt').focus();
document.getElementById('latt').value=userlatitude;
document.getElementById('longt').focus();
document.getElementById('longt').value=userlongitude;
document.getElementById('latt').focus();
userlatitude=0.0;
userlongitude=0.0;
document.getElementById('sst').innerHTML='Here';
if (appendz != '') {
tplacen='Here (elevation ' + appendz.substring(1) + ' m)';
document.getElementById('sst').innerHTML=tplacen;
} else {

tplacen='Here';
}
gllentry='' + document.getElementById('latt').value + ',' + document.getElementById('longt').value + ',' + tplacen;
askit();
return false;
}
}
}
return true;
}


Previous relevant Earth Bearing Distance Missing Two Trip Geolocation Tutorial is shown below.

Earth Bearing Distance Missing Two Trip Geolocation Tutorial

Earth Bearing Distance Missing Two Trip Geolocation Tutorial

Okay, it’s the day where gobsmacked readers of Earth Bearing Distance Missing Two Trip Compass Tutorial and (all) users of its “Missing Two” web application can be relieved of their “gobsmackederhood“?! Yes …

  • on top of our Wikipedia way to glean Latitude and Longitude for a Place Name … today (oh, but the shame of it all, the shame, leaving it for so long … oh, the shame of“okay, that’s it … pull yourself together”) we finally get around to …
  • “Here” Place Name based HTML5 Geolocation API (should the user be allowing Location Services (into their frightfully busy lives) for their web browser of use) … yayyyyyyyy!

… is flagged to the user via that top textbox’s “placeholder” blurb being adjusted (for 7 seconds) as a user focuses there via changed HTML


<h1 id=myh1 style='display:block;'>Missing Two (<font size=1>optional</font> <span onclick="this.innerHTML=this.innerHTML.replace('to','From').replace('from','to').replace('From','from'); document.getElementById('ipn').focus(); " id=spfr title='Click me to toggle between from and to' style='cursor:pointer;'>from</span> <input onfocus='hereit(this,"");' title='Optionally semicolon separate an elevation affecting horizon distance used for Place Name/Bearing (where Compass app might show you this elevation value) input scenarios. Note that a Place Name/Distance scenario shows a Locality Distance Ring map. Append space for gyroscope bearing.' onblur='lkwk(this,"");' style='display:inline-block;width:280px;' placeholder='Place Name' id=ipn value='' type=text></input>) in Table Column <span data-onfocus="document.getElementById('semail').innerHTML='';" data-title='Email to (append a space to just show the table cell with the gradient)?' data-contenteditable=true data-onblur=preemail(this.innerHTML); onclick=emailit(''); id=semail title=Email>&#128231;</span> <span data-onfocus="document.getElementById('semail').innerHTML='';" data-title='SMS to?' data-contenteditable=true data-onblur=preemail(this.innerHTML); onclick=toize(''); id=ssms title=SMS>&#128223;</span><div id=dntable style=display:none;>    <table border=1 id=ntable style="background-color:pink;display:inline-block;font-size:10px;"><tr><td>N</td></tr><tr><td>&#11014;</td></tr></table>    <div style='display:inline-block;cursor:pointer;' id=arrowup title='To Portrait Up ... line up, parallel, with compass N to face North the ideal way' onclick='alert(this.title);'>&#11014;</div></div></h1>

… calling on new Javascript …


var oiqplaceholder='';

function oiqit() {
if (oiqplaceholder != '') {
hereit(document.getElementById('ipn'), oiqplaceholder);
oiqplaceholder='';
} else if (document.getElementById('ipn')) {
if (('' + document.getElementById('ipn').placeholder).indexOf('"Here" ') == 0 && ('' + document.getElementById('ipn').placeholder).indexOf(' Longitude. ') != -1) {
document.getElementById('ipn').placeholder=document.getElementById('ipn').placeholder.split(' Longitude. ')[1];
}
}
}

function hereit(oiq, twopis) {
var wasp='';
if (twopis != '') {
if (('' + oiq.placeholder).indexOf('"Here"') == -1) {
wasp=('' + oiq.placeholder);
oiq.placeholder='"Here" uses Geolocation derived Latitude, Longitude. ' + wasp;
setTimeout(oiqit, 7000);
}
document.getElementById('myh1').style.cursor='pointer';
} else if (oiq.value == '' && document.URL.toLowerCase().indexOf('https') == 0) {
if (('' + oiq.placeholder).indexOf('"Here"') == -1) {
wasp=('' + oiq.placeholder);
oiqplaceholder='"Here" uses Geolocation derived Latitude, Longitude. ' + wasp;
document.getElementById('myh1').style.cursor='progess';
setTimeout(oiqit, 500);
}
}
}

… and if the user types in the Here  we are looking for


function lkwk(oiis, twop) {
var doi=true;
if (oiis.value.trim() != '') {
if ((('' + oiis.value).replace(/\"/g,'').replace(/\'/g,'').replace(';',' ') + ' ').toLowerCase().indexOf('here ') == 0) { doi=false; if (1 == 2) { oiis.value=''; } doi=getLocation(); if (1 == 2) { return ''; } }
if (document.getElementById('tdmid')) {
if (document.getElementById('tdmid').innerHTML.toLowerCase().indexOf('<iframe') != -1) {
if (document.getElementById('spfr')) {
if (document.getElementById('spfr').innerHTML.toLowerCase().indexOf('rom') != -1) {
location.href=document.URL.split('#')[0].split('?')[0] + '?ipn=' + encodeURIComponent(oiis.value);
}
}
}
}
if (oiis.value.trim() != oiis.value) { tplacen=tplacen.trim(); } else { tplacen+=String.fromCharCode(32); }
var ois=oiis.value.trim().split(';');
if (doi) { document.getElementById('ifplacegeo').src=document.getElementById('ifplacegeo').src.split('?')[0].split('#')[0] + '?placegeo=' + encodeURIComponent(ois[0]); }
if (eval('' + ois.length) > 1) { elev=eval('' + ois[1]); evel=Math.max(elev, 2.0); }
if (twop == '') { oiis.value=''; }
if (doi) { document.body.style.cursor='progress'; }
}
}

… new Geolocation API Javascript code swings into action …


var userlatitude=0.0, userlongitude=0.0;

function getLocation() {
if (navigator.geolocation) {
try {
navigator.geolocation.getCurrentPosition(showPosition);
//setTimeout(later, 1000);
return false;
} catch(err) {
//setTimeout(later, 1000);
}
} else if (userlatitude != 0.0 || userlongitude != 0.0) {
//document.getElementById('you').innerHTML='(0,0)';
if (document.getElementById('spfr').innerHTML.indexOf('rom') != -1) {
if (document.getElementById('latf') && document.getElementById('longf')) {
document.getElementById('latf').focus();
document.getElementById('latf').value=userlatitude;
document.getElementById('longf').focus();
document.getElementById('longf').value=userlongitude;
document.getElementById('latf').focus();
userlatitude=0.0;
userlongitude=0.0;
document.getElementById('ssf').innerHTML='Here';
gllentry='' + document.getElementById('latf').value + ',' + document.getElementById('longf').value + ',Here';
askit();
//document.getElementById('spfr').innerHTML='to';
fplacen='Here';
return false;
}
} else {
if (document.getElementById('latt') && document.getElementById('longt')) {
document.getElementById('latt').focus();
document.getElementById('latt').value=userlatitude;
document.getElementById('longt').focus();
document.getElementById('longt').value=userlongitude;
document.getElementById('latt').focus();
userlatitude=0.0;
userlongitude=0.0;
document.getElementById('sst').innerHTML='Here';
gllentry='' + document.getElementById('latt').value + ',' + document.getElementById('longt').value + ',Here';
askit();
tplacen='Here';
return false;
}
}
}
return true;
}


function showPosition(position) {
if (userlatitude == 0.0 && userlongitude == 0.0) {
userlatitude=eval('' + position.coords.latitude);
userlongitude=eval('' + position.coords.longitude);
if (userlatitude != 0.0 || userlongitude != 0.0) {
//document.getElementById('you').innerHTML='(0,0)';
if (document.getElementById('spfr').innerHTML.indexOf('rom') != -1) {
if (document.getElementById('latf') && document.getElementById('longf')) {
document.getElementById('latf').focus();
document.getElementById('latf').value=userlatitude;
document.getElementById('longf').focus();
document.getElementById('longf').value=userlongitude;
document.getElementById('latf').focus();
userlatitude=0.0;
userlongitude=0.0;
document.getElementById('ssf').innerHTML='Here';
gllentry='' + document.getElementById('latf').value + ',' + document.getElementById('longf').value + ',Here';
askit();
//document.getElementById('spfr').innerHTML='to';
fplacen='Here';
}
} else {
if (document.getElementById('latt') && document.getElementById('longt')) {
document.getElementById('latt').focus();
document.getElementById('latt').value=userlatitude;
document.getElementById('longt').focus();
document.getElementById('longt').value=userlongitude;
document.getElementById('latt').focus();
userlatitude=0.0;
userlongitude=0.0;
document.getElementById('sst').innerHTML='Here';
gllentry='' + document.getElementById('latt').value + ',' + document.getElementById('longt').value + ',Here';
askit();
tplacen='Here';
}
}
}
}
}

… into our changed missing_two.html‘s “Missing Two” web application.

What a programmer’s relief!


Previous relevant Earth Bearing Distance Missing Two Trip Compass Tutorial is shown below.

Earth Bearing Distance Missing Two Trip Compass Tutorial

Earth Bearing Distance Missing Two Trip Compass Tutorial

The recent Earth Bearing Distance Missing Two Trip North Point Tutorial set up a …

  • mobile device “North point” additional functionality … and today …
  • more compass use helpers to guide user towards facing North … as well as …
  • allow for Degrees Minutes Seconds as alternative angular method of entry harnessing changed HTML … exemplified by …

    Latitude (decimal degrees): <input title='' style='width:90px;display:inline-block;' onchange='this.style.backgroundColor="pink";cwhat[0]=false; cwhat[1]=false; if (!decided) { if (!cwhat[5]) { cwhat[5]=true; } if (!cwhat[4]) { cwhat[4]=true; } decided=true; } top.document.getElementById("ltf").value=this.value; ' onblur='this.style.backgroundColor="pink"; cwhat[0]=false; cwhat[1]=false; if (!decided) { if (!cwhat[5]) { cwhat[5]=true; } if (!cwhat[4]) { cwhat[4]=true; } decided=true; } top.document.getElementById("ltf").value=mdms(this.value,this); ' id=latf name=latf type=number onfocus='ati=0; atic=[]; atis=[];' onkeydown='couldbedms(event);' min=-90.0000000 max=90.0000000 step=0.0000010 value='0.0000000'></input><br>

    … helped out by new Javascript …

    var ati=0, atis=[], atic=[];

    function mdms(tvis, otvis) {
    var altvl=0.0, dvr=1.0, isv=0;
    if (eval('' + atic.length) >= 1) {
    //alert('ov=' + otvis.value + ' and atic[0]=' + atic[0]);
    if (atic[0].indexOf('-') != -1 && otvis.value.indexOf('-') == -1) {
    isv++;
    } else if (atic[0].indexOf('+') != -1 && otvis.value.indexOf('+') == -1) {
    isv++;
    } else if (eval('' + atis.length) >= 2) {
    if (eval('' + atis[1]) > 60) { isv++; }
    }
    }
    if (eval('' + atic.length) > 1) {
    //alert('Here ' + atic.length + ' last is=' + atic[eval(-1 + atic.length)]);
    for (var ijh=0; ijh<atic.length; ijh++) {
    if (atic[ijh].trim() != '') {
    isv++;
    if (atic[0].indexOf('-') != -1) {
    altvl-=eval(eval('' + dvr) * eval(atic[ijh].replace('-','')));
    } else {
    altvl+=eval(eval('' + dvr) * eval(atic[ijh].replace('-','')));
    }
    //alert('Here ' + altvl);
    dvr/=60.0;
    }
    }
    if (isv > 1) {
    tvis='' + altvl;
    otvis.value='' + altvl;
    }
    }
    ati=0;
    atic=[];
    atis=[];
    return tvis;
    }

    function idms(otvis) {
    var altvl=0.0, dvr=1.0, isv=0;
    if (eval('' + atic.length) >= 1) {
    //alert('Ov=' + otvis.value + ' and Atic[0]=' + atic[0]);
    if (atic[0].indexOf('-') != -1 && otvis.value.indexOf('-') == -1) {
    isv++;
    } else if (atic[0].indexOf('+') != -1 && otvis.value.indexOf('+') == -1) {
    isv++;
    } else if (eval('' + atis.length) >= 2) {
    if (eval('' + atis[1]) > 60) { isv++; }
    }
    }
    if (eval('' + atic.length) > 1) {
    //alert('here ' + atic.length + ' last is=' + atic[eval(-1 + atic.length)]);
    for (var ijh=0; ijh<atic.length; ijh++) {
    if (atic[ijh].trim() != '') {
    isv++;
    if (atic[0].indexOf('-') != -1) {
    altvl-=eval(eval('' + dvr) * eval(atic[ijh].replace('-','').replace('+','')));
    } else {
    altvl+=eval(eval('' + dvr) * eval(atic[ijh].replace('-','').replace('+','')));
    }
    //alert('here ' + altvl);
    dvr/=60.0;
    }
    }
    if (isv > 1) {
    otvis.value='' + altvl;
    }
    }
    ati=0;
    atic=[];
    atis=[];
    return otvis;
    }

    function couldbedms(event) {
    var wasc='';
    if (eval('' + event.keyCode) == 69 || eval('' + event.keyCode) == 78 || eval('' + event.keyCode) == 87 || eval('' + event.keyCode) == 83 || eval('' + event.keyCode) == 187 || eval('' + event.keyCode) == 189 || eval('' + event.keyCode) == 190 || (eval('' + event.keyCode) >= 48 && eval('' + event.keyCode) <= 57)) {
    if (ati == 0) { atis=[]; atis.push(0); atic.push(''); } else if (ati < 0) { ati=0; }
    ati++;
    atis[eval(-1 + atis.length)]=ati;
    if (eval('' + event.keyCode) == 87 || eval('' + event.keyCode) == 83) {
    if (atic[0].indexOf('-') == -1) { wasc=atic[0]; atic[0]='-' + wasc; }
    } else if (eval('' + event.keyCode) == 69 || eval('' + event.keyCode) == 78) {
    if (atic[0].indexOf('+') == -1) { wasc=atic[0]; atic[0]='+' + wasc; }
    } else if (eval('' + event.keyCode) != 187) {
    atic[eval(-1 + atic.length)]+=String.fromCharCode(eval(eval('' + event.keyCode) % 144));
    }
    } else {
    ati=-1;
    if (eval('' + event.keyCode) >= 65 && eval('' + event.keyCode) <= 90) {
    atis.push(eval('' + event.keyCode));
    } else {
    atis.push(0);
    }
    atic.push('');
    }
    }

… improving the functionality and ease of use of our changed missing_two.html‘s “Missing Two” web application when using a mobile platform.


Previous relevant Earth Bearing Distance Missing Two Trip North Point Tutorial is shown below.

Earth Bearing Distance Missing Two Trip North Point Tutorial

Earth Bearing Distance Missing Two Trip North Point Tutorial

We build on the recent Earth Bearing Distance Missing Two Trip Tap Orientation Tutorial and help out those “what’s out there in the distance” dreamers of Earth Bearing Distance Missing Two Trip Details Orientation Tutorial by, today adding a “North point” (HTML table element) to …

… on some mobile platforms, such as the iOS iPad we tested, adding compass like new functionality, as per the new HTML …


<h1 id=myh1 style='display:block;'>Missing Two (<font size=1>optional</font> <span onclick="this.innerHTML=this.innerHTML.replace('to','From').replace('from','to').replace('From','from'); document.getElementById('ipn').focus(); " id=spfr title='Click me to toggle between from and to' style='cursor:pointer;'>from</span> <input title='Optionally semicolon separate an elevation affecting horizon distance used for Place Name/Bearing (where Compass app might show you this elevation value) input scenarios. Note that a Place Name/Distance scenario shows a Locality Distance Ring map. Append space for gyroscope bearing.' onblur='lkwk(this);' style='display:inline-block;width:280px;' placeholder='Place Name' id=ipn value='' type=text></input>) in Table Column <span data-onfocus="document.getElementById('semail').innerHTML='';" data-title='Email to (append a space to just show the table cell with the gradient)?' data-contenteditable=true data-onblur=preemail(this.innerHTML); onclick=emailit(''); id=semail title=Email>&#128231;</span> <span data-onfocus="document.getElementById('semail').innerHTML='';" data-title='SMS to?' data-contenteditable=true data-onblur=preemail(this.innerHTML); onclick=toize(''); id=ssms title=SMS>&#128223;</span><div id=dntable style=display:none;>    <table border=1 id=ntable style="background-color:pink;display:inline-block;font-size:10px;"><tr><td>N</td></tr><tr><td>&#11014;</td></tr></table>    &#11014;</div></h1>

… and Javascript …


var wasthisso='' + (screen.msOrientation || screen.mozOrientation || (screen.orientation || {}).type); //"portrait";
var wasangle=eval(180 - eval('' + window.orientation));


if (1 == 1) {
window.addEventListener("orientationchange", function() {
// Announce the new orientation number
wasangle=eval(180 - eval('' + window.orientation));
var thisso='' + screen.msOrientation || screen.mozOrientation || (screen.orientation || {}).type;
if (('' + thisso) == 'undefined') {
var mql=window.matchMedia("(orientation: portrait)");
// If there are matches, we're in portrait
if (mql.matches) {
thisso="Portrait"; // Portrait orientation
} else {
thisso="Landscape"; // Landscape orientation
}
}


if (thisso != wasthisso) {
wasthisso=thisso;
//alert('ori');
}
}, false);
}

if (window.DeviceOrientationEvent) {
if (1 == 2) { alert(1); }
// Listen for orientation changes ... thanks to https://davidwalsh.name/orientation-change
// Listen for the deviceorientation event and handle the raw data
window.addEventListener('deviceorientation', function(eventData) {
// gamma is the left-to-right tilt in degrees, where right is positive
if (1 == 2) { alert(11); }
if (document.getElementById('ipn')) {
//if (('' + document.getElementById('ipn').placeholder).indexOf('Append space and face north for gyroscope bearing.') == -1) {
if (('' + document.getElementById('ipn').placeholder).indexOf(' and ') == -1) {
document.getElementById('ipn').className='ph';
document.getElementById('ipn').placeholder+='. Append space and portrait face north for gyroscope bearing.';
document.getElementById("myviewport").setAttribute("content", "width=device-width, initial-scale=1.5, minimum-scale=0.1, maximum-scale=8, user-scalable=yes");
setTimeout(asafn, 5000);
}
}
//eventData.absolute=true;


var eventDataalpha = eval(360.0 - eval('' + eventData.alpha)); // lalpha)); //
if (eventData.absolute !== true && +eventData.webkitCompassAccuracy > 0 && +eventData.webkitCompassAccuracy < 50) {
eventDataalpha = eval('' + eventData.webkitCompassHeading || 0);
if (document.getElementById('dntable')) { document.getElementById('dntable').style.display='inline-block'; }
}

if (!datstart) { eventDataalpha-=initial_yaw; }


tiltLeftToRight = eval('' + eventData.gamma);

// beta is the front-to-back tilt in degrees, where front is positive
tiltFrontToBack = eval('' + eventData.beta);

// alpha is the compass direction the device is facing in degrees
lastalpha='' + eventData.alpha; // lalpha; //
dorbrg = eval('' + eventDataalpha); //compassHeading(eval('' + eventDataalpha), tiltFrontToBack, tiltLeftToRight);
if (1 == 2) { alert(dorbrg); }
if (document.URL.indexOf('aleJUNKrt=') != -1) {
alert(dorbrg);
}
if (document.URL.indexOf('upJUNKdate=') != -1 || (fplacen != '' && tplacen == '')) {
if (eventData.absolute || 1 == 1) {
//document.getElementById('brg').value='' + eval(eval(540.0 - eval('' + dorbrg)) % 360.0);
//document.getElementById('brg').value='' + eval(eval(720.0 - eval('' + dorbrg)) % 360.0);
//document.getElementById('brg').value='' + dorbrg;
if (eval(dcnt % 10) == 0) {
document.getElementById('brg').value='' + eval(eval(720.0 + eval('' + dorbrg)) % 360.0);
document.getElementById('brg').style.backgroundColor='yellow';
}
dcnt++;
}
}


if (datstart && (fplacen != '' && tplacen == '')) {
datstart=false;
//initial_yaw=eval(360.0 - eval('' + lalpha)); //eventData.alpha));
//alert('0:' + initial_yaw);
if (!eventData.absolute) {
initial_yaw=eval(360.0 - eval('' + eventData.alpha)); // lalpha)); //
}
//alert('' + initial_yaw);
initial_pitch=Math.round(tiltFrontToBack);
initial_roll=Math.round(tiltLeftToRight);
//alert(initial_yaw + ',' + initial_pitch + ',' + initial_roll);
}


if (document.getElementById('ntable')) {
var ts=450;
if (wasangle != 0) {
ts+=wasangle;
}
try { document.getElementById('ntable').style.webkitTransform = ("rotate(" + eval(ts - Math.round(dorbrg)) + "deg)"); } catch(e10) { }
try { document.getElementById('ntable').style.MozTransform = ("rotate(" + eval(ts - Math.round(dorbrg)) + "deg)"); } catch(e1000) { }
try { document.getElementById('ntable').style.msTransform = ("rotate(" + eval(ts - Math.round(dorbrg)) + "deg)"); } catch(e100) { }
try { document.getElementById('ntable').style.OTransform = ("rotate(" + eval(ts - Math.round(dorbrg)) + "deg)"); } catch(e10000) { }
try { document.getElementById('ntable').style.transform = ("rotate(" + eval(ts - Math.round(dorbrg)) + "deg)"); } catch(e1) { }
}



handleOrientationEvent(tiltFrontToBack, tiltLeftToRight, dorbrg, eventData.absolute);

if ((fplacen != '' && tplacen == '') && document.getElementById('ipn')) {
//if (('' + document.getElementById('ipn').placeholder).indexOf('Append space and face north for gyroscope bearing.') != -1) {
if (('' + document.getElementById('ipn').placeholder).indexOf('Append space and ') != -1) {
document.getElementById('ipn').style.backgroundColor='#f0f0f0';
//document.getElementById('ipn').placeholder=document.getElementById('ipn').placeholder.split('Append space and face north for gyroscope bearing.')[0] + ' Now swivel to direction of interest then tap yellow textbox.';
document.getElementById('ipn').placeholder=document.getElementById('ipn').placeholder.split('Append space and ')[0] + ' Now swivel to direction of interest then tap yellow textbox.';
document.getElementById("myviewport").setAttribute("content", "width=device-width, initial-scale=1.2, minimum-scale=0.1, maximum-scale=8, user-scalable=yes");
//window.scrollBy(0,50); //location.href='#brg';
}
}


}, false);
}


Previous relevant Earth Bearing Distance Missing Two Trip Tap Orientation Tutorial is shown below.

Earth Bearing Distance Missing Two Trip Details Tap Tutorial

Earth Bearing Distance Missing Two Trip Tap Orientation Tutorial

That window.DeviceOrientationEvent event work of the recent Earth Bearing Distance Missing Two Trip Details Orientation Tutorial was missing an important point. We learnt about this point by debugging on an iOS (iPhone 7) Google Chrome web browser, as we showed with yesterday’s Google Chrome on iOS Web Browser Debug Tutorial. That tutorial’s finding lead us to the Google search for …


ERROR NotAllowedError Requesting device

… and onto the excellent How to requestPermission for devicemotion and deviceorientation events in iOS 13+

One more thing

One more thing to keep in mind is that requestPermission could only be called on a user gesture (e.g. click). This is reasonable UX too as we would want to tell users why we are asking for such permissions and let them confirm before prompting them so that they see it coming.

Otherwise you would get this error:

Console error: NotAllowedError: Requesting device orientation or motion access requires a user gesture to prompt

… where we needed to shift our oft-used document.body onload event code placement thinking to allow for this thinking, plus the provision of a button for the user to tap, as required, should the “permission” popup window be required to seek permission to, effectively, access that device’s gyroscope measurements via that window.DeviceOrientationEvent and/or window.DeviceMotionEvent event(s).

This is a similar Apple requirement, as it applies to iOS playing audio files, which we have mentioned quite a bit at this blog. One could say …

We should have known.

… and luckily two is too polite to say …

You blockhead!

… to which we are infinitely grateful, and will install for the rest of the day, that …

Two is our favourite number (for the rest of today, that is).

But it’s not only …

… for you to try for yourself, perhaps there on your mobile device with an accessible gyroscope on a compatible web browser such as Google Chrome (or others, now) on iOS.


Previous relevant Earth Bearing Distance Missing Two Trip Details Orientation Tutorial is shown below.

Earth Bearing Distance Missing Two Trip Details Orientation Tutorial

Earth Bearing Distance Missing Two Trip Details Orientation Tutorial

Humans, particularly before the advent of the mobile devices, were probably (as a whole) more skilled regarding navigation via “landmarks” or “sunmarks” or “moonmarks” working out …

In which direction is North?

Well, the irony here, today, is that the better you have been hanging onto these skills you are, the better you can use our new …

  • mobile phone …
  • containing a gyroscope … but …
  • not an accessible compass (or if so, the knowledge of where North is becomes superfluous below)
  • using a compatible web browser such as Google Chrome …
  • a good indication your scenario is compatible being that at some stage you answer “Allow” to a prompt as below …

    … at some point … using …
  • today’s changed missing_two.html‘s live run link modifications … using …
    1. window.DeviceOrientationEvent event … and perhaps you could use …
    2. window.DeviceMotionEvent event

  • software detection to offer that user …

… the chance to mix technology with human navigational instincts to answer that perennial question similarly asked in Earth Bearing Distance Missing Two Place Name and Horizon Tutorial

What’s out there in the distance?

… via …

  1. using a compatible web browser such as Google Chrome … live run
  2. point your mobile phone in portrait to North (or at least arrange to do this just before tapping the Done link in step below)
  3. enter in a Place Name into that top textbox (to which, it’s good, as known, to append semicolon elevation) and add a space, and because you are on a mobile device, tap the Done link
  4. bearing text will start being updated with bearing of your mobile device portrait mode top pointing direction … so …
  5. when you’ve swivelled the mobile device to be pointing (in portrait) to the (What’s out there in the distance?) direction of interest, tap that yellow bearing textbox, then tap the Done link … resulting in …
  6. Google Chart Map Chart showing your Place Name and (the calculated) Horizon Position in that direction of your choosing

… meaning the combination of …

  • your mobile device’s gyroscope’s angle measuring talent (akin to those theodolite talents Land Surveyors are using) … and …
  • your navigational talents knowing where North is

… save you having to know that awkward “bearing” (in degrees) textbox answer to What’s out there in the distance? Perhaps see what we mean viewing today’s animated GIF presentation.

Onto yesterday’s Earth Bearing Distance Missing Two Trip Details Styling Tutorial and since the last time we ventured into the wooooorrrrrlllldddd of “window.DeviceOrientationEvent” logic we’ve gotten great help Javascript coding for the permissions side to the handling of this event, as per …


if ((navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i) || document.URL.indexOf('alert=') != -1) && document.URL.toLowerCase().indexOf('https:') != 0) {
location.href=document.URL.replace('http:','https:') + '&random=' + Math.floor(Math.random() * 174765654);
}
if ((navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i) || document.URL.indexOf('update=') != -1) && document.URL.toLowerCase().indexOf('https:') != 0) {
location.href=document.URL.replace('http:','https:') + '&random=' + Math.floor(Math.random() * 174765654);
}

// Thanks to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await and
// https://gist.github.com/Ajasra/ddd616505013a4309c0dda8a8ba626cb

async function myfunction() {
console.log('Inside of myfunction');
//alert(0);
if (window.DeviceOrientationEvent && typeof(DeviceOrientationEvent.requestPermission) === "function") {
//alert(4);
const permissionState = await DeviceOrientationEvent.requestPermission().then(response => {
if (response === 'granted') {
if (1 == 2) { alert('GrAnted'); }
//window.addEventListener('deviceorientation', OrientationHandler, true);
dorh();
} else if (result.state === 'prompt') {
if (1 == 2) { alert("Need prompt!"); }
} else {
if (1 == 2) { alert("Not Supported!"); }
}
}).catch(console.error);

//if (permissionState === "granted") {
// alert('granted');
//} else {
// alert('denied');
//}
} else if (window.DeviceOrientationEvent) {
//alert(44);
dorh();
}

if (window.DeviceMotionEvent && typeof(DeviceMotionEvent.requestPermission) === "function") {
//alert(24);
const permissionStateM = await DeviceMotionEvent.requestPermission().then(response => {
if (response === 'granted') {
if (1 == 2) { alert('GranTed'); }
window.addEventListener('devicemotion', function(event) {
lalpha='' + event.rotationRate.alpha;
});
//window.addEventListener('deviceorientation', OrientationHandler, true);
} else if (result.state === 'prompt') {
if (1 == 2) { alert("NeeD prompt!"); }
} else {
if (1 == 2) { alert("NoT Supported!"); }
}
}).catch(console.error);

//if (permissionStateM === "granted") {
// alert('Granted');
//} else {
// alert('Denied');
//}
} else if (window.DeviceMotionEvent) {
//alert(244);
window.addEventListener('devicemotion', function(event) {
lalpha='' + event.rotationRate.alpha;
});
}

}

// Here we wait for the myfunction to finish
// and then returns a promise that'll be waited for aswell
// It's useless to wait the myfunction to finish before to return
// we can simply returns a promise that will be resolved later

// Also point that we don't use async keyword on the function because
// we can simply returns the promise returned by myfunction
function start() {
return myfunction();
}

// Call start
(async() => {
console.log('before start');

await start();


console.log('after start');
})();

var degtorad = Math.PI / 180; // Degree-to-Radian conversion ... thanks to https://www.w3.org/TR/orientation-event/#worked-example

function dorh() {
//let laSensor = new LinearAccelerationSensor({frequency: 60});

//laSensor.addEventListener('reading', e => {
// console.log("Linear acceleration along the X-axis " + laSensor.x);
// console.log("Linear acceleration along the Y-axis " + laSensor.y);
// console.log("Linear acceleration along the Z-axis " + laSensor.z);
//});
//laSensor.start();


//window.addEventListener('devicemotion', function(event) {
// alert(event.rotationRate.alpha + ' m/s2');
//});


if (1 == 3) {
window.addEventListener("orientationchange", function() {
// Announce the new orientation number
var thisso='' + screen.msOrientation || screen.mozOrientation || (screen.orientation || {}).type;
if (('' + thisso) == 'undefined') {
var mql=window.matchMedia("(orientation: portrait)");
// If there are matches, we're in portrait
if (mql.matches) {
thisso="Portrait"; // Portrait orientation
} else {
thisso="Landscape"; // Landscape orientation
}
}


if (thisso != wasthisso) {
wasthisso=thisso;
alert('ori');
}
}, false);
}

if (window.DeviceOrientationEvent) {
if (1 == 2) { alert(1); }
// Listen for orientation changes ... thanks to https://davidwalsh.name/orientation-change
// Listen for the deviceorientation event and handle the raw data
window.addEventListener('deviceorientation', function(eventData) {
// gamma is the left-to-right tilt in degrees, where right is positive
if (1 == 2) { alert(11); }
if (document.getElementById('ipn')) {
//if (('' + document.getElementById('ipn').placeholder).indexOf('Append space and face north for gyroscope bearing.') == -1) {
if (('' + document.getElementById('ipn').placeholder).indexOf(' and ') == -1) {
document.getElementById('ipn').className='ph';
document.getElementById('ipn').placeholder+='. Append space and portrait face north for gyroscope bearing.';
document.getElementById("myviewport").setAttribute("content", "width=device-width, initial-scale=1.5, minimum-scale=0.1, maximum-scale=8, user-scalable=yes");
setTimeout(asafn, 5000);
}
}
//eventData.absolute=true;


var eventDataalpha = eval(360.0 - eval('' + eventData.alpha)); // lalpha)); //
if (!datstart) { eventDataalpha-=initial_yaw; }


tiltLeftToRight = eval('' + eventData.gamma);

// beta is the front-to-back tilt in degrees, where front is positive
tiltFrontToBack = eval('' + eventData.beta);

// alpha is the compass direction the device is facing in degrees
lastalpha='' + eventData.alpha; // lalpha; //
dorbrg = eval('' + eventDataalpha); //compassHeading(eval('' + eventDataalpha), tiltFrontToBack, tiltLeftToRight);
if (1 == 2) { alert(dorbrg); }
if (document.URL.indexOf('aleJUNKrt=') != -1) {
alert(dorbrg);
}
if (document.URL.indexOf('upJUNKdate=') != -1 || (fplacen != '' && tplacen == '')) {
if (eventData.absolute || 1 == 1) {
//document.getElementById('brg').value='' + eval(eval(540.0 - eval('' + dorbrg)) % 360.0);
//document.getElementById('brg').value='' + eval(eval(720.0 - eval('' + dorbrg)) % 360.0);
//document.getElementById('brg').value='' + dorbrg;
if (eval(dcnt % 10) == 0) {
document.getElementById('brg').value='' + eval(eval(720.0 + eval('' + dorbrg)) % 360.0);
document.getElementById('brg').style.backgroundColor='yellow';
}
dcnt++;
}
}


if (datstart && (fplacen != '' && tplacen == '')) {
datstart=false;
//initial_yaw=eval(360.0 - eval('' + lalpha)); //eventData.alpha));
//alert('0:' + initial_yaw);
if (!eventData.absolute) {
initial_yaw=eval(360.0 - eval('' + eventData.alpha)); // lalpha)); //
}
//alert('' + initial_yaw);
initial_pitch=Math.round(tiltFrontToBack);
initial_roll=Math.round(tiltLeftToRight);
//alert(initial_yaw + ',' + initial_pitch + ',' + initial_roll);
}


handleOrientationEvent(tiltFrontToBack, tiltLeftToRight, dorbrg, eventData.absolute);

if ((fplacen != '' && tplacen == '') && document.getElementById('ipn')) {
//if (('' + document.getElementById('ipn').placeholder).indexOf('Append space and face north for gyroscope bearing.') != -1) {
if (('' + document.getElementById('ipn').placeholder).indexOf('Append space and ') != -1) {
document.getElementById('ipn').style.backgroundColor='#f0f0f0';
//document.getElementById('ipn').placeholder=document.getElementById('ipn').placeholder.split('Append space and face north for gyroscope bearing.')[0] + ' Now swivel to direction of interest then tap yellow textbox.';
document.getElementById('ipn').placeholder=document.getElementById('ipn').placeholder.split('Append space and ')[0] + ' Now swivel to direction of interest then tap yellow textbox.';
document.getElementById("myviewport").setAttribute("content", "width=device-width, initial-scale=1.2, minimum-scale=0.1, maximum-scale=8, user-scalable=yes");
//window.scrollBy(0,50); //location.href='#brg';
}
}


}, false);
}
}

var handleOrientationEvent = function(tiltFrontToBack, tiltLeftToRight, dorbrg, absis) {
// do something amazing
if (1 == 2) { alert(dorbrg); }
if (document.URL.indexOf('alJUNKert=') != -1) {
alert(dorbrg);
}
if (document.URL.indexOf('upJUNKdate=') != -1 || (fplacen != '' && tplacen == '')) {
if (absis || 1 == 1) {
//document.getElementById('brg').value='' + eval(eval(540.0 - eval('' + dorbrg)) % 360.0);
//document.getElementById('brg').value='' + eval(eval(720.0 - eval('' + dorbrg)) % 360.0);
//document.getElementById('brg').value='' + dorbrg;
if (eval(dcnt % 10) == 0) {
document.getElementById('brg').value='' + eval(eval(720.0 + eval('' + dorbrg)) % 360.0);
document.getElementById('brg').style.backgroundColor='yellow';
}
dcnt++;
}
}
};


function asafn() {
if (document.getElementById('ipn')) {
//if (('' + document.getElementById('ipn').placeholder).indexOf('Append space and face north for gyroscope bearing.') == -1) {
if (('' + document.getElementById('ipn').placeholder).indexOf('Append space and portrait face north for ') != -1) {
document.getElementById('ipn').placeholder=document.getElementById('ipn').placeholder.split('Append space and ')[0] + 'Append space and portrait face north onto ;elevation(m)?';
setTimeout(asafn, 5000);
} else if (('' + document.getElementById('ipn').placeholder).indexOf('Append space and ') != -1) {
document.getElementById('ipn').placeholder=document.getElementById('ipn').placeholder.split('Append space and ')[0] + 'Append space and portrait face north for horizon bearing.';
setTimeout(asafn, 5000);
}
}
}

Today we added a meta viewport, and for the first time that we can recall, we started styling the “placeholder” of that top textbox as per (thanks to https://stackoverflow.com/questions/44679144/how-to-make-input-placeholder-font-size-different-from-input-value-font-size) …


<meta id="myviewport" name="viewport" content="width=device-width, initial-scale=1, minimum-scale=0.1, maximum-scale=8, user-scalable=yes" >
<style>
summary { background-color: #f0f0f0; }

.ph::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
color: red;
opacity: 1; /* Firefox */
font-size: 8px;
}

.ph:-ms-input-placeholder { /* Internet Explorer 10-11 */
color: red;
font-size: 8px;
}

.ph::-ms-input-placeholder { /* Microsoft Edge */
color: red;
font-size: 8px;
}

</style>


Previous relevant Earth Bearing Distance Missing Two Trip Details Styling Tutorial is shown below.

Earth Bearing Distance Missing Two Trip Details Styling Tutorial

Earth Bearing Distance Missing Two Trip Details Styling Tutorial

On top of the recent Earth Bearing Distance Missing Two Trip Details Reveal Tutorial, today we discuss styling strategies a little. When and where do you style your webpage? We think you do it all along, but for us, we like “little spurts” at it too, so we might let a web application project progress in a practical approach not worrying about aesthetics too much until we do a “little spurt” bubble of activity regarding styling. Often times ideas for that can be developed away from the laptop you might write the code on. For example, today’s changed missing_two.html‘s live run link modifications were directed by an email we sent to ourselves …

Jobs

Robert Metcalfe
Sun, Sep 12, 8:16 PM (5 days ago)
to me

Vertical-align: top
I frame too high
To after horizon leaves horizon I frame title
Lat long display online-block
Coloured summary background colour
Th header cells text-align center

Sent from my iPhone

… “mind map” type ideas that may or may not be followed through to fruition, depending on …

  • where possible
  • where feasible
  • where wise

This strategy above is for your small projects, else if much bigger, or involving multiple people to produce, or being written to a specification, or being written for a third party, you’d be much better placed to think about styling issues from the start, in a plan. You might want to use wireframes?

On these small projects we also don’t mind just involving the one HTML (or PHP writing HTML) source file and use a combination of …

  • inline <style> CSS styling goes here </style> within the webpage <head></head> header section … or …
  • in amongst the HTML via “style” attribute … eg. <p id=”myp” style=” CSS styling for p element goes here “> Content for p element goes here </p>

… or Javascript DOM code such as …


document.getElementById('myp').style.fontSize='18px';

… and it is very rare, with these small projects, though very good in organizational terms, to write all your CSS styling in an external CSS (styling file) arrangement such as …


<head>
<link href='./my_styling.css' rel='stylesheet' type='text/css'>
</head>

There are many ways to … well, you know what I mean … a cat! Not only were “no cats harmed in the making of this tutorial” but no cats were even roughed up?!


Previous relevant Earth Bearing Distance Missing Two Trip Details Reveal Tutorial is shown below.

Earth Bearing Distance Missing Two Trip Details Reveal Tutorial

Earth Bearing Distance Missing Two Trip Details Reveal Tutorial

Yes, there’s only so long you can use the wonderful details/summary HTML element combination as with the recent Earth Bearing Distance Missing Two Trip Details Summary Tutorial‘s …

we often use to “reveal”, or not, webpage “real estate”, but today we default to the “open” look

… just using that “open” element mode of use, and not want to make use of its “reveal” talents. How so? Well, a bit like the dropdown element, we find that the details/summary combination allows for the containment of lots of data for a controlled amount of “reveal”. In this day and age of responsiveness to limited screen sizes, that is a big advantage.

Today, then, with our changed missing_two.html‘s live run link, we have …

  1. that first (at first) “open” details/summary nesting a Google Chart Map Chart iframe summarizing the entirety of your Trip … today …
  2. festooned with up arrow emoji (⬆) “button” links which, when clicked, zero in (into a new topmost “only open” details/summary nesting Google Chart Map Chart iframe set of data) on any one “leg” of your trip, displaying its own crow fly distance and Google Maps Directions information link, as well as new …
  3. accommodation (🛌) links ala accommodation in Springwood, New South Wales Google image search style links

… to enhance a Trip Planner’s user experience. Perhaps best to explain a bit codewise is to say “follow the Javascript variable interesting in code below” …


function askit() {
var ourdist=0.0, ourbrg=0.0;
//alert(gllentry);
if (gllentry.indexOf(',') != -1) {
if ((1 == 2 && gllonesuffix == 'f') || document.getElementById('spfr').innerHTML == 'from') {
tpurl=origtpurl;
document.getElementById('latf').focus();
document.getElementById('latf').value=gllentry.split(',')[0];
//var mu="//www.rjmprogramming.com.au/PHP/Map/map.php?title=London&label=['Lat',&value='Lon','Name']&data=,[51.5072,-0.1275,~London~]";
mu=mu.replace('[51.5072,','[' + gllentry.split(',')[0] + ',');
document.getElementById('longf').focus();
document.getElementById('longf').value=gllentry.split(',')[1];
mu=mu.replace(',-0.1275,',',' + gllentry.split(',')[1] + ',');
document.getElementById('latf').focus();
gllonesuffix = 't';
document.getElementById('spfr').innerHTML=document.getElementById('spfr').innerHTML.replace('from','to<input type=hidden name=fplacen value="' + gllentry.split(',')[2].replace(/\;/g,',') + '"></input>');
fplacen=gllentry.split(',')[2].replace(/\;/g,',');
document.getElementById('ssf').innerHTML=' ' + gllentry.split(',')[2].replace(/\;/g,',');
mu=mu.replace('=LonJunkdon','=' + encodeURIComponent(gllentry.split(',')[2].replace(/\;/g,','))).replace(',~London~]',',~' + encodeURIComponent(gllentry.split(',')[2].replace(/\;/g,',')) + '~],[051.5072,-00.1275,~LonDon~]');
tpurl=tpurl.replace("Sydney+NSW,+Australia",encodeURIComponent(gllentry.split(',')[2].replace(/\;/g,',')));
if (document.getElementById('sftif') && document.getElementById('iftif')) {
document.getElementById('iftif').src=document.getElementById('iftif').src.replace('&',encodeURIComponent(' from ' + gllentry.split(',')[2].replace(/\;/g,',')) + '&') + ',[' + gllentry.replace(',' + gllentry.split(',')[1] + ',', ',' + gllentry.split(',')[1] + ',~').replace(/\ /g,'%20') + '~]';
document.getElementById('sftif').innerHTML+=' <a target=_blank title=Accomodation onclick=woit(this); data-href="' + accomurl.replace(/Springwood\,\+New\+South\+Wales/g, encodeURIComponent(gllentry.split(',')[2].replace(/\;/g,',')).replace(/\%20/g,'+')) + '">from &#128716;</a> <a target=_blank title="' + gllentry.split(',')[2].replace(/\;/g,',') + '" href="//en.wikipedia.org/wiki/' + encodeURIComponent(gllentry.split(',')[2].replace(/\;/g,',')) + '">' + gllentry.split(',')[2].replace(/\;/g,',') + '</a>';
document.getElementById('brg').value='0.0000000';
document.getElementById('dist').value='0.000';
document.getElementById('brg').style.backgroundColor='white';
document.getElementById('dist').style.backgroundColor='white';
cwhat=[false,false,true,true,false,false];
ourdist=great_circle_distance(document.getElementById(eles[0]).value,document.getElementById(eles[1]).value,document.getElementById(eles[4]).value,document.getElementById(eles[5]).value);
document.getElementById(eles[3]).value='' + ourdist;

//Let ‘R’ be the radius of Earth,
//‘L’ be the longitude,
//‘θ’ be latitude,
//‘β‘ be Bearing.


//Bearing from point A to B, can be calculated as,

//β = atan2(X,Y),

//where, X and Y are two quantities and can be calculated as:

//X = cos θb * sin ∆L

//Y = cos θa * sin θb – sin θa * cos θb * cos ∆L


ourbrg=eval(eval(360.0 + eval(eval(eval(180.0 / Math.PI) * Math.atan2(
eval(eval('' + Math.cos(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[4]).value))) *
eval('' + Math.sin(eval(Math.PI / 180.0) * eval(eval('' + document.getElementById(eles[5]).value) - eval('' + document.getElementById(eles[1]).value))))),
eval(eval('' + Math.cos(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[0]).value))) *
eval('' + Math.sin(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[4]).value)))) -
eval(eval('' + Math.sin(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[0]).value))) *
eval('' + Math.cos(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[4]).value))) *
eval('' + Math.cos(eval(Math.PI / 180.0) * eval(eval('' + document.getElementById(eles[5]).value) - eval('' + document.getElementById(eles[1]).value)))))
)))) % 360.0);


document.getElementById('mysel').value='2';
document.getElementById(eles[2]).value='' + ourbrg;
document.getElementById(eles[2]).style.backgroundColor='lightgreen';
document.getElementById(eles[3]).style.backgroundColor='lightgreen';
}
} else {
var interesting=false, waslatt='', waslongt='', wasfplacen='';
if (gllonesuffix == 'f') {
interesting=true;
waslatt=document.getElementById('latt').value;
waslongt=document.getElementById('longt').value;
if (documentURL == document.URL) {
wasfplacen=location.search.split('tplacen=')[1] ? (' ' + decodeURIComponent(location.search.split('tplacen=')[1].split('&')[0]).replace(/\+/g,' ')) : ''; //document.getElementById('tplacen').value;
} else {
wasfplacen=decodeURIComponent(documentURL.split('tplacen=')[eval(-1 + documentURL.split('tplacen=').length)].split('&')[0]);
}
//alert('interesting');
}

mu=mu.replace('=London','=' + encodeURIComponent(fplacen));
document.getElementById('brg').focus();
document.getElementById('dist').focus();
document.getElementById('latt').focus();
document.getElementById('latt').value=gllentry.split(',')[0];
mu=mu.replace('[051.5072,','[' + gllentry.split(',')[0] + ',');
document.getElementById('longt').focus();
document.getElementById('longt').value=gllentry.split(',')[1];
mu=mu.replace(',-00.1275,',',' + gllentry.split(',')[1] + ',');
document.getElementById('latt').focus();
gllonesuffix = 'f';
if (interesting) {
document.getElementById('spfr').innerHTML=document.getElementById('spfr').innerHTML.replace('to','from<input type=hidden id=tplacen name=tplacen value="' + gllentry.split(',')[2].replace(/\;/g,',') + '"></input>');
} else {
document.getElementById('spfr').innerHTML=document.getElementById('spfr').innerHTML.replace('to','from<input type=hidden id=tplacen name=tplacen value="' + gllentry.split(',')[2].replace(/\;/g,',') + '"></input>');
}
document.getElementById('ifill').value='Map Trip';
document.getElementById('sst').innerHTML=' ' + gllentry.split(',')[2].replace(/\;/g,',');
mu=mu.replace(',~LonDon~]',',~' + encodeURIComponent(gllentry.split(',')[2].replace(/\;/g,',')) + '~]');
tpurl=tpurl.replace("Brisbane+QLD,+Australia",encodeURIComponent(gllentry.split(',')[2].replace(/\;/g,',')));
if (document.getElementById('sftif') && document.getElementById('iftif')) {
if (document.getElementById('addafirst')) { document.getElementById('addafirst').style.display='inline-block'; }
if (document.getElementById('addacc')) { document.getElementById('addacc').style.display='inline-block'; }
document.getElementById('iftif').src=document.getElementById('iftif').src.replace('&',encodeURIComponent(' to ' + gllentry.split(',')[2].replace(/\;/g,',')) + '&') + ',[' + gllentry.replace(',' + gllentry.split(',')[1] + ',', ',' + gllentry.split(',')[1] + ',~').replace(/\ /g,'%20') + '~]';
//if (interesting) {
// alert('interesting ... fplacen=' + fplacen);
//}
if (interesting) {
document.getElementById('sftif').innerHTML+=(' from <a target=_blank title="' + wasfplacen + '" href="//en.wikipedia.org/wiki/' + encodeURIComponent(wasfplacen) + '">' + wasfplacen + '</a> ').substring(0,1) + '<a target=_blank title=Accomodation onclick=woit(this); data-href="' + accomurl.replace(/Springwood\,\+New\+South\+Wales/g, encodeURIComponent(wasfplacen).replace(/\%20/g,'+')) + '">&#128716;</a>' + '<a target=_blank title="Google Maps Directions" href="' + tpurl.replace('https:','') + '">to</a><a title="Map of this trip leg" class="adda" onclick="addto(this);" data-from="' + (wasfplacen ? wasfplacen : fplacen) + '" data-to="' + gllentry.split(',')[2].replace(/\;/g,',') + '" style="display:inline-block;cursor:pointer;" data-latf=' + (waslatt ? waslatt : document.getElementById('latf').value) + ' data-longf=' + (waslongt ? waslongt : document.getElementById('longf').value) + ' data-latt=' + document.getElementById('latt').value + ' data-longt=' + document.getElementById('longt').value + ' data-gcd=' + eval(eval('' + great_circle_distance((waslatt ? waslatt : document.getElementById(eles[0]).value),(waslongt ? waslongt : document.getElementById(eles[1]).value),document.getElementById(eles[4]).value,document.getElementById(eles[5]).value)) / 1000.000) + '>&#11014;<a> <a target=_blank title="' + gllentry.split(',')[2].replace(/\;/g,',') + '" href="//en.wikipedia.org/wiki/' + encodeURIComponent(gllentry.split(',')[2].replace(/\;/g,',')) + '">' + gllentry.split(',')[2].replace(/\;/g,',') + '</a> (' + '<a target=_blank title=Accomodation onclick=woit(this); data-href="' + accomurl.replace(/Springwood\,\+New\+South\+Wales/g, encodeURIComponent(gllentry.split(',')[2].replace(/\;/g,',')).replace(/\%20/g,'+')) + '">&#128716;</a> ' + eval(eval('' + great_circle_distance(document.getElementById(eles[0]).value,document.getElementById(eles[1]).value,document.getElementById(eles[4]).value,document.getElementById(eles[5]).value)) / 1000.000) + ' kilometres)';
//alert('interesting ... fplacen=' + wasfplacen);
} else {

document.getElementById('sftif').innerHTML+=' <a target=_blank title="Google Maps Directions" href="' + tpurl.replace('https:','') + '">to</a><a title="Map of this trip leg" class="adda" onclick="addto(this);" data-from="' + (wasfplacen ? wasfplacen : fplacen) + '" data-to="' + gllentry.split(',')[2].replace(/\;/g,',') + '" style="display:inline-block;cursor:pointer;" data-latf=' + (waslatf ? waslatf : document.getElementById('latf').value) + ' data-longf=' + (waslongf ? waslongf : document.getElementById('longf').value) + ' data-latt=' + document.getElementById('latt').value + ' data-longt=' + document.getElementById('longt').value + ' data-gcd=' + eval(eval('' + great_circle_distance((waslatf ? waslatf : document.getElementById(eles[0]).value),(waslongf ? waslongf : document.getElementById(eles[1]).value),document.getElementById(eles[4]).value,document.getElementById(eles[5]).value)) / 1000.000) + '>&#11014;<a> <a target=_blank title="' + gllentry.split(',')[2].replace(/\;/g,',') + '" href="//en.wikipedia.org/wiki/' + encodeURIComponent(gllentry.split(',')[2].replace(/\;/g,',')) + '">' + gllentry.split(',')[2].replace(/\;/g,',') + '</a> (' + '<a target=_blank title=Accomodation onclick=woit(this); data-href="' + accomurl.replace(/Springwood\,\+New\+South\+Wales/g, encodeURIComponent(gllentry.split(',')[2].replace(/\;/g,',')).replace(/\%20/g,'+')) + '">&#128716;</a> ' + eval(eval('' + great_circle_distance(document.getElementById(eles[0]).value,document.getElementById(eles[1]).value,document.getElementById(eles[4]).value,document.getElementById(eles[5]).value)) / 1000.000) + ' kilometres)';
}
document.getElementById('brg').style.backgroundColor='white';
document.getElementById('dist').style.backgroundColor='white';
documentURL+='&tplacen=' + encodeURIComponent(gllentry.split(',')[2].replace(/\;/g,','));
cwhat=[false,false,true,true,false,false];
ourdist=great_circle_distance(document.getElementById(eles[0]).value,document.getElementById(eles[1]).value,document.getElementById(eles[4]).value,document.getElementById(eles[5]).value);
document.getElementById(eles[3]).value='' + ourdist;

//Let ‘R’ be the radius of Earth,
//‘L’ be the longitude,
//‘θ’ be latitude,
//‘β‘ be Bearing.


//Bearing from point A to B, can be calculated as,

//β = atan2(X,Y),

//where, X and Y are two quantities and can be calculated as:

//X = cos θb * sin ∆L

//Y = cos θa * sin θb – sin θa * cos θb * cos ∆L


ourbrg=eval(eval(360.0 + eval(eval(eval(180.0 / Math.PI) * Math.atan2(
eval(eval('' + Math.cos(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[4]).value))) *
eval('' + Math.sin(eval(Math.PI / 180.0) * eval(eval('' + document.getElementById(eles[5]).value) - eval('' + document.getElementById(eles[1]).value))))),
eval(eval('' + Math.cos(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[0]).value))) *
eval('' + Math.sin(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[4]).value)))) -
eval(eval('' + Math.sin(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[0]).value))) *
eval('' + Math.cos(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[4]).value))) *
eval('' + Math.cos(eval(Math.PI / 180.0) * eval(eval('' + document.getElementById(eles[5]).value) - eval('' + document.getElementById(eles[1]).value)))))
)))) % 360.0);


document.getElementById('mysel').value='2';
document.getElementById(eles[2]).value='' + ourbrg;
document.getElementById(eles[2]).style.backgroundColor='lightgreen';
document.getElementById(eles[3]).style.backgroundColor='lightgreen';


if (interesting) {
document.getElementById('spfr').innerHTML='to';
document.getElementById('ipn').focus();
}

}
}
document.getElementById('ipn').placeholder=gllentry.split(',')[2].replace(/\;/g,',');
}
gllentry='';
document.getElementById('placegeo').value='';
}


Previous relevant Earth Bearing Distance Missing Two Trip Details Summary Tutorial is shown below.

Earth Bearing Distance Missing Two Trip Details Summary Tutorial

Earth Bearing Distance Missing Two Trip Details Summary Tutorial

The recent Earth Bearing Distance Missing Two Locality Distance Ring Tutorial coalesced “From” Place name functionality for …

  • defined bearing … deriving horizon place
  • defined distance … deriving ring of positions … and today we consider …
  • Trip functionality thoughts via “To” Place name definitions supplementing the already entered “From” Place name

We say “Trip Details Summary” in our blog posting title today as a hint about how we present a nester of Google Chart Map Chart display data.

The details/summary HTML element combination we often use to “reveal”, or not, webpage “real estate”, but today we default to the “open” look and add Wikipedia links and crowfly distance and Google Maps Directions information into the summary tag, for extra interest with your Trip planning.

The user can access this functionality with our changed missing_two.html‘s live run link …

  1. user enters “From” Place Name via new textbox … eg. “Lawson, New South Wales”
  2. user enters “To” Place Name via new textbox … eg. “Katoomba”
  3. user clicks/taps the “Fill” button
  4. optionally the user can add more places to the Map Chart by adding more “From” and/or “To” Place Name definitions


Previous relevant Earth Bearing Distance Missing Two Locality Distance Ring Tutorial is shown below.

Earth Bearing Distance Missing Two Locality Distance Ring Tutorial

Earth Bearing Distance Missing Two Locality Distance Ring Tutorial

The corollary to yesterday’s Earth Bearing Distance Missing Two Place Name and Horizon Tutorial‘s …

  • locality and bearing derivation of a “place on horizon” position … is, today …
  • locality and distance derivation of a “locality distance ring” set of positions

… again, combining the geodata talents of Wikipedia and a Google Chart Map Chart, we figure.

And so a user accessing this functionality with our changed missing_two.html‘s live run link …

  1. user enters “From” Place Name via new textbox … eg. “Lawson, New South Wales”
  2. user enters “Distance” (eg. “5000.000” metres) and tabs out … we use the “onblur” event …

    var dok=true;

    function dfillablemaybe(brgo) {
    if (!dok) { return ''; }
    var i, ourbrg=0.0, ourdist=0.0, j, dvlat='', dvlong='';
    if (('' + brgo.value).replace(/0/g,'').replace('.','') != '') {
    //alert('356:' + document.getElementById('dist').value);
    if (('' + document.getElementById('dist').value).replace(/0/g,'').replace('.','') == '' || (fplacen != '' && tplacen == '')) {
    //alert(456);
    if (('' + document.getElementById('latt').value).replace(/0/g,'').replace('.','') == '' || (fplacen != '' && tplacen == '')) {
    //alert(556);
    if (('' + document.getElementById('longt').value).replace(/0/g,'').replace('.','') == '' || (fplacen != '' && tplacen == '')) {
    //alert(656);
    if (('' + document.getElementById('ssf').innerHTML) != '') {
    //alert(756);
    if (!viastart) {
    //document.getElementById('brg').focus();
    document.getElementById('brg').value='0.0000001';
    //brgo.focus();
    }
    if (mu.indexOf('[051.5072,') != -1) {
    //alert(856);
    if (!viastart) {
    //alert(1);
    document.getElementById('ifill').click();
    //alert(11);
    }
    mu=mu.replace('[051.5072,','[' + eval('' + document.getElementById('latt').value).toFixed(3) + ',');
    mu=mu.replace(',-00.1275,',',' + eval('' + document.getElementById('longt').value).toFixed(3) + ',');
    if (('' + brgo.value).indexOf('000.000') != -1) {
    //mu=mu.replace(encodeURIComponent('looking out North'), encodeURIComponent(('' + brgo.value).split('000.000')[0] + 'km Ring'));
    mu=mu.replace(',~LonDon~]',',~' + encodeURIComponent(fplacen + ' looking North') + '~]');
    mu=mu.replace('=London','=' + encodeURIComponent(fplacen + (' ' + brgo.value).split('000.000')[0] + 'km Ring'));
    } else {
    mu=mu.replace(',~LonDon~]',',~' + encodeURIComponent(fplacen + ' looking North') + '~]');
    mu=mu.replace('=London','=' + encodeURIComponent(fplacen + ' looking out North'));
    }
    //mu=mu.replace(',~LonDon~]',',~' + encodeURIComponent(fplacen + ' looking North') + '~]');
    //mu=mu.replace('=London','=' + encodeURIComponent(fplacen + ' looking out North'));
    //alert('956:' + mu);
    //document.getElementById('hplacen').innerHTML='<input type=hidden name=fplacen value="' + mu + '"></input>';
    //document.getElementById('tdmid').innerHTML='<iframe src="' + mu + '" style="width:100%;height:700px;"></iframe>';
    if (viastart) {
    for (var dbrg=30; dbrg<=330; dbrg+=30) {
    //document.getElementById('brg').value='' + dbrg + '.0000000';

    if (('' + document.getElementById('mysel').value) == '2') {
    ourbrg=eval(eval(540.0 + 180.0 + eval('' + document.getElementById(eles[2]).value)) % 360.0);
    } else {
    ourbrg=eval('' + document.getElementById(eles[2]).value);
    }
    ourbrg=eval('' + dbrg);
    for (j=eval(3 - eval(('' + document.getElementById('mysel').value))); j>=1; j--) {
    ourdist=eval('' + document.getElementById(eles[3]).value);

    //Let first point latitude be la1,
    ///longitude as lo1,
    //d be distance,
    //R as radius of Earth,
    //Ad be the angular distance i.e d/R and.
    //θ be the bearing,

    //Here is the formula to find the second point, when first point, bearing and distance is known:

    //latitude of second point = la2 = asin(sin la1 * cos Ad + cos la1 * sin Ad * cos θ), and
    //longitude of second point = lo2 = lo1 + atan2(sin θ * sin Ad * cos la1 , cos Ad – sin la1 * sin la2)


    dvlat='' +
    eval(eval(eval(180.0 / Math.PI) * Math.asin(
    Math.sin(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[0]).value)) *
    Math.cos(eval(eval('' + ourdist) / 6371000.0)) +
    Math.cos(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[0]).value)) *
    Math.sin(eval(eval('' + ourdist) / 6371000.0)) *
    Math.cos(eval(Math.PI / 180.0) * eval('' + ourbrg)))));

    //Let first point latitude be la1,
    //longitude as lo1,
    //d be distance,
    //R as radius of Earth,
    //Ad be the angular distance i.e d/R and
    //θ be the bearing,
    // longitude of second point = lo2 = lo1 + atan2(sin θ * sin Ad * cos la1 , cos Ad – sin la1 * sin la2)

    dvlong='' + eval(eval(180.0 / Math.PI) * eval(eval(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[1]).value)) +
    Math.atan2(
    eval(eval('' + Math.sin(eval(Math.PI / 180.0) * eval('' + ourbrg)) *
    eval('' + Math.sin(eval(eval('' + ourdist) / 6371000.0)))) *
    eval('' + Math.cos(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[0]).value)))),
    eval(eval('' + Math.cos(eval(eval('' + ourdist) / 6371000.0))) -
    eval(eval('' + Math.sin(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[0]).value)))) *
    eval('' + Math.sin(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[4]).value)))))));
    mu+=',[' + eval('' + dvlat).toFixed(3) + ',' + eval('' + dvlong).toFixed(3) + ',~' + dbrg + '~]';


    }

    }
    document.getElementById('tdmid').innerHTML='<iframe src="' + mu + '" style="width:100%;height:700px;"></iframe>';
    fplacen='';
    }
    }

    }
    }
    }
    }
    }
    }

    … logic of that occurrence to say it is this scenario and above … so …
  3. set bearing to value “0.0000001” (ie. start the locality distance ring looking North)
  4. we programmatically click the yellow “Fill” button
  5. a Google Chart Map Chart is displayed with both …
    • observer position … and this approximate calculated …
    • locality distance ring set of positions at 30 degree intervals around the ring whose radius is the Distance value (in metres) entered by the user


Previous relevant Earth Bearing Distance Missing Two Place Name and Horizon Tutorial is shown below.

Earth Bearing Distance Missing Two Place Name and Horizon Tutorial

Earth Bearing Distance Missing Two Place Name and Horizon Tutorial

Yesterday’s Earth Bearing Distance Missing Two Place Name Tutorial left off with …

We hope so, and there is another reason for this preparatory work that will be explained tomorrow. Stay tuned!

Well, today’s “tomorrow”. Let me ask first, did you read our Compass iOS App Primer Tutorial? Well, the use of the Compass iOS (and am sure Android would have their own version of) mobile app fits into our scenario whereby …

  • we had occasion to be looking at a long distance view into the distance down a road both …
    1. during the day … and also seeing …
    2. lights at night

    … which set us (being of the “where are we” looking curious set) wondering …

  • where are we looking?
  • whipping out the iPhone’s Compass app gave us all of …
    1. bearing to distant view …
    2. elevation in metres … interesting …
    3. latitude, longitude of where we were (though we think we’ll get help from Wikipedia here, thanks)

    … meaning …

  • we could offer the user of our changed missing_two.html‘s live run link the chance to involve data items 1 and 2 above directly and 3 (via Wikipedia) … to have it that …
    1. user enters “From” Place Name via new textbox (and add the Compass app elevation (in metres) as a semicolon separated data item) … eg. “Lawson, New South Wales;740”
    2. user enters “Bearing” (eg. “185” (off the Compass app)) and tabs out … we use the “onblur” event …

      var dok=true;

      function fillablemaybe(brgo) {
      if (('' + brgo.value).replace(/0/g,'').replace('.','') != '') {
      //alert('356:' + document.getElementById('dist').value);
      if (('' + document.getElementById('dist').value).replace(/0/g,'').replace('.','') == '' || (fplacen != '' && tplacen == '')) {
      //alert(456);
      if (('' + document.getElementById('latt').value).replace(/0/g,'').replace('.','') == '' || (fplacen != '' && tplacen == '')) {
      //alert(556);
      if (('' + document.getElementById('longt').value).replace(/0/g,'').replace('.','') == '' || (fplacen != '' && tplacen == '')) {
      //alert(656);
      if (('' + document.getElementById('ssf').innerHTML) != '') {
      //alert(756);
      if (!viastart) {
      dok=false;
      document.getElementById('dist').focus();
      if (1 == 1) { // assume 2m elevation ... thanks to https://en.wikipedia.org/wiki/Horizon
      document.getElementById('dist').value='' + Math.floor(Math.pow(eval(eval(2.0 * eval('' + elev)) * 6371000.0), 0.5)) + '.000';
      } else {
      document.getElementById('dist').value='5000.000';
      }
      elev=2.0;
      brgo.focus();
      }
      if (mu.indexOf('[051.5072,') != -1) {
      //alert(856);
      if (!viastart) {
      document.getElementById('ifill').click();
      }
      mu=mu.replace('[051.5072,','[' + document.getElementById('latt').value + ',');
      mu=mu.replace(',-00.1275,',',' + document.getElementById('longt').value + ',');
      mu=mu.replace(',~LonDon~]',',~' + encodeURIComponent(fplacen + ' looking out at bearing ' + brgo.value + ' degrees towards horizon') + '~]');
      mu=mu.replace('=London','=' + encodeURIComponent(fplacen + ' looking out at bearing ' + brgo.value + ' degrees towards horizon'));
      //alert('956:' + mu);
      //document.getElementById('hplacen').innerHTML='<input type=hidden name=fplacen value="' + mu + '"></input>';
      document.getElementById('tdmid').innerHTML='<iframe src="' + mu + '" style="width:100%;height:700px;"></iframe>';
      if (viastart) {
      fplacen='';
      }
      }
      }
      }
      }
      }
      }
      }

      … logic of that occurrence to say it is this scenario and above … so compute …
    3. the distance to horizon is computed via square root of two times elevation (in meters) times radius of earth (in meters) … then …
    4. we programmatically click the yellow “Fill” button
    5. a Google Chart Map Chart is displayed with both …
      1. observer position … and this approximate calculated …
      2. horizon position

      … to help you un-nut “where are we looking?… we hope

… which you can see the gist of with today’s animated GIF presentation.

Bit like relaxed orienteering, would you say?!


Previous relevant Earth Bearing Distance Missing Two Place Name Tutorial is shown below.

Earth Bearing Distance Missing Two Place Name Tutorial

Earth Bearing Distance Missing Two Place Name Tutorial

It’s often a good news story in I.T. when you can replace or supplement numbers with names (without being too nosy about it, that is!) And so, extending the functionality of our “Missing Two” web application talked about, last, with Earth Bearing Distance Missing Two Trip Share Tutorial we allow the user to enter in Place Names as an alternative to entering in the Latitude and Longitude co-ordinates of that place’s position on the earth, especially apt for any web application purporting to be helpful regarding “trip” functionality.

Being suckers for “the where of life” web applications out there, we’re tickled pink to be offering this “red zone” special extension to functionality, and all because you asked for it (well, that’s my story, and am sticking with it).

As we went along coding for this change, and implications of this into the future, we realized we needed to allow for two more (GET argument) data items to be catered for, the codelines below responsible for “reading them in” …


var fplacen=location.search.split('fplacen=')[1] ? (' ' + decodeURIComponent(location.search.split('fplacen=')[1].split('&')[0]).replace(/\+/g,' ')) : '';
var tplacen=location.search.split('tplacen=')[1] ? (' ' + decodeURIComponent(location.search.split('tplacen=')[1].split('&')[0]).replace(/\+/g,' ')) : '';

… and allowed for within the (static) HTML’s form element‘s HTML as per …


<h1 id=myh1 style='display:block;'>Missing Two (<font size=1>optional</font> <span id=spfr>from</span> <input onblur='lkwk(this);' style='display:inline-block;' placeholder='Place Name' id=ipn value='' type=text></input>) in a Table Column <span data-onfocus="document.getElementById('semail').innerHTML='';" data-title='Email to (append a space to just show the table cell with the gradient)?' data-contenteditable=true data-onblur=preemail(this.innerHTML); onclick=emailit(''); id=semail title=Email>&#128231;</span> <span data-onfocus="document.getElementById('semail').innerHTML='';" data-title='SMS to?' data-contenteditable=true data-onblur=preemail(this.innerHTML); onclick=toize(''); id=ssms title=SMS>&#128223;</span></h1>

… and …


<tr id=trhead style='display:table-row;'><th style='width:30%;text-align:left;background-color:#f0e0d0;'><a title='Show nearest TimeZone places' id=afrom onclick=mapit(this); style='cursor:pointer;text-decoration:underline;'>From</a><span id=ssf></span>> <div id=dfrom style='display:none;'></div></th><th style='width:30%;text-align:left;background-color:#e0d0f0;'> ... On The Way ...</th><th style='text-align:left;background-color:#d0f0e0;'><a title='Show nearest TimeZone places' id=ato onclick=mapit(this); style='cursor:pointer;text-decoration:underline;'>To</a><span id=sst></span> <div id=dto style='display:none;'></div></th></tr>

… and populated via supportive “onload” event based Javascript DOMWikipedia (thanks) based” logic as per …


if (fplacen != '') {
document.getElementById('ssf').innerHTML=fplacen;
fplacen='';
}
if (tplacen != '') {
document.getElementById('sst').innerHTML=tplacen;
tplacen='';
}

… as the incoming code paradigm, living with the outgoing paradigm’s work based on that “lkwk(this);” Javascript function …


var gllentry='';

function askit() {
//alert(gllentry);
if (gllentry.indexOf(',') != -1) {
if (gllonesuffix == 'f') {
document.getElementById('latf').focus();
document.getElementById('latf').value=gllentry.split(',')[0];
document.getElementById('longf').focus();
document.getElementById('longf').value=gllentry.split(',')[1];
document.getElementById('latf').focus();
gllonesuffix = 't';
document.getElementById('spfr').innerHTML=document.getElementById('spfr').innerHTML.replace('from','to<input type=hidden name=fplacen value="' + gllentry.split(',')[2].replace(/\;/g,',') + '"></input>');
document.getElementById('ssf').innerHTML=' ' + gllentry.split(',')[2].replace(/\;/g,',');
} else {
document.getElementById('brg').focus();
document.getElementById('dist').focus();
document.getElementById('latt').focus();

document.getElementById('latt').value=gllentry.split(',')[0];
document.getElementById('longt').focus();
document.getElementById('longt').value=gllentry.split(',')[1];
document.getElementById('latt').focus();
gllonesuffix = 'f';
document.getElementById('spfr').innerHTML=document.getElementById('spfr').innerHTML.replace('to','from<input type=hidden name=tplacen value="' + gllentry.split(',')[2].replace(/\;/g,',') + '"></input>');
document.getElementById('sst').innerHTML=' ' + gllentry.split(',')[2].replace(/\;/g,',');
}
document.getElementById('ipn').placeholder=gllentry.split(',')[2].replace(/\;/g,',');
}
gllentry='';
document.getElementById('placegeo').value='';
}

function lookforg() {
if (document.getElementById('placegeo').value != '') {
gllentry=document.getElementById('placegeo').value + ',' + decodeURIComponent(document.getElementById('ifplacegeo').src.split('?placegeo=')[1]).replace(/\,/g,';');
askit();
} else {
setTimeout(lookforg,1000);
}
}

function checkit(iois) {
if (iois != null) {
if (iois.src.indexOf('?placegeo=') != -1) {
//alert(1);
var aconto = (iois.contentWindow || iois.contentDocument);
//alert(11);
if (aconto != null) {
//alert(111);
if (aconto.document) { aconto = aconto.document; }
//alert(1111);
if (aconto.body != null) {
//alert(2);
document.body.style.cursor='pointer';
if (document.getElementById('placegeo').value != '') {
//alert(3);
gllentry=document.getElementById('placegeo').value + ',' + decodeURIComponent(iois.src.split('?placegeo=')[1]).replace(/\,/g,';');
askit();
} else {
//alert(8);
setTimeout(lookforg,1000);
}
}
}
}
}
}


function lkwk(oiis) {
if (oiis.value.trim() != '') {
document.getElementById('ifplacegeo').src=document.getElementById('ifplacegeo').src.split('?')[0].split('#')[0] + '?placegeo=' + encodeURIComponent(oiis.value);
oiis.value='';
document.body.style.cursor='progress';
}

}

… supporting the relevant (new static) HTML …


<iframe onload='checkit(this);' style='display:none;' id=ifplacegeo src='../PHP/fgc/index.php'></iframe>
<input type=hidden id=placegeo value=''></input>

Believe it or not, with this web application, it is important what input type=text textboxes are “visited”, and up until today, we had no concerns with that “ordering” issue very much, because we only coded for “real user” interactive input, but today’s place name functionality modifications mean that we feel we need to programmatically force the order somewhat in these place name entry scenarios, but we were not sure whether our non-mobile only (and slightly kludgy feeling) [input type=text element].focus(); interventions would/could work. But they did, happily, at least for non-mobile platforms! This means input type=text element “onblur” events must have been triggered, we figure, which is an interesting finding (well, you had to be there, didn’t you?!)

Perhaps, then, the changed missing_two.html‘s live run link will spark your interest? We hope so, and there is another reason for this preparatory work that will be explained tomorrow. Stay tuned!


Previous relevant Earth Bearing Distance Missing Two Trip Share Tutorial is shown below.

Earth Bearing Distance Missing Two Trip Share Tutorial

Earth Bearing Distance Missing Two Trip Share Tutorial

When Ajax came on the scene, HTML form navigation got that bit daggier. But as time has gone on, we’ve started appreciating those more traditional HTML form navigation methodologies more for a few major reasons …

  1. the FormData in the Ajax/FormData combination of navigational methodologies simulates static HTML form element functionality
  2. we’ve grown to really admire “Inline HTML Email” sharing via PHP mail to the email and back again out to the “www” wooooorrrrrlllllddd via an “Inline HTML Email Form” (as widens the scope of use for today’s web application)
  3. we’ve grown to really admire a static HTML form element’s “onsubmit” event to massage an HTML form element’s content on the way through to accepting the “action” form navigational destination, or reject that
  4. we’ve grown to really admire the concept of multiple submit button elements without or with an associated name attribute to be able to detect which submit button was clicked/touched

… and it seems to me there are now in the web application wooooorrrrrllllddd a plethora of navigational functionality choices for programmers out there. Yayyyyy!

And so, onto Earth Bearing Distance Missing Two Trip Tutorial today we add two sharing conduit …

  • email
  • SMS

… means of functionality which call on …


function preemailit(ine) {
if (ine.indexOf('@') != -1) {
emailit(ine);
} else if (ine != '') {
toize(ine);
}
}

function dummyencodeURIComponent(invl) {
return invl;
}

function emailit(defe) {
//document.getElementById('ih').value=document.getElementById('tdlook').innerHTML.replace(/\<br\>/g,String.fromCharCode(10));
var lastfis='youllneverfindthis';
var lasttis='';
var lasteis='youllneverfindthis';
var lastenow='';
var lastsis='youllneverfindthis';
var lastsnow='';
var lasteis2='youllneverfindthis';
var lastenow2='';
var lastsis2='youllneverfindthis';
var lastsnow2='';
var em='';
var suffbits='?latf=' + encodeURIComponent(document.getElementById('latf').value) + '&longf=' + encodeURIComponent(document.getElementById('longf').value) + '&latt=' + encodeURIComponent(document.getElementById('latt').value) + '&longt=' + encodeURIComponent(document.getElementById('longt').value) + '&brg=' + encodeURIComponent(document.getElementById('brg').value) + '&dist=' + encodeURIComponent(document.getElementById('dist').value);
if (defe.indexOf('@') != -1) {
em=defe
} else {
em=prompt('Email to? (all uppercase uses client email else sends an Inline HTML Email Form)', '');
}
if (em == null) { em=''; }
if (em.indexOf('@') != -1) {
//document.getElementById('from').value=em;
if (document.URL.toLowerCase().indexOf('rjmprogramming.com.au') != -1 && em != em.toUpperCase()) {
var xzhr = new XMLHttpRequest();
var xform=new FormData();
xform.append('inline','');
xform.append('to',em.trim());
var flatf=document.getElementById('latf').outerHTML;
var flongf=document.getElementById('longf').outerHTML;
var flatt=document.getElementById('latt').outerHTML;
var flongt=document.getElementById('longt').outerHTML;
var fbrg=document.getElementById('brg').outerHTML;
var fdist=document.getElementById('dist').outerHTML;
var tlatf='<input type=text name=latf id=latf value="' + document.getElementById('latf').value + '"></input>';
var tlongf='<input type=text name=longf id=longf value="' + document.getElementById('longf').value + '"></input>';
var tlatt='<input type=text name=latt id=latt value="' + document.getElementById('latt').value + '"></input>';
var tlongt='<input type=text name=longt id=longt value="' + document.getElementById('longt').value + '"></input>';
var tbrg='<input type=text name=brg id=brg value="' + document.getElementById('brg').value + '"></input>';
var tdist='<input type=text name=dist id=dist value="' + document.getElementById('dist').value + '"></input>';
//if (from.indexOf('@') != -1) { xform.append('cc',from.trim()); }
console.log('tdfrom');
faux=true;
mapit(document.getElementById('tdfrom'));
console.log(document.getElementById('afrom').href);
console.log('tdto');
faux=true;
mapit(document.getElementById('tdto'));
console.log(document.getElementById('ato').href);
if (document.body.innerHTML.indexOf('<tr id="trfoot"') != -1) {
lastfis='<tr id="trfoot"' + document.body.innerHTML.split('<tr id="trfoot"')[1].split('</tr>')[0] + '</tr>';
if (document.getElementById('asms').href.indexOf('sms:') != -1) {
lasteis='<span ';
lastenow='<a target=_blank href="mailto:?subject=' + dummyencodeURIComponent(encodeURIComponent('Missing%20Two')) + '&body=' + dummyencodeURIComponent(encodeURIComponent(document.getElementById('asms').href.split('&body=')[1])) + '" ';
lasteis2='</span>';
lastenow2='</a>';
lastsis='<span ';
lastsnow='<a target=_blank href="' + document.getElementById('asms').href.split('&')[0] + '&body=' + dummyencodeURIComponent(encodeURIComponent(document.getElementById('asms').href.split('&body=')[1])) + '" ';
lastsis2='</span>';
lastsnow2='</a>';
} else if (document.getElementById('asms').href.indexOf('mailto:') != -1) {
lastsis='<span ';
lastsis=document.getElementById('ssms').outerHTML.split('>')[0] + '>';
lastsnow='<a target=_blank href="sms:&body=' + dummyencodeURIComponent(encodeURIComponent(document.getElementById('asms').href.split('&body=')[1])) + '" ';
lastsnow='<input type=submit title=SMS name=sms id=ssms value="';
lastsis2='</span>';
lastsnow2='</a>';
lastsnow2='"></input>';
lasteis='<span ';
lastenow='<a target=_blank href="mailto:' + em.trim() + '?subject=' + dummyencodeURIComponent(encodeURIComponent('Missing%20Two')) + '&body=' + dummyencodeURIComponent(encodeURIComponent(document.getElementById('asms').href.split('&body=')[1])) + '" ';
lasteis2='</span>';
lastenow2='</a>';
}
}
if (em.trim() != em) {
xform.append('subj','Missing Two');
//var cbgtd=document.getElementById('tdlook').getBoundingClientRect();
xform.append('body','<body>' + document.body.innerHTML.replace(/\ id\=\"mysel\"/g, ' name="mysel" id="mysel"').replace(/\ size\=\"3\"/g, ' size="4"').replace(/\ data\-href\=/g, ' target=_blank href=').replace('</form>', '<br><br><input style=background-color:lightgreen; type=submit value=Solve></input></form>').replace('DISPLAY:table-row','DISPLAY:none').replace(lastfis,lasttis).replace(lasteis,lastenow).replace(lasteis2,lastenow2).replace(lastsis,lastsnow).replace(lastsis2,lastsnow2).replace('absolute;','absolute;display:none;').replace(flatf,tlatf).replace(flongf,tlongf).replace(flatt,tlatt).replace(flongt,tlongt).replace(fbrg,tbrg).replace(fdist,tdist) + '</body>');
} else {
xform.append('subj','Missing Two');
xform.append('body','<body>' + document.body.innerHTML.replace(/\ id\=\"mysel\"/g, ' name="mysel" id="mysel"').replace(/\ size\=\"3\"/g, ' size="4"').replace(/\ data\-href\=/g, ' target=_blank href=').replace('</form>', '<br><br><input style=background-color:lightgreen; type=submit value=Solve></input></form>').replace('DISPLAY:table-row','DISPLAY:none').replace(lastfis,lasttis).replace(lasteis,lastenow).replace(lasteis2,lastenow2).replace(lastsis,lastsnow).replace(lastsis2,lastsnow2).replace('absolute;','absolute;display:none;').replace(flatf,tlatf).replace(flongf,tlongf).replace(flatt,tlatt).replace(flongt,tlongt).replace(fbrg,tbrg).replace(fdist,tdist) + '</body>');
}
xzhr.open('post','//www.rjmprogramming.com.au/HTMLCSS/emailhtml.php',true);
xzhr.send(xform);
} else {
document.getElementById('asms').href='mailto:' + em.trim() + '?subject=' + encodeURIComponent('Missing Two') + '&body=' + encodeURIComponent(document.URL.split('#')[0].split('?')[0] + suffbits); // + '?missingtwo=' + encodeURIComponent(encodeURIComponent(document.getElementById('dfix').innerHTML.replace('background: ','').replace('background:','').replace(');',')').replace(';',''))));
document.getElementById('asms').click();
}
}
}

… in the changed missing_two.html‘s live run link.


Previous relevant Earth Bearing Distance Missing Two Trip Tutorial is shown below.

Earth Bearing Distance Missing Two Trip Tutorial

Earth Bearing Distance Missing Two Trip Tutorial

If we were to nominate an “onions of the 4th dimension” improvement on top of the work of Earth Bearing Distance Missing Two Context Tutorial we’d nominate … anyone, anyone … yes, tenticle 5 of The Kraken … we’d want to allow our “Missing Two Geographical places via Bearing and Distance” web application be turned into a trip planner by allowing for multiple legs, perhaps of a trip, to be “represented” by our new incarnation of the web application. As per usual, with extensions of functionality, here, it is optional, and manifested by … anyone, anyone … yes, tenticle 9 3/4 of The Kraken … turning a hardcoded piece of (webpage) text into an HTML element with action logic behind it … our TAHPOWTIAHEWALBI moment, you could say?!

Seriously though, it is rare that a sizeable trip happens as a one leg with the one bearing and distance component, so we turn our old web application into a …

… type of web application, in order to do that other thing we like to do, and that is to have the one (in this case just HTML/Javascript/CSS) codeset handle both simple and (optional) complex usage functionalities.

How do we differentiate a “top.document” parent from an (HTML) iframe (element) child? We use …

  • address bar URL ? and & argument (?latf=[previousToLatitude]&longf=[previousToLongitude]) usage (and analysis) via … checked for via
  • <body onload=’moremaybe();’>

  • function moremaybe() {
    var latto=location.search.split('latf=')[1] ? decodeURIComponent(location.search.split('latf=')[1].split('&')[0]) : '';
    var longto=location.search.split('longf=')[1] ? decodeURIComponent(location.search.split('longf=')[1].split('&')[0]) : '';
    if (latto != '' && longto != '') {
    nextplease();
    top.document.getElementById('goagain').style.display='block';
    document.getElementById('latf').value=latto;
    document.getElementById('latf').style.backgroundColor="pink";
    cwhat[0]=false;
    cwhat[1]=false;
    if (!decided) {
    if (!cwhat[5]) {
    cwhat[5]=true;
    }
    if (!cwhat[4]) {
    cwhat[4]=true;
    }
    decided=true;
    }
    top.document.getElementById("ltf").value=latto;
    document.getElementById('longf').value=longto;
    document.getElementById('longf').style.backgroundColor="pink";
    cwhat[0]=false;
    cwhat[1]=false;
    if (!decided) {
    if (!cwhat[5]) {
    cwhat[5]=true;
    }
    if (!cwhat[4]) {
    cwhat[4]=true;
    }
    decided=true;
    }
    top.document.getElementById("lgf").value=longto;
    document.getElementById('dtop').style.display='none';
    document.getElementById('trhead').style.display='none';
    document.getElementById('trfoot').style.display='none';
    document.getElementById('myt').border=0;
    var recti=parent.document.getElementById('niframe').getBoundingClientRect();
    parent.document.getElementById('niframe').height=eval(200 + eval(('' + recti.height).replace('px',''))) + 'px';
    if (parent.document.getElementById('niframe') != top.document.getElementById('niframe')) {
    var trecti=top.document.getElementById('niframe').getBoundingClientRect();
    top.document.getElementById('niframe').height=eval(200 + eval(('' + trecti.height).replace('px',''))) + 'px';
    }
    setTimeout(checkfill, 500);
    parent.document.getElementById("slong").innerHTML=":";
    parent.document.getElementById("slong").title="";
    parent.document.getElementById("slong").style.textDecoration="none";
    //top.document.title+=' started ';
    }
    }

… where you can see that “top.document” (top) parent is just that … top.document … and that a parent of an (HTML) iframe (element) trip leg is referred to via … parent.document … and what is being done in the here and now of a simple scenario (just in the (top) parent) or a complex (non (top) parent leg) … document … references come into play. That parent.document.getElementById(“slong”) refers to the dynamically changed method of adding legs, by turning the …

  • hardcoded “:” (text) of the To longitude textbox labelling … into a clickable and onclick event working …

  • document.getElementById('slong').style.cursor='pointer';
    document.getElementById('slong').style.textDecoration='underline';
    document.getElementById('slong').title='Click for another leg of a trip, perhaps?';
    document.getElementById('slong').innerHTML='+';

    … optionally used, and dynamic extension to functionality … our “onions of the 4th dimension” moment … who said we don’t care about your health here?!

… so that top.document.getElementById(‘niframe’) is the representation of that “top.document” parent’s first (HTML) iframe (element) child.

Why ask that previous question? To have the one codebase service all the scenarios, we need (the code) to know “where it is at”, so to speak.

The changed missing_two.html‘s live run link can have you planning your own “where of life” trip itinerary of interest yourself.


Previous relevant Earth Bearing Distance Missing Two Context Tutorial is shown below.

Earth Bearing Distance Missing Two Context Tutorial

Earth Bearing Distance Missing Two Context Tutorial

Mapping and navigational apps wouldn’t be as popular as they are without …

  • satellite based geodata available to our mobile and laptop (and cars etcetera) devices and their software … and …
  • the human urge to want to know where they are

… and so to leave yesterday’s Earth Bearing Distance Missing Two Primer Tutorial “proof of concept” web application the way it was, not showing much context to the latitude and longitude form “asks” would be a missed opportunity.

In this sense, we’ve decided to interface this web application to …

… to give the changed missing_two.html‘s live run link that optional map (or visual) extra context. This is accessible off links applied to the previously hardcoded “From” and “To” table headers. Please feel free to give it a go to see what we mean.


Previous relevant Earth Bearing Distance Missing Two Primer Tutorial is shown below.

Earth Bearing Distance Missing Two Primer Tutorial

Earth Bearing Distance Missing Two Primer Tutorial

Get in a conversation with a Land Surveyor, and drop in your sentence, close to each other, the words “bearing” and “distance” and in all likelihood you’ll get a smile. Is it a curved smile? Maybe, they are interested in the geodesic aspects to these two terms. You see, the rules of Euclidean geometry are all fine and good and used by Land Surveyors for small distances involving local mapping or small area mapping, where the curvature of the Earth is not really a factor. In fact, in the early days of Land Surveying, the plotting of an area might have been done using a table resting on a tripod, which hopefully made that table level (all good terrestrial surveying wants you to be perpendicular to the imaginary plumb bob hanging from your instrument, and hanging down in accordance with gravity’s laws). Geodesic interest for Land Surveyors tries to take into account the curvature of the Earth, which we’ll assume for today, is a sphere, though in reality it takes on a spheroidal shape that is not quite a sphere.

Polar co-ordinate designations are an alternative “view” to placing yourself, as distinct from grid co-ordinates, or geographical latitude and longitude.

We talked about some of what we have written a proof of concept web application for today with the PHP Google Map Chart Bearing Distance Tutorial some time back, and revisited its excellent …

very useful link that talks about the Haversine distance formula, as well

… and rereading this excellent webpage, realized that two sets of formulae there (plus the great circle distance calculations before) could help us piece together a useful navigational web application that, out of …

From Latitude, Longitude Bearing, Distance To Latitude, Longitude

… we could get the user to fill out 2 of 3 columns of information above, and calculate the missing one for them.

How is this useful? Well, sometimes you want to know …

  • We are at X. We are crow flying to Y. In which direction do we set out? How far is it?
  • We are at X. That looks like a nice direction to head, so what compass reading is that? If I go however far, where do I end up?

Second one for those dreamers and adventurers (or perhaps, orienteerers) methinks. Anyway, feel free to try the HTML and Javascript ‘s live run link, or down below …


Previous relevant PHP Google Map Chart Bearing Distance Tutorial is shown below.

PHP Google Map Chart Bearing Distance Tutorial

PHP Google Map Chart Bearing Distance Tutorial

There have been three recent things going on, for us, involving software integration of our interface to the great Google Chart Map Chart

As a worker with a background in Land Surveying, of course, the words “bearing” and “distance” were part of the “bread and butter” of this job. The modern day equipment can, at the observer’s tripod, and given the chainperson’s placement of equipment, deal with both of these “measures” at once, but you can still use the old theodolites and distance measuring chains if you like. You take your measurements and use calculations like those underlying the workings of the web application of HTML and Javascript and CSS Survey Traverse Tutorial which are all fine and dandy if the distances are relatively small, because we can think “planar geometry” as we mostly learn at school. But if the measurements involve long enough distances, you need to take into account that Earth is, basically, round … meanwhile, on the phone ….

You don’t say. You don’t say. You don’t say.

“What’d they say?” …

They didn’t say.

When distances are this large we need to turn towards “geodesic calculations” and today …

Here are some “live runs” …

… and here’s the changed PHP map.php changed in this way.


Previous relevant PHP Wikipedia Australian List Integration Tutorial is shown below.

PHP Wikipedia Australian List Integration Tutorial

PHP Wikipedia Australian List Integration Tutorial

Yesterday’s PHP Wikipedia Australian List Makeover Tutorial got us thinking more about “where of life” functionality integration possibilities.

For us, with many “where of life” web applications, the Google Charts Map Chart is a core part of the functionality, as the receptacle, and more and more often as time goes on, also a launching pad out to other concepts, such as …

  • TimeZone … and …
  • Weather

… two of the concepts hovering about our “Other Side of the World” web application we last talked about with Other Side of the World Google Chart Tutorial, whose supervisory HTML other_side_of_the_world.htm‘s live run, changed in this way to tweak the the linking of …

  • latitude and longitude and (anywhere) placename … to …
  • TimeZone place(s) … and then (with great help from Weather Underground (thanks)) onto …
  • direct or nearby weather predictions

… coming off a new Map Chart Google Chart and its select event menu option

  • Nearest TimeZone=Z (and onto Other Side of the World and Weather)
  • YouTube=Y (looking for placename)

… the latter integrating us with YouTube API for Iframe embedded videos interface HTML/Javascript “parent” web application called karaoke_youtube_api.htm HTML iframe elements in another direction additional to yesterday’s usage. Along the way, we tweak the Google Map=G menu option, adding more map type options and zooming in a little less by default, and with the Nearby Airports=A option making the default be a search for 3 (rather than 4) nearby airports. A lot of this all happens because of the changes to

… which all got changed to allow for an “Animate” feature, allowing for an automated right to left “animation” (via hashtagging) of the Wikipedia based slides near the top of this suite of web application’s webpages. We hope you get to try all this out for yourself.


Previous relevant PHP Wikipedia Australian List Makeover Tutorial is shown below.

PHP Wikipedia Australian List Makeover Tutorial

PHP Wikipedia Australian List Makeover Tutorial

Some time back we linked a Wikipedia “list” webpage to the Google Charts Map Chart functionality with PHP Modularization for Lighthouses in Australia Tutorial.

We’re revisiting, and finding some “peer” web applications, linked by a dropdown, that all …

  • access a relevant Wikipedia “list” webpage for Australian “things” and mentioning latitude and longitude … which link to …
  • Google Charts Map Chart

… for all of …

We were inspired to take on this “makeover” of “where of life” functionalities because earlier on today we discovered a stupendous online resource for Australian geography enthusiasts, the Bonzle Digital Atlas of Australia, with incredibly detailed and flexible search mechanisms, thanks heaps!

We’ve decided to include extra buttons (to those already linking to Google Maps links and to the relevant Wikipedia webpage) for that suite of web applications above for …

Great for research and “surfing the Australian world”! Lose yourself!

What happened Javascript (australian_lighthouses.js changed this way) and PHP wise?


Previous relevant PHP Modularization for Lighthouses in Australia Tutorial is shown below.

PHP Modularization for Lighthouses in Australia Tutorial

PHP Modularization for Lighthouses in Australia Tutorial

Today we want to try two more things …

  1. continuing on with our PHP code (you could call australian_lighthouses.php) for our Australian Lighthouses project
  2. talk about PHP glob and its modularization sensibilities

… so let’s talk about the second one first … it’s south of north … chortle, chortle.

What does PHP’s glob do? It is doing functionality like the “underworkings” of any browse button you would see would do when you have a hard disk (in your life) … unfortunately, this is no longer a given (with mobile technology and the “cloud” challenging this thinking, sometimes). Give glob a file specification and a directory to start with, and it will happily (if you were both “globular” and “modular” you would be, too) provide you with a list of filenames, so that we use it to construct this PHP function for use with our lighthouses web application …


function selcreate($def) {
$ret=$def;
$selstr='<select onchange=" window.location=this.value; "><option value="' . str_replace(" ", "_", strtolower($def)) . '_lighthouses.php">' . $def . '</option>';
$cnt=0;
foreach (glob("*_lighthouses.php") as $filename) {
if (strpos(($filename . "*"), (str_replace(" ", "_", strtolower($def)) . '_lighthouses.php*')) === false) {
$cnt++;
$newidea=str_replace("_", " ", str_replace("_lighthouses.php", "", strtolower($filename)));
$newideas=explode(" ", $newidea);
$ideas=strtoupper(substr($newideas[0],0,1)) . strtolower(substr($newideas[0],1));
for ($ii=1; $ii<sizeof($newideas); $ii++) {
$ideas.=(" " . strtoupper(substr($newideas[$ii],0,1)) . strtolower(substr($newideas[$ii],1)));
}
$selstr.='<option value="' . $filename . '">' . $ideas . '</option>';
}
}
if ($cnt > 0) return $selstr . "</select>";
return $ret;
}

… and hope you can see that glob could be used for PHP code to self-detect sibling variation programs, so that, for instance, if we “plonked” (ie. eg. (s)ftp it) an egypt_lighthouses.php (probably with an egypt_lighthouses.js accompanying Javascript file) into the same directory as our …

… it would automatically be added into the functionality of its siblings without you having to change any code of those siblings … and that egypt_lighthouses.php is free to be a web application with a totally different method of functionality … cute, huh?!

As a matter of fact ireland_lighthouses.php is quite different, and if you examine the code, you will see that the Javascript putElement(s)By via PHP Relative URLs Tutorial is more apt to a discussion of its workings.

You see, there are so many many different ways to “skin a cat” in Information Technology, quite often … not always … but “quite often” … and why be cornered into thinking there is only one way to do things?

The other thing you’ll find is that even though ireland_lighthouses.php differs a lot to its nearest matching sibling (in terms of methodology), new_zealand_lighthouses.php the Javascript corresponding codesets called ireland_lighthouses.js and new_zealand_lighthouses.js are only superficially different … in other words our PHP coalesces concepts into a similar “client” look … a “modularization” of sorts … not everybody’s sort, but a sort none the less … and this begs a question?

Why is “modularization” a good thing? Well, to me, you don’t have to have any “modularization” going on at all, and this is fine by me, but you must deal with issues that allow you to modify many many codesets efficiently and accurately in vastly different ways to be efficient, or be “modular” and be able to, perhaps, even, automate your changes, because of these “modular” patterns you’ve created … many people find “modularization” blissful … and often it suits the work patterns for teams of programmers. Perhaps you want to read about MVC (and its like) as a coding modularization idea for PHP (or many other programming languages, for that matter).


Previous releveant PHP/Javascript Asynchronous Lighthouses in Australia Tutorial is shown below.

PHP/Javascript Asynchronous Lighthouses in Australia Tutorial

PHP/Javascript Asynchronous Lighthouses in Australia Tutorial

Today we want to try two things …

  1. continuing on with our PHP code (you could call australian_lighthouses.php) for our Australian Lighthouses project
  2. talk about Javascript asynchronous script tag option

… so let’s talk about the second one first … it’s south … chortle, chortle.

Why should you be interested in the HTML’s script tag attributes …

  • asynch=”asynch”
  • defer=”defer”

? Well, we want our web pages to load as fast as possible. Yaaaaaa?! So if there was the mechanism to do more than one bit of ((client) Javascript) thinking at a time would you avail yourself of the opportunity … or would you pick what’s behind door 3?

Do you want to hear more on this theory wise? It seems to me, there are web application mission critical parts, and there are embellishments, quite often … “nice to haves” but not “mission critical” … well, if those “nice to haves” could be arranged not to hog all the web application designated CPU that would be good, wouldn’t it?! Yaaaaaaaaaaa?!

So, that, in theory, is y why.

Now back to the project at hand … Australian Lighthouses … don’t you think some geographical sorting options and place name sorting options might be useful? Yaaaaaaaaaaaaaaaaa?! But for us it doesn’t feel mission critical … so we …

  • place the logic in some external Javascript called australian_lighthouses.js
  • we load it from the PHP via
    <script type=”text/javascript” src=”australian_lighthouses.js” async=”async”></script>

    … and this amounts to the only change to today’s PHP code from yesterday as per this link

… and this becomes a way to modularize your thinking regarding a project … please don’t think there are not a myriad of other ways … this is just one idea here.

With regard to how we approached our external Javascript we did not demand anything (much) of our parent PHP and this may not be the fastest way to approach this. What we mean by that is that, perhaps, as a general rule, external Javascript can perform faster with the parent PHP or HTML leaving it with a lot more HTML element id=”[elementId]” to hang its hats on, so to speak … instead, here, we acted innocently with our Javascript and used lots of calls to the Javascript DOM method getElementsByTagName() (which results in an array return value). Perhaps calls to getElementById() via (parent) arranged id=”[elementId]” would be faster?! Today, as with the previous Static HTML Javascript Primer Tutorial we concentrated on the “modular” feel to additional external Javascript code ideas.

So try a live run to see what we mean.


Previous relevant PHP Lighthouses in Australia Primer Tutorial is shown below.

PHP Lighthouses in Australia Primer Tutorial

PHP Lighthouses in Australia Primer Tutorial

Today we examine some of the methodology behind a project idea.

Projects need …

  • an idea … ours came from listening to the radio and hearing about Lighthouses, and how the technologies had changed what they look like and how they function these days … to quote Wikipedia with respect to Australian Lighthouses (thanks) …

    The first lighthouse was Macquarie Lighthouse, which was lit in 1793 as a tripod mounted wood and coal fired beacon. The last manned lighthouse was Maatsuyker Island Lighthouse, off the south coast of Tasmania, which was automated in 1996.

  • a means to access information … much easier these days with the search engines … we went with a Google Search as per list of lighthouse positions … which led to …
  • the information source(s) … we settled, and were not surprised about the source, for Wikipedia’s List of lighthouses and lightvessels in Australia – Wikipedia … then, once happy about the quality of the source information, analyzed …
  • the source data format … initially, at least, via View->Page Source, relative to the webpage … to get ideas for how to parse the data … so that we can determine a …
  • programming language of choice … which is PHP … no surprise here … will need a server-side language … and a method like PHP’s file_get_contents() … from there …
  • PHP coding to parse the data and put it into another format that value adds … otherwise why do it, as the Wikipedia information is fine as is … that is where we determine that we should …
  • include an iframe that uses the Google Chart Map Chart to add that extra overall positional view of Lighthouses … a definite asset to the reader’s understanding of the subject … definitely a “where” web application … and in doing this we notice that …
  • Google Chart Map Chart map.php web application needed to be able to handle much larger input data streams than it could in its previous incarnation of only allowing PHP $_GET[] parameters … so we change it to allow $_POST[] parameters … maybe you noticed this with yesterday’s PHP/Javascript/HTML Google Chart Map Onclick Tutorial as shown below … as this meant that …
  • we need an HTML form that POSTs to the iframe with the Google Chart Map Chart map.php web application allowable because we are on the same domain with this thinking … and using an HTML textarea element to store the huge string of Lighthouse data that will be passed across via urldecode($_POST[‘data’]) at map.php … using PHP’s urldecode() and urlencode() methods and Javascript’s decodeURIComponent() method … as well as utilizing …
  • Google Chart Map Chart map.php web application onclick and tooltip functionality we’ve been working on lately … hence the talk about this below … working out what (component) tools could do with a “makeover” is an extremely important part of any project and can be a useful compartmentalizing of the project

… and so we end up with our live run behind which is the PHP programming source code you could call australian_lighthouses.php for your perusal.


Previous relevant PHP/Javascript/HTML Google Chart Map Onclick Tutorial is shown below.

PHP/Javascript/HTML Google Chart Map Onclick Tutorial

PHP/Javascript/HTML Google Chart Map Onclick Tutorial

They say “the knee bone’s connected to the thigh bone” then they say “the thigh bone’s connected to the … hip bone” then they say “let’s call the whole thing off” … sometimes.

Today we say “the onmouseover event is connected to the onclick event” then we say “the onclick event is connected to the online woooooorld” … “do … the hokey pokey” x3 … “that’s what the onclick event preceeded by the onmouseover event within the environs you are encountering … is all about”.

That news is pretty good actually, because it means mobile users are not missing out on much not having easy access to any onmouseover (ie. hover) functionality … they’ll still reach any onclick logic you present them, in the default case of events where onclick is a valid “touch” event as well.

So the data structure of arrangements to allow for this onclick functionality is intrinsically the same as allowed for yesterday with the PHP/Javascript/HTML Google Chart Map Tooltips Tutorial as shown below, but we just check for some more delimitation issue matters, and our updated prompting window logic gets quite “blurby” as per the Javascript (via PHP) …



echo " datalinesuffix = prompt('Enter decimal Latitude,Longitude ' + thisline + extra + ' (for no more hit Cancel button and append with ' + '\\n\\n' + ',\"A tooltip and clicking link for Google Map of <a target=_blank href=https://www.google.com.au/maps/place/' + encodeURIComponent(dlp2) + '>' + dlp2 + '</a>\" ' + '\\n\\n' + ' or maybe perhaps ' + '\\n\\n' + ',\"A tooltip and clicking link for Google Map based on latitude and longitude of <a target=_blank href=https://maps.google.com.au/maps?' + encodeURIComponent('z=15&t=m&q=loc:') + '{latitude}{longitude}>' + dlp2 + '</a>\"' + '\\n\\n' + ' optionally (as (just) two examples of what is possible with HTML included (activates with onclick bit not onmouseover))', thisdef); " . "\n";
echo ' if (datalinesuffix != null) { if (datalinesuffix.indexOf("{latitude}") != -1) { dlsa=datalinesuffix.split(","); if (dlsa[0].indexOf("-") == -1) { datalinesuffix=datalinesuffix.replace("{latitude}",encodeURIComponent("+" + dlsa[0])); } else { datalinesuffix=datalinesuffix.replace("{latitude}",encodeURIComponent(dlsa[0])); } } if (datalinesuffix.indexOf("{longitude}") != -1) { dlsa=datalinesuffix.split(","); if (dlsa.length > 1) { if (dlsa[1].indexOf("-") == -1) { datalinesuffix=datalinesuffix.replace("{longitude}",encodeURIComponent("+" + dlsa[1])); } else { datalinesuffix=datalinesuffix.replace("{longitude}",encodeURIComponent(dlsa[1])); } } } } ' . "\n";

… as again we are making use of $_GET[] parameters coming into the PHP at the server side.

The bigger picture plan for how this helps something else we are trying will become apparent over time … in the fullness of time … at the appropriate juncture of juxtapositions.

Let’s see some PHP code in live action for this tutorial where you define your map characteristics and data.

Link to Google Chart Tools “spiritual home” … via Google.
Link to Google Chart Tools Map information … via Google.
Link to Google Chart tooltips information … via Google.

Link to some downloadable PHP programming code … rename to map.php which changed from yesterday as per this link.


Previous relevant PHP/Javascript/HTML Google Chart Map Tooltips Tutorial is shown below.

PHP/Javascript/HTML Google Chart Map Tooltips Tutorial

PHP/Javascript/HTML Google Chart Map Tooltips Tutorial

Here is a tutorial that is revisiting Google Graphs API, or Google Chart Tools, and its Map functionality, which we first talked about with PHP/Javascript/HTML Google Chart Map Tutorial as shown below. Please read

Google Chart Tools provide a perfect way to visualize data on your website. From simple line charts to complex hierarchical tree maps, the chart galley provides a large number of well-designed chart types. Populating your data is easy using the provided client- and server-side tools.

Why are we revisiting? Well, we are interested in the interactive side to this wonderful product. We are going to start with a look into “tooltips”. Tooltips are those optional informational features of some webpages that happen when hovering over an HTML element, principally through the filling out of an HTML element’s title global attribute.. Google Charts functionality amounts to the use of Javascript, and, these days, SVG HTML elements, so “tooltips” are very relevant to the “user experience” when using Google Charts. With the Map Chart, the latitude, laongitude set is combined with a title, which can be the default “tooltip” shown, as this is all fine for many usages, but we want to extend it so that that title doesn’t have to be the tooltip.

The integration of this added functionality into the Google Chart Map Chart involves adding an extra “string” column to the data table as per the bold bits of the new Javascript (via PHP) snippet …



if (isset($_GET['value']) && (isset($_GET['tooltip']) || strpos($GETdata, "'") !== false)) {
echo " var data = new google.visualization.DataTable(); /" . "/" . $GETlabel . $GETvalue . " \n";
echo " data.addColumn('number', '" . str_replace("'","",str_replace(",","",str_replace("['","",$GETlabel))) . "'); \n";
echo " data.addColumn('number', " . str_replace(",", "); data.addColumn({'type': 'string', 'role': 'tooltip', 'p': {'html': true}}); data.addColumn('string', ", str_replace("]","",$GETvalue)) . "); \n";
echo " data.addRows([ \n";
echo str_replace("''" . "''", "''", str_replace("~", "'", substr($GETdata,1)));
echo " ]); \n";
} else {

echo ' var data = google.visualization.arrayToDataTable([ ' . "\n";
echo " " . $GETlabel . $GETvalue . " \n";
echo str_replace("''" . "''", "''", str_replace("~", "'", $GETdata));
echo " ]);\n";
}

… making use of $_GET[] parameters coming into the PHP at the server side … you’ll find that Javascript loves to work with PHP as one of those Fred and Ginger relationships of the programming world … you’ll be happier writing Javascript from your PHP too … try it and you’ll see the advantages time and again and again and again … did we leave out one? … and again.

The bigger picture plan for how this helps something else we are trying will hopefully become apparent over time.

Let’s see some PHP code in live action for this tutorial where you define your map characteristics and data.

Link to Google Chart Tools “spiritual home” … via Google.
Link to Google Chart Tools Map information … via Google.
Link to Google Chart tooltips information … via Google.

Link to some downloadable PHP programming code … rename to map.php which changed from the days of Google Charts Emailing Primer Tutorial as per this link.


Previous relevant PHP/Javascript/HTML Google Chart Map Tutorial is shown below.

PHP/Javascript/HTML Google Chart Map Tutorial

PHP/Javascript/HTML Google Chart Map Tutorial

Here is a tutorial that introduces you to Google Graphs API, or Google Chart Tools, and its Map functionality.

Google Chart Tools provide a perfect way to visualize data on your website. From simple line charts to complex hierarchical tree maps, the chart galley provides a large number of well-designed chart types. Populating your data is easy using the provided client- and server-side tools.

Let’s see some PHP code in live action for this tutorial where you define your map characteristics and data.

Link to Google Chart Tools “spiritual home” … via Google.
Link to Google Chart Tools Map information … via Google.

Link to some downloadable PHP programming code … rename to map.php.

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

Posted in eLearning, Event-Driven Programming, Software, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Earth Scanner Google Chrome Speech to Text Tutorial

Earth Scanner Google Chrome Speech to Text Tutorial

Earth Scanner Google Chrome Speech to Text Tutorial

We’re interested in methodologies, even if they are not fully cross-browser and/or cross platform ones, if only to reassure that a concept is possible, and that applies to today’s …

  • Google Chrome … only …
  • non-mobile … only …
  • https:// protocol … only

… interfacing of our recent Earth Scanner web application to Google’s Web Speech API demonstration integration, further to yesterday’s Earth Scanner User Emoji Entities Tutorial.

At first, reimagining how the Web Speech API worked, we remembered place names always coming out with a capitalized first letter, and so suits our requirements perfectly, but when testing the other two words we wanted to integrate …

  • email
  • SMS

… guess what?! The email still reads as “Email” in the API. It just capitalizes starts of sentences or phrases. Game show dadong buzzer goes here. Nevertheless, we can count on the infinite good sense of our readers and users, and know that out of their mouths we’ll only hear place names or “and” or “to” or “email” or “SMS” (coded for English, so far) and that no swear words (that aren’t place names) would ever pass their lips?!

To make this integration happen, for us, involved …

  1. new HTML …

    <input type=hidden id=posturl style=display:none; value=""></input><input type=button id=dbutton onclick=checkforstt(); style=display:none;></input>
  2. new just after webpage onload event popup window opening of our inhouse Web Speech API interfacer

    var speechtotextwo=null;
    var screenwidth=screen.width;

    if (document.URL.indexOf('https:') != -1 && navigator.userAgent.toLowerCase().indexOf('chrome') > -1 && !navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
    speechtotextwo=window.open('https://www.rjmprogramming.com.au/PHP/speech_supervisor.php?mode=3', '_blank', 'top=0,left=' + eval(-300 + screenwidth) + ',width=300,height=500');
    setTimeout(checkforstt, 6000);
    setTimeout(function(){ speechtotextwo.document.title='Places for Earth Scanner'; }, 5000);
    }
  3. new timed Javascript function acting on spoken findings …

    var stt='', potentialstt='';
    var firststt=true, firstdone=false;

    function checkforstt() {
    var azx=null;
    if (document.getElementById('posturl').value.trim() != '') {
    if (document.getElementById('posturl').value == 'Email') {
    document.getElementById('posturl').value = 'email';
    }
    if (document.getElementById('posturl').value == 'SMS') {
    document.getElementById('posturl').value = 'sms';
    }
    if (document.getElementById('posturl').value.substring(0,1) == document.getElementById('posturl').value.substring(0,1).toUpperCase() && document.getElementById('posturl').value.substring(0,1) != document.getElementById('posturl').value.substring(0,1).toLowerCase()) {
    if (potentialstt.indexOf(document.getElementById('posturl').value) == -1) {
    if (potentialstt.trim() == '') {
    potentialstt=document.getElementById('posturl').value;
    } else {
    if (('' + potentialstt + ' ').replace(' and ', ' to ').replace(/\ to\ $/g, '') != ('' + potentialstt + ' ')) {
    potentialstt+=' ' + document.getElementById('posturl').value;
    } else {
    potentialstt+=',' + document.getElementById('posturl').value;
    }
    }
    //alert(potentialstt);

    if (('' + potentialstt + ' ').replace(' and ', ' to ').replace(/\ to\ $/g, '') == ('' + potentialstt + ' ')) {
    stt=potentialstt.replace(/\ and\ /g, ',').replace(/\ to\ /g, '-');
    if (2 == 2) {
    gdefv=(stt + '?!').replace(/\,/g, '?!,').replace(/\-/g,'?!-');
    scmok=true;
    movesallowed=true;
    gmovesallowed=true;
    five=5;
    gfive=5;
    dountilnoquestion(); //document.getElementById('myimg').click(); //scmove();
    } else {
    document.getElementById('sdurl').value=((document.getElementById('sdurl').value.split('#')[0].split('?')[0] + thecssarg + ((argstuff + '#') == '#' ? argstuff + '#' : '#' + argstuff.substring(1) + '&') + ('#' + ('' + stt.replace(/\ /g,'_')).substring(0).replace(/^\%2C/g,'')).replace(/^\#$/g, '')).replace('&#', '&')).replace('##','#');
    //alert('stt=' + stt + ' and ' + document.getElementById('sdurl').value);

    if (document.getElementById('sdurl').value.indexOf('#') != -1) {
    location.hash='#' + document.getElementById('sdurl').value.split('#')[1];
    }
    }
    }

    }
    } else if (document.getElementById('posturl').value == 'email') {
    potentialstt='';
    stt='';
    if (1 == 1) {
    //if (shareb) { shareb.click(); } //document.getElementById('share').click();
    //alert('here');
    azx = document.createElement("a");
    document.body.appendChild(azx);
    azx.style = "display: none";
    azx.href = 'mailto:?subject=' + encodeURIComponent('Earth Scanner') + '&body=' + encodeURIComponent(document.getElementById('sdurl').value);
    azx.click();
    } else {
    potentialstt='';
    stt='';
    }
    } else if (document.getElementById('posturl').value == 'sms') {
    if (1 == 1) {
    //if (shareb) { shareb.click(); } //document.getElementById('share').click();
    azx = document.createElement("a");
    document.body.appendChild(azx);
    azx.style = "display: none";
    azx.href = 'sms:' + prompt('Please enter the SMS number you are sending to.', '') + '&body=' + encodeURIComponent(document.getElementById('sdurl').value);
    azx.click();
    } else {
    potentialstt='';
    stt='';
    }
    }
    document.getElementById('posturl').value='';
    }
    if (firststt && speechtotextwo) {
    firststt=false;
    var tds=speechtotextwo.document.getElementsByTagName('td');
    if (eval('' + tds.length) >= 3) {
    speechtotextwo.document.getElementById('tdm').style.width='5px';
    tds[1].style.width='5px';
    tds[2].style.width='5px';
    speechtotextwo.document.getElementById('tdm').style.display='none';
    tds[1].style.display='none';
    tds[2].style.display='none';
    }
    if (!firstdone) {
    firstdone=true;
    setInterval(checkforstt, 10000);
    }
    }
    }

… in the changed twenty third draft of the Earth Scanner web application for you to retry this “getting towards hands free for non-mobile Google Chroome using the https:// protocol” version, over & over again.


Previous relevant Earth Scanner User Emoji Entities Tutorial is shown below.

Earth Scanner User Emoji Entities Tutorial

Earth Scanner User Emoji Entities Tutorial

Recently we’ve been trying to add to the flexibility and power of the user using our recent Earth Scanner web application to tailor what it looks like and how it works via settings the user can control. Adding to this work up to yesterday’s Earth Scanner Intranet Feeling Externals Tutorial, today, we’d like to allow the user to control the look of two types of emojis used, they being …

  1. the pin emoji for place locations … and …
  2. the compass emoji in the middle of a trip leg

Emojis, as we’ve said a few times now, are really useful, as that hybrid between text and graphics, for we graphically challenged, and as Internationalization aids, and clarifiers. But how are they defined. Our favourite way, of many, is via …

  • HTML Decimal Entities … in HTML or Javascript code, but you can also use …
  • HTML Hexadecimal Entity … in HTML or Javascript code, or …
  • String.fromCodePoint([HTML Decimal Entity]) … in Javascript code or …
  • CSS (selector) content property value expressed like content:’\000031\0020e3′; … ie. UTF-32 expression(s)
  • The emoji contents, copied, within the CSS content or HTML or Javascript code, as applicable

We like to look up the concept at Emojipedia. We …

  • make initial example of Google Search (today, “Bow and Arrow emojipedia”) … leads to link to …
  • get off Emojipedia, in its “Technical Information”, these days, the Codepoint eg. U+1F3F9 … then we just type that into an address bar … to get to a …
  • relevant Google search … and in its list, for the more fundamental emoji arrangements we look for …
  • relevant Fileformat.info web page … where this entity information is laid out for you

… used by the Javascript of the Earth Scanner …


var thepin='&#128205;', thecompass='&#129517;';

… used, now in code lines like …


// Pin ...
bmeridian+='<span class=place style="z-index:1675;position:' + posval + ';top:' + eval(0 + eval(eval(lglat - eval('' + plotlat[iplot])) / eval(lglat - smlat) * eval(screenheight))) + 'px;left:' + eval(0 + eval(eval('' + plotlong[iplot]) - smlong) / eval(lglong - smlong) * eval(screenwidth)) + 'px;" onclick="event.stopPropagation(); woit(' + "'" + plotplace[iplot].split(', ')[0] + "'" + ');">' + thepin + '</span>';
// Compass ...
bmeridian+='<hr' + clabit + ' onclick="event.stopPropagation(); canlooknow=false; clearwo(); wo=window.open(' + "'//www.google.com/maps/dir/" + encodeURIComponent(plotplace[eval(thisleg.split('.')[0])]) + '/' + encodeURIComponent(plotplace[eval(thisleg.split('.')[1])]) + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; alert(this.title); " ondblclick="event.stopPropagation(); canlooknow=false; clearwo(); wo=window.open(' + "'//www.google.com/maps/dir/" + plotlat[eval(thisleg.split('.')[0])] + ',' + plotlong[eval(thisleg.split('.')[0])] + '/' + plotlat[eval(thisleg.split('.')[1])] + ',' + plotlong[eval(thisleg.split('.')[1])] + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; alert(this.title); " title="' + plusbit + '' + plotplace[eval(thisleg.split('.')[0])] + ' to ' + plotplace[eval(thisleg.split('.')[1])] + ' has the crow flying (' + gbrgtoset + ' degrees setting off at versus on Mercator Projection ...) ' + eval(eval(brgtoset + 450) % 360) + ' degrees for ' + eval(gdisttoset / 1000.0) + ' kilometers. Click (for placename) or double click (for geographicals) to open a Google Directions window." data-class=leg style="transform:rotate(' + eval(eval('' + brgtoset) - 0) + 'deg);z-index:975;opacity:0.3;position:' + posval + ';top:' +
meanlat +
'px;left:' +
eval(meanlong - disttoset / 2) +
'px;background-color:rgba(255,0,0,0.5);width:' + disttoset + 'px;height:6px;"></hr><span onclick="event.stopPropagation(); canlooknow=false; clearwo(); wo=window.open(' + "'//www.google.com/maps/dir/" + encodeURIComponent(plotplace[eval(thisleg.split('.')[0])]) + '/' + encodeURIComponent(plotplace[eval(thisleg.split('.')[1])]) + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; " ondblclick="event.stopPropagation(); canlooknow=false; clearwo(); gleg=glegit(this); wo=windowopen(' + "'//www.google.com/maps/dir/" + plotlat[eval(thisleg.split('.')[0])] + ',' + plotlong[eval(thisleg.split('.')[0])] + '/' + plotlat[eval(thisleg.split('.')[1])] + ',' + plotlong[eval(thisleg.split('.')[1])] + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; " title="' + plusbit + '' + plotplace[eval(thisleg.split('.')[0])] + ' to ' + plotplace[eval(thisleg.split('.')[1])] + ' has the crow flying (' + gbrgtoset + ' degrees setting off at versus on Mercator Projection ...) ' + eval(eval(360 - brgtoset) % 360) + ' degrees for ' + eval(gdisttoset / 1000.0) + ' kilometers. Click (for placename) or double click (for geographicals) to open a Google Directions window. ' + '" data-class=leg style="cursor:pointer;font-size:6px;z-index:976;margin-top:6px;margin-left:-6px;position:' + posval + ';top:' + meanlat + 'px;left:' + meanlong + 'px;" data-oncontextmenu="event.stopPropagation(); woit(' + "'" + plotplace[eval(thisleg.split('.')[1])].split(', ')[0] + "'" + ');" data-tleg="' + thisleg + '">' + thecompass + '</span>';

… and now, given a “heads up to” for the user, in the blurb …

At prompt window, prefixing, and persevering, CSS map image styling available (and able to be turned off via nocssplease and special decimal entity number parts for emojis eg. pin:128204; (versus 📍) compass:127993; (versus 🧭))) eg. filter:sepia(74%); Or you can specify <style></style> non-persevering or <style></STYLE> persevering CSS of your own (or use a URL ending with .css) to begin with and/or <script></script> non-persevering or <script></SCRIPT> persevering Javascript of your own (or use a URL ending with .js) to begin with

… and determined in amongst the map image styling code functionality …


while (eval('' + retc.indexOf(';')) > eval('' + retc.indexOf(':'))) {
if (retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] == 'pin') {
theval=retc.split(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':')[1].split(';')[0].trim();
if (theval.substring(0,1) == '&') {
thepin=theval + ';';
} else if (theval.substring(0,1) >= '0' && theval.substring(0,1) <= '9') {
thepin='&#' + theval + ';';
} else {
thepin=theval;
}
}
else if (retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] == 'compass') {
theval=retc.split(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':')[1].split(';')[0].trim();
if (theval.substring(0,1) == '&') {
thecompass=theval + ';';
} else if (theval.substring(0,1) >= '0' && theval.substring(0,1) <= '9') {
thecompass='&#' + theval + ';';
} else {
thecompass=theval;
}
} else
{
thecss+=' ' + retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':' + retc.split(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':')[1].split(';')[0] + '; ';
labels=retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)].split('-');
thislab=labels[0].toLowerCase();
for (ilab=1; ilab<labels.length; ilab++) {
thislab+=labels[ilab].substring(0,1).toUpperCase() + labels[ilab].substring(1).toLowerCase();
}
try {
undos.push(" document.getElementById('myimg').style." + thislab + "='none';");
eval(" document.getElementById('myimg').style." + thislab + "='" + retc.split(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':')[1].split(';')[0] + "';");
} catch(hgfjh) {
}
}
retc=retc.replace(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':' + retc.split(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':')[1].split(';')[0] + ';', '');
}

… as shown in today’s tutorial picture for the changed twenty second draft of the Earth Scanner web application for you to retry, over and over again.


Previous relevant Earth Scanner Intranet Feeling Externals Tutorial is shown below.

Earth Scanner Intranet Feeling Externals Tutorial

Earth Scanner Intranet Feeling Externals Tutorial

Yesterday’s Earth Scanner Externals Tutorial left off with …

HTTP://localhost:8888/newstuff.js

… and if it had been called http://localhost:8888/newstuff.JS it could have persevered.

… as an “Intranet feeling” idea for the styling and scripting that users can get involved with, working with our latest Earth Scanner web application.

As you can imagine, to share this, in our case, local MAMP external Javascript, you can’t expect the recipient to necessarily have MAMP installed, let alone have MAMP and have your scripting and/or styling in place with its proper name. And so, to share with collaborators in this scenario, we have to convert the script URL types, as above into inline HTML script elements that will make their way into the location.hash (ie hashtagging) arrangements we’ve got going with our sharing functionalities.

So here’s the thing. We perennially battle the “Intranet feeling” restrictions out there, trying HTML iframes and Ajax and PHP curl (via window.open within the Intranet realms) before settling on the non-automated but “user participation possible” idea of using the FileReader API to read the contents of the relevant external script file the user has browsed for (off their local computer system) and selected. It’s contents are held in base64 and we’re using window.atob (via our inhouse tweaked client_browsing.htm Client Browsing FileReader API interfacer) to bring it back from the decoding into the clientside wooooorrrrlllllddd. We warn here, we’ve seen flaky window.atob arrangements, and so we’ll ease into all this, starting with small amounts of scripting for now. This is wise, too, in that we don’t know yet, about the limits, even to hashtagged URLs in “a” link mailto: and sms: URLs.

Our coding conduit into it all was a Javascript wrapper function also concerned with “user induced” mixed content issues …


function nomc(hashttpmaybe) {
var nohttp=hashttpmaybe;
var ihp=0, hparts=nohttp.split('https://');
for (ihp=1; ihp<hparts.length; ihp++) {
if (hparts[ihp].indexOf('localhost') == -1) {
nohttp=nohttp.replace('https://' + hparts[ihp], '//' + hparts[ihp]);
} else if (hparts[ihp].indexOf('.js') != -1) {
if (scrto == 'youllneverfindthis') {
scrto='filescript:https://' + hparts[ihp].split('.js')[0] + '.js';
nohttp=nohttp.replace('filescript:https://' + hparts[ihp].split('.js')[0] + '.js', ajaxit(scrto));
} else {
scrfrom='filescript:https://' + hparts[ihp].split('.js')[0] + '.js';
}
} else if (hparts[ihp].indexOf('.JS') != -1) {
if (scrto == 'youllneverfindthis') {
scrto='filescript:https://' + hparts[ihp].split('.JS')[0] + '.JS';
nohttp=nohttp.replace('filescript:https://' + hparts[ihp].split('.JS')[0] + '.JS', ajaxit(scrto));
} else {
scrfrom='filescript:https://' + hparts[ihp].split('.JS')[0] + '.JS';
}
} else if (hparts[ihp].indexOf('.css') != -1) {
if (styto == 'youllneverfindthis') {
styto='filecss:https://' + hparts[ihp].split('.css')[0] + '.css';
nohttp=nohttp.replace('filecss:https://' + hparts[ihp].split('.css')[0] + '.css', ajaxit(styto));
} else {
styfrom='filecss:https://' + hparts[ihp].split('.css')[0] + '.css';
}
} else if (hparts[ihp].indexOf('.CSS') != -1) {
if (styto == 'youllneverfindthis') {
styto='filecss:https://' + hparts[ihp].split('.CSS')[0] + '.CSS';
nohttp=nohttp.replace('filecss:https://' + hparts[ihp].split('.CSS')[0] + '.CSS', ajaxit(styto));
} else {
styfrom='filecss:https://' + hparts[ihp].split('.CSS')[0] + '.CSS';
}
}
}
hparts=nohttp.split('HTTPS://');
for (ihp=1; ihp<hparts.length; ihp++) {
if (hparts[ihp].indexOf('localhost') == -1) {
nohttp=nohttp.replace('HTTPS://' + hparts[ihp], '//' + hparts[ihp]);
} else if (hparts[ihp].indexOf('.js') != -1) {
if (scrto == 'youllneverfindthis') {
scrto='filescript:HTTPS://' + hparts[ihp].split('.js')[0] + '.js';
nohttp=nohttp.replace('filescript:HTTPS://' + hparts[ihp].split('.js')[0] + '.js', ajaxit(scrto));
} else {
scrfrom='filescript:HTTPS://' + hparts[ihp].split('.js')[0] + '.js';
}
} else if (hparts[ihp].indexOf('.JS') != -1) {
if (scrto == 'youllneverfindthis') {
scrto='filescript:HTTPS://' + hparts[ihp].split('.JS')[0] + '.JS';
nohttp=nohttp.replace('filescript:HTTPS://' + hparts[ihp].split('.JS')[0] + '.JS', ajaxit(scrto));
} else {
scrfrom='filescript:HTTPS://' + hparts[ihp].split('.JS')[0] + '.JS';
}
} else if (hparts[ihp].indexOf('.css') != -1) {
if (styto == 'youllneverfindthis') {
styto='filecss:HTTPS://' + hparts[ihp].split('.css')[0] + '.css';
nohttp=nohttp.replace('filecss:HTTPS://' + hparts[ihp].split('.css')[0] + '.css', ajaxit(styto));
} else {
styfrom='filecss:HTTPS://' + hparts[ihp].split('.css')[0] + '.css';
}
} else if (hparts[ihp].indexOf('.CSS') != -1) {
if (styto == 'youllneverfindthis') {
styto='filecss:HTTPS://' + hparts[ihp].split('.CSS')[0] + '.CSS';
nohttp=nohttp.replace('filecss:HTTPS://' + hparts[ihp].split('.CSS')[0] + '.CSS', ajaxit(styto));
} else {
styfrom='filecss:HTTPS://' + hparts[ihp].split('.CSS')[0] + '.CSS';
}
}
}
hparts=nohttp.split('http://');
for (ihp=1; ihp<hparts.length; ihp++) {
if (hparts[ihp].indexOf('localhost') == -1) {
nohttp=nohttp.replace('http://' + hparts[ihp], '//' + hparts[ihp]);
} else if (hparts[ihp].indexOf('.js') != -1) {
if (scrto == 'youllneverfindthis') {
scrto='filescript:http://' + hparts[ihp].split('.js')[0] + '.js';
nohttp=nohttp.replace('filescript:http://' + hparts[ihp].split('.js')[0] + '.js', ajaxit(scrto));
} else {
scrfrom='filescript:http://' + hparts[ihp].split('.js')[0] + '.js';
}
} else if (hparts[ihp].indexOf('.JS') != -1) {
if (scrto == 'youllneverfindthis') {
scrto='filescript:http://' + hparts[ihp].split('.JS')[0] + '.JS';
nohttp=nohttp.replace('filescript:http://' + hparts[ihp].split('.JS')[0] + '.JS', ajaxit(scrto));
} else {
scrfrom='filescript:http://' + hparts[ihp].split('.JS')[0] + '.JS';
}
} else if (hparts[ihp].indexOf('.css') != -1) {
if (styto == 'youllneverfindthis') {
styto='filecss:http://' + hparts[ihp].split('.css')[0] + '.css';
nohttp=nohttp.replace('filecss:http://' + hparts[ihp].split('.css')[0] + '.css', ajaxit(styto));
} else {
styfrom='filecss:http://' + hparts[ihp].split('.css')[0] + '.css';
}
} else if (hparts[ihp].indexOf('.CSS') != -1) {
if (styto == 'youllneverfindthis') {
styto='filecss:http://' + hparts[ihp].split('.CSS')[0] + '.CSS';
nohttp=nohttp.replace('filecss:http://' + hparts[ihp].split('.CSS')[0] + '.CSS', ajaxit(styto));
} else {
styfrom='filecss:http://' + hparts[ihp].split('.CSS')[0] + '.CSS';
}
}
}
hparts=nohttp.split('HTTP://');
for (ihp=1; ihp<hparts.length; ihp++) {
if (hparts[ihp].indexOf('localhost') == -1) {
nohttp=nohttp.replace('HTTP://' + hparts[ihp], '//' + hparts[ihp]);
} else if (hparts[ihp].indexOf('.js') != -1) {
if (scrto == 'youllneverfindthis') {
scrto='filescript:HTTP://' + hparts[ihp].split('.js')[0] + '.js';
nohttp=nohttp.replace('filescript:HTTP://' + hparts[ihp].split('.js')[0] + '.js', ajaxit(scrto));
} else {
scrfrom='filescript:HTTP://' + hparts[ihp].split('.js')[0] + '.js';
}
} else if (hparts[ihp].indexOf('.JS') != -1) {
if (scrto == 'youllneverfindthis') {
scrto='filescript:HTTP://' + hparts[ihp].split('.JS')[0] + '.JS';
nohttp=nohttp.replace('filescript:HTTP://' + hparts[ihp].split('.JS')[0] + '.JS', ajaxit(scrto));
} else {
scrfrom='filescript:HTTP://' + hparts[ihp].split('.JS')[0] + '.JS';
}
} else if (hparts[ihp].indexOf('.css') != -1) {
if (styto == 'youllneverfindthis') {
styto='filecss:HTTP://' + hparts[ihp] + '.css';
nohttp=nohttp.replace('filecss:HTTP://' + hparts[ihp] + '.css', ajaxit(styto));
} else {
styfrom='filecss:HTTP://' + hparts[ihp] + '.css';
}
} else if (hparts[ihp].indexOf('.CSS') != -1) {
if (styto == 'youllneverfindthis') {
styto='filecss:HTTP://' + hparts[ihp].split('.CSS')[0] + '.CSS';
nohttp=nohttp.replace('filecss:HTTP://' + hparts[ihp].split('.CSS')[0] + '.CSS', ajaxit(styto));
} else {
styfrom='filecss:HTTP://' + hparts[ihp].split('.CSS')[0] + '.CSS';
}
}
}
return nohttp.replace(scrfrom, scrto).replace(styfrom, styto);
}

We hope you get the gist of this battle with the changed twenty first draft of the Earth Scanner web application for you to retry, over again.


Previous relevant Earth Scanner Externals Tutorial is shown below.

Earth Scanner Externals Tutorial

Earth Scanner Externals Tutorial

The “externals” we’re talking about in today’s “Earth Scanner Externals Tutorial” blog posting title refer to …

  • <style> … CSS code … </style> … (or </STYLE> for persevering) … CSS styling (then/or external CSS via URL ending with .css or .CSS (for persevering CSS))
  • <script> … Javascript code … </script> … (or </SCRIPT> for persevering) … Javascript coding (then/or external Javascript via URL ending with .js or .JS (for persevering Javascript))

… we’re encouraging you, as users of our current Earth Scanner, to try, to further personalize your Earth Scanner web application, should you be interested.

And so, onto yesterday’s Earth Scanner Image Styling Tutorial‘s map image, only, styling functionalities, we’ve got more generic ideas to control proceedings today, resulting in a new Javascript “function processinline” called via


function processinline(zretc) {
var ssss=[], jpos=-1, endtag='', jss=0, suffis='', prefis='';
var wasprefixingstuff=prefixingstuff;
var wasdstylestuff=dstylestuff;
var wasdscriptstuff=dscriptstuff;
var wasexdstylestuff=exdstylestuff;
var wasexdscriptstuff=exdscriptstuff;
ssss=zretc.replace(/\<\/S/g, '</s').split('</s');
if (eval('' + ssss.length) > 1) {
for (jss=eval(-1 + ssss.length); jss>=1; jss--) {
switch (ssss[jss].substring(0,4).toLowerCase()) {
case 'tyle':
endtag='</st' + 'yle>';
if (ssss[jss].substring(0,4).toLowerCase() != ssss[jss].substring(0,4)) {
endtag='</sT' + 'YLE>';
}
if (jss > 1) {
jpos=eval(eval('' + zretc.indexOf(ssss[eval(-1 + jss)])) + eval('' + (ssss[eval(-1 + jss)].split('>')[0] + '>').length));
dstylestuff+=ssss[eval(-1 + jss)].replace(ssss[eval(-1 + jss)].split('>')[0] + '>', '') + endtag;
zretc=zretc.replace(zretc.substring(jpos).substring(0,eval('' + (ssss[eval(-1 + jss)].replace(ssss[eval(-1 + jss)].split('>')[0] + '>', '') + endtag).length)), '');
if (document.getElementById('xdstylestuff').innerHTML.indexOf(ssss[eval(-1 + jss)].replace(ssss[eval(-1 + jss)].split('>')[0] + '>', '')) == -1) {
document.getElementById('xdstylestuff').innerHTML+=ssss[eval(-1 + jss)].replace(ssss[eval(-1 + jss)].split('>')[0] + '>', '') + endtag;
//alert(endtag + ' ... ' + ssss[jss].substring(0,4) + ' ... ' + document.getElementById('xdstylestuff').innerHTML);
if (ssss[jss].substring(0,4).toLowerCase() != ssss[jss].substring(0,4)) {
prefixingstuff+=ssss[eval(-1 + jss)].replace(ssss[eval(-1 + jss)].split('>')[0] + '>', '') + endtag;
//alert(prefixingstuff);
}
}
} else {
jpos=eval(eval('' + zretc.indexOf(ssss[eval(-1 + jss)])) + 0);
dstylestuff+=ssss[eval(-1 + jss)] + endtag;
zretc=zretc.replace(zretc.substring(jpos).substring(0,eval('' + (ssss[eval(-1 + jss)] + endtag).length)), '');
if (document.getElementById('xdstylestuff').innerHTML.indexOf(ssss[eval(-1 + jss)]) == -1) {
document.getElementById('xdstylestuff').innerHTML+=ssss[eval(-1 + jss)] + endtag;
//alert(endtag + ' .;. ' + ssss[jss].substring(0,4) + ' .;. ' + document.getElementById('xdstylestuff').innerHTML);
if (ssss[jss].substring(0,4).toLowerCase() != ssss[jss].substring(0,4)) {
prefixingstuff+=ssss[eval(-1 + jss)] + endtag;
//alert(prefixingstuff);
}
}
}
break;

case 'crip':
endtag='</sc' + 'ript>';
if (ssss[jss].substring(0,4).toLowerCase() != ssss[jss].substring(0,4)) {
endtag='</sC' + 'RIPT>';
}
if (jss > 1) {
jpos=eval(eval('' + zretc.indexOf(ssss[eval(-1 + jss)])) + eval('' + (ssss[eval(-1 + jss)].split('>')[0] + '>').length));
dscriptstuff+=ssss[eval(-1 + jss)].replace(ssss[eval(-1 + jss)].split('>')[0] + '>', '') + endtag;
zretc=zretc.replace(zretc.substring(jpos).substring(0,eval('' + (ssss[eval(-1 + jss)].replace(ssss[eval(-1 + jss)].split('>')[0] + '>', '') + endtag).length)), '');
if (document.getElementById('xdscriptstuff').innerHTML.indexOf(ssss[eval(-1 + jss)].replace(ssss[eval(-1 + jss)].split('>')[0] + '>', '')) == -1) {
document.getElementById('xdscriptstuff').innerHTML+=ssss[eval(-1 + jss)].replace(ssss[eval(-1 + jss)].split('>')[0] + '>', '') + endtag;
if (ssss[jss].substring(0,4).toLowerCase() != ssss[jss].substring(0,4)) {
prefixingstuff+=ssss[eval(-1 + jss)].replace(ssss[eval(-1 + jss)].split('>')[0] + '>', '') + endtag;
}
}
} else {
jpos=eval(eval('' + zretc.indexOf(ssss[eval(-1 + jss)])) + 0);
dscriptstuff+=ssss[eval(-1 + jss)] + endtag;
zretc=zretc.replace(zretc.substring(jpos).substring(0,eval('' + (ssss[eval(-1 + jss)] + endtag).length)), '');
if (document.getElementById('xdscriptstuff').innerHTML.indexOf(ssss[eval(-1 + jss)]) == -1) {
document.getElementById('xdscriptstuff').innerHTML+=ssss[eval(-1 + jss)] + endtag;
if (ssss[jss].substring(0,4).toLowerCase() != ssss[jss].substring(0,4)) {
prefixingstuff+=ssss[eval(-1 + jss)] + endtag;
}
}
}
break;

default:
break;

}
}
}

if (wasdscriptstuff != dscriptstuff) { // dynamic Javascript (ideas via YouTube API Embedded Iframe API ... thanks)
if (7 == 7) {
setTimeout(dolater, 3000);
} else {
var tag = document.createElement('script');
tag.innerHTML = dscriptstuff;
var firstScriptTag = document.getElementsByTagName('script')[eval(-1 + document.getElementsByTagName('script').length)];
firstScriptTag.parentNode.insertAfter(tag, firstScriptTag);
}
wasdscriptstuff=dscriptstuff;
}

ssss=zretc.split(' ');
if (eval('' + ssss.length) > 1) {
for (jss=0; jss<ssss.length; jss++) {
if (ssss[jss].toLowerCase().slice(-4) == '.css') {
if (ssss[jss].indexOf('filecss:') == -1) {
zretc=zretc.replace(ssss[jss], 'filecss:' + ssss[jss] + ';');
} else {
zretc=zretc.replace(ssss[jss], ssss[jss] + ';');
}
}
if (ssss[jss].toLowerCase().slice(-3) == '.js') {
//alert('4:' + zretc);
if (ssss[jss].indexOf('filescript:') == -1) {
zretc=zretc.replace(ssss[jss], 'filescript:' + ssss[jss] + ';');
} else {
zretc=zretc.replace(ssss[jss], ssss[jss] + ';');
}
//alert('44:' + zretc);
}
}
}

ssss=zretc.replace(/\.CSS/g, '.css').split('.css');
if (eval('' + ssss.length) > 1) {
for (jss=0; jss<ssss.length; jss++) {
if (eval('' + ssss[jss].length) > 1) {
suffis='';
prefis='';
if ((ssss[eval(1 + jss)] + ' ').substring(0,1) != ';') {
suffis=';';
}
if (ssss[jss].toLowerCase().indexOf('filecss:') == -1) {
if (jss == 0) {
prefis='filecss:';
} else if (ssss[jss].indexOf('.js;') != -1) {
zretc=zretc.replace('.js;', '.js;filecss:');
} else if (ssss[jss].indexOf('.JS;') != -1) {
zretc=zretc.replace('.JS;', '.JS;filecss:');
} else if (ssss[jss].indexOf('.js') != -1) {
zretc=zretc.replace('.js', '.js;filecss:');
} else if (ssss[jss].indexOf('.JS') != -1) {
zretc=zretc.replace('.JS', '.JS;filecss:');
} else if (ssss[jss].indexOf('HTTP') != -1) {
zretc=zretc.replace('HTTP', 'filecss:HTTP');
} else if (ssss[jss].indexOf('http') != -1) {
zretc=zretc.replace('http', 'filecss:http');
} else if (ssss[jss].indexOf('//') != -1) {
zretc=zretc.replace('//', 'filecss://');
} else if (ssss[jss].indexOf('www.') != -1) {
zretc=zretc.replace('www.', 'filecss://www.');
}
}
if ((prefis + suffis) != '') {
zretc=zretc.replace(ssss[jss] + zretc.split(ssss[jss])[1].substring(0,4), prefis + ssss[jss] + zretc.split(ssss[jss])[1].substring(0,4) + suffis);
}
}
}
}

ssss=zretc.replace(/\.JS/g, '.js').split('.js');
if (eval('' + ssss.length) > 1) {
//alert('6:' + zretc);
for (jss=0; jss<ssss.length; jss++) {
if (eval('' + ssss[jss].length) > 1) {
suffis='';
prefis='';
if ((ssss[eval(1 + jss)] + ' ').substring(0,1) != ';') {
suffis=';';
}
if (ssss[jss].toLowerCase().indexOf('filescript:') == -1) {
if (jss == 0) {
prefis='filescript:';
} else if (ssss[jss].indexOf('.css;') != -1) {
zretc=zretc.replace('.css;', '.css;filescript:');
} else if (ssss[jss].indexOf('.CSS;') != -1) {
zretc=zretc.replace('.CSS;', '.CSS;filescript:');
} else if (ssss[jss].indexOf('.css') != -1) {
zretc=zretc.replace('.css', '.css;filescript:');
} else if (ssss[jss].indexOf('.CSS') != -1) {
zretc=zretc.replace('.CSS', '.CSS;filescript:');
} else if (ssss[jss].indexOf('HTTP') != -1) {
zretc=zretc.replace('HTTP', 'filescript:HTTP');
} else if (ssss[jss].indexOf('http') != -1) {
zretc=zretc.replace('http', 'filescript:http');
} else if (ssss[jss].indexOf('//') != -1) {
zretc=zretc.replace('//', 'filescript://');
} else if (ssss[jss].indexOf('www.') != -1) {
zretc=zretc.replace('www.', 'filescript://www.');
}
}
if ((prefis + suffis) != '') {
//alert('676:' + ssss[jss] + ' plus ' + zretc.split(ssss[jss])[1].substring(0,3) + ' from ' + zretc);
zretc=zretc.replace(ssss[jss] + zretc.split(ssss[jss])[1].substring(0,3), prefis + ssss[jss] + zretc.split(ssss[jss])[1].substring(0,3) + suffis);
}
}
}
//alert('66:' + zretc);
}

zretc=zretc.replace(/FILECSS\:/g, 'filecss:').replace(/FILESCRIPT\:/g, 'filescript:');
//alert('7:' + zretc);

ssss=zretc.split('filescript:');
for (jss=1; jss<ssss.length; jss++) {
if (ssss[jss].split(';')[0].indexOf('.JS') != -1) {
prefixingstuff+='filescript:' + ssss[jss].split(';')[0] + ';';
if (exdscriptstuff.indexOf(ssss[jss].split(';')[0]) == -1) {
exdscriptstuff+='<scr' + 'ipt type=text/javascript src="' + ssss[jss].split(';')[0] + '"></sCR' + 'IPT>';
}
} else {
if (exdscriptstuff.indexOf(ssss[jss].split(';')[0]) == -1) {
exdscriptstuff+='<scr' + 'ipt type=text/javascript src="' + ssss[jss].split(';')[0] + '"></sc' + 'ript>';
}
}
}

ssss=zretc.split('filecss:');
for (jss=1; jss<ssss.length; jss++) {
if (ssss[jss].split(';')[0].indexOf('.CSS') != -1) {
prefixingstuff+='filecss:' + ssss[jss].split(';')[0] + ';';
if (exdstylestuff.indexOf(ssss[jss].split(';')[0]) == -1) {
exdstylestuff+='<li' + 'nk type=text/css href="' + ssss[jss].split(';')[0] + '"></lI' + 'NK>';
}
} else {
if (exdstylestuff.indexOf(ssss[jss].split(';')[0]) == -1) {
exdstylestuff+='<li' + 'nk type=text/css href="' + ssss[jss].split(';')[0] + '"></li' + 'nk>';
}
}
}

if (wasprefixingstuff != prefixingstuff) {
try {
window.localStorage.removeItem('earth_scanner_externals');
} catch(anoops) {
}
//alert(prefixingstuff);
window.localStorage.setItem('earth_scanner_externals', encodeURIComponent(prefixingstuff));
//alert(window.localStorage.getItem('earth_scanner_externals'));
}


if (1 == 6 && wasexdscriptstuff != exdscriptstuff) {
}

if (1 == 6 && wasexdstylestuff != exdstylestuff) {
}


//alert('98:' + zretc);
return zretc.replace(/\;\ \;/g,';').replace(/\;\;/g,';');
}

function processcss(retc) {
var labels=[], ilab=0, thislab='';

if ((retc.trim() + ' ').substring(0,1) == '<' || retc.trim().toLowerCase().replace('.css','.js').indexOf('.js') != -1) {
retc=processinline(retc);
//alert('*' + retc + '*');
}

if (retc.indexOf(';') != -1 && retc.indexOf(':') != -1) {
if (eval('' + retc.indexOf(';')) > eval('' + retc.indexOf(':'))) {
thecss='';
thecssarg='';
while (eval('' + retc.indexOf(';')) > eval('' + retc.indexOf(':'))) {
thecss+=' ' + retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':' + retc.split(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':')[1].split(';')[0] + '; ';
labels=retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)].split('-');
thislab=labels[0].toLowerCase();
for (ilab=1; ilab<labels.length; ilab++) {
thislab+=labels[ilab].substring(0,1).toUpperCase() + labels[ilab].substring(1).toLowerCase();
}
try {
undos.push(" document.getElementById('myimg').style." + thislab + "='none';");
eval(" document.getElementById('myimg').style." + thislab + "='" + retc.split(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':')[1].split(';')[0] + "';");
} catch(hgfjh) {
}
retc=retc.replace(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':' + retc.split(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':')[1].split(';')[0] + ';', '');
}
if (thecss.replace('nocssplease',':').indexOf(':') != -1) {
thecssarg='?css=' + encodeURIComponent(thecss);
}
var cflds=thecss.split(':');
if (('' + window.localStorage.getItem('earth_scanner_css')).replace(/^null/g,'').replace(/^undefined/g,'') != '') {
window.localStorage.removeItem('earth_scanner_css');
}
if (cflds[eval(-1 + cflds.length)].trim() != '') {
window.localStorage.setItem('earth_scanner_css', encodeURIComponent(thecss));
} else {
thecss='';
thecssarg='';
if (eval('' + undos.length) > 0) {
for (ilab=0; ilab<undos.length; ilab++) {
eval('' + undos[ilab]);
}
undos=[];
}
}
}
} else if (retc.indexOf(';') == -1 && retc.replace('nocssplease',':').indexOf(':') != -1) {
if (retc.indexOf(':') != -1) {
retc=retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':';
retc=retc.replace('nocssplease','');
} else {
retc=retc.replace('nocssplease','');
}
if (('' + window.localStorage.getItem('earth_scanner_css')).replace(/^null/g,'').replace(/^undefined/g,'') != '') {
window.localStorage.removeItem('earth_scanner_css');
}
thecss='';
thecssarg='';
if (eval('' + undos.length) > 0) {
for (ilab=0; ilab<undos.length; ilab++) {
eval('' + undos[ilab]);
}
undos=[];
}
}
//alert(retc);
return retc;
}

… in the changed twentieth draft of the Earth Scanner web application for you to retry, again … yet again, where “the blurb” for “heads up” purposes now goes …

At prompt window, prefixing, and persevering, CSS map image styling available (and able to be turned off via nocssplease) eg. filter:sepia(74%); Or you can specify <style></style> non-persevering or <style></STYLE> persevering CSS of your own (or use a URL ending with .css) to begin with and/or <script></script> non-persevering or <script></SCRIPT> persevering Javascript of your own (or use a URL ending with .js) to begin with

Today’s animated GIF presentation shows us, at the prompt window, enter …

<style> span { font-style: italic; } </STYLE>

… which affected the Earth Scanner text look, then (a, for us, local MAMP external Javascript reference, which functioned up at the RJM Programming domain) …

HTTP://localhost:8888/newstuff.js

… and if it had been called http://localhost:8888/newstuff.JS it could have persevered.


Previous relevant Earth Scanner Image Styling Tutorial is shown below.

Earth Scanner Image Styling Tutorial

Earth Scanner Image Styling Tutorial

Today’s improvement on yesterday’s Earth Scanner Delimitation Cover Tutorial is simple on paper …

  • allow users to change the CSS styling of the map that is an image (img element) for our Earth Scanner …
  • but quite involved, to make work, in practice

Why? Well, we want a meaningful change, it having such big implications. And then there is the thought about whether it can or should be propagated through to any sharing or collaboration friends? Easy answer … yes. Because we cater for the nullifying of any of these image styling.

And can an image styling persevere to the next web browser session? Easy answer … yes. We’ve got HTTP Cookies, or what we’ve plumped for … Window localStorage … as alternatives, to allow for perseverence on a web browser platform, of your CSS image styling, between sessions.

Here are the various bits of Javascript contributing to the addition of this functionality …

  • get argument acceptance and variable cseplocans becomes global …

    var earth_scanner_css=location.search.split('css=')[1] ? (decodeURIComponent(location.search.split('css=')[1].split('&')[0]).replace(/\+/g,' ')) : '';
    var cseplocans='';
  • as used in the document.write equivalence to a usual document.body onload scenario …

    thecss=earth_scanner_css;
    if (thecss == '') {
    thecss=decodeURIComponent(('' + window.localStorage.getItem('earth_scanner_css')).replace(/^null/g,'').replace(/^undefined/g,''));
    } else if (thecss.replace('nocssplease',':').indexOf(':') != -1) {
    var cflds=thecss.split(':');
    if (('' + window.localStorage.getItem('earth_scanner_css')).replace(/^null/g,'').replace(/^undefined/g,'') != '') {
    window.localStorage.removeItem('earth_scanner_css');
    }
    if (cflds[eval(-1 + cflds.length)].trim() != '') {
    window.localStorage.setItem('earth_scanner_css', encodeURIComponent(thecss));
    } else {
    thecss='';
    thecssarg='';
    }
    }
    if (thecss.replace('nocssplease',':').indexOf(':') == -1) { thecss=''; } else { thecssarg='?css=' + encodeURIComponent(thecss); processcss(thecss); }


    document.write("<img src='/HTMLCSS/HYP_50M_SR_W.jpg' id=myimg width=" + eval(zoomf * 10800) + " height=" + eval(zoomf * 5400) + " style='margin:0 0 0 0;margin-left:10px;margin-top:10px;" + thecss + "'></img><div id=dstyle></div><input id=sdtitle type=hidden value='Earth Scanner'></input><input id=sdtext type=hidden value='Earth Scanner - RJM Programming'></input><input id=sdurl type=hidden value='" + document.URL.split('#')[0] + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'') + "'></input><iframe scrolling=no farmeborder=0 style='z-index:3456;position:fixed;top:55px;left:15px;width:30px;height:24px;' src='/HTMLCSS/web_share_api_test.html?emojize=128231'></iframe><input type=hidden id=itworked value=''></input><iframe onload=coordit(this); id=wif style=display:none;margin-left:50px; src='//wikipedia.org/wiki/Saint_George,_Antigua_and_Barbuda'></iframe><iframe onload=coordittwo(this); id=wiftwo style=display:none; src=></iframe><input type=hidden id=placegeo title='' value=''></input>" + atend);
  • start wrapping the Javascript prompt window where relevant

    cseplocans=cssprompt(ourblurb, defv);
  • in new wrapper function …

    function cssprompt(inb, ind) {
    var xretc=prompt(inb, ind);
    if (xretc != null) {
    xretc=processcss(xretc);
    }
    return xretc;
    }
  • calling a new user entry analysis Javascript function …

    function processcss(retc) {
    var labels=[], ilab=0, thislab='';
    if (retc.indexOf(';') != -1 && retc.indexOf(':') != -1) {
    if (eval('' + retc.indexOf(';')) > eval('' + retc.indexOf(':'))) {
    thecss='';
    thecssarg='';
    while (eval('' + retc.indexOf(';')) > eval('' + retc.indexOf(':'))) {
    thecss+=' ' + retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':' + retc.split(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':')[1].split(';')[0] + '; ';
    labels=retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)].split('-');
    thislab=labels[0].toLowerCase();
    for (ilab=1; ilab<labels.length; ilab++) {
    thislab+=labels[ilab].substring(0,1).toUpperCase() + labels[ilab].substring(1).toLowerCase();
    }
    try {
    undos.push(" document.getElementById('myimg').style." + thislab + "='none';");
    eval(" document.getElementById('myimg').style." + thislab + "='" + retc.split(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':')[1].split(';')[0] + "';");
    } catch(hgfjh) {
    }
    retc=retc.replace(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':' + retc.split(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':')[1].split(';')[0] + ';', '');
    }
    if (thecss.replace('nocssplease',':').indexOf(':') != -1) {
    thecssarg='?css=' + encodeURIComponent(thecss);
    }
    var cflds=thecss.split(':');
    if (('' + window.localStorage.getItem('earth_scanner_css')).replace(/^null/g,'').replace(/^undefined/g,'') != '') {
    window.localStorage.removeItem('earth_scanner_css');
    }
    if (cflds[eval(-1 + cflds.length)].trim() != '') {
    window.localStorage.setItem('earth_scanner_css', encodeURIComponent(thecss));
    } else {
    thecss='';
    thecssarg='';
    if (eval('' + undos.length) > 0) {
    for (ilab=0; ilab<undos.length; ilab++) {
    eval('' + undos[ilab]);
    }
    undos=[];
    }
    }
    }
    } else if (retc.indexOf(';') == -1 && retc.replace('nocssplease',':').indexOf(':') != -1) {
    if (retc.indexOf(':') != -1) {
    retc=retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':';
    retc=retc.replace('nocssplease','');
    } else {
    retc=retc.replace('nocssplease','');
    }
    if (('' + window.localStorage.getItem('earth_scanner_css')).replace(/^null/g,'').replace(/^undefined/g,'') != '') {
    window.localStorage.removeItem('earth_scanner_css');
    }
    thecss='';
    thecssarg='';
    if (eval('' + undos.length) > 0) {
    for (ilab=0; ilab<undos.length; ilab++) {
    eval('' + undos[ilab]);
    }
    undos=[];
    }
    }
    //alert(retc);
    return retc;
    }

… in the changed nineteenth draft of the Earth Scanner web application for you to retry, yet again … again.

And below are some image CSS styling ideas for you to try …


Previous relevant Earth Scanner Delimitation Cover Tutorial is shown below.

Earth Scanner Delimitation Cover Tutorial

Earth Scanner Delimitation Cover Tutorial

We find, further to yesterday’s Earth Scanner Map Image Margin Tutorial, with some long running programming projects, how you can get days, or whole periods, where either …

  • the day itself’s progress is a bit (or totally) sideways … or …
  • the day itself’s progress is a bit (or totally) sideways, because of something you decided some time back

… and we have that feeling about today, in that you might have realized days ago but we were in denial, or scared (rightly) about difficulties, that the idea of those …

  • ?
  • !

… delimitations from a couple of days ago were a bit irrelevant, when it was within our powers to decide, about a placename, whether it was a TimeZone one or not (and if not, try Wikipedia), so in that scenario, why not, behind the scenes, help out the user?

Indeed!

But it was difficult to rearrange things (especially regarding the timing, in the code, about these occurrences) as we did today, to allow this to happen, and it prompted us to try a prompt window entry …

Budgewoi,Alice Springs-Tennant Creek

(see Mum, no Delimiters!) entry, which plotted an all legs overlay, rather than channel the nuances in the minds of Budgewoi residents contemplating the trip to Alice Springs accompanying the crows?! The thing is, in defence of a user having to use delimiters (and, by the way, your more masochistic users can mention nohelp somewhere in the address bar, to not get delimiter assistance), is that, with all this, misspellings of placenames or Wikipedia URLs not getting you to geodata information, or there not being any, or the entries by the user not being straightforward, are still issues that can arise with the Earth Scanner … we’re just telling you for a friend … … Ssshhhh! Please don’t tell them we fixed the Budgewoi issue, else it’ll be more treats!

So sideways turns into crabways progress today, as we did add in more involved double click event logic for 🧭 compass leg emoji …


function glegit(iwhat) {
return '' + iwhat.getAttribute('data-tleg');
}

function windowopen(w1, w2, w3) {
var twoends=[], tzps=[];
if (gleg != '') {
twoends=gleg.split('.');
}
if (eval('' + twoends.length) > 1) {
w3='top=50,left=50,width=1000,height=900';
if (plottz[eval('' + twoends[0])].trim() != '' && plottz[eval('' + twoends[1])].trim() != '') {
w3='top=50,left=' + Math.floor(screenwidth / 3) + ',width=' + Math.floor(screenwidth / 3) + ',height=900';
window.open('//www.rjmprogramming.com.au/HTMLCSS/colour_wheel.html?mode=' + encodeURIComponent(plottz[eval('' + twoends[0])].trim()), '_blank','top=50,left=2,width=' + Math.floor(screenwidth / 3) + ',height=900');
window.open('//www.rjmprogramming.com.au/HTMLCSS/colour_wheel.html?mode=' + encodeURIComponent(plottz[eval('' + twoends[1])].trim()), '_blank','top=50,left=' + Math.floor(screenwidth * 2 / 3) + ',width=' + Math.floor(screenwidth / 3) + ',height=900');
} else if (plottz[eval('' + twoends[0])].trim() != '') {
w3='top=50,left=' + Math.floor(screenwidth / w) + ',width=' + Math.floor(screenwidth / 2) + ',height=900';
window.open('//www.rjmprogramming.com.au/HTMLCSS/colour_wheel.html?mode=' + encodeURIComponent(plottz[eval('' + twoends[0])].trim()), '_blank','top=50,left=2,width=' + Math.floor(screenwidth / 2) + ',height=900');
} else if (plottz[eval('' + twoends[1])].trim() != '') {
w3='top=50,left=5,width=' + Math.floor(screenwidth / 2) + ',height=900';
window.open('//www.rjmprogramming.com.au/HTMLCSS/colour_wheel.html?mode=' + encodeURIComponent(plottz[eval('' + twoends[1])].trim()), '_blank','top=50,left=' + Math.floor(screenwidth / 2) + ',width=' + Math.floor(screenwidth / 2) + ',height=900');
}
}
return window.open(w1, w2, w3);
}

… adding in interfacing to our Colour Wheel web application, in the changed eighteenth draft of the Earth Scanner web application for you to retry, yet again.


Previous relevant Earth Scanner Map Image Margin Tutorial is shown below.

Earth Scanner Map Image Margin Tutorial

Earth Scanner Map Image Margin Tutorial

We finally got around to addressing a bugbear we’ve had with our Earth Scanner web application, of recent times, right from its inception, regarding the small mismatch of overlayed HTML elements with the world map (image) underneath, improving on yesterday’s Earth Scanner Wikipedia Images Tutorial.

So, is it the chicken or the egg that should change? Neither, because the marmalade just crossed the road at the zebra crossing. And you don’t want to make the zebra mad, now … huh?!

Well, we figured, even just from a laziness perspective, it was easier to tinker with CSS margin-left and margin-top properties of the world map (image) element, and so got to, tweaking …


document.write("<img src='/HTMLCSS/HYP_50M_SR_W.jpg' id=myimg width=10800 height=5400 style='margin:0 0 0 0;margin-left:10px;margin-top:10px;'></img><div id=dstyle></div><input id=sdtitle type=hidden value='Earth Scanner'></input><input id=sdtext type=hidden value='Earth Scanner - RJM Programming'></input><input id=sdurl type=hidden value='" + document.URL.split('#')[0] + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'') + "'></input><iframe scrolling=no farmeborder=0 style='z-index:3456;position:fixed;top:55px;left:15px;width:30px;height:24px;' src='/HTMLCSS/web_share_api_test.html?emojize=128231'></iframe><input type=hidden id=itworked value=''></input><iframe onload=coordit(this); id=wif style=display:none;margin-left:50px; src='//wikipedia.org/wiki/Saint_George,_Antigua_and_Barbuda'></iframe><iframe onload=coordittwo(this); id=wiftwo style=display:none; src=></iframe><input type=hidden id=placegeo title='' value=''></input>" + atend);
document.body.title='' + document.title + String.fromCharCode(10) + ' ... at prompt ++ can make delay between snapshots slower and -- can make delay faster ' + String.fromCharCode(10) + ' ... at prompt > can hide time related information else < reveals again ' + String.fromCharCode(10) + ' ... comma lists of TimeZone places (suffix ? for Wikipedia ! forced), Country Codes, Country Names can be plotted via click or via hashtag use at address bar ' + String.fromCharCode(10) + ' ... suffix with space to show meridians and/or prefix to not show meridians ' + String.fromCharCode(10) + ' ... multiple place plotting is faster via comma separated {} annotated list (where, instead of comma, a minus - constructs Trip Leg between those places) ';
document.body.style.backgroundColor='rgba(0,0,255,0.5)';

… that last codeline trying to ameloriate that kludgy feeling change we felt compelled to make … though we all want to participate in the Sydney to Hobart Yacht Race, don’t we?!

And then further to yesterday’s Earth Scanner Wikipedia Images Tutorial, and continuing its theme, instead of Wikipedia images only for “TimeZone places” we extended the thinking to other places, where possible.

And then there was the checking of a couple of matters regarding sharing and collaboration code. It occurred to us the way we were starting to build up how long that “nontz” get argument might get to with all these non-timezone places, it occurred to us that it could start getting mapped back into the “purely clientside” location.hash mode of thinking, as per


var nontz=('' + location.search + ('' + location.hash).replace(/^\#/g,'')).split('nontz=')[1] ? decodeURIComponent(('' + location.search + ('' + location.hash).replace(/^\#/g,'')).split('nontz=')[1].split('&')[0].split('#')[0]) : '';

… so that we could rest easier. In amongst that initial “nontz” coding we added


plotplacepush=(locans.split('|')[0].replace(/\_/g,' '));

if (bigback.indexOf(plotplacepush + ':') == -1 && bigback.indexOf(plotplacepush.replace(/\ /g,'_') + ':') == -1 && nextwiftwo.indexOf(encodeURIComponent(plotplacepush)) == -1) {
if (wiftwoavailable) {
wiftwoavailable=false;
document.getElementById('wiftwo').src='/PHP/fgc/index.php?tzexact=&tznickname=' + encodeURIComponent(plotplacepush.replace(/\ /g,'_'));
} else {
nextwiftwo+='/PHP/fgc/index.php?tzexact=&tznickname=' + encodeURIComponent(plotplacepush.replace(/\ /g,'_')) + '#';
}
}


plotlongpush=(locans.split('|')[1].replace('_','-'));
plotlatpush=(locans.split('|')[2].replace('_','-'));

… so that our Hunters and Collectors “Do You See What I See?” can be more often in the affirmative in the changed seventeenth dolldraft of the Earth Scanner web application for you to retry, again.


Previous relevant Earth Scanner Wikipedia Images Tutorial is shown below.

Earth Scanner Wikipedia Images Tutorial

Earth Scanner Wikipedia Images Tutorial

Yesterday’s Earth Scanner Linear Gradient Leg Tutorial‘s use of Wikipedia geodata reminded us, again, of the incredible resource Wikipedia can be for the online world.

Wikipedia is a great resource for images of places too, and today, we add to the functionality of …

  • 📍
  • TimeZone place
  • onclick event

… “when ready” way we open a popup window displaying some of these images in a sort of collage relevant to the place 📍 pin you clicked, the main Javascript function “players” being …


var bigback='', nextwiftwo='', wiftwoavailable=true, wobi=null;

function woit(what) { // pin onclick event
if (what.trim() != '') {
if (bigback.indexOf(what + ':') != -1) {
if (wobi) {
if (!wobi.closed) { wobi.close(); }
}
wobi=window.open('', '_blank', 'top=50,left=50,width=900,height=800');
wobi.document.write(bigback.split(what + ':')[1].split('</div>')[0] + '</div>');
}
}
}

function coordittwo(xiois) { // Wikipedia image URLs gathered via iframe onload event
var xxaconto = (xiois.contentWindow || xiois.contentDocument);
if (xxaconto != null) {
if (xxaconto.document) { xxaconto = xxaconto.document; }
var xxacontobodyouterHTML=xxaconto.body.outerHTML.replace(/\"\;/g,'"');
if (xxacontobodyouterHTML.indexOf('.style.background="URL(') != -1) {
if (bigback.indexOf(xiois.src.split('tznickname=')[1].split('&')[0].split('#')[0] + ':') == -1) {
if (document.getElementById('span' + xiois.src.split('tznickname=')[1].split('&')[0].split('#')[0])) {
document.getElementById('span' + xiois.src.split('tznickname=')[1].split('&')[0].split('#')[0]).style.cursor='pointer';
}
bigback+=xiois.src.split('tznickname=')[1].split('&')[0].split('#')[0] + ':' + document.getElementById('ourcanvas').outerHTML.replace('<canvas','<div title="Images thanks to Wikipedia at https://wikipedia.org" ').replace('</canvas>','</div>').replace(':none;',':block;background:' + 'URL(' + xxacontobodyouterHTML.split('.style.background="URL(')[1].split('"')[0] + ';background-repeat:no-repeat;background-position:' + xxacontobodyouterHTML.split('.style.backgroundPosition="')[1].split('"')[0]);
}
}
wiftwoavailable=true;
if (nextwiftwo.split('#')[0] != '') {
xiois.src=nextwiftwo.split('#')[0];
nextwiftwo=nextwiftwo.replace(nextwiftwo.split('#')[0] + '#', '');
wiftwoavailable=false;
}
}
}

… in the changed sixteenth draft of the Earth Scanner web application for you to retry.


Previous relevant Earth Scanner Linear Gradient Leg Tutorial is shown below.

Earth Scanner Linear Gradient Leg Tutorial

Earth Scanner Linear Gradient Leg Tutorial

Onto yesterday’s Earth Scanner Question Delimiter Tutorial‘s progress, today, we have …

  • a linear gradient applied to the trip leg plotting … for …
    1. colour
    2. direction

    … purposes …
    <style>

    hr.hrright {
    background-image: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet);
    }

    hr.hrleft {
    background-image: linear-gradient(to left, red, orange, yellow, green, blue, indigo, violet);
    }

    </style>
    … and …

  • code for a new placename suffix delimiter …

    !

    … (in addition to “?”) to force the Wikipedia interpretation of geodata for a placename entered by the user … the orgainizing Javascript function now looking like …

    function dountilnoquestion() {
    var ibap=0, bap=[];
    caret='^';
    //document.title=gdefv;
    console.log('gdefv=' + gdefv);
    if (gdefv.trim() != gdefv.trim().replace(/\?$/g,'') || gdefv.indexOf('!?') != -1 || gdefv.indexOf('?!') != -1 || gdefv.indexOf('?{') != -1 || gdefv.indexOf('?,') != -1 || gdefv.indexOf('?-') != -1) {
    bap=gdefv.split('{');
    for (ibap=1; ibap<bap.length; ibap++) {
    if (bap[ibap].split('}')[0].indexOf('?') != -1) {
    gdefv=gdefv.replace(bap[ibap], bap[ibap].replace(/\?/g, '%3f'));
    }
    }
    //alert('gdefv=' + gdefv);
    // Alice Springs|133.87000|_23.70000^-Sydney?!
    curgdefv=gdefv.split('?')[0].split(',')[eval(-1 + gdefv.split('?')[0].split(',').length)].trim().replace(/^\[/g,'');
    //alert('Curgdefv=' + curgdefv);
    curgdefv=curgdefv.split('^')[eval(-1 + curgdefv.split('^').length)].replace(/^\-/g,'');
    //alert('curGdefv=' + curgdefv);
    if (curgdefv != curgdefv.replace(/\!$/g,'')) {
    caret='^ ';
    gdefv=gdefv.replace(curgdefv, curgdefv.replace(/\!$/g,''));
    //alert('1:' + gdefv);
    curgdefv=curgdefv.replace(/\!$/g,'');
    } else if (gdefv.indexOf(curgdefv + '?!') != -1) {
    caret='^ ';
    gdefv=gdefv.replace(curgdefv + '?!', curgdefv + '?');
    //alert('2:' + gdefv);
    curgdefv=curgdefv;
    }
    if (caret == '^ ' && yourtzlist.toLowerCase().indexOf('/' + curgdefv.toLowerCase().replace(/\ /g,'_') + '<') == -1) {
    caret='^';
    }
    }

    //alert('*' + caret + '*');


    if (caret == '^') {

    if (yourtzlist.toLowerCase().indexOf('/' + curgdefv.toLowerCase().replace(/\ /g,'_') + '<') != -1) {
    gdefv=gdefv.replace(curgdefv + '?', curgdefv + '^');
    if (gdefv.indexOf('?') == -1) {
    gdefv=gdefv.replace(/\^/g, '').replace(/\%3f/g, '?');
    //alert('gdefv=' + gdefv);
    scmok=true;
    movesallowed=true;
    gmovesallowed=true;
    five=5;
    gfive=5;
    document.getElementById('myimg').click(); //scmove();
    } else {
    setTimeout(dountilnoquestion, 1000);
    }
    } else {
    //alert('curgdefv=' + curgdefv);
    document.getElementById('placegeo').value=' ';
    document.getElementById('wif').src='/PHP/fgc/index.php?placegeo=' + encodeURIComponent(curgdefv.replace(/\ \(/g,', ').replace(/\)$/g,'')).replace(/\%20/g,'_');
    }

    } else if (caret == '^ ') {


    if (caret == '^' && yourtzlist.toLowerCase().indexOf('/' + curgdefv.toLowerCase().replace(/\ /g,'_') + '<') != -1) {
    gdefv=gdefv.replace(curgdefv + '?', curgdefv + '^');
    if (gdefv.indexOf('?') == -1) {
    gdefv=gdefv.replace(/\^/g, '').replace(/\%3f/g, '?');
    //alert('gdefv=' + gdefv);
    scmok=true;
    movesallowed=true;
    gmovesallowed=true;
    five=5;
    gfive=5;
    document.getElementById('myimg').click(); //scmove();
    } else {
    setTimeout(dountilnoquestion, 1000);
    }
    } else {
    //alert('curgdefv=' + curgdefv);
    document.getElementById('placegeo').value=' ';
    document.getElementById('wif').src='/PHP/fgc/index.php?placegeo=' + encodeURIComponent(curgdefv.replace(/\ \(/g,', ').replace(/\)$/g,'')).replace(/\%20/g,'_');
    }

    }
    }

… in the changed fifteenth draft of the Earth Scanner web application for you to retry.


Previous relevant Earth Scanner Question Delimiter Tutorial is shown below.

Earth Scanner Question Delimiter Tutorial

Earth Scanner Question Delimiter Tutorial

We’re adding another delimiter to those discussed in yesterday’s Earth Scanner Delimitation Tutorial, and it’s a doozy …

?

… (just quietly for now while we test for another day) … placed after a placename will …

  • first check if a TimeZone placename, and use that PHP timezone longitude and latitude should it find that to be the case … else …
  • will look to Wikipedia, thanks, for help, as available …

… for improvements on two fronts …

  1. a lot of us don’t know every timezone placename (but we expect you to know from tomorrow about 3?)
  2. Wikipedia has tons of useful geodata on lots of places brought into the Earth Scanner realms via this change …

    function coordit(xiois) {
    var xaconto = (xiois.contentWindow || xiois.contentDocument);
    if (xaconto != null) {
    try {
    if (xaconto.document) { xaconto = xaconto.document; }
    if (xaconto.body.innerHTML.indexOf('>Coordinates') != -1) {
    var subpart=xaconto.body.innerHTML.split('>Coordinates')[1];
    latdeg=-999;
    longdeg=-999;
    latmin=0;
    longmin=0;
    latsec=0;
    longsec=0;
    sparelat='';
    sparelong='';
    if (subpart.indexOf('"latitude"') != -1 && subpart.indexOf('"longitude"') != -1) {
    latdeg=subpart.split('"latitude"')[1].split('>')[1].split("°")[0].split('<')[0];
    sparelat=subpart.split('"latitude"')[1].split('>')[1].split('<')[0].slice(-1);
    latmin=subpart.split('"latitude"')[1].split('>')[1].split('<')[0].substring(eval(1 + eval('' + latdeg.length))).split("′")[0].split(sparelat)[0].split('<')[0];
    if (sparelat == 'S') { latdeg=eval(eval(eval(-1 * latmin) / 60) - latdeg); } else { latdeg+=eval(eval('' + latmin) / 60) }

    longdeg=subpart.split('"longitude"')[1].split('>')[1].split("°")[0].split('<')[0];
    sparelong=subpart.split('"longitude"')[1].split('>')[1].split('<')[0].slice(-1);
    longmin=subpart.split('"longitude"')[1].split('>')[1].split('<')[0].substring(eval(1 + eval('' + longdeg.length))).split("′")[0].split(sparelong)[0].split('<')[0];
    if (sparelong == 'W') { longdeg=eval(eval(eval(-1 * longmin) / 60) - longdeg); } else { longdeg+=eval(eval('' + longmin) / 60) }

    if (gdefv.indexOf(curgdefv + '?') != -1) {
    gdefv=gdefv.replace(curgdefv + '?', curgdefv + ('|' + longdeg).replace('|-','|_') + + ('|' + latdeg).replace('|-','|_') + '^');
    dountilnoquestion();
    }

    return true;

    } else if (('' + document.getElementById('placegeo').value).trim().indexOf(',') != -1) {
    latdeg=document.getElementById('placegeo').value.split(',')[eval(-2 + document.getElementById('placegeo').value.split(',').length)];
    longdeg=document.getElementById('placegeo').value.split(',')[eval(-1 + document.getElementById('placegeo').value.split(',').length)];

    if (gdefv.indexOf(curgdefv + '?') != -1) {
    gdefv=gdefv.replace(curgdefv + '?', curgdefv + ('|' + longdeg).replace('|-','|_') + ('|' + latdeg).replace('|-','|_') + '^');
    dountilnoquestion();
    }

    return true;
    }


    } else {

    if (('' + document.getElementById('placegeo').value).trim().indexOf(',') != -1) {
    latdeg=document.getElementById('placegeo').value.split(',')[eval(-2 + document.getElementById('placegeo').value.split(',').length)];
    longdeg=document.getElementById('placegeo').value.split(',')[eval(-1 + document.getElementById('placegeo').value.split(',').length)];

    if (gdefv.indexOf(curgdefv + '?') != -1) {
    gdefv=gdefv.replace(curgdefv + '?', curgdefv + ('|' + longdeg).replace('|-','|_') + ('|' + latdeg).replace('|-','|_') + '^');
    dountilnoquestion();
    }
    } else {
    if (gdefv.indexOf(curgdefv + '?') != -1) {
    gdefv=gdefv.replace(curgdefv + '?', curgdefv + '^');
    dountilnoquestion();
    }
    }

    }
    } catch(hgjg) { }
    }
    return true;
    }

… in a changed fourteenth draft of the Earth Scanner web application for you to retry.


Previous relevant Earth Scanner Delimitation Tutorial is shown below.

Earth Scanner Delimitation Tutorial

Earth Scanner Delimitation Tutorial

A lot of the data aspects to our latest Earth Scanner web application have relied on …

  • user reliability … and …
  • delimitation rules … less stringent for …
  • timezone places

Of course, we’d really like to automate more, but because we are not the repository of place geographicals data regarding placenames, except via PHP TimeZone derived ones, thanks, we don’t envisage a time with this web application, where for most places (which are not timezone places) that the user wants to specify and plot and perhaps form part of an itinerary schedule, they will be specifying longitude and latitude data. That is asking a bit of the user, as a lot of us will forget the order of these, and so of the two new data format syntaxes accepted, as of today, for examples regarding Alice Springs …

  1. Alice Springs 23.6980° S, 133.8807° E
    … as with this link
  2. Alice Springs|133.8807|-23.6980
    … as with this link

… the former of which, can have latitude and longitude order flexible, and determined via those N or S and W or E directionals, and we just copy off the Google webpage their presented syntax after the placename, optionally followed by a space.

We mention the second syntax above as the basis for our hashtagging inhouse logic, helping as a conduit towards communications for other parties.

Believe it or not with these nuances, at least for us, with the architecture of this Earth Scanner, is far from trivial, and it represents a salutary lesson regarding delimitation. It is best to have only one role for particular delimiter usage within your web application. It was overcomable for us, via context, to have in the Earth Scanner …

  • a minus “-” delimiter can be
    1. a negative aspect to latitude or longitude
    2. be a trip leg delimiter
    3. can be a character in a place name … and we hope we’ve covered off that it …
    4. can be a character in a country name
  • a comma “,” delimiter can be
    1. a separator of latitude or longitude or placename in some syntaxes
    2. a separator between placename and country name or country code
    3. a separator between some place plus geographicals syntaxes

… but life would have been easier with a one to one relationship between delimiter and role.

And so, further to yesterday’s Earth Scanner Placements Tutorial we have a changed thirteenth draft of the Earth Scanner web application for you to retry.


Previous relevant Earth Scanner Placements Tutorial is shown below.

Earth Scanner Placements Tutorial

Earth Scanner Placements Tutorial

You see that little play on words in today’s title, using …

Placements

? Where we meant “the specification, by placename, of latitude and longitude for a user defined place”? And so we decided not to give this blog posting the title …

Earth Scanner the specification, by placename, of latitude and longitude for a user defined place Tutorial

… because … cough, cough … that’s us …

  • succinct …
  • unable to find the place mats … tee hee … but …
  • ready to be “agile in place

Let’s go over the backstory. With our current Earth Scanner project, as far as placenames go, without a latitude or longitude specification, it’s best worked, so far, ever since Earth Scanner TimeZone Tutorial, with those placenames being TimeZone placenames, because …

PHP inspired TimeZone place lookup logic within the Javascript code

… were a freely available resource for us. But the users using our Earth Scanner are also a resource, and can supply prompt window entries such as …


[133.8807,-23.6980,Alice Springs]
… or …
… equivalent
in this case
regarding real mantissa …
remember rules?

133.8807,-23.6980,Alice Springs

… which now, further to yesterday’s Earth Scanner Itinerary Collaboration Tutorial, has the effect of …

This allows places other than TimeZone places be fully functional components in the logic for plotting and annotations and trip planning and itinerary construction purposes in our latest twelfth draft Earth Scanner web application.

Did you know?

As well as mantissa “kludge” we enjoy a good anti-dot . “kludge” every now and then. In a couple of “if” statements we now have


if (eval('' + ('' + locans.trim()).length) >= 3 && ('' + locans).indexOf(',') == -1 && yourtzlist.indexOf('/' + ('' + locans.trim()).replace(/\ /g,'_') + '<') != -1) { // code logic here }

... modifications, so that ...


var yourtzlist="<option value=\"GMT\" data-geo=\"51.4934,0.0098,GMT,GB,+0\">GMT</option><option value=\"Africa/Abidjan\" data-geo=\"5.31666,-4.03334,GMT,CI,+0\">Africa/Abidjan</option> ... blah blah blah ...";
var eventualyourtzlist=yourtzlist; // is appended with non TimeZone entries found, that follow ...
var realtz=true;

function retyour(propis) {
if (!realtz) {
return eventualyourtzlist;
}
return yourtzlist;
}

function yourtzlistindexOf(proposedplace) {
if (yourtzlist.indexOf(proposedplace) != -1) {
realtz=true;
return yourtzlist.indexOf(proposedplace);
} else if (eventualyourtzlist.indexOf(proposedplace) != -1) {
realtz=false;
return eventualyourtzlist.indexOf(proposedplace);
} else {
realtz=true;
}
return yourtzlist.indexOf(proposedplace);
}

... can help out.


Previous relevant Earth Scanner Itinerary Collaboration Tutorial is shown below.

Earth Scanner Itinerary Collaboration Tutorial

Earth Scanner Itinerary Collaboration Tutorial

It might be just us, but around here, we give ourselves a "leave pass", talking about ...

  • sharing ... much more than ...
  • collaborating

... because we see collaboration, as much to do with at least two parties being able to adjust a "thaing", whatever that may be, and we see sharing as maybe that, but also could be just edicts from above, broadcast out, with no meaningful active input from the people being sent the communication. And you see, this all comes about, because, as programmers, it's much easier to code for sharing ... it makes us look good?!

Up to yesterday, we would have to classify our efforts with our latest Earth Scanner project, in the realms of "Trip Itinerary" communications, as just being sharing, but where we said, yesterday ...

Well, it means a person travelling, could share their itinerary with someone, or have a collaborator fill in the gaps perhaps, and the context of it all can be shown on an interactive map.

... that "perhaps" was all there was, really, yesterday. But, today, we've had time to think of ways forward, and realized ...

  • off plotted (perhaps TimeZone) places ... we could add ...
  • revealed (ie. details/summary based) ...
    1. trip leg from annotation
    2. this place annotation
    3. trip leg to annotation

    ... textarea element(s) at which a collaborator becomes capable of adding itinerary detail and/or changing itinerary detail ...

    function panno(bec, idx) {
    if (plotanno[idx] != bec.replace(/\`/g, '"')) {
    plotanno[idx]=bec.replace(/\`/g, '"').replace(/\{/g, '[').replace(/\}/g, ']');
    newhashit();
    }
    }

    function lganno(bec, idx) {
    if (legsanno[idx] != bec.replace(/\`/g, '"')) {
    legsanno[idx]=bec.replace(/\`/g, '"').replace(/\{/g, '[').replace(/\}/g, ']');
    newhashit();
    }
    }

    function doplotplace(ipl, maybeg) {
    var jpl=0, detbegin='', detend='', nearend='', textras='', legend='', prelegend='', ileg=0;
    var thisclock='', nonclock='', aclocl='', thatplace='', utzdate=null, tzDate=null, xdiff=0, xdate1=null;
    if (!reveal) {
    detbegin='<details onclick="reveal=!reveal;"><summary></summary>';
    detend='</details>';
    } else {
    detbegin='<details open onclick="reveal=!reveal;"><summary>';
    detend='</summary></details>';
    }
    if (plotcc[ipl].trim() && plottz[ipl].trim() != '') { // && plotplace[ipl].indexOf(':') == -1) {
    //alert(plotplace[ipl]);
    //alert(plotct[ipl]);
    //alert(plotemj[ipl]);
    if (maybeg == 'g') {
    for (ileg=0; ileg<legs.length; ileg++) {
    if (('~' + legs[ileg] + '~').indexOf('~' + ipl + '.') != -1) {
    jpl=eval(('~' + legs[ileg] + '~').split('~' + ipl + '.')[1].split('~')[0]);
    legend+='<details onclick="event.stopPropagation();" title="Annotations for Leg from ' + plotplace[ipl].replace(/\_/g,' ') + ' ' + orflag(plotcc[ipl]) + ' to ' + plotplace[jpl].replace(/\_/g,' ') + ' ' + orflag(plotcc[jpl]) + ' ..."><summary class=lanno> --> ' + plotplace[jpl].replace(/\_/g,' ') + ' ' + orflag(plotcc[jpl]) + '</summary><textarea class=txleg onclick="event.stopPropagation();" rows=9 cols=40 onblur="lganno(this.value,' + ileg + ');">' + legsanno[ileg].replace(/\"/g,'`') + '</textarea></details>';
    }
    if (('~' + legs[ileg] + '~').indexOf('.' + ipl + '~') != -1) {
    jpl=eval(('~' + legs[ileg] + '~').split('.' + ipl + '~')[0].split('~')[1]);
    prelegend+='<details onclick="event.stopPropagation();" title="Annotations for Leg from ' + plotplace[jpl].replace(/\_/g,' ') + ' ' + orflag(plotcc[jpl]) + ' to ' + plotplace[ipl].replace(/\_/g,' ') + ' ' + orflag(plotcc[ipl]) + ' ..."><summary class=lanno>' + plotplace[jpl].replace(/\_/g,' ') + ' ' + orflag(plotcc[jpl]) + ' --></summary><textarea class=txleg onclick="event.stopPropagation();" rows=9 cols=40 onblur="lganno(this.value,' + ileg + ');">' + legsanno[ileg].replace(/\"/g,'`') + '</textarea></details>';
    }
    }
    if (bmeridian.indexOf(' id="div' + plotlong[ipl] + plotlat[ipl] + '"') != -1) {
    textras=bmeridian.split(' id="div' + plotlong[ipl] + plotlat[ipl] + '"')[1].split('>')[0].replace(/\"$/g, String.fromCharCode(10) + plotanno[ipl].replace(/\"/g,'`') + '"');
    } else {
    textras=' title="' + plotanno[ipl].replace(/\"/g,'`') + '"';
    }
    nearend='<div id="div' + plotlong[ipl] + plotlat[ipl] + '"' + textras + '>' + prelegend + '<details onclick="event.stopPropagation();" title="Annotations for ' + plotplace[ipl].replace(/\_/g,' ') + ' ' + orflag(plotcc[ipl]) + ' ..."><summary class=panno>&#128395;</summary><textarea class=txplc onclick="event.stopPropagation();" rows=9 cols=40 onblur="panno(this.value,' + ipl + ');">' + plotanno[ipl].replace(/\"/g,'`') + '</textarea></details>' + legend + '</div>';

    thatplace=plottz[ipl];
    utzdate=new Date();
    tzDate = new Date(utzdate.toLocaleString('en-US', { timeZone: thatplace.replace('GMT','UTC').replace(/\ /g,'_') }));
    xdiff = Math.abs(tzDate.getTime() - gutcDate.getTime()) / 3600000;
    xdate1=new Date().toLocaleString("en-US", { timeZone: thatplace.replace('GMT','UTC').replace(/\ /g,'_') });
    if (xdiff > 0 && (eval('' + utzdate.getDay()) == 0 && eval('' + tzDate.getDay()) == 6 || eval('' + utzdate.getDay()) > eval('' + tzDate.getDay()))) {
    xdiff=-xdiff;
    }
    xextraemj=',' + clockit('' + xdiff);
    plotct[ipl]=('' + xdate1);
    plotemj[ipl]=(clockit('' + xdiff));
    }
    if (plotemj[ipl].indexOf('pm') != -1) {
    aclock=plotemj[ipl].split('pm')[0];
    nonclock=plotemj[ipl].split(aclock)[1];
    thisclock='<span class=pm>' + aclock + '</span>';
    return plotplace[ipl] + ' ' + orflag(plotcc[ipl]) + detbegin + '<br>' + plotct[ipl] + '<br>' + thisclock + nonclock + nearend + detend;
    }
    return plotplace[ipl] + ' ' + orflag(plotcc[ipl]) + detbegin + '<br>' + plotct[ipl] + '<br>' + plotemj[ipl] + nearend + detend;
    }
    return plotplace[ipl];
    }

    ... (happily now not needing to know the "behind the scenes" delimitation is {} ... in fact we map to [] here if a user uses these characters in a textarea element) ... then ...

  • resend to other collaborator the ideas for further collaborations the other way around ... purrrrrrrrrhaps?

... improving on yesterday's Earth Scanner Sharing Itinerary Detail Tutorial with our latest eleventh draft (dedicated to "Legs XI") Earth Scanner web application, we hope.


Previous relevant Earth Scanner Sharing Itinerary Detail Tutorial is shown below.

Earth Scanner Sharing Itinerary Detail Tutorial

Earth Scanner Sharing Itinerary Detail Tutorial

Further to yesterday's Earth Scanner Sharing Tutorial, today, we were ...

  • more than half expecting that for web browsers where navigator.canShare comes up with true (eg. Safari), supporting the Web Share API on a https:// protocol, we'd be saying for our tests involving faux itineraries (with much more than a thousand characters) being processed via a ...

    Have most of the data be stored in the hash part of the "URL"

    ... approach, that it worked back with our latest tenth draft Earth Scanner web application incarnation, but ...

  • we weren't expecting to be saying that web browsers where navigator.canShare comes up with false (eg. Google Chrome), not supporting the Web Share API, we'd be saying for our tests involving faux itineraries (with much more than a thousand characters) being processed via a ...

    Have most of the data be stored in the hash part of the "URL"

    ... approach, that it worked back with our latest Earth Scanner incarnation, but it did!

The thing to note is that the data should be hashtagged, rather than formed into ? and & "get" arguments which end up with a web server somewhere. This also means a serverside language, such as PHP (where we'd often be involving HTML form method=POST scenarios by now), may never be needed with this Earth Scanner project we are currently engaged in, and we do prefer to talk just HTML and Javascript and CSS to be able to share code with more readers out there. Hashtagging is purely client side work. Guess we'd never tried any "a" "mailto:" URLs of huge length, mainly taken up by hashtagging data?! Anyway, we are very pleased, and still think the Web Share API logic is worth keeping in, because of all the sharing options other than email presented, when this API is in full swing.

And what is the point here? Well, it means a person travelling, could share their itinerary with someone, or have a collaborator fill in the gaps perhaps, and the context of it all can be shown on an interactive map. They could base a trip leg on the paradigm (using the Earth Scanner click prompt window) ...

TimezonePlaceFrom{eg. accomodation details, dates of stay, meeting details}-{eg. flight or road or rail or walking or sailing trip details, timezone issues}TimezonePlaceTo{eg. accomodation details, dates of stay, meeting details}

... model, where {} are the Earth Scanner's annotation delimiters (we'd really like you to avoid within your annotations). So far?!

Stop Press

As Hunters and Collectors asked ...

Do you see what I see?

... well, this is what we saw making today's tutorial's animated GIF presentation ... and so ... Do you see what I see?


Previous relevant Earth Scanner Sharing Tutorial is shown below.

Earth Scanner Sharing Tutorial

Earth Scanner Sharing Tutorial

Another day, another API interfacing with our Earth Scanner web application from yesterday's Earth Scanner Window Focus Tutorial.

This time around, it is the turn of Web Share API to help us with our aim to introduce some ...

  • email ... and/or ...
  • SMS

... sharing logic into play. When "sharing" is talked about at this blog, we do not always resort to interfacing to the Web Share API. Even so, when it works, this Web Share API works very usefully, but does not work everywhere. So why the interest today, even so? Well, we have more testing to know for sure, so that answer will be for tomorrow.

Where navigator.canShare comes up with false we fall through to the usual ...

  • email via "a" "mailto:" link usage ... and/or ...
  • SMS via "a" "sms:" link usage

... methodologies, feeding off the {} delimited annotations the user can now apply behind ...

  • placenames (best with timezone places)
  • leg delimiters ... to or - or from

... you can see us using in today's animated GIF presentation. Why not just use this methodology everywhere? Well, we have more testing to know for sure, so that answer will be for tomorrow.

Reading this, feel free to try our changed ninth draft Earth Scanner web application, it now having a new "create a hashtag part to the email/SMS URL" (taking into account the newly populated plotanno[] and legsanno[] arrays) function, as per ...


function newhashit() {
var newh='#', legi=0, interim='';
if (document.getElementById('sdurl')) {
var washash='';
if (document.getElementById('sdurl').value.indexOf('#') != -1) {
washash='#' + document.getElementById('sdurl').value.split('#')[1];
}
for (var ii=0; ii<plotplace.length; ii++) {
if ((plotplace[ii] + ' ').toUpperCase().substring(0,1) >= 'A' && (plotplace[ii] + ' ').toUpperCase().substring(0,1) <= 'Z') {
if (newh == '#') {
if (plotanno[ii].trim() != '') {
newh+=encodeURIComponent(plotplace[ii].replace(/\ /g,'_').split(',_')[0] + '{' + plotanno[ii] + '}');
} else if (legc.indexOf(',' + eval(-1 + ii) + '.' + eval(0 + ii) + ',') != -1) {
legi=legs.indexOf('' + eval(-1 + ii) + '.' + eval(0 + ii) + '');
if (legi == -1) {
newh+=encodeURIComponent('-') + encodeURIComponent(plotplace[ii].replace(/\ /g,'_').split(',_')[0]);
} else if (legsanno[legi].trim() != '') {
newh+=encodeURIComponent('-{' + legsanno[legi] + '}') + encodeURIComponent(plotplace[ii].replace(/\ /g,'_').split(',_')[0]);
} else {
newh+=encodeURIComponent('-') + encodeURIComponent(plotplace[ii].replace(/\ /g,'_').split(',_')[0]);
}
} else {
newh+=encodeURIComponent(',') + encodeURIComponent(plotplace[ii].replace(/\ /g,'_').split(',_')[0]);
}
} else if (plotplace[ii].trim() != '') {
interim=encodeURIComponent(plotplace[ii].replace(/\ /g,'_').split(',_')[0]);
if (plotanno[ii].trim() != '') {
interim=encodeURIComponent(plotplace[ii].replace(/\ /g,'_').split(',_')[0] + '{' + plotanno[ii] + '}');
}
if (legc.indexOf(',' + eval(-1 + ii) + '.' + eval(0 + ii) + ',') != -1) {
legi=legs.indexOf('' + eval(-1 + ii) + '.' + eval(0 + ii) + '');
if (legi == -1) {
newh+=encodeURIComponent('-') + interim;
} else if (legsanno[legi].trim() != '') {
newh+=encodeURIComponent('-{' + legsanno[legi] + '}') + interim;
} else {
newh+=encodeURIComponent('-') + interim;
}
} else {
newh+=encodeURIComponent(',') + interim;
}
}
}
}
if (newh != lasthcalc && newh != '#' && newh != washash) {
document.getElementById('sdurl').value=document.getElementById('sdurl').value.split('#')[0] + '#' + newh.substring(1).replace(/^\%2C/g,'');
lasthcalc=newh;
}
}
}

... and helped out by ...


Previous relevant Earth Scanner Window Focus Tutorial is shown below.

Earth Scanner Window Focus Tutorial

Earth Scanner Window Focus Tutorial

The Page Visibility API has opened up possibilities from within Javascript, to monitor the toing and froing to and/or from your web applications in the modern web browsers. We think the Earth Scanner web application of yesterday's Making of Earth Scanner Legs Tutorial could benefit from some Page Visibility API Javascript logic, and where we tend to inform the user is with ...

  • document.title (as displayed on the web browser tab, of relevance) ... showing ...
  • Page Visibility API findings ... perhaps involving ...
  • date timestamps

And how, practically, in our changed eighth draft Earth Scanner web application, did we act should we make the discovery, with this Page Visibility API code ...


var firstopn=true;
var gmovesallowed=movesallowed, gfive=five;
var playing=false, restart=false;

function myFunction(opening) {
if (opening) {
document.body.style.backgroundColor='lightgreen';
if (!playing && restart) {
//document.title='Restarting video play at ' + document.URL + ' at ' + ('' + new Date()) + '.';
if (firstopn && eval('' + plotplace.length) > 0) {
if (plotplace[eval(-1 + plotplace.length)].trim() != '') {
lastdtplace='' + plotplace[eval(-1 + plotplace.length)];
document.title='' + plotplace[eval(-1 + plotplace.length)] + ' ... ';
}
}
movesallowed=gmovesallowed; five=gfive; //document.getElementById('main-video').play();
playing=true;
} else {
//alert('2:' + document.title);
movesallowed=gmovesallowed; five=gfive; //document.getElementById('main-video').play();
document.title=(document.title + ' ... ').split(' ... ')[0] + ' ... ' + 'Welcome back to Earth Scanner at ' + ('' + new Date()) + '.';
}
restart=false;
} else {
document.body.style.backgroundColor='yellow';
if (playing) {
movesallowed=false; five=0; // document.getElementById('main-video').pause();
playing=false;
restart=true;
document.title=(document.title + ' ... ').split(' ... ')[0] + ' ... ' + 'Paused Earth Scanner at ' + ('' + new Date()) + '.';
} else {
//alert('0:' + document.title);
movesallowed=false; five=0; // document.getElementById('main-video').pause();
document.title=(document.title + ' ... ').split(' ... ')[0] + ' ... ' + 'You left Earth Scanner at ' + ('' + new Date()) + '.';
}
}
//alert(0);
firstopn=false;
}

function myCloseFunction() {
if (document.visibilityState === "hidden") {
if (playing) {
movesallowed=false; five=0; // document.getElementById('main-video').pause();
playing=false;
restart=true;
document.title=(document.title + ' ... ').split(' ... ')[0] + ' ... ' + 'Paused Earth Scanner at ' + ('' + new Date()) + '.';
} else {
//alert('1:' + document.title);
movesallowed=false; five=0; // document.getElementById('main-video').pause();
document.title=(document.title + ' ... ').split(' ... ')[0] + ' ... ' + 'You Left Earth Scanner at ' + ('' + new Date()) + '.';
}
document.body.style.backgroundColor='yellow';
} else {
myFunction(true);
}
}


//
// and down after the document.write() ... remember "no body" ... sort of "just javascript" ...
//
document.onvisibilitychange = function() {
if (document.visibilityState === "hidden") {
document.title=(document.title + ' ... ').split(' ... ')[0] + ' ... ' + 'You Left ' + document.URL + ' At ' + ('' + new Date()) + '.'
document.body.style.backgroundColor='yellow';
if (playing) {
movesallowed=false; five=0; // document.getElementById('main-video').pause();
playing=false;
restart=true;
document.title=(document.title + ' ... ').split(' ... ')[0] + ' ... ' + 'Paused URL at ' + document.URL + ' at ' + ('' + new Date()) + '.';
} else {
movesallowed=false; five=0; // document.getElementById('main-video').pause();
document.title=(document.title + ' ... ').split(' ... ')[0] + ' ... ' + 'You Left ' + document.URL + ' At ' + ('' + new Date()) + '.';
}
} else {
myFunction(true);
}
};

document.onpagehide = function() {
if (document.visibilityState === "hidden") {
document.title=(document.title + ' ... ').split(' ... ')[0] + ' ... ' + 'You Left Earth Scanner at ' + ('' + new Date()) + '.';
document.body.style.backgroundColor='yellow';
if (playing) {
movesallowed=false; five=0; // document.getElementById('main-video').pause();
playing=false;
restart=true;
document.title=(document.title + ' ... ').split(' ... ')[0] + ' ... ' + 'Paused Earth Scanner at ' + ('' + new Date()) + '.';
}
movesallowed=false; five=0; // document.getElementById('main-video').pause();
} else {
myFunction(true);
}
};

document.body.onvisibilityChange=function() { myCloseFunction(); };
document.body.onpageHide=function() { myFunction(false); };
document.body.onpageShow=function() { myFunction(true); };

... that a user has been distracted from the unmissable moments of Earth Scanner usage , heaven forbid? We try to slow it down, so that when they come back , praise be, things have not moved on to irrelevance, as often.

If all this sounds familiar, perhaps you were reading Applying Onpageshow and Onpagehide and Onvisibilitychange Events Tutorial when we were last talking about this excellent feature, when we were applying it to the playing or pausing of videos. Of particular relevance might be ...

  1. onpageshow (at same time as document.body onload event) … opening … versus … closing …
  2. onpagehide (we had little success with this event) … and we had more success with …
  3. onvisibilitychange (in conjunction with document.visibilityState === “hidden” we succeeded)


Previous relevant Making of Earth Scanner Legs Tutorial is shown below.

Making of Earth Scanner Legs Tutorial

Making of Earth Scanner Legs Tutorial

Quite often within the I.T. wooooorrrrrllllddd it is when we have an idea that is ...

Just a Bit of Fun

... more than likely ...

  1. this is code for ... it will end up being difficult to achieve ... and in that same way ...
  2. often you'll learn a lot trying to make it happen

What we wanted regarding yesterday's Earth Scanner Legs Tutorial blog posting initial draft, where we had ...


New York-Los Angeles

... in HTML code ...


<code><a target=_blank id=ahash style='display:inline-block;' href="https://www.rjmprogramming.com.au/HTMLCSS/earth_scanner.html#New%20York-Los%20Angeles">New York-Los Angeles</a></code>

... we really wanted to prefix some content that ...

  • showed as ... #
  • on hover showed ... 🎶 ... for the heads up that a click might play ...
  • Patsy Gallant's From New York to LA via YouTube ... initially envisaging just audio ... but the Google Chrome web browser, at least (while others are good too) is far better than this ...

We expected mobile might be different, and yes, we achieved less here, but we could open a popup the user can click a play button regarding. With non-mobile, if your browser allows the "autoplay" feature for the "rjmprogramming.com.au" domain, you only need to click the "#" link to hear Patsy sing the song once over. But there's more with Google Chrome, at least, supplying a "right of address bar" up the top "musical notes" button leading to ...

  • usual video and/or audio media controls ...
  • "In Picture" playing of the YouTube video behind the audio ... and/or ...
  • "Live Captions" for that "Karaoke Feel"

... and so, that was all a pleasant surprise for us, because, of course, there were "Internal Use Only" issues. We'd not noticed a "Mixed Content" call we were making in amongst our "YouTube Video Interfacing Karaoke Style Play" web application code in the changed stop_start_youtube.html helper of the changed karaoke_youtube_api.htm inhouse YouTube video interfacer, and we needed to add in logic for the use of a new "justaudio" argument.

That's one part of the equation, and the other was back at the blog posting "code" element coding, as below, where its HTML innards became ...


<code><span id=shash data-cp=127926 onmouseover="if (this.title == 'Might play music ...') { this.title=String.fromCodePoint(127926); setInterval(function() { if (document.getElementById('shash').innerHTML.indexOf('<') == -1) { if (eval('' + event.target.getAttribute('data-cp')) == 35) { document.getElementById('shash').innerHTML=String.fromCharCode(eval('' + document.getElementById('shash').getAttribute('data-cp'))); document.getElementById('shash').setAttribute('data-cp','127926'); } else { document.getElementById('shash').innerHTML=String.fromCodePoint(eval('' + document.getElementById('shash').getAttribute('data-cp'))); document.getElementById('shash').setAttribute('data-cp','35'); } } }, 5000); }" title='Might play music ...' style=display:inline-block;cursor:pointer;text-decoration:underline; onclick="this.innerHTML+='<iframe style=display:inline-block;width:50px;height:50px;display:none; src=//www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?justaudio=%23&youtubeid=kUI_P5eMVLo&youtube_duration=&email=&emoji=on>#</iframe>'; if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { document.getElementById('ahash').click(); window.open('//www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?youtubeid=kUI_P5eMVLo&youtube_duration=202.221&email=&email=&emoji=on&c0=on&i0=0&j0=202.221&i1=&j1=&i2=&j2=&i3=&j3=&i4=&j4=&i5=&j5=&i6=&j6=&i7=&j7=&i8=&j8=&i9=&j9=&i10=&j10=&i11=&j11=&i12=&j12=&i13=&j13=&i14=&j14=&i15=&j15=&i16=&j16=&i17=&j17=&i18=&j18=&i19=&j19=&i20=&j20=&i21=&j21=&i22=&j22=&i23=&j23=&i24=&j24=&i25=&j25=&i26=&j26=&i27=&j27=&i28=&j28=&i29=&j29=','_blank','top=50,left=50,width=800,height=800'); } ">#</span><a target=_blank id=ahash style='display:inline-block;' href="https://www.rjmprogramming.com.au/HTMLCSS/earth_scanner.html#New%20York-Los%20Angeles">New York-Los Angeles</a>
</code>

Happy listening ... etcetera, etcetera, etcetera!


Previous relevant Earth Scanner Legs Tutorial is shown below.

Earth Scanner Legs Tutorial

Earth Scanner Legs Tutorial

Of course, yes, there's a part of me that hoped today's tutorial in its thread of related blog postings, would line up with the 11th draft of our Earth Scanner web application of yesterday's Earth Scanner Hashtag Lists Tutorial, and then we could have made some lame joke about "Legs 11", but we've grown up a lot since then, and even some reference to "Legs XI" can't quite bring us around. Enjoy the sobriety (until the 11th draft, that is)?!

So, the "legs" we're referring to today are like a ...

Trip Leg

... a concept of interest to lots of people. Most of us make trips every day, and in our Earth Scanning web application we harness the great Google Directions link to make suggestions about how you might undertake your trip leg. It's a simple case of replacing any commas in your (perhaps timezone) list with minus sign(s) to start seeing trip legs, such as ...

#New York-Los Angeles

... either at the Javascript prompt window or with the address bar hashtag arrangements, which might end up calling ...


function plotleg(thisleg, smlong, lglat, lglong, smlat) {
var brgtoset=0.0, disttoset=0.0, gbrgtoset=0.0, gdisttoset=0.0;
if (1 == 1) {
disttoset=Math.sqrt((eval(0 + eval(eval('' + plotlong[eval(thisleg.split('.')[0])]) - smlong) / eval(lglong - smlong) * eval(screenwidth)) - eval(0 + eval(eval('' + plotlong[eval(thisleg.split('.')[1])]) - smlong) / eval(lglong - smlong) * eval(screenwidth))) * (eval(0 + eval(eval('' + plotlong[eval(thisleg.split('.')[0])]) - smlong) / eval(lglong - smlong) * eval(screenwidth)) - eval(0 + eval(eval('' + plotlong[eval(thisleg.split('.')[1])]) - smlong) / eval(lglong - smlong) * eval(screenwidth))) + (eval(0 + eval(eval(lglat - eval('' + plotlat[eval(thisleg.split('.')[0])])) / eval(lglat - smlat) * eval(screenheight))) - eval(0 + eval(eval(lglat - eval('' + plotlat[eval(thisleg.split('.')[1])])) / eval(lglat - smlat) * eval(screenheight)))) * (eval(0 + eval(eval(lglat - eval('' + plotlat[eval(thisleg.split('.')[0])])) / eval(lglat - smlat) * eval(screenheight))) - eval(0 + eval(eval(lglat - eval('' + plotlat[eval(thisleg.split('.')[1])])) / eval(lglat - smlat) * eval(screenheight)))));
}
gdisttoset=great_circle_distance(plotlat[eval(thisleg.split('.')[0])], plotlong[eval(thisleg.split('.')[0])], plotlat[eval(thisleg.split('.')[1])], plotlong[eval(thisleg.split('.')[1])]);
gdisttoset=great_circle_distance(plotlat[eval(thisleg.split('.')[0])], plotlong[eval(thisleg.split('.')[0])], plotlat[eval(thisleg.split('.')[1])], plotlong[eval(thisleg.split('.')[1])]);
var meanlong=eval(0 + eval(eval('' + plotlong[eval(thisleg.split('.')[0])]) - smlong) / eval(lglong - smlong) * eval(screenwidth));
var meanlat=eval(0 + eval(eval(lglat - eval('' + plotlat[eval(thisleg.split('.')[0])])) / eval(lglat - smlat) * eval(screenheight)));
brgtoset=Math.atan2(eval(0 + eval(eval(lglat - eval('' + plotlat[eval(thisleg.split('.')[1])])) / eval(lglat - smlat) * eval(screenheight))) - meanlat, eval(0 + eval(eval('' + plotlong[eval(thisleg.split('.')[1])]) - smlong) / eval(lglong - smlong) * eval(screenwidth)) - meanlong) * 180 / Math.PI;
meanlong+=eval(0 + eval(eval('' + plotlong[eval(thisleg.split('.')[1])]) - smlong) / eval(lglong - smlong) * eval(screenwidth))
meanlong/=2.0;
meanlat+=eval(0 + eval(eval(lglat - eval('' + plotlat[eval(thisleg.split('.')[1])])) / eval(lglat - smlat) * eval(screenheight)));
meanlat/=2.0;
console.log(thisleg + ' ' + brgtoset + ' ' + thisleg + ' ... ' + plotlat[eval(thisleg.split('.')[0])] + ',' + plotlong[eval(thisleg.split('.')[0])] + ' to ' + plotlat[eval(thisleg.split('.')[1])] + ',' + plotlong[eval(thisleg.split('.')[1])]);
bmeridian+='<hr onclick="event.stopPropagation(); canlooknow=false; clearwo(); wo=window.open(' + "'//www.google.com/maps/dir/" + encodeURIComponent(plotplace[eval(thisleg.split('.')[0])]) + '/' + encodeURIComponent(plotplace[eval(thisleg.split('.')[1])]) + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; " ondblclick="event.stopPropagation(); canlooknow=false; clearwo(); wo=window.open(' + "'//www.google.com/maps/dir/" + plotlat[eval(thisleg.split('.')[0])] + ',' + plotlong[eval(thisleg.split('.')[0])] + '/' + plotlat[eval(thisleg.split('.')[1])] + ',' + plotlong[eval(thisleg.split('.')[1])] + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; " title="' + plotplace[eval(thisleg.split('.')[0])] + ' to ' + plotplace[eval(thisleg.split('.')[1])] + ' has the crow flying (' + gbrgtoset + ' degrees setting off at versus on Mercator Projection ...) ' + eval(eval(brgtoset + 450) % 360) + ' degrees for ' + eval(gdisttoset / 1000.0) + ' kilometers. Click (for placename) or double click (for geographicals) to open a Google Directions window." class=leg style="transform:rotate(' + eval(eval('' + brgtoset) - 0) + 'deg);z-index:975;opacity:0.3;position:fixed;top:' +
meanlat +
'px;left:' +
eval(meanlong - disttoset / 2) +
'px;background-color:rgba(255,0,0,0.5);width:' + disttoset + 'px;height:6px;"></hr><span onclick="event.stopPropagation(); canlooknow=false; clearwo(); wo=window.open(' + "'//www.google.com/maps/dir/" + encodeURIComponent(plotplace[eval(thisleg.split('.')[0])]) + '/' + encodeURIComponent(plotplace[eval(thisleg.split('.')[1])]) + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; " ondblclick="event.stopPropagation(); canlooknow=false; clearwo(); wo=window.open(' + "'//www.google.com/maps/dir/" + plotlat[eval(thisleg.split('.')[0])] + ',' + plotlong[eval(thisleg.split('.')[0])] + '/' + plotlat[eval(thisleg.split('.')[1])] + ',' + plotlong[eval(thisleg.split('.')[1])] + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; " title="' + plotplace[eval(thisleg.split('.')[0])] + ' to ' + plotplace[eval(thisleg.split('.')[1])] + ' has the crow flying (' + gbrgtoset + ' degrees setting off at versus on Mercator Projection ...) ' + eval(eval(360 - brgtoset) % 360) + ' degrees for ' + eval(gdisttoset / 1000.0) + ' kilometers. Click (for placename) or double click (for geographicals) to open a Google Directions window." class=leg style="cursor:pointer;font-size:6px;z-index:976;margin-top:6px;margin-left:-6px;position:fixed;top:' + meanlat + 'px;left:' + meanlong + 'px;">&#129517;</span>';
if (ofive == fivethousand) {
fivethousand*=10;
setTimeout(callintoplay, 5000);
}

}

... and putting this into play we realized we should slow down animations to give users a chance to consider whether they want to "drill down" into finding out more about the "trip legs" as user defined.

This happens in our changed seventh (boo hoo) draft Earth Scanner web application.


Previous relevant Earth Scanner Hashtag Lists Tutorial is shown below.

Earth Scanner Hashtag Lists Tutorial

Earth Scanner Hashtag Lists Tutorial

Before yesterday's Earth Scanner TimeZone Tutorial, when we presented Earth Scanner Places Tutorial we intimated with ...

... and into the future we have another idea regarding how this operates.

... that we might offer another way for the driver of our latest Earth Scanner web application ...

  • not only depend on a webpage click event Javascript prompt window means by which to control proceedings, including newly coded for comma separated list logic support ... but, also, as of today, after proving it could work (because we can't remember ever depending this much on a "hashtag on the address bar" arrangement, in the past, before) ...
  • but also allow similar functionality using hashtags on the address bar of the web browser, and able to be changed dynamically (ie. in real time) by the user, as required ...

    if (prevhash != decodeURIComponent(('' + location.hash).replace(/^null$/g,'').replace(/^undefined$/g,'').replace(/^\#/g,''))) {
    thishash=decodeURIComponent(('' + location.hash).replace(/^null$/g,'').replace(/^undefined$/g,'').replace(/^\#/g,'')); //.trim();
    for (var iop=0; iop<plotplace.length; iop++) {
    thishash=thishash.replace(plotplace[iop], '');
    }
    var thishs=thishash.replace(/\ to\ /g,',').trim().split(',');
    if (thishs[0].trim() != '') {
    for (var ipo=0; ipo<thishs.length; ipo++) {
    if (newlist == '') {
    nlist=thishs[ipo].replace(/\+/g,'').trim(); //.trim();
    newlist=thishs[ipo].replace(/\+/g,''); //.trim();
    prefnew=thishs[ipo].replace(/\+/g,' ').split(nlist)[0];
    if (eval(1 + ipo) == eval('' + thishs.length) && thishs[ipo].replace(/\+/g,' ') != (prefnew + newlist)) {
    //alert(98);
    suffnew=thishs[ipo].replace(/\+/g,' ').split(newlist)[1];
    }
    } else {
    nlist=thishs[ipo].replace(/\+/g,'').trim(); //.trim();
    newlist+=',' + nlist; //.trim();
    if (eval(1 + ipo) == eval('' + thishs.length) && thishs[ipo].replace(/\+/g,' ') != nlist) {
    suffnew=thishs[ipo].replace(/\+/g,' ').split(nlist)[1];
    }
    }
    }
    }
    prevhash=decodeURIComponent(('' + location.hash).replace(/^null$/g,'').replace(/^undefined$/g,'').replace(/^\#/g,'')); //.trim();
    if (newlist != '') {
    //alert('newlist=' + newlist + '|');
    gdefv=prefnew + newlist + suffnew;
    //alert(gdefv + '!');
    if (1 == 1) {
    askfor=gdefv;
    if (1 == 7 && ('' + askfor).replace('(','').replace(')','').replace('[','').replace(']','').indexOf(',') != -1) {
    ameridian='';
    acircleoflatitude='';
    enforcedlong=false;
    enforcedxp=-999;
    }
    document.getElementById('myimg').click();
    gdefv='';
    setTimeout(scmove, fivethousand);
    return null;
    } else {
    ourprompt(null,'Earth Scanner - RJM Programming - February, 2024 ... ' + String.fromCharCode(10) + 'Thanks to https://github.com/nvkelso/natural-earth-raster/blob/master/50m_rasters/HYP_50M_SR_W/HYP_50M_SR_W.README.html ... ' + String.fromCharCode(10) + 'Currently top left of screen is (Longitude,Latitude) ' + '(' + eval(-180 + xp * 360 / 100) + ',' + eval(90 - yp * 180 / 100) + ') and bottom right is (' + eval(-180 + screenlong + xp * 360 / 100) + ',' + eval(90 - screenlat - yp * 180 / 100) + ') and around the middle is (' + eval(-180 + eval(screenlong / 2) + xp * 360 / 100) + ',' + eval(90 - eval(screenlat / 2) - yp * 180 / 100) + ').' + String.fromCharCode(10) + 'Where do you want middle of screen to be in terms of Longitude,Latitude? Suffix with space to show meridians and/or prefix with space to not show meridians.', newlist);
    }
    }
    }

And we did find this an easy way to build up a sizeable number of plotted places, in quick time, entered as ...

  • the "P" and "N' and "A" and "C" shortcuts (near to where the user clicked) ways
  • timezone place name(s)
  • country name(s)
  • country code(s)
  • [longitude,latitude,placename]
  • [longitude,latitude]
  • longitude,latitude,placename
  • longitude,latitude (with some form of mantissa)

... methodologies to end up with at least a pin (📍) emoji plotted, as well as the "longitude,latitude (with no form of mantissa)" way to just move the map to that position with no plotting taking place.

But now that we have a few "data players" in the mix, there'll be users out there that do not want to see it all, perhaps ... and so, now "the blurb" goes, for user entries, in either of these modes of use ...

... at prompt ++ can make delay between snapshots slower and -- can make delay between snapshots faster
... at prompt > can hide any time related information else < reveals it again
... comma lists of TimeZone places and/or Country Codes (2 letter) and/or Country Names can be plotted via click or via hashtag usage up at address bar
... suffix with space to show meridians and/or prefix with space to not show meridians

... in our changed sixth draft Earth Scanner web application.


Previous relevant Earth Scanner TimeZone Tutorial is shown below.

Earth Scanner TimeZone Tutorial

Earth Scanner TimeZone Tutorial

Take a look at the word ...

TimeZone

... as a concept newly introduced into the Earth Scanner web application workings, as explained in yesterday's Earth Scanner Places Tutorial.

It's got a "where" word part "Zone" fitting in with our "where of life" ideas up to now, but it also has got "Time" as a new "when of life" word part of the whole idea of TimeZones we'd like to start exploring today. Yes, TimeZones are very useful to have "where" meet "when" ... the Opera Bar would be nice, we think.

We now have ...


function ourprompt(e, blurb, defv) {
var locans=null, ijk=0, extras='',thatplace='', utzdate, tzDate, xdate1, xextratztime, xextraemj, xdiff;
if (eval(uc_iso_country_codes.length) == 0) {
for (ijk=0; ijk<iso_country_codes.length; ijk++) {
uc_iso_country_codes.push(iso_country_codes[ijk].toUpperCase());
}
}
e = e || window.event;
e.preventDefault();
if (e.touches) {
if (e.touches[0].pageX) {
xinxy.push(eval(e.touches[0].pageX + document.body.scrollLeft * 0) * 1);
yinxy.push(eval(e.touches[0].pageY + document.body.scrollTop * 0) * 1);
} else {
xinxy.push(eval(e.touches[0].clientX + document.body.scrollLeft * 0) * 1);
yinxy.push(eval(e.touches[0].clientY + document.body.scrollTop * 0) * 1);
}
} else if (e.clientX || e.clientY) {
xinxy.push(e.clientX + document.body.scrollLeft * 0);
yinxy.push(e.clientY + document.body.scrollTop * 0);
} else {
xinxy.push(e.pageX + document.body.scrollLeft * 0);
yinxy.push(e.pageY + document.body.scrollTop * 0);
}
var llsa=blurb.split(') (')[1];
//alert(blurb + ' ... ' + llsa);
tllg=eval(llsa.split(',')[0]);
tlla=eval(llsa.split(',')[1].split(')')[0]);
brlg=eval(llsa.split('(')[1].split(',')[0]);
brla=eval(llsa.split('(')[1].split(',')[1].split(')')[0]);
thislong=eval(tllg + eval(eval(xinxy[eval(-1 + xinxy.length)] / screenwidth) * eval(screenlong)));
thislat=eval(tlla - eval(eval(yinxy[eval(-1 + yinxy.length)] / screenheight) * eval(screenlat)));
var nearbyfour=retnearest(thislong, thislat);
var aatm='youllneverfindthis';
var bbtm=String.fromCharCode(9);
if (blurb.indexOf('Thanks to ') != -1) {
if (blurb.split('Thanks to ')[1].indexOf(' ...') != -1) {
bbtm='Thanks to ' + blurb.split('Thanks to ')[1].split(' ...')[0] + ' ...';
}
}
if (blurb.indexOf(' and around the middle ') != -1) {
aatm=' and around the middle ' + blurb.split(' and around the middle ')[1].split(')')[0] + ')';
}
var ourblurb=(blurb.replace(bbtm,'').replace('Currently top ','Top ').replace(' in terms of ',' as ').replace(aatm, '').replace(/\ and\ /g,' & ').replace('? ', '? ' + ' Nearest timezone place (via N) is ' + nearbyfour.split('|')[3] + ' at [' + nearbyfour.split('|')[0] + ',' + nearbyfour.split('|')[1] + '] to your clicked (via C) [' + thislong + ',' + thislat + '] ') + bbtm.replace(String.fromCharCode(9),'')).replace(String.fromCharCode(10),' ').replace(String.fromCharCode(10),' ').replace(String.fromCharCode(10),' ').replace(String.fromCharCode(10),' ');
if (prevf.indexOf(',') != -1) {
if (Math.abs(eval(prevf.split(',')[0]) - tllg) <= 0.5) {
prevf='' + prevone + ',' + prevtwo + ',' + prevthree + ',' + prevfour;
}
if (Math.abs(eval(prevf.split(',')[0]) - tllg) > 0.5) {
tllg=eval(prevf.split(',')[0]);
tlla=eval(prevf.split(',')[1]);
brlg=eval(prevf.split(',')[2]);
brla=eval(prevf.split(',')[3]);
var sthislong=eval(tllg + eval(eval(xinxy[eval(-1 + xinxy.length)] / screenwidth) * eval(screenlong)));
var sthislat=eval(tlla - eval(eval(yinxy[eval(-1 + yinxy.length)] / screenheight) * eval(screenlat)));
var snearbyfour=retnearest(sthislong, sthislat);
//alert(ourblurb + ' ' + prevf + ' vs ' + tllg + ' ... ' + Math.abs(eval(prevf.split(',')[0]) - tllg));
ourblurb=ourblurb.replace('? ', '? ' + ' Nearest timezone place (via P) is ' + snearbyfour.split('|')[3] + ' at [' + snearbyfour.split('|')[0] + ',' + snearbyfour.split('|')[1] + '] to your clicked (via A) [' + sthislong + ',' + sthislat + '] ');
}
locans=prompt(ourblurb, defv);
}
if (locans != null) {
if (locans.toUpperCase().trim() == 'N') {
locans=locans.toUpperCase().replace('N', '[' + nearbyfour.split('|')[0] + ',' + nearbyfour.split('|')[1] + ']');
plotplace.push(nearbyfour.split('|')[3]);
plotcc.push(nearbyfour.split('|')[2]);
plotlong.push(nearbyfour.split('|')[0]);
plotlat.push(nearbyfour.split('|')[1]);
if (eval('' + nearbyfour.length) > 4) {

plottz.push(nearbyfour.split('|')[4]);
plotct.push(nearbyfour.split('|')[5]);
plotemj.push(nearbyfour.split('|')[6]);

} else {
plottz.push('');
plotct.push('');
plotemj.push('');
}

} else if (locans.toUpperCase().trim() == 'C') {
thisplace=' ';
locans=locans.toUpperCase().replace('C', '[' + thislong + ',' + thislat + ']');
plotplace.push('');
plotcc.push(nearbyfour.split('|')[2]);
plotlong.push(thislong);
plotlat.push(thislat);
plotct.push('');
plotemj.push('');
plottz.push('');

} else if (locans.toUpperCase().trim() == 'P') {
locans=locans.toUpperCase().replace('P', '[' + snearbyfour.split('|')[0] + ',' + snearbyfour.split('|')[1] + ']');
plotplace.push(snearbyfour.split('|')[3]);
plotcc.push(snearbyfour.split('|')[2]);
plotlong.push(snearbyfour.split('|')[0]);
plotlat.push(snearbyfour.split('|')[1]);
if (eval('' + nearbyfour.length) > 4) {

plottz.push(nearbyfour.split('|')[4]);
plotct.push(nearbyfour.split('|')[5]);
plotemj.push(nearbyfour.split('|')[6]);

} else {
plottz.push('');
plotct.push('');
plotemj.push('');
}

} else if (locans.toUpperCase().trim() == 'A') {
thisplace=' ';
locans=locans.toUpperCase().replace('A', '[' + sthislong + ',' + sthislat + ']');
plotplace.push('');
plotcc.push(snearbyfour.split('|')[2]);
plotlong.push(sthislong);
plotlat.push(sthislat);
plotct.push('');
plotemj.push('');
plottz.push('');

} else if (eval('' + ('' + locans.trim()).length) >= 3 && ('' + locans).indexOf(',') == -1 && yourtzlist.indexOf('/' + ('' + locans.trim()).replace(/\ /g,'_') + '<') != -1) {
thisplace=yourtzlist.split('/' + ('' + locans.trim()).replace(/\ /g,'_') + '<')[0].split(' data-geo="')[eval(-1 + yourtzlist.split('/' + ('' + locans.trim()).replace(/\ /g,'_') + '<')[0].split(' data-geo="').length)];
//alert(thisplace);

udate=new Date();
utcDate = new Date(udate.toLocaleString('en-US', { timeZone: 'UTC' }));

thatplace=thisplace.split('>')[1].split('<')[0].replace('GMT','UTC') + '/' + locans;
//alert(thatplace);
utzdate=new Date();
tzDate = new Date(utzdate.toLocaleString('en-US', { timeZone: thatplace.replace('GMT','UTC').replace(/\ /g,'_') }));
extratz=',' + thatplace; //.split('/')[eval(-1 + iplacesarr[jk].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' ');
xdate1=new Date().toLocaleString("en-US", { timeZone: thatplace.replace('GMT','UTC').replace(/\ /g,'_') });
xextratztime=(',' + xdate1);
plottz.push(thatplace);
thatplace=thatplace.replace('GMT','Europe/London').split('/')[eval(-1 + thatplace.replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' ');
xdiff = Math.abs(tzDate.getTime() - utcDate.getTime()) / 3600000;
xextraemj=',' + clockit('' + xdiff);
plotct.push('' + xdate1);
plotemj.push(clockit('' + xdiff));

plotplace.push(yourtzlist.split(thisplace.split('>')[0] + '>')[1].split('<')[0].replace('GMT','Europe/London').split('/')[eval(-1 + yourtzlist.split(thisplace.split('>')[0] + '>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' '));
plotlong.push((thisplace.split(',')[1]));
plotlat.push((thisplace.split(',')[0]));
plotcc.push(thisplace.split(',')[3]);
if (thisplace.split(',')[3] != '') {
for (ijk=0; ijk<iso_country_codes.length; ijk+=2) {
if (iso_country_codes[ijk].toUpperCase() == thisplace.split(',')[3].toUpperCase()) {
extras=', ' + iso_country_codes[eval(1 + ijk)];
plotplace[eval(-1 + plotplace.length)]+=extras;
extras='';
}
}
}
//alert(extras + ' ... ' + locans);
locans=locans.replace(locans.trim(), '[' + thisplace.split(',')[1] + ',' + thisplace.split(',')[0] + ',' + plotplace[eval(-1 + plotplace.length)] + extras + ']');
//alert(locans);
thisplace=' ';
} else if (eval('' + ('' + locans.trim()).length) >= 3 && ('' + locans).indexOf(',') == -1 && yourtzlist.toUpperCase().indexOf('/' + ('' + locans.trim()).toUpperCase().replace(/\ /g,'_') + '<') != -1) {
thisplace=yourtzlist.toUpperCase().split('/' + ('' + locans.trim()).toUpperCase().replace(/\ /g,'_') + '<')[0].split(' DATA-GEO="')[eval(-1 + yourtzlist.toUpperCase().split('/' + ('' + locans.trim()).toUpperCase().replace(/\ /g,'_') + '<')[0].split(' DATA-GEO="').length)];
//alert(thisplace);
udate=new Date();
utcDate = new Date(udate.toLocaleString('en-US', { timeZone: 'UTC' }));

thatplace=thisplace.split('>')[1].split('<')[0].replace('GMT','UTC') + '/' + locans;
utzdate=new Date();
tzDate = new Date(utzdate.toLocaleString('en-US', { timeZone: thatplace.replace('GMT','UTC').replace(/\ /g,'_') }));
extratz=',' + thatplace; //.split('/')[eval(-1 + iplacesarr[jk].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' ');
xdate1=new Date().toLocaleString("en-US", { timeZone: thatplace.replace('GMT','UTC') });
xextratztime=(',' + xdate1);
plottz.push(thatplace);
thatplace=thatplace.replace('GMT','Europe/London').split('/')[eval(-1 + thatplace.replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' ');
xdiff = Math.abs(tzDate.getTime() - utcDate.getTime()) / 3600000;
xextraemj=',' + clockit('' + xdiff);
plotct.push('' + xdate1);
plotemj.push(clockit('' + xdiff));

plotplace.push(yourtzlist.split(thisplace.split('>')[0] + '>')[1].split('<')[0].replace('GMT','Europe/London').split('/')[eval(-1 + yourtzlist.split(thisplace.split('>')[0] + '>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' '));
plotlong.push((thisplace.split(',')[1]));
plotlat.push((thisplace.split(',')[0]));
plotcc.push(thisplace.split(',')[3]);
if (thisplace.split(',')[3] != '') {
for (ijk=0; ijk<iso_country_codes.length; ijk+=2) {
if (iso_country_codes[ijk].toUpperCase() == thisplace.split(',')[3].toUpperCase()) {
extras=', ' + iso_country_codes[eval(1 + ijk)];
plotplace[eval(-1 + plotplace.length)]+=extras;
extras='';
}
}
}
//alert(extras + ' ... ' + locans);
locans=locans.replace(locans.trim(), '[' + thisplace.split(',')[1] + ',' + thisplace.split(',')[0] + ',' + plotplace[eval(-1 + plotplace.length)] + extras + ']');
//alert(locans);
thisplace=' ';
} else if (eval('' + ('' + locans.trim()).length) == 2 && ('' + locans).indexOf(',') == -1 && yourtzlist.indexOf(',' + ('' + locans.trim()).toUpperCase() + ',') != -1) {
thisplace=yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[0].split(' data-geo="')[eval(-1 + yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[0].split(' data-geo="').length)];

thatplace=yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[1].split('>')[1].split('<')[0].replace('GMT','UTC');
utzdate=new Date();
tzDate = new Date(utzdate.toLocaleString('en-US', { timeZone: thatplace.replace('GMT','UTC').replace(/\ /g,'_') }));
extratz=',' + thatplace; //.split('/')[eval(-1 + iplacesarr[jk].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' ');
xdate1=new Date().toLocaleString("en-US", { timeZone: thatplace.replace('GMT','UTC').replace(/\ /g,'_') });
xextratztime=(',' + xdate1);
plottz.push(thatplace);
thatplace=thatplace.replace('GMT','Europe/London').split('/')[eval(-1 + thatplace.replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' ');
xdiff = Math.abs(tzDate.getTime() - utzdate.getTime()) / 3600000;
xextraemj=',' + clockit('' + xdiff);
plotct.push('' + xdate1);
plotemj.push(clockit('' + xdiff));

plotplace.push(yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[1].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/')[eval(-1 + yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[1].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' '));
plotlong.push((thisplace.split(',')[1]));
plotlat.push((thisplace.split(',')[0]));
plotcc.push(locans.trim());
if (locans != '') {
for (ijk=0; ijk<iso_country_codes.length; ijk+=2) {
if (iso_country_codes[ijk].toUpperCase() == locans.trim().toUpperCase()) {
extras=', ' + iso_country_codes[eval(1 + ijk)];
plotplace[eval(-1 + plotplace.length)]+=extras;
extras='';
}
}
}
locans=locans.replace(locans.trim(), '[' + thisplace.split(',')[1] + ',' + thisplace.split(',')[0] + ',' + plotplace[eval(-1 + plotplace.length)] + extras + ']');
thisplace=' ';
} else if (eval('' + ('' + locans.trim()).length) >= 3 && ('' + locans).indexOf(',') == -1 && iso_country_codes.indexOf(locans.trim()) != -1) {
//alert(iso_country_codes[eval(-1 + eval('' + iso_country_codes.indexOf(locans.trim())))].toUpperCase());
if (yourtzlist.indexOf(',' + ('' + iso_country_codes[eval(-1 + eval('' + iso_country_codes.indexOf(locans.trim())))].toUpperCase()) + ',') != -1) {
locans=locans.replace(locans.trim(), '' + iso_country_codes[eval(-1 + eval('' + iso_country_codes.indexOf(locans.trim())))]);
thisplace=yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[0].split(' data-geo="')[eval(-1 + yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[0].split(' data-geo="').length)];

//alert('thisplace=' + thisplace + ' and thatplace=' + thatplace);
thatplace=yourtzlist.split(thisplace)[1].split('>')[1].split('<')[0].replace('GMT','UTC');
//alert('thisplace=' + thisplace + ' and thatplace=' + thatplace);
utzdate=new Date();
tzDate = new Date(utzdate.toLocaleString('en-US', { timeZone: thatplace.replace('GMT','UTC').replace(/\ /g,'_') }));
extratz=',' + thatplace; //.split('/')[eval(-1 + iplacesarr[jk].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' ');
xdate1=new Date().toLocaleString("en-US", { timeZone: thatplace.replace('GMT','UTC').replace(/\ /g,'_') });
xextratztime=(',' + xdate1);
plottz.push(thatplace);
thatplace=thatplace.replace('GMT','Europe/London').split('/')[eval(-1 + thatplace.replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' ');
xdiff = Math.abs(tzDate.getTime() - utzdate.getTime()) / 3600000;
xextraemj=',' + clockit('' + xdiff);
plotct.push('' + xdate1);
plotemj.push(clockit('' + xdiff));

plotplace.push(yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[1].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/')[eval(-1 + yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[1].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' '));
plotlong.push((thisplace.split(',')[1]));
plotlat.push((thisplace.split(',')[0]));
plotcc.push(locans.trim());
if (locans != '') {
for (ijk=0; ijk<iso_country_codes.length; ijk+=2) {
if (iso_country_codes[ijk].toUpperCase() == locans.trim().toUpperCase()) {
extras=', ' + iso_country_codes[eval(1 + ijk)];
plotplace[eval(-1 + plotplace.length)]+=extras;
extras='';
}
}
}
locans=locans.replace(locans.trim(), '[' + thisplace.split(',')[1] + ',' + thisplace.split(',')[0] + ',' + plotplace[eval(-1 + plotplace.length)] + extras + ']');
thisplace=' ';
} else if (locans.trim() != '' && locans.trim() != locans) {
locans=locans.replace(locans.trim(), '');
} else {
locans=null;
}
} else if (eval('' + ('' + locans.trim()).length) >= 3 && ('' + locans).indexOf(',') == -1 && uc_iso_country_codes.indexOf(locans.trim().toUpperCase()) != -1) {
//alert(iso_country_codes[eval(-1 + eval('' + uc_iso_country_codes.indexOf(locans.trim())))].toUpperCase());
if (yourtzlist.indexOf(',' + iso_country_codes[eval(-1 + uc_iso_country_codes.indexOf(locans.trim().toUpperCase()))].toUpperCase() + ',') != -1) {
locans=locans.replace(locans.trim(), '' + iso_country_codes[eval(-1 + eval('' + uc_iso_country_codes.indexOf(locans.trim().toUpperCase())))]);
thisplace=yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[0].split(' data-geo="')[eval(-1 + yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[0].split(' data-geo="').length)];

thatplace=thisplace.split('>')[1].split('<')[0].replace('GMT','UTC');
utzdate=new Date();
tzDate = new Date(utzdate.toLocaleString('en-US', { timeZone: thatplace.replace('GMT','UTC').replace(/\ /g,'_') }));
extratz=',' + thatplace; //.split('/')[eval(-1 + iplacesarr[jk].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' ');
xdate1=new Date().toLocaleString("en-US", { timeZone: thatplace.replace('GMT','UTC').replace(/\ /g,'_') });
xextratztime=(',' + xdate1);
plottz.push(thatplace);
thatplace=thatplace.replace('GMT','Europe/London').split('/')[eval(-1 + thatplace.replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' ');
xdiff = Math.abs(tzDate.getTime() - utzdate.getTime()) / 3600000;
xextraemj=',' + clockit('' + xdiff);
plotct.push('' + xdate1);
plotemj.push(clockit('' + xdiff));

plotplace.push(yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[1].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/')[eval(-1 + yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[1].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' '));
plotlong.push((thisplace.split(',')[1]));
plotlat.push((thisplace.split(',')[0]));
plotcc.push(locans.trim());
if (locans != '') {
for (ijk=0; ijk<iso_country_codes.length; ijk+=2) {
if (iso_country_codes[ijk].toUpperCase() == locans.trim().toUpperCase()) {
extras=', ' + iso_country_codes[eval(1 + ijk)];
plotplace[eval(-1 + plotplace.length)]+=extras;
extras='';
}
}
}
locans=locans.replace(locans.trim(), '[' + thisplace.split(',')[1] + ',' + thisplace.split(',')[0] + ',' + plotplace[eval(-1 + plotplace.length)] + extras + ']');
thisplace=' ';
} else if (locans.trim() != '' && locans.trim() != locans) {
locans=locans.replace(locans.trim(), '');
} else {
locans=null;
}
} else if (('' + locans).indexOf(',') != -1 && ('' + locans).indexOf('[') != -1) {
thisplace=' ';
if (eval('' + locans.replace('(','').replace(')','').replace('[','').replace(']','').split(',').length) > 2) {
plotplace.push(locans.replace(locans.split(',')[0] + ',' + locans.split(',')[1] + ',', '').replace('(','').replace(')','').replace('[','').replace(']',''));
thisplace=locans.replace(locans.split(',')[0] + ',' + locans.split(',')[1] + ',', '').replace('(','').replace(')','').replace('[','').replace(']','') + ' ';
} else {
plotplace.push('');
}
plotcc.push('');
plotlong.push(locans.replace('(','').replace(')','').replace('[','').replace(']','').split(',')[0]);
plotlat.push(locans.replace('(','').replace(')','').replace('[','').replace(']','').split(',')[1]);
plotct.push('');
plotemj.push('');
plottz.push('');

} else if (('' + locans).indexOf(',') != -1 && ('' + locans).indexOf('.') != -1) {
thisplace=' ';
if (eval('' + locans.replace('(','').replace(')','').replace('[','').replace(']','').split(',').length) > 2) {
plotplace.push(locans.replace(locans.split(',')[0] + ',' + locans.split(',')[1] + ',', '').replace('(','').replace(')','').replace('[','').replace(']',''));
thisplace=locans.replace(locans.split(',')[0] + ',' + locans.split(',')[1] + ',', '').replace('(','').replace(')','').replace('[','').replace(']','') + ' ';
} else {
plotplace.push('');
}
plotcc.push('');
plotlong.push(locans.replace('(','').replace(')','').replace('[','').replace(']','').split(',')[0]);
plotlat.push(locans.replace('(','').replace(')','').replace('[','').replace(']','').split(',')[1]);
plotct.push('');
plotemj.push('');
plottz.push('');

} else if (locans.trim() != '' && locans.trim() != locans) {
locans=locans.replace(locans.trim(), '');
} else {
locans=null;
}
}

movesallowed=true;
return locans;
}

function orflag(thiscc) {
var ccchar='', ccsuff='';
var lri='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var dri=['127462','127463','127464','127465','127466','127467','127468','127469','127470','127471','127472','127473','127474','127475','127476','127477','127478','127479','127480','127481','127482','127483','127484','127485','127486','127487'];
for (var iccsuff=0; iccsuff<thiscc.length; iccsuff++) {
ccchar=thiscc.substring(iccsuff, eval(1 + eval('' + iccsuff))).toUpperCase();
ccsuff+=String.fromCodePoint(eval('' + dri[eval('' + lri.indexOf(ccchar))])); //'&#' + dri[eval('' + lri.indexOf(ccchar))] + ';';
}
return ccsuff;
}

... referencing three new when "collectables" ...

  1. var plottz=[]; // contains a TimeZone name
  2. var plotct=[]; // contains a current datetime timestamp
  3. var plotemj=[]; // contains a current datetime clockemoji of nearest relevance

... now used in an amended plotting span element innerHTML (used to be plotplace[iplot]) "wrapper" (now using doplotplace(iplot)) ...


function doplotplace(ipl) {
if (plotcc[ipl].trim() && plottz[ipl].trim() != '') {
return plotplace[ipl] + ' ' + orflag(plotcc[ipl]) + '
' + plotct[ipl] + '
' + plotemj[ipl];
}

return plotplace[ipl];
}

... in our changed fifth draft Earth Scanner web application.


Previous relevant Earth Scanner Places Tutorial is shown below.

Earth Scanner Places Tutorial

Earth Scanner Places Tutorial

So far, with our Earth Scanner web application from the day before yesterday's Earth Scanner Lines Tutorial, it had a pretty passive modus operandi. On a plane or on television or some other "just watching" scenario that suits, but we'd like to offer more regarding value adding ...

  • new Place plotting functionality that the user has real-time control over via onclick logic reaching a ...
  • Javascript prompt window

... and into the future we have another idea regarding how this operates.

So today, though, we change how that Javascript prompt window's "blurb" is constructed, and how the user answer is analyzed, because, today, we've added in ...


PHP inspired TimeZone place lookup logic within the Javascript code

Of course not all places are TimeZone places, and we'll see how that goes into the future?!

We funnelled the Javascript prompt window logic into a new "wrapper style" Javascript inhouse function ...


function ourprompt(e, blurb, defv) {
var locans=null, ijk=0, extras='';
if (eval(uc_iso_country_codes.length) == 0) {
for (ijk=0; ijk<iso_country_codes.length; ijk++) {
uc_iso_country_codes.push(iso_country_codes[ijk].toUpperCase());
}
}
e = e || window.event;
e.preventDefault();
if (e.touches) {
if (e.touches[0].pageX) {
xinxy.push(eval(e.touches[0].pageX + document.body.scrollLeft * 0) * 1);
yinxy.push(eval(e.touches[0].pageY + document.body.scrollTop * 0) * 1);
} else {
xinxy.push(eval(e.touches[0].clientX + document.body.scrollLeft * 0) * 1);
yinxy.push(eval(e.touches[0].clientY + document.body.scrollTop * 0) * 1);
}
} else if (e.clientX || e.clientY) {
xinxy.push(e.clientX + document.body.scrollLeft * 0);
yinxy.push(e.clientY + document.body.scrollTop * 0);
} else {
xinxy.push(e.pageX + document.body.scrollLeft * 0);
yinxy.push(e.pageY + document.body.scrollTop * 0);
}
var llsa=blurb.split(') (')[1];
//alert(blurb + ' ... ' + llsa);
tllg=eval(llsa.split(',')[0]);
tlla=eval(llsa.split(',')[1].split(')')[0]);
brlg=eval(llsa.split('(')[1].split(',')[0]);
brla=eval(llsa.split('(')[1].split(',')[1].split(')')[0]);
thislong=eval(tllg + eval(eval(xinxy[eval(-1 + xinxy.length)] / screenwidth) * eval(screenlong)));
thislat=eval(tlla - eval(eval(yinxy[eval(-1 + yinxy.length)] / screenheight) * eval(screenlat)));
var nearbyfour=retnearest(thislong, thislat);
var aatm='youllneverfindthis';
var bbtm=String.fromCharCode(9);
if (blurb.indexOf('Thanks to ') != -1) {
if (blurb.split('Thanks to ')[1].indexOf(' ...') != -1) {
bbtm='Thanks to ' + blurb.split('Thanks to ')[1].split(' ...')[0] + ' ...';
}
}
if (blurb.indexOf(' and around the middle ') != -1) {
aatm=' and around the middle ' + blurb.split(' and around the middle ')[1].split(')')[0] + ')';
}
var ourblurb=(blurb.replace(bbtm,'').replace('Currently top ','Top ').replace(' in terms of ',' as ').replace(aatm, '').replace(/\ and\ /g,' & ').replace('? ', '? ' + ' Nearest timezone place (via N) is ' + nearbyfour.split('|')[3] + ' at [' + nearbyfour.split('|')[0] + ',' + nearbyfour.split('|')[1] + '] to your clicked (via C) [' + thislong + ',' + thislat + '] ') + bbtm.replace(String.fromCharCode(9),'')).replace(String.fromCharCode(10),' ').replace(String.fromCharCode(10),' ').replace(String.fromCharCode(10),' ').replace(String.fromCharCode(10),' ');
if (prevf.indexOf(',') != -1) {
if (Math.abs(eval(prevf.split(',')[0]) - tllg) <= 0.5) {
prevf='' + prevone + ',' + prevtwo + ',' + prevthree + ',' + prevfour;
}
if (Math.abs(eval(prevf.split(',')[0]) - tllg) > 0.5) {
tllg=eval(prevf.split(',')[0]);
tlla=eval(prevf.split(',')[1]);
brlg=eval(prevf.split(',')[2]);
brla=eval(prevf.split(',')[3]);
var sthislong=eval(tllg + eval(eval(xinxy[eval(-1 + xinxy.length)] / screenwidth) * eval(screenlong)));
var sthislat=eval(tlla - eval(eval(yinxy[eval(-1 + yinxy.length)] / screenheight) * eval(screenlat)));
var snearbyfour=retnearest(sthislong, sthislat);
//alert(ourblurb + ' ' + prevf + ' vs ' + tllg + ' ... ' + Math.abs(eval(prevf.split(',')[0]) - tllg));
ourblurb=ourblurb.replace('? ', '? ' + ' Nearest timezone place (via P) is ' + snearbyfour.split('|')[3] + ' at [' + snearbyfour.split('|')[0] + ',' + snearbyfour.split('|')[1] + '] to your clicked (via A) [' + sthislong + ',' + sthislat + '] ');
}
locans=prompt(ourblurb, defv);
}
if (locans != null) {
if (locans.toUpperCase().trim() == 'N') {
locans=locans.toUpperCase().replace('N', '[' + nearbyfour.split('|')[0] + ',' + nearbyfour.split('|')[1] + ']');
plotplace.push(nearbyfour.split('|')[3]);
plotcc.push(nearbyfour.split('|')[2]);
plotlong.push(nearbyfour.split('|')[0]);
plotlat.push(nearbyfour.split('|')[1]);
} else if (locans.toUpperCase().trim() == 'C') {
thisplace=' ';
locans=locans.toUpperCase().replace('C', '[' + thislong + ',' + thislat + ']');
plotplace.push('');
plotcc.push(nearbyfour.split('|')[2]);
plotlong.push(thislong);
plotlat.push(thislat);
} else if (locans.toUpperCase().trim() == 'P') {
locans=locans.toUpperCase().replace('P', '[' + snearbyfour.split('|')[0] + ',' + snearbyfour.split('|')[1] + ']');
plotplace.push(snearbyfour.split('|')[3]);
plotcc.push(snearbyfour.split('|')[2]);
plotlong.push(snearbyfour.split('|')[0]);
plotlat.push(snearbyfour.split('|')[1]);
} else if (locans.toUpperCase().trim() == 'A') {
thisplace=' ';
locans=locans.toUpperCase().replace('A', '[' + sthislong + ',' + sthislat + ']');
plotplace.push('');
plotcc.push(snearbyfour.split('|')[2]);
plotlong.push(sthislong);
plotlat.push(sthislat);
} else if (eval('' + ('' + locans.trim()).length) >= 3 && ('' + locans).indexOf(',') == -1 && yourtzlist.toUpperCase().indexOf('/' + ('' + locans.trim()).toUpperCase().replace(/\ /g,'_') + '<') != -1) {
thisplace=yourtzlist.toUpperCase().split('/' + ('' + locans.trim()).toUpperCase().replace(/\ /g,'_') + '<')[0].split(' DATA-GEO="')[eval(-1 + yourtzlist.toUpperCase().split('/' + ('' + locans.trim()).toUpperCase().replace(/\ /g,'_') + '<')[0].split(' DATA-GEO="').length)];
//alert(thisplace);
plotplace.push(yourtzlist.split(thisplace.split('>')[0] + '>')[1].split('<')[0].replace('GMT','Europe/London').split('/')[eval(-1 + yourtzlist.split(thisplace.split('>')[0] + '>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' '));
plotlong.push((thisplace.split(',')[1]));
plotlat.push((thisplace.split(',')[0]));
plotcc.push(thisplace.split(',')[3]);
if (thisplace.split(',')[3] != '') {
for (ijk=0; ijk<iso_country_codes.length; ijk+=2) {
if (iso_country_codes[ijk].toUpperCase() == thisplace.split(',')[3].toUpperCase()) {
extras=', ' + iso_country_codes[eval(1 + ijk)];
plotplace[eval(-1 + plotplace.length)]+=extras;
extras='';
}
}
}
//alert(extras + ' ... ' + locans);
locans=locans.replace(locans.trim(), '[' + thisplace.split(',')[1] + ',' + thisplace.split(',')[0] + ',' + plotplace[eval(-1 + plotplace.length)] + extras + ']');
//alert(locans);
thisplace=' ';
} else if (eval('' + ('' + locans.trim()).length) == 2 && ('' + locans).indexOf(',') == -1 && yourtzlist.indexOf(',' + ('' + locans.trim()).toUpperCase() + ',') != -1) {
thisplace=yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[0].split(' data-geo="')[eval(-1 + yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[0].split(' data-geo="').length)];
plotplace.push(yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[1].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/')[eval(-1 + yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[1].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' '));
plotlong.push((thisplace.split(',')[1]));
plotlat.push((thisplace.split(',')[0]));
plotcc.push(locans.trim());
if (locans != '') {
for (ijk=0; ijk<iso_country_codes.length; ijk+=2) {
if (iso_country_codes[ijk].toUpperCase() == locans.trim().toUpperCase()) {
extras=', ' + iso_country_codes[eval(1 + ijk)];
plotplace[eval(-1 + plotplace.length)]+=extras;
extras='';
}
}
}
locans=locans.replace(locans.trim(), '[' + thisplace.split(',')[1] + ',' + thisplace.split(',')[0] + ',' + plotplace[eval(-1 + plotplace.length)] + extras + ']');
thisplace=' ';
} else if (eval('' + ('' + locans.trim()).length) >= 3 && ('' + locans).indexOf(',') == -1 && iso_country_codes.indexOf(locans.trim()) != -1) {
//alert(iso_country_codes[eval(-1 + eval('' + iso_country_codes.indexOf(locans.trim())))].toUpperCase());
if (yourtzlist.indexOf(',' + ('' + iso_country_codes[eval(-1 + eval('' + iso_country_codes.indexOf(locans.trim())))].toUpperCase()) + ',') != -1) {
locans=locans.replace(locans.trim(), '' + iso_country_codes[eval(-1 + eval('' + iso_country_codes.indexOf(locans.trim())))]);
thisplace=yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[0].split(' data-geo="')[eval(-1 + yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[0].split(' data-geo="').length)];
plotplace.push(yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[1].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/')[eval(-1 + yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[1].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' '));
plotlong.push((thisplace.split(',')[1]));
plotlat.push((thisplace.split(',')[0]));
plotcc.push(locans.trim());
if (locans != '') {
for (ijk=0; ijk<iso_country_codes.length; ijk+=2) {
if (iso_country_codes[ijk].toUpperCase() == locans.trim().toUpperCase()) {
extras=', ' + iso_country_codes[eval(1 + ijk)];
plotplace[eval(-1 + plotplace.length)]+=extras;
extras='';
}
}
}
locans=locans.replace(locans.trim(), '[' + thisplace.split(',')[1] + ',' + thisplace.split(',')[0] + ',' + plotplace[eval(-1 + plotplace.length)] + extras + ']');
thisplace=' ';
} else if (locans.trim() != '' && locans.trim() != locans) {
locans=locans.replace(locans.trim(), '');
} else {
locans=null;
}
} else if (eval('' + ('' + locans.trim()).length) >= 3 && ('' + locans).indexOf(',') == -1 && uc_iso_country_codes.indexOf(locans.trim().toUpperCase()) != -1) {
//alert(iso_country_codes[eval(-1 + eval('' + uc_iso_country_codes.indexOf(locans.trim())))].toUpperCase());
if (yourtzlist.indexOf(',' + iso_country_codes[eval(-1 + uc_iso_country_codes.indexOf(locans.trim().toUpperCase()))].toUpperCase() + ',') != -1) {
locans=locans.replace(locans.trim(), '' + iso_country_codes[eval(-1 + eval('' + uc_iso_country_codes.indexOf(locans.trim().toUpperCase())))]);
thisplace=yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[0].split(' data-geo="')[eval(-1 + yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[0].split(' data-geo="').length)];
plotplace.push(yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[1].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/')[eval(-1 + yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[1].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' '));
plotlong.push((thisplace.split(',')[1]));
plotlat.push((thisplace.split(',')[0]));
plotcc.push(locans.trim());
if (locans != '') {
for (ijk=0; ijk<iso_country_codes.length; ijk+=2) {
if (iso_country_codes[ijk].toUpperCase() == locans.trim().toUpperCase()) {
extras=', ' + iso_country_codes[eval(1 + ijk)];
plotplace[eval(-1 + plotplace.length)]+=extras;
extras='';
}
}
}
locans=locans.replace(locans.trim(), '[' + thisplace.split(',')[1] + ',' + thisplace.split(',')[0] + ',' + plotplace[eval(-1 + plotplace.length)] + extras + ']');
thisplace=' ';
} else if (locans.trim() != '' && locans.trim() != locans) {
locans=locans.replace(locans.trim(), '');
} else {
locans=null;
}
} else if (('' + locans).indexOf(',') != -1 && ('' + locans).indexOf('[') != -1) {
thisplace=' ';
if (eval('' + locans.replace('(','').replace(')','').replace('[','').replace(']','').split(',').length) > 2) {
plotplace.push(locans.replace(locans.split(',')[0] + ',' + locans.split(',')[1] + ',', '').replace('(','').replace(')','').replace('[','').replace(']',''));
thisplace=locans.replace(locans.split(',')[0] + ',' + locans.split(',')[1] + ',', '').replace('(','').replace(')','').replace('[','').replace(']','') + ' ';
} else {
plotplace.push('');
}
plotcc.push('');
plotlong.push(locans.replace('(','').replace(')','').replace('[','').replace(']','').split(',')[0]);
plotlat.push(locans.replace('(','').replace(')','').replace('[','').replace(']','').split(',')[1]);
} else if (('' + locans).indexOf(',') != -1 && ('' + locans).indexOf('.') != -1) {
thisplace=' ';
if (eval('' + locans.replace('(','').replace(')','').replace('[','').replace(']','').split(',').length) > 2) {
plotplace.push(locans.replace(locans.split(',')[0] + ',' + locans.split(',')[1] + ',', '').replace('(','').replace(')','').replace('[','').replace(']',''));
thisplace=locans.replace(locans.split(',')[0] + ',' + locans.split(',')[1] + ',', '').replace('(','').replace(')','').replace('[','').replace(']','') + ' ';
} else {
plotplace.push('');
}
plotcc.push('');
plotlong.push(locans.replace('(','').replace(')','').replace('[','').replace(']','').split(',')[0]);
plotlat.push(locans.replace('(','').replace(')','').replace('[','').replace(']','').split(',')[1]);
} else if (locans.trim() != '' && locans.trim() != locans) {
locans=locans.replace(locans.trim(), '');
} else {
locans=null;
}
}


movesallowed=true;
return locans;
}

... as the best way to get into how this happens in Earth Scanner Primer Tutorial, in our changed fourth draft Earth Scanner web application.


Previous relevant Earth Scanner Lines Tutorial is shown below.

Earth Scanner Lines Tutorial

Earth Scanner Lines Tutorial

Not everybody is a geography buff. But I'd say more people attended primary school than are geography buffs. And those people may have seen World Maps on the wall, and they were often Mercator Projection maps featuring the usual country and sea boundaries, as well as useful reference lines ...

  • lines of latitude, including, in between top "North Pole" 90° N and "South Pole" 90° S bottom ...
    1. Arctic Circle 66° 34' N
    2. Tropic of Cancer 23° 26' N
    3. Equator 0°
    4. Tropic of Capricorn 23° 26' S
    5. Antarctic Circle 66° 34' S
  • meridians of longitude (only the Equator above, is as long as ... and in the "Go Figure, Mercator" realms, the North Pole and South Pole are each of zero length, in "non-projection land"), including ...
    1. Greenwich Meridian 0°
    2. International Date Line 180° (but in practice, broken up so as not to confuse regarding timezones for some Pacific island countries)

... that become useful as you scan your way around Earth, further to yesterday's Earth Scanner Primer Tutorial, in our changed second draft Earth Scanner web application.

Stop Press

Couple of points to note ...

  1. the linework is just hr (Horizontal rule) elements, which are not the challenge either horizontally or vertically, regarding linework, that any diagonality brings ...

  2. the matter of screen width and screen height, which we need to know precisely for the work above, can be more involved to calculate on mobile platforms ... we ended up, with great help from this useful link, with this Javascript code ...

    var screenwidth=screen.width, screenheight=screen.height;

    var wasthisso='';
    if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
    try {
    wasthisso=('' + window.orientation).replace(/^0$/g, 'portrait'); //"portrait";
    } catch (ehgfg) {
    wasthisso='';
    }
    if (wasthisso == '') {
    try {
    wasthisso='' + screen.orientation.type; //"portrait";
    } catch (hgfg) {
    wasthisso=('' + window.orientation).replace(/^0$/g, 'portrait'); //"portrait";
    }
    }
    //alert(wasthisso);
    var hdone=false;
    if (wasthisso.indexOf('ortrait') != -1) { // thanks to https://stackoverflow.com/questions/50690191/window-innerheight-returning-wrong-value-in-ios-11
    if (eval('0' + document.documentElement.clientWidth) >= eval('0' + window.innerWidth)) {
    screenwidth=eval('' + document.documentElement.clientWidth);
    screenheight=eval('' + document.documentElement.clientHeight);
    hdone=true;
    } else {
    screenwidth=window.innerWidth;
    }
    if (!hdone) {
    if (eval('0' + document.documentElement.clientHeight) > eval('0' + window.innerHeight)) {
    screenheight=eval('' + document.documentElement.clientHeight);
    } else {
    screenheight=window.innerHeight;
    }
    }
    } else {
    if (eval('0' + document.documentElement.clientWidth) >= eval('0' + window.innerHeight)) {
    screenwidth=eval('' + document.documentElement.clientWidth);
    screenheight=eval('' + document.documentElement.clientHeight);
    hdone=true;
    } else {
    screenwidth=window.innerHeight;
    }
    if (!hdone) {
    if (eval('0' + document.documentElement.clientHeight) > eval('0' + window.innerWidth)) {
    screenheight=eval('' + document.documentElement.clientHeight);
    } else {
    screenheight=window.innerWidth;
    }
    }
    }
    if (1 == 6) {
    documentURL=documentURL + '&nolines=y';
    if (documentURL.indexOf('.html') != -1) {
    location.href=document.URL.replace('.html','.htm');
    }
    }
    }

    ... in Earth Scanner Primer Tutorial, in our changed third draft Earth Scanner web application


Previous relevant Earth Scanner Primer Tutorial is shown below.

Earth Scanner Primer Tutorial

Earth Scanner Primer Tutorial

Today we've got for you a tutorial that takes bits and pieces from ...

... so as to create a new "Earth Scanner" web application in what we like to think of as "the where of life" realms.

In essence this Earth Scanner is pretty simple, so below you can see a first draft, "holus bolus" ...


<html>
<head>
<title>Earth Scanner - RJM Programming - February, 2024 ... Thanks to https://github.com/nvkelso/natural-earth-raster/blob/master/50m_rasters/HYP_50M_SR_W/HYP_50M_SR_W.README.html</title>
<style>
#myimg {
clip-path: circle(2% at 800px 700px);
animation:mymove 5s infinite;
-webkit-animation:mymove 5s infinite; /* Safari and Chrome */
}

@keyframes mymove
{
0% { clip-path: circle(2% at 0px 0px) }
100% { clip-path: circle(16% at 140px 140px) }
}

@-webkit-keyframes mymove /* Safari and Chrome */
{
0% { clip-path: circle(2% at 0px 0px) }
100% { clip-path: circle(16% at 140px 140px) }
}
</style>
<script type=text/javascript>
// Deemed unnecessary is ...
// 7% { clip-path: circle(3% at 10px 10px) }
// 14% { clip-path: circle(4% at 20px 20px) }
// 21% { clip-path: circle(5% at 30px 30px) }
// 28% { clip-path: circle(6% at 40px 40px) }
// 35% { clip-path: circle(7% at 50px 50px) }
// 42% { clip-path: circle(8% at 60px 60px) }
// 50% { clip-path: circle(9% at 70px 70px) }
// 57% { clip-path: circle(10% at 80px 80px) }
// 64% { clip-path: circle(11% at 90px 90px) }
// 71% { clip-path: circle(12% at 100px 100px) }
// 78% { clip-path: circle(13% at 110px 110px) }
// 85% { clip-path: circle(14% at 120px 120px) }
// 93% { clip-path: circle(15% at 130px 130px) }

var xp=0, yp=0, num=0;
var fixkeys='<style> #myimg { animation:mymove 5s infinite; -webkit-animation:mymove 5s infinite; } @keyframes mymove' + document.head.innerHTML.split('@keyframes mymove')[1].split('</style>')[0] + ' </style>';
var screenlong=-9, screenlat=-9, askfor=null, enforcedlong=false, enforcedxp=-999;

function scmove() {
var longforce='-999', latforce='-999';
if (screenlong < 0) {
screenlong=eval(360 * screen.width / document.getElementById('myimg').width);
screenlat=eval(180 * screen.height / document.getElementById('myimg').height);
document.getElementById('myimg').onclick=function() { askfor=prompt('Earth Scanner - RJM Programming - February, 2024 ... ' + String.fromCharCode(10) + 'Thanks to https://github.com/nvkelso/natural-earth-raster/blob/master/50m_rasters/HYP_50M_SR_W/HYP_50M_SR_W.README.html ... ' + String.fromCharCode(10) + 'Currently top left of screen is (Longitude,Latitude) ' + '(' + eval(-180 + xp * 360 / 100) + ',' + eval(90 - yp * 180 / 100) + ') and bottom right is (' + eval(-180 + screenlong + xp * 360 / 100) + ',' + eval(90 - screenlat - yp * 180 / 100) + ') and in the middle is (' + eval(-180 + eval(screenlong / 2) + xp * 360 / 100) + ',' + eval(90 - eval(screenlat / 2) - yp * 180 / 100) + ').' + String.fromCharCode(10) + 'Where do you want middle of screen to be in terms of Longitude,Latitude?', ''); };
}
//document.title="window.scrollTo(" + eval(xp * eval('' + document.getElementById('myimg').width) / 100) + "," + eval(yp * eval('' + document.getElementById('myimg').height) / 100) + ")";
if (askfor != null) {
if (askfor.replace('(','').replace(')','').indexOf(',') != -1) {
longforce=askfor.replace('(','').replace(')','').split(',')[0];
latforce=askfor.replace('(','').replace(')','').split(',')[1];
} else if (askfor.replace('(','').replace(')','').indexOf(' ') != -1) {
longforce=askfor.replace('(','').replace(')','').split(' ')[0];
latforce=askfor.replace('(','').replace(')','').split(' ')[1];
}
//xp = eval(((eval(eval('' + longforce) + 180) / 360) * eval('' + document.getElementById('myimg').width) / 100) - 0 * eval(eval(screenlong / 720) * eval('' + document.getElementById('myimg').width) / 100));
//yp = eval(((eval(90 - eval('' + latforce)) / 180) * eval('' + document.getElementById('myimg').height) / 100) + 0 * eval(eval(screenlat / 360) * eval('' + document.getElementById('myimg').height) / 100));
xp = eval(eval(eval('' + longforce) - screenlong / 2 + 180) / 3.60); // * eval('' + document.getElementById('myimg').width) / 100) - 0 * eval(eval(screenlong / 720) * eval('' + document.getElementById('myimg').width) / 100));
yp = eval(eval(90 - eval('' + latforce) - screenlat / 2) / 1.80); // * eval('' + document.getElementById('myimg').height) / 100) + 0 * eval(eval(screenlat / 360) * eval('' + document.getElementById('myimg').height) / 100));
//alert('' + xp + ',' + yp + ' ... ' + "window.scrollTo(" + eval(xp * eval('' + document.getElementById('myimg').width) / 100) + "," + eval(yp * eval('' + document.getElementById('myimg').height) / 100) + ")");
askfor=null;
if (enforcedlong) {
enforcedlong=false;
enforcedxp=xp;
//alert(xp + ' or ' + enforcedxp);
}
}
eval("window.scrollTo(" + eval((enforcedxp > -990 ? enforcedxp : xp) * eval('' + document.getElementById('myimg').width) / 100) + "," + eval(yp * eval('' + document.getElementById('myimg').height) / 100) + ")");
document.getElementById('myimg').title='Earth Scanner - RJM Programming - February, 2024 ... ' + 'Thanks to https://github.com/nvkelso/natural-earth-raster/blob/master/50m_rasters/HYP_50M_SR_W/HYP_50M_SR_W.README.html ... ' + String.fromCharCode(10) + String.fromCharCode(10) + 'Top left of screen is (Longitude,Latitude) ' + '(' + eval(-180 + (enforcedxp > -990 ? enforcedxp : xp) * 360 / 100) + ',' + eval(90 - yp * 180 / 100) + ') and bottom right is (' + eval(-180 + screenlong + (enforcedxp > -990 ? enforcedxp : xp) * 360 / 100) + ',' + eval(90 - screenlat - yp * 180 / 100) + ') and in the middle is (' + eval(-180 + eval(screenlong / 2) + (enforcedxp > -990 ? enforcedxp : xp) * 360 / 100) + ',' + eval(90 - eval(screenlat / 2) - yp * 180 / 100) + ')';
document.title=document.getElementById('myimg').title; //'Top left of screen is (Longitude,Latitude) ' + '(' + eval(-180 + xp * 360 / 100) + ',' + eval(90 - yp * 180 / 100) + ') and bottom right is (' + eval(-180 + screenlong + (enforcedxp > -990 ? enforcedxp : xp) * 360 / 100) + ',' + eval(90 - screenlat - yp * 180 / 100) + ') and in the middle is (' + eval(-180 + eval(screenlong / 2) + (enforcedxp > -990 ? enforcedxp : xp) * 360 / 100) + ',' + eval(90 - eval(screenlat / 2) - yp * 180 / 100) + ')';
if (xp < 95) {
xp+=5;
} else if (yp >= 95 && xp >= 95) {
enforcedxp=-999;
xp=0;
yp=0;
} else {
yp+=5;
xp=0;
}
var xdiff=eval((enforcedxp > -990 ? enforcedxp : xp) * eval('' + document.getElementById('myimg').width) / 100);
var ydiff=eval(yp * eval('' + document.getElementById('myimg').height) / 100);
var startkeys=fixkeys;
var coords=fixkeys.split('px');
for (var ic=0; ic<coords.length; ic+=2) {
if (coords[ic].split(' ')[eval(-1 + coords[ic].split(' ').length)].indexOf('<') == -1) {
//alert('' + xdiff + ',' + ydiff+ ',' + coords[ic].split(' ')[eval(-1 + coords[ic].split(' ').length)]);
startkeys=startkeys.replace(' ' + coords[ic].split(' ')[eval(-1 + coords[ic].split(' ').length)] + 'px', ' ' + eval(xdiff + eval('' + coords[ic].split(' ')[eval(-1 + coords[ic].split(' ').length)])) + 'px');
startkeys=startkeys.replace(' ' + coords[eval(1 + ic)].split(' ')[eval(-1 + coords[eval(1 + ic)].split(' ').length)] + 'px', ' ' + eval(ydiff + eval('' + coords[eval(1 + ic)].split(' ')[eval(-1 + coords[eval(1 + ic)].split(' ').length)])) + 'px');
}
}
//alert(startkeys);
document.getElementById('dstyle').innerHTML=startkeys; //.replace(/mymove/g, 'mymove' + num);
num++;
}

setInterval(scmove, 5000);
document.write("<img src='/HTMLCSS/HYP_50M_SR_W.jpg' id=myimg></img><div id=dstyle></div>");
var latis=location.search.split('latitude=')[1] ? decodeURIComponent(location.search.split('latitude=')[1].split('&')[0]) : '';
var longis=location.search.split('longitude=')[1] ? decodeURIComponent(location.search.split('longitude=')[1].split('&')[0]) : '';
if (latis != '' && longis != '') {
askfor='' + longis + ',' + latis;
} else if (latis != '') {
askfor='-168,' + latis;
} else if (longis != '') {
enforcedlong=true;
askfor='' + longis + ',70';
}
</script>
</head>
<body>
</body>
</html>

... now given to the user in a "heads up" that goes ...

At prompt window, prefixing, and persevering, CSS map image styling available (and able to be turned off via nocssplease) eg. filter:sepia(74%); Or you can specify <style></style> non-persevering or <style></STYLE> persevering CSS of your own (or use a URL ending with .css) to begin with and/or <script></script> non-persevering or <script></SCRIPT> persevering Javascript of your own (or use a URL ending with .js) to begin with

... with great thanks to this great resource as the crucial image in our first draft Earth Scanner web application.

Please note using it, it does have onclick logic to specify ...

Posted in eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Earth Scanner User Emoji Entities Tutorial

Earth Scanner User Emoji Entities Tutorial

Earth Scanner User Emoji Entities Tutorial

Recently we’ve been trying to add to the flexibility and power of the user using our recent Earth Scanner web application to tailor what it looks like and how it works via settings the user can control. Adding to this work up to yesterday’s Earth Scanner Intranet Feeling Externals Tutorial, today, we’d like to allow the user to control the look of two types of emojis used, they being …

  1. the pin emoji for place locations … and …
  2. the compass emoji in the middle of a trip leg

Emojis, as we’ve said a few times now, are really useful, as that hybrid between text and graphics, for we graphically challenged, and as Internationalization aids, and clarifiers. But how are they defined. Our favourite way, of many, is via …

  • HTML Decimal Entities … in HTML or Javascript code, but you can also use …
  • HTML Hexadecimal Entity … in HTML or Javascript code, or …
  • String.fromCodePoint([HTML Decimal Entity]) … in Javascript code or …
  • CSS (selector) content property value expressed like content:’\000031\0020e3′; … ie. UTF-32 expression(s)
  • The emoji contents, copied, within the CSS content or HTML or Javascript code, as applicable

We like to look up the concept at Emojipedia. We …

  • make initial example of Google Search (today, “Bow and Arrow emojipedia”) … leads to link to …
  • get off Emojipedia, in its “Technical Information”, these days, the Codepoint eg. U+1F3F9 … then we just type that into an address bar … to get to a …
  • relevant Google search … and in its list, for the more fundamental emoji arrangements we look for …
  • relevant Fileformat.info web page … where this entity information is laid out for you

… used by the Javascript of the Earth Scanner …


var thepin='&#128205;', thecompass='&#129517;';

… used, now in code lines like …


// Pin ...
bmeridian+='<span class=place style="z-index:1675;position:' + posval + ';top:' + eval(0 + eval(eval(lglat - eval('' + plotlat[iplot])) / eval(lglat - smlat) * eval(screenheight))) + 'px;left:' + eval(0 + eval(eval('' + plotlong[iplot]) - smlong) / eval(lglong - smlong) * eval(screenwidth)) + 'px;" onclick="event.stopPropagation(); woit(' + "'" + plotplace[iplot].split(', ')[0] + "'" + ');">' + thepin + '</span>';
// Compass ...
bmeridian+='<hr' + clabit + ' onclick="event.stopPropagation(); canlooknow=false; clearwo(); wo=window.open(' + "'//www.google.com/maps/dir/" + encodeURIComponent(plotplace[eval(thisleg.split('.')[0])]) + '/' + encodeURIComponent(plotplace[eval(thisleg.split('.')[1])]) + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; alert(this.title); " ondblclick="event.stopPropagation(); canlooknow=false; clearwo(); wo=window.open(' + "'//www.google.com/maps/dir/" + plotlat[eval(thisleg.split('.')[0])] + ',' + plotlong[eval(thisleg.split('.')[0])] + '/' + plotlat[eval(thisleg.split('.')[1])] + ',' + plotlong[eval(thisleg.split('.')[1])] + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; alert(this.title); " title="' + plusbit + '' + plotplace[eval(thisleg.split('.')[0])] + ' to ' + plotplace[eval(thisleg.split('.')[1])] + ' has the crow flying (' + gbrgtoset + ' degrees setting off at versus on Mercator Projection ...) ' + eval(eval(brgtoset + 450) % 360) + ' degrees for ' + eval(gdisttoset / 1000.0) + ' kilometers. Click (for placename) or double click (for geographicals) to open a Google Directions window." data-class=leg style="transform:rotate(' + eval(eval('' + brgtoset) - 0) + 'deg);z-index:975;opacity:0.3;position:' + posval + ';top:' +
meanlat +
'px;left:' +
eval(meanlong - disttoset / 2) +
'px;background-color:rgba(255,0,0,0.5);width:' + disttoset + 'px;height:6px;"></hr><span onclick="event.stopPropagation(); canlooknow=false; clearwo(); wo=window.open(' + "'//www.google.com/maps/dir/" + encodeURIComponent(plotplace[eval(thisleg.split('.')[0])]) + '/' + encodeURIComponent(plotplace[eval(thisleg.split('.')[1])]) + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; " ondblclick="event.stopPropagation(); canlooknow=false; clearwo(); gleg=glegit(this); wo=windowopen(' + "'//www.google.com/maps/dir/" + plotlat[eval(thisleg.split('.')[0])] + ',' + plotlong[eval(thisleg.split('.')[0])] + '/' + plotlat[eval(thisleg.split('.')[1])] + ',' + plotlong[eval(thisleg.split('.')[1])] + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; " title="' + plusbit + '' + plotplace[eval(thisleg.split('.')[0])] + ' to ' + plotplace[eval(thisleg.split('.')[1])] + ' has the crow flying (' + gbrgtoset + ' degrees setting off at versus on Mercator Projection ...) ' + eval(eval(360 - brgtoset) % 360) + ' degrees for ' + eval(gdisttoset / 1000.0) + ' kilometers. Click (for placename) or double click (for geographicals) to open a Google Directions window. ' + '" data-class=leg style="cursor:pointer;font-size:6px;z-index:976;margin-top:6px;margin-left:-6px;position:' + posval + ';top:' + meanlat + 'px;left:' + meanlong + 'px;" data-oncontextmenu="event.stopPropagation(); woit(' + "'" + plotplace[eval(thisleg.split('.')[1])].split(', ')[0] + "'" + ');" data-tleg="' + thisleg + '">' + thecompass + '</span>';

… and now, given a “heads up to” for the user, in the blurb …

At prompt window, prefixing, and persevering, CSS map image styling available (and able to be turned off via nocssplease and special decimal entity number parts for emojis eg. pin:128204; (versus 📍) compass:127993; (versus 🧭))) eg. filter:sepia(74%); Or you can specify <style></style> non-persevering or <style></STYLE> persevering CSS of your own (or use a URL ending with .css) to begin with and/or <script></script> non-persevering or <script></SCRIPT> persevering Javascript of your own (or use a URL ending with .js) to begin with

… and determined in amongst the map image styling code functionality …


while (eval('' + retc.indexOf(';')) > eval('' + retc.indexOf(':'))) {
if (retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] == 'pin') {
theval=retc.split(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':')[1].split(';')[0].trim();
if (theval.substring(0,1) == '&') {
thepin=theval + ';';
} else if (theval.substring(0,1) >= '0' && theval.substring(0,1) <= '9') {
thepin='&#' + theval + ';';
} else {
thepin=theval;
}
}
else if (retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] == 'compass') {
theval=retc.split(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':')[1].split(';')[0].trim();
if (theval.substring(0,1) == '&') {
thecompass=theval + ';';
} else if (theval.substring(0,1) >= '0' && theval.substring(0,1) <= '9') {
thecompass='&#' + theval + ';';
} else {
thecompass=theval;
}
} else
{
thecss+=' ' + retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':' + retc.split(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':')[1].split(';')[0] + '; ';
labels=retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)].split('-');
thislab=labels[0].toLowerCase();
for (ilab=1; ilab<labels.length; ilab++) {
thislab+=labels[ilab].substring(0,1).toUpperCase() + labels[ilab].substring(1).toLowerCase();
}
try {
undos.push(" document.getElementById('myimg').style." + thislab + "='none';");
eval(" document.getElementById('myimg').style." + thislab + "='" + retc.split(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':')[1].split(';')[0] + "';");
} catch(hgfjh) {
}
}
retc=retc.replace(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':' + retc.split(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':')[1].split(';')[0] + ';', '');
}

… as shown in today’s tutorial picture for the changed twenty second draft of the Earth Scanner web application for you to retry, over and over again.


Previous relevant Earth Scanner Intranet Feeling Externals Tutorial is shown below.

Earth Scanner Intranet Feeling Externals Tutorial

Earth Scanner Intranet Feeling Externals Tutorial

Yesterday’s Earth Scanner Externals Tutorial left off with …

HTTP://localhost:8888/newstuff.js

… and if it had been called http://localhost:8888/newstuff.JS it could have persevered.

… as an “Intranet feeling” idea for the styling and scripting that users can get involved with, working with our latest Earth Scanner web application.

As you can imagine, to share this, in our case, local MAMP external Javascript, you can’t expect the recipient to necessarily have MAMP installed, let alone have MAMP and have your scripting and/or styling in place with its proper name. And so, to share with collaborators in this scenario, we have to convert the script URL types, as above into inline HTML script elements that will make their way into the location.hash (ie hashtagging) arrangements we’ve got going with our sharing functionalities.

So here’s the thing. We perennially battle the “Intranet feeling” restrictions out there, trying HTML iframes and Ajax and PHP curl (via window.open within the Intranet realms) before settling on the non-automated but “user participation possible” idea of using the FileReader API to read the contents of the relevant external script file the user has browsed for (off their local computer system) and selected. It’s contents are held in base64 and we’re using window.atob (via our inhouse tweaked client_browsing.htm Client Browsing FileReader API interfacer) to bring it back from the decoding into the clientside wooooorrrrlllllddd. We warn here, we’ve seen flaky window.atob arrangements, and so we’ll ease into all this, starting with small amounts of scripting for now. This is wise, too, in that we don’t know yet, about the limits, even to hashtagged URLs in “a” link mailto: and sms: URLs.

Our coding conduit into it all was a Javascript wrapper function also concerned with “user induced” mixed content issues …


function nomc(hashttpmaybe) {
var nohttp=hashttpmaybe;
var ihp=0, hparts=nohttp.split('https://');
for (ihp=1; ihp<hparts.length; ihp++) {
if (hparts[ihp].indexOf('localhost') == -1) {
nohttp=nohttp.replace('https://' + hparts[ihp], '//' + hparts[ihp]);
} else if (hparts[ihp].indexOf('.js') != -1) {
if (scrto == 'youllneverfindthis') {
scrto='filescript:https://' + hparts[ihp].split('.js')[0] + '.js';
nohttp=nohttp.replace('filescript:https://' + hparts[ihp].split('.js')[0] + '.js', ajaxit(scrto));
} else {
scrfrom='filescript:https://' + hparts[ihp].split('.js')[0] + '.js';
}
} else if (hparts[ihp].indexOf('.JS') != -1) {
if (scrto == 'youllneverfindthis') {
scrto='filescript:https://' + hparts[ihp].split('.JS')[0] + '.JS';
nohttp=nohttp.replace('filescript:https://' + hparts[ihp].split('.JS')[0] + '.JS', ajaxit(scrto));
} else {
scrfrom='filescript:https://' + hparts[ihp].split('.JS')[0] + '.JS';
}
} else if (hparts[ihp].indexOf('.css') != -1) {
if (styto == 'youllneverfindthis') {
styto='filecss:https://' + hparts[ihp].split('.css')[0] + '.css';
nohttp=nohttp.replace('filecss:https://' + hparts[ihp].split('.css')[0] + '.css', ajaxit(styto));
} else {
styfrom='filecss:https://' + hparts[ihp].split('.css')[0] + '.css';
}
} else if (hparts[ihp].indexOf('.CSS') != -1) {
if (styto == 'youllneverfindthis') {
styto='filecss:https://' + hparts[ihp].split('.CSS')[0] + '.CSS';
nohttp=nohttp.replace('filecss:https://' + hparts[ihp].split('.CSS')[0] + '.CSS', ajaxit(styto));
} else {
styfrom='filecss:https://' + hparts[ihp].split('.CSS')[0] + '.CSS';
}
}
}
hparts=nohttp.split('HTTPS://');
for (ihp=1; ihp<hparts.length; ihp++) {
if (hparts[ihp].indexOf('localhost') == -1) {
nohttp=nohttp.replace('HTTPS://' + hparts[ihp], '//' + hparts[ihp]);
} else if (hparts[ihp].indexOf('.js') != -1) {
if (scrto == 'youllneverfindthis') {
scrto='filescript:HTTPS://' + hparts[ihp].split('.js')[0] + '.js';
nohttp=nohttp.replace('filescript:HTTPS://' + hparts[ihp].split('.js')[0] + '.js', ajaxit(scrto));
} else {
scrfrom='filescript:HTTPS://' + hparts[ihp].split('.js')[0] + '.js';
}
} else if (hparts[ihp].indexOf('.JS') != -1) {
if (scrto == 'youllneverfindthis') {
scrto='filescript:HTTPS://' + hparts[ihp].split('.JS')[0] + '.JS';
nohttp=nohttp.replace('filescript:HTTPS://' + hparts[ihp].split('.JS')[0] + '.JS', ajaxit(scrto));
} else {
scrfrom='filescript:HTTPS://' + hparts[ihp].split('.JS')[0] + '.JS';
}
} else if (hparts[ihp].indexOf('.css') != -1) {
if (styto == 'youllneverfindthis') {
styto='filecss:HTTPS://' + hparts[ihp].split('.css')[0] + '.css';
nohttp=nohttp.replace('filecss:HTTPS://' + hparts[ihp].split('.css')[0] + '.css', ajaxit(styto));
} else {
styfrom='filecss:HTTPS://' + hparts[ihp].split('.css')[0] + '.css';
}
} else if (hparts[ihp].indexOf('.CSS') != -1) {
if (styto == 'youllneverfindthis') {
styto='filecss:HTTPS://' + hparts[ihp].split('.CSS')[0] + '.CSS';
nohttp=nohttp.replace('filecss:HTTPS://' + hparts[ihp].split('.CSS')[0] + '.CSS', ajaxit(styto));
} else {
styfrom='filecss:HTTPS://' + hparts[ihp].split('.CSS')[0] + '.CSS';
}
}
}
hparts=nohttp.split('http://');
//alert('Nohttp=' + nohttp + ' and hparts.length=' + hparts.length + ' and last hparts=' + hparts[eval(-1 + hparts.length)]);
for (ihp=1; ihp<hparts.length; ihp++) {
if (hparts[ihp].indexOf('localhost') == -1) {
nohttp=nohttp.replace('http://' + hparts[ihp], '//' + hparts[ihp]);
} else if (hparts[ihp].indexOf('.js') != -1) {
if (scrto == 'youllneverfindthis') {
scrto='filescript:http://' + hparts[ihp].split('.js')[0] + '.js';
nohttp=nohttp.replace('filescript:http://' + hparts[ihp].split('.js')[0] + '.js', ajaxit(scrto));
} else {
scrfrom='filescript:http://' + hparts[ihp].split('.js')[0] + '.js';
}
} else if (hparts[ihp].indexOf('.JS') != -1) {
//alert(scrto);
if (scrto == 'youllneverfindthis') {
scrto='filescript:http://' + hparts[ihp].split('.JS')[0] + '.JS';
//alert(scrto);
nohttp=nohttp.replace('filescript:http://' + hparts[ihp].split('.JS')[0] + '.JS', ajaxit(scrto));
} else {
scrfrom='filescript:http://' + hparts[ihp].split('.JS')[0] + '.JS';
}
} else if (hparts[ihp].indexOf('.css') != -1) {
if (styto == 'youllneverfindthis') {
styto='filecss:http://' + hparts[ihp].split('.css')[0] + '.css';
nohttp=nohttp.replace('filecss:http://' + hparts[ihp].split('.css')[0] + '.css', ajaxit(styto));
} else {
styfrom='filecss:http://' + hparts[ihp].split('.css')[0] + '.css';
}
} else if (hparts[ihp].indexOf('.CSS') != -1) {
if (styto == 'youllneverfindthis') {
styto='filecss:http://' + hparts[ihp].split('.CSS')[0] + '.CSS';
nohttp=nohttp.replace('filecss:http://' + hparts[ihp].split('.CSS')[0] + '.CSS', ajaxit(styto));
} else {
styfrom='filecss:http://' + hparts[ihp].split('.CSS')[0] + '.CSS';
}
}
}
hparts=nohttp.split('HTTP://');
for (ihp=1; ihp<hparts.length; ihp++) {
if (hparts[ihp].indexOf('localhost') == -1) {
nohttp=nohttp.replace('HTTP://' + hparts[ihp], '//' + hparts[ihp]);
} else if (hparts[ihp].indexOf('.js') != -1) {
if (scrto == 'youllneverfindthis') {
scrto='filescript:HTTP://' + hparts[ihp].split('.js')[0] + '.js';
nohttp=nohttp.replace('filescript:HTTP://' + hparts[ihp].split('.js')[0] + '.js', ajaxit(scrto));
} else {
scrfrom='filescript:HTTP://' + hparts[ihp].split('.js')[0] + '.js';
}
} else if (hparts[ihp].indexOf('.JS') != -1) {
if (scrto == 'youllneverfindthis') {
scrto='filescript:HTTP://' + hparts[ihp].split('.JS')[0] + '.JS';
nohttp=nohttp.replace('filescript:HTTP://' + hparts[ihp].split('.JS')[0] + '.JS', ajaxit(scrto));
} else {
scrfrom='filescript:HTTP://' + hparts[ihp].split('.JS')[0] + '.JS';
}
} else if (hparts[ihp].indexOf('.css') != -1) {
if (styto == 'youllneverfindthis') {
styto='filecss:HTTP://' + hparts[ihp] + '.css';
nohttp=nohttp.replace('filecss:HTTP://' + hparts[ihp] + '.css', ajaxit(styto));
} else {
styfrom='filecss:HTTP://' + hparts[ihp] + '.css';
}
} else if (hparts[ihp].indexOf('.CSS') != -1) {
if (styto == 'youllneverfindthis') {
styto='filecss:HTTP://' + hparts[ihp].split('.CSS')[0] + '.CSS';
nohttp=nohttp.replace('filecss:HTTP://' + hparts[ihp].split('.CSS')[0] + '.CSS', ajaxit(styto));
} else {
styfrom='filecss:HTTP://' + hparts[ihp].split('.CSS')[0] + '.CSS';
}
}
}
//alert('nohttp=' + nohttp.replace(scrfrom, scrto).replace(styfrom, styto));
return nohttp.replace(scrfrom, scrto).replace(styfrom, styto);
}

We hope you get the gist of this battle with the changed twenty first draft of the Earth Scanner web application for you to retry, over again.


Previous relevant Earth Scanner Externals Tutorial is shown below.

Earth Scanner Externals Tutorial

Earth Scanner Externals Tutorial

The “externals” we’re talking about in today’s “Earth Scanner Externals Tutorial” blog posting title refer to …

  • <style> … CSS code … </style> … (or </STYLE> for persevering) … CSS styling (then/or external CSS via URL ending with .css or .CSS (for persevering CSS))
  • <script> … Javascript code … </script> … (or </SCRIPT> for persevering) … Javascript coding (then/or external Javascript via URL ending with .js or .JS (for persevering Javascript))

… we’re encouraging you, as users of our current Earth Scanner, to try, to further personalize your Earth Scanner web application, should you be interested.

And so, onto yesterday’s Earth Scanner Image Styling Tutorial‘s map image, only, styling functionalities, we’ve got more generic ideas to control proceedings today, resulting in a new Javascript “function processinline” called via


function processinline(zretc) {
var ssss=[], jpos=-1, endtag='', jss=0, suffis='', prefis='';
var wasprefixingstuff=prefixingstuff;
var wasdstylestuff=dstylestuff;
var wasdscriptstuff=dscriptstuff;
var wasexdstylestuff=exdstylestuff;
var wasexdscriptstuff=exdscriptstuff;
ssss=zretc.replace(/\<\/S/g, '</s').split('</s');
if (eval('' + ssss.length) > 1) {
for (jss=eval(-1 + ssss.length); jss>=1; jss--) {
switch (ssss[jss].substring(0,4).toLowerCase()) {
case 'tyle':
endtag='</st' + 'yle>';
if (ssss[jss].substring(0,4).toLowerCase() != ssss[jss].substring(0,4)) {
endtag='</sT' + 'YLE>';
}
if (jss > 1) {
jpos=eval(eval('' + zretc.indexOf(ssss[eval(-1 + jss)])) + eval('' + (ssss[eval(-1 + jss)].split('>')[0] + '>').length));
dstylestuff+=ssss[eval(-1 + jss)].replace(ssss[eval(-1 + jss)].split('>')[0] + '>', '') + endtag;
zretc=zretc.replace(zretc.substring(jpos).substring(0,eval('' + (ssss[eval(-1 + jss)].replace(ssss[eval(-1 + jss)].split('>')[0] + '>', '') + endtag).length)), '');
if (document.getElementById('xdstylestuff').innerHTML.indexOf(ssss[eval(-1 + jss)].replace(ssss[eval(-1 + jss)].split('>')[0] + '>', '')) == -1) {
document.getElementById('xdstylestuff').innerHTML+=ssss[eval(-1 + jss)].replace(ssss[eval(-1 + jss)].split('>')[0] + '>', '') + endtag;
//alert(endtag + ' ... ' + ssss[jss].substring(0,4) + ' ... ' + document.getElementById('xdstylestuff').innerHTML);
if (ssss[jss].substring(0,4).toLowerCase() != ssss[jss].substring(0,4)) {
prefixingstuff+=ssss[eval(-1 + jss)].replace(ssss[eval(-1 + jss)].split('>')[0] + '>', '') + endtag;
//alert(prefixingstuff);
}
}
} else {
jpos=eval(eval('' + zretc.indexOf(ssss[eval(-1 + jss)])) + 0);
dstylestuff+=ssss[eval(-1 + jss)] + endtag;
zretc=zretc.replace(zretc.substring(jpos).substring(0,eval('' + (ssss[eval(-1 + jss)] + endtag).length)), '');
if (document.getElementById('xdstylestuff').innerHTML.indexOf(ssss[eval(-1 + jss)]) == -1) {
document.getElementById('xdstylestuff').innerHTML+=ssss[eval(-1 + jss)] + endtag;
//alert(endtag + ' .;. ' + ssss[jss].substring(0,4) + ' .;. ' + document.getElementById('xdstylestuff').innerHTML);
if (ssss[jss].substring(0,4).toLowerCase() != ssss[jss].substring(0,4)) {
prefixingstuff+=ssss[eval(-1 + jss)] + endtag;
//alert(prefixingstuff);
}
}
}
break;

case 'crip':
endtag='</sc' + 'ript>';
if (ssss[jss].substring(0,4).toLowerCase() != ssss[jss].substring(0,4)) {
endtag='</sC' + 'RIPT>';
}
if (jss > 1) {
jpos=eval(eval('' + zretc.indexOf(ssss[eval(-1 + jss)])) + eval('' + (ssss[eval(-1 + jss)].split('>')[0] + '>').length));
dscriptstuff+=ssss[eval(-1 + jss)].replace(ssss[eval(-1 + jss)].split('>')[0] + '>', '') + endtag;
zretc=zretc.replace(zretc.substring(jpos).substring(0,eval('' + (ssss[eval(-1 + jss)].replace(ssss[eval(-1 + jss)].split('>')[0] + '>', '') + endtag).length)), '');
if (document.getElementById('xdscriptstuff').innerHTML.indexOf(ssss[eval(-1 + jss)].replace(ssss[eval(-1 + jss)].split('>')[0] + '>', '')) == -1) {
document.getElementById('xdscriptstuff').innerHTML+=ssss[eval(-1 + jss)].replace(ssss[eval(-1 + jss)].split('>')[0] + '>', '') + endtag;
if (ssss[jss].substring(0,4).toLowerCase() != ssss[jss].substring(0,4)) {
prefixingstuff+=ssss[eval(-1 + jss)].replace(ssss[eval(-1 + jss)].split('>')[0] + '>', '') + endtag;
}
}
} else {
jpos=eval(eval('' + zretc.indexOf(ssss[eval(-1 + jss)])) + 0);
dscriptstuff+=ssss[eval(-1 + jss)] + endtag;
zretc=zretc.replace(zretc.substring(jpos).substring(0,eval('' + (ssss[eval(-1 + jss)] + endtag).length)), '');
if (document.getElementById('xdscriptstuff').innerHTML.indexOf(ssss[eval(-1 + jss)]) == -1) {
document.getElementById('xdscriptstuff').innerHTML+=ssss[eval(-1 + jss)] + endtag;
if (ssss[jss].substring(0,4).toLowerCase() != ssss[jss].substring(0,4)) {
prefixingstuff+=ssss[eval(-1 + jss)] + endtag;
}
}
}
break;

default:
break;

}
}
}

if (wasdscriptstuff != dscriptstuff) { // dynamic Javascript (ideas via YouTube API Embedded Iframe API ... thanks)
if (7 == 7) {
setTimeout(dolater, 3000);
} else {
var tag = document.createElement('script');
tag.innerHTML = dscriptstuff;
var firstScriptTag = document.getElementsByTagName('script')[eval(-1 + document.getElementsByTagName('script').length)];
firstScriptTag.parentNode.insertAfter(tag, firstScriptTag);
}
wasdscriptstuff=dscriptstuff;
}

ssss=zretc.split(' ');
if (eval('' + ssss.length) > 1) {
for (jss=0; jss<ssss.length; jss++) {
if (ssss[jss].toLowerCase().slice(-4) == '.css') {
if (ssss[jss].indexOf('filecss:') == -1) {
zretc=zretc.replace(ssss[jss], 'filecss:' + ssss[jss] + ';');
} else {
zretc=zretc.replace(ssss[jss], ssss[jss] + ';');
}
}
if (ssss[jss].toLowerCase().slice(-3) == '.js') {
//alert('4:' + zretc);
if (ssss[jss].indexOf('filescript:') == -1) {
zretc=zretc.replace(ssss[jss], 'filescript:' + ssss[jss] + ';');
} else {
zretc=zretc.replace(ssss[jss], ssss[jss] + ';');
}
//alert('44:' + zretc);
}
}
}

ssss=zretc.replace(/\.CSS/g, '.css').split('.css');
if (eval('' + ssss.length) > 1) {
for (jss=0; jss<ssss.length; jss++) {
if (eval('' + ssss[jss].length) > 1) {
suffis='';
prefis='';
if ((ssss[eval(1 + jss)] + ' ').substring(0,1) != ';') {
suffis=';';
}
if (ssss[jss].toLowerCase().indexOf('filecss:') == -1) {
if (jss == 0) {
prefis='filecss:';
} else if (ssss[jss].indexOf('.js;') != -1) {
zretc=zretc.replace('.js;', '.js;filecss:');
} else if (ssss[jss].indexOf('.JS;') != -1) {
zretc=zretc.replace('.JS;', '.JS;filecss:');
} else if (ssss[jss].indexOf('.js') != -1) {
zretc=zretc.replace('.js', '.js;filecss:');
} else if (ssss[jss].indexOf('.JS') != -1) {
zretc=zretc.replace('.JS', '.JS;filecss:');
} else if (ssss[jss].indexOf('HTTP') != -1) {
zretc=zretc.replace('HTTP', 'filecss:HTTP');
} else if (ssss[jss].indexOf('http') != -1) {
zretc=zretc.replace('http', 'filecss:http');
} else if (ssss[jss].indexOf('//') != -1) {
zretc=zretc.replace('//', 'filecss://');
} else if (ssss[jss].indexOf('www.') != -1) {
zretc=zretc.replace('www.', 'filecss://www.');
}
}
if ((prefis + suffis) != '') {
zretc=zretc.replace(ssss[jss] + zretc.split(ssss[jss])[1].substring(0,4), prefis + ssss[jss] + zretc.split(ssss[jss])[1].substring(0,4) + suffis);
}
}
}
}

ssss=zretc.replace(/\.JS/g, '.js').split('.js');
if (eval('' + ssss.length) > 1) {
//alert('6:' + zretc);
for (jss=0; jss<ssss.length; jss++) {
if (eval('' + ssss[jss].length) > 1) {
suffis='';
prefis='';
if ((ssss[eval(1 + jss)] + ' ').substring(0,1) != ';') {
suffis=';';
}
if (ssss[jss].toLowerCase().indexOf('filescript:') == -1) {
if (jss == 0) {
prefis='filescript:';
} else if (ssss[jss].indexOf('.css;') != -1) {
zretc=zretc.replace('.css;', '.css;filescript:');
} else if (ssss[jss].indexOf('.CSS;') != -1) {
zretc=zretc.replace('.CSS;', '.CSS;filescript:');
} else if (ssss[jss].indexOf('.css') != -1) {
zretc=zretc.replace('.css', '.css;filescript:');
} else if (ssss[jss].indexOf('.CSS') != -1) {
zretc=zretc.replace('.CSS', '.CSS;filescript:');
} else if (ssss[jss].indexOf('HTTP') != -1) {
zretc=zretc.replace('HTTP', 'filescript:HTTP');
} else if (ssss[jss].indexOf('http') != -1) {
zretc=zretc.replace('http', 'filescript:http');
} else if (ssss[jss].indexOf('//') != -1) {
zretc=zretc.replace('//', 'filescript://');
} else if (ssss[jss].indexOf('www.') != -1) {
zretc=zretc.replace('www.', 'filescript://www.');
}
}
if ((prefis + suffis) != '') {
//alert('676:' + ssss[jss] + ' plus ' + zretc.split(ssss[jss])[1].substring(0,3) + ' from ' + zretc);
zretc=zretc.replace(ssss[jss] + zretc.split(ssss[jss])[1].substring(0,3), prefis + ssss[jss] + zretc.split(ssss[jss])[1].substring(0,3) + suffis);
}
}
}
//alert('66:' + zretc);
}

zretc=zretc.replace(/FILECSS\:/g, 'filecss:').replace(/FILESCRIPT\:/g, 'filescript:');
//alert('7:' + zretc);

ssss=zretc.split('filescript:');
for (jss=1; jss<ssss.length; jss++) {
if (ssss[jss].split(';')[0].indexOf('.JS') != -1) {
prefixingstuff+='filescript:' + ssss[jss].split(';')[0] + ';';
if (exdscriptstuff.indexOf(ssss[jss].split(';')[0]) == -1) {
exdscriptstuff+='<scr' + 'ipt type=text/javascript src="' + ssss[jss].split(';')[0] + '"></sCR' + 'IPT>';
}
} else {
if (exdscriptstuff.indexOf(ssss[jss].split(';')[0]) == -1) {
exdscriptstuff+='<scr' + 'ipt type=text/javascript src="' + ssss[jss].split(';')[0] + '"></sc' + 'ript>';
}
}
}

ssss=zretc.split('filecss:');
for (jss=1; jss<ssss.length; jss++) {
if (ssss[jss].split(';')[0].indexOf('.CSS') != -1) {
prefixingstuff+='filecss:' + ssss[jss].split(';')[0] + ';';
if (exdstylestuff.indexOf(ssss[jss].split(';')[0]) == -1) {
exdstylestuff+='<li' + 'nk type=text/css href="' + ssss[jss].split(';')[0] + '"></lI' + 'NK>';
}
} else {
if (exdstylestuff.indexOf(ssss[jss].split(';')[0]) == -1) {
exdstylestuff+='<li' + 'nk type=text/css href="' + ssss[jss].split(';')[0] + '"></li' + 'nk>';
}
}
}

if (wasprefixingstuff != prefixingstuff) {
try {
window.localStorage.removeItem('earth_scanner_externals');
} catch(anoops) {
}
//alert(prefixingstuff);
window.localStorage.setItem('earth_scanner_externals', encodeURIComponent(prefixingstuff));
//alert(window.localStorage.getItem('earth_scanner_externals'));
}


if (1 == 6 && wasexdscriptstuff != exdscriptstuff) {
}

if (1 == 6 && wasexdstylestuff != exdstylestuff) {
}


//alert('98:' + zretc);
return zretc.replace(/\;\ \;/g,';').replace(/\;\;/g,';');
}

function processcss(retc) {
var labels=[], ilab=0, thislab='';

if ((retc.trim() + ' ').substring(0,1) == '<' || retc.trim().toLowerCase().replace('.css','.js').indexOf('.js') != -1) {
retc=processinline(retc);
//alert('*' + retc + '*');
}

if (retc.indexOf(';') != -1 && retc.indexOf(':') != -1) {
if (eval('' + retc.indexOf(';')) > eval('' + retc.indexOf(':'))) {
thecss='';
thecssarg='';
while (eval('' + retc.indexOf(';')) > eval('' + retc.indexOf(':'))) {
thecss+=' ' + retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':' + retc.split(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':')[1].split(';')[0] + '; ';
labels=retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)].split('-');
thislab=labels[0].toLowerCase();
for (ilab=1; ilab<labels.length; ilab++) {
thislab+=labels[ilab].substring(0,1).toUpperCase() + labels[ilab].substring(1).toLowerCase();
}
try {
undos.push(" document.getElementById('myimg').style." + thislab + "='none';");
eval(" document.getElementById('myimg').style." + thislab + "='" + retc.split(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':')[1].split(';')[0] + "';");
} catch(hgfjh) {
}
retc=retc.replace(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':' + retc.split(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':')[1].split(';')[0] + ';', '');
}
if (thecss.replace('nocssplease',':').indexOf(':') != -1) {
thecssarg='?css=' + encodeURIComponent(thecss);
}
var cflds=thecss.split(':');
if (('' + window.localStorage.getItem('earth_scanner_css')).replace(/^null/g,'').replace(/^undefined/g,'') != '') {
window.localStorage.removeItem('earth_scanner_css');
}
if (cflds[eval(-1 + cflds.length)].trim() != '') {
window.localStorage.setItem('earth_scanner_css', encodeURIComponent(thecss));
} else {
thecss='';
thecssarg='';
if (eval('' + undos.length) > 0) {
for (ilab=0; ilab<undos.length; ilab++) {
eval('' + undos[ilab]);
}
undos=[];
}
}
}
} else if (retc.indexOf(';') == -1 && retc.replace('nocssplease',':').indexOf(':') != -1) {
if (retc.indexOf(':') != -1) {
retc=retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':';
retc=retc.replace('nocssplease','');
} else {
retc=retc.replace('nocssplease','');
}
if (('' + window.localStorage.getItem('earth_scanner_css')).replace(/^null/g,'').replace(/^undefined/g,'') != '') {
window.localStorage.removeItem('earth_scanner_css');
}
thecss='';
thecssarg='';
if (eval('' + undos.length) > 0) {
for (ilab=0; ilab<undos.length; ilab++) {
eval('' + undos[ilab]);
}
undos=[];
}
}
//alert(retc);
return retc;
}

… in the changed twentieth draft of the Earth Scanner web application for you to retry, again … yet again, where “the blurb” for “heads up” purposes now goes …

At prompt window, prefixing, and persevering, CSS map image styling available (and able to be turned off via nocssplease) eg. filter:sepia(74%); Or you can specify <style></style> non-persevering or <style></STYLE> persevering CSS of your own (or use a URL ending with .css) to begin with and/or <script></script> non-persevering or <script></SCRIPT> persevering Javascript of your own (or use a URL ending with .js) to begin with

Today’s animated GIF presentation shows us, at the prompt window, enter …

<style> span { font-style: italic; } </STYLE>

… which affected the Earth Scanner text look, then (a, for us, local MAMP external Javascript reference, which functioned up at the RJM Programming domain) …

HTTP://localhost:8888/newstuff.js

… and if it had been called http://localhost:8888/newstuff.JS it could have persevered.


Previous relevant Earth Scanner Image Styling Tutorial is shown below.

Earth Scanner Image Styling Tutorial

Earth Scanner Image Styling Tutorial

Today’s improvement on yesterday’s Earth Scanner Delimitation Cover Tutorial is simple on paper …

  • allow users to change the CSS styling of the map that is an image (img element) for our Earth Scanner …
  • but quite involved, to make work, in practice

Why? Well, we want a meaningful change, it having such big implications. And then there is the thought about whether it can or should be propagated through to any sharing or collaboration friends? Easy answer … yes. Because we cater for the nullifying of any of these image styling.

And can an image styling persevere to the next web browser session? Easy answer … yes. We’ve got HTTP Cookies, or what we’ve plumped for … Window localStorage … as alternatives, to allow for perseverence on a web browser platform, of your CSS image styling, between sessions.

Here are the various bits of Javascript contributing to the addition of this functionality …

  • get argument acceptance and variable cseplocans becomes global …

    var earth_scanner_css=location.search.split('css=')[1] ? (decodeURIComponent(location.search.split('css=')[1].split('&')[0]).replace(/\+/g,' ')) : '';
    var cseplocans='';
  • as used in the document.write equivalence to a usual document.body onload scenario …

    thecss=earth_scanner_css;
    if (thecss == '') {
    thecss=decodeURIComponent(('' + window.localStorage.getItem('earth_scanner_css')).replace(/^null/g,'').replace(/^undefined/g,''));
    } else if (thecss.replace('nocssplease',':').indexOf(':') != -1) {
    var cflds=thecss.split(':');
    if (('' + window.localStorage.getItem('earth_scanner_css')).replace(/^null/g,'').replace(/^undefined/g,'') != '') {
    window.localStorage.removeItem('earth_scanner_css');
    }
    if (cflds[eval(-1 + cflds.length)].trim() != '') {
    window.localStorage.setItem('earth_scanner_css', encodeURIComponent(thecss));
    } else {
    thecss='';
    thecssarg='';
    }
    }
    if (thecss.replace('nocssplease',':').indexOf(':') == -1) { thecss=''; } else { thecssarg='?css=' + encodeURIComponent(thecss); processcss(thecss); }


    document.write("<img src='/HTMLCSS/HYP_50M_SR_W.jpg' id=myimg width=" + eval(zoomf * 10800) + " height=" + eval(zoomf * 5400) + " style='margin:0 0 0 0;margin-left:10px;margin-top:10px;" + thecss + "'></img><div id=dstyle></div><input id=sdtitle type=hidden value='Earth Scanner'></input><input id=sdtext type=hidden value='Earth Scanner - RJM Programming'></input><input id=sdurl type=hidden value='" + document.URL.split('#')[0] + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'') + "'></input><iframe scrolling=no farmeborder=0 style='z-index:3456;position:fixed;top:55px;left:15px;width:30px;height:24px;' src='/HTMLCSS/web_share_api_test.html?emojize=128231'></iframe><input type=hidden id=itworked value=''></input><iframe onload=coordit(this); id=wif style=display:none;margin-left:50px; src='//wikipedia.org/wiki/Saint_George,_Antigua_and_Barbuda'></iframe><iframe onload=coordittwo(this); id=wiftwo style=display:none; src=></iframe><input type=hidden id=placegeo title='' value=''></input>" + atend);
  • start wrapping the Javascript prompt window where relevant

    cseplocans=cssprompt(ourblurb, defv);
  • in new wrapper function …

    function cssprompt(inb, ind) {
    var xretc=prompt(inb, ind);
    if (xretc != null) {
    xretc=processcss(xretc);
    }
    return xretc;
    }
  • calling a new user entry analysis Javascript function …

    function processcss(retc) {
    var labels=[], ilab=0, thislab='';
    if (retc.indexOf(';') != -1 && retc.indexOf(':') != -1) {
    if (eval('' + retc.indexOf(';')) > eval('' + retc.indexOf(':'))) {
    thecss='';
    thecssarg='';
    while (eval('' + retc.indexOf(';')) > eval('' + retc.indexOf(':'))) {
    thecss+=' ' + retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':' + retc.split(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':')[1].split(';')[0] + '; ';
    labels=retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)].split('-');
    thislab=labels[0].toLowerCase();
    for (ilab=1; ilab<labels.length; ilab++) {
    thislab+=labels[ilab].substring(0,1).toUpperCase() + labels[ilab].substring(1).toLowerCase();
    }
    try {
    undos.push(" document.getElementById('myimg').style." + thislab + "='none';");
    eval(" document.getElementById('myimg').style." + thislab + "='" + retc.split(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':')[1].split(';')[0] + "';");
    } catch(hgfjh) {
    }
    retc=retc.replace(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':' + retc.split(retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':')[1].split(';')[0] + ';', '');
    }
    if (thecss.replace('nocssplease',':').indexOf(':') != -1) {
    thecssarg='?css=' + encodeURIComponent(thecss);
    }
    var cflds=thecss.split(':');
    if (('' + window.localStorage.getItem('earth_scanner_css')).replace(/^null/g,'').replace(/^undefined/g,'') != '') {
    window.localStorage.removeItem('earth_scanner_css');
    }
    if (cflds[eval(-1 + cflds.length)].trim() != '') {
    window.localStorage.setItem('earth_scanner_css', encodeURIComponent(thecss));
    } else {
    thecss='';
    thecssarg='';
    if (eval('' + undos.length) > 0) {
    for (ilab=0; ilab<undos.length; ilab++) {
    eval('' + undos[ilab]);
    }
    undos=[];
    }
    }
    }
    } else if (retc.indexOf(';') == -1 && retc.replace('nocssplease',':').indexOf(':') != -1) {
    if (retc.indexOf(':') != -1) {
    retc=retc.split(':')[0].split(' ')[eval(-1 + retc.split(':')[0].split(' ').length)] + ':';
    retc=retc.replace('nocssplease','');
    } else {
    retc=retc.replace('nocssplease','');
    }
    if (('' + window.localStorage.getItem('earth_scanner_css')).replace(/^null/g,'').replace(/^undefined/g,'') != '') {
    window.localStorage.removeItem('earth_scanner_css');
    }
    thecss='';
    thecssarg='';
    if (eval('' + undos.length) > 0) {
    for (ilab=0; ilab<undos.length; ilab++) {
    eval('' + undos[ilab]);
    }
    undos=[];
    }
    }
    //alert(retc);
    return retc;
    }

… in the changed nineteenth draft of the Earth Scanner web application for you to retry, yet again … again.

And below are some image CSS styling ideas for you to try …


Previous relevant Earth Scanner Delimitation Cover Tutorial is shown below.

Earth Scanner Delimitation Cover Tutorial

Earth Scanner Delimitation Cover Tutorial

We find, further to yesterday’s Earth Scanner Map Image Margin Tutorial, with some long running programming projects, how you can get days, or whole periods, where either …

  • the day itself’s progress is a bit (or totally) sideways … or …
  • the day itself’s progress is a bit (or totally) sideways, because of something you decided some time back

… and we have that feeling about today, in that you might have realized days ago but we were in denial, or scared (rightly) about difficulties, that the idea of those …

  • ?
  • !

… delimitations from a couple of days ago were a bit irrelevant, when it was within our powers to decide, about a placename, whether it was a TimeZone one or not (and if not, try Wikipedia), so in that scenario, why not, behind the scenes, help out the user?

Indeed!

But it was difficult to rearrange things (especially regarding the timing, in the code, about these occurrences) as we did today, to allow this to happen, and it prompted us to try a prompt window entry …

Budgewoi,Alice Springs-Tennant Creek

(see Mum, no Delimiters!) entry, which plotted an all legs overlay, rather than channel the nuances in the minds of Budgewoi residents contemplating the trip to Alice Springs accompanying the crows?! The thing is, in defence of a user having to use delimiters (and, by the way, your more masochistic users can mention nohelp somewhere in the address bar, to not get delimiter assistance), is that, with all this, misspellings of placenames or Wikipedia URLs not getting you to geodata information, or there not being any, or the entries by the user not being straightforward, are still issues that can arise with the Earth Scanner … we’re just telling you for a friend … … Ssshhhh! Please don’t tell them we fixed the Budgewoi issue, else it’ll be more treats!

So sideways turns into crabways progress today, as we did add in more involved double click event logic for 🧭 compass leg emoji …


function glegit(iwhat) {
return '' + iwhat.getAttribute('data-tleg');
}

function windowopen(w1, w2, w3) {
var twoends=[], tzps=[];
if (gleg != '') {
twoends=gleg.split('.');
}
if (eval('' + twoends.length) > 1) {
w3='top=50,left=50,width=1000,height=900';
if (plottz[eval('' + twoends[0])].trim() != '' && plottz[eval('' + twoends[1])].trim() != '') {
w3='top=50,left=' + Math.floor(screenwidth / 3) + ',width=' + Math.floor(screenwidth / 3) + ',height=900';
window.open('//www.rjmprogramming.com.au/HTMLCSS/colour_wheel.html?mode=' + encodeURIComponent(plottz[eval('' + twoends[0])].trim()), '_blank','top=50,left=2,width=' + Math.floor(screenwidth / 3) + ',height=900');
window.open('//www.rjmprogramming.com.au/HTMLCSS/colour_wheel.html?mode=' + encodeURIComponent(plottz[eval('' + twoends[1])].trim()), '_blank','top=50,left=' + Math.floor(screenwidth * 2 / 3) + ',width=' + Math.floor(screenwidth / 3) + ',height=900');
} else if (plottz[eval('' + twoends[0])].trim() != '') {
w3='top=50,left=' + Math.floor(screenwidth / w) + ',width=' + Math.floor(screenwidth / 2) + ',height=900';
window.open('//www.rjmprogramming.com.au/HTMLCSS/colour_wheel.html?mode=' + encodeURIComponent(plottz[eval('' + twoends[0])].trim()), '_blank','top=50,left=2,width=' + Math.floor(screenwidth / 2) + ',height=900');
} else if (plottz[eval('' + twoends[1])].trim() != '') {
w3='top=50,left=5,width=' + Math.floor(screenwidth / 2) + ',height=900';
window.open('//www.rjmprogramming.com.au/HTMLCSS/colour_wheel.html?mode=' + encodeURIComponent(plottz[eval('' + twoends[1])].trim()), '_blank','top=50,left=' + Math.floor(screenwidth / 2) + ',width=' + Math.floor(screenwidth / 2) + ',height=900');
}
}
return window.open(w1, w2, w3);
}

… adding in interfacing to our Colour Wheel web application, in the changed eighteenth draft of the Earth Scanner web application for you to retry, yet again.


Previous relevant Earth Scanner Map Image Margin Tutorial is shown below.

Earth Scanner Map Image Margin Tutorial

Earth Scanner Map Image Margin Tutorial

We finally got around to addressing a bugbear we’ve had with our Earth Scanner web application, of recent times, right from its inception, regarding the small mismatch of overlayed HTML elements with the world map (image) underneath, improving on yesterday’s Earth Scanner Wikipedia Images Tutorial.

So, is it the chicken or the egg that should change? Neither, because the marmalade just crossed the road at the zebra crossing. And you don’t want to make the zebra mad, now … huh?!

Well, we figured, even just from a laziness perspective, it was easier to tinker with CSS margin-left and margin-top properties of the world map (image) element, and so got to, tweaking …


document.write("<img src='/HTMLCSS/HYP_50M_SR_W.jpg' id=myimg width=10800 height=5400 style='margin:0 0 0 0;margin-left:10px;margin-top:10px;'></img><div id=dstyle></div><input id=sdtitle type=hidden value='Earth Scanner'></input><input id=sdtext type=hidden value='Earth Scanner - RJM Programming'></input><input id=sdurl type=hidden value='" + document.URL.split('#')[0] + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'') + "'></input><iframe scrolling=no farmeborder=0 style='z-index:3456;position:fixed;top:55px;left:15px;width:30px;height:24px;' src='/HTMLCSS/web_share_api_test.html?emojize=128231'></iframe><input type=hidden id=itworked value=''></input><iframe onload=coordit(this); id=wif style=display:none;margin-left:50px; src='//wikipedia.org/wiki/Saint_George,_Antigua_and_Barbuda'></iframe><iframe onload=coordittwo(this); id=wiftwo style=display:none; src=></iframe><input type=hidden id=placegeo title='' value=''></input>" + atend);
document.body.title='' + document.title + String.fromCharCode(10) + ' ... at prompt ++ can make delay between snapshots slower and -- can make delay faster ' + String.fromCharCode(10) + ' ... at prompt > can hide time related information else < reveals again ' + String.fromCharCode(10) + ' ... comma lists of TimeZone places (suffix ? for Wikipedia ! forced), Country Codes, Country Names can be plotted via click or via hashtag use at address bar ' + String.fromCharCode(10) + ' ... suffix with space to show meridians and/or prefix to not show meridians ' + String.fromCharCode(10) + ' ... multiple place plotting is faster via comma separated {} annotated list (where, instead of comma, a minus - constructs Trip Leg between those places) ';
document.body.style.backgroundColor='rgba(0,0,255,0.5)';

… that last codeline trying to ameloriate that kludgy feeling change we felt compelled to make … though we all want to participate in the Sydney to Hobart Yacht Race, don’t we?!

And then further to yesterday’s Earth Scanner Wikipedia Images Tutorial, and continuing its theme, instead of Wikipedia images only for “TimeZone places” we extended the thinking to other places, where possible.

And then there was the checking of a couple of matters regarding sharing and collaboration code. It occurred to us the way we were starting to build up how long that “nontz” get argument might get to with all these non-timezone places, it occurred to us that it could start getting mapped back into the “purely clientside” location.hash mode of thinking, as per


var nontz=('' + location.search + ('' + location.hash).replace(/^\#/g,'')).split('nontz=')[1] ? decodeURIComponent(('' + location.search + ('' + location.hash).replace(/^\#/g,'')).split('nontz=')[1].split('&')[0].split('#')[0]) : '';

… so that we could rest easier. In amongst that initial “nontz” coding we added


plotplacepush=(locans.split('|')[0].replace(/\_/g,' '));

if (bigback.indexOf(plotplacepush + ':') == -1 && bigback.indexOf(plotplacepush.replace(/\ /g,'_') + ':') == -1 && nextwiftwo.indexOf(encodeURIComponent(plotplacepush)) == -1) {
if (wiftwoavailable) {
wiftwoavailable=false;
document.getElementById('wiftwo').src='/PHP/fgc/index.php?tzexact=&tznickname=' + encodeURIComponent(plotplacepush.replace(/\ /g,'_'));
} else {
nextwiftwo+='/PHP/fgc/index.php?tzexact=&tznickname=' + encodeURIComponent(plotplacepush.replace(/\ /g,'_')) + '#';
}
}


plotlongpush=(locans.split('|')[1].replace('_','-'));
plotlatpush=(locans.split('|')[2].replace('_','-'));

… so that our Hunters and Collectors “Do You See What I See?” can be more often in the affirmative in the changed seventeenth dolldraft of the Earth Scanner web application for you to retry, again.


Previous relevant Earth Scanner Wikipedia Images Tutorial is shown below.

Earth Scanner Wikipedia Images Tutorial

Earth Scanner Wikipedia Images Tutorial

Yesterday’s Earth Scanner Linear Gradient Leg Tutorial‘s use of Wikipedia geodata reminded us, again, of the incredible resource Wikipedia can be for the online world.

Wikipedia is a great resource for images of places too, and today, we add to the functionality of …

  • 📍
  • TimeZone place
  • onclick event

… “when ready” way we open a popup window displaying some of these images in a sort of collage relevant to the place 📍 pin you clicked, the main Javascript function “players” being …


var bigback='', nextwiftwo='', wiftwoavailable=true, wobi=null;

function woit(what) { // pin onclick event
if (what.trim() != '') {
if (bigback.indexOf(what + ':') != -1) {
if (wobi) {
if (!wobi.closed) { wobi.close(); }
}
wobi=window.open('', '_blank', 'top=50,left=50,width=900,height=800');
wobi.document.write(bigback.split(what + ':')[1].split('</div>')[0] + '</div>');
}
}
}

function coordittwo(xiois) { // Wikipedia image URLs gathered via iframe onload event
var xxaconto = (xiois.contentWindow || xiois.contentDocument);
if (xxaconto != null) {
if (xxaconto.document) { xxaconto = xxaconto.document; }
var xxacontobodyouterHTML=xxaconto.body.outerHTML.replace(/\"\;/g,'"');
if (xxacontobodyouterHTML.indexOf('.style.background="URL(') != -1) {
if (bigback.indexOf(xiois.src.split('tznickname=')[1].split('&')[0].split('#')[0] + ':') == -1) {
if (document.getElementById('span' + xiois.src.split('tznickname=')[1].split('&')[0].split('#')[0])) {
document.getElementById('span' + xiois.src.split('tznickname=')[1].split('&')[0].split('#')[0]).style.cursor='pointer';
}
bigback+=xiois.src.split('tznickname=')[1].split('&')[0].split('#')[0] + ':' + document.getElementById('ourcanvas').outerHTML.replace('<canvas','<div title="Images thanks to Wikipedia at https://wikipedia.org" ').replace('</canvas>','</div>').replace(':none;',':block;background:' + 'URL(' + xxacontobodyouterHTML.split('.style.background="URL(')[1].split('"')[0] + ';background-repeat:no-repeat;background-position:' + xxacontobodyouterHTML.split('.style.backgroundPosition="')[1].split('"')[0]);
}
}
wiftwoavailable=true;
if (nextwiftwo.split('#')[0] != '') {
xiois.src=nextwiftwo.split('#')[0];
nextwiftwo=nextwiftwo.replace(nextwiftwo.split('#')[0] + '#', '');
wiftwoavailable=false;
}
}
}

… in the changed sixteenth draft of the Earth Scanner web application for you to retry.


Previous relevant Earth Scanner Linear Gradient Leg Tutorial is shown below.

Earth Scanner Linear Gradient Leg Tutorial

Earth Scanner Linear Gradient Leg Tutorial

Onto yesterday’s Earth Scanner Question Delimiter Tutorial‘s progress, today, we have …

  • a linear gradient applied to the trip leg plotting … for …
    1. colour
    2. direction

    … purposes …
    <style>

    hr.hrright {
    background-image: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet);
    }

    hr.hrleft {
    background-image: linear-gradient(to left, red, orange, yellow, green, blue, indigo, violet);
    }

    </style>
    … and …

  • code for a new placename suffix delimiter …

    !

    … (in addition to “?”) to force the Wikipedia interpretation of geodata for a placename entered by the user … the orgainizing Javascript function now looking like …

    function dountilnoquestion() {
    var ibap=0, bap=[];
    caret='^';
    //document.title=gdefv;
    console.log('gdefv=' + gdefv);
    if (gdefv.trim() != gdefv.trim().replace(/\?$/g,'') || gdefv.indexOf('!?') != -1 || gdefv.indexOf('?!') != -1 || gdefv.indexOf('?{') != -1 || gdefv.indexOf('?,') != -1 || gdefv.indexOf('?-') != -1) {
    bap=gdefv.split('{');
    for (ibap=1; ibap<bap.length; ibap++) {
    if (bap[ibap].split('}')[0].indexOf('?') != -1) {
    gdefv=gdefv.replace(bap[ibap], bap[ibap].replace(/\?/g, '%3f'));
    }
    }
    //alert('gdefv=' + gdefv);
    // Alice Springs|133.87000|_23.70000^-Sydney?!
    curgdefv=gdefv.split('?')[0].split(',')[eval(-1 + gdefv.split('?')[0].split(',').length)].trim().replace(/^\[/g,'');
    //alert('Curgdefv=' + curgdefv);
    curgdefv=curgdefv.split('^')[eval(-1 + curgdefv.split('^').length)].replace(/^\-/g,'');
    //alert('curGdefv=' + curgdefv);
    if (curgdefv != curgdefv.replace(/\!$/g,'')) {
    caret='^ ';
    gdefv=gdefv.replace(curgdefv, curgdefv.replace(/\!$/g,''));
    //alert('1:' + gdefv);
    curgdefv=curgdefv.replace(/\!$/g,'');
    } else if (gdefv.indexOf(curgdefv + '?!') != -1) {
    caret='^ ';
    gdefv=gdefv.replace(curgdefv + '?!', curgdefv + '?');
    //alert('2:' + gdefv);
    curgdefv=curgdefv;
    }
    if (caret == '^ ' && yourtzlist.toLowerCase().indexOf('/' + curgdefv.toLowerCase().replace(/\ /g,'_') + '<') == -1) {
    caret='^';
    }
    }

    //alert('*' + caret + '*');


    if (caret == '^') {

    if (yourtzlist.toLowerCase().indexOf('/' + curgdefv.toLowerCase().replace(/\ /g,'_') + '<') != -1) {
    gdefv=gdefv.replace(curgdefv + '?', curgdefv + '^');
    if (gdefv.indexOf('?') == -1) {
    gdefv=gdefv.replace(/\^/g, '').replace(/\%3f/g, '?');
    //alert('gdefv=' + gdefv);
    scmok=true;
    movesallowed=true;
    gmovesallowed=true;
    five=5;
    gfive=5;
    document.getElementById('myimg').click(); //scmove();
    } else {
    setTimeout(dountilnoquestion, 1000);
    }
    } else {
    //alert('curgdefv=' + curgdefv);
    document.getElementById('placegeo').value=' ';
    document.getElementById('wif').src='/PHP/fgc/index.php?placegeo=' + encodeURIComponent(curgdefv.replace(/\ \(/g,', ').replace(/\)$/g,'')).replace(/\%20/g,'_');
    }

    } else if (caret == '^ ') {


    if (caret == '^' && yourtzlist.toLowerCase().indexOf('/' + curgdefv.toLowerCase().replace(/\ /g,'_') + '<') != -1) {
    gdefv=gdefv.replace(curgdefv + '?', curgdefv + '^');
    if (gdefv.indexOf('?') == -1) {
    gdefv=gdefv.replace(/\^/g, '').replace(/\%3f/g, '?');
    //alert('gdefv=' + gdefv);
    scmok=true;
    movesallowed=true;
    gmovesallowed=true;
    five=5;
    gfive=5;
    document.getElementById('myimg').click(); //scmove();
    } else {
    setTimeout(dountilnoquestion, 1000);
    }
    } else {
    //alert('curgdefv=' + curgdefv);
    document.getElementById('placegeo').value=' ';
    document.getElementById('wif').src='/PHP/fgc/index.php?placegeo=' + encodeURIComponent(curgdefv.replace(/\ \(/g,', ').replace(/\)$/g,'')).replace(/\%20/g,'_');
    }

    }
    }

… in the changed fifteenth draft of the Earth Scanner web application for you to retry.


Previous relevant Earth Scanner Question Delimiter Tutorial is shown below.

Earth Scanner Question Delimiter Tutorial

Earth Scanner Question Delimiter Tutorial

We’re adding another delimiter to those discussed in yesterday’s Earth Scanner Delimitation Tutorial, and it’s a doozy …

?

… (just quietly for now while we test for another day) … placed after a placename will …

  • first check if a TimeZone placename, and use that PHP timezone longitude and latitude should it find that to be the case … else …
  • will look to Wikipedia, thanks, for help, as available …

… for improvements on two fronts …

  1. a lot of us don’t know every timezone placename (but we expect you to know from tomorrow about 3?)
  2. Wikipedia has tons of useful geodata on lots of places brought into the Earth Scanner realms via this change …

    function coordit(xiois) {
    var xaconto = (xiois.contentWindow || xiois.contentDocument);
    if (xaconto != null) {
    try {
    if (xaconto.document) { xaconto = xaconto.document; }
    if (xaconto.body.innerHTML.indexOf('>Coordinates') != -1) {
    var subpart=xaconto.body.innerHTML.split('>Coordinates')[1];
    latdeg=-999;
    longdeg=-999;
    latmin=0;
    longmin=0;
    latsec=0;
    longsec=0;
    sparelat='';
    sparelong='';
    if (subpart.indexOf('"latitude"') != -1 && subpart.indexOf('"longitude"') != -1) {
    latdeg=subpart.split('"latitude"')[1].split('>')[1].split("°")[0].split('<')[0];
    sparelat=subpart.split('"latitude"')[1].split('>')[1].split('<')[0].slice(-1);
    latmin=subpart.split('"latitude"')[1].split('>')[1].split('<')[0].substring(eval(1 + eval('' + latdeg.length))).split("′")[0].split(sparelat)[0].split('<')[0];
    if (sparelat == 'S') { latdeg=eval(eval(eval(-1 * latmin) / 60) - latdeg); } else { latdeg+=eval(eval('' + latmin) / 60) }

    longdeg=subpart.split('"longitude"')[1].split('>')[1].split("°")[0].split('<')[0];
    sparelong=subpart.split('"longitude"')[1].split('>')[1].split('<')[0].slice(-1);
    longmin=subpart.split('"longitude"')[1].split('>')[1].split('<')[0].substring(eval(1 + eval('' + longdeg.length))).split("′")[0].split(sparelong)[0].split('<')[0];
    if (sparelong == 'W') { longdeg=eval(eval(eval(-1 * longmin) / 60) - longdeg); } else { longdeg+=eval(eval('' + longmin) / 60) }

    if (gdefv.indexOf(curgdefv + '?') != -1) {
    gdefv=gdefv.replace(curgdefv + '?', curgdefv + ('|' + longdeg).replace('|-','|_') + + ('|' + latdeg).replace('|-','|_') + '^');
    dountilnoquestion();
    }

    return true;

    } else if (('' + document.getElementById('placegeo').value).trim().indexOf(',') != -1) {
    latdeg=document.getElementById('placegeo').value.split(',')[eval(-2 + document.getElementById('placegeo').value.split(',').length)];
    longdeg=document.getElementById('placegeo').value.split(',')[eval(-1 + document.getElementById('placegeo').value.split(',').length)];

    if (gdefv.indexOf(curgdefv + '?') != -1) {
    gdefv=gdefv.replace(curgdefv + '?', curgdefv + ('|' + longdeg).replace('|-','|_') + ('|' + latdeg).replace('|-','|_') + '^');
    dountilnoquestion();
    }

    return true;
    }


    } else {

    if (('' + document.getElementById('placegeo').value).trim().indexOf(',') != -1) {
    latdeg=document.getElementById('placegeo').value.split(',')[eval(-2 + document.getElementById('placegeo').value.split(',').length)];
    longdeg=document.getElementById('placegeo').value.split(',')[eval(-1 + document.getElementById('placegeo').value.split(',').length)];

    if (gdefv.indexOf(curgdefv + '?') != -1) {
    gdefv=gdefv.replace(curgdefv + '?', curgdefv + ('|' + longdeg).replace('|-','|_') + ('|' + latdeg).replace('|-','|_') + '^');
    dountilnoquestion();
    }
    } else {
    if (gdefv.indexOf(curgdefv + '?') != -1) {
    gdefv=gdefv.replace(curgdefv + '?', curgdefv + '^');
    dountilnoquestion();
    }
    }

    }
    } catch(hgjg) { }
    }
    return true;
    }

… in a changed fourteenth draft of the Earth Scanner web application for you to retry.


Previous relevant Earth Scanner Delimitation Tutorial is shown below.

Earth Scanner Delimitation Tutorial

Earth Scanner Delimitation Tutorial

A lot of the data aspects to our latest Earth Scanner web application have relied on …

  • user reliability … and …
  • delimitation rules … less stringent for …
  • timezone places

Of course, we’d really like to automate more, but because we are not the repository of place geographicals data regarding placenames, except via PHP TimeZone derived ones, thanks, we don’t envisage a time with this web application, where for most places (which are not timezone places) that the user wants to specify and plot and perhaps form part of an itinerary schedule, they will be specifying longitude and latitude data. That is asking a bit of the user, as a lot of us will forget the order of these, and so of the two new data format syntaxes accepted, as of today, for examples regarding Alice Springs …

  1. Alice Springs 23.6980° S, 133.8807° E
    … as with this link
  2. Alice Springs|133.8807|-23.6980
    … as with this link

… the former of which, can have latitude and longitude order flexible, and determined via those N or S and W or E directionals, and we just copy off the Google webpage their presented syntax after the placename, optionally followed by a space.

We mention the second syntax above as the basis for our hashtagging inhouse logic, helping as a conduit towards communications for other parties.

Believe it or not with these nuances, at least for us, with the architecture of this Earth Scanner, is far from trivial, and it represents a salutary lesson regarding delimitation. It is best to have only one role for particular delimiter usage within your web application. It was overcomable for us, via context, to have in the Earth Scanner …

  • a minus “-” delimiter can be
    1. a negative aspect to latitude or longitude
    2. be a trip leg delimiter
    3. can be a character in a place name … and we hope we’ve covered off that it …
    4. can be a character in a country name
  • a comma “,” delimiter can be
    1. a separator of latitude or longitude or placename in some syntaxes
    2. a separator between placename and country name or country code
    3. a separator between some place plus geographicals syntaxes

… but life would have been easier with a one to one relationship between delimiter and role.

And so, further to yesterday’s Earth Scanner Placements Tutorial we have a changed thirteenth draft of the Earth Scanner web application for you to retry.


Previous relevant Earth Scanner Placements Tutorial is shown below.

Earth Scanner Placements Tutorial

Earth Scanner Placements Tutorial

You see that little play on words in today’s title, using …

Placements

? Where we meant “the specification, by placename, of latitude and longitude for a user defined place”? And so we decided not to give this blog posting the title …

Earth Scanner the specification, by placename, of latitude and longitude for a user defined place Tutorial

… because … cough, cough … that’s us …

  • succinct …
  • unable to find the place mats … tee hee … but …
  • ready to be “agile in place

Let’s go over the backstory. With our current Earth Scanner project, as far as placenames go, without a latitude or longitude specification, it’s best worked, so far, ever since Earth Scanner TimeZone Tutorial, with those placenames being TimeZone placenames, because …

PHP inspired TimeZone place lookup logic within the Javascript code

… were a freely available resource for us. But the users using our Earth Scanner are also a resource, and can supply prompt window entries such as …


[133.8807,-23.6980,Alice Springs]
… or …
… equivalent
in this case
regarding real mantissa …
remember rules?

133.8807,-23.6980,Alice Springs

… which now, further to yesterday’s Earth Scanner Itinerary Collaboration Tutorial, has the effect of …

This allows places other than TimeZone places be fully functional components in the logic for plotting and annotations and trip planning and itinerary construction purposes in our latest twelfth draft Earth Scanner web application.

Did you know?

As well as mantissa “kludge” we enjoy a good anti-dot . “kludge” every now and then. In a couple of “if” statements we now have


if (eval('' + ('' + locans.trim()).length) >= 3 && ('' + locans).indexOf(',') == -1 && yourtzlist.indexOf('/' + ('' + locans.trim()).replace(/\ /g,'_') + '<') != -1) { // code logic here }

... modifications, so that ...


var yourtzlist="<option value=\"GMT\" data-geo=\"51.4934,0.0098,GMT,GB,+0\">GMT</option><option value=\"Africa/Abidjan\" data-geo=\"5.31666,-4.03334,GMT,CI,+0\">Africa/Abidjan</option> ... blah blah blah ...";
var eventualyourtzlist=yourtzlist; // is appended with non TimeZone entries found, that follow ...
var realtz=true;

function retyour(propis) {
if (!realtz) {
return eventualyourtzlist;
}
return yourtzlist;
}

function yourtzlistindexOf(proposedplace) {
if (yourtzlist.indexOf(proposedplace) != -1) {
realtz=true;
return yourtzlist.indexOf(proposedplace);
} else if (eventualyourtzlist.indexOf(proposedplace) != -1) {
realtz=false;
return eventualyourtzlist.indexOf(proposedplace);
} else {
realtz=true;
}
return yourtzlist.indexOf(proposedplace);
}

... can help out.


Previous relevant Earth Scanner Itinerary Collaboration Tutorial is shown below.

Earth Scanner Itinerary Collaboration Tutorial

Earth Scanner Itinerary Collaboration Tutorial

It might be just us, but around here, we give ourselves a "leave pass", talking about ...

  • sharing ... much more than ...
  • collaborating

... because we see collaboration, as much to do with at least two parties being able to adjust a "thaing", whatever that may be, and we see sharing as maybe that, but also could be just edicts from above, broadcast out, with no meaningful active input from the people being sent the communication. And you see, this all comes about, because, as programmers, it's much easier to code for sharing ... it makes us look good?!

Up to yesterday, we would have to classify our efforts with our latest Earth Scanner project, in the realms of "Trip Itinerary" communications, as just being sharing, but where we said, yesterday ...

Well, it means a person travelling, could share their itinerary with someone, or have a collaborator fill in the gaps perhaps, and the context of it all can be shown on an interactive map.

... that "perhaps" was all there was, really, yesterday. But, today, we've had time to think of ways forward, and realized ...

  • off plotted (perhaps TimeZone) places ... we could add ...
  • revealed (ie. details/summary based) ...
    1. trip leg from annotation
    2. this place annotation
    3. trip leg to annotation

    ... textarea element(s) at which a collaborator becomes capable of adding itinerary detail and/or changing itinerary detail ...

    function panno(bec, idx) {
    if (plotanno[idx] != bec.replace(/\`/g, '"')) {
    plotanno[idx]=bec.replace(/\`/g, '"').replace(/\{/g, '[').replace(/\}/g, ']');
    newhashit();
    }
    }

    function lganno(bec, idx) {
    if (legsanno[idx] != bec.replace(/\`/g, '"')) {
    legsanno[idx]=bec.replace(/\`/g, '"').replace(/\{/g, '[').replace(/\}/g, ']');
    newhashit();
    }
    }

    function doplotplace(ipl, maybeg) {
    var jpl=0, detbegin='', detend='', nearend='', textras='', legend='', prelegend='', ileg=0;
    var thisclock='', nonclock='', aclocl='', thatplace='', utzdate=null, tzDate=null, xdiff=0, xdate1=null;
    if (!reveal) {
    detbegin='<details onclick="reveal=!reveal;"><summary></summary>';
    detend='</details>';
    } else {
    detbegin='<details open onclick="reveal=!reveal;"><summary>';
    detend='</summary></details>';
    }
    if (plotcc[ipl].trim() && plottz[ipl].trim() != '') { // && plotplace[ipl].indexOf(':') == -1) {
    //alert(plotplace[ipl]);
    //alert(plotct[ipl]);
    //alert(plotemj[ipl]);
    if (maybeg == 'g') {
    for (ileg=0; ileg<legs.length; ileg++) {
    if (('~' + legs[ileg] + '~').indexOf('~' + ipl + '.') != -1) {
    jpl=eval(('~' + legs[ileg] + '~').split('~' + ipl + '.')[1].split('~')[0]);
    legend+='<details onclick="event.stopPropagation();" title="Annotations for Leg from ' + plotplace[ipl].replace(/\_/g,' ') + ' ' + orflag(plotcc[ipl]) + ' to ' + plotplace[jpl].replace(/\_/g,' ') + ' ' + orflag(plotcc[jpl]) + ' ..."><summary class=lanno> --> ' + plotplace[jpl].replace(/\_/g,' ') + ' ' + orflag(plotcc[jpl]) + '</summary><textarea class=txleg onclick="event.stopPropagation();" rows=9 cols=40 onblur="lganno(this.value,' + ileg + ');">' + legsanno[ileg].replace(/\"/g,'`') + '</textarea></details>';
    }
    if (('~' + legs[ileg] + '~').indexOf('.' + ipl + '~') != -1) {
    jpl=eval(('~' + legs[ileg] + '~').split('.' + ipl + '~')[0].split('~')[1]);
    prelegend+='<details onclick="event.stopPropagation();" title="Annotations for Leg from ' + plotplace[jpl].replace(/\_/g,' ') + ' ' + orflag(plotcc[jpl]) + ' to ' + plotplace[ipl].replace(/\_/g,' ') + ' ' + orflag(plotcc[ipl]) + ' ..."><summary class=lanno>' + plotplace[jpl].replace(/\_/g,' ') + ' ' + orflag(plotcc[jpl]) + ' --></summary><textarea class=txleg onclick="event.stopPropagation();" rows=9 cols=40 onblur="lganno(this.value,' + ileg + ');">' + legsanno[ileg].replace(/\"/g,'`') + '</textarea></details>';
    }
    }
    if (bmeridian.indexOf(' id="div' + plotlong[ipl] + plotlat[ipl] + '"') != -1) {
    textras=bmeridian.split(' id="div' + plotlong[ipl] + plotlat[ipl] + '"')[1].split('>')[0].replace(/\"$/g, String.fromCharCode(10) + plotanno[ipl].replace(/\"/g,'`') + '"');
    } else {
    textras=' title="' + plotanno[ipl].replace(/\"/g,'`') + '"';
    }
    nearend='<div id="div' + plotlong[ipl] + plotlat[ipl] + '"' + textras + '>' + prelegend + '<details onclick="event.stopPropagation();" title="Annotations for ' + plotplace[ipl].replace(/\_/g,' ') + ' ' + orflag(plotcc[ipl]) + ' ..."><summary class=panno>&#128395;</summary><textarea class=txplc onclick="event.stopPropagation();" rows=9 cols=40 onblur="panno(this.value,' + ipl + ');">' + plotanno[ipl].replace(/\"/g,'`') + '</textarea></details>' + legend + '</div>';

    thatplace=plottz[ipl];
    utzdate=new Date();
    tzDate = new Date(utzdate.toLocaleString('en-US', { timeZone: thatplace.replace('GMT','UTC').replace(/\ /g,'_') }));
    xdiff = Math.abs(tzDate.getTime() - gutcDate.getTime()) / 3600000;
    xdate1=new Date().toLocaleString("en-US", { timeZone: thatplace.replace('GMT','UTC').replace(/\ /g,'_') });
    if (xdiff > 0 && (eval('' + utzdate.getDay()) == 0 && eval('' + tzDate.getDay()) == 6 || eval('' + utzdate.getDay()) > eval('' + tzDate.getDay()))) {
    xdiff=-xdiff;
    }
    xextraemj=',' + clockit('' + xdiff);
    plotct[ipl]=('' + xdate1);
    plotemj[ipl]=(clockit('' + xdiff));
    }
    if (plotemj[ipl].indexOf('pm') != -1) {
    aclock=plotemj[ipl].split('pm')[0];
    nonclock=plotemj[ipl].split(aclock)[1];
    thisclock='<span class=pm>' + aclock + '</span>';
    return plotplace[ipl] + ' ' + orflag(plotcc[ipl]) + detbegin + '<br>' + plotct[ipl] + '<br>' + thisclock + nonclock + nearend + detend;
    }
    return plotplace[ipl] + ' ' + orflag(plotcc[ipl]) + detbegin + '<br>' + plotct[ipl] + '<br>' + plotemj[ipl] + nearend + detend;
    }
    return plotplace[ipl];
    }

    ... (happily now not needing to know the "behind the scenes" delimitation is {} ... in fact we map to [] here if a user uses these characters in a textarea element) ... then ...

  • resend to other collaborator the ideas for further collaborations the other way around ... purrrrrrrrrhaps?

... improving on yesterday's Earth Scanner Sharing Itinerary Detail Tutorial with our latest eleventh draft (dedicated to "Legs XI") Earth Scanner web application, we hope.


Previous relevant Earth Scanner Sharing Itinerary Detail Tutorial is shown below.

Earth Scanner Sharing Itinerary Detail Tutorial

Earth Scanner Sharing Itinerary Detail Tutorial

Further to yesterday's Earth Scanner Sharing Tutorial, today, we were ...

  • more than half expecting that for web browsers where navigator.canShare comes up with true (eg. Safari), supporting the Web Share API on a https:// protocol, we'd be saying for our tests involving faux itineraries (with much more than a thousand characters) being processed via a ...

    Have most of the data be stored in the hash part of the "URL"

    ... approach, that it worked back with our latest tenth draft Earth Scanner web application incarnation, but ...

  • we weren't expecting to be saying that web browsers where navigator.canShare comes up with false (eg. Google Chrome), not supporting the Web Share API, we'd be saying for our tests involving faux itineraries (with much more than a thousand characters) being processed via a ...

    Have most of the data be stored in the hash part of the "URL"

    ... approach, that it worked back with our latest Earth Scanner incarnation, but it did!

The thing to note is that the data should be hashtagged, rather than formed into ? and & "get" arguments which end up with a web server somewhere. This also means a serverside language, such as PHP (where we'd often be involving HTML form method=POST scenarios by now), may never be needed with this Earth Scanner project we are currently engaged in, and we do prefer to talk just HTML and Javascript and CSS to be able to share code with more readers out there. Hashtagging is purely client side work. Guess we'd never tried any "a" "mailto:" URLs of huge length, mainly taken up by hashtagging data?! Anyway, we are very pleased, and still think the Web Share API logic is worth keeping in, because of all the sharing options other than email presented, when this API is in full swing.

And what is the point here? Well, it means a person travelling, could share their itinerary with someone, or have a collaborator fill in the gaps perhaps, and the context of it all can be shown on an interactive map. They could base a trip leg on the paradigm (using the Earth Scanner click prompt window) ...

TimezonePlaceFrom{eg. accomodation details, dates of stay, meeting details}-{eg. flight or road or rail or walking or sailing trip details, timezone issues}TimezonePlaceTo{eg. accomodation details, dates of stay, meeting details}

... model, where {} are the Earth Scanner's annotation delimiters (we'd really like you to avoid within your annotations). So far?!

Stop Press

As Hunters and Collectors asked ...

Do you see what I see?

... well, this is what we saw making today's tutorial's animated GIF presentation ... and so ... Do you see what I see?


Previous relevant Earth Scanner Sharing Tutorial is shown below.

Earth Scanner Sharing Tutorial

Earth Scanner Sharing Tutorial

Another day, another API interfacing with our Earth Scanner web application from yesterday's Earth Scanner Window Focus Tutorial.

This time around, it is the turn of Web Share API to help us with our aim to introduce some ...

  • email ... and/or ...
  • SMS

... sharing logic into play. When "sharing" is talked about at this blog, we do not always resort to interfacing to the Web Share API. Even so, when it works, this Web Share API works very usefully, but does not work everywhere. So why the interest today, even so? Well, we have more testing to know for sure, so that answer will be for tomorrow.

Where navigator.canShare comes up with false we fall through to the usual ...

  • email via "a" "mailto:" link usage ... and/or ...
  • SMS via "a" "sms:" link usage

... methodologies, feeding off the {} delimited annotations the user can now apply behind ...

  • placenames (best with timezone places)
  • leg delimiters ... to or - or from

... you can see us using in today's animated GIF presentation. Why not just use this methodology everywhere? Well, we have more testing to know for sure, so that answer will be for tomorrow.

Reading this, feel free to try our changed ninth draft Earth Scanner web application, it now having a new "create a hashtag part to the email/SMS URL" (taking into account the newly populated plotanno[] and legsanno[] arrays) function, as per ...


function newhashit() {
var newh='#', legi=0, interim='';
if (document.getElementById('sdurl')) {
var washash='';
if (document.getElementById('sdurl').value.indexOf('#') != -1) {
washash='#' + document.getElementById('sdurl').value.split('#')[1];
}
for (var ii=0; ii<plotplace.length; ii++) {
if ((plotplace[ii] + ' ').toUpperCase().substring(0,1) >= 'A' && (plotplace[ii] + ' ').toUpperCase().substring(0,1) <= 'Z') {
if (newh == '#') {
if (plotanno[ii].trim() != '') {
newh+=encodeURIComponent(plotplace[ii].replace(/\ /g,'_').split(',_')[0] + '{' + plotanno[ii] + '}');
} else if (legc.indexOf(',' + eval(-1 + ii) + '.' + eval(0 + ii) + ',') != -1) {
legi=legs.indexOf('' + eval(-1 + ii) + '.' + eval(0 + ii) + '');
if (legi == -1) {
newh+=encodeURIComponent('-') + encodeURIComponent(plotplace[ii].replace(/\ /g,'_').split(',_')[0]);
} else if (legsanno[legi].trim() != '') {
newh+=encodeURIComponent('-{' + legsanno[legi] + '}') + encodeURIComponent(plotplace[ii].replace(/\ /g,'_').split(',_')[0]);
} else {
newh+=encodeURIComponent('-') + encodeURIComponent(plotplace[ii].replace(/\ /g,'_').split(',_')[0]);
}
} else {
newh+=encodeURIComponent(',') + encodeURIComponent(plotplace[ii].replace(/\ /g,'_').split(',_')[0]);
}
} else if (plotplace[ii].trim() != '') {
interim=encodeURIComponent(plotplace[ii].replace(/\ /g,'_').split(',_')[0]);
if (plotanno[ii].trim() != '') {
interim=encodeURIComponent(plotplace[ii].replace(/\ /g,'_').split(',_')[0] + '{' + plotanno[ii] + '}');
}
if (legc.indexOf(',' + eval(-1 + ii) + '.' + eval(0 + ii) + ',') != -1) {
legi=legs.indexOf('' + eval(-1 + ii) + '.' + eval(0 + ii) + '');
if (legi == -1) {
newh+=encodeURIComponent('-') + interim;
} else if (legsanno[legi].trim() != '') {
newh+=encodeURIComponent('-{' + legsanno[legi] + '}') + interim;
} else {
newh+=encodeURIComponent('-') + interim;
}
} else {
newh+=encodeURIComponent(',') + interim;
}
}
}
}
if (newh != lasthcalc && newh != '#' && newh != washash) {
document.getElementById('sdurl').value=document.getElementById('sdurl').value.split('#')[0] + '#' + newh.substring(1).replace(/^\%2C/g,'');
lasthcalc=newh;
}
}
}

... and helped out by ...


Previous relevant Earth Scanner Window Focus Tutorial is shown below.

Earth Scanner Window Focus Tutorial

Earth Scanner Window Focus Tutorial

The Page Visibility API has opened up possibilities from within Javascript, to monitor the toing and froing to and/or from your web applications in the modern web browsers. We think the Earth Scanner web application of yesterday's Making of Earth Scanner Legs Tutorial could benefit from some Page Visibility API Javascript logic, and where we tend to inform the user is with ...

  • document.title (as displayed on the web browser tab, of relevance) ... showing ...
  • Page Visibility API findings ... perhaps involving ...
  • date timestamps

And how, practically, in our changed eighth draft Earth Scanner web application, did we act should we make the discovery, with this Page Visibility API code ...


var firstopn=true;
var gmovesallowed=movesallowed, gfive=five;
var playing=false, restart=false;

function myFunction(opening) {
if (opening) {
document.body.style.backgroundColor='lightgreen';
if (!playing && restart) {
//document.title='Restarting video play at ' + document.URL + ' at ' + ('' + new Date()) + '.';
if (firstopn && eval('' + plotplace.length) > 0) {
if (plotplace[eval(-1 + plotplace.length)].trim() != '') {
lastdtplace='' + plotplace[eval(-1 + plotplace.length)];
document.title='' + plotplace[eval(-1 + plotplace.length)] + ' ... ';
}
}
movesallowed=gmovesallowed; five=gfive; //document.getElementById('main-video').play();
playing=true;
} else {
//alert('2:' + document.title);
movesallowed=gmovesallowed; five=gfive; //document.getElementById('main-video').play();
document.title=(document.title + ' ... ').split(' ... ')[0] + ' ... ' + 'Welcome back to Earth Scanner at ' + ('' + new Date()) + '.';
}
restart=false;
} else {
document.body.style.backgroundColor='yellow';
if (playing) {
movesallowed=false; five=0; // document.getElementById('main-video').pause();
playing=false;
restart=true;
document.title=(document.title + ' ... ').split(' ... ')[0] + ' ... ' + 'Paused Earth Scanner at ' + ('' + new Date()) + '.';
} else {
//alert('0:' + document.title);
movesallowed=false; five=0; // document.getElementById('main-video').pause();
document.title=(document.title + ' ... ').split(' ... ')[0] + ' ... ' + 'You left Earth Scanner at ' + ('' + new Date()) + '.';
}
}
//alert(0);
firstopn=false;
}

function myCloseFunction() {
if (document.visibilityState === "hidden") {
if (playing) {
movesallowed=false; five=0; // document.getElementById('main-video').pause();
playing=false;
restart=true;
document.title=(document.title + ' ... ').split(' ... ')[0] + ' ... ' + 'Paused Earth Scanner at ' + ('' + new Date()) + '.';
} else {
//alert('1:' + document.title);
movesallowed=false; five=0; // document.getElementById('main-video').pause();
document.title=(document.title + ' ... ').split(' ... ')[0] + ' ... ' + 'You Left Earth Scanner at ' + ('' + new Date()) + '.';
}
document.body.style.backgroundColor='yellow';
} else {
myFunction(true);
}
}


//
// and down after the document.write() ... remember "no body" ... sort of "just javascript" ...
//
document.onvisibilitychange = function() {
if (document.visibilityState === "hidden") {
document.title=(document.title + ' ... ').split(' ... ')[0] + ' ... ' + 'You Left ' + document.URL + ' At ' + ('' + new Date()) + '.'
document.body.style.backgroundColor='yellow';
if (playing) {
movesallowed=false; five=0; // document.getElementById('main-video').pause();
playing=false;
restart=true;
document.title=(document.title + ' ... ').split(' ... ')[0] + ' ... ' + 'Paused URL at ' + document.URL + ' at ' + ('' + new Date()) + '.';
} else {
movesallowed=false; five=0; // document.getElementById('main-video').pause();
document.title=(document.title + ' ... ').split(' ... ')[0] + ' ... ' + 'You Left ' + document.URL + ' At ' + ('' + new Date()) + '.';
}
} else {
myFunction(true);
}
};

document.onpagehide = function() {
if (document.visibilityState === "hidden") {
document.title=(document.title + ' ... ').split(' ... ')[0] + ' ... ' + 'You Left Earth Scanner at ' + ('' + new Date()) + '.';
document.body.style.backgroundColor='yellow';
if (playing) {
movesallowed=false; five=0; // document.getElementById('main-video').pause();
playing=false;
restart=true;
document.title=(document.title + ' ... ').split(' ... ')[0] + ' ... ' + 'Paused Earth Scanner at ' + ('' + new Date()) + '.';
}
movesallowed=false; five=0; // document.getElementById('main-video').pause();
} else {
myFunction(true);
}
};

document.body.onvisibilityChange=function() { myCloseFunction(); };
document.body.onpageHide=function() { myFunction(false); };
document.body.onpageShow=function() { myFunction(true); };

... that a user has been distracted from the unmissable moments of Earth Scanner usage , heaven forbid? We try to slow it down, so that when they come back , praise be, things have not moved on to irrelevance, as often.

If all this sounds familiar, perhaps you were reading Applying Onpageshow and Onpagehide and Onvisibilitychange Events Tutorial when we were last talking about this excellent feature, when we were applying it to the playing or pausing of videos. Of particular relevance might be ...

  1. onpageshow (at same time as document.body onload event) … opening … versus … closing …
  2. onpagehide (we had little success with this event) … and we had more success with …
  3. onvisibilitychange (in conjunction with document.visibilityState === “hidden” we succeeded)


Previous relevant Making of Earth Scanner Legs Tutorial is shown below.

Making of Earth Scanner Legs Tutorial

Making of Earth Scanner Legs Tutorial

Quite often within the I.T. wooooorrrrrllllddd it is when we have an idea that is ...

Just a Bit of Fun

... more than likely ...

  1. this is code for ... it will end up being difficult to achieve ... and in that same way ...
  2. often you'll learn a lot trying to make it happen

What we wanted regarding yesterday's Earth Scanner Legs Tutorial blog posting initial draft, where we had ...


New York-Los Angeles

... in HTML code ...


<code><a target=_blank id=ahash style='display:inline-block;' href="https://www.rjmprogramming.com.au/HTMLCSS/earth_scanner.html#New%20York-Los%20Angeles">New York-Los Angeles</a></code>

... we really wanted to prefix some content that ...

  • showed as ... #
  • on hover showed ... 🎶 ... for the heads up that a click might play ...
  • Patsy Gallant's From New York to LA via YouTube ... initially envisaging just audio ... but the Google Chrome web browser, at least (while others are good too) is far better than this ...

We expected mobile might be different, and yes, we achieved less here, but we could open a popup the user can click a play button regarding. With non-mobile, if your browser allows the "autoplay" feature for the "rjmprogramming.com.au" domain, you only need to click the "#" link to hear Patsy sing the song once over. But there's more with Google Chrome, at least, supplying a "right of address bar" up the top "musical notes" button leading to ...

  • usual video and/or audio media controls ...
  • "In Picture" playing of the YouTube video behind the audio ... and/or ...
  • "Live Captions" for that "Karaoke Feel"

... and so, that was all a pleasant surprise for us, because, of course, there were "Internal Use Only" issues. We'd not noticed a "Mixed Content" call we were making in amongst our "YouTube Video Interfacing Karaoke Style Play" web application code in the changed stop_start_youtube.html helper of the changed karaoke_youtube_api.htm inhouse YouTube video interfacer, and we needed to add in logic for the use of a new "justaudio" argument.

That's one part of the equation, and the other was back at the blog posting "code" element coding, as below, where its HTML innards became ...


<code><span id=shash data-cp=127926 onmouseover="if (this.title == 'Might play music ...') { this.title=String.fromCodePoint(127926); setInterval(function() { if (document.getElementById('shash').innerHTML.indexOf('<') == -1) { if (eval('' + event.target.getAttribute('data-cp')) == 35) { document.getElementById('shash').innerHTML=String.fromCharCode(eval('' + document.getElementById('shash').getAttribute('data-cp'))); document.getElementById('shash').setAttribute('data-cp','127926'); } else { document.getElementById('shash').innerHTML=String.fromCodePoint(eval('' + document.getElementById('shash').getAttribute('data-cp'))); document.getElementById('shash').setAttribute('data-cp','35'); } } }, 5000); }" title='Might play music ...' style=display:inline-block;cursor:pointer;text-decoration:underline; onclick="this.innerHTML+='<iframe style=display:inline-block;width:50px;height:50px;display:none; src=//www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?justaudio=%23&youtubeid=kUI_P5eMVLo&youtube_duration=&email=&emoji=on>#</iframe>'; if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { document.getElementById('ahash').click(); window.open('//www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?youtubeid=kUI_P5eMVLo&youtube_duration=202.221&email=&email=&emoji=on&c0=on&i0=0&j0=202.221&i1=&j1=&i2=&j2=&i3=&j3=&i4=&j4=&i5=&j5=&i6=&j6=&i7=&j7=&i8=&j8=&i9=&j9=&i10=&j10=&i11=&j11=&i12=&j12=&i13=&j13=&i14=&j14=&i15=&j15=&i16=&j16=&i17=&j17=&i18=&j18=&i19=&j19=&i20=&j20=&i21=&j21=&i22=&j22=&i23=&j23=&i24=&j24=&i25=&j25=&i26=&j26=&i27=&j27=&i28=&j28=&i29=&j29=','_blank','top=50,left=50,width=800,height=800'); } ">#</span><a target=_blank id=ahash style='display:inline-block;' href="https://www.rjmprogramming.com.au/HTMLCSS/earth_scanner.html#New%20York-Los%20Angeles">New York-Los Angeles</a>
</code>

Happy listening ... etcetera, etcetera, etcetera!


Previous relevant Earth Scanner Legs Tutorial is shown below.

Earth Scanner Legs Tutorial

Earth Scanner Legs Tutorial

Of course, yes, there's a part of me that hoped today's tutorial in its thread of related blog postings, would line up with the 11th draft of our Earth Scanner web application of yesterday's Earth Scanner Hashtag Lists Tutorial, and then we could have made some lame joke about "Legs 11", but we've grown up a lot since then, and even some reference to "Legs XI" can't quite bring us around. Enjoy the sobriety (until the 11th draft, that is)?!

So, the "legs" we're referring to today are like a ...

Trip Leg

... a concept of interest to lots of people. Most of us make trips every day, and in our Earth Scanning web application we harness the great Google Directions link to make suggestions about how you might undertake your trip leg. It's a simple case of replacing any commas in your (perhaps timezone) list with minus sign(s) to start seeing trip legs, such as ...

#New York-Los Angeles

... either at the Javascript prompt window or with the address bar hashtag arrangements, which might end up calling ...


function plotleg(thisleg, smlong, lglat, lglong, smlat) {
var brgtoset=0.0, disttoset=0.0, gbrgtoset=0.0, gdisttoset=0.0;
if (1 == 1) {
disttoset=Math.sqrt((eval(0 + eval(eval('' + plotlong[eval(thisleg.split('.')[0])]) - smlong) / eval(lglong - smlong) * eval(screenwidth)) - eval(0 + eval(eval('' + plotlong[eval(thisleg.split('.')[1])]) - smlong) / eval(lglong - smlong) * eval(screenwidth))) * (eval(0 + eval(eval('' + plotlong[eval(thisleg.split('.')[0])]) - smlong) / eval(lglong - smlong) * eval(screenwidth)) - eval(0 + eval(eval('' + plotlong[eval(thisleg.split('.')[1])]) - smlong) / eval(lglong - smlong) * eval(screenwidth))) + (eval(0 + eval(eval(lglat - eval('' + plotlat[eval(thisleg.split('.')[0])])) / eval(lglat - smlat) * eval(screenheight))) - eval(0 + eval(eval(lglat - eval('' + plotlat[eval(thisleg.split('.')[1])])) / eval(lglat - smlat) * eval(screenheight)))) * (eval(0 + eval(eval(lglat - eval('' + plotlat[eval(thisleg.split('.')[0])])) / eval(lglat - smlat) * eval(screenheight))) - eval(0 + eval(eval(lglat - eval('' + plotlat[eval(thisleg.split('.')[1])])) / eval(lglat - smlat) * eval(screenheight)))));
}
gdisttoset=great_circle_distance(plotlat[eval(thisleg.split('.')[0])], plotlong[eval(thisleg.split('.')[0])], plotlat[eval(thisleg.split('.')[1])], plotlong[eval(thisleg.split('.')[1])]);
gdisttoset=great_circle_distance(plotlat[eval(thisleg.split('.')[0])], plotlong[eval(thisleg.split('.')[0])], plotlat[eval(thisleg.split('.')[1])], plotlong[eval(thisleg.split('.')[1])]);
var meanlong=eval(0 + eval(eval('' + plotlong[eval(thisleg.split('.')[0])]) - smlong) / eval(lglong - smlong) * eval(screenwidth));
var meanlat=eval(0 + eval(eval(lglat - eval('' + plotlat[eval(thisleg.split('.')[0])])) / eval(lglat - smlat) * eval(screenheight)));
brgtoset=Math.atan2(eval(0 + eval(eval(lglat - eval('' + plotlat[eval(thisleg.split('.')[1])])) / eval(lglat - smlat) * eval(screenheight))) - meanlat, eval(0 + eval(eval('' + plotlong[eval(thisleg.split('.')[1])]) - smlong) / eval(lglong - smlong) * eval(screenwidth)) - meanlong) * 180 / Math.PI;
meanlong+=eval(0 + eval(eval('' + plotlong[eval(thisleg.split('.')[1])]) - smlong) / eval(lglong - smlong) * eval(screenwidth))
meanlong/=2.0;
meanlat+=eval(0 + eval(eval(lglat - eval('' + plotlat[eval(thisleg.split('.')[1])])) / eval(lglat - smlat) * eval(screenheight)));
meanlat/=2.0;
console.log(thisleg + ' ' + brgtoset + ' ' + thisleg + ' ... ' + plotlat[eval(thisleg.split('.')[0])] + ',' + plotlong[eval(thisleg.split('.')[0])] + ' to ' + plotlat[eval(thisleg.split('.')[1])] + ',' + plotlong[eval(thisleg.split('.')[1])]);
bmeridian+='<hr onclick="event.stopPropagation(); canlooknow=false; clearwo(); wo=window.open(' + "'//www.google.com/maps/dir/" + encodeURIComponent(plotplace[eval(thisleg.split('.')[0])]) + '/' + encodeURIComponent(plotplace[eval(thisleg.split('.')[1])]) + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; " ondblclick="event.stopPropagation(); canlooknow=false; clearwo(); wo=window.open(' + "'//www.google.com/maps/dir/" + plotlat[eval(thisleg.split('.')[0])] + ',' + plotlong[eval(thisleg.split('.')[0])] + '/' + plotlat[eval(thisleg.split('.')[1])] + ',' + plotlong[eval(thisleg.split('.')[1])] + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; " title="' + plotplace[eval(thisleg.split('.')[0])] + ' to ' + plotplace[eval(thisleg.split('.')[1])] + ' has the crow flying (' + gbrgtoset + ' degrees setting off at versus on Mercator Projection ...) ' + eval(eval(brgtoset + 450) % 360) + ' degrees for ' + eval(gdisttoset / 1000.0) + ' kilometers. Click (for placename) or double click (for geographicals) to open a Google Directions window." class=leg style="transform:rotate(' + eval(eval('' + brgtoset) - 0) + 'deg);z-index:975;opacity:0.3;position:fixed;top:' +
meanlat +
'px;left:' +
eval(meanlong - disttoset / 2) +
'px;background-color:rgba(255,0,0,0.5);width:' + disttoset + 'px;height:6px;"></hr><span onclick="event.stopPropagation(); canlooknow=false; clearwo(); wo=window.open(' + "'//www.google.com/maps/dir/" + encodeURIComponent(plotplace[eval(thisleg.split('.')[0])]) + '/' + encodeURIComponent(plotplace[eval(thisleg.split('.')[1])]) + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; " ondblclick="event.stopPropagation(); canlooknow=false; clearwo(); wo=window.open(' + "'//www.google.com/maps/dir/" + plotlat[eval(thisleg.split('.')[0])] + ',' + plotlong[eval(thisleg.split('.')[0])] + '/' + plotlat[eval(thisleg.split('.')[1])] + ',' + plotlong[eval(thisleg.split('.')[1])] + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; " title="' + plotplace[eval(thisleg.split('.')[0])] + ' to ' + plotplace[eval(thisleg.split('.')[1])] + ' has the crow flying (' + gbrgtoset + ' degrees setting off at versus on Mercator Projection ...) ' + eval(eval(360 - brgtoset) % 360) + ' degrees for ' + eval(gdisttoset / 1000.0) + ' kilometers. Click (for placename) or double click (for geographicals) to open a Google Directions window." class=leg style="cursor:pointer;font-size:6px;z-index:976;margin-top:6px;margin-left:-6px;position:fixed;top:' + meanlat + 'px;left:' + meanlong + 'px;">&#129517;</span>';
if (ofive == fivethousand) {
fivethousand*=10;
setTimeout(callintoplay, 5000);
}

}

... and putting this into play we realized we should slow down animations to give users a chance to consider whether they want to "drill down" into finding out more about the "trip legs" as user defined.

This happens in our changed seventh (boo hoo) draft Earth Scanner web application.


Previous relevant Earth Scanner Hashtag Lists Tutorial is shown below.

Earth Scanner Hashtag Lists Tutorial

Earth Scanner Hashtag Lists Tutorial

Before yesterday's Earth Scanner TimeZone Tutorial, when we presented Earth Scanner Places Tutorial we intimated with ...

... and into the future we have another idea regarding how this operates.

... that we might offer another way for the driver of our latest Earth Scanner web application ...

  • not only depend on a webpage click event Javascript prompt window means by which to control proceedings, including newly coded for comma separated list logic support ... but, also, as of today, after proving it could work (because we can't remember ever depending this much on a "hashtag on the address bar" arrangement, in the past, before) ...
  • but also allow similar functionality using hashtags on the address bar of the web browser, and able to be changed dynamically (ie. in real time) by the user, as required ...

    if (prevhash != decodeURIComponent(('' + location.hash).replace(/^null$/g,'').replace(/^undefined$/g,'').replace(/^\#/g,''))) {
    thishash=decodeURIComponent(('' + location.hash).replace(/^null$/g,'').replace(/^undefined$/g,'').replace(/^\#/g,'')); //.trim();
    for (var iop=0; iop<plotplace.length; iop++) {
    thishash=thishash.replace(plotplace[iop], '');
    }
    var thishs=thishash.replace(/\ to\ /g,',').trim().split(',');
    if (thishs[0].trim() != '') {
    for (var ipo=0; ipo<thishs.length; ipo++) {
    if (newlist == '') {
    nlist=thishs[ipo].replace(/\+/g,'').trim(); //.trim();
    newlist=thishs[ipo].replace(/\+/g,''); //.trim();
    prefnew=thishs[ipo].replace(/\+/g,' ').split(nlist)[0];
    if (eval(1 + ipo) == eval('' + thishs.length) && thishs[ipo].replace(/\+/g,' ') != (prefnew + newlist)) {
    //alert(98);
    suffnew=thishs[ipo].replace(/\+/g,' ').split(newlist)[1];
    }
    } else {
    nlist=thishs[ipo].replace(/\+/g,'').trim(); //.trim();
    newlist+=',' + nlist; //.trim();
    if (eval(1 + ipo) == eval('' + thishs.length) && thishs[ipo].replace(/\+/g,' ') != nlist) {
    suffnew=thishs[ipo].replace(/\+/g,' ').split(nlist)[1];
    }
    }
    }
    }
    prevhash=decodeURIComponent(('' + location.hash).replace(/^null$/g,'').replace(/^undefined$/g,'').replace(/^\#/g,'')); //.trim();
    if (newlist != '') {
    //alert('newlist=' + newlist + '|');
    gdefv=prefnew + newlist + suffnew;
    //alert(gdefv + '!');
    if (1 == 1) {
    askfor=gdefv;
    if (1 == 7 && ('' + askfor).replace('(','').replace(')','').replace('[','').replace(']','').indexOf(',') != -1) {
    ameridian='';
    acircleoflatitude='';
    enforcedlong=false;
    enforcedxp=-999;
    }
    document.getElementById('myimg').click();
    gdefv='';
    setTimeout(scmove, fivethousand);
    return null;
    } else {
    ourprompt(null,'Earth Scanner - RJM Programming - February, 2024 ... ' + String.fromCharCode(10) + 'Thanks to https://github.com/nvkelso/natural-earth-raster/blob/master/50m_rasters/HYP_50M_SR_W/HYP_50M_SR_W.README.html ... ' + String.fromCharCode(10) + 'Currently top left of screen is (Longitude,Latitude) ' + '(' + eval(-180 + xp * 360 / 100) + ',' + eval(90 - yp * 180 / 100) + ') and bottom right is (' + eval(-180 + screenlong + xp * 360 / 100) + ',' + eval(90 - screenlat - yp * 180 / 100) + ') and around the middle is (' + eval(-180 + eval(screenlong / 2) + xp * 360 / 100) + ',' + eval(90 - eval(screenlat / 2) - yp * 180 / 100) + ').' + String.fromCharCode(10) + 'Where do you want middle of screen to be in terms of Longitude,Latitude? Suffix with space to show meridians and/or prefix with space to not show meridians.', newlist);
    }
    }
    }

And we did find this an easy way to build up a sizeable number of plotted places, in quick time, entered as ...

  • the "P" and "N' and "A" and "C" shortcuts (near to where the user clicked) ways
  • timezone place name(s)
  • country name(s)
  • country code(s)
  • [longitude,latitude,placename]
  • [longitude,latitude]
  • longitude,latitude,placename
  • longitude,latitude (with some form of mantissa)

... methodologies to end up with at least a pin (📍) emoji plotted, as well as the "longitude,latitude (with no form of mantissa)" way to just move the map to that position with no plotting taking place.

But now that we have a few "data players" in the mix, there'll be users out there that do not want to see it all, perhaps ... and so, now "the blurb" goes, for user entries, in either of these modes of use ...

... at prompt ++ can make delay between snapshots slower and -- can make delay between snapshots faster
... at prompt > can hide any time related information else < reveals it again
... comma lists of TimeZone places and/or Country Codes (2 letter) and/or Country Names can be plotted via click or via hashtag usage up at address bar
... suffix with space to show meridians and/or prefix with space to not show meridians

... in our changed sixth draft Earth Scanner web application.


Previous relevant Earth Scanner TimeZone Tutorial is shown below.

Earth Scanner TimeZone Tutorial

Earth Scanner TimeZone Tutorial

Take a look at the word ...

TimeZone

... as a concept newly introduced into the Earth Scanner web application workings, as explained in yesterday's Earth Scanner Places Tutorial.

It's got a "where" word part "Zone" fitting in with our "where of life" ideas up to now, but it also has got "Time" as a new "when of life" word part of the whole idea of TimeZones we'd like to start exploring today. Yes, TimeZones are very useful to have "where" meet "when" ... the Opera Bar would be nice, we think.

We now have ...


function ourprompt(e, blurb, defv) {
var locans=null, ijk=0, extras='',thatplace='', utzdate, tzDate, xdate1, xextratztime, xextraemj, xdiff;
if (eval(uc_iso_country_codes.length) == 0) {
for (ijk=0; ijk<iso_country_codes.length; ijk++) {
uc_iso_country_codes.push(iso_country_codes[ijk].toUpperCase());
}
}
e = e || window.event;
e.preventDefault();
if (e.touches) {
if (e.touches[0].pageX) {
xinxy.push(eval(e.touches[0].pageX + document.body.scrollLeft * 0) * 1);
yinxy.push(eval(e.touches[0].pageY + document.body.scrollTop * 0) * 1);
} else {
xinxy.push(eval(e.touches[0].clientX + document.body.scrollLeft * 0) * 1);
yinxy.push(eval(e.touches[0].clientY + document.body.scrollTop * 0) * 1);
}
} else if (e.clientX || e.clientY) {
xinxy.push(e.clientX + document.body.scrollLeft * 0);
yinxy.push(e.clientY + document.body.scrollTop * 0);
} else {
xinxy.push(e.pageX + document.body.scrollLeft * 0);
yinxy.push(e.pageY + document.body.scrollTop * 0);
}
var llsa=blurb.split(') (')[1];
//alert(blurb + ' ... ' + llsa);
tllg=eval(llsa.split(',')[0]);
tlla=eval(llsa.split(',')[1].split(')')[0]);
brlg=eval(llsa.split('(')[1].split(',')[0]);
brla=eval(llsa.split('(')[1].split(',')[1].split(')')[0]);
thislong=eval(tllg + eval(eval(xinxy[eval(-1 + xinxy.length)] / screenwidth) * eval(screenlong)));
thislat=eval(tlla - eval(eval(yinxy[eval(-1 + yinxy.length)] / screenheight) * eval(screenlat)));
var nearbyfour=retnearest(thislong, thislat);
var aatm='youllneverfindthis';
var bbtm=String.fromCharCode(9);
if (blurb.indexOf('Thanks to ') != -1) {
if (blurb.split('Thanks to ')[1].indexOf(' ...') != -1) {
bbtm='Thanks to ' + blurb.split('Thanks to ')[1].split(' ...')[0] + ' ...';
}
}
if (blurb.indexOf(' and around the middle ') != -1) {
aatm=' and around the middle ' + blurb.split(' and around the middle ')[1].split(')')[0] + ')';
}
var ourblurb=(blurb.replace(bbtm,'').replace('Currently top ','Top ').replace(' in terms of ',' as ').replace(aatm, '').replace(/\ and\ /g,' & ').replace('? ', '? ' + ' Nearest timezone place (via N) is ' + nearbyfour.split('|')[3] + ' at [' + nearbyfour.split('|')[0] + ',' + nearbyfour.split('|')[1] + '] to your clicked (via C) [' + thislong + ',' + thislat + '] ') + bbtm.replace(String.fromCharCode(9),'')).replace(String.fromCharCode(10),' ').replace(String.fromCharCode(10),' ').replace(String.fromCharCode(10),' ').replace(String.fromCharCode(10),' ');
if (prevf.indexOf(',') != -1) {
if (Math.abs(eval(prevf.split(',')[0]) - tllg) <= 0.5) {
prevf='' + prevone + ',' + prevtwo + ',' + prevthree + ',' + prevfour;
}
if (Math.abs(eval(prevf.split(',')[0]) - tllg) > 0.5) {
tllg=eval(prevf.split(',')[0]);
tlla=eval(prevf.split(',')[1]);
brlg=eval(prevf.split(',')[2]);
brla=eval(prevf.split(',')[3]);
var sthislong=eval(tllg + eval(eval(xinxy[eval(-1 + xinxy.length)] / screenwidth) * eval(screenlong)));
var sthislat=eval(tlla - eval(eval(yinxy[eval(-1 + yinxy.length)] / screenheight) * eval(screenlat)));
var snearbyfour=retnearest(sthislong, sthislat);
//alert(ourblurb + ' ' + prevf + ' vs ' + tllg + ' ... ' + Math.abs(eval(prevf.split(',')[0]) - tllg));
ourblurb=ourblurb.replace('? ', '? ' + ' Nearest timezone place (via P) is ' + snearbyfour.split('|')[3] + ' at [' + snearbyfour.split('|')[0] + ',' + snearbyfour.split('|')[1] + '] to your clicked (via A) [' + sthislong + ',' + sthislat + '] ');
}
locans=prompt(ourblurb, defv);
}
if (locans != null) {
if (locans.toUpperCase().trim() == 'N') {
locans=locans.toUpperCase().replace('N', '[' + nearbyfour.split('|')[0] + ',' + nearbyfour.split('|')[1] + ']');
plotplace.push(nearbyfour.split('|')[3]);
plotcc.push(nearbyfour.split('|')[2]);
plotlong.push(nearbyfour.split('|')[0]);
plotlat.push(nearbyfour.split('|')[1]);
if (eval('' + nearbyfour.length) > 4) {

plottz.push(nearbyfour.split('|')[4]);
plotct.push(nearbyfour.split('|')[5]);
plotemj.push(nearbyfour.split('|')[6]);

} else {
plottz.push('');
plotct.push('');
plotemj.push('');
}

} else if (locans.toUpperCase().trim() == 'C') {
thisplace=' ';
locans=locans.toUpperCase().replace('C', '[' + thislong + ',' + thislat + ']');
plotplace.push('');
plotcc.push(nearbyfour.split('|')[2]);
plotlong.push(thislong);
plotlat.push(thislat);
plotct.push('');
plotemj.push('');
plottz.push('');

} else if (locans.toUpperCase().trim() == 'P') {
locans=locans.toUpperCase().replace('P', '[' + snearbyfour.split('|')[0] + ',' + snearbyfour.split('|')[1] + ']');
plotplace.push(snearbyfour.split('|')[3]);
plotcc.push(snearbyfour.split('|')[2]);
plotlong.push(snearbyfour.split('|')[0]);
plotlat.push(snearbyfour.split('|')[1]);
if (eval('' + nearbyfour.length) > 4) {

plottz.push(nearbyfour.split('|')[4]);
plotct.push(nearbyfour.split('|')[5]);
plotemj.push(nearbyfour.split('|')[6]);

} else {
plottz.push('');
plotct.push('');
plotemj.push('');
}

} else if (locans.toUpperCase().trim() == 'A') {
thisplace=' ';
locans=locans.toUpperCase().replace('A', '[' + sthislong + ',' + sthislat + ']');
plotplace.push('');
plotcc.push(snearbyfour.split('|')[2]);
plotlong.push(sthislong);
plotlat.push(sthislat);
plotct.push('');
plotemj.push('');
plottz.push('');

} else if (eval('' + ('' + locans.trim()).length) >= 3 && ('' + locans).indexOf(',') == -1 && yourtzlist.indexOf('/' + ('' + locans.trim()).replace(/\ /g,'_') + '<') != -1) {
thisplace=yourtzlist.split('/' + ('' + locans.trim()).replace(/\ /g,'_') + '<')[0].split(' data-geo="')[eval(-1 + yourtzlist.split('/' + ('' + locans.trim()).replace(/\ /g,'_') + '<')[0].split(' data-geo="').length)];
//alert(thisplace);

udate=new Date();
utcDate = new Date(udate.toLocaleString('en-US', { timeZone: 'UTC' }));

thatplace=thisplace.split('>')[1].split('<')[0].replace('GMT','UTC') + '/' + locans;
//alert(thatplace);
utzdate=new Date();
tzDate = new Date(utzdate.toLocaleString('en-US', { timeZone: thatplace.replace('GMT','UTC').replace(/\ /g,'_') }));
extratz=',' + thatplace; //.split('/')[eval(-1 + iplacesarr[jk].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' ');
xdate1=new Date().toLocaleString("en-US", { timeZone: thatplace.replace('GMT','UTC').replace(/\ /g,'_') });
xextratztime=(',' + xdate1);
plottz.push(thatplace);
thatplace=thatplace.replace('GMT','Europe/London').split('/')[eval(-1 + thatplace.replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' ');
xdiff = Math.abs(tzDate.getTime() - utcDate.getTime()) / 3600000;
xextraemj=',' + clockit('' + xdiff);
plotct.push('' + xdate1);
plotemj.push(clockit('' + xdiff));

plotplace.push(yourtzlist.split(thisplace.split('>')[0] + '>')[1].split('<')[0].replace('GMT','Europe/London').split('/')[eval(-1 + yourtzlist.split(thisplace.split('>')[0] + '>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' '));
plotlong.push((thisplace.split(',')[1]));
plotlat.push((thisplace.split(',')[0]));
plotcc.push(thisplace.split(',')[3]);
if (thisplace.split(',')[3] != '') {
for (ijk=0; ijk<iso_country_codes.length; ijk+=2) {
if (iso_country_codes[ijk].toUpperCase() == thisplace.split(',')[3].toUpperCase()) {
extras=', ' + iso_country_codes[eval(1 + ijk)];
plotplace[eval(-1 + plotplace.length)]+=extras;
extras='';
}
}
}
//alert(extras + ' ... ' + locans);
locans=locans.replace(locans.trim(), '[' + thisplace.split(',')[1] + ',' + thisplace.split(',')[0] + ',' + plotplace[eval(-1 + plotplace.length)] + extras + ']');
//alert(locans);
thisplace=' ';
} else if (eval('' + ('' + locans.trim()).length) >= 3 && ('' + locans).indexOf(',') == -1 && yourtzlist.toUpperCase().indexOf('/' + ('' + locans.trim()).toUpperCase().replace(/\ /g,'_') + '<') != -1) {
thisplace=yourtzlist.toUpperCase().split('/' + ('' + locans.trim()).toUpperCase().replace(/\ /g,'_') + '<')[0].split(' DATA-GEO="')[eval(-1 + yourtzlist.toUpperCase().split('/' + ('' + locans.trim()).toUpperCase().replace(/\ /g,'_') + '<')[0].split(' DATA-GEO="').length)];
//alert(thisplace);
udate=new Date();
utcDate = new Date(udate.toLocaleString('en-US', { timeZone: 'UTC' }));

thatplace=thisplace.split('>')[1].split('<')[0].replace('GMT','UTC') + '/' + locans;
utzdate=new Date();
tzDate = new Date(utzdate.toLocaleString('en-US', { timeZone: thatplace.replace('GMT','UTC').replace(/\ /g,'_') }));
extratz=',' + thatplace; //.split('/')[eval(-1 + iplacesarr[jk].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' ');
xdate1=new Date().toLocaleString("en-US", { timeZone: thatplace.replace('GMT','UTC') });
xextratztime=(',' + xdate1);
plottz.push(thatplace);
thatplace=thatplace.replace('GMT','Europe/London').split('/')[eval(-1 + thatplace.replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' ');
xdiff = Math.abs(tzDate.getTime() - utcDate.getTime()) / 3600000;
xextraemj=',' + clockit('' + xdiff);
plotct.push('' + xdate1);
plotemj.push(clockit('' + xdiff));

plotplace.push(yourtzlist.split(thisplace.split('>')[0] + '>')[1].split('<')[0].replace('GMT','Europe/London').split('/')[eval(-1 + yourtzlist.split(thisplace.split('>')[0] + '>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' '));
plotlong.push((thisplace.split(',')[1]));
plotlat.push((thisplace.split(',')[0]));
plotcc.push(thisplace.split(',')[3]);
if (thisplace.split(',')[3] != '') {
for (ijk=0; ijk<iso_country_codes.length; ijk+=2) {
if (iso_country_codes[ijk].toUpperCase() == thisplace.split(',')[3].toUpperCase()) {
extras=', ' + iso_country_codes[eval(1 + ijk)];
plotplace[eval(-1 + plotplace.length)]+=extras;
extras='';
}
}
}
//alert(extras + ' ... ' + locans);
locans=locans.replace(locans.trim(), '[' + thisplace.split(',')[1] + ',' + thisplace.split(',')[0] + ',' + plotplace[eval(-1 + plotplace.length)] + extras + ']');
//alert(locans);
thisplace=' ';
} else if (eval('' + ('' + locans.trim()).length) == 2 && ('' + locans).indexOf(',') == -1 && yourtzlist.indexOf(',' + ('' + locans.trim()).toUpperCase() + ',') != -1) {
thisplace=yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[0].split(' data-geo="')[eval(-1 + yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[0].split(' data-geo="').length)];

thatplace=yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[1].split('>')[1].split('<')[0].replace('GMT','UTC');
utzdate=new Date();
tzDate = new Date(utzdate.toLocaleString('en-US', { timeZone: thatplace.replace('GMT','UTC').replace(/\ /g,'_') }));
extratz=',' + thatplace; //.split('/')[eval(-1 + iplacesarr[jk].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' ');
xdate1=new Date().toLocaleString("en-US", { timeZone: thatplace.replace('GMT','UTC').replace(/\ /g,'_') });
xextratztime=(',' + xdate1);
plottz.push(thatplace);
thatplace=thatplace.replace('GMT','Europe/London').split('/')[eval(-1 + thatplace.replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' ');
xdiff = Math.abs(tzDate.getTime() - utzdate.getTime()) / 3600000;
xextraemj=',' + clockit('' + xdiff);
plotct.push('' + xdate1);
plotemj.push(clockit('' + xdiff));

plotplace.push(yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[1].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/')[eval(-1 + yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[1].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' '));
plotlong.push((thisplace.split(',')[1]));
plotlat.push((thisplace.split(',')[0]));
plotcc.push(locans.trim());
if (locans != '') {
for (ijk=0; ijk<iso_country_codes.length; ijk+=2) {
if (iso_country_codes[ijk].toUpperCase() == locans.trim().toUpperCase()) {
extras=', ' + iso_country_codes[eval(1 + ijk)];
plotplace[eval(-1 + plotplace.length)]+=extras;
extras='';
}
}
}
locans=locans.replace(locans.trim(), '[' + thisplace.split(',')[1] + ',' + thisplace.split(',')[0] + ',' + plotplace[eval(-1 + plotplace.length)] + extras + ']');
thisplace=' ';
} else if (eval('' + ('' + locans.trim()).length) >= 3 && ('' + locans).indexOf(',') == -1 && iso_country_codes.indexOf(locans.trim()) != -1) {
//alert(iso_country_codes[eval(-1 + eval('' + iso_country_codes.indexOf(locans.trim())))].toUpperCase());
if (yourtzlist.indexOf(',' + ('' + iso_country_codes[eval(-1 + eval('' + iso_country_codes.indexOf(locans.trim())))].toUpperCase()) + ',') != -1) {
locans=locans.replace(locans.trim(), '' + iso_country_codes[eval(-1 + eval('' + iso_country_codes.indexOf(locans.trim())))]);
thisplace=yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[0].split(' data-geo="')[eval(-1 + yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[0].split(' data-geo="').length)];

//alert('thisplace=' + thisplace + ' and thatplace=' + thatplace);
thatplace=yourtzlist.split(thisplace)[1].split('>')[1].split('<')[0].replace('GMT','UTC');
//alert('thisplace=' + thisplace + ' and thatplace=' + thatplace);
utzdate=new Date();
tzDate = new Date(utzdate.toLocaleString('en-US', { timeZone: thatplace.replace('GMT','UTC').replace(/\ /g,'_') }));
extratz=',' + thatplace; //.split('/')[eval(-1 + iplacesarr[jk].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' ');
xdate1=new Date().toLocaleString("en-US", { timeZone: thatplace.replace('GMT','UTC').replace(/\ /g,'_') });
xextratztime=(',' + xdate1);
plottz.push(thatplace);
thatplace=thatplace.replace('GMT','Europe/London').split('/')[eval(-1 + thatplace.replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' ');
xdiff = Math.abs(tzDate.getTime() - utzdate.getTime()) / 3600000;
xextraemj=',' + clockit('' + xdiff);
plotct.push('' + xdate1);
plotemj.push(clockit('' + xdiff));

plotplace.push(yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[1].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/')[eval(-1 + yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[1].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' '));
plotlong.push((thisplace.split(',')[1]));
plotlat.push((thisplace.split(',')[0]));
plotcc.push(locans.trim());
if (locans != '') {
for (ijk=0; ijk<iso_country_codes.length; ijk+=2) {
if (iso_country_codes[ijk].toUpperCase() == locans.trim().toUpperCase()) {
extras=', ' + iso_country_codes[eval(1 + ijk)];
plotplace[eval(-1 + plotplace.length)]+=extras;
extras='';
}
}
}
locans=locans.replace(locans.trim(), '[' + thisplace.split(',')[1] + ',' + thisplace.split(',')[0] + ',' + plotplace[eval(-1 + plotplace.length)] + extras + ']');
thisplace=' ';
} else if (locans.trim() != '' && locans.trim() != locans) {
locans=locans.replace(locans.trim(), '');
} else {
locans=null;
}
} else if (eval('' + ('' + locans.trim()).length) >= 3 && ('' + locans).indexOf(',') == -1 && uc_iso_country_codes.indexOf(locans.trim().toUpperCase()) != -1) {
//alert(iso_country_codes[eval(-1 + eval('' + uc_iso_country_codes.indexOf(locans.trim())))].toUpperCase());
if (yourtzlist.indexOf(',' + iso_country_codes[eval(-1 + uc_iso_country_codes.indexOf(locans.trim().toUpperCase()))].toUpperCase() + ',') != -1) {
locans=locans.replace(locans.trim(), '' + iso_country_codes[eval(-1 + eval('' + uc_iso_country_codes.indexOf(locans.trim().toUpperCase())))]);
thisplace=yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[0].split(' data-geo="')[eval(-1 + yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[0].split(' data-geo="').length)];

thatplace=thisplace.split('>')[1].split('<')[0].replace('GMT','UTC');
utzdate=new Date();
tzDate = new Date(utzdate.toLocaleString('en-US', { timeZone: thatplace.replace('GMT','UTC').replace(/\ /g,'_') }));
extratz=',' + thatplace; //.split('/')[eval(-1 + iplacesarr[jk].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' ');
xdate1=new Date().toLocaleString("en-US", { timeZone: thatplace.replace('GMT','UTC').replace(/\ /g,'_') });
xextratztime=(',' + xdate1);
plottz.push(thatplace);
thatplace=thatplace.replace('GMT','Europe/London').split('/')[eval(-1 + thatplace.replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' ');
xdiff = Math.abs(tzDate.getTime() - utzdate.getTime()) / 3600000;
xextraemj=',' + clockit('' + xdiff);
plotct.push('' + xdate1);
plotemj.push(clockit('' + xdiff));

plotplace.push(yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[1].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/')[eval(-1 + yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[1].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' '));
plotlong.push((thisplace.split(',')[1]));
plotlat.push((thisplace.split(',')[0]));
plotcc.push(locans.trim());
if (locans != '') {
for (ijk=0; ijk<iso_country_codes.length; ijk+=2) {
if (iso_country_codes[ijk].toUpperCase() == locans.trim().toUpperCase()) {
extras=', ' + iso_country_codes[eval(1 + ijk)];
plotplace[eval(-1 + plotplace.length)]+=extras;
extras='';
}
}
}
locans=locans.replace(locans.trim(), '[' + thisplace.split(',')[1] + ',' + thisplace.split(',')[0] + ',' + plotplace[eval(-1 + plotplace.length)] + extras + ']');
thisplace=' ';
} else if (locans.trim() != '' && locans.trim() != locans) {
locans=locans.replace(locans.trim(), '');
} else {
locans=null;
}
} else if (('' + locans).indexOf(',') != -1 && ('' + locans).indexOf('[') != -1) {
thisplace=' ';
if (eval('' + locans.replace('(','').replace(')','').replace('[','').replace(']','').split(',').length) > 2) {
plotplace.push(locans.replace(locans.split(',')[0] + ',' + locans.split(',')[1] + ',', '').replace('(','').replace(')','').replace('[','').replace(']',''));
thisplace=locans.replace(locans.split(',')[0] + ',' + locans.split(',')[1] + ',', '').replace('(','').replace(')','').replace('[','').replace(']','') + ' ';
} else {
plotplace.push('');
}
plotcc.push('');
plotlong.push(locans.replace('(','').replace(')','').replace('[','').replace(']','').split(',')[0]);
plotlat.push(locans.replace('(','').replace(')','').replace('[','').replace(']','').split(',')[1]);
plotct.push('');
plotemj.push('');
plottz.push('');

} else if (('' + locans).indexOf(',') != -1 && ('' + locans).indexOf('.') != -1) {
thisplace=' ';
if (eval('' + locans.replace('(','').replace(')','').replace('[','').replace(']','').split(',').length) > 2) {
plotplace.push(locans.replace(locans.split(',')[0] + ',' + locans.split(',')[1] + ',', '').replace('(','').replace(')','').replace('[','').replace(']',''));
thisplace=locans.replace(locans.split(',')[0] + ',' + locans.split(',')[1] + ',', '').replace('(','').replace(')','').replace('[','').replace(']','') + ' ';
} else {
plotplace.push('');
}
plotcc.push('');
plotlong.push(locans.replace('(','').replace(')','').replace('[','').replace(']','').split(',')[0]);
plotlat.push(locans.replace('(','').replace(')','').replace('[','').replace(']','').split(',')[1]);
plotct.push('');
plotemj.push('');
plottz.push('');

} else if (locans.trim() != '' && locans.trim() != locans) {
locans=locans.replace(locans.trim(), '');
} else {
locans=null;
}
}

movesallowed=true;
return locans;
}

function orflag(thiscc) {
var ccchar='', ccsuff='';
var lri='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var dri=['127462','127463','127464','127465','127466','127467','127468','127469','127470','127471','127472','127473','127474','127475','127476','127477','127478','127479','127480','127481','127482','127483','127484','127485','127486','127487'];
for (var iccsuff=0; iccsuff<thiscc.length; iccsuff++) {
ccchar=thiscc.substring(iccsuff, eval(1 + eval('' + iccsuff))).toUpperCase();
ccsuff+=String.fromCodePoint(eval('' + dri[eval('' + lri.indexOf(ccchar))])); //'&#' + dri[eval('' + lri.indexOf(ccchar))] + ';';
}
return ccsuff;
}

... referencing three new when "collectables" ...

  1. var plottz=[]; // contains a TimeZone name
  2. var plotct=[]; // contains a current datetime timestamp
  3. var plotemj=[]; // contains a current datetime clockemoji of nearest relevance

... now used in an amended plotting span element innerHTML (used to be plotplace[iplot]) "wrapper" (now using doplotplace(iplot)) ...


function doplotplace(ipl) {
if (plotcc[ipl].trim() && plottz[ipl].trim() != '') {
return plotplace[ipl] + ' ' + orflag(plotcc[ipl]) + '
' + plotct[ipl] + '
' + plotemj[ipl];
}

return plotplace[ipl];
}

... in our changed fifth draft Earth Scanner web application.


Previous relevant Earth Scanner Places Tutorial is shown below.

Earth Scanner Places Tutorial

Earth Scanner Places Tutorial

So far, with our Earth Scanner web application from the day before yesterday's Earth Scanner Lines Tutorial, it had a pretty passive modus operandi. On a plane or on television or some other "just watching" scenario that suits, but we'd like to offer more regarding value adding ...

  • new Place plotting functionality that the user has real-time control over via onclick logic reaching a ...
  • Javascript prompt window

... and into the future we have another idea regarding how this operates.

So today, though, we change how that Javascript prompt window's "blurb" is constructed, and how the user answer is analyzed, because, today, we've added in ...


PHP inspired TimeZone place lookup logic within the Javascript code

Of course not all places are TimeZone places, and we'll see how that goes into the future?!

We funnelled the Javascript prompt window logic into a new "wrapper style" Javascript inhouse function ...


function ourprompt(e, blurb, defv) {
var locans=null, ijk=0, extras='';
if (eval(uc_iso_country_codes.length) == 0) {
for (ijk=0; ijk<iso_country_codes.length; ijk++) {
uc_iso_country_codes.push(iso_country_codes[ijk].toUpperCase());
}
}
e = e || window.event;
e.preventDefault();
if (e.touches) {
if (e.touches[0].pageX) {
xinxy.push(eval(e.touches[0].pageX + document.body.scrollLeft * 0) * 1);
yinxy.push(eval(e.touches[0].pageY + document.body.scrollTop * 0) * 1);
} else {
xinxy.push(eval(e.touches[0].clientX + document.body.scrollLeft * 0) * 1);
yinxy.push(eval(e.touches[0].clientY + document.body.scrollTop * 0) * 1);
}
} else if (e.clientX || e.clientY) {
xinxy.push(e.clientX + document.body.scrollLeft * 0);
yinxy.push(e.clientY + document.body.scrollTop * 0);
} else {
xinxy.push(e.pageX + document.body.scrollLeft * 0);
yinxy.push(e.pageY + document.body.scrollTop * 0);
}
var llsa=blurb.split(') (')[1];
//alert(blurb + ' ... ' + llsa);
tllg=eval(llsa.split(',')[0]);
tlla=eval(llsa.split(',')[1].split(')')[0]);
brlg=eval(llsa.split('(')[1].split(',')[0]);
brla=eval(llsa.split('(')[1].split(',')[1].split(')')[0]);
thislong=eval(tllg + eval(eval(xinxy[eval(-1 + xinxy.length)] / screenwidth) * eval(screenlong)));
thislat=eval(tlla - eval(eval(yinxy[eval(-1 + yinxy.length)] / screenheight) * eval(screenlat)));
var nearbyfour=retnearest(thislong, thislat);
var aatm='youllneverfindthis';
var bbtm=String.fromCharCode(9);
if (blurb.indexOf('Thanks to ') != -1) {
if (blurb.split('Thanks to ')[1].indexOf(' ...') != -1) {
bbtm='Thanks to ' + blurb.split('Thanks to ')[1].split(' ...')[0] + ' ...';
}
}
if (blurb.indexOf(' and around the middle ') != -1) {
aatm=' and around the middle ' + blurb.split(' and around the middle ')[1].split(')')[0] + ')';
}
var ourblurb=(blurb.replace(bbtm,'').replace('Currently top ','Top ').replace(' in terms of ',' as ').replace(aatm, '').replace(/\ and\ /g,' & ').replace('? ', '? ' + ' Nearest timezone place (via N) is ' + nearbyfour.split('|')[3] + ' at [' + nearbyfour.split('|')[0] + ',' + nearbyfour.split('|')[1] + '] to your clicked (via C) [' + thislong + ',' + thislat + '] ') + bbtm.replace(String.fromCharCode(9),'')).replace(String.fromCharCode(10),' ').replace(String.fromCharCode(10),' ').replace(String.fromCharCode(10),' ').replace(String.fromCharCode(10),' ');
if (prevf.indexOf(',') != -1) {
if (Math.abs(eval(prevf.split(',')[0]) - tllg) <= 0.5) {
prevf='' + prevone + ',' + prevtwo + ',' + prevthree + ',' + prevfour;
}
if (Math.abs(eval(prevf.split(',')[0]) - tllg) > 0.5) {
tllg=eval(prevf.split(',')[0]);
tlla=eval(prevf.split(',')[1]);
brlg=eval(prevf.split(',')[2]);
brla=eval(prevf.split(',')[3]);
var sthislong=eval(tllg + eval(eval(xinxy[eval(-1 + xinxy.length)] / screenwidth) * eval(screenlong)));
var sthislat=eval(tlla - eval(eval(yinxy[eval(-1 + yinxy.length)] / screenheight) * eval(screenlat)));
var snearbyfour=retnearest(sthislong, sthislat);
//alert(ourblurb + ' ' + prevf + ' vs ' + tllg + ' ... ' + Math.abs(eval(prevf.split(',')[0]) - tllg));
ourblurb=ourblurb.replace('? ', '? ' + ' Nearest timezone place (via P) is ' + snearbyfour.split('|')[3] + ' at [' + snearbyfour.split('|')[0] + ',' + snearbyfour.split('|')[1] + '] to your clicked (via A) [' + sthislong + ',' + sthislat + '] ');
}
locans=prompt(ourblurb, defv);
}
if (locans != null) {
if (locans.toUpperCase().trim() == 'N') {
locans=locans.toUpperCase().replace('N', '[' + nearbyfour.split('|')[0] + ',' + nearbyfour.split('|')[1] + ']');
plotplace.push(nearbyfour.split('|')[3]);
plotcc.push(nearbyfour.split('|')[2]);
plotlong.push(nearbyfour.split('|')[0]);
plotlat.push(nearbyfour.split('|')[1]);
} else if (locans.toUpperCase().trim() == 'C') {
thisplace=' ';
locans=locans.toUpperCase().replace('C', '[' + thislong + ',' + thislat + ']');
plotplace.push('');
plotcc.push(nearbyfour.split('|')[2]);
plotlong.push(thislong);
plotlat.push(thislat);
} else if (locans.toUpperCase().trim() == 'P') {
locans=locans.toUpperCase().replace('P', '[' + snearbyfour.split('|')[0] + ',' + snearbyfour.split('|')[1] + ']');
plotplace.push(snearbyfour.split('|')[3]);
plotcc.push(snearbyfour.split('|')[2]);
plotlong.push(snearbyfour.split('|')[0]);
plotlat.push(snearbyfour.split('|')[1]);
} else if (locans.toUpperCase().trim() == 'A') {
thisplace=' ';
locans=locans.toUpperCase().replace('A', '[' + sthislong + ',' + sthislat + ']');
plotplace.push('');
plotcc.push(snearbyfour.split('|')[2]);
plotlong.push(sthislong);
plotlat.push(sthislat);
} else if (eval('' + ('' + locans.trim()).length) >= 3 && ('' + locans).indexOf(',') == -1 && yourtzlist.toUpperCase().indexOf('/' + ('' + locans.trim()).toUpperCase().replace(/\ /g,'_') + '<') != -1) {
thisplace=yourtzlist.toUpperCase().split('/' + ('' + locans.trim()).toUpperCase().replace(/\ /g,'_') + '<')[0].split(' DATA-GEO="')[eval(-1 + yourtzlist.toUpperCase().split('/' + ('' + locans.trim()).toUpperCase().replace(/\ /g,'_') + '<')[0].split(' DATA-GEO="').length)];
//alert(thisplace);
plotplace.push(yourtzlist.split(thisplace.split('>')[0] + '>')[1].split('<')[0].replace('GMT','Europe/London').split('/')[eval(-1 + yourtzlist.split(thisplace.split('>')[0] + '>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' '));
plotlong.push((thisplace.split(',')[1]));
plotlat.push((thisplace.split(',')[0]));
plotcc.push(thisplace.split(',')[3]);
if (thisplace.split(',')[3] != '') {
for (ijk=0; ijk<iso_country_codes.length; ijk+=2) {
if (iso_country_codes[ijk].toUpperCase() == thisplace.split(',')[3].toUpperCase()) {
extras=', ' + iso_country_codes[eval(1 + ijk)];
plotplace[eval(-1 + plotplace.length)]+=extras;
extras='';
}
}
}
//alert(extras + ' ... ' + locans);
locans=locans.replace(locans.trim(), '[' + thisplace.split(',')[1] + ',' + thisplace.split(',')[0] + ',' + plotplace[eval(-1 + plotplace.length)] + extras + ']');
//alert(locans);
thisplace=' ';
} else if (eval('' + ('' + locans.trim()).length) == 2 && ('' + locans).indexOf(',') == -1 && yourtzlist.indexOf(',' + ('' + locans.trim()).toUpperCase() + ',') != -1) {
thisplace=yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[0].split(' data-geo="')[eval(-1 + yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[0].split(' data-geo="').length)];
plotplace.push(yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[1].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/')[eval(-1 + yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[1].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' '));
plotlong.push((thisplace.split(',')[1]));
plotlat.push((thisplace.split(',')[0]));
plotcc.push(locans.trim());
if (locans != '') {
for (ijk=0; ijk<iso_country_codes.length; ijk+=2) {
if (iso_country_codes[ijk].toUpperCase() == locans.trim().toUpperCase()) {
extras=', ' + iso_country_codes[eval(1 + ijk)];
plotplace[eval(-1 + plotplace.length)]+=extras;
extras='';
}
}
}
locans=locans.replace(locans.trim(), '[' + thisplace.split(',')[1] + ',' + thisplace.split(',')[0] + ',' + plotplace[eval(-1 + plotplace.length)] + extras + ']');
thisplace=' ';
} else if (eval('' + ('' + locans.trim()).length) >= 3 && ('' + locans).indexOf(',') == -1 && iso_country_codes.indexOf(locans.trim()) != -1) {
//alert(iso_country_codes[eval(-1 + eval('' + iso_country_codes.indexOf(locans.trim())))].toUpperCase());
if (yourtzlist.indexOf(',' + ('' + iso_country_codes[eval(-1 + eval('' + iso_country_codes.indexOf(locans.trim())))].toUpperCase()) + ',') != -1) {
locans=locans.replace(locans.trim(), '' + iso_country_codes[eval(-1 + eval('' + iso_country_codes.indexOf(locans.trim())))]);
thisplace=yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[0].split(' data-geo="')[eval(-1 + yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[0].split(' data-geo="').length)];
plotplace.push(yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[1].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/')[eval(-1 + yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[1].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' '));
plotlong.push((thisplace.split(',')[1]));
plotlat.push((thisplace.split(',')[0]));
plotcc.push(locans.trim());
if (locans != '') {
for (ijk=0; ijk<iso_country_codes.length; ijk+=2) {
if (iso_country_codes[ijk].toUpperCase() == locans.trim().toUpperCase()) {
extras=', ' + iso_country_codes[eval(1 + ijk)];
plotplace[eval(-1 + plotplace.length)]+=extras;
extras='';
}
}
}
locans=locans.replace(locans.trim(), '[' + thisplace.split(',')[1] + ',' + thisplace.split(',')[0] + ',' + plotplace[eval(-1 + plotplace.length)] + extras + ']');
thisplace=' ';
} else if (locans.trim() != '' && locans.trim() != locans) {
locans=locans.replace(locans.trim(), '');
} else {
locans=null;
}
} else if (eval('' + ('' + locans.trim()).length) >= 3 && ('' + locans).indexOf(',') == -1 && uc_iso_country_codes.indexOf(locans.trim().toUpperCase()) != -1) {
//alert(iso_country_codes[eval(-1 + eval('' + uc_iso_country_codes.indexOf(locans.trim())))].toUpperCase());
if (yourtzlist.indexOf(',' + iso_country_codes[eval(-1 + uc_iso_country_codes.indexOf(locans.trim().toUpperCase()))].toUpperCase() + ',') != -1) {
locans=locans.replace(locans.trim(), '' + iso_country_codes[eval(-1 + eval('' + uc_iso_country_codes.indexOf(locans.trim().toUpperCase())))]);
thisplace=yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[0].split(' data-geo="')[eval(-1 + yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[0].split(' data-geo="').length)];
plotplace.push(yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[1].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/')[eval(-1 + yourtzlist.split(',' + ('' + locans.trim()).toUpperCase() + ',')[1].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' '));
plotlong.push((thisplace.split(',')[1]));
plotlat.push((thisplace.split(',')[0]));
plotcc.push(locans.trim());
if (locans != '') {
for (ijk=0; ijk<iso_country_codes.length; ijk+=2) {
if (iso_country_codes[ijk].toUpperCase() == locans.trim().toUpperCase()) {
extras=', ' + iso_country_codes[eval(1 + ijk)];
plotplace[eval(-1 + plotplace.length)]+=extras;
extras='';
}
}
}
locans=locans.replace(locans.trim(), '[' + thisplace.split(',')[1] + ',' + thisplace.split(',')[0] + ',' + plotplace[eval(-1 + plotplace.length)] + extras + ']');
thisplace=' ';
} else if (locans.trim() != '' && locans.trim() != locans) {
locans=locans.replace(locans.trim(), '');
} else {
locans=null;
}
} else if (('' + locans).indexOf(',') != -1 && ('' + locans).indexOf('[') != -1) {
thisplace=' ';
if (eval('' + locans.replace('(','').replace(')','').replace('[','').replace(']','').split(',').length) > 2) {
plotplace.push(locans.replace(locans.split(',')[0] + ',' + locans.split(',')[1] + ',', '').replace('(','').replace(')','').replace('[','').replace(']',''));
thisplace=locans.replace(locans.split(',')[0] + ',' + locans.split(',')[1] + ',', '').replace('(','').replace(')','').replace('[','').replace(']','') + ' ';
} else {
plotplace.push('');
}
plotcc.push('');
plotlong.push(locans.replace('(','').replace(')','').replace('[','').replace(']','').split(',')[0]);
plotlat.push(locans.replace('(','').replace(')','').replace('[','').replace(']','').split(',')[1]);
} else if (('' + locans).indexOf(',') != -1 && ('' + locans).indexOf('.') != -1) {
thisplace=' ';
if (eval('' + locans.replace('(','').replace(')','').replace('[','').replace(']','').split(',').length) > 2) {
plotplace.push(locans.replace(locans.split(',')[0] + ',' + locans.split(',')[1] + ',', '').replace('(','').replace(')','').replace('[','').replace(']',''));
thisplace=locans.replace(locans.split(',')[0] + ',' + locans.split(',')[1] + ',', '').replace('(','').replace(')','').replace('[','').replace(']','') + ' ';
} else {
plotplace.push('');
}
plotcc.push('');
plotlong.push(locans.replace('(','').replace(')','').replace('[','').replace(']','').split(',')[0]);
plotlat.push(locans.replace('(','').replace(')','').replace('[','').replace(']','').split(',')[1]);
} else if (locans.trim() != '' && locans.trim() != locans) {
locans=locans.replace(locans.trim(), '');
} else {
locans=null;
}
}


movesallowed=true;
return locans;
}

... as the best way to get into how this happens in Earth Scanner Primer Tutorial, in our changed fourth draft Earth Scanner web application.


Previous relevant Earth Scanner Lines Tutorial is shown below.

Earth Scanner Lines Tutorial

Earth Scanner Lines Tutorial

Not everybody is a geography buff. But I'd say more people attended primary school than are geography buffs. And those people may have seen World Maps on the wall, and they were often Mercator Projection maps featuring the usual country and sea boundaries, as well as useful reference lines ...

  • lines of latitude, including, in between top "North Pole" 90° N and "South Pole" 90° S bottom ...
    1. Arctic Circle 66° 34' N
    2. Tropic of Cancer 23° 26' N
    3. Equator 0°
    4. Tropic of Capricorn 23° 26' S
    5. Antarctic Circle 66° 34' S
  • meridians of longitude (only the Equator above, is as long as ... and in the "Go Figure, Mercator" realms, the North Pole and South Pole are each of zero length, in "non-projection land"), including ...
    1. Greenwich Meridian 0°
    2. International Date Line 180° (but in practice, broken up so as not to confuse regarding timezones for some Pacific island countries)

... that become useful as you scan your way around Earth, further to yesterday's Earth Scanner Primer Tutorial, in our changed second draft Earth Scanner web application.

Stop Press

Couple of points to note ...

  1. the linework is just hr (Horizontal rule) elements, which are not the challenge either horizontally or vertically, regarding linework, that any diagonality brings ...

  2. the matter of screen width and screen height, which we need to know precisely for the work above, can be more involved to calculate on mobile platforms ... we ended up, with great help from this useful link, with this Javascript code ...

    var screenwidth=screen.width, screenheight=screen.height;

    var wasthisso='';
    if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
    try {
    wasthisso=('' + window.orientation).replace(/^0$/g, 'portrait'); //"portrait";
    } catch (ehgfg) {
    wasthisso='';
    }
    if (wasthisso == '') {
    try {
    wasthisso='' + screen.orientation.type; //"portrait";
    } catch (hgfg) {
    wasthisso=('' + window.orientation).replace(/^0$/g, 'portrait'); //"portrait";
    }
    }
    //alert(wasthisso);
    var hdone=false;
    if (wasthisso.indexOf('ortrait') != -1) { // thanks to https://stackoverflow.com/questions/50690191/window-innerheight-returning-wrong-value-in-ios-11
    if (eval('0' + document.documentElement.clientWidth) >= eval('0' + window.innerWidth)) {
    screenwidth=eval('' + document.documentElement.clientWidth);
    screenheight=eval('' + document.documentElement.clientHeight);
    hdone=true;
    } else {
    screenwidth=window.innerWidth;
    }
    if (!hdone) {
    if (eval('0' + document.documentElement.clientHeight) > eval('0' + window.innerHeight)) {
    screenheight=eval('' + document.documentElement.clientHeight);
    } else {
    screenheight=window.innerHeight;
    }
    }
    } else {
    if (eval('0' + document.documentElement.clientWidth) >= eval('0' + window.innerHeight)) {
    screenwidth=eval('' + document.documentElement.clientWidth);
    screenheight=eval('' + document.documentElement.clientHeight);
    hdone=true;
    } else {
    screenwidth=window.innerHeight;
    }
    if (!hdone) {
    if (eval('0' + document.documentElement.clientHeight) > eval('0' + window.innerWidth)) {
    screenheight=eval('' + document.documentElement.clientHeight);
    } else {
    screenheight=window.innerWidth;
    }
    }
    }
    // alert(wasthisso + ' ' + screenwidth + 'x' + screenheight);
    if (1 == 6) {
    documentURL=documentURL + '&nolines=y';
    if (documentURL.indexOf('.html') != -1) {
    location.href=document.URL.replace('.html','.htm');
    }
    }
    }

    ... in Earth Scanner Primer Tutorial, in our changed third draft Earth Scanner web application


Previous relevant Earth Scanner Primer Tutorial is shown below.

Earth Scanner Primer Tutorial

Earth Scanner Primer Tutorial

Today we've got for you a tutorial that takes bits and pieces from ...

... so as to create a new "Earth Scanner" web application in what we like to think of as "the where of life" realms.

In essence this Earth Scanner is pretty simple, so below you can see a first draft, "holus bolus" ...


<html>
<head>
<title>Earth Scanner - RJM Programming - February, 2024 ... Thanks to https://github.com/nvkelso/natural-earth-raster/blob/master/50m_rasters/HYP_50M_SR_W/HYP_50M_SR_W.README.html</title>
<style>
#myimg {
clip-path: circle(2% at 800px 700px);
animation:mymove 5s infinite;
-webkit-animation:mymove 5s infinite; /* Safari and Chrome */
}

@keyframes mymove
{
0% { clip-path: circle(2% at 0px 0px) }
100% { clip-path: circle(16% at 140px 140px) }
}

@-webkit-keyframes mymove /* Safari and Chrome */
{
0% { clip-path: circle(2% at 0px 0px) }
100% { clip-path: circle(16% at 140px 140px) }
}
</style>
<script type=text/javascript>
// Deemed unnecessary is ...
// 7% { clip-path: circle(3% at 10px 10px) }
// 14% { clip-path: circle(4% at 20px 20px) }
// 21% { clip-path: circle(5% at 30px 30px) }
// 28% { clip-path: circle(6% at 40px 40px) }
// 35% { clip-path: circle(7% at 50px 50px) }
// 42% { clip-path: circle(8% at 60px 60px) }
// 50% { clip-path: circle(9% at 70px 70px) }
// 57% { clip-path: circle(10% at 80px 80px) }
// 64% { clip-path: circle(11% at 90px 90px) }
// 71% { clip-path: circle(12% at 100px 100px) }
// 78% { clip-path: circle(13% at 110px 110px) }
// 85% { clip-path: circle(14% at 120px 120px) }
// 93% { clip-path: circle(15% at 130px 130px) }

var xp=0, yp=0, num=0;
var fixkeys='<style> #myimg { animation:mymove 5s infinite; -webkit-animation:mymove 5s infinite; } @keyframes mymove' + document.head.innerHTML.split('@keyframes mymove')[1].split('</style>')[0] + ' </style>';
var screenlong=-9, screenlat=-9, askfor=null, enforcedlong=false, enforcedxp=-999;

function scmove() {
var longforce='-999', latforce='-999';
if (screenlong < 0) {
screenlong=eval(360 * screen.width / document.getElementById('myimg').width);
screenlat=eval(180 * screen.height / document.getElementById('myimg').height);
document.getElementById('myimg').onclick=function() { askfor=prompt('Earth Scanner - RJM Programming - February, 2024 ... ' + String.fromCharCode(10) + 'Thanks to https://github.com/nvkelso/natural-earth-raster/blob/master/50m_rasters/HYP_50M_SR_W/HYP_50M_SR_W.README.html ... ' + String.fromCharCode(10) + 'Currently top left of screen is (Longitude,Latitude) ' + '(' + eval(-180 + xp * 360 / 100) + ',' + eval(90 - yp * 180 / 100) + ') and bottom right is (' + eval(-180 + screenlong + xp * 360 / 100) + ',' + eval(90 - screenlat - yp * 180 / 100) + ') and in the middle is (' + eval(-180 + eval(screenlong / 2) + xp * 360 / 100) + ',' + eval(90 - eval(screenlat / 2) - yp * 180 / 100) + ').' + String.fromCharCode(10) + 'Where do you want middle of screen to be in terms of Longitude,Latitude?', ''); };
}
//document.title="window.scrollTo(" + eval(xp * eval('' + document.getElementById('myimg').width) / 100) + "," + eval(yp * eval('' + document.getElementById('myimg').height) / 100) + ")";
if (askfor != null) {
if (askfor.replace('(','').replace(')','').indexOf(',') != -1) {
longforce=askfor.replace('(','').replace(')','').split(',')[0];
latforce=askfor.replace('(','').replace(')','').split(',')[1];
} else if (askfor.replace('(','').replace(')','').indexOf(' ') != -1) {
longforce=askfor.replace('(','').replace(')','').split(' ')[0];
latforce=askfor.replace('(','').replace(')','').split(' ')[1];
}
//xp = eval(((eval(eval('' + longforce) + 180) / 360) * eval('' + document.getElementById('myimg').width) / 100) - 0 * eval(eval(screenlong / 720) * eval('' + document.getElementById('myimg').width) / 100));
//yp = eval(((eval(90 - eval('' + latforce)) / 180) * eval('' + document.getElementById('myimg').height) / 100) + 0 * eval(eval(screenlat / 360) * eval('' + document.getElementById('myimg').height) / 100));
xp = eval(eval(eval('' + longforce) - screenlong / 2 + 180) / 3.60); // * eval('' + document.getElementById('myimg').width) / 100) - 0 * eval(eval(screenlong / 720) * eval('' + document.getElementById('myimg').width) / 100));
yp = eval(eval(90 - eval('' + latforce) - screenlat / 2) / 1.80); // * eval('' + document.getElementById('myimg').height) / 100) + 0 * eval(eval(screenlat / 360) * eval('' + document.getElementById('myimg').height) / 100));
//alert('' + xp + ',' + yp + ' ... ' + "window.scrollTo(" + eval(xp * eval('' + document.getElementById('myimg').width) / 100) + "," + eval(yp * eval('' + document.getElementById('myimg').height) / 100) + ")");
askfor=null;
if (enforcedlong) {
enforcedlong=false;
enforcedxp=xp;
//alert(xp + ' or ' + enforcedxp);
}
}
eval("window.scrollTo(" + eval((enforcedxp > -990 ? enforcedxp : xp) * eval('' + document.getElementById('myimg').width) / 100) + "," + eval(yp * eval('' + document.getElementById('myimg').height) / 100) + ")");
document.getElementById('myimg').title='Earth Scanner - RJM Programming - February, 2024 ... ' + 'Thanks to https://github.com/nvkelso/natural-earth-raster/blob/master/50m_rasters/HYP_50M_SR_W/HYP_50M_SR_W.README.html ... ' + String.fromCharCode(10) + String.fromCharCode(10) + 'Top left of screen is (Longitude,Latitude) ' + '(' + eval(-180 + (enforcedxp > -990 ? enforcedxp : xp) * 360 / 100) + ',' + eval(90 - yp * 180 / 100) + ') and bottom right is (' + eval(-180 + screenlong + (enforcedxp > -990 ? enforcedxp : xp) * 360 / 100) + ',' + eval(90 - screenlat - yp * 180 / 100) + ') and in the middle is (' + eval(-180 + eval(screenlong / 2) + (enforcedxp > -990 ? enforcedxp : xp) * 360 / 100) + ',' + eval(90 - eval(screenlat / 2) - yp * 180 / 100) + ')';
document.title=document.getElementById('myimg').title; //'Top left of screen is (Longitude,Latitude) ' + '(' + eval(-180 + xp * 360 / 100) + ',' + eval(90 - yp * 180 / 100) + ') and bottom right is (' + eval(-180 + screenlong + (enforcedxp > -990 ? enforcedxp : xp) * 360 / 100) + ',' + eval(90 - screenlat - yp * 180 / 100) + ') and in the middle is (' + eval(-180 + eval(screenlong / 2) + (enforcedxp > -990 ? enforcedxp : xp) * 360 / 100) + ',' + eval(90 - eval(screenlat / 2) - yp * 180 / 100) + ')';
if (xp < 95) {
xp+=5;
} else if (yp >= 95 && xp >= 95) {
enforcedxp=-999;
xp=0;
yp=0;
} else {
yp+=5;
xp=0;
}
var xdiff=eval((enforcedxp > -990 ? enforcedxp : xp) * eval('' + document.getElementById('myimg').width) / 100);
var ydiff=eval(yp * eval('' + document.getElementById('myimg').height) / 100);
var startkeys=fixkeys;
var coords=fixkeys.split('px');
for (var ic=0; ic<coords.length; ic+=2) {
if (coords[ic].split(' ')[eval(-1 + coords[ic].split(' ').length)].indexOf('<') == -1) {
//alert('' + xdiff + ',' + ydiff+ ',' + coords[ic].split(' ')[eval(-1 + coords[ic].split(' ').length)]);
startkeys=startkeys.replace(' ' + coords[ic].split(' ')[eval(-1 + coords[ic].split(' ').length)] + 'px', ' ' + eval(xdiff + eval('' + coords[ic].split(' ')[eval(-1 + coords[ic].split(' ').length)])) + 'px');
startkeys=startkeys.replace(' ' + coords[eval(1 + ic)].split(' ')[eval(-1 + coords[eval(1 + ic)].split(' ').length)] + 'px', ' ' + eval(ydiff + eval('' + coords[eval(1 + ic)].split(' ')[eval(-1 + coords[eval(1 + ic)].split(' ').length)])) + 'px');
}
}
//alert(startkeys);
document.getElementById('dstyle').innerHTML=startkeys; //.replace(/mymove/g, 'mymove' + num);
num++;
}

setInterval(scmove, 5000);
document.write("<img src='/HTMLCSS/HYP_50M_SR_W.jpg' id=myimg></img><div id=dstyle></div>");
var latis=location.search.split('latitude=')[1] ? decodeURIComponent(location.search.split('latitude=')[1].split('&')[0]) : '';
var longis=location.search.split('longitude=')[1] ? decodeURIComponent(location.search.split('longitude=')[1].split('&')[0]) : '';
if (latis != '' && longis != '') {
askfor='' + longis + ',' + latis;
} else if (latis != '') {
askfor='-168,' + latis;
} else if (longis != '') {
enforcedlong=true;
askfor='' + longis + ',70';
}
</script>
</head>
<body>
</body>
</html>

... now given to the user in a "heads up" that goes ...

At prompt window, prefixing, and persevering, CSS map image styling available (and able to be turned off via nocssplease) eg. filter:sepia(74%); Or you can specify <style></style> non-persevering or <style></STYLE> persevering CSS of your own (or use a URL ending with .css) to begin with and/or <script></script> non-persevering or <script></SCRIPT> persevering Javascript of your own (or use a URL ending with .js) to begin with

... with great thanks to this great resource as the crucial image in our first draft Earth Scanner web application.

Please note using it, it does have onclick logic to specify ...

Posted in eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment