Emoji Random Slideshow Sharing Tutorial

Emoji Random Slideshow Sharing Tutorial

Emoji Random Slideshow Sharing Tutorial

Accountability and sharing are feature words for our functionality improvements on yesterday’s Random Emoji Slideshow we presented with Emoji Random Slideshow Primer Tutorial yesterday.

  1. Accountability is achieved by remembering the random emojis on any given session should the user be interested, and the means by which this is done in the web application, is by Javascript DOM … no databases nor server-side code. If your promise to do with accountability concerns only the session the user is on, then Javascript DOM and/or HTTP Cookies can usually handle such jobs. Our Javascript DOM functionality works via …
    • an HTML div element is appended to the HTML body element innerHTML property is the “parent” to “child” elements below, that has style properties …
      • overflow-x:scroll to allow for horizontal scrolling, and you’ll know if you’re a regular reader the overflow anything CSS property is a favourite of ours regarding that CSS topic “theme” of “reveal” we like at this blog
      • -webkit-overflow-scrolling:touch to allow for momentum scrolling on mobile devices (as we did with Image in Nine Game Hide and Seek Tutorial)
      • visibility:hidden to allow for user controllable visibility of this functionality that occurs by clicking the ➕➕ emoji “buttons”, which uses Javascript DOM to make the HTML div above “visible” (and you may want to read Karaoke via YouTube API in Iframe Primer Tutorial regarding the differences between this method versus the setting of the display property, alternative approach)
    • an HTML table element (and, like for Karaoke via YouTube API in Iframe Email Tutorial, channelled some of the thinking regarding HTML table element border attributes to be quite big numerical values … though we, again, tone that down a bit for today’s purposes … which we talked about with Holes Web Application Primer Tutorial) with one HTML tbody element with one HTML tr (row) element … encasing …
    • many HTML td cell elements created on the fly, the content coming from a snapshot of the current emoji (using outerHTML Javascript DOM properties), and the Javascript DOM achieving it by appending that content to the HTML tr (row) element above innerHTML property … as per …

      document.getElementById('sessiontr').innerHTML += '<td id=td' + cnt + ' style="font-size:18px;background-color:' + colhuh + ';">' + document.getElementById('myh4').outerHTML + '<br>' + document.getElementById('re').outerHTML + '</td>';
  2. Sharing functionality is approached by allowing for emailing snapshots of an Emoji Slideshow session … via …
    • taking the existing (email via PHP mail) functionality we had established after …

      child PHP legend_via_map.php changed in this way for email functionality

      … from Karaoke via YouTube API in Iframe Email Tutorial we tweak this PHP coding to be able to manage HTML email attachments via the new child PHP legend_via_map.php changed in this new way … where …

    • the email client “branch” of this functionality is unavailable to us with today’s work, because a mailto: HTML a link element cannot feed into a “text/html” email, but rather, only, the default “text/plain” (no attachment) mailto usage … invoked by …
    • the clicking of an 📧 emoji “button” to ask for an emailee email address, and then off to the PHP code above via an HTML form action via a target pointing at an HTML iframe element, all invisible to the user, very similar to how we did email functionality in the Karaoke via YouTube API in Iframe Email Tutorial

So, again, we say “Happy Emoji making” with our new HTML and Javascript emoji_slideshow.html changed this way, and its slideshow live run. We hope you try it out … and share your experience!

Stop Press

Yes, you were right, you who predicted the weakness with the prototype code design above. What if somebody leaves it running forever? Yes, the web browser suffers … event-u-ally, so we’ve changed (the main Javascript function of use) as below …


