Tag Archives: cell

CSS Countdown Table Tutorial

What the user is lacking working the web application of yesterday’s CSS Countdown Emoji Tutorial is a … means by which to spread horizontally … to supplement the pre-existant … means by which to spread vertically With pre-existant div elements nested, perhaps, by details elements can probably be arranged horizontally via some fancy CSS, but we’d prefer to use the more traditional … table … nesting a … single tr row element … nesting … one or more td cells nesting “pre-existant div elements nested, perhaps, by details elements” Just as with the details elements, the td cells will need to be sized as applicable (ie. if they nest img data via … <style> div:not(.nested)::after { content: var(–tooltip-string); } </style> ). For the user to implement this table functionality, they just need to prefix their textbox entry by a space character … // Inform users … placeholder=”Enter comma separated list (we’ + “‘” + ‘ll CSS countdown via counter & var) of sets of Title:ImageURL (two :: means do not use details/summary and space appended Title uses ~ else emojis used and space prefixed Title causes display in a table of one row of cells)” // … at form onsubmit (before recall) … if ((cbits[0] + ‘x’).substring(0,1) == ‘ ‘) { formo.innerHTML+='<input type=hidden name=table value=”y”></input>’; cbits[0]=cbits[0].substring(1); } // … on recall … var dotb=(location.search.split(‘table=’)[1] ? true : false); var dotbprefix=”, dotbsuffix=”; if (dotb) { dotbprefix='<td>’; dotbsuffix='</td>’; } // … later within recall … outval=dotbprefix.replace(‘>’, ‘ id=td’ + detcnt + ‘>’) + dodsprefix.replace(‘<details’, ‘<details id=det’ + detcnt).replace(‘>’, ‘ style=”background:linear-gradient(rgba(255,255,255,0.8),rgba(255,255,255,0.8)),url(‘ + dimgh(dwiurl) + ‘);background-repeat:no-repeat;background-position:0px 60px;”>’) + ‘<div class=nested style=”–tooltip-string:url(‘ + dwiurl.split(‘#’)[0] + ‘);”>’ + decodeURIComponent(inval).replace(/\+/g,’ ‘) + ‘</div>’ + dodsmiddle + dodssuffix + dotbsuffix; if (outval.indexOf(‘</td>’) != -1) { return ‘<table><tr>’ + outval + ‘</tr></table>’; } // as details element gets its height td gets that and width … if (document.getElementById(deto.id.replace(‘det’, ‘td’))) { document.getElementById(deto.id.replace(‘det’, ‘td’)).style.height=bigh; document.getElementById(deto.id.replace(‘det’, ‘td’)).style.minHeight=bigh; document.getElementById(deto.id.replace(‘det’, ‘td’)).style.width=bigw; } . And so, again, see this in action, via the changed css_count_image.html‘s live run. Previous relevant CSS Countdown Emoji Tutorial is shown below. A synopsis of the CSS highlights of the web application of yesterday’s CSS Countdown Reveal Tutorial are, so far … counter-increment counter-reset var (as in content: var(–tooltip-string);) … and today’s addition is … attr (as in content: attr(data-cnt);) … that “attr” (standing for attribute) causing an interplay to go on from the HTML (design) back to the CSS (styling) and back out to the HTML (design). The “attr” is also a reminder of the huge wooooorrrrlllllddd of Javascript global data attributes that awaits your imagination here, because though “attr” can point at the big attributes like “title” or “class” or “id” it can also point at your tailored global data attributes, turning on the intelligence of your HTML to be that little more like XML (invited into all the swankiest establishments, wooooohooo!) Today, we’re going to, as the default, … Continue reading →

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

ComboBox Sort Tutorial

