Google Charts Totally Hashtagging Communication Conduits Tutorial

Google Charts Totally Hashtagging Communication Conduits Tutorial

Google Charts Totally Hashtagging Communication Conduits Tutorial

The work of Form Target Self Primer Tutorial got us thinking …

  1. Could it be applied to our inhouse Google Charts PHP web applications?
  2. And if so, is the work generic enough to just be applied to our gchartgen.js external Javascript they, mostly, all use?
  3. And proceeding forward, if it works, how can it help? (Everybody needs a dorothy dixer?!)

… and the jury’s in …

  1. Yes
  2. 95%
  3. Email and SMS communications could all be hashtag navigation based on URLs not needing PHP mail nearly as much

In arriving at our “hived off” (because it is useful just itself for other “parents” out there (as what we like to think of as a “tool”), we’re thinking) hashtagdata_self_post.js


// hashtagdata_self_post.js
// RJM Programming
// July, 2024

function checkfortotalhash() {
//document.title='1';
//document.title='11';
//document.title='111';
if (('' + location.href).split('#')[0].indexOf('?') == -1 && ('' + location.hash).indexOf('=') != -1) {
//document.title='1111';
if (eval('' + ((('' + location.href).split('#')[0].split('?')[0].split('#')[0] + location.hash)).length) < 800) {
//prompt = function(zwords, defwords){ return null; };
location.href=(('' + location.href).split('#')[0].split('?')[0].split('#')[0] + location.hash).replace('#','?');
} else if (('' + location.href).split('#')[0].split('?')[0].split('#')[0].indexOf('.htm') == -1) {
//document.title='11111';
//prompt = function(zwords, defwords){ return null; };
//document.title='111111';
var wlytsp=false;
var formdt='<form action="' + ('' + location.href).split('#')[0].split('?')[0].split('#')[0] + '" method="POST" target="_self"> <input type="submit" id="checkforb"></input></form>';
var labvals=[], ilv=0;
labvals=('' + location.hash).split('=');
for (ilv=1; ilv<labvals.length; ilv++) {
if (labvals[eval(-1 + ilv)].replace(/^\#/g,'&').split('&')[eval(-1 + labvals[eval(-1 + ilv)].replace(/^\#/g,'&').split('&').length)] == 'wouldlikeyoutoseekpermission') {
wlytsp=true;
}
formdt=formdt.replace('<input type="submit"', '<input type="hidden" name="' + labvals[eval(-1 + ilv)].replace(/^\#/g,'&').split('&')[eval(-1 + labvals[eval(-1 + ilv)].replace(/^\#/g,'&').split('&').length)] + '" value="' + decodeURIComponent(labvals[ilv].split('&')[0]) + '"></input><input type="submit"');
}
//document.title='1111111';
setTimeout(function(){
if (!wlytsp) {
//alert(formdt.replace('> <', '><input type=hidden name=wouldlikeyoutoseekpermission value=y></input><'));
document.body.innerHTML+=formdt.replace('> <', '><input type=hidden name=wouldlikeyoutoseekpermission value=y></input><');
} else {
//alert(formdt.slice(-220));
document.body.innerHTML+=formdt;
}
document.getElementById('checkforb').click();
}, 1000);
}
}
}

if (('' + location.href).indexOf('/GeoChart') == -1) {
checkfortotalhash();
}

… proof of concept start we made a discovery that surprised us with …

  • when an intervention point for external Javascript occurs before the webpage’s document.body onload event …
  • you do better scouring location.href rather than document.URL (though, curiously, document.title is okay) and that location.href may contain hashtagging data (or we were dreaming … anyway, we’ve coded for either) … and …
  • is okay recognizing location.hash hashtagging data … but …
  • we found a setTimeout arrangement of adding a form to document.body.innerHTML helps get past the document.body onload event starting timing

… and exceptions for web applications doing their own thaing here should be considered.

And so we used as our guinea pig Google Chart to try, the inhouse Pie Chart interfacer, as you can see from today’s animated GIF presentation to prove this …

  • navigational arrangement “proof of concept” methodology converting hashtagged incoming data into an HTML form method=POST target=_self action=[HereIsLookingAtYouKid] navigation back onto itself … and when happy just slapped that into the changed gchartgen.js external Javascript helper … along with …
  • email (mailto:) and SMS (sms:) URL tweaks to change ? to # to bypass the PHP server woooooorrrrrrllllllddd (and any PHP mail servers) for the Javascript client mailto: and sms: communication conduit wooooooorrrrrllllldddd … causing within a Javascript function called iftoobigthe changes

    if (eval(eval(urlin.length) + eval(urldata.length) + eval(urldata0.length)) < 800 || urlin.split('?')[0].split('#')[0].length < 800) { //1000) { // vs 2000
    return urlin.replace('?','#');
    }

Bear in mind, this is not ignoring the serverside. You’ll notice the chance of form method=POST coming into consideration. You need a serverside language to handle that method=POST … it’s just that not involving a PHP mail server and the mail command, when the amounts of data are substantial, so often, is the improvement, to our mind.

All that being so URLs such as the Google Chart Pie Chart (meddled around with) one …

https://www.rjmprogramming.com.au/PHP/PieChart/pie_chart.php#title=Country%20Populations&onclick=y&task=Country&desc=Populations&data=,%20[~https;China,1347000000,India,1241000000,United%20States,312000000,Indonesia,238000000,Brazil,197000000,Pakistan,177000000,Nigeria,162000000,Bangladesh,151000000,Russia,143000000,Japan,128000000,Mexico,115000000,Philippines,96000000,Vietnam,88000000,Ethiopia,87000000,Germany,81800000,Egypt,82600000,Iran,78000000,Turkey,74000000,Thailand,69500000,Congo,67800000,France,63300000,United%20Kingdom,62700000,Italy,60800000~,100]

… should, these days, show interesting graphical (and sometimes editable) data that is able or able.


Previous relevant Form Target Self Primer Tutorial is shown below.

Form Target Self Primer Tutorial

Form Target Self Primer Tutorial

We’ve rarely used the …

… style of arrangement in the past, but we’ve found it useful recently (a couple of times) because we find we want to, more and more, use …

  • hashtagged data
  • reassembled into a …
    1. form
    2. method=POST
    3. action=[URLofInterestOfPHP]
    4. target=_self

    … arrangement …

… that way keeping any window.parent and window.self and/or window.opener and window.self connections intact, and at the same time, being able to involve very long (mostly hashtagged data) URLs in the arrangements.

Let’s show you an example. In the recently talked about Google Charts Image Chart Map Chart inhouse interfacer called image_chart.php downaways into the code it now goes

<?php

$screenheight='0';
<br>
// ;Continent;CC1|CC2|:blLAT,blLONG,trLAT,trLONG:width,height:scblX,scblY,sctrX,sctrY
$continfo=';Europe;IS|CY|:35.16666,-27.6,67.0,33.36666:468,450:422,560,890,140'; // 53 523
$continfo.=';Australia;AU|AU|:-44,113.65,-10.26667,161.28333:600,450:422,560,866,140';
$continfo.=';Asia;FI|WS|:-14,37,81,179.9:600,450:422,560,866,140';
$continfo.=';America;GS|US|:-56,-179.9,77,-35:600,450:422,560,866,140';
$continfo.=';Africa;TF||:-35,-17,37,52:600,450:422,560,890,140';
if (isset($_GET['screenheight'])) {
$screenheight=str_replace('+',' ',urldecode($_GET['screenheight']));
}
if (isset($_POST['screenheight'])) {
$screenheight=str_replace('+',' ',urldecode($_POST['screenheight']));
}
<br>
if (isset($_GET['nothing'])) {
exit;
} else if ($screenheight != '0' && !isset($_GET['returnxytoparent']) && (!isset($_POST['returnxytoparent']) && !isset($_POST['ix']))) {
echo "<html>
<head>
<script type=text/javascript>
function tryit() {
if (('' + location.hash).indexOf('returnxytoparent=') != -1) {
document.getElementById('returnxytoparent').value=decodeURIComponent(('' + location.hash).split('returnxytoparent=')[1].split('&')[0].split('#'));
document.getElementById('submy').click();
}
}
</script>
</head>
<body onload=tryit();>
<form style=display:none; target=_self action=/PHP/GeoChart/image_chart.php method=POST>
<input type=hidden name=returnxytoparent id=returnxytoparent value=\"\"></input>
<input type=hidden name=screenheight value=" . $screenheight . "></input>
<input type=submit style=display:none; value=Submit id=submy></input>
</form>
</body>
</html>";
exit;

} else if (isset($_GET['returnxytoparent']) || (isset($_POST['returnxytoparent']) && !isset($_POST['ix']))) {
// more code to do with real returnxytoparent data follows
}
// more code follows

?>

… called from our inhouse Region Picker in this way now (where inhouse Javascript function windowdotdotopen can be thought of as window.open for these purposes)


if (eval('' + encodeURIComponent(theurlis).length) > 750) {
dbwo=windowdotdotopen('//www.rjmprogramming.com.au/PHP/GeoChart/image_chart.php' + '?screenheight=' + screen.height + '#returnxytoparent=' + encodeURIComponent(theurlis),'_blank','top=' + eval(-300 + screen.height) + ',left=450,width=600,height=300');
} else {

dbwo=windowdotdotopen('//www.rjmprogramming.com.au/PHP/GeoChart/image_chart.php?returnxytoparent=' + encodeURIComponent(theurlis) + '&screenheight=' + screen.height,'_blank','top=' + eval(-300 + screen.height) + ',left=450,width=600,height=300');
}

… setting up a two way understanding between window.opener Region Picker and window.self Google Charts Image Chart Map Chart inhouse interfacer. Using that target=_self arrangement above allows …

  • despite the “double dipping” transfer of hashtagged URL data (when longer than 750 characters, that is) into method=POST form data (of considerable size) …
  • that understanding between window.open Region Picker and window.self Google Charts Image Chart Map Chart inhouse interfacer remains intact

Yayyyyyy!

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, Event-Driven Programming, Tutorials and tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>