Google Chart Geo and or Map Chart Windows Batch File Tutorial
โœ‚๐Ÿƒ๐Ÿพโ€โ™€๏ธ๐Ÿƒ๐Ÿผโ€โ™‚๏ธ
๐Ÿ“–

Google Chart Geo and or Map Chart Windows Batch File Tutorial

Google Chart Geo and or Map Chart Windows Batch File Tutorial   ๐Ÿ”

The โ€œleast botherโ€ desktop command line application means are (via the use of) โ€ฆ

macOS Windows
Shell Scripts (eg. Korn, C, Bourne, Bash) Batch Files

โ€ฆ in the Windows case, going back to โ€œthe days of DOSโ€ (and whatever happened to that โ€œDOS is on its way outโ€ talk way back when Windows 95 came out?)

No compilers, just desktop operating system โ€œout of the boxโ€ interpretive ideas which still work, not for every software idea, but for lots, including those that need to use interactive entry methods to glean information from the user, in thechanged geo_chartโšซbat weโ€™d like you to download to your Windows system (and just run via typing its geo_chart.bat name (at the cmd command line) within the directory where it exists, and you have โ€œcdโ€œed to) โ€ฆ



@echo off

setlocal EnableDelayedExpansion

echo Interface to Google Chart Geo or Map Chart interfacer created by RJM Programming ...

echo.

set text = ""

set equl = "="

set underscore = "__"

set centralplace = ""

set /p verb=Verb for command line eg. firefox eg. curl eg. map

if not defined verb set verb = "map"

if defined verb goto goonverb

set verb = "map"

:goonverb

if "!verb!" == "" set verb = "map"

echo.

set /p commastring=Enter comma separated list of placenames, or list of countries eg. Sydney,London,Beijing,Paris,Rome,Boston,Santiago,Cairo,Istanbul,New_Delhi

if not defined commastring goto veryend

if "!verb!" == "map" goto gopastc

echo.

set /p centralplace=Enter optional central country eg. Italy

:gopastc

echo.

set /p width=Enter width eg. 1112

if defined verb goto goonwidth

set width = "556"

:goonwidth

echo.

set /p height=Enter height eg. 694

if defined verb goto goonheight

set height = "347"

:goonheight

echo.

set /p text=Enter the word text for text display

echo.

echo 'Starting the call ...'

if "!verb!" == "map" goto gopastxc

echo %verb% "https://www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?%text%_%width%_%height%_%centralplace%_listis=%commastring%"

%verb% "https://www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?%text%_%width%_%height%_%centralplace%_listis=%commastring%"

exit

:gopastxc

echo C:\Progra~1\INTERN~1\iexplore.exe "https://www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?%text%_%width%_%height%_%centralplace%___listis=%commastring%#mapit=y"

C:\Progra~1\INTERN~1\iexplore.exe "https://www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?%text%_%width%_%height%_%centralplace%___listis=%commastring%#mapit=y"

exit

:veryend

exit

โ€ฆ to have a Windows Geo and or Map Google Chart hosting solution which is not reliant on any MAMP local web servers, perhaps?! But do please read about the โ€œIntranet feelingโ€ alternative ideas from yesterdayโ€™s Google Chart Geo and or Map Chart Modes of Use Tutorial should you want to start learning the great PHP serverside (and command line, and curl friendly) language.



Previous relevant Google Chart Geo and or Map Chart Modes of Use Tutorial is shown below.

Google Chart Geo and or Map Chart Modes of Use Tutorial

Google Chart Geo and or Map Chart Modes of Use Tutorial   ๐Ÿ”

We get a bit of a downer whenever, like yesterday, there are only certain platforms applicable to a solution you come up with as a programmer. But please, the obverse is worse, that you do nothing just because of this issue. You often find that you cannot please everybody with your software solutions.

Todayโ€™s PHP serverside work, however, goes towards mollifying the situation with yesterdayโ€™s progress, somewhat, working with those โ€œthree modes of PHP useโ€ we are often rabbiting on about โ€ฆ

  • surfing the net (ie. via web browser address bar)
  • desktop operating system command line use of verb โ€œphpโ€ โ€ฆ we call โ€œcommand lineโ€ mode of use โ€ฆ
  • curl

And so, before we change some Windows Batch file equivalent change in conjunction with yesterdayโ€™s Google Chart Geo and or Map Chart macOS Korn Shell Tutorial letโ€™s explore some โ€œthree modes of useโ€ functionality additions with todayโ€™schanged geo_chartโšซphp Geo Chart interfacer (which can be run as a standalone web application as well) โ€ฆ

  • surfing the net (ie. via web browser address bar)


    HTTP://www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?command=


    โ€ฆ or, from underlying macOS command line โ€ฆ


    open "HTTP://www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?command="


    โ€ฆ or, from underlying Windows command line (assuming your web browser (eg. Firefox) is in your environment path) โ€ฆ


    firefox.exe "HTTP://www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?command="

  • desktop operating system command line use of verb โ€œphpโ€ โ€ฆ we call โ€œcommand lineโ€ mode of use โ€ฆ after โ€œcdโ€ to where geo_chart.php sits on Windows or macOS (respectively) local MAMP Apache/PHP/MySql web server or RJM Programming Apache/PHP/MySql web server โ€ฆ


    php.exe geo_chart.php


    โ€ฆ


    php geo_chart.php

  • curl โ€ฆ
    macOS


    curl "HTTP://localhost:8888/PHP/GeoChart/geo_chart.php?command="
    Windows


    curl.exe "HTTP://localhost/PHP/GeoChart/geo_chart.php?command="

    โ€ฆ but, please note, we have no useful working solution for curl โ€œHTTP://www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?command=โ€ as yet

โ€ฆ allowing for some operating system agnostic โ€œIntranet feelingโ€ methodologies, where weโ€™d ask you to download that latest geo_chartโšซphp to a Windows or macOS MAMP local web serverโ€™s Document Rootโ€™s PHPโ€™s GeoChart folder to allow procedures above to happen, where the interactive entry feels like those โ€œold daysโ€ desktop application โ€œone question at a timeโ€ modus operandi.

Another reason to admire PHP!


Previous relevant Google Chart Geo and or Map Chart macOS Korn Shell Tutorial is shown below.

Google Chart Geo and or Map Chart macOS Korn Shell Tutorial

Google Chart Geo and or Map Chart macOS Korn Shell Tutorial   ๐Ÿ”

Weโ€™re revisiting Google Chart Geo Chart Windows Batch File Tutorial and before it, Google Chart Geo Chart macOS Korn Shell Tutorial because of the symbiosis between Google Chart โ€ฆ

โ€ฆ the former being great for overall world map views or country views and the latter for distributions of geographicals zoomed in upon, as well as having user โ€œpinโ€ click controlled inhouse functionality extensions. So, with our macOS interfacing as the first cab off the rank we wanted to allow that Korn Shell script we created back then, called geo_chartโšซksh, bechanged so that the user can interactively enter data whereby they might get to a Map Chart presentation via the Geo Chart, in the case of the โ€œtextโ€ presentation mode being the go, the user may see both types of Google Chart be displayed โ€ฆ

$ ksh geo_chart.ksh
Interface to Google Chart Geo or Map Chart interfacer created by RJM Programming โ€ฆ

Verb for command line eg. open eg. curl eg. map
map

Enter comma separated list of placenames (suffix by &text=y for text mode display) eg. Sydney,Beijing,London,Paris,Rome,Boston,Santiago,New_Delhi,Cairo,Istanbul
Sydney,Beijing,London,Paris,Rome,Boston,Santiago,New_Delhi,Cairo,Istanbul

Enter width [556] eg. 1112
1112

Enter height [347] eg. 694
694

Enter the word text for text display
text
$

โ€ฆ the results, for us, being as shown in todayโ€™s tutorial picture after we downloaded geo_chartโšซksh to our macOS system and executed the Korn Shell script from the macOS Terminal applicationโ€™s command line.

In order to make all this possible somechanges needed to be made with geo_chartโšซphp Geo Chart interfacer, which can be run as a standalone web application as well.


Previous relevant Google Chart Geo Chart Windows Batch File Tutorial is shown below.

Google Chart Geo Chart Windows Batch File Tutorial

Google Chart Geo Chart Windows Batch File Tutorial   ๐Ÿ”

Yes, itโ€™s not just the macOS scenario of yesterdayโ€™s Google Chart Geo Chart macOS Korn Shell Tutorial which can have a simple scripting solution. So can Windows, and we use the โ€œgoing back to near when Adam was a boyโ€ method of (DOS) Batch File means (to an end) โ€ฆ as per โ€ฆ



@echo off

setlocal EnableDelayedExpansion

echo 'Interface to Google Chart Geo Chart interfacer created by RJM Programming ...'

echo ''

set text ""

set equl "="

set /p verb=Verb for command line eg. firefox eg. curl

if defined verb goto goonverb

set verb "firefox"

:goonverb

echo ''

set /p commastring=Enter comma separated list of placenames, or list of countries eg. Sydney,London,Alice_Springs,Beijing,London,New_York,Paris,Rio_de_Janeiro,Cairo,Rome,Tennant_Creek

if not defined commastring goto veryend

echo ''

set /p centralplace=Enter optional central country eg. Italy

echo ''

set /p width=Enter width [556] eg. 1112

if defined verb goto goonwidth

set width "556"

:goonwidth

echo ''

set /p height=Enter height [347] eg. 694

if defined verb goto goonheight

set height "347"

:goonheight

echo ''

set /p text=Enter the word text for text display

echo ''

echo 'Starting the call ...'

echo %verb% https://www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?%text%_%width%_%height%_%centralplace%_listis=%commastring%

%verb% https://www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?%text%_%width%_%height%_%centralplace%_listis=%commastring%

exit

:veryend

exit

โ€ฆ geo_chartโšซbat Windows Batch File use of โ€œset /p โ€ โ€œask and ye shall find a way to askโ€ methodology.


Previous relevant Google Chart Geo Chart macOS Korn Shell Tutorial is shown below.

Google Chart Geo Chart macOS Korn Shell Tutorial

Google Chart Geo Chart macOS Korn Shell Tutorial   ๐Ÿ”

The progress of yesterdayโ€™s Google Chart Geo Chart Command Line Tutorial allows the โ€œwebโ€ to join with the (non-mobile) โ€œdesktopโ€, an opportunity weโ€™d like to dwell upon. Once at the macOS or Windows desktop there are still very simple interpretive language (and ascii text editor editable) means by which to write interfacing โ€œprogramsโ€ (or โ€œscriptsโ€ if you prefer the more boring terminology) as per โ€ฆ

  • Windows (command line) *.bat (batch file)
  • macOS (command line via Terminal application) *.ksh (Korn Shell) or *.bsh (Bash Shell) or *.csh (C Shell) or *.sh (Bourne Shell)

โ€ฆ our favourite being Korn Shell programming, which we show in todayโ€™s tutorial picture in the scenario โ€ฆ



ksh geo_chart.ksh

โ€ฆ is probably an indication we never went (something like the โ€œ7โ€ (to become โ€œexecutableโ€ of)) โ€ฆ



chmod 755 geo_chart.ksh

โ€ฆ that would mean that prefixing โ€œkshโ€ is superfluous above, and both macOS and Windows allow $PATH environment chances to simplify from anywhere where you execute the โ€œshell scriptโ€.



#!/bin/ksh

echo 'Interface to Google Chart Geo Chart interfacer created by RJM Programming ...'

echo ''

text=""

equl="="

echo 'Verb for command line eg. open eg. curl'

read verb

if [ -z "$verb" ]; then

verb="open"

fi

if [ ! -z "$verb" ]; then

echo ''

echo 'Enter comma separated list of placenames, or list of countries (suffix by &text=y for text mode display) eg. Sydney,London,Alice_Springs,Beijing,London,New_York,Paris,Rio_de_Janeiro,Cairo,Rome,Tennant_Creek'

read commastring

if [ ! -z "$commastring" ]; then

echo ''

echo 'Enter optional central country eg. Italy'

read centralplace

echo ''

echo 'Enter width [556] eg. 1112'

read width

if [ -z "$width" ]; then

width="556"

fi

if [ ! -z "$width" ]; then

echo ''

echo 'Enter height [347] eg. 694'

read height

if [ -z "$height" ]; then

height="347"

fi

if [ ! -z "$commastring" ]; then

echo ''

echo 'Enter the word text for text display'

read text

echo ''

echo 'Starting the call ...'

echo "$verb https://www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?${text}_${width}_${height}_${centralplace}_listis${equl}${commastring}"

ksh -c "$verb https://www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?${text}_${width}_${height}_${centralplace}_listis${equl}${commastring}"

