Event Calendar New Window Tutorial

Event Calendar New Window Tutorial

Event Calendar New Window Tutorial

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

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

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

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

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

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

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


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

… the form submit buttons are reworded accordingly.

Another idea from this blog thread’s inspiration …

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

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

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

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

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


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

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



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

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

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

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


Previous relevant Event Calendar Remembered Tutorial is shown below.

Event Calendar Remembered Tutorial

Event Calendar Remembered Tutorial

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

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

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

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

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

Stop Press

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

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


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

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

Event Calendar Remembered Tutorial

Event Calendar Remembered Tutorial

Event Calendar Remembered Tutorial

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

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

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

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

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

Stop Press

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

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

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

Drag and Drop via Hotlinked Javascript Global Variable Tutorial

Drag and Drop via Hotlinked Javascript Global Variable Tutorial

Drag and Drop via Hotlinked Javascript Global Variable Tutorial

The recent Drag and Drop via Hotlinked External Javascript Tutorial had an annoyance, whereby, regarding its modus operandi of …

  • write their own HTML (and derived Javascript) via a textarea element with initial template HTML code
  • construct a personalized HTML webpage after the light green submit button press … so that …
  • downloading the HTML is possible via “View Page Source” (context option) and Copy/Paste into a text editor (and then, perhaps, onto local system web server environment development via an Apache/PHP/MySql local web server product such as MAMP)

… in its middle phase that if you …

  • clicked into that middle phase‘s HTML textarea element … the logic was the same as the …
  • external Javascript’s …


    parent.document.getElementById('textareaaction').click();


    function doit(what) {
    if (viaej) { eval(what); }
    }

… but we really only want that HTML textarea element (id=’textareaaction’) onclick logic


<textarea style=background-color:silver; ontouchdown='viaej=false; event.stopPropagation();' onmousedown='viaej=false; event.stopPropagation();' onclick=doit(this.value); data-onblur=doit(this.value); rows=5 cols=80 placeholder='Please place your drop action to do Javascript here below ...' id=textareaaction>
alert('You just dropped off');
</textarea>

… to happen in the second scenario, but not the first (which is really just a mechanism to give the textarea element the webpage focus). How can we differentiate? Well, there are probably a lot of ways, but our preferred way is to involve a new global variable


var viaej=false;

… which our external Javascript can reference, usefully, via code like




function dolaterwo() {
window.opener.viaej=false;
}

function dolaternonwo() {
parent.viaej=false;
}


if (typeof(parent.viaej) !== 'undefined') {
parent.viaej=true;
}

parent.document.getElementById('textareaaction').click();
if (typeof(parent.viaej) !== 'undefined') {
setTimeout(dolaternonwo, 3000); //parent.viaej=false;
}

… so that an onclick event’s click or touch into the textarea element equates to global variable viaej having value false (because onmousedown or ontouchdown (yayyyy!!!) events precede onclick event) and for the external Javascript parent.document.getElementById(‘textareaaction’).click() call equates to a timing where global variable viaej having value true (and the function doit’s eval logic is executed).

In order to fix this issue we made changes to our external Javascript countries.js “Drag and Drop specialist” use by our changed “second draft proof of concept” PHP draganddrop_hotwiring.php web application you can try below.


Previous relevant Drag and Drop via Hotlinked External Javascript Tutorial is shown below.

Drag and Drop via Hotlinked External Javascript Tutorial

Drag and Drop via Hotlinked External Javascript Tutorial

There are three very useful “hotwiring” ideas that usually work with your web applications …

  • via absolute image URLs
  • via absolute stylesheet URLs
  • via absolute external Javascript URLs

… and that last one is what we want to hone in regarding, with an idea we had to allow a user to …

  • write their own HTML (and derived Javascript) via a textarea element with initial template HTML code
  • construct a personalized HTML webpage after the light green submit button press … so that …
  • downloading the HTML is possible via “View Page Source” (context option) and Copy/Paste into a text editor (and then, perhaps, onto local system web server environment development via an Apache/PHP/MySql local web server product such as MAMP)

In order to allow this more generic approach we made changes to our external Javascript countries.js “Drag and Drop specialist” use by our “first draft proof of concept” PHP draganddrop_hotwiring.php web application you can try below (where a context option like “View Frame Source” might more be the go regarding downloading your HTML invention)

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


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

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

Drag and Drop Three Dimensional Look Tutorial

Drag and Drop Three Dimensional Look Tutorial

Drag and Drop Three Dimensional Look Tutorial

So far with our latest Drag and Drop work, further to that of Drag and Drop via Hotlinked External Javascript Tutorial below, we’ve concentrated on Javascript. So, you’d think it would be CSS’s time for attention?! Well, sort of. We like to do a lot of CSS styling via Javascript DOM like (today’s simple intervention to add a Three Dimensional look to our drag via CSS property text-shadow) …