All around the Internet, where there is tabular data presented, users instinctively look to that table’s header row and the column header cells (often “th” elements) to find ways to sort the data of the associated column’s rows, or in our ComboBox web application, that would be the presented order of option elements within the row data cell (usually “td” elements) “select” (dropdown) elements. With today’s work, we do not buck that idea, placing our new sort functionalities, on top of the recent ComboBox Wikipedia Tutorial‘s progress … to that same aforesaid mentioned “place” … tabular header row column “th” cells … but … in a less commonly seen “form” … because we decide to turn “th” cell hardcodings into “a” element links (not underlined) that when clicked/tapped bring up a Javascript prompt window presenting a way for the user to decide (or not) among three new sort (of data) choices … Ascending (sort) Descending (sort) Original (as presented originally) Can these “rearrangements of data” move with the “select” (dropdown) element? You bet they can! Now, we all know that “Chewing Gum” always sticks to the rails, and “Razor Blade” is always cutting it off, but who rounds the corner “sitting pretty”? Anyone, anyone? Yes, Laffit Pincay Junior, that “Global Attribute” has a wicked and withering home run! So much so, there’s time for the caller to formalize with that horse’s middle name … … and “Global Data Attribute” wins by four lengths, in grand style! Yes, these global data attributes are like having XML in your HTML armoury of data smarts. All we do, when called on to sort dropdown data is to store its Original order in a global attribute and then sort (that separate innerHTML content “option” subelements) off that, as called upon to do so (that “function thprompts” being called around the same time as document.body ‘s “onload” event) … function askaboutsort(iw, iwc) { var ioselo=null; var sels=[], isels=0; var curval=”; var ansis=”; var contarr=[], icont=0, incont=”; var ris=’O’; sels=document.getElementsByTagName(‘select’); for (isels=0; isels<sels.length; isels++) { if ((” + sels[isels].name) == (‘selcombo’ + iw).replace(‘o0′,’o’) || (” + sels[isels].name) == (‘selcombo’ + iw).replace(‘oJUNK0′,’o’)) { ioselo=sels[isels]; curval=ioselo.value; } } if (ioselo) { if (ioselo.outerHTML.indexOf(‘ data-content=’) != -1) { contarr=decodeURIComponent(ioselo.getAttribute(‘data-content’)).split(‘</option>’); contarr.sort(); ansis=prompt(‘Do you want to sort Ascending or Descending column or restore Original order ‘ + iwc + ‘? … A or D or O’, ”); } else { ris=’A’; ioselo.setAttribute(‘data-content’, encodeURIComponent(ioselo.innerHTML)); contarr=decodeURIComponent(ioselo.getAttribute(‘data-content’)).split(‘</option>’); contarr.sort(); ansis=prompt(‘Do you want to sort Ascending or Descending column ‘ + iwc + ‘? … A or D’, ”); } if (ansis == null) { ansis = ”; } if ((ansis + ‘ ‘).toUpperCase().substring(0,1) == ‘A’) { for (icont=0; icont<contarr.length; icont++) { incont+=contarr[icont] + ‘</option>’; } ioselo.innerHTML=incont; ioselo.value=curval; } else if ((ansis + ‘ ‘).toUpperCase().substring(0,1) == ‘D’) { for (icont=eval(-1 + contarr.length); icont>=0; icont–) { incont+=contarr[icont] + ‘</option>’; } ioselo.innerHTML=incont; ioselo.value=curval; } else if ((ansis + … Continue reading →

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

ComboBox Wikipedia Tutorial

Yesterday’s ComboBox Form Tutorial progress combined with today’s involvement of … Wikipedia … thanks … via … Inhouse PHP … and can open up our ComboBox Form Table web application to the idea that the user can decide the table column names. How, pray tell? Have you noticed how great Wikipedia is at lists? There are lists of a huge number of concepts. So, think of plural words and use the new “dot” link in the header label of our web application to define your comma separated list of column names, and we’ll use the new PHP combobox.php to see “whether it flies” with a list distilled back to the user in the dropdown within the table data row cell’s ComboBox’s div/select element’s dropdown (ie. select) part. Along the way we’ve started down the road of some mappings to those option elements of those ComboBox dropdown parts, that being … <option value=”[WikipediaBasedURL]”>[WikipediaBasedLabel]</option> … and in turn that has given us a pretty “static” (but none the less useful) “onchange” event logic idea to start using on ComboBox select (dropdown) element parts, as per … function woit(sthis) { if (sthis.value.indexOf(String.fromCharCode(104) + String.fromCharCode(116) + String.fromCharCode(116) + String.fromCharCode(112)) == 0) { // absolute URL value window.open(sthis.value,’_blank’,’top=100,left=100,width=600,height=600′); } } And on the recall analysis of form (ie. user interactions) report we can use (good ‘ol) document.referrer to glean precise “name” in “name=value” paradigm alert box reporting, those being those user defined column headings to the ComboxBox Form Table … <script type=’text/javascript’> var selc=” “, seli=0, selcombov=[], retrep=”; while (selc != ”) { selc = location.search.split(‘selcombo’ + seli + ‘=’)[1] ? decodeURIComponent(location.search.split(‘selcombo’ + seli + ‘=’)[1].split(‘&’)[0]) : ”; if (selc != ”) { selcombov.push(” + selc); retrep+=’Value’ + eval(1 + seli) + ‘ (set by user)=’ + selc + String.fromCharCode(10); } seli++; } if (retrep != ”) { if ((” + document.referrer).indexOf(‘?topics=’) != -1) { var cols=decodeURIComponent((” + document.referrer).split(‘?topics=’)[1]).split(‘,’); for (var iiu=1; iiu<=cols.length; iiu++) { retrep=retrep.replace(‘Value’ + iiu + ‘ ‘, cols[eval(-1 + iiu)] + ‘ ‘); } } alert(retrep); } </script> That being so, our changed external Javascript combobox.js called by our changed parent HTML combobox.htm web application might be worth your re-analysis. Previous relevant ComboBox Form Tutorial is shown below. Yesterday’s ComboBox Primer Tutorial got us working with new ComboBox div/select elements, but that was just a display mechanism, and not a “collection of data” mechanism. We could code for dynamic select “onchange” event and div “onblur” event logics, which we may allow for into the future, but today’s work is to have our external Javascript work with a parent HTML that has a … form method=GET action=[“here’s looking at you kid”] table with a header (ie. th cells) row … and row with empty data cells (ie. td cells) … <table border=20> <tr><th>Integer</th><th>Lowercase</th><th>Uppercase</th></tr> <tr><td></td><td></td><td></td></tr> </table> form submit button … that can parrot back what a user selected for their ComboBox(es). The external … Continue reading →

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

ComboBox Form Tutorial

Yesterday’s ComboBox Primer Tutorial got us working with new ComboBox div/select elements, but that was just a display mechanism, and not a “collection of data” mechanism. We could code for dynamic select “onchange” event and div “onblur” event logics, which we may allow for into the future, but today’s work is to have our external Javascript work with a parent HTML that has a … form method=GET action=[“here’s looking at you kid”] table with a header (ie. th cells) row … and row with empty data cells (ie. td cells) … <table border=20> <tr><th>Integer</th><th>Lowercase</th><th>Uppercase</th></tr> <tr><td></td><td></td><td></td></tr> </table> form submit button … that can parrot back what a user selected for their ComboBox(es). The external Javascript changes ensure … a mechanism now exists for multiple calls of the external Javascript from the parent HTML … exemplified by … <script type=’text/javascript’ src=’combobox.js?ddlist=1,2,3,4′ defer></script> <script type=’text/javascript’ src=’combobox.js?ddlist=a,b,c,d’ defer></script> <script type=’text/javascript’ src=’combobox.js?ddlist=A,B,C,D’ defer></script> and the default place to hold those resultant ComboBox div/select elements is to empty innerHTML elements (such as those td data cells above) … and … ComboBox div/select elements now get created with a “name” attribute (meaning selections are passed back to [here’s looking at you kid”] ComboBox div/select elements now get class “combobox” applied to them to aid with parent HTML styling CSS such as … <style> div.combobox { background-color:yellow; } select.combobox { background-color:pink; width:95%; } </style> … means they slot into place into the parent HTML form and be self-returnable (ie. action=[“here’s looking at you kid”]) … so that there can be better practical use made of these ComboBox div/select elements used by our changed external Javascript combobox.js called by our changed parent HTML combobox.htm web application … Previous relevant ComboBox Primer Tutorial is shown below. Do you remember a blog posting a couple of days ago called Favourites Poll Email Moderation Contenteditable Tutorial featuring … contenteditable global attribute magic ? Well, that started me rethinking on a very long-running personal desire with our web application work. In the Windows early GUI desktop applications going back to VB.Net and C++ in the latter 1900 years there was a GUI control called “ComboBox” (class) that never failed to impress me. It matches a lot of needs to be presented with a static list of choices in mind, but then want to extend that list as time and situation changes over time. A “ComboBox” can handle it, it being that combination of … dropdown (static) list … and … textbox “extender” … all manageable sounding in today’s web application wooooorrrrrlllllld, especially, in our minds, having defer and contenteditable as useful concepts for the latter item above. And so a … dropdown (select) element … nested within a … div contenteditable=true … paradigm is the basis for our combobox.js external Javascript to feature an Object Oriented looking Javascript Class … // combobox.js // External Javascript to extend some HTML like combobox.html allowing for … Continue reading →

Posted in eLearning, GUI, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

WordPress Recent Post Animated GIF Improvement Mobile Tutorial

Yesterday’s WordPress Recent Post Animated GIF Improvement Tutorial concerned … Landing Page iframe (zero.html) “content”, primarily … but there is also the matter of the … presentation (or display) of that content … and the nuanced improvements in this regard, today, concern mobile platforms, which had, up until today only shown 2 recent post thumbnails within that Landing Page iframe, leaving white space to the right of that iframe, perhaps making a user conclude “are there only two tutorials to read?”. No, better would be, on mobile, as for non-mobile … hide part of thumbnail 3 and entirely thumbnails 4 to 8 that don’t fit horizontally … but still allow a … user can scroll to these hidden thumbnails, and use them, via horizontal scrolling … and, as we often find in such matters, to encase whatever HTML content you are concerned about and not happy with within a new div encasing element is a great starting point, as per … <?php //$htmlis = “<html><head><script type=’text/javascript’> ” . // “var one_o_five=600; function ol() {” . // ” if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {” . // ” one_o_five=105; for (var j=3; j<=8; j++) {” . // ” document.getElementById(j).style.display=’none’; } } } </script><style> td { vertical-align: top; } </style></head><body onload=’ol();’ style=’width:260px;’><table style=’overflow:scroll;’><tr><td id=1></td><td id=2></td><td id=3></td><td id=4></td><td id=5></td><td id=6></td><td id=7></td><td id=8></td></tr></table></body></html>”; $htmlis = “<html><head><script type=’text/javascript’> ” . “var one_o_five=600; function postonl() {“. ” var ims=document.getElementsByTagName(‘img’); for (var jms=0;jms<ims.length; jms++) {” . ” ims[jms].src=ims[jms].src.replace(‘-0.jpeg’,’.jpg’); } }” . ” function ol() {” . ” if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {” . ” setTimeout(postonl,8000); ” . ” one_o_five=105;” . ” document.getElementById(‘dtable’).style.width=’260px’;” . ” document.getElementById(‘dtable’).style.overflow=’scroll’; } else if (1 == 2) {” . ” for (var j=3; j<=8; j++) { document.getElementById(j).style.display=’none’; } } else {” . ” setTimeout(postonl,1000); } } </script><style> td { vertical-align: top; } </style></head><body onload=’ol();’ data-style=’width:260px;’><div id=’dtable’><table id=’mytable’ style=’overflow:scroll;’><tr><td id=1></td><td id=2></td><td id=3></td><td id=4></td><td id=5></td><td id=6></td><td id=7></td><td id=8></td></tr></table></div></body></html>”; ?> … a change that didn’t need any tweaking of the parent Landing Page definition of the parent’s iframe element containing this content. We’ve automated a change from any (fast to load) “-0” image to equivalent animated GIF soon after page load along the way … <?php //$htmlis = “<html><head><script type=’text/javascript’> ” . // “var one_o_five=600; function ol() {” . // ” if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {” . // ” one_o_five=105; for (var j=3; j<=8; j++) {” . // ” document.getElementById(j).style.display=’none’; } } } </script><style> td { vertical-align: top; } </style></head><body onload=’ol();’ style=’width:260px;’><table style=’overflow:scroll;’><tr><td id=1></td><td id=2></td><td id=3></td><td id=4></td><td id=5></td><td id=6></td><td id=7></td><td id=8></td></tr></table></body></html>”; $htmlis = “<html><head><script type=’text/javascript’> ” . “var one_o_five=600; function postonl() {“. ” var ims=document.getElementsByTagName(‘img’); for (var jms=0;jms<ims.length; jms++) {” . ” ims[jms].src=ims[jms].src.replace(‘-0.jpeg’,’.jpg’); } }” . ” function ol() {” . ” if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {” . ” setTimeout(postonl,8000); ” . ” one_o_five=105;” . ” document.getElementById(‘dtable’).style.width=’260px’;” . ” document.getElementById(‘dtable’).style.overflow=’scroll’; } else if (1 == 2) {” . ” for (var j=3; j<=8; j++) { document.getElementById(j).style.display=’none’; } } else {” . ” … Continue reading →

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

WordPress Recent Post Animated GIF Improvement Tutorial

The last time we visited our crontab/curl once a day Recent Posts thumbnail imagery PHP application was for a bug fix when we presented WordPress Recent Post Bug Fix Tutorial. But there was an ongoing annoyance on top of that addressed today involving … animated GIF image presentations would not, until hovering over them, display as … the first slide of that animated GIF (but rather would show a snapshot of the previous day’s image) on … the iframe of the RJM Programming landing page … that iframe content having been … created via the changed recent-posts-2.php The three part changes (as proved would help over at MAMP (you can see a bit of with today’s animated GIF tutorial picture) by isolating the zero.html webpage (iframe content) recent-posts-2.php creates once a day every day at the instigation of crontab/curl) … Relating to Was …Becomes After onmouseover image name <?php … <img onmouseover=\”this.src=this.src.replace(‘-0.jpeg’,’.jpg’).replace(‘.jpeg’,’.jpg’); … ?> Before onmouseover image name call <?php … src=’//www.rjmprogramming.com.au/PHP/” . minuszerobetter($narray[$thisij] . “.jpeg”) . “?rand=” . rand(12345678) . “‘ /></a></td>” … ?> Before onmouseover image name called <?php function minuszerobetter($infp) { if (file_exists(dirname(__FILE__) . “/” . explode(“.”, $infp)[0] . “-1.jpeg”)) { if (file_exists(dirname(__FILE__) . “/” . explode(“.”, $infp)[0] . “-0.jpeg”)) { return explode(“.”, $infp)[0] . “-0.jpeg”; } else { return explode(“.”, $infp)[0] . “.jpg”; } } if (!file_exists(dirname(__FILE__) . “/” . $infp)) { return str_replace(“jpeg”,”jpg”,$infp); } return $infp; } ?> Now if it was me asking the questions, I’d ask … How does “-0” come into it? Glad you asked? It relates to something being the smart thing behind the scenes that detects any animated GIF presentations and not only creates an animated GIF presentation that starts up after onmouseover (ie. on hover) but supplies the animated GIF as JPEG “image slides” of that animated GIF, the first “image slide” being named with a “-0” in its name. Now, what is that “smart application”? It’s the great Linux (or other) command line “convert” application of the ImageMagick suite of image manipulations programs. We call it from the PHP as per … if (file_exists(dirname(__FILE__) . “/” . $narray[$thisij] . “.jpeg”)) { unlink(dirname(__FILE__) . “/” . $narray[$thisij] . “.jpeg”); } $zis=0; while (file_exists(dirname(__FILE__) . “/” . $narray[$thisij] . “-” . $zis . “.jpeg”)) { unlink(dirname(__FILE__) . “/” . $narray[$thisij] . “-” . $zis . “.jpeg”); $zis++; } exec(“convert ” . dirname(__FILE__) . “/” . $narray[$thisij] . “.jpg -resize 105 -quality 50 -strip ” . dirname(__FILE__) . “/” . $narray[$thisij] . “.jpeg”); … the other “beauty” of this PHP exec method arrangement being that the PHP hangs around until the “exec” command finishes, letting the (PHP) file_exists of the new PHP function above be functional and accurate and useful. Previous relevant WordPress Recent Post Bug Fix Tutorial is shown below. Welcome to our “WordPress Blog Recent Posts Widget Enhancer Bug Fix Troubleshooting Special” … catchy, huh?! But seriously, recently, on … Continue reading →

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

HTML Canvas Video Display Filters Tutorial

We’re adding some new functionality onto the recent HTML Canvas Video Display Primer Tutorial, that being … turn the “Video” hardcoded text, on the webpage … into an “a” link … <a style=”cursor:pointer;text-decoration:underline;” onclick=”askv();”>Video</a> … calling on the Javascript function … function askv() { var vurl=prompt(“Enter a video URL (if you click OK to blank entry we’ll open a local file browse window).”, “”); if (vurl != null) { if (vurl == “”) { document.getElementById(‘cvideo’).click(); // browse for video file on local device found=false; lookfor(); } else { location.href=document.URL.split(‘#’)[0].split(‘?’)[0] + ‘?vurl=’ + encodeURIComponent(vurl); // reload with video URL } } } to allow for a “reload with video URL” … <script type=’text/javascript’> var types = [“video/mp4″,”image/svg”,”audio/wav”,”audio/x-wav”,”audio/x-pn-realaudio”,”audio/x-mpegurl”,”audio/x-aiff”,”audio/mpeg”,”audio/mid”, “audio/basic”,”audio/ogg”,”video/x-sgi-movie”,”video/x-msvideo”,”video/quicktime”,”audio/mp3″,”video/mp4″,”video/mpeg”, “video/x-la-asf”,”video/ogg”,”video/webm”,”audio/mp4″, “image/jpeg”, “image/jpeg”, “image/png”, “image/gif”, “image/bmp”, “image/tif”, “text/html”, “text/html”, “text/html”, “text/javascript”, “text/css”, “text/plain”, “text/xml”, “text/csv”, “application/vnd.ms-word”, “application/vnd.openxmlformats-officedocument.wordprocessingml.document”, “application/x-php”, “application/pdf”, “application/vnd.openxmlformats-officedocument.presentationml.presentation”, “application/vnd.ms-powerpoint”, “application/vnd.ms-excel”, “application/vnd.openxmlformats-officedocument.spreadsheetml.sheet”]; var exts = [“.mp4″,”.svg”,”.wav”,”.wav”,”.ram”,”.m3u”,”.aiff”,”.mp3″,”.rmi”, “.snd”,”.ogg”,”.movie”,”.avi”,”.mov”,”.mp3″,”.m4v”,”.mpeg”, “.lsx”,”.ogv”,”.webm”,”.m4a”, “.jpg”, “.jpeg”, “.png”, “.gif”, “.bmp”, “.tif”, “.htm”, “.html”, “.htmls”, “.js”, “.css”, “.txt”, “.xml”, “.csv”, “.doc”, “.docx”, “.php”, “.pdf”, “.pptx”, “.ppt”, “.xls”, “.xlsx”]; var ourmimetype=””; var vnameis=location.search.split(‘vurl=’)[1] ? decodeURIComponent(location.search.split(‘vurl=’)[1].split(‘&’)[0]) : ‘ants_reversed.mp4’; for (var ji=0; ji<exts.length; ji++) { if ((“.” + vnameis.split(‘.’)[eval(-1 + vnameis.split(‘.’).length)]).toLowerCase() == exts[ji].toLowerCase()) { ourmimetype=types[ji]; } } </script> … dovetailing with the new … <script type=’text/javascript’> document.write(“<video id=vvideo data-style=display:none; controls><source id=vsource src=” + vnameis + ” type=” + ourmimetype + “></video>”); </script> to allow for a “browse for video file on local device” … function lookfor() { if (!found) { if (document.getElementById(‘cvideo’).value != “”) { document.getElementById(‘vbut’).click(); } else { setTimeout(lookfor, 1000); } } } … <input style=”display:none;” type=”file” name=”video” id=”cvideo” accept=”video/*”></input><span class=readVBytesButtons><button style=display:none; data-startbyte=0 data-endbyte=4>1-5</button><button style=display:none; data-startbyte=5 data-endbyte=14>6-15</button><button style=display:none; data-startbyte=6 data-endbyte=7>7-8</button><button id=vbut style=background-color:pink;display:none;>Video Process</button></span> … document.querySelector(‘.readVBytesButtons’).addEventListener(‘click’, function(evt) { if (evt.target.tagName.toLowerCase() == ‘button’) { var startByte = evt.target.getAttribute(‘data-startbyte’); var endByte = evt.target.getAttribute(‘data-endbyte’); readVBlob(startByte, endByte); } }, false); … var mfil=null; function readVBlob(opt_startByte, opt_stopByte) { var file = document.getElementById(‘cvideo’).files[0]; mfile = file; document.getElementById(‘vsource’).type=mfile.type; var start = parseInt(opt_startByte) || 0; var stop = parseInt(opt_stopByte) || mfile.size – 1; var reader = new FileReader(); // If we use onloadend, we need to check the readyState. reader.onloadend = function(e) { if (e.target.readyState == FileReader.DONE) { // DONE == 2 document.getElementById(‘dvideo’).innerHTML='<video id=vvideo data-style=display:none; controls><source id=vsource type=’ + document.getElementById(‘vsource’).type + ‘ src=”‘ + e.target.result + ‘”></source></video>’; initCanvas(); } }; var blob = mfile.slice(start, stop + 1); reader.readAsDataURL(mfile); //blob); } to allow for some changed … HTML <select onchange=”qangle=’-0.0′; dorotate=false; inversev=false; grayscalev=false; doflip=false; doflop=false; rep=scratchit(this.value);”><option value=’repeat’>Repeat</option><option value=’no-repeat’>No Repeat</option><option value=’Repeat’>Grayscale Repeat</option><option value=’No-repeat’>Grayscale No Repeat</option><option value=’rEpeat’>Inverse Repeat</option><option value=’nO-repeat’>Inverse No Repeat</option><option value=’repEat’>Flip Repeat</option><option value=’no-Repeat’>Flip No Repeat</option><option value=’repeAt’>Flop Repeat</option><option value=’no-rEpeat’>Flop No Repeat</option><option value=’repeaT’>Rotate Repeat</option><option value=’no-rePeat’>Rotate No Repeat</option></select> Javascript initializations … var inversev=false, grayscalev=false; var doflip=false, doflop=false; var qangle=’-0.0′, dorotate=false; Javascript changed function … function scratchit(inr) { if ((” + inr).toLowerCase().indexOf(‘no-‘) == 0) { scratch.width = eval(” + iwis); scratch.height = eval(” + ihis); } if ((” + inr + ‘ ‘).substring(0,1) == (” + inr + ‘ ‘).substring(0,1).toUpperCase()) { grayscalev=true; } else if ((” + … Continue reading →

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

HTML Canvas Video Display Primer Tutorial

In doing the research for yesterday’s HTML Canvas Pros and Cons Inline HTML Email Tutorial‘s heavy use of the stupendous HTML(5) canvas element we came upon a very interesting discovery, at least for us, that being the HTML canvas createPattern() Method. Have you read this webpage yet? Did you notice … Definition and Usage The createPattern() method repeats the specified element in the specified direction. The element can be an image, video, or another <canvas> element. The repeated element can be used to draw/fill rectangles, circles, lines etc. ? So modestly put, in a list like that, but the implications so big, would you not say … eh wot, guv’?! No examples followed, alas, but a scouring of the “net” arrived at The Definitive Guide to HTML5 Video (ISBN: 978-1-4302-3091-5) mention on a Google search, thanks everyone! This gave us great scope for a proof of concept web application we got going so long as we clicked (and so the video becomes visible) on the controls of a video element (to play it), as is now the go with a lot of platforms, when it comes to working with (and amongst) media forms. A video plays, and the canvas createPattern helps project “repeat” or “no-repeat” (controllable to user, a concept similar to how background images can work) onto the right hand table cell’s canvas via a hidden smaller canvas conduit, the widths and heights controllable to the user as well (all the way to, perhaps, having the canvas be bigger than the video, and so zoom into it (and maybe zoom out the screen) as you can see with today’s animated GIF tutorial picture). In that tutorial picture, also take a quick skeg at macOS two finger gesture’s video “Picture in Picture” functionality, too. Pretty interesting start to a journey we think there’ll be more to talk about into the future. You can try for yourself at the “proof of concept” canvas_createpattern_video.html‘s live run link. If this was interesting you may be interested in this too.

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