exit

fi

fi

fi

fi

fi

exit

โ€ฆ as geo_chartโšซksh (Korn Shell script) (being run at right hand side of the tutorial picture). Testing this got us to identify achange needed to fix a bug with geo_chartโšซphp Geo Chart interfacer at this liveโœ‚run link.


Previous relevant Google Chart Geo Chart Command Line Tutorial is shown below.

Google Chart Geo Chart Command Line Tutorial

Google Chart Geo Chart Command Line Tutorial   ๐Ÿ”

For a complex set of online web application requirements you can think to โ€ฆ

  • write one (or just a few) web application(s) with lots of functionality โ€œsmartsโ€, each โ€ฆ or โ€ฆ
  • write lots of small independent web applications with specialized subsets of that total functionality requirement

We generally prefer the first approach, though quite like โ€œpeer to peerโ€ arrangements if it is the second approach taken. You might say Microsoft Word is a fabulous example of the first approach. Am sure you will agree there are lists as long as your arm about the pros of Microsoft Word, but there will be people that say the same about its cons. You open Microsoft Word and the complexity of the GUI (ie. look) might put off some users. The complexity of the Javascript prompt โ€œblurbsโ€ of our Google Chart Geo Chart interfacer worry us in this same feeling.

When this happens, though, a fresh access approach, even with the first arrangement above, can be to slice through the โ€œbutter of complexityโ€. We want to be able to reach the Geo Chart via the relevant non-mobile platformโ€™s command line access, here on our macOS MacBook Pro, that being a command like โ€ฆ



open https://www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?xtext_1112_694_listis=Sydney,Rome,London,Brisbane,Beijing

โ€ฆ paring down a whole raft of Javascript prompt windows into a single very flexible command line argument. Lucky arrangement, perhaps? Not exactly, it is a useful plan not to involve the โ€œ&โ€ ampersand delimiter of non-first arguments (of the address bar URLs) because, at least on Linux and Unix and macOS based command lines, not clash with that second โ€œ&โ€ meaning of โ€œsetting a process into the backgroundโ€.

And so, onto the recent Google Chart Geo Chart Zoom In Quiz Sharing Tutorial we have thesechanges to geo_chartโšซphp Geo Chart interfacer at this liveโœ‚run link, where we allow for some command line access user interface flexibility, swinging into play.


Previous relevant Google Chart Geo Chart Zoom In Quiz Sharing Tutorial is shown below.

Google Chart Geo Chart Zoom In Quiz Sharing Tutorial

Google Chart Geo Chart Zoom In Quiz Sharing Tutorial   ๐Ÿ”

Adding functionality to yesterdayโ€™s Google Chart Geo Chart Zoom In Quiz Tutorial we see an opportunity to โ€ฆ

  • add an element of โ€œwhenโ€ functionality onto the โ€œwhereโ€ strengths of the Google Chart Geo Chart recent work, via PHP TimeZones and interfacing to the work of the recent Looks Nice Nearby Speech to Text Game Video Tutorial โ€ฆ as well as โ€ฆ
  • means by which to share or collaborate with the โ€œMy World Zoom In Quizโ€ โ€ฆ via โ€ฆ
    1. email ๐Ÿ“ง (via inline HTML PHP mail) โ€ฆ or โ€ฆ
    2. SMS ๐Ÿ“Ÿ (via โ€œaโ€ tag href=sms: link)

โ€ฆ and that last SMS methodology brought into focus our wish not to allow, yet, a URL approach to get directly to this new โ€œMy World Zoom In Quizโ€ (although we may change this strategy into the future). So, how to apply security over the use of a URL such as โ€ฆ

https://www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?wqperspective=Monday+10+Feb+2020+17:57:15.7182

โ€ฆ not linked, above, because there is no point. We have already clicked it in an SMS we got sent, and that nullifies its use from then on? Huh?! Yes, we use the PHP itself, as we are fond of doing, storing (a form of) that โ€œMonday+10+Feb+2020+17:57:15.7182โ€ away as a comment in amongst the PHP code and, hence, โ€œfile_get_contentsโ€ checkable by its or some other PHP code for its existence (as well as the โ€œfile_put_contentsโ€ based clean up removal of said comment after the SMSeeโ€™s (body) link is ever clicked), as the security check for whether we navigate to the โ€œMy World Zoom In Quizโ€ (bringing up that last correct answer) via an SMS body URL link, clicked by an SMSee. And that collaborator can do the same thing back to the original sender for the next wrong answerโ€™s similar ๐Ÿ“Ÿ emoji button press instigation of this sharing and collaboration Javascript logic โ€ฆ



function smswho() {

if (smsorig == '') { smsorig=document.getElementById('smssend').href.split('0000')[0]; }

if (smsdateorig == '') { smsdateorig=document.getElementById('smsdate').value; }

var smsto=prompt('SMS to?', document.getElementById('smssend').href.split('sms:')[1].split('?')[0]);

if (smsto == null) { smsto = ''; }

if (smsto.trim() != '') {

document.getElementById('smsdate').value=smsdateorig + '.' + gsv.substring(0,1).charCodeAt(0) + gsv.substring(1).substring(0,1).charCodeAt(0);

document.getElementById('smsbut').click();

document.getElementById('smssend').href=(smsorig + '' + gsv.substring(0,1).charCodeAt(0) + gsv.substring(1).substring(0,1).charCodeAt(0)).replace('sms:?','sms:' + smsto + '?');

document.getElementById('smssend').click();

}

}




function emailwho() {

var emto=prompt('Email to?', document.getElementById('emailto').value);

if (emto == null) { emto = ''; }

if (emto.indexOf('@') != -1) {

document.getElementById('emailto').value=emto;

document.getElementById('hcont').value='<html><body><form action=' + document.URL + ' method=POST><input type=hidden value=' + gsv + ' name=wqperspective></input><input type=submit value=\"My World Zoom In Quiz\" style=\"background-color:yellow;\"></input></form></body></html>';

document.getElementById('iemail').click();

}

}

โ€ฆ in the context of allthese changes to geo_chartโšซphp Geo Chart interfacer at this liveโœ‚run link, where we remind you again, a substitution of โ€œSurveyโ€ by โ€œQuizโ€ at the first title prompt can show the โ€œMy World Zoom In Quizโ€ in a new window.


Previous relevant Google Chart Geo Chart Zoom In Quiz Tutorial is shown below.

Google Chart Geo Chart Zoom In Quiz Tutorial

Google Chart Geo Chart Zoom In Quiz Tutorial   ๐Ÿ”

Today weโ€™re combining โ€ฆ

โ€ฆ to create another form of quiz (we think of as โ€œMy World Zoom In Quizโ€) the user can navigate to via the way they answer that first title prompt (substituting โ€œSurveyโ€ with โ€œQuizโ€). You might prefer to think of it as the โ€œGeographical Perspective Quizโ€ with a degree of difficulty, often, because to see a โ€œZoomed Inโ€ display of a country or region can be disorienting and challenging to recognize. And so, for incorrect dropdown answers, we provide a โ€œzoomed outโ€ world view of where that โ€œzoomed inโ€ view sits (like an inset).

In order to show you this below please click

Again, a bit of a different tack to yesterday with thereworked geo_chartโšซphp Geo Chart interfacer at this liveโœ‚run link, where a substitution of โ€œSurveyโ€ by โ€œQuizโ€ at the first title prompt can show the โ€œMy World Zoom In Quizโ€ (like above) in a new window.


Previous relevant Google Chart Geo Chart Small Region Tutorial is shown below.

Google Chart Geo Chart Small Region Tutorial

Google Chart Geo Chart Small Region Tutorial   ๐Ÿ”

Meanwhile, resuming our dreams of Andorra, there must be hundreds of readers there a bit sick of us going on and on and on and on and on about our Google Chart Geo Chart interfacing Quizzes and the use of complex โ€œwidthโ€ (and โ€œheightโ€) prompt user interactions. After all, we came onto this topic more to do with โ€œsmall countriesโ€. Well, letโ€™s go back to that and letโ€™s say โ€ฆ

  • as well as the โ€œmarkersโ€ mode (geographicals) latitude and longitude (helped out by PHP TimeZone places) way of signifying the position of a small country on a world or continent map โ€ฆ always, there behind the scenes, set up ages ago, was the interfacing we had set up to โ€ฆ
  • connect with the Google Chart โ€œsmartsโ€ regarding โ€œregionโ€ mapping to be able to hone in on a โ€œregionโ€ (which can mean a whole country too) of interest

โ€ฆ and that means, today, we revisit our imaginary jaunts in Andorra setting out from the big smoke of โ€ฆ



Andorra la Vella

โ€ฆ to the border tranquillity of โ€ฆ



Pas de la Casa

โ€ฆ in the scenario of todayโ€™s tutorial picture โ€ฆ honing in on the user interaction before the width one (yayyyyyy!) with that title prompt. At this prompt we make use of two extensions to default behaviour with our PHP web application, those being โ€ฆ

  1. prefix of โ€œregion codeโ€ + โ€œ;โ€ ( in the case of Andorra an ISO 2 Character Country Code โ€œADโ€ + โ€œ;โ€ = porkAD; )
  2. suffix of โ€œheads upโ€ placename list (making it so you will probably not need to fish around for any latitude and longitude geographicals yourself) via &areplaces=[comma (and + if you want lines joining) separated placename list] โ€ฆ eg. &areplaces=Andorra la Vella,+Pas de la Casa

โ€ฆ to end up with a user title data item user interaction entry of โ€ฆ



AD;My World Survey&areplaces=Andorra la Vella,+Pas de la Casa

โ€ฆ as the lead in to โ€œnot much thinkingโ€ (and as long as you are not Pinocchio, โ€œfollow your noseโ€ ease) required for the other non-quiz-based prompts (ie. no need for width or height mantissae โ€ฆ

โ€ฆ in this scenario).

Quite a bit of a different tack to yesterdayโ€™s Google Chart Geo Chart Quiz Tooltip Flag Tutorial that you can see howwe needed to tweak geo_chartโšซphp Geo Chart interfacer at this liveโœ‚run link, showing the versatility and usefulness of Google Chart Geo Charts.


Previous relevant Google Chart Geo Chart Quiz Tooltip Flag Tutorial is shown below.

Google Chart Geo Chart Quiz Tooltip Flag Tutorial

Google Chart Geo Chart Quiz Tooltip Flag Tutorial   ๐Ÿ”

Yesterdayโ€™s Google Chart Geo Chart Quiz on Mobile Tutorialโ€˜s Google Chart Geo Chart interfacing uses โ€ฆ

  • onmouseover event tooltip functionality for non-mobile platforms โ€ฆ and, better something than nothing, we guess โ€ฆ
  • first onclick event tooltip functionality for mobile platforms

โ€ฆ a blessing, in our view, that an onmouseover (ie. on hover) piece of functionality thinking survives into the mobile platform wooooooooorrrrrlllddd in some way shape or form. We generally find tooltips an optimistic and useful webpage functionality tool.

And with this in mind, it was worth our mindโ€™s attention to ask โ€ฆ โ€œwhat about if the Geo Chart Quiz functionality can, optionally, help out the user a bit without giving the game away?โ€ โ€ฆ in the sense that ISO 2 character country codes can be baffling, yet help to make the quiz a challenge, on occasions, though enough of a turn off for some users, weโ€™re sure. But to place an Emoji Flag could be a feature some quizzers will like and appreciate.

Rather than add to the navigational data weโ€™d rather โ€œaddโ€ an Emoji Flag on being โ€œflaggedโ€ (tee hee) to do so, that โ€œflaggingโ€ being to add argument โ€œ&flag=yโ€ into the mix, at the width value prompt, which is the same prompt whereby a user decides to create a quiz in the first place. And because Emojis represent text data (albeit multibyte ones) we wonโ€™t even need to change data structures, just data content involving the one string structure member of โ€ฆ



['Latitude','Longitude','Country','Countdown']

โ€ฆ which weโ€™ve been sending as that countryโ€™s ISO 2 character code (to leave some challenge to the quizzer, where the user has been seeing that ISO code only โ€œon hoverโ€ up to today) โ€ฆ but if the user has โ€œflaggedโ€ &flag=y this code below swings into play appending text data onto that ISO Code text data (of PHP variable (and argument) โ€œ$instuffโ€ below) via String.fromCodePoint() function, as per โ€ฆ

<?php


$lri=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];

$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"];