window.addEventListener("DOMContentLoaded", () => {
gelo=wod('body');
const source = document.querySelector("#mg");
if (source.title.indexOf('ong drag') == -1 && !classo) {
source.title+=' ... long drag (eg. more than 10 seconds) also opens a Google Maps webpage ... very long drag (eg. more than 20 seconds) also opens a Google Earth webpage';
}

if (source) {
if (source.outerHTML.indexOf('text-shadow:') == -1) {
source.style.textShadow='-1px 1px 3px #952dff';
}
}

if (noyes == noyes.toUpperCase()) {
source.style.border='1px dashed pink';
}
console.log('source.id=' + source.id);
source.addEventListener("dragstart", (ev) => {
var elo=null;
dragdt=(new Date());
// more code follows
});
source.addEventListener("dragend", (ev) =>
ev.target.classList.remove("dragging")
);

That’s it! Guess this is the joy of involving genericized external Javascript, because this simple change to our external Javascript countries.js “Drag and Drop specialist” has affected (the look of) about five web applications, so far, calling it … one per codeline!


Previous relevant Drag and Drop via Hotlinked External Javascript Tutorial is shown below.

Drag and Drop via Hotlinked External Javascript Tutorial

Drag and Drop via Hotlinked External Javascript Tutorial

There are three very useful “hotwiring” ideas that usually work with your web applications …

  • via absolute image URLs
  • via absolute stylesheet URLs
  • via absolute external Javascript URLs

… and that last one is what we want to hone in regarding, with an idea we had to allow a user to …

  • write their own HTML (and derived Javascript) via a textarea element with initial template HTML code
  • construct a personalized HTML webpage after the light green submit button press … so that …
  • downloading the HTML is possible via “View Page Source” (context option) and Copy/Paste into a text editor (and then, perhaps, onto local system web server environment development via an Apache/PHP/MySql local web server product such as MAMP)

In order to allow this more generic approach we made changes to our external Javascript countries.js “Drag and Drop specialist” use by our “first draft proof of concept” PHP draganddrop_hotwiring.php web application you can try below (where a context option like “View Frame Source” might more be the go regarding downloading your HTML invention)

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


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

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

Tic Tac Toe Game Timing Tutorial

Tic Tac Toe Game Timing Tutorial

Tic Tac Toe Game Timing Tutorial

Yesterday’s Tic Tac Toe Game Drag and Drop Tutorial‘s Tic Tac Toe game had an annoyance. You, as the interactive player, playing the Computer, had to imagine how the Computer won, should it do so. How come? Well, when writing …

  • Javascript … especially …
  • DOM style … you need to look out for the combination of …
    1. Javascript DOM that crucially affects the look of the visible webpage … followed by …
    2. a modal popup window such as alert or confirm or prompt … followed by a …
    3. webpage reload

    … because …

  • if step 2 above immediately follows step 1 it can be that the user never sees that Javascript DOM code’s visible webpage effects … we believe, because, Javascript DOM (maybe sometimes) needs some “flush” (no … not … to da loo) time before any modal Javascript windows appear, demanding attention.

We have almost answered our own question about how to resolve this issue where we say above “if step 2 above immediately follows step 1”. Can you think how? Anyone, anyone?! Yes, Brendan, we can embed a static Javascript snippet of code ( eg. alert(‘Some blurb’); ) into a …


setTimeout(function(){
alert('Some blurb');
newgame();
}, 3000);

… delayed ( eg. by 3 seconds ) setTimeout timed function type of scenario, as above. In that 3 seconds, Javascript DOM’s work can have time to complete.

And regarding how our step 3 is described by webpage reload above, that equates to newgame(); in our Tic Tac Toe game code, it needs to be in the delayed sequence of events ( the purple snippets representing the basis for a 2 second delay solution to this timing issue ) …


if (oemail.indexOf(',') != -1) {
if ((oemail.split(',')[0] + oemail.split(',')[1]).indexOf('Computer') != -1) { emojithem('Computer'); }
setTimeout(function(){
alert(emojithem(oemail.split(',')[1]) + " wins! Bad luck, " + emojithem(oemail.split(',')[0]));
newgame();
}, 2000);
} else {
emojithem('Computer');
setTimeout(function(){
alert(emojithem("Computer") + " wins! Bad luck. Scores: " + emojithem("Computer") + " " + cscore + " vs " + emojithem("You") + " " + yscore + " (" + dscore + " draws)");
newgame();
}, 2000);
}
//newgame();

… within the changed tictactoe.js Tic Tac Toe logic external Javascript specialist used for the Tic Tac Toe game you can play below also.


Previous relevant Tic Tac Toe Game Drag and Drop Tutorial is shown below.

Tic Tac Toe Game Drag and Drop Tutorial

Tic Tac Toe Game Drag and Drop Tutorial

The Tic Tac Toe game talked about in Apache PHP Code Control Tutorial already has a variety of inputs such as mouse and touch and email and SMS possibilities, and so to also allow drag and drop as an alternative does not sound like too much of a stretch for our extremely able and perspicacious audience!

Again, “click” or “touch” reigns supreme here, but because the user is being asked to fill a (3×3 grid) square with their (usually “X”) answer of “X” or “O” a drag and drop paradigm can well suit the player’s thinking.

Yesterday’s Australian Indigenous Language Drag and Drop Tutorial‘s logic panned out to be a great help with fleshing out what was required, but again, there were nuances

tictactoe.js countries.js

var amdragging=false, havedropped=false, dropthing='';
var defxo='❌';

// ...
var ifbittwo='<iframe scrolling=no frameborder=0 name=iftr id=iftr style="display:block;position:absolute;left:calc(100% - 60px);top:50%;width:60px;height:60px;" srcdoc="<body style=background-color:transparent;><p id=mg title=' + "'" + 'Drag and drop for your X square choice playing Tic Tac Toe.' + "'" + ' draggable=' + "'" + 'true' + "'" + '>' + defxo + '</p><br><br><div id=myh1></div><script type=' + "'" + 'text/javascript' + "'" + ' src=' + "'" + '//www.rjmprogramming.com.au/HTMLCSS/countries.js?rand=89742464857' + "'" + ' defer></script></body>" data-src=></iframe>';

// ...
document.body.innerHTML = hcont + hcont2 + hcont3 + hcont4 + hcont5 + hcont6 + hcont7 + hcont8 + hcont9 + hcont10 + hcont11 + hcont12 + hcont13 + hcont14 + hcont15 + hcont16 + hcont17 + hcont18 + hcont19 + hcont20 + hcont21 + eform + ifbit + ifbittwo;

console.log("Drop ... " + ev.target.id + ' --- ' + ev.target.outerHTML);
dropdt=(new Date());
if (('' + ev.target.id) != '') {
if (typeof(parent.amdragging) !== 'undefined') { parent.amdragging=false; }
if (typeof(parent.havedropped) !== 'undefined') { parent.havedropped=true; }
if (('' + ev.target.outerHTML).indexOf('else if (('' + ev.target.outerHTML).indexOf(' alt="') != -1 && typeof(parent.amdragging) !== 'undefined' && typeof(parent.havedropped) !== 'undefined' && typeof(parent.dropthing) !== 'undefined') {
parent.dropthing=('' + ev.target.outerHTML).split(' alt="')[1].split('"')[0];
parent.langwo();
} else if (('' + ev.target.outerHTML).indexOf('

… asking for our still needing to be changed changed external Javascript countries.js “Drag and Drop specialist” to be tweaked, so that a call by the changed tictactoe.js Tic Tac Toe logic external Javascript specialist used for the Tic Tac Toe game could be made to work, as you might want to try below …


Previous relevant Apache PHP Code Control Tutorial is shown below.

Apache PHP Code Control Tutorial

Apache PHP Code Control Tutorial

It might be tempting to ask, after the event, with web application code on an Apache web server, can controlling code be added to an existing web application codeset, that does not rely on changes to any existent code? The answer is yes, with a lot of provisos …

  • it’s not a great idea, as much to do with causing confusion as to do with security looseness … but, nonetheless, depending on other php.ini configurations you might be able to add …
  • into Apache domain’s php.ini configuration file …

    ; Automatically add files before or after any PHP document.
    auto_prepend_file = somestartingphp.php
    auto_append_file = someendingphp.php

    … as we intimated in Apache/PHP/MySql Linux Language Considerations Primer Tutorial … or …
  • within a folder of Apache web server directory structure via an Apache .htaccess file mention, such as …

    php_value auto_prepend_file ../../ncmailxitin.php
    php_value auto_append_file ../../ncmailxitout.php

    … the exact contents of our MAMP Apache .htaccess for HTTP://localhost:8888/Games/Noughtsandcrosses/ in explanation below

We were kind of sad and relieved at the same time seeing that to apply this .htaccess approach of allowing for introductory Notification welcome messages up at the RJM Programming domain’s Noughts and Crosses web application we tried it on, but it did not work, whereas trying to apply it to our Apache MAMP (local web server) environment via …

  • downloaded existing code to MAMP place in Games/Noughtsandcrosses off the MAMP Document Root folder …
  • tweaked the changed tictactoe.js … in a way that suited allowing new introductory Notifications welcoming players in both MAMP and RJM Programming domain brands of Apache web servers, but in different ways … please note that this change to existent code would not have been needed had the RJM Programming domain accepted the .htaccess methodologies, and we were not wanting the same Noughts and Crosses codeset suiting both Apache environments …
  • renamed the Games/Noughtsandcrosses index.html (default web application filename) to index.php … to allow for an Apache .htaccess methodology to possibly work (but only does, for us, at MAMP) … it’s only noticed when PHP code is involved (even if there are no starting <?php and ending ?> delimitations in the code, as in our, what was, index.html case)
  • created a 644 permissions .htaccess in Games/Noughtsandcrosses off the MAMP Document Root folder …

    php_value auto_prepend_file ../../ncmailxitin.php
    php_value auto_append_file ../../ncmailxitout.php
  • created in MAMP Document Root folder ncmailxitin.php
  • created in MAMP Document Root folder ncmailxitout.php

… did!


Previous relevant Apache/PHP/MySql Linux Language Considerations Primer Tutorial is shown below.

Apache/PHP/MySql Linux Language Considerations Primer Tutorial

Apache/PHP/MySql Linux Language Considerations Primer Tutorial

The recent CSS Style Javascript DOM Override Onload Primer Tutorial “proof of concept” web application ended up with the name …


are_you_happy_with_my_or_do_you_think_my_derriere_needs_work.html

… but along the way we wanted to call it …


are_you_happy_with_my_or_do_you_think_my_derrière_needs_work.html

… but this didn’t work as an RJM Programming website filename. Rather than make it work, we compromised, and called it (the final) are_you_happy_with_my_or_do_you_think_my_derriere_needs_work.html it ended up as. But this didn’t stop us wondering about all this language and the relationship of these language characters and where and how you can or can’t use those characters outside those usual US-keyboard type characters.

And that brings us to the great MAMP local Apache/PHP/MySql web server product, as a place to experiment, comforted in the knowledge that the Mac OS X Terminal application …


ls -li

… and knowledge of inodes (all the way to their “extreme case Linux system file removal talents) you can read about at Linux Inode File Removal Tutorial would probably protect me from home grown stupidities.

So what followed for me was a quick look at MAMP’s relevant php.ini file and its httpd.conf configuration files to see that the web server default “goto look for” file list for the web server directory can be altered by a change of …


DirectoryIndex index.html index.php

… to something else in httpd.conf Apache configuration file. But nothing to easily reinvent the US-keyboard feeling file extensions .htm and .html and .php that was apparent to me. And noting to change that …


[protocol]://localhost:[localHostPortNumber]/

… US-keyboard feeling prefix to a URL, such as our http://localhost:8888/ prefix to a MAMP local Apache/PHP/MySql URL we created a Simplified Chinese character set “Hello World” folder scenario (and thank Google Translate for translation help today) …

http://localhost:8888/你好/世界/

index.html as per …


<!doctype html>
<head>
<title>RJM编程着陆页</title>
<meta charset="UTF-8">
</head>
<body>
<h1>欢迎来到-RJM编程网站</h1><br>
<a target=_blank title='RJM编程着陆页' href='https://translate.google.com/translate?sl=en&js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&u=%2F%2Fwww.rjmprogramming.com.au%2Findex.html&tl=zh-CN'>RJM编程着陆页</a>
</body></html>

Within the php.ini configuration file we found interesting, in particular …


; Automatically add files before or after any PHP document.
auto_prepend_file =
auto_append_file =

; PHP's built-in default is text/html
default_mimetype = "text/html"

; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
allow_url_fopen = On

… the last of which, if set to Off could set up for the scenario of setting up a web server full of index.html and index.php code in web server folders that could include non US-keyboard characters, and so you could have within the code of …

http://localhost:8888/你好/

index.html a relative URL such as …

<a target=_blank title='你好 世界' href='世界'>你好 世界</a>

… taking you off to today’s (URL) starting place.

Am sure you can feel yourself, there is so much more to explore in this topic area, and we’ll be returning soon to this neck of the woods soon, we hope. In the meantime, take a look at our tutorial picture for a bit of what we did on MAMP with some of these concepts not changing any configuration files at all.

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


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


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


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

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

Tic Tac Toe Game Drag and Drop Tutorial

Tic Tac Toe Game Drag and Drop Tutorial

Tic Tac Toe Game Drag and Drop Tutorial

The Tic Tac Toe game talked about in Apache PHP Code Control Tutorial already has a variety of inputs such as mouse and touch and email and SMS possibilities, and so to also allow drag and drop as an alternative does not sound like too much of a stretch for our extremely able and perspicacious audience!

Again, “click” or “touch” reigns supreme here, but because the user is being asked to fill a (3×3 grid) square with their (usually “X”) answer of “X” or “O” a drag and drop paradigm can well suit the player’s thinking.

Yesterday’s Australian Indigenous Language Drag and Drop Tutorial‘s logic panned out to be a great help with fleshing out what was required, but again, there were nuances

tictactoe.js countries.js

var amdragging=false, havedropped=false, dropthing='';
var defxo='❌';

// ...
var ifbittwo='<iframe scrolling=no frameborder=0 name=iftr id=iftr style="display:block;position:absolute;left:calc(100% - 60px);top:50%;width:60px;height:60px;" srcdoc="<body style=background-color:transparent;><p id=mg title=' + "'" + 'Drag and drop for your X square choice playing Tic Tac Toe.' + "'" + ' draggable=' + "'" + 'true' + "'" + '>' + defxo + '</p><br><br><div id=myh1></div><script type=' + "'" + 'text/javascript' + "'" + ' src=' + "'" + '//www.rjmprogramming.com.au/HTMLCSS/countries.js?rand=89742464857' + "'" + ' defer></script></body>" data-src=></iframe>';

// ...
document.body.innerHTML = hcont + hcont2 + hcont3 + hcont4 + hcont5 + hcont6 + hcont7 + hcont8 + hcont9 + hcont10 + hcont11 + hcont12 + hcont13 + hcont14 + hcont15 + hcont16 + hcont17 + hcont18 + hcont19 + hcont20 + hcont21 + eform + ifbit + ifbittwo;

console.log("Drop ... " + ev.target.id + ' --- ' + ev.target.outerHTML);
dropdt=(new Date());
if (('' + ev.target.id) != '') {
if (typeof(parent.amdragging) !== 'undefined') { parent.amdragging=false; }
if (typeof(parent.havedropped) !== 'undefined') { parent.havedropped=true; }
if (('' + ev.target.outerHTML).indexOf('else if (('' + ev.target.outerHTML).indexOf(' alt="') != -1 && typeof(parent.amdragging) !== 'undefined' && typeof(parent.havedropped) !== 'undefined' && typeof(parent.dropthing) !== 'undefined') {
parent.dropthing=('' + ev.target.outerHTML).split(' alt="')[1].split('"')[0];
parent.langwo();
} else if (('' + ev.target.outerHTML).indexOf('

… asking for our still needing to be changed changed external Javascript countries.js “Drag and Drop specialist” to be tweaked, so that a call by the changed tictactoe.js Tic Tac Toe logic external Javascript specialist used for the Tic Tac Toe game could be made to work, as you might want to try below …


Previous relevant Apache PHP Code Control Tutorial is shown below.

Apache PHP Code Control Tutorial

Apache PHP Code Control Tutorial

It might be tempting to ask, after the event, with web application code on an Apache web server, can controlling code be added to an existing web application codeset, that does not rely on changes to any existent code? The answer is yes, with a lot of provisos …

  • it’s not a great idea, as much to do with causing confusion as to do with security looseness … but, nonetheless, depending on other php.ini configurations you might be able to add …
  • into Apache domain’s php.ini configuration file …

    ; Automatically add files before or after any PHP document.
    auto_prepend_file = somestartingphp.php
    auto_append_file = someendingphp.php

    … as we intimated in Apache/PHP/MySql Linux Language Considerations Primer Tutorial … or …
  • within a folder of Apache web server directory structure via an Apache .htaccess file mention, such as …

    php_value auto_prepend_file ../../ncmailxitin.php
    php_value auto_append_file ../../ncmailxitout.php

    … the exact contents of our MAMP Apache .htaccess for HTTP://localhost:8888/Games/Noughtsandcrosses/ in explanation below

We were kind of sad and relieved at the same time seeing that to apply this .htaccess approach of allowing for introductory Notification welcome messages up at the RJM Programming domain’s Noughts and Crosses web application we tried it on, but it did not work, whereas trying to apply it to our Apache MAMP (local web server) environment via …

  • downloaded existing code to MAMP place in Games/Noughtsandcrosses off the MAMP Document Root folder …
  • tweaked the changed tictactoe.js … in a way that suited allowing new introductory Notifications welcoming players in both MAMP and RJM Programming domain brands of Apache web servers, but in different ways … please note that this change to existent code would not have been needed had the RJM Programming domain accepted the .htaccess methodologies, and we were not wanting the same Noughts and Crosses codeset suiting both Apache environments …
  • renamed the Games/Noughtsandcrosses index.html (default web application filename) to index.php … to allow for an Apache .htaccess methodology to possibly work (but only does, for us, at MAMP) … it’s only noticed when PHP code is involved (even if there are no starting <?php and ending ?> delimitations in the code, as in our, what was, index.html case)
  • created a 644 permissions .htaccess in Games/Noughtsandcrosses off the MAMP Document Root folder …

    php_value auto_prepend_file ../../ncmailxitin.php
    php_value auto_append_file ../../ncmailxitout.php
  • created in MAMP Document Root folder ncmailxitin.php
  • created in MAMP Document Root folder ncmailxitout.php

… did!


Previous relevant Apache/PHP/MySql Linux Language Considerations Primer Tutorial is shown below.

Apache/PHP/MySql Linux Language Considerations Primer Tutorial

Apache/PHP/MySql Linux Language Considerations Primer Tutorial

The recent CSS Style Javascript DOM Override Onload Primer Tutorial “proof of concept” web application ended up with the name …


are_you_happy_with_my_or_do_you_think_my_derriere_needs_work.html

… but along the way we wanted to call it …


are_you_happy_with_my_or_do_you_think_my_derrière_needs_work.html

… but this didn’t work as an RJM Programming website filename. Rather than make it work, we compromised, and called it (the final) are_you_happy_with_my_or_do_you_think_my_derriere_needs_work.html it ended up as. But this didn’t stop us wondering about all this language and the relationship of these language characters and where and how you can or can’t use those characters outside those usual US-keyboard type characters.

And that brings us to the great MAMP local Apache/PHP/MySql web server product, as a place to experiment, comforted in the knowledge that the Mac OS X Terminal application …


ls -li

… and knowledge of inodes (all the way to their “extreme case Linux system file removal talents) you can read about at Linux Inode File Removal Tutorial would probably protect me from home grown stupidities.

So what followed for me was a quick look at MAMP’s relevant php.ini file and its httpd.conf configuration files to see that the web server default “goto look for” file list for the web server directory can be altered by a change of …


DirectoryIndex index.html index.php

… to something else in httpd.conf Apache configuration file. But nothing to easily reinvent the US-keyboard feeling file extensions .htm and .html and .php that was apparent to me. And noting to change that …


[protocol]://localhost:[localHostPortNumber]/

… US-keyboard feeling prefix to a URL, such as our http://localhost:8888/ prefix to a MAMP local Apache/PHP/MySql URL we created a Simplified Chinese character set “Hello World” folder scenario (and thank Google Translate for translation help today) …

http://localhost:8888/你好/世界/

index.html as per …


<!doctype html>
<head>
<title>RJM编程着陆页</title>
<meta charset="UTF-8">
</head>
<body>
<h1>欢迎来到-RJM编程网站</h1><br>
<a target=_blank title='RJM编程着陆页' href='https://translate.google.com/translate?sl=en&js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&u=%2F%2Fwww.rjmprogramming.com.au%2Findex.html&tl=zh-CN'>RJM编程着陆页</a>
</body></html>

Within the php.ini configuration file we found interesting, in particular …


; Automatically add files before or after any PHP document.
auto_prepend_file =
auto_append_file =

; PHP's built-in default is text/html
default_mimetype = "text/html"

; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
allow_url_fopen = On

… the last of which, if set to Off could set up for the scenario of setting up a web server full of index.html and index.php code in web server folders that could include non US-keyboard characters, and so you could have within the code of …

http://localhost:8888/你好/

index.html a relative URL such as …

<a target=_blank title='你好 世界' href='世界'>你好 世界</a>

… taking you off to today’s (URL) starting place.

Am sure you can feel yourself, there is so much more to explore in this topic area, and we’ll be returning soon to this neck of the woods soon, we hope. In the meantime, take a look at our tutorial picture for a bit of what we did on MAMP with some of these concepts not changing any configuration files at all.

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


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


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

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

Australian Indigenous Language Drag and Drop Tutorial

Australian Indigenous Language Drag and Drop Tutorial

Australian Indigenous Language Drag and Drop Tutorial

Further to Australian Indigenous Language HTML Map Trove Tutorial, today, we wanted to see whether the Indigenous Language webpage could be improved by the application of drag and drop functionality. The thing is, “drag and drop” can supplement good “click” logic in this web application, rather than any thoughts regarding replacing it. In that sense we were on the lookout for a new resource regarding Indigenous Languages here in Australia, and found Aboriginal Languages of Australia had interesting audio links that we’ve long been interested in finding, thanks.

Nonetheless, we are not yet at a stage where we’ve seen every “parent” type caller of our still needing to be changed external Javascript countries.js “Drag and Drop specialist” called by the changed external Javascript aboriginal_language_regions.js further called by the changed HTML/Javascript parent called aboriginal_language_regions.html‘s live run link.

In these scenarios where a “child” external Javascript serves a wide range of “parent” needs, you can use global Javascript variables


var amdragging=false, havedropped=false, dropthing='';

… in the “parent” HTML webpage, and the “child” external Javascript typeof methodologies can be used for code like …


console.log("dragStart");
if (typeof(parent.amdragging) !== 'undefined') { parent.amdragging=true; }
if (typeof(parent.havedropped) !== 'undefined') { parent.havedropped=false; }
// ...
console.log("Drop ... " + ev.target.id + ' --- ' + ev.target.outerHTML);
dropdt=(new Date());
if (('' + ev.target.id) != '') {
if (typeof(parent.amdragging) !== 'undefined') { parent.amdragging=false; }
if (typeof(parent.havedropped) !== 'undefined') { parent.havedropped=true; }
} else if (('' + ev.target.outerHTML).indexOf(' alt="') != -1 && typeof(parent.amdragging) !== 'undefined' && typeof(parent.havedropped) !== 'undefined' && typeof(parent.dropthing) !== 'undefined') {
parent.dropthing=('' + ev.target.outerHTML).split(' alt="')[1].split('"')[0];
parent.langwo();
}

… in the country.js external Javascript “Drag and Drop specialist”, helping us associate “drop” logic with an HTML image map‘s area subelement of relevance, and then onto a window.open …


function langwo() {
if (typeof(amdragging) !== 'undefined' && typeof(havedropped) !== 'undefined' && typeof(dropthing) !== 'undefined') {
if (amdragging && !havedropped) { if (dropthing != '') { window.open('//www.dnathan.com/VL/index.php?searchstring=' + encodeURIComponent(dropthing) + '&searchtype=all', '_blank','top=10,left=10,height=' + eval(screen.height / 1.5) + ',width=' + eval(screen.width / 1.4)); } amdragging=false; havedropped=false; dropthing=''; }
}
}

… featuring in a new Javascript function, above, in the web application’s specific aboriginal_language_regions.js external Javascript.


Previous relevant Australian Indigenous Language HTML Map Trove Tutorial is shown below.

Australian Indigenous Language HTML Map Trove Tutorial

Australian Indigenous Language HTML Map Trove Tutorial

Revisiting the web application of Australian Indigenous Language HTML Map jQuery YQL Tutorial we …

  • take a step back, dismantling, at least as far as the user experience goes, the YQL functionality (it being a no-go these days … boo hoo) … and …
  • take a step forward augmenting Google Search links with incredible research content from the wonderful Trove

    Trove is a collaboration between the National Library of Australia and hundreds of Partner organisations around Australia.

… a feature we wish we’d got together earlier on, even back to the time of Australian Historical Research Primer Tutorial back in a 2014 look at Trove. Since then it’s had a great and useful makeover!

The changed external Javascript called aboriginal_language_regions.js is called by the changed HTML/Javascript parent called aboriginal_language_regions.html‘s live run link is a place for you to research “the oldest surviving culture in the world”.


Previous relevant Australian Indigenous Language HTML Map jQuery YQL Tutorial is shown below.

Australian Indigenous Language HTML Map jQuery YQL Tutorial

Australian Indigenous Language HTML Map jQuery YQL Tutorial

Our image map web application exploring Indigenous Australian Language, History and Culture quest continues, this time adding some jQuery and YQL and Ajax functionality best suited to non-mobile platform usage, but still appearing in the mobile “world” during a touch operation, as distinct from the “onhover” event scenario for non-mobile platforms.

Ajax is, for non-mobile platforms, a way to add functionality without moving off the webpage you are on, by gleaning information from other sources of data such as …

  • local HTML (or PHP) webpages
  • local data files
  • local database information
  • same domain HTML (or PHP) webpages
  • same domain data files

… but if you involve jQuery (Javascript library) as well (and we still hold off involving any server-side PHP, you’ll notice, and thanks here go to this very useful link) you can add …

… and so we do this today by adding the functionality to optionally find books of specific interest to your subject of interest as you roam (or “hover”) across the image map.

We facilitate this functionality for the user, again, via the use of a checkbox.

The changes to Javascript code as per aboriginal_language_regions.js are reflected by this link from yesterday.

The supervising HTML code as per aboriginal_language_regions.html needed to change to load the jQuery as reflected by this link from yesterday.

The minor changes to CSS as per aboriginal_language_regions.css are reflected by this link from yesterday.

To see this in action take a look at today’s live run.


Previous relevant Australian Indigenous Language Image Map Ajax Tutorial is shown below.

Australian Indigenous Language Image Map Ajax Tutorial

Australian Indigenous Language Image Map Ajax Tutorial

Today, again, we mix geography and history in an image map web application exploring Indigenous Australian Language, History and Culture, this time adding some Ajax functionality best suited to non-mobile platform usage.

Ajax is, for non-mobile platforms, a way to add functionality without moving off the webpage you are on, by gleaning information from other sources of data such as …

  • local HTML (or PHP) webpages
  • local data files
  • local database information
  • same domain HTML (or PHP) webpages
  • same domain data files

Again, here, we are talking about Javascript functionality, still not having to resort to any server-side language such as PHP, and though you can use jQuery calls to do this also, we do not call on any of this, as we just use Javascript code.

And the background context to all this … we established a “MobileFish” inspired HTML map element scenario with the following components …

  • a brilliant piece of research from the University of Western Sydney and ending up on the TreatyRepublic.net website as a map image … thanks
  • using the wonderful MobileFish image map (HTML element) creator helper … thanks

Today sees the introduction of an external CSS file, for styling, for the first time. This introduction of CSS causes the only change to our parent HTML code aboriginal_language_regions.html changed as per this link from yesterday.

The changes to Javascript code as per aboriginal_language_regions.js are reflected by this link from yesterday.

The fairly simple external CSS code file could be called aboriginal_language_regions.css

Yesterday we presented Australian Indigenous Language Image Map Checkbox Tutorial as shown below. The checkboxes are added to become …

  1. Images (will result in Google Image Search)
  2. Videos (will result in Google Video Search (if no Image Searching is happening))
  3. Map (onclick) (will additionally result in popup window of Google Map Chart (see also PHP/Javascript/HTML Google Chart Map Tutorial) of the tribal area)
  4. Map (onhover) (will additionally, via Ajax functionality, result in popup window of Google Map Chart (see also PHP/Javascript/HTML Google Chart Map Tutorial) of the tribal area)

It is this last functionality that will not work on mobile platforms, most likely, because the onmouseover event they use doesn’t happen with touch platforms.

You can try the web application as it stands now with our line run link.


Previous relevant Australian Indigenous Language Image Map Checkbox Tutorial is shown below.

Australian Indigenous Language Image Map Checkbox Tutorial

Australian Indigenous Language Image Map Checkbox Tutorial

Like yesterday, today we mix geography and history in an image map web application exploring Indigenous Australian Language, History and Culture, “the oldest surviving culture in the world”. Today’s tutorial, extending on yesterday’s Australian Indigenous Language Image Map Dropdown Tutorial continues the Javascript DOM methodology, and shows the use of checkboxes.

The HTML input tag’s checkbox type is a “binary” decision maker, boiling down to a yes/no (or true/false) decision on something. A related HTML input tag type is called the radio button, which allows two or more choices, only one of which can be yes (or true). Checkboxes are more independent than radio buttons, and perhaps more generically useful in that respect. However, if stringency and transparency of purpose is what you are after, a radio button leaves no doubt as to interpretation for the user, usually, because the element can only highlight at most one option.

Our checkboxes today are for …

  1. Images (will result in Google Image Search)
  2. Videos (will result in Google Video Search (if no Image Searching is happening))
  3. Map (will additionally result in popup window of Google Map Chart (see also PHP/Javascript/HTML Google Chart Map Tutorial) of the tribal area)

As you can see, there is more complication here that a radio button, on its own, cannot resolve.

Just reviewing how we got here … we established a “MobileFish” inspired HTML map element scenario with the following components …

  • a brilliant piece of research from the University of Western Sydney and ending up on the TreatyRepublic.net website as a map image … thanks
  • using the wonderful MobileFish image map (HTML element) creator helper … thanks

From there we’ve been developing external Javascript to allow a dropdown and checkboxes, with minimal change to that originally written HTML, and without resorting to PHP usage.

So please take a look at today’s live run (HTML source code (you could call) aboriginal_language_regions.html unchanged from yesterday, and calling on the external Javascript aboriginal_language_regions.js changed as per this link from yesterday) where we add those three new checkbox elements to refine our Google Search information, and add “map” functionality via Google Map Chart.


Previous relevant Australian Indigenous Language Image Map Dropdown Tutorial is shown below.

Australian Indigenous Language Image Map Dropdown Tutorial

Australian Indigenous Language Image Map Dropdown Tutorial

Today we mix geography and history in an image map web application exploring Indigenous Australian Language, History and Culture. We’ll be devoting a blog posting to the subject in the future, but today’s tutorial, extending on yesterday’s Australian Indigenous Language Image Map Primer Tutorial and its promise of more Javascript DOM functionality to follow, uses a Javascript DOM technique we term here, the “Javascript DOM Big Changes” technique, which is the idea of manipulating “document.body.innerHTML” as a whole.

This technique of manipulating “document.body.innerHTML” as a whole is all fine to do, but you should remember with it that values the user has set, since, with dropdown selection, for instance, need to be taken into account, as a separate stage afterwards, with this method … you’ll see what we mean …

Introduction to Australia’s Aboriginal Culture by David M. Welch. … Aboriginal culture probably represents the oldest surviving culture in the world


function selchange(osel) {
var ov=osel.value;
var oi=osel.id;
document.body.innerHTML = document.body.innerHTML.replace(/" target="_blank"/g, "+'" + ov.replace(/ /g, "%20") + "'" + '" target="_blank"');
document.getElementById(oi).value = ov;
}

… in code above, for the dropdown’s “onchange” event logic … or by trying your own scenarios … which am 100% certain you’ll be beavering away at within minutes of reading today’s offering?!

Is the “document.body.innerHTML” a refresh? It sort of acts like one, but it is more as well, because you have your own logic controls over what gets “refreshed into” … something a little more comfortable, perhaps?!

Now, back to the real world purpose of this technique. Yesterday we established a “MobileFish” inspired HTML map element scenario with the following components …

  • a brilliant piece of research from the University of Western Sydney and ending up on the TreatyRepublic.net website as a map image … thanks
  • using the wonderful MobileFish image map (HTML element) creator helper … thanks

… so now we virtually leave that HTML intact and only mildly changed, and do not use PHP, no matter how tempting that is for me to do, and use Javascript on that existant HTML (which, by the way, will eventually be fleshed out to avoid ‘Under construction’ messages, eventually) to perform significant functional improvements. This Javascript is external Javascript, hence the minimalist approach to changes to the HTML.

So take a look at today’s live run (HTML source code (you could call) aboriginal_language_regions.html changed as per this link from yesterday, and calling on the external Javascript aboriginal_language_regions.js) where we add the dropdown HTML select element at the top to refine our Google Search information.


Previous relevant Australian Indigenous Language Image Map Primer Tutorial is shown below.

Australian Indigenous Language Image Map Primer Tutorial

Australian Indigenous Language Image Map Primer Tutorial

We want to show more ideas with Javascript DOM and the HTML map element over coming days.

The HTML map element is a very useful way to combine a graphical image with web functionality, by turning that image into a clickable, by region, entity.

For the theme of work over the next few days we combine history and geography. Remember at school that history and geography were choices at a certain stage of schooling, but today, we try to use geography to foster an interest in history … after all, where we live is really important to how history pans out for society.

Was inspired by a story of a several meter high atlas that is currently on display in our New South Wales library … and it takes two people to turn a page, else the weight of the page will tear it with only one person turning.

This thought of maps combined with me with a story about how diverse and interesting our Australian Indigenous Languages are here in Australia. There are hundreds of languages involved in Australia’s history, though we often only think of English … so take a look at today’s live run (HTML source code (you could call) aboriginal_language_regions.html) where we show …

  • a brilliant piece of research from the University of Western Sydney and ending up on the TreatyRepublic.net website as a map image … thanks
  • using the wonderful MobileFish image map (HTML element) creator helper … thanks

… to set up that initial additional “onclick” intelligence that takes you to some Google search engine opportunities to link a region of Australia with an indigenous tribe (and its language), as a first step in the functionality we develop over time.

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


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


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


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


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


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


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

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

Drag and Drop via Hotlinked External Javascript Tutorial

Drag and Drop via Hotlinked External Javascript Tutorial

Drag and Drop via Hotlinked External Javascript Tutorial

There are three very useful “hotwiring” ideas that usually work with your web applications …

  • via absolute image URLs
  • via absolute stylesheet URLs
  • via absolute external Javascript URLs

… and that last one is what we want to hone in regarding, with an idea we had to allow a user to …

  • write their own HTML (and derived Javascript) via a textarea element with initial template HTML code
  • construct a personalized HTML webpage after the light green submit button press … so that …
  • downloading the HTML is possible via “View Page Source” (context option) and Copy/Paste into a text editor (and then, perhaps, onto local system web server environment development via an Apache/PHP/MySql local web server product such as MAMP)

In order to allow this more generic approach we made changes to our external Javascript countries.js “Drag and Drop specialist” use by our “first draft proof of concept” PHP draganddrop_hotwiring.php web application you can try below (where a context option like “View Frame Source” might more be the go regarding downloading your HTML invention)

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

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