function dothis() {
var postfw, fw=Math.floor((Math.random()*firstbytes.length)+0);
try {
postfw = eval(Math.floor((Math.random()*rsize[fw])+0) + (firstbytes[fw] + srangebytes[fw]).codePointAt(0)); //Math.floor((Math.random()*rsize[fw])+0));
} catch(e) {
postfw = eval(Math.floor((Math.random()*rsize[fw])+0) + fixedCharCodeAt((firstbytes[fw] + srangebytes[fw]), 0)); //Math.floor((Math.random()*rsize[fw])+0));
}
if (bcol != "YELLOW") {
document.getElementById('myh4').innerHTML = '';
document.getElementById('re').innerHTML = '&nbsp;';
} else {
document.getElementById('myh4').innerHTML = 'Codepoint: <a target=_blank title="Google search" href="https://www.google.com.au/?gfe_rd=cr&ei=X6rxV8GfFqzr8Aeo-5_4AQ&gws_rd=ssl#q=%26%23' + postfw + '">' + postfw + '</a>';
document.getElementById('re').innerHTML = '<a style=text-decoration:none; target=_blank title="Google search" href="https://www.google.com.au/?gfe_rd=cr&ei=X6rxV8GfFqzr8Aeo-5_4AQ&gws_rd=ssl#q=%26%23' + postfw + '">' + String.fromCodePoint(postfw) + '</a>';
cnt++;
if (eval(cnt) > 1200) {
cnt = 1;
document.getElementById('sessiontr').innerHTML = "";
}

var carr=['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'];
var ired = Math.floor(Math.random() * 127);
var igreen = Math.floor(Math.random() * 127);
var iblue = Math.floor(Math.random() * 127);
var colhuh = '#f' + carr[Math.floor(eval(ired) % 16)] + 'f' + carr[Math.floor(eval(igreen) % 16)] + 'f' + carr[Math.floor(eval(iblue) % 16)];
document.getElementById('sessiontr').innerHTML += '<td id=td' + cnt + ' style="font-size:18px;background-color:' + colhuh + ';">' + document.getElementById('myh4').outerHTML + '<br>' + document.getElementById('re').outerHTML + '</td>';
}
}

… which is called by the document.body onload event as per “setInterval(dothis,3000)”


Previous relevant Emoji Random Slideshow Primer Tutorial is shown below.

Emoji Random Slideshow Primer Tutorial

Emoji Random Slideshow Primer Tutorial

We’ve got a Random Emoji Slideshow for you today, a project long in the thinking, and helped out enormously by the great Open Source community on the net, two webpages from which we’d like to point you towards, regarding this topic …

You may recall from the recent Karaoke via YouTube API in Iframe Emoji Tutorial our old approach to finding technically useful information from the net when we said …

How do we find the emojis we want? Well, at the entry level and exit level we have, respectively …

  • searches for relevant words in Google search engine … eg. “video game emoji” Google search as per this link
  • and hope to arrive at the http://www.fileformat.info website for the technical details necessary … eg. Unicode Character ‘VIDEO GAME’ (U+1F3AE) HTML Entity (decimal) &#127918; is what is useful to us, in HTML coding as a value= value for HTML input elements or innerHTML property of HTML a elements, for instance

The steps in between the two above tends to be a bit variable. For the example above, we ended up at Google’s first suggestion, which we often end up at, at the domain emojipedia.org, specifically this link and its “Codepoints” section value U+1F3AE that when refed back into Google search engine (for us, by literally typing it into the address bar) you get a first result sending you to http://www.fileformat.info website’s Unicode Character ‘VIDEO GAME’ (U+1F3AE) as above. However, we did not always use emojipedia.org as our “middle guide” here. There are many references out there.

… but the word we didn’t hone in on then, that we’d like to hone in on now … better late than never … is Codepoint, regarding Character Encoding, quite a big, and at many times, confusing, subject matter in Information Technology. But you wouldn’t really expect it to be otherwise, as it is a matter with Internationalization getting us … all of us non-Martians … together on representing ourselves, with all our different language and symbology methods of communicating, out there on the “palette” that the internet is for so many of us … though, think we should invite any Martians in to Internet cafe sessions over nibbles, don’t you think?

For us, the useful technical thing to take away, is, for Emojis … and other symbology is even easier …


&#[Codepoint]

… is “lookable uppable” these days on the search engines, and so our Emoji Slideshow web application today, in which there is nothing for you to do regarding the slideshow, leaves you with spare time to click either …

  • the random emoji itself … or …
  • the “Codepoint” link

… to start up a Google search regarding that, that we’ve found, for most emojis, gets you quickly to some good technical information with the links up the top of the search engine results.

Happy Emoji making with our HTML and Javascript emoji_slideshow.html and its slideshow live run.

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 *