function maybequizflag($instuff) {

global $GETdata, $iso_country_codes, $flagentity, $lri, $dri;

if (isset($_GET['quiz']) || isset($_POST['quiz'])) {

if (isset($_GET['flag']) || isset($_POST['flag'])) {

if (strpos($instuff, "['Lat','Long',") !== false) {

return $instuff; //str_replace("'Country',", "'Country','Flag',", $instuff);

} else {

$outstuff=$instuff;

$cbits=explode("'", $instuff);

$outstuff=$cbits[0];

$uretv=" ' + '";

for ($iol=1; $iol<sizeof($cbits); $iol++) {

if (($iol % 2) == 1) {

if (strlen($cbits[$iol]) == 2) {

for ($jjm=0; $jjm<strlen($cbits[$iol]); $jjm++) {

for ($jm=0; $jm<sizeof($lri); $jm++) {

if (strtoupper(substr($cbits[$iol],$jjm,1)) == $lri[$jm]) {

$uretv=str_replace(" + '", " + String.fromCodePoint(" . $dri[$jm] . ") + '", $uretv); //uvaltosfcp($dri[$jm]);

}

}

}

$outstuff.="'" . $cbits[$iol] . $uretv;

$uretv="' + '";

} else {

$uretv=" ' + '";

for ($im=1; $im<sizeof($iso_country_codes); $im+=2) {

if ($uretv == " ' + '" && strpos(strtolower($iso_country_codes[$im]), strtolower(str_replace("%20"," ",str_replace("%E2%80%99","",str_replace("%2C",",",$cbits[$iol]))))) !== false) {

for ($jjm=0; $jjm<strlen($iso_country_codes[-1 + $im]); $jjm++) {

for ($jm=0; $jm<sizeof($lri); $jm++) {

if (strtoupper(substr($iso_country_codes[-1 + $im],$jjm,1)) == $lri[$jm]) {

$uretv=str_replace(" + '", " + String.fromCodePoint(" . $dri[$jm] . ") + '", $uretv); //uvaltosfcp($dri[$jm]);

}

}

}

}

}

$outstuff.="'" . $cbits[$iol] . $uretv;

$uretv="' + '";

}

} else {

$outstuff.="'" . $cbits[$iol];

}

}

return $outstuff; //str_replace("',9", "','x',9", str_replace("',8", "','x',8", str_replace("',7", "','x',7", str_replace("',6", "','x',6", str_replace("',5", "','x',5", str_replace("',4", "','x',4", str_replace("',3", "','x',3", str_replace("',2", "','x',2", str_replace("',1", "','x',1", str_replace("',0", "','x',0", $instuff))))))))));

}

}

}

return $instuff;

}


?>

Again, you can try thechanged geo_chartโšซphp Geo Chart interfacer at this liveโœ‚run link.


Previous relevant Google Chart Geo Chart Quiz on Mobile Tutorial is shown below.

Google Chart Geo Chart Quiz on Mobile Tutorial

Google Chart Geo Chart Quiz on Mobile Tutorial   ๐Ÿ”

We wanted to improve on the recent Google Chart Geo Chart More Quizzes Tutorialโ€˜s โ€œWorld Quizโ€ functionality approach of displaying window.open popups for mobile platforms. The reason for the concern on mobile platforms, and not such a concern on non-mobile platforms (though there is a concern about popup window web browser disabling settings), because the chance to โ€œoverlayโ€ a popup window (via the use of a third argument to window.open calls) is ignored on mobile platforms, instead opening a new browser tab (at best). This can be disconcerting, akin to telling a room of students doing an important examination, to look out the window at an interesting magpie (warbling about Collingwoodโ€™s last triumph, no doubt).

Well, after extensive research, and first trying to position โ€œanything newโ€ down the bottom of the webpage we โ€ฆ

  • rejected idea of whole display of a relevant Wikipedia page content at the bottom (of a mobile userโ€™s Geo Chart โ€œquizโ€ webpage) โ€ฆ associated with a โ€ฆ
  • rejected โ€œaโ€ hashtag link down the bottom (but above proposed content above) to navigate back up to the quiz โ€ฆ to, instead โ€ฆ
  • start thinking that it is up to the mobile user to act themselves to ever navigate away from the quiz webpage, so, instead, initially condense the Wikipedia content down to an image that is โ€ฆ
    1. if HTTPS:// protocol being used, use the Google Page Insights screenshotting โ€œsmartsโ€ you can see being used at PDF Slideshow and Form Creation Data URI Contents Tutorial
    2. if HTTP:// protocol being used, use the (thumbnail version of) the first image of the relevant Wikipedia webpage

    โ€ฆ encased by an โ€œaโ€ tag that the click of navigates the user to the relevant Wikipedia content in a new tab (at best), all positioned at the left hand side of the Geo Chart webpageโ€™s H1 or H2 tag heading as a 70px width42px height thumbnail

The conduit here are Ajax Javascript techniques as per โ€ฆ



var myxhr = false;

var oursrc = '';

var woourl='';




function ajit(wourl) {

woourl=wourl;

var xurl = '';

if (document.URL.toLowerCase().indexOf('https') == 0) {

xurl='https://www.googleapis.com/pagespeedonline/v1/runPagespeed?url=' + encodeURIComponent(wourl) + '&screenshot=true';

} else {

xurl=document.URL.split('/GeoChart')[0] + '/fgc/?tdinto=&inurl=' + encodeURIComponent(wourl);

}

if (window.XMLHttpRequest) {

myxhr = new window.XMLHttpRequest;

}

else {

try {

myxhr = new ActiveXObject('Msxml2.XMLHTTP');

} catch (othermicrosoft) {

try {

myxhr = new ActiveXObject('Microsoft.XMLHTTP');

} catch (failed) {

myxhr = false;

}

}

}

if (myxhr) {

myxhr.onreadystatechange = backin;

myxhr.open('GET', xurl, true);

myxhr.send(null);

}

}




function backin() {

if (myxhr.readyState == 4) {

if (myxhr.status == 200) {

if (myxhr.responseText) {

var dbits = myxhr.responseText.split('\"data\":');

if (dbits.length > 1) {

oursrc='data:image/jpeg;base64,' + dbits[1].split('\"')[1].split('\"')[0].replace(/\_/g,'/').replace(/\-/g,'+');

ism='nm';

if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {

ism='';

document.getElementById(ism + 'dwoalttwo').style.position='absolute';

document.getElementById(ism + 'dwoalttwo').style.left='20px';

document.getElementById(ism + 'dwoalttwo').style.top='0px';

document.getElementById(ism + 'dwoalttwo').style.opacity='0.95';

document.getElementById(ism + 'dwoalttwo').style.zIndex='51';

} else {

document.getElementById(ism + 'dwoalt').innerHTML='<br><a id=btta href=#myh title=Top>Back to top</a>';

}

document.getElementById(ism + 'dwoalttwo').innerHTML='<a target=_blank id=adw title=Wikipedia style=z-index:52; href=' + woourl + '><img title=Wikipedia style=width:80px;z-index:52; src=' + oursrc + '></img></a>';

document.getElementById('myh').onclick=function() { document.getElementById('adw').click(); }

if (ism != '') { location.href='#btta'; }

} else if (myxhr.responseText.indexOf('<img') != -1) {

dbits = myxhr.responseText.split('<img');

dbits=dbits[1].split(' src=');

ism='nm';

if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {

ism='';

document.getElementById(ism + 'dwoalttwo').style.position='absolute';

document.getElementById(ism + 'dwoalttwo').style.left='20px';

document.getElementById(ism + 'dwoalttwo').style.top='0px';

document.getElementById(ism + 'dwoalttwo').style.opacity='0.95';

document.getElementById(ism + 'dwoalttwo').style.zIndex='51';

} else {

document.getElementById(ism + 'dwoalt').innerHTML='<br><a id=btta href=#myh title=Top>Back to top</a>';

}

document.getElementById(ism + 'dwoalttwo').innerHTML='<a target=_blank id=adw title=Wikipedia style=z-index:52; href=' + woourl + '><img title=Wikipedia style=width:80px;z-index:52; src=' + dbits[1].split(' ')[0].split('>')[0] + '></img></a>';

document.getElementById('myh').onclick=function() { document.getElementById('adw').click(); }

if (ism != '') { location.href='#btta'; }

}

}

}

}

}

โ€ฆ with the effect, for a mobile user, of not being interrupted from their quiz, unless this thumbnail (Wikipedia content) appears at the top left, that they can โ€œlong clickโ€ to open in a โ€œNew Tabโ€ (or, perhaps, a โ€œSplit Viewโ€) as required, at least on the iPad we tried this with.

And so, you can try thechanged geo_chartโšซphp Geo Chart interfacer at this liveโœ‚run link, we hope representing an improvement for the Quizzing User Experience for our mobile user readers.


Previous relevant Google Chart Geo Chart More Quizzes Tutorial is shown below.

Google Chart Geo Chart More Quizzes Tutorial

Google Chart Geo Chart More Quizzes Tutorial   ๐Ÿ”

In allowing the World Quiz web applications of yesterdayโ€™s Google Chart Geo Chart World Quizzes Tutorial work accept more than about โ€ฆ

  • the 10 places (per continent Geo Chart) fitting into a $_GET arguments URL (of about 850 characters, for rjmprogramming.com.au domain) โ€ฆ the first cab off the rank allowing for โ€ฆ
  • a lot more than 10 can be accepted via $_POST in an HTML form method=POST action=./geo_chart.php

You may wonder why โ€œfirst cab off the rankโ€ here. Well, weโ€™re not sure we wonโ€™t involve window.sessionStorage or window.localStorage in future plans. It being PHP weโ€™re writing though, we will need a compelling reason to try this.

We allow you to ask the web application to try more places by (optionally) appending space characters onto the height values they enter.

You can try thechanged (and note โ€œfunction iftoobig()โ€ in particular, here) geo_chartโšซphp Geo Chart interfacer at this liveโœ‚run link, and try it with a few right space appended โ€œheightsโ€ to try out this new functionality.


Previous relevant Google Chart Geo Chart World Quizzes Tutorial is shown below.

Google Chart Geo Chart World Quizzes Tutorial

Google Chart Geo Chart World Quizzes Tutorial   ๐Ÿ”

Weโ€™re heading towards โ€œprove it for nโ€ on top of the recent Google Chart Geo Chart Oceania Quiz Tutorial (โ€œprove it for 2โ€) progress, making quizzes for โ€ฆ

  • Europe
  • South East Asia and Oceania
  • Africa
  • South America
  • North and Central America
  • Asia

โ€ฆ but feel we need more testing to bed it down, as far as reliability issues go, and weโ€™ll keep you posted on that.

We found clutter issue with ISO 2 character Country Codes โ€ฆ

ISO Code 1 Country TZ Place 1 (Lat,Long) Too Close To Country TZ Place 2 (Lat,Long) ISO Code 2
VA Vatican City
(41.90222,
12.45305)
(-0.02,
+0.03)
Rome, Italy
(41.9,
12.48333)
IT
BJ Porto-Novo, Benin
(6.48333,
2.61666)
(-0.03,
+0.78)
Lagos, Nigeria
(6.45,
3.4)
NG

โ€ฆ and so โ€œfashionedโ€ this into a numerical basis for a โ€œdeclutterโ€ algorithm โ€ฆ



function setsixteenquiz() {

var sixteen=16;

var allcontinents=['Europe','South East Asia and Oceania', 'Africa', 'South America', 'North and Central America', 'Asia'];

var thiscontinent=isquiz;

var cisq=-1;

var exclusions=',';

var sofarq=',-1,';

var ourselceqih=selceqih.replace(/\ data\-alt\-/g, ' data-');

if (thiscontinent == 'South East Asia and Oceania') {

sixteen=10;

} else if (thiscontinent == 'Africa') {

sixteen=17;

} else if (thiscontinent == 'South America') {

sixteen=10;

} else if (thiscontinent == 'North and Central America') {

sixteen=10;

}

for (var isqis=0; isqis<allcontinents.length; isqis++) {

if (allcontinents[isqis] != thiscontinent) {

while (ourselceqih.indexOf(' data-continent=\"' + allcontinents[isqis] + '\"') != -1) {

ourselceqih=ourselceqih.replace(' data-continent=\"' + allcontinents[isqis] + '\"','');

}

}

}

var sqws=ourselceqih.split(' data-continent=\"' + thiscontinent + '\" value=\"');

document.body.title='Awaiting quiz clickable circle symbols to score ...';

document.body.style.cursor=pcur;

if (document.getElementById('chart')) {

document.getElementById('chart').title='Awaiting quiz clickable circle symbols to score ... ';

document.getElementById('chart').style.cursor=pcur;

}

var latsofar=[], longsofar=[], thislats=0.0, thislongs=0.0;

var valid=true, ivalid=0, difflatlong=0.0;


while (quizisos.length < sixteen) {

cisq=-1;

while (sofarq.indexOf(',' + cisq + ',') != -1 || exclusions.indexOf(',' + cisq + ',') != -1) {

cisq=Math.floor(Math.random() * eval(-1 + sqws.length));

cisq++;

if (ourtzlist.indexOf(',' + sqws[cisq].split('\"')[0] + ',') != -1) {

thislats=(eval(ourtzlist.split(',' + sqws[cisq].split('\"')[0] + ',')[0].split(' data-geo=\"')[eval(-1 + ourtzlist.split(',' + sqws[cisq].split('\"')[0] + ',')[0].split(' data-geo=\"').length)].split(',')[0]));

thislongs=(eval(ourtzlist.split(',' + sqws[cisq].split('\"')[0] + ',')[0].split(' data-geo=\"')[eval(-1 + ourtzlist.split(',' + sqws[cisq].split('\"')[0] + ',')[0].split(' data-geo=\"').length)].split(',')[1]));

}


if (thiscontinent == 'South East Asia and Oceania') {

if (ourtzlist.indexOf(',' + sqws[cisq].split('\"')[0] + ',') != -1) {

if (eval(ourtzlist.split(',' + sqws[cisq].split('\"')[0] + ',')[0].split(' data-geo=\"')[eval(-1 + ourtzlist.split(',' + sqws[cisq].split('\"')[0] + ',')[0].split(' data-geo=\"').length)].split(',')[1]) < 73.0) { // || eval(ourtzlist.split(',' + ourselceqih[cisq].split('\"')[0] + ',')[0].split(' data-geo=\"')[eval(-1 + ourtzlist.split(',' + ourselceqih[cisq].split('\"')[0] + ',')[0].split(' data-geo=\"').length)].split(',')[1]) >= 169.0) {

cisq=-1;

}

} else {

cisq=-1;

}

}

}

sofarq+='' + cisq + ',';

if (cisq != -1) {

if (sqws[cisq].split('\"')[0] == 'IT') { exclusions+='VA,'; } else if (sqws[cisq].split('\"')[0] == 'VA') { exclusions+='IT,'; }

if (sqws[cisq].split('\"')[0] == 'BJ') { exclusions+='NG,'; } else if (sqws[cisq].split('\"')[0] == 'NG') { exclusions+='BJ,'; }

difflatlong=0.0;

if (quizisos.length > 0) {

for (ivalid=0; ivalid<quizisos.length; ivalid++) {

difflatlong=Math.abs(eval('' + latsofar[ivalid]) - eval('' + thislats)) + Math.abs(eval('' + longsofar[ivalid]) - eval('' + thislongs));

}

}

if (difflatlong >= 2.0 || quizisos.length == 0) {

latsofar.push(thislats);

longsofar.push(thislongs);

quizisos.push(sqws[cisq].split('\"')[0]);

}


}

}

quizisos.push(\"\");

}

Hereโ€™s your chance to try thechanged geo_chartโšซphp Geo Chart interfacer at this liveโœ‚run link, and enter Africa, South America, North and Central America and Asia Quiz territory by following pointers at the โ€œwidthโ€ interactive entry (Javascript) prompt window.


Previous relevant Google Chart Geo Chart Oceania Quiz Tutorial is shown below.

Google Chart Geo Chart Oceania Quiz Tutorial

Google Chart Geo Chart Oceania Quiz Tutorial   ๐Ÿ”

Regular readers will know about our penchant for โ€œmathematical inductionโ€ theory, in the way you โ€ฆ

  • prove it for 1
  • prove it for 2
  • prove it for n

โ€ฆ and earlier this morning โ€œtoo proudโ€ moi thought weโ€™d be at โ€œnโ€, skipping โ€œ2โ€ by now getting our Geo Chart interfacing new โ€œQuizโ€ functionality to have covered user interactions for all the major continents of greater than 10 (of category) places, looking towards the โ€œ10 is a bit lameโ€ thinking, to follow. Oh, well! But maybe thatโ€™s the point of the โ€œ2โ€ in the โ€œmathematical inductionโ€ proof โ€œgameโ€. A lot might be discovered, and so it was for us, trying to open the door to โ€ฆ come in โ€ฆ



South East Asia and Oceania ...

โ€ฆ spinner! In broad brush concepts, we discovered โ€ฆ

  • we needed to start to worry about places with an ISO 2 code but no TimeZone โ€ฆ
  • we needed to start to worry about places off to the left, right, and top limits of the Geo Chart limits we establish via those weird width and height values you enter โ€ฆ and on this am sure many will have tweaked that the value integer parts are like a โ€œscalarโ€ measure and the mantissae are a โ€œleft zero padded percentage offset into the entire Geo Chart on which to lobโ€ measure
  • we needed to rearrange the scoring systemโ€™s denominator as a โ€œseconds timerโ€ rather than a โ€œnumber of goesโ€
  • we needed to, at least at the start, mention name of Quiz
  • we needed to start closing previous Wikipedia windows on opening a new one, as applicable
  • we needed to start to worry about clutter (eg. Vatican City and Rome geographicals for two different countries)
  • we needed to start to worry about โ€œskewed representationsโ€ (going back to Europe Quiz) whereby the first mention of a country ISO 2 Code within the TimeZone list is a position of a colony or dominion

โ€ฆ whereas we optimistically imagined all we might need to worry about was just โ€ฆ

  • converting (boolean binary decision) variable isquiz=false/true (Javascript code logic) into (string ternary and more decision) variable isquiz=โ€/โ€™Europeโ€™/โ€™South East Asia and Oceaniaโ€™ (with more to come โ€ฆ until โ€œnโ€ (for) nirvana) โ€ฆ and associated โ€ฆ
  • adding data-continent=โ€South East Asia and Oceaniaโ€ global data attributes into dropdown id=โ€™selceqโ€™ linking ISO 2 codes with Country names
  • trying to add a bit of cursor=โ€™progressโ€™ flagging of web application โ€œthinking timeโ€

Never mind! And so, onto yesterdayโ€™s Google Chart Geo Chart Europe Quiz Tutorial progress there is not that much difference user interaction wise, just the offer of another weird โ€œwidthโ€ value choice (on which to blow your mind) but behind the scenes a โ€œhard working mathematical induction middlemanpersonโ€ can now offer you the chance to try thechanged geo_chartโšซphp Geo Chart interfacer at this liveโœ‚run link, and enter South East Asia and Oceania Quiz territory by following pointers at the โ€œwidthโ€ interactive entry (Javascript) prompt window.


Previous relevant Google Chart Geo Chart Europe Quiz Tutorial is shown below.

Google Chart Geo Chart Europe Quiz Tutorial

Google Chart Geo Chart Europe Quiz Tutorial   ๐Ÿ”

Up to yesterdayโ€™s Google Chart Geo Chart Sorted Small Countries Tutorial, as with interfacings to other Google Charts, we had a two phase aspect to the web application structures โ€ฆ

  1. ask for user interaction via the keyboard
  2. display the resultant Google Chart taking notice of that user interaction

โ€ฆ but todayโ€™s extension of Geo Chart interfacing functionality opens the door to the new โ€ฆ

  • display the resultant Google Chart taking notice of that user interaction and allowing click/touch continuing interaction in the form of a quiz โ€ฆ first cab off the rank โ€ฆ Europe Quiz

The work recently has helped because โ€ฆ



function gck(igck) {

var ansis='';

if (document.getElementById('attachedImage' + ('' + igck).replace('-1',''))) {

var xxx=document.getElementById('attachedImage' + ('' + igck).replace('-1','')).getAttribute('title');

if (xxx.indexOf('#') != -1) {

if (isquiz) {

maybe_bad=false;

if (xxx.split('#')[1].indexOf('/') != -1) {

ansis=xxx.split('#')[1].split('/')[eval(-1 + xxx.split('#')[1].split('/').length)].toLowerCase();

} else {

ansis=xxx.split('#')[1];

}

if (document.getElementById('sans').getAttribute('data-title').toLowerCase().replace(/\ /g,'_') == ansis.toLowerCase().replace(/\ /g,'_')) {

score++;

goes++;

} else {

goes++;

}

document.getElementById('sans').innerHTML='? ' + score + '/' + goes;

}


window.open(xxx.split('#')[1],'_blank', 'top=50,left=50,width=500,height=500');

} else if (xxx == '') {

if (isquiz) {

maybe_bad=false;

if (document.getElementById('attachedImage' + ('' + igck).replace('-1','')).title.indexOf('/') != -1) {

ansis=document.getElementById('attachedImage' + ('' + igck).replace('-1','')).title.split('/')[eval(-1 + xxx.split('#')[1].split('/').length)].toLowerCase();

} else {

ansis=document.getElementById('attachedImage' + ('' + igck).replace('-1','')).title;

}

if (document.getElementById('sans').getAttribute('data-title').toLowerCase().replace(/\ /g,'_') == ansis.toLowerCase().replace(/\ /g,'_')) {

score++;

goes++;

} else {

goes++;

}

document.getElementById('sans').innerHTML='? ' + score + '/' + goes;

}


window.open(document.getElementById('attachedImage' + ('' + igck).replace('-1','')).title,'_blank', 'top=50,left=50,width=500,height=500');

} else {

if (isquiz) {

maybe_bad=false;

if (xxx.indexOf('/') != -1) {

ansis=xxx.split('/')[eval(-1 + xxx.split('/').length)].toLowerCase();

} else {

ansis=xxx;

}

if (document.getElementById('sans').getAttribute('data-title').toLowerCase().replace(/\ /g,'_') == ansis.toLowerCase().replace(/\ /g,'_')) {

score++;

goes++;

} else {

goes++;

}

document.getElementById('sans').innerHTML='? ' + score + '/' + goes;

}


window.open(xxx,'_blank', 'top=50,left=50,width=500,height=500');

}

}

}

โ€ฆ is an onclick place weโ€™ve set aside for our SVG intervention work. Keep it to no keyboard for this Europe Quiz, and we are happy (with this new idea, reminiscent of recent tweaking at Google Chart Annotated Timeline Whitespace Delimitation Tutorial).

So, again, you can try thechanged geo_chartโšซphp Geo Chart interfacer at this liveโœ‚run link, and enter Europe Quiz territory by following pointers at the โ€œwidthโ€ interactive entry (Javascript) prompt window.


Previous relevant Google Chart Geo Chart Sorted Small Countries Tutorial is shown below.

Google Chart Geo Chart Sorted Small Countries Tutorial

Google Chart Geo Chart Sorted Small Countries Tutorial   ๐Ÿ”

Yesterdayโ€™s Google Chart Geo Chart Small Countries Overlay Tutorialโ€˜s workings potentially using the geographicals (or marker) mode of use actually involve intervention logic within what Google provide SVG-wise for the Geo Chart content.

And so, for some time, the order in which we entered โ€ฆ

Country Surface Area (sq km)
Australia 7692024
New Zealand 269190
Andorra 468

โ€ฆ we entered, interactively by us, like, personally, like, in that order above, like. But for a day or two we were covering up a gap in the โ€œwall of logicโ€ plaster we had created for Google Chart select event logic (actually non-existant for the Geo Chart, but we code for onclick logic to navigate a user to a relevant Wikipedia page). The good news is we have fixed it now, not tying the user down to entering data in any particular order.

Fixed what, now? (I thought I heard you ask?!) Well, the alignment of &aregeographical= data to the symbology presented at the geographical positions on the Geo Map asks that the order we present corresponds to the relevant order of relevant Google SVG elements, and Google orders these from the largest numerical value down to the smallest, as you notice as far as Surface Area (sq km) suits an order of Australia, New Zealand, Andorra โ€ฆ

First non-overlay URL version goes https://www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?title=Surface%20Areas%20(sq%20km)&width=1112&height=694&country=Country&popularity=Surface%20Area%20(sq%20km)&data=%20[-34.91667|138.58333|~Australia~,7692024]%20,%20[-36.86667|174.76666|~New%20Zealand~,269190]%20,%20[42.5|1.51666|~Andorra~,468]%20&aregeographicals=http.Australia%2Chttp.New%20Zealand%2Chttp.Andorra
Second overlay URL version goes https://www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?title=Surface%20Areas%20(sq%20km)&width=1112&height=694&country=Country&popularity=Surface%20Area%20(sq%20km)&data=%20[-34.91667|138.58333|~Australia~,7692024]%20,%20[-36.86667|174.76666|~New%20Zealand~,269190]%20,%20[42.5|1.51666|~Andorra~,468]%20&overlay=y&aregeographicals=http.Australia%2Chttp.New%20Zealand%2Chttp.Andorra
But the recent work means overlay URL version created interactively with order New Zealand, Andorra, Australia https://www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?title=Surface%20Areas%20(sq%20km)&width=1112&height=694&country=Country&popularity=Surface%20Area%20(sq%20km)&data=%20[-36.86667|174.76666|~New%20Zealand~,269190]%20,%20[42.5|1.51666|~Andorra~,468]%20,%20[-34.91667|138.58333|~Australia~,7692024]%20&overlay=y&aregeographicals=http.Australia%2Chttp.New%20Zealand%2Chttp.Andorra
also works

โ€ฆ and the changes necessary to ensure this go โ€ฆ



// var pushfrom=[], pushto=[], pushag=[], selceqih='', saih='', oneistoosmall=false, oneisnotapplicable=false;

function assess_small(indatar) {

var ipl=0, jpl=0, kpl=0, pushxx=[];

var outsuffix='';

var outdatar=indatar;

if (pushfrom.length > 0 && !oneisnotapplicable && oneistoosmall) {

for (jpl=0; jpl<pushfrom.length; jpl++) { // for (var ipl=0; ipl<pushfrom.length; ipl++) {

if (jpl == 0) {

var huhdatas=indatar.split('~');

for (var ihuhdatas=2; ihuhdatas<huhdatas.length; ihuhdatas+=2) {

if (huhdatas[eval(-1 + eval('' + ihuhdatas))].split('~')[0].replace('%20',' ').indexOf(' ') != -1) {

pushxx.push(('00000000000000000000000' + huhdatas[ihuhdatas].split(',')[1].split(']')[0]).slice(-22) + ' ... ' + huhdatas[eval(-1 + eval('' + ihuhdatas))].split('~')[0]);

}

pushxx.push(('00000000000000000000000' + huhdatas[ihuhdatas].split(',')[1].split(']')[0]).slice(-22) + ' ... ' + encodeURIComponent(huhdatas[eval(-1 + eval('' + ihuhdatas))].split('~')[0]));

}

pushxx.sort();

pushxx.reverse();

}

ipl=jpl;

for (kpl=0; kpl<pushfrom.length; kpl++) {

if (ipl == jpl && pushxx[jpl].split(' ... ')[1] == pushfrom[kpl].split('~')[1].split('~')[0]) {

ipl=kpl;

pushxx[jpl]=pushxx[jpl].split(' ... ')[0] + ' ... ';

}

}


if (outdatar.indexOf(pushfrom[ipl]) != -1) {

if (outsuffix == '') {

outsuffix='&aregeographicals=' + pushag[ipl];

} else {

outsuffix+='%2C' + pushag[ipl];

}

while (outdatar.indexOf(pushfrom[ipl]) != -1) {

outdatar=outdatar.replace(pushfrom[ipl], pushto[ipl]);

}

}

}

}




return outdatar + outsuffix;

}

Yet again, you can try thechanged geo_chartโšซphp Geo Chart interfacer at this liveโœ‚run link.


Previous relevant Google Chart Geo Chart Small Countries Overlay Tutorial is shown below.

Google Chart Geo Chart Small Countries Overlay Tutorial

Google Chart Geo Chart Small Countries Overlay Tutorial   ๐Ÿ”

With โ€œoverlayโ€ techniques available in life it might be tempting to say โ€œnever say neverโ€ because you donโ€™t have to compromise a weak solution for a less weak solution. Yesterdayโ€™s Google Chart Geo Chart Small Countries Tutorialโ€˜s Google Chart Geo Chartโ€˜s homegrown interfacer tactics for Small Countries is a case in point.

You may recall from yesterday how we dynamically reverted to โ€œgeographicals modeโ€ display (Google call it โ€œMarkersโ€ mode) when the shading for a Small Country would lead to โ€œdata lossโ€. But what if we โ€ฆ

  • continue what we were doing yesterday โ€œoverlayedโ€ โ€ฆ

    โ€ฆ onto โ€ฆ

  • what we changed from URL-wise with โ€œfunction assess_small()โ€ (with the one codeline change โ€ฆ


    outsuffix='&overlay=y&aregeographicals=' + pushag[ipl];


    ) โ€ฆ in the form of two new HTML iframe code below โ€ฆ
    <?php


    if (isset($_GET['overlay']) || isset($_POST['overlay'])) {

    echo "<script> function overlayit() {

    var ourls=documentURL.split('&overlay=')[0].split('[');

    var ourl=ourls[0];

    for (var iouris=1; iouris<ourls.length; iouris++) {

    if (ourls[iouris].substring(0,1) == '~') {

    ourl+='[' + ourls[iouris];

    } else {

    ourl+='[' + ourls[iouris].replace(ourls[iouris].split('~')[0],'');

    }

    }

    document.body.style.zIndex='-12';

    document.getElementById('doverlay').innerHTML='<iframe style=\"position:absolute;top:0px;left:0px;width:100%;height:100vh;z-index:2;opacity:0.95;\" src=\"' + ourl + '\"></iframe>';

    document.getElementById('doverlaytwo').innerHTML='<iframe style=\"position:absolute;top:0px;left:0px;width:100%;height:100vh;z-index:22;opacity:0.9;\" src=\"' + documentURL.replace('&overlay=','&qw=') + '&guess=' + '\"></iframe>';

    }

    setTimeout(overlayit, 2000);

    </script>

    ";

    }


    ?>

Again, you can try thechanged geo_chartโšซphp Geo Chart interfacer at this liveโœ‚run link.


Previous relevant Google Chart Geo Chart Small Countries Tutorial is shown below.

Google Chart Geo Chart Small Countries Tutorial

Google Chart Geo Chart Small Countries Tutorial   ๐Ÿ”

We last used the excellent Google Chart Geo Chart tool with the work of Window LocalStorage Client Versus Server Map Tutorial, and it was this project that alerted us to both a weakness and a strength of that chart โ€ฆ

  • a weakness being its inability to get the resolution to shade a small country (eg. todayโ€™s tutorial pictureโ€˜s Andorra) โ€ฆ but, the good news, as used with this integration work above โ€ฆ
  • a strength is the alternative display mechanism via geographical entries

โ€ฆ and so, what if โ€ฆ

  • as the user enters in their Country (or Geographical) data โ€ฆ
  • if we can determine it as being a Country being entered โ€ฆ andโ€ฆ
  • you have only ever been entering Countries โ€ฆ and โ€ฆ
  • any one Country so defined has a surface area less than 10000 square kilometers โ€ฆ then โ€ฆ
  • we navigate to a Geographical data version of this โ€œonly Countries enteredโ€ data set โ€ฆ so that โ€ฆ
  • even small such Countries will be displayed โ€ฆ
  • as they would not if still in the default โ€œonly Countries enteredโ€ mode of display

We introduce three new sources of data in order to piece together the (Javascript via PHP coding) logic for this โ€ฆ

  1. TimeZone and Geographicals and ISO 2 Letter Code information โ€ฆ


    var ourtzlist='<option value="Africa/Abidjan" data-geo="5.31666,-4.03334,GMT,CI,+0">Africa/Abidjan</option><option value="Africa/Accra" data-geo="5.55,-0.21667,GMT,GH,+0">Africa/Accra</option>'; // etcetera etcetera etcetera

  2. Country Name and ISO 2 Letter Code information (etcetera etcetera etcetera) โ€ฆ


    <div id=dlookups>

    <select id='selceq' style='display:none;'>

    <option value='AF'>Afghanistan</option>

    <option value='AX'>Aland Islands</option>

    <option value='AL'>Albania</option>

    </select></div>

  3. Surface Areas of Countries thanks to Wikipedia (etcetera etcetera etcetera) โ€ฆ


    <table style='display:none;' id='surface_area' border='1' cellpadding='2' cellspacing='0'>

    <tbody><tr bgcolor='#efefef'>

    <th>Pos

    </th><th>Country

    </th>

    <th>Area (kmยฒ)

    </th></tr>

    <tr>

    <td>1</td>

    <td><a data-href='/wiki/Russia' title='Russia'>Russia</a></td>

    <td>17098246

    </td></tr>

    <tr>

    <td>2</td>

    <td><a data-href='/wiki/Canada' title='Canada'>Canada</a></td>

    <td>9984670

    </td></tr>

    <tr>

    <td>3</td>

    <td><a data-href='/wiki/People%27s_Republic_of_China' title='People's Republic of China'>China</a></td>

    <td>9572900

    </td></tr>

    </tbody></table>

โ€ฆ used where we process a user Country (or Geographical) interaction Javascript code snippet where variable thisris is that user interaction result โ€ฆ



var pushfrom=[], pushto=[], pushag=[], selceqih='', saih='', oneistoosmall=false, oneisnotapplicable=false;



if (ourtzlist.indexOf(',' + thisris.toUpperCase() + ',') != -1 && thisris.length == 2) {

if (selceqih == '') { selceqih=document.getElementById('selceq').innerHTML; }

if (saih == '') { saih=document.getElementById('surface_area').innerHTML; }

pushfrom.push('[~' + thisris + '~');

pushto.push('[' + ourtzlist.split(',' + thisris.toUpperCase() + ',')[0].split(' data-geo=\"')[eval(-1 + ourtzlist.split(',' + thisris.toUpperCase() + ',')[0].split(' data-geo=\"').length)].split(',')[0] + '|' + ourtzlist.split(',' + thisris.toUpperCase() + ',')[0].split(' data-geo=\"')[eval(-1 + ourtzlist.split(',' + thisris.toUpperCase() + ',')[0].split(' data-geo=\"').length)].split(',')[1] + '|~' + thisris.toUpperCase() + '~');

if (selceqih.indexOf(' value=\"' + thisris.toUpperCase() + '\">') != -1) {

pushag.push('http.' + encodeURIComponent(selceqih.split(' value=\"' + thisris.toUpperCase() + '\">')[1].split('<')[0]));

} else {

pushag.push('');

}

if (saih.indexOf('>' + selceqih.split(' value=\"' + thisris.toUpperCase() + '\">')[1].split('<')[0]) != -1) {

thissa=saih.split('>' + selceqih.split(' value=\"' + thisris.toUpperCase() + '\">')[1].split('<')[0])[1].split('<td>')[1].split('<')[0].split(String.fromCharCode(10))[0];

if (eval('' + thissa) < 10000) {

oneistoosmall=true;

}

}

} else if (('' + thisris).trim() != '' && selceqih.toUpperCase().indexOf('>' + thisris.toUpperCase()) != -1) {

thisisocc=selceqih.toUpperCase().split('>' + thisris.toUpperCase())[0].split(' VALUE=\"')[eval(-1 + selceqih.toUpperCase().split('>' + thisris.toUpperCase())[0].split(' VALUE=\"').length)].split('\"')[0];

pushfrom.push('[~' + encodeURIComponent(thisris) + '~');

pushto.push('[' + ourtzlist.split(',' + thisisocc + ',')[0].split(' data-geo=\"')[eval(-1 + ourtzlist.split(',' + thisisocc + ',')[0].split(' data-geo=\"').length)].split(',')[0] + '|' + ourtzlist.split(',' + thisisocc + ',')[0].split(' data-geo=\"')[eval(-1 + ourtzlist.split(',' + thisisocc + ',')[0].split(' data-geo=\"').length)].split(',')[1] + '|~' + encodeURIComponent(thisris) + '~');

pushag.push('http.' + encodeURIComponent(thisris));

if (thisris.indexOf(' ') != -1) {

pushfrom.push('[~' + thisris + '~');

pushto.push('[' + ourtzlist.split(',' + thisisocc + ',')[0].split(' data-geo=\"')[eval(-1 + ourtzlist.split(',' + thisisocc + ',')[0].split(' data-geo=\"').length)].split(',')[0] + '|' + ourtzlist.split(',' + thisisocc + ',')[0].split(' data-geo=\"')[eval(-1 + ourtzlist.split(',' + thisisocc + ',')[0].split(' data-geo=\"').length)].split(',')[1] + '|~' + encodeURIComponent(thisris) + '~');

pushag.push('http.' + encodeURIComponent(thisris));

}

if (saih.toUpperCase().indexOf('>' + thisris.toUpperCase()) != -1) {

thissa=saih.toUpperCase().split('>' + thisris.toUpperCase())[1];

thissa=thissa.split('<TD>')[1].split('<')[0].split(String.fromCharCode(10))[0];

if (eval('' + thissa) < 10000) {

oneistoosmall=true;

}

}

}

โ€ฆ and if remaining relevant just before the next navigation happens, where variable indatar represents the default โ€œonly Countries enteredโ€ mode of display value โ€ฆ



// var pushfrom=[], pushto=[], pushag=[], selceqih='', saih='', oneistoosmall=false, oneisnotapplicable=false;

function assess_small(indatar) {

var outsuffix='';

var outdatar=indatar;

if (pushfrom.length > 0 && !oneisnotapplicable && oneistoosmall) {

for (var ipl=0; ipl<pushfrom.length; ipl++) {

if (outdatar.indexOf(pushfrom[ipl]) != -1) {

if (outsuffix == '') {

outsuffix='&aregeographicals=' + pushag[ipl];

} else {

outsuffix+='%2C' + pushag[ipl];

}

while (outdatar.indexOf(pushfrom[ipl]) != -1) {

outdatar=outdatar.replace(pushfrom[ipl], pushto[ipl]);

}

}

}

}




return outdatar + outsuffix;

}

You can try thechanged geo_chartโšซphp Geo Chart interfacer at this liveโœ‚run link.


Previous relevant Window LocalStorage Client Versus Server Map Tutorial is shown below.

Window LocalStorage Client Versus Server Map Tutorial

Window LocalStorage Client Versus Server Map Tutorial   ๐Ÿ”

Get a good map, and a goodly number of times youโ€™ll want a map of smaller or larger scale than the one you have. Murphyโ€™s Law? This is probably why in the wonderful woooooooorrrrrrrrlllllld of Google Charts they have included โ€ฆ

  • Geo Chart topographic map of the world or of regions
  • Map Chart terrestrial/satellite map of your group of markers at a zoom level of your choosing

โ€ฆ and hope you can see that the latter can save the day for a Short Distance Trip (corner shop, anyone?!).

So weโ€™ve added onto yesterdayโ€™s Window LocalStorage Client Versus Server Timeline Tutorial progress a new toggling button to view a scenario in either Google Chart scenario above.

You can see this integration work with ourchanged wls_vs_phpโšซhtmโ€˜s Capitalโœ‚City Find Matching Country Report live run link supervising atweaked geo_chartโšซphp Geo Chart interfacer.


Previous relevant Window LocalStorage Client Versus Server Timeline Tutorial is shown below.

Window LocalStorage Client Versus Server Timeline Tutorial

Window LocalStorage Client Versus Server Timeline Tutorial   ๐Ÿ”

Up to yesterdayโ€™s Window LocalStorage Client Versus Server User Tutorialโ€˜s progress, our Capital City Find Matching Country Report web application project was all about โ€ฆ

  • where (and capital of โ€œwhatโ€) โ€ฆ but we often seek out a way to add into the mix that 4th dimension โ€ฆ
  • when (ie. time)

โ€ฆ and regarding the current project, a โ€ฆ

  • where โ€œmapโ€ โ€ฆ can interface with a โ€ฆ
  • when โ€œTrip Plan Itineraryโ€

โ€ฆ and for this purpose, weโ€™re going to interface to the excellent Google Charts Annotated Timeline Chart, thanks, because it combines links of โ€œtimeโ€ to โ€œuser annotationsโ€ in a timeline way, that similar way you might describe the qualities of a Trip, even before youโ€™ve gone on that trip. Weโ€™ve also added it so that an unordered places list can be turned into a Trip Plan Itinerary at the click/touch of a new map ๐Ÿ—บ &#128506; emoji button.

Again, see how these timeline amendments were achieved with ourchanged wls_vs_phpโšซhtmโ€˜s Capitalโœ‚City Find Matching Country Report live run link and annotatedtimeline_chartโšซphp which changedquite a lot.


Previous relevant Window LocalStorage Client Versus Server User Tutorial is shown below.

Window LocalStorage Client Versus Server User Tutorial

Window LocalStorage Client Versus Server User Tutorial   ๐Ÿ”

The inherent weakness with our current Capital City Find Matching Country Report web application project, to our minds, was that places of interest are not restricted to the Capital Cities of Countries, especially when โ€œTrip Planningโ€. On the other hand, it would be impossible to cater for every โ€œplaceโ€ in the world. That is far too subjective for good web application applicability. What would be good though, is to allow in user defined โ€ฆ



Place name, Country name

โ€ฆ terms, the definitions of interest to a user. We can ask this โ€ฆ

  • flagged by the click/touch of an emoji button โ€ฆ and โ€ฆ
  • the interactive entry presented via a Javascript prompt window

. When thinking of data applicable to an individual, then that can be catered for by recording it in localStorage where it will be recalled on the next execution of that web application in the same web browser.

This, along with a Colour Wheel of the โ€œnearest TimeZone placeโ€ onto the existing logic of yesterdayโ€™s Window SessionStorage Client Versus Server Order Tutorial progress could make for a more useful and practical tool for those Trip Planners out there!

See how this was achieved with ourchanged wls_vs_phpโšซhtmโ€˜s Capitalโœ‚City Find Matching Country Report live run link.

Did you know?

To click/touch one of those Google Chart Geo Chart lines between Emoji Flag Markers will show a new Google Maps directions web page with transport times and detail, as well as an inhouse crow fly distance of that trip leg, as shown up the top right of todayโ€™s tutorial picture.


Previous relevant Window SessionStorage Client Versus Server Order Tutorial is shown below.

Window SessionStorage Client Versus Server Order Tutorial

Window SessionStorage Client Versus Server Order Tutorial   ๐Ÿ”

If we are to honour our thoughts of being able to use our current Capital City Find Matching Country Report web application as a Trip Planner โ€ฆ

Our primary integration today is to (software) integrate the great Weather Underground and its great API service for autocomplete name searches for weather (and hurricane) information. Why bother? Well, can you not envisage a user using that Ajax functionality of yesterdayโ€™s Window SessionStorage Client Versus Server Ajax Tutorial as a trip planner, perhaps, or as a โ€œchecking up on relatives overseasโ€ tool, perhaps? And not all the capital cities are timezone places, and so for some of those we can use Weather integration to still show apt online information when click/touching a Countries Report row. Speaking of this โ€œrowโ€, we make an improvement whereby on a first click of a right hand (Country) row cell, that cell is not initially a contenteditable=โ€trueโ€ one (that may frustrate showing the keyboard on mobile, when most likely it was the row touch intended), but then becomes a contenteditable=โ€trueโ€ cell henceforth.

โ€ฆ then yesterdayโ€™s Window SessionStorage Client Versus Server Flags Tutorial โ€œprogress to nowโ€ needs to take notice of a userโ€™s order of multiple select (dropdown) element click/touching of Capital City option (sub)elements, just as we did with the recent User Controlled Dynamic Javascript YouTube Embedded API Ordered Tutorialโ€˜s web application project to allow for a user ordered YouTube video playlist.

Because what is a Trip Planner without an ordered trip? Well, that is debatable, but what isnโ€™t (debatable), is that there will be people in the world who appreciate the โ€œmapping outโ€ of a proposed Trip Planning Itinerary. What could we call on here? We can think of the Google Chart Geo Chart work around about the time of Google Geo Chart Co-ordinate Emojis Tutorial, when we started using โ€ฆ

  • a world map โ€ฆ with โ€ฆ
  • emoji markers โ€ฆ and optionally โ€ฆ
  • joined up by straight lines

โ€ฆ an idea for a Trip Plan itinerary synopsis, perhaps?!

If you examined closely yesterdayโ€™s code changes you will have noticed our collecting of TimeZone Place geographical latitude and longitude information. Today, we start making use of that preparatory work with ourchanged wls_vs_phpโšซhtmโ€˜s Capitalโœ‚City Find Matching Country Report live run link.

Stop Press

The โ€œemoji markersโ€ above (as of 2 January 2020) will be โ€œcountry flagsโ€ (as per Window SessionStorage Client Versus Server Flags Tutorial ideas), as defined.


Previous relevant Window SessionStorage Client Versus Server Flags Tutorial is shown below.

Window SessionStorage Client Versus Server Flags Tutorial

Window SessionStorage Client Versus Server Flags Tutorial   ๐Ÿ”

Yes, thereโ€™s more to do onto yesterdayโ€™s Window SessionStorage Client Versus Server CSS Tutorialโ€˜s Capital City Find Matching Country Report web application project, in our eyes. We have not even mentioned โ€œInternationalizationโ€ as a concept up to now. In this line of thinking โ€ฆ

Did you know?

Emoji flags via ISO 2 character country codes are dead easy via Regional Indicator Symbol characters โ€ฆ



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"];



var thiscc='AU'; // ISO 2 character countrycode for Australia

var ccsuff='', ccchar=' ';

for (var iccsuff=0; iccsuff<thiscc.length; iccsuff++) {

ccchar=thiscc.substring(iccsuff, eval(1 + eval('' + iccsuff))).toUpperCase();

ccsuff+='&#' + dri[eval('' + lri.indexOf(ccchar))] + ';';

}

document.getElementById('lastflag').innerHTML=ccsuff;

โ€ฆ to result in (via <span style=font-size:64px;>&#127462;&#127482;</span>) โ€ฆ



๐Ÿ‡ฆ๐Ÿ‡บ

โ€ฆ providing interest and general translatability to thechanged wls_vs_phpโšซhtmโ€˜s Capitalโœ‚City Find Matching Country Report live run link.


Previous relevant Window SessionStorage Client Versus Server CSS Tutorial is shown below.

Window SessionStorage Client Versus Server CSS Tutorial

Window SessionStorage Client Versus Server CSS Tutorial   ๐Ÿ”

Further to yesterdayโ€™s Window SessionStorage Client Versus Server Integration Tutorial we have a two pronged improvements set for you today with our current Capital City Find Matching Country Report web application project โ€ฆ

  • CSS styling changes โ€ฆ and โ€ฆ
  • additional functionality for Email and SMS links back to our current Capital City Find Matching Country Report web application project (to complete the cycle)

We use several modes of CSS application (the first and last of particular relevance to todayโ€™s โ€œhighlighting of workflowโ€ improvements) โ€ฆ

โ€ฆ the โ€œstaticโ€ measures often helping to highlight the web applicationโ€™s main workflow of user interaction and the โ€œdynamicโ€ measures helping to alert the user as to where to proceed with their โ€œworkflowโ€.

In terms of CSS styling work โ€ฆ

  1. for non-mobile platforms we allow for more columns to be applied to our Capitals select (dropdown) element (in order to reduce some user scrolling, as does our new additional A-Z letter basis sorting functionality) as per โ€ฆ the โ€œdynamicโ€ Javascript DOM โ€œclassโ€ modifications โ€ฆ


    if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {

    document.getElementById('lefttd').className='lefttd';

    }


    โ€ฆ dovetailing with the โ€œstaticโ€ internal CSS coding โ€ฆ


    <style>

    .lefttd {

    column-count: 4;

    max-height: 35%;

    vertical-align: top;

    max-width: 70%;

    font-size: 8px;

    background-color: rgba(205,205,205,0.5);

    background-image: -webkit-gradient(

    linear,

    right bottom,

    left top,

    color-stop(0, rgba(205, 205, 205, 0.8)),

    color-stop(0.50, rgba(255, 255, 0, 0.2))

    );

    background-image: -o-linear-gradient(left top, rgba(205, 205, 205, 1) 0%, rgba(255, 255, 0, 0.2) 50%);

    background-image: -moz-linear-gradient(left top, rgba(205, 205, 205, 1) 0%, rgba(255, 255, 0, 0.2) 50%);

    background-image: -webkit-linear-gradient(left top, rgba(205, 205, 205, 1) 0%, rgba(255, 255, 0, 0.2) 50%);

    background-image: -ms-linear-gradient(left top, rgba(205, 205, 205, 1) 0%, rgba(255, 255, 0, 0.2) 50%);

    background-image: linear-gradient(to left top, rgba(205, 205, 205, 1) 0%, rgba(255, 255, 0, 0.2) 50%);


    }

    </style>


    โ€ฆ and please note that around here at RJM Programming we have a โ€œfar from hard and fast ruleโ€ (but a rule regardless) regarding HTML element ID and class attributes that they concern (and (usually) be compartmentalised into) Javascript (DOM) manipulations and CSS styling issues respectively โ€ฆ and add a linear-gradient background to the table cell when expecting the initial user interaction on non-mobile platforms
  2. a โ€œdynamicโ€ Javascript DOM โ€œclassโ€ modification โ€ฆ document.getElementById(โ€˜myrepsbโ€™).className=โ€™dglowโ€™; โ€ฆ is made to the โ€œReportโ€ฆโ€ button at the Capitals select (dropdown) onfocusout event so as to highlight (with โ€œglowโ€ inspired styling) where user interaction may flow to

As far as links go, you may expect to need serverside means to construct these in online Email and SMS message interfacing, but email (client program) products like Gmail parse your ascii text and convert http: or https: protocol URLs in your Email body to hyperlinks, as does the Messages SMS application here on this MacBook Pro using macOS Mojave. Cute, huh?! So to close the circle back from remote tharโ€™ parts back to our web application is a simple matter of, in broad brush terms โ€ฆ

  • adding two new buttons called โ€œEmail Columns and Links โ€ฆโ€ and โ€œSMS Columns and Links โ€ฆโ€ that โ€ฆ
  • set a global variable andlinkto = true; โ€ฆ setting in play, within the report writing code (that likes monospaced fonts) โ€ฆ
  • add a new links column to the right with URLs like โ€ฆ
    https://www.rjmprogramming.com.au/HTMLCSS/wls_vs_php.htm?andgo=y&countries=Belize&capitals=Belmopan
    โ€ฆ to tell your client programs to form the hyperlinks for us (if they are โ€œof the moodโ€, that is!)

To improve user experience we use โ€œdynamicโ€ Javascript DOM HTML โ€œstyleโ€ attribute change means to easier close the โ€œColour Wheelโ€ helper web application โ€œabove the foldโ€ by changing the CSS z-index (Javascript DOM [element].style.zIndex) of elements accordingly, when the user clicks other elements. You can see all this with the first โ€œthechangedโ€ link above, where all โ€œglowโ€ CSS styling will also feature prominently.


Previous relevant Window SessionStorage Client Versus Server Integration Tutorial is shown below.

Window SessionStorage Client Versus Server Integration Tutorial

Window SessionStorage Client Versus Server Integration Tutorial   ๐Ÿ”

We hope, when performing a โ€œsoftware integrationโ€ task, that the two or more components of that integration work with each otherโ€™s talents, rather than a big tussle like reinventing the wheel. This ideal makes the work โ€ฆ

  • sometimes difficult but rewarding because โ€ฆ
  • the differences between two independent software components can be quite large and daunting โ€ฆ and the programmer has to see that โ€ฆ
  • care is applied so as not to wreck previous functionality and integrations in making the current integration work

โ€ฆ and that is why weโ€™ve made corollaries to โ€œbuilding from scratchโ€ (when planning and design is a huge component) can be a lot simpler than a software integration โ€œrenovationโ€, in the past, here at this blog.

Our primary integration today is to (software) integrate the great Weather Underground and its great API service for autocomplete name searches for weather (and hurricane) information. Why bother? Well, can you not envisage a user using that Ajax functionality of yesterdayโ€™s Window SessionStorage Client Versus Server Ajax Tutorial as a trip planner, perhaps, or as a โ€œchecking up on relatives overseasโ€ tool, perhaps? And not all the capital cities are timezone places, and so for some of those we can use Weather integration to still show apt online information when click/touching a Countries Report row. Speaking of this โ€œrowโ€, we make an improvement whereby on a first click of a right hand (Country) row cell, that cell is not initially a contenteditable=โ€trueโ€ one (that may frustrate showing the keyboard on mobile, when most likely it was the row touch intended), but then becomes a contenteditable=โ€trueโ€ cell henceforth.

As a user experience improvement for โ€œtrip plannersโ€ perhaps, we allow the user to alphabetically sort the presented select (dropdown) element entries โ€ฆ



var firstopt='';

var wasopts='';

var restopts='';



function readyitforsort(iselid) {

var optsare=[];

var huhisel=document.getElementById(iselid).innerHTML;

var huhsopts=huhisel.split('</option>');

for (var ihuh=0; ihuh<huhsopts.length; ihuh++) {

if (huhsopts[ihuh].trim() != '') {

if (firstopt == '') {

firstopt=huhsopts[ihuh] + '</option>';

} else {

wasopts+=huhsopts[ihuh].replace('option ','option data-ih="' + (huhsopts[ihuh].split('>')[eval(-1 + huhsopts[ihuh].split('>').length)] + '" ')) + '</option>';

optsare.push(huhsopts[ihuh].replace('option ','option data-ih="' + (huhsopts[ihuh].split('>')[eval(-1 + huhsopts[ihuh].split('>').length)] + '" ')) + '</option>');

}

}

}

optsare.sort();

for (var jhuh=0; jhuh<optsare.length; jhuh++) {

restopts+=optsare[jhuh];

}

}

โ€ฆ controlled by a new dropdown in the left hand column header cell.

We also allow the user to move the iframe element with some positioning emoji buttons near the โ€œCloseโ€ button one (of yesterdayโ€™s work).

Into the future, too, weโ€™ll have more to say regarding the germination of an idea โ€œto allow a mobile onmouseover simulator (of sorts)โ€ be to allow the user to perform a swipe across an individual HTML element of interest on mobile platforms (ie. harness ontouchmove event) as per (so far) โ€ฆ kicked off by โ€œ<body onload=โ€ setTimeout(athn, 5000); โ€œ>โ€ โ€ฆ



var last24='';

var rectdc;



function nodivalert() {

document.getElementById('divalert').style.display='none';

document.getElementById('divalert').style.zIndex='-456';

document.getElementById('divalert').style.left=('-' + rectdc.left).replace('px','') + 'px';

document.getElementById('divalert').style.top=('-' + rectdc.top).replace('px','') + 'px';

}



function ourdivalert(inmsg) {

document.getElementById('divalert').style.position='absolute';

document.getElementById('divalert').style.left=('' + rectdc.left).replace('px','') + 'px';

document.getElementById('divalert').style.top='' + eval(-80 + eval(('' + rectdc.top).replace('px',''))) + 'px';

document.getElementById('divalert').style.backgroundColor='#e0e0e0';

document.getElementById('divalert').style.display='block';

document.getElementById('divalert').style.zIndex='456';

document.getElementById('divalert').style.opacity='0.8';

document.getElementById('divalert').style.padding='5px 5px 5px 5px';

document.getElementById('divalert').innerHTML=inmsg + '<br><br><input type=button value=Close onclick=nodivalert();></input>';

setTimeout(nodivalert,9000);

}



function athn() {

rectdc=document.getElementById('dc').getBoundingClientRect();

if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {

document.getElementById('dc').ontouchmove=function(event) { if (last24.substring(0,eval(-1 + last24.length)) == event.target.title.substring(0,eval(-1 + event.target.title.length))) { last24=last24; } else { last24=event.target.title; ourdivalert(event.target.title); } }

} else {

document.getElementById('dc').onmousemove=function(event) { if (last24.substring(0,eval(-1 + last24.length)) == event.target.title.substring(0,eval(-1 + event.target.title.length))) { last24=last24; } else { last24=event.target.title; ourdivalert(event.target.title); } }

}

}

โ€ฆ working with the new HTML โ€ฆ



<div id=divalert></div>

</body>

</html>

โ€ฆ to try to allow the โ€œexplainer of an elementโ€ advantages non-mobile platforms have for hovering over an HTML element with a title attribute filled in.

And so, yet again, see thechanged wls_vs_phpโšซhtmโ€˜s Capitalโœ‚City Find Matching Country Report live run linkโ€™s new Weather integration functionality. It caused thechanged colour_wheelโšซhtmlโ€˜s colour wheel (at this liveโœ‚run link) to be affected (by integrations โ€œupโ€).


Previous relevant Window SessionStorage Client Versus Server Ajax Tutorial is shown below.

Window SessionStorage Client Versus Server Ajax Tutorial

Window SessionStorage Client Versus Server Ajax Tutorial   ๐Ÿ”

We have a few โ€œclientside chestnutsโ€ to use with our current Capital City Find Matching Country Report web application project today, those being โ€ฆ

  • Ajax functionality, kicked off by an โ€œonclickโ€ event set of logic, allowing mobile platforms to also have a look in (the look in that they miss when the event logic is off the โ€œonmouseoverโ€ event)
  • iframe and its โ€ฆ
    1. srcdoc attribute (โ€œcontentโ€ alternative to src โ€œurlโ€ attribute) โ€ฆ along with, and crucially needing (because srcdoc ignores its own document.body onload goings on, that we need the โ€œIframe Client Pre-Emptiveโ€ methods below to circumvent) the โ€ฆ
    2. onload event opportunity of an iframe element (we group into โ€œIframe Client Pre-Emptiveโ€ methods, here)

โ€ฆ adding onto yesterdayโ€™s Window SessionStorage Client Versus Server Canvas Tutorial.

Itโ€™s not that involved with the Ajax work today, given that there are no cross-domain issues, though there are cross-protocol (SSL https: versus non-SSL http:) issues to be careful about. Those can be addressed because the web application is recalled to present its โ€œCountry Reportโ€ and that is the opportunity to check on protocol navigation requirements.

Along the way, we also make this happen for the user on โ€ฆ

  • click/touching a table row โ€ฆ it sets off new โ€œtrโ€ (table row) element logic calling our (inhouse) Timezone and Wikipedia Place Information helper (HTML) via Ajax (so not leaving the webpage) โ€ฆ and because of place name oddities we allow for โ€ฆ
  • โ€œtdโ€ (table cell) element user amendments by setting their contenteditable attributes to โ€œtrueโ€ (since fixed, but we found the Timezone Europe/Tirane pointing at Tirane in Albania used to be spelt โ€œTiranaโ€)

โ€ฆ that latter methodology normally a technique we apply to โ€œdivโ€ elements (so, there you are!)

Also used are โ€œoverlayโ€ techniques, two of the โ€œusual suspectsโ€ here coming into play, to present to the โ€œAjax content to srcdoc iframe arrangementsโ€ โ€ฆ

Yet again, see thechanged wls_vs_phpโšซhtmโ€˜s Capitalโœ‚City Find Matching Country Report live run linkโ€™s new โ€œAjaxโ€ functionality.


Previous relevant Window SessionStorage Client Versus Server Canvas Tutorial is shown below.

Window SessionStorage Client Versus Server Canvas Tutorial

Window SessionStorage Client Versus Server Canvas Tutorial   ๐Ÿ”

Yesterdayโ€™s Window SessionStorage Client Versus Server Share Tutorial dealt with ascii text clipboard copy assisted sharing options with our current Capital City Find Matching Country Report web application project. This suited both Email and SMS share options we coded for, but todayโ€™s extension of functionality from โ€œascii textโ€ data to โ€œgraphical dataโ€ only suits Email sharing. The other caveat with our work is that no serverside (for us, PHP) help is allowed, so no PHP mail here.

What comes into play with a โ€œgraphical dataโ€ clientside (only) sharing approach? It will not surprise many readers that, for us, it involves โ€ฆ

  • canvas element โ€ฆ converting HTML table outerHTML โ€œascii textโ€ data โ€ฆ via โ€ฆ
  • canvas drawing methods โ€œ[canvasContext].strokeRect()โ€ and โ€œ[canvasContext].strokeText()โ€ via โ€œ[cellElement].getBoundingClientRect()โ€ โ€ฆ to convert that canvas element content via โ€ฆ
  • [canvasElement].toDataURL() โ€ฆ to an โ€ฆ
  • img element nested in a div contenteditable=true element โ€ฆ so as to hook in with todayโ€™s very useful helper link, thanks โ€ฆ use โ€ฆ


  • function tabletoclipboard(canvas) { // thanks to https://stackoverflow.com/questions/27863617/is-it-possible-to-copy-a-canvas-image-to-the-clipboard

    var img = document.createElement('img');

    img.src = canvas.toDataURL();



    var div = document.createElement('div');

    div.contentEditable = true;

    div.appendChild(img);

    document.body.appendChild(div);



    // do copy

    SelectText(div);

    document.execCommand('Copy');

    document.body.removeChild(div);

    }



    function SelectText(element) { // thanks to https://stackoverflow.com/questions/27863617/is-it-possible-to-copy-a-canvas-image-to-the-clipboard

    var doc = document;

    if (doc.body.createTextRange) {

    var range = document.body.createTextRange();

    range.moveToElementText(element);

    range.select();

    } else if (window.getSelection) {

    var selection = window.getSelection();

    var range = document.createRange();

    range.selectNodeContents(element);

    selection.removeAllRanges();

    selection.addRange(range);

    }

    }

  • to leave the userโ€™s deviceโ€™s clipboard containing a useful table (with linework) โ€ฆ ready to โ€ฆ
  • paste into an email body section

โ€ฆ sharing off to an emailee collaborator.

Again, see thechanged wls_vs_phpโšซhtmโ€˜s Capitalโœ‚City Find Matching Country Report live run linkโ€™s new โ€œEmail Tableโ€ button functionality.


Previous relevant Window SessionStorage Client Versus Server Share Tutorial is shown below.

Window SessionStorage Client Versus Server Share Tutorial

Window SessionStorage Client Versus Server Share Tutorial   ๐Ÿ”

Yesterdayโ€™s Window SessionStorage Client Versus Server Tutorial has been amended today for two new sharing and collaboration options, those being โ€ฆ

  • email
  • SMS

โ€ฆ but you may well be familiar with the restrictions on email and SMS client (program) approaches to this, coming from HTML โ€œaโ€ link โ€œmailto:โ€ and โ€œsms:โ€ href property prefixes respectively. Weโ€™re going to need help with the 800 odd character (length) restrictions with the (resultant) web address (bar) URL, but what? How about working off the great advice of this wonderful link, thanks, to copy what weโ€™d have assembled into an ascii text Report into the characters contained by the userโ€™s deviceโ€™s clipboard?



function copytoclipboard(str) { // thanks to https://hackernoon.com/copying-text-to-clipboard-with-javascript-df4d4988697f

var el = document.createElement('textarea');

el.value = str;

el.setAttribute('readonly', '');

el.style.position = 'absolute';

el.style.left = '-9999px';

document.body.appendChild(el);

el.select();

document.execCommand('copy');

document.body.removeChild(el);

}

An issue that springs up here using such clipboard ascii text content, whenever you get the Font choice given to you, pick a monospaced Font like Courier New or โ€œFixed Widthโ€.

See thechanged wls_vs_phpโšซhtmโ€˜s Capitalโœ‚City Find Matching Country Report live run linkโ€™s new sharing functionality.


Previous relevant Window SessionStorage Client Versus Server Tutorial is shown below.

Window SessionStorage Client Versus Server Tutorial

Window SessionStorage Client Versus Server Tutorial   ๐Ÿ”

Sometimes itโ€™s the case at this blog that weโ€™d like to introduce a new topic, but do not do so, because we cannot show any real world (or real application) use of that concept. So it has been, up until now, with the concept of (web browser) window (object) sessionStorage property. But yesterdayโ€™s Window LocalStorage Client Versus Server Primer Tutorial represented an opportunity akin to when Haleyโ€™s Comet gets at its closest to the Earth โ€ฆ while you see a chance, take it โ€ฆ chance because of that nuance whereby we were not trying to store data for any other purpose than passing data onto โ€ฆ

  1. a known entity โ€ฆ ie. same web application โ€ฆ at โ€ฆ
  2. a known time โ€ฆ ie. immediately

โ€ฆ two conditions that make the code design โ€œmarginallyโ€ more ideal for the window object property concept of sessionStorage rather than localStorage, in that any โ€ฆ



localStorage.removeItem([knownLocalStorageName]);

โ€ฆ becomes superfluous as with sessionStorage data will disappear between web browser sessions, anyway.

We offer this new concept as a non-default option of a select (dropdown) element replacement to the h1 element hardcoding โ€œlocalStorageโ€ with thechanged wls_vs_phpโšซhtm Capitalโœ‚City Find Matching Country Report live run. The other nuance of difference with sessionStorage usage is that in the document.body onload event logic, we may as well (as part of other changes) pre-emptively look for, and if there, respond to, any found sessionStorage data points, even without the user having flagged it specifically โ€ฆ



var datamode='localStorage';



function checkforreport() {

var divcont='';

var dcaps, dctys, idis;

if (getcapitals == 'localStorage') {

if (window.localStorage) {

getcapitals=decodeURIComponent(localStorage.getItem('wls_vs_php_capitals')).replace(/\+/g,' ');

localStorage.removeItem('wls_vs_php_capitals');

} else {

getcapitals='';

}

} else if (getcapitals == 'sessionStorage') {

document.getElementById('smode').value=getcapitals;

datamode=getcapitals;

if (window.sessionStorage) {

getcapitals=decodeURIComponent(sessionStorage.getItem('wls_vs_php_capitals')).replace(/\+/g,' ');

} else {

getcapitals='';

}

}
else if (getcapitals == '' && window.sessionStorage) {

getcapitals=decodeURIComponent(('' + sessionStorage.getItem('wls_vs_php_capitals')).replace(/^null$/g,'')).replace(/\+/g,' ');

if (getcapitals != '') {

document.getElementById('smode').value='sessionStorage';

datamode='sessionStorage';

}

}


if (getcountries == 'localStorage') {

if (window.localStorage) {

getcountries=decodeURIComponent(localStorage.getItem('wls_vs_php_countries')).replace(/\+/g,' ');

if (getcapitals.replace('localStorage','') != '' && getcountries.replace('localStorage','') != '') { document.getElementById('myh1').innerHTML+=' <font size=1>... yes, it was needed</font>'; }

localStorage.removeItem('wls_vs_php_countries');

} else {

getcountries='';

}

} else if (getcountries == 'sessionStorage') {

if (window.sessionStorage) {

getcountries=decodeURIComponent(sessionStorage.getItem('wls_vs_php_countries')).replace(/\+/g,' ');

if (getcapitals.replace('sessionStorage','') != '' && getcountries.replace('sessionStorage','') != '') { document.getElementById('myh1').innerHTML+=' <font size=1>... yes, it was needed</font>'; }

} else {

getcountries='';

}

}
else if (getcountries == '' && document.getElementById('smode').value == 'sessionStorage' && window.sessionStorage) {

getcountries=decodeURIComponent(('' + sessionStorage.getItem('wls_vs_php_countries')).replace(/^null$/g,'')).replace(/\+/g,' ');

if (getcountries != '') {

document.getElementById('smode').value='sessionStorage';

datamode='sessionStorage';

}

}


if (getcapitals != '' && getcountries != '') {

divcont='<table border=5 style="width:95%;vertical-align:top;background-color:white;"><tr style=background-color:#f0f0f0;"><th>Capital</th><th>Country</th></tr></table>';

dcaps=getcapitals.split('|');

dctys=getcountries.split('|');

for (idis=0; idis<dcaps.length; idis++) {

divcont=divcont.replace('</table>', '<tr><td>' + dcaps[idis] + '</td><td>' + dctys[idis] + '</td></tr></table>');

}

document.getElementById('dreport').innerHTML=divcont;

}

document.getElementById('smode').value=datamode;

}

Which beggars the question โ€œWhat are the differences between sessionStorage and localStorage?โ€ A quick reading might surmise that โ€œthe latter has an expiration dateโ€. We leave you with an open ended Google search so that you may extend your readings on this.


Previous relevant Window LocalStorage Client Versus Server Primer Tutorial is shown below.

Window LocalStorage Client Versus Server Primer Tutorial

Window LocalStorage Client Versus Server Primer Tutorial   ๐Ÿ”

Even though we rave on a lot about serverside PHP and its $_POST method=POST (versus HTML/Javascript recipient via ? and & argument $_GET method=GET scenario) data length advantages as the recipient of an HTML form method=POST set of data that could be sizeable, weโ€™ve just realized that there is a client Javascript and window.localStorage methodology that may help alleviate the need to involve PHP (and any other serverside intervention) on occasions.

Hint: Yes, weโ€™ve raved on about this too?! Does the blog posting title give it away? Okay, yes, it should read โ€œlocalStorageโ€, but thought weโ€™d gone past such juvenile finickiness since the Whac-A-Mole controversy of 1st December 2019 (or even The Great Tea Trolley Disaster of โ€™67, we daresay).

It can even use a โ€œself-destructโ€ approach to the use of this โ€œlocalStorageโ€ on having used it because โ€ฆ

  • the web application knows who is using it (localStorage) โ€ฆ and on having accessed and read it โ€ฆ
  • the web application knows it (localStorage) is of no use to any other user (in this web applicationโ€™s case, at least)

โ€ฆ which is very pleasing for a Land Surveyor who likes to leave cow paddocks as theyโ€™ve seen them so to speak. Except itโ€™s like having a ten tonne truck worth of data access in amongst the cow pats when having access to โ€œlocalStorageโ€ (or PHP), rather than a little piddle of calf wee (wee Metcalfes know a thing or two about these things!) data access of ? and & HTML/Javascript URL arguments (or even if we were to use HTTP Cookies).

Itโ€™s not as if we all have access to serverside language usage, though we do, because we really like PHP and MAMP and Apache/PHP/MySql web servers (and have arranged our development environment accordingly), but what if you are starting out in web development, and still want to allow for sizeable chunks of data with your web applications? Huh? Huh?! See the possibilities? Try our proof of concept Capitalโœ‚City Find Matching Country Report live run, and highlight a whole swathe of (multiple mode) dropdown option Capital Cities holding down the shift key before pressing the yellow โ€œReportโ€ button. If the URL ends up as โ€ฆ

https://rjmprogramming.com.au/HTMLCSS/wls_vs_php.html?capitals=localStorage&countries=localStorage

โ€ฆ thatโ€™s because the web applicationโ€™s โ€ฆ



function analyze() {

var purl=document.URL.split('#')[0].split('?')[0] + '?capitals=' + encodeURIComponent(document.getElementById('capitals').value) + '&countries=' + encodeURIComponent(document.getElementById('countries').value);

if (purl.length > 800) {

if (phpexists) {

document.getElementById('myform').method='POST';

document.getElementById('myform').action='./wls_vs_php.php';

} else if (window.localStorage) {

localStorage.setItem('wls_vs_php_countries', encodeURIComponent(document.getElementById('countries').value));

localStorage.setItem('wls_vs_php_capitals', encodeURIComponent(document.getElementById('capitals').value));

document.getElementById('capitals').value='localStorage';

document.getElementById('countries').value='localStorage';

location.href=document.URL.split('#')[0].split('?')[0] + '?capitals=' + encodeURIComponent(document.getElementById('capitals').value) + '&countries=' + encodeURIComponent(document.getElementById('countries').value);


return false;

}

}

return true;

}

โ€ฆ HTML form onsubmit event logic โ€ฆ

  1. discovered no PHP web application existant (via Client Pre-emptive Iframe techniques) โ€ฆ and โ€ฆ
  2. discovered (in a sanity check feeling way) that to go down the proposed HTML form method=GET approach was risking a โ€ฆ


    HTTP 414 "Request URI too long"


    โ€ฆ web browser error โ€ฆ and that โ€ฆ
  3. localStorage was a known web browser piece of functionality
  4. โ€ฆ and so as per our localStorage logic we โ€ฆ

  5. back out of the default HTML form method=GET navigation setup of the web application in favour of โ€ฆ
    • storing that data into localStorage
    • substituting into the URL ? and & arguments the hardcoding โ€œlocalStorageโ€ (and in so doing, getting back under the HTTP 414 โ€œRequest URI too longโ€ limitation, piecing together (what amounts to) โ€ฆ
      location.href=document.URL.split(โ€˜#โ€™)[0].split(โ€˜?โ€™)[0] + โ€˜?capitals=localStorage&countries=localStorageโ€™;)
      โ€ฆ that on a recall to this same web application a โ€ฆ
    • document.body onload event piece of Javascript logic checks the localStorage for its incoming Capital City Country Report data, as per โ€ฆ


      var phpexists=false;

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

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



      function checkforreport() {

      var divcont='';

      var dcaps, dctys, idis;

      if (getcapitals == 'localStorage') {

      if (window.localStorage) {

      getcapitals=decodeURIComponent(localStorage.getItem('wls_vs_php_capitals')).replace(/\+/g,' ');

      localStorage.removeItem('wls_vs_php_capitals');

      } else {

      getcapitals='';

      }

      }

      if (getcountries == 'localStorage') {

      if (window.localStorage) {

      getcountries=decodeURIComponent(localStorage.getItem('wls_vs_php_countries')).replace(/\+/g,' ');

      if (getcapitals.replace('localStorage','') != '' && getcountries.replace('localStorage','') != '') { document.getElementById('myh1').innerHTML+=' <font size=1>... yes, it was needed</font>'; }

      localStorage.removeItem('wls_vs_php_countries');

      } else {

      getcountries='';

      }

      }


      if (getcapitals != '' && getcountries != '') {

      divcont='<table border=5 style="width:95%;vertical-align:top;background-color:white;"><tr style=background-color:#f0f0f0;"><th>Capital</th><th>Country</th></tr></table>';

      dcaps=getcapitals.split('|');

      dctys=getcountries.split('|');

      for (idis=0; idis<dcaps.length; idis++) {

      divcont=divcont.replace('</table>', '<tr><td>' + dcaps[idis] + '</td><td>' + dctys[idis] + '</td></tr></table>');

      }

      document.getElementById('dreport').innerHTML=divcont;

      }

      }


      โ€ฆ the localStorage.removeItem() representing that โ€œself-destructโ€ nuance we were talking about before

We may well use this methodology in future projects, and hope it has been of some little interest to you as well?!

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.


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.

This entry was posted in eLearning, Operating System, Software, Tutorials and tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *