{"id":55897,"date":"2022-05-22T03:01:25","date_gmt":"2022-05-21T17:01:25","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=55897"},"modified":"2022-05-22T09:40:21","modified_gmt":"2022-05-21T23:40:21","slug":"keyboard-based-cursor-canvas-content-copy-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/keyboard-based-cursor-canvas-content-copy-tutorial\/","title":{"rendered":"Keyboard Based Cursor Canvas Content Copy Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/body_mouse_deepdive.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Keyboard Based Cursor Canvas Content Copy Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/body_mouse_deepdive_canvas.jpg\" title=\"Keyboard Based Cursor Canvas Content Copy Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">Keyboard Based Cursor Canvas Content Copy Tutorial<\/p><\/div>\n<p>You may have noticed with yesterday&#8217;s <a title='Keyboard Based Cursor Share Content Copy Tutorial' href='#kbcscct'>Keyboard Based Cursor Share Content Copy Tutorial<\/a>, crucial to the sharing code, was the use of the incredible HTML5 introduced <a target=_blank title='HTML Canvas element information from w3schools' href='http:\/\/www.w3schools.com\/tags\/ref_canvas.asp'>canvas<\/a> element, helped by that middleperson link to those <i>public<\/i> email and SMS sharing conduits, overseeing the great random <a target=_blank title='Lorem Picsum' href='https:\/\/picsum.photos\/'>Lorem Picsum<\/a> background images and user created emoji and\/or text initial annotations.<\/p>\n<p>And this got us wondering whether there was a <i>private<\/i> (ie. inhouse) web application of the past that could further value add as another optional middleperson tool for (user) personalization (of the content) purposes.   And yes, do you remember the canvas work involved in the featured web application of <a target=_blank href='https:\/\/www.rjmprogramming.com.au\/ITblog\/emoji-borders-and-backgrounds-canvas-annotation-tutorial\/' title='Emoji Borders and Backgrounds Canvas Annotation Tutorial'>Emoji Borders and Backgrounds Canvas Annotation Tutorial<\/a>?<\/p>\n<p>It uses an interesting approach with the transference of data across from a canvas in one application to the canvas in that <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/user_of_signature_signature.htm\" title=\"user_of_signature_signature.htm\">user_of_signature_signature.htm<\/a> web application.  Once <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/body_mouse_deepdive.html----GETME\" title=\"body_mouse_deepdive.html\">our changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/body_mouse_deepdive.html----GETME\" title=\"body_mouse_deepdive.html\">body_mouse_deepdive.html<\/a>&#8216;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/body_mouse_deepdive.html\">&#8220;parent&#8221; web application<\/a> has organized its canvas contents, it&#8217;s just a matter of &#8230;<\/p>\n<p><code><br \/>\n  var awo=null;<br \/>\n  awo=<a target=_blank href='http:\/\/www.w3schools.com\/jsref\/met_win_open.asp' title='window.open information from w3schools'>window.open<\/a>('.\/user_of_signature_signature.htm','_blank','top=100,left=100,width=800,height=800');<br \/>\n<\/code><\/p>\n<p> for the &#8220;child&#8221; <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/user_of_signature_signature.htm\" title=\"user_of_signature_signature.htm\">canvas annotator<\/a> to effectively &#8220;suck up&#8221; the canvas data into its canvas via &#8230;<\/p>\n<p><code><br \/>\nvar cancont='';<br \/>\nvar elemode=location.search.split('elemode=')[1] ? (location.search.split('elemode=')[1].split('&')[0]) : \"canvas\";<br \/>\n<br \/>\nif (('' + <a target=_blank title='window.opener information from W3Schools' href='https:\/\/www.w3schools.com\/jsref\/prop_win_opener.asp'>window.opener<\/a>).replace('null','') != '') {<br \/>\n    var cans=window.opener.document.<a target=_blank title='Javascript DOM getElementsByTagName() method information from w3schools' href='https:\/\/www.w3schools.com\/jsref\/met_document_getelementsbytagname.asp'>getElementsByTagName<\/a>(elemode);<br \/>\n    if (cans.length &gt; 0) {<br \/>\n      if (elemode == 'img') {<br \/>\n      cancont=cans[0].src;<br \/>\n      } else {<br \/>\n      cancont=cans[0].<a target=_blank title='HTML5 canvas element toDataURL method information' href='https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/HTMLCanvasElement\/toDataURL'>toDataURL<\/a>('image\/png');<br \/>\n      }<br \/>\n      if (cancontw < 0 &#038;&#038; canconth < 0) {\n      cancontw=cans[0].width; \n      canconth=cans[0].height; \n      }\n    }\n}\n<\/code><\/p>\n<p> ... possible because both \"parent\" and \"child\" exist on the same RJM Programming domain (web server).<\/p>\n<p>Once there, another woooooorrrrrlllddd of image manipulations, via canvas, can await the user, perhaps ready for ongoing sharing possibilities with that \"child\".<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/keyboard-based-cursor-canvas-content-copy-tutorial\/'>Keyboard Based Cursor Canvas Content Copy Tutorial<\/a>.<\/p-->\n<hr>\n<p id='kbcscct'>Previous relevant <a target=_blank title='Keyboard Based Cursor Share Content Copy Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/keyboard-based-cursor-share-content-copy-tutorial\/'>Keyboard Based Cursor Share Content Copy Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/body_mouse_deepdive.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Keyboard Based Cursor Share Content Copy Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/body_mouse_deepdive_share.jpg\" title=\"Keyboard Based Cursor Share Content Copy Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">Keyboard Based Cursor Share Content Copy Tutorial<\/p><\/div>\n<p>Yesterday's <a title='Keyboard Based Cursor Personalized Content Copy Tutorial' href='#kbcpcct'>Keyboard Based Cursor Personalized Content Copy Tutorial<\/a> has probably reached a point where some sharing mechanism is apt, for accountability and usefulness purposes, at the very least, regarding our recent web application allowing for foreground content on top of a random <a target=_blank title='Lorem Picsum' href='https:\/\/picsum.photos\/'>Lorem Picsum<\/a> background image.<\/p>\n<p>We've been helped out greatly by <a target=_blank title='javascript - Can I take a screenshot from the clipboard? - Stack Overflow' href='https:\/\/stackoverflow.com\/questions\/55559432\/can-i-take-a-screenshot-from-the-clipboard'>javascript - Can I take a screenshot from the clipboard? - Stack Overflow<\/a> and <a target=_blank title='html - How to render a blob on a canvas element? - Stack Overflow' href='https:\/\/stackoverflow.com\/questions\/38004917\/how-to-render-a-blob-on-a-canvas-element'>html - How to render a blob on a canvas element? - Stack Overflow<\/a> in the following new relevant Javascript code ...<\/p>\n<p><code><br \/>\nfunction renderNoImage(canvas, blob) {  \/\/ thanks to https:\/\/stackoverflow.com\/questions\/38004917\/how-to-render-a-blob-on-a-canvas-element<br \/>\n  const ctx = canvas.getContext('2d');<br \/>\n  const img = new Image();<br \/>\n  img.onload = (event) =&gt; {<br \/>\n    URL.revokeObjectURL(event.target.src) \/\/  This is important. If you are not using the blob, you should release it if you don't want to reuse it. It's good for memory.<br \/>\n    ctx.drawImage(event.target, 0, 0)<br \/>\n  img.style.display='none';<br \/>\n  img.style.zIndex='-123';<br \/>\n  };<br \/>\n  img.src = URL.createObjectURL(blob);<br \/>\n}<br \/>\n<br \/> <br \/>\nfunction renderImage(canvas, blob) {  \/\/ thanks to https:\/\/stackoverflow.com\/questions\/38004917\/how-to-render-a-blob-on-a-canvas-element<br \/>\n  const ctx = canvas.getContext('2d');<br \/>\n  const img = new Image();<br \/>\n  img.onload = (event) =&gt; {<br \/>\n    URL.revokeObjectURL(event.target.src) \/\/  This is important. If you are not using the blob, you should release it if you don't want to reuse it. It's good for memory.<br \/>\n    ctx.drawImage(event.target, 0, 0)<br \/>\n  };<br \/>\n  img.src = URL.createObjectURL(blob);<br \/>\n}<br \/>\n<br \/> <br \/>\n  addEventListener(\"paste\", ev =&gt; { \/\/ thanks to https:\/\/stackoverflow.com\/questions\/55559432\/can-i-take-a-screenshot-from-the-clipboard<br \/>\n    for(const item of ev.clipboardData.items) { \/\/\/ Clipboard may contain multiple elements of different type -- text, image, etc<br \/>\n        if(item.type.startsWith(\"image\/\")) { \/\/\/ We are only interested in clipboard data that is an image<br \/>\n            if (emailee == '') {<br \/>\n            emailee=prompt('Your clipboard has a useful image you could share the image with.  Optionally, please enter an email address or SMS number to share with.');<br \/>\n            if (emailee == null) { emailee=''; }<br \/>\n            }<br \/>\n            if (emailee.indexOf('@') != -1) {<br \/>\n            document.getElementById('mydiv').style.overflow='scroll';<br \/>\n            document.getElementById('mycanvas').innerHTML='&lt;br&gt;&lt;canvas style=\"position:absolute;z-index:98;top:0px;left:0px;\" id=thecanvas width=' + screen.width + ' height=' + screen.height + '&gt;&lt;\/canvas&gt;';<br \/>\n            elem=document.getElementById('thecanvas');<br \/>\n            context=elem.getContext('2d');<br \/>\n            renderImage(elem, item.getAsFile()); \/\/context.drawImage(item.getAsFile(), 0, 0);<br \/>\n            document.getElementById('aemail').href=document.getElementById('aemail').href.replace(':?', ':' + emailee + '?');<br \/>\n            document.getElementById('aemail').click();<br \/>\n            document.getElementById('mycanvas').innerHTML='';<br \/>\n            } else if (emailee != '' && emailee.replace(\/0\/g,'').replace(\/1\/g,'').replace(\/2\/g,'').replace(\/3\/g,'').replace(\/4\/g,'').replace(\/5\/g,'').replace(\/6\/g,'').replace(\/7\/g,'').replace(\/8\/g,'').replace(\/9\/g,'') == '') {<br \/>\n            document.getElementById('mydiv').style.overflow='scroll';<br \/>\n            document.getElementById('mycanvas').innerHTML='&lt;br&gt;&lt;canvas style=\"position:absolute;z-index:98;top:0px;left:0px;\" id=thecanvas width=' + screen.width + ' height=' + screen.height + '&gt;&lt;\/canvas&gt;';<br \/>\n            elem=document.getElementById('thecanvas');<br \/>\n            context=elem.getContext('2d');<br \/>\n            renderImage(elem, item.getAsFile()); \/\/context.drawImage(item.getAsFile(), 0, 0);<br \/>\n            document.getElementById('asms').href=document.getElementById('asms').href.replace(':&', ':' + emailee + '&');<br \/>\n            document.getElementById('asms').click();<br \/>\n            document.getElementById('mycanvas').innerHTML='';<br \/>\n            } else {<br \/>\n            \/\/document.getElementById('mydiv').style.overflow='scroll';<br \/>\n            document.getElementById('mycanvas').innerHTML='&lt;br&gt;&lt;canvas style=\"display:none;position:absolute;z-index:-98;top:0px;left:0px;\" id=thecanvas width=' + screen.width + ' height=' + screen.height + '&gt;&lt;\/canvas&gt;';<br \/>\n            elem=document.getElementById('thecanvas');<br \/>\n            context=elem.getContext('2d');<br \/>\n            renderNoImage(elem, item.getAsFile()); \/\/context.drawImage(item.getAsFile(), 0, 0);<br \/>\n            document.getElementById('mycanvas').innerHTML='';<br \/>\n            }<br \/>\n        }<br \/>\n    }<br \/>\n});<br \/>\n<\/code> <\/p>\n<p> ... which is explained to the user in the following way ...<\/p>\n<blockquote><p>\nShare with email or SMS happens via screenshots (macOS control-command-shift-3 or Windows Prnt-Scrn) followed by File menu Paste option causing chance to share after which File menu Undo can remove pasted part as required.\n<\/p><\/blockquote>\n<p> ... in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/body_mouse_deepdive.html---GETME\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/body_mouse_deepdive.html---GETME\">\"proof of concept\" body_mouse_deepdive.html<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/body_mouse_deepdive.html\" title=\"Click picture\">live run<\/a>.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/keyboard-based-cursor-share-content-copy-tutorial\/'>Keyboard Based Cursor Share Content Copy Tutorial<\/a>.<\/p-->\n<hr>\n<p id='kbcpcct'>Previous relevant <a target=_blank title='Keyboard Based Cursor Personalized Content Copy Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/keyboard-based-cursor-personalized-content-copy-tutorial\/'>Keyboard Based Cursor Personalized Content Copy Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/body_mouse_deepdive.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Keyboard Based Cursor Personalized Content Copy Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/body_mouse_deepdiveemoji.jpg\" title=\"Keyboard Based Cursor Personalized Content Copy Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">Keyboard Based Cursor Personalized Content Copy Tutorial<\/p><\/div>\n<p>On top of yesterday's <a title='Keyboard Based Cursor Content Copy Tutorial' href='#kbccct'>Keyboard Based Cursor Content Copy Tutorial<\/a> we wanted to offer the user the chance for them to tailor their foreground content on top of the <a target=_blank title='Lorem Picsum' href='https:\/\/picsum.photos\/'>Lorem Picsum<\/a> background image.<\/p>\n<p>The user can enter this via the keyboard because there is an HTML div <a target=_blank title='Global contenteditable attribute information from W3schools' href='https:\/\/www.w3schools.com\/tags\/att_global_contenteditable.asp'>contenteditable<\/a>=true pallette to work with ...<\/p>\n<p><code><br \/>\n&lt;div id=mydiv onfocus='setTimeout(alte, 1000);' ondblclick=\"this.innerHTML='';\" onclick='stamp(event);' title='Click and type and see the cursor change as you use Alt or Shift or Control that can be reset via Caps Lock with a click copying cursor into content ... RJM Programming ... May, 2022 ... thanks to https:\/\/picsum.photos\/ Lorem Picsum  <font color=blue>You can change emojis if you know the \\002602 form of UTF-16 (hex) entry (our example is umbrella and if you express it as \\\\002602 that leaves cursor just as your emoji).  <\/font><font color=purple>Double click existant foreground emoji element to clear all the foreground emoji elements.<\/font>' spellcheck='false' contenteditable=true style='width:100vw;height:100%;color:transparent;text-color:transparent;' <font color=olive>onkeypress=kpcursorlook(event); <\/font>onkeydown=cursorlook(event); onmousemove=xycursorlook(event); ontouchmove=xycursorlook(event);&gt;&lt;\/div&gt;<br \/>\n<\/code><\/p>\n<p>It's \"title\" attribute now talks about two new pieces of functionality, those being ...<\/p>\n<ul>\n<li><font color=blue>You can change emojis if you know the \\002602 form of UTF-16 (hex) entry (our example is umbrella and if you express it as \\\\002602 that leaves cursor just as your emoji).  <\/font><\/li>\n<li><font color=purple>Double click existant foreground emoji element to clear all the foreground emoji elements.<\/font><\/li>\n<\/ul>\n<p>The choice of keyboard input methodology also suits CSS \"content\" property definitions as one backslash followed by a hexidecimal value left padded with zeroes to a length of six.  See us doing this below for an <span id=myumbrella>umbrella emoji <\/span> (which could also be expressed in an HTML hexadecimal entity way &amp;#x2602; &#x2602; the information for which you can find at <a target=_blank href='https:\/\/www.fileformat.info\/info\/unicode\/char\/2602\/index.htm'>Unicode Character 'UMBRELLA' (U+2602)<\/a> we normally get to by entering \"U+2602\" at a web browser address bar, the knowledge for which we arrive at via entering \"umbrella emojipedia\" and moving down the top link's webpage to find the \"U+2602\")  ...<\/p>\n<p><code><br \/>\n&lt;style&gt; #myumbrella::after { content: '\\002602'; } &lt;\/style&gt;<br \/>\n<\/code><\/p>\n<style> #myumbrella::after { content: '\\002602'; } <\/style>\n<p> ... that feeds into some new <a target=_blank title='Event onkeydown information from W3schools' href='https:\/\/www.w3schools.com\/jsref\/event_onkeypress.asp'>\"onkeypress\"<\/a> keyboard event logic ...<\/p>\n<p><code><br \/>\n  function kpcursorlook(evt) {<br \/>\n    var atofa=['a','b','c','d','e','f'];<br \/>\n    var rgbit='';<br \/>\n    if (evt.keyCode == 92) {<br \/>\n     if (newu.length == 1) { gro=true; } else { gro=false; }<br \/>\n     newu=(\"\\\\\").substring(0,1);<br \/>\n    } else if (evt.keyCode &gt;= 48 && evt.keyCode &lt;= 57) {<br \/>\n     newu+=('' + eval(-48 + evt.keyCode));<br \/>\n    } else if (evt.keyCode &gt;= 65 && evt.keyCode &lt;= 70) {<br \/>\n     newu+=('' + atofa[eval(-65 + evt.keyCode)]);<br \/>\n    } else if (evt.keyCode &gt;= 97 && evt.keyCode &lt;= 102) {<br \/>\n     newu+=('' + atofa[eval(-97 + evt.keyCode)]);<br \/>\n    }<br \/>\n    if (newu.length == 7) {<br \/>\n     if (lastcursor.indexOf((\"\\\\\\\\\").substring(0,2)) != -1) {<br \/>\n       rgbit=lastcursor.split((\"\\\\\\\\\").substring(0,2))[1].substring(6);<br \/>\n       lastcursor=lastcursor.split((\"\\\\\\\\\").substring(0,2))[0] + (\"\\\\\").substring(0,1) + newu + rgbit;<br \/>\n       document.head.innerHTML+='&lt;style&gt; html {  cursor: ' + lastcursor + '; } &lt;\/style&gt;';<br \/>\n     } else if (lastcursor.indexOf((\"\\\\\").substring(0,1)) != -1) {<br \/>\n       rgbit=lastcursor.split((\"\\\\\").substring(0,1))[1].substring(6);<br \/>\n       lastcursor=lastcursor.split((\"\\\\\").substring(0,1))[0] + newu + rgbit;<br \/>\n       if (gro) {<br \/>\n         lastcursor=lastcursor.replace('&gt;Shift\/Alt\/Ctrl', '&gt;').replace('&gt;Shift', '&gt;').replace('&gt;Alt', '&gt;').replace('&gt;Ctrl', '&gt;').replace(\" width='126'\", \" width='20'\").replace(\" width='66'\", \" width='20'\").replace(\" height='48'\", \" height='20'\").replace('0 0 100 100', '0 0 20 20');<br \/>\n       }<br \/>\n       document.head.innerHTML+='&lt;style&gt; html {  cursor: ' + lastcursor + '; } &lt;\/style&gt;';<br \/>\n     }<br \/>\n    }<br \/>\n   \/\/ console.log(evt.keyCode);<br \/>\n  }<br \/>\n<\/code><\/p>\n<p> ... in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/body_mouse_deepdive.html-GETME\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/body_mouse_deepdive.html-GETME\">\"proof of concept\" body_mouse_deepdive.html<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/body_mouse_deepdive.html\" title=\"Click picture\">live run<\/a>.<\/p>\n<p><b><i>Stop Press<\/i><\/b><\/p>\n<p>Two more \"title\" attribute pieces of functionality are now ...<\/p>\n<ul>\n<li><font color=darkgreen>With complex emoji entries do not zero leftpad until your last simple entity eg. \\\\1F6A3\\200D\\2640\\00FE0F could define a Woman Rowing complex emoji.<\/font><\/li>\n<li><font color=brown>Optionally make emojis bigger after \\ with + two time multipliers.<\/font><\/li>\n<\/ul>\n<p>The choice of keyboard input methodology also suits CSS \"content\" property definitions as one backslash followed by \"first off\" sets of HTML entities they should not left zero pad in their entry, followed by a last HTML entity hexidecimal value left padded with zeroes to a length of six to finish up with.  See us doing this below for a <span id=myrowing>woman rowing emoji <\/span> (which could also be expressed in an HTML hexadecimal entity way &amp;#x1f6a3;&amp;#x0200d;&amp;#x02640;&amp;#x0fe0f; the information for which you can find at <a target=_blank href='https:\/\/emojiterra.com\/woman-rowing-boat\/'>&#x1f6a3;&#x0200d;&#x02640;&#x0fe0f; Woman Rowing Boat Emoji<\/a> we normally get to by entering \"woman rowing emoji\" at the web browser address bar)  ...<\/p>\n<p><code><br \/>\n&lt;style&gt; #myrowing::after { content: '\\01f6a3\\00200d\\002640\\00fe0f'; } &lt;\/style&gt;<br \/>\n<\/code><\/p>\n<style> #myrowing::after { content: '\\01f6a3\\00200d\\002640\\00fe0f'; } <\/style>\n<p> ... in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/body_mouse_deepdive.html--GETME\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/body_mouse_deepdive.html--GETME\">\"proof of concept\" body_mouse_deepdive.html<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/body_mouse_deepdive.html\" title=\"Click picture\">live run<\/a>.<\/p>\n<p><img decoding=\"async\" style=\"width:100%;\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/body_mouse_deepdive_complexemoji.jpg\"><\/img><\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/keyboard-based-cursor-personalized-content-copy-tutorial\/'>Keyboard Based Cursor Personalized Content Copy Tutorial<\/a>.<\/p-->\n<hr>\n<p id='kbccct'>Previous relevant <a target=_blank title='Keyboard Based Cursor Content Copy Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/keyboard-based-cursor-content-copy-tutorial\/'>Keyboard Based Cursor Content Copy Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/body_mouse_deepdive.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Keyboard Based Cursor Content Copy Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/body_mouse_deepdive.jpg\" title=\"Keyboard Based Cursor Content Copy Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">Keyboard Based Cursor Content Copy Tutorial<\/p><\/div>\n<p>The <a target=_blank title='Event onkeydown information from W3schools' href='https:\/\/www.w3schools.com\/jsref\/event_onkeydown.asp'>\"onkeydown\"<\/a> keyboard event can involve in its logic three <a target=_blank title='Mouse event information from W3schools' href='https:\/\/www.w3schools.com\/jsref\/obj_mouseevent.asp'>mouse event<\/a> (event object) property usages that caught our interest recently ...<\/p>\n<ul>\n<li><a target=_blank title='event.altKey information from W3schools' href='https:\/\/www.w3schools.com\/jsref\/event_altkey.asp'>event.altKey<\/a><\/li>\n<li><a target=_blank title='event.shiftKey information from W3schools' href='https:\/\/www.w3schools.com\/jsref\/event_shiftkey.asp'>event.shiftKey<\/a><\/li>\n<li><a target=_blank title='event.ctrlKey information from W3schools' href='https:\/\/www.w3schools.com\/jsref\/event_ctrlkey.asp'>event.ctrlKey<\/a><\/li>\n<\/ul>\n<p> ... and we wanted to have \"keyboard\" meets \"mouse\" events, along with the brilliance of <a target=_blank title='Lorem Picsum' href='https:\/\/picsum.photos\/'>Lorem Picsum<\/a> regarding background image randomosity and quality, working with HTML ...<\/p>\n<p><code><br \/>\n&lt;div id=mydiv onfocus='setTimeout(alte, 1000);' onclick='stamp(this);' title='Click and type and see the cursor change as you use Alt or Shift or Control that can be reset via Caps Lock with a click copying cursor into content ... RJM Programming ... May, 2022 ... thanks to https:\/\/picsum.photos\/ Lorem Picsum' spellcheck='false' contenteditable=true style='width:100vw;height:100%;color:transparent;text-color:transparent;' data-onkeypress=xycursorlook(event); onkeydown=cursorlook(event); onmousemove=xycursorlook(event); ontouchmove=xycursorlook(event);&gt;&lt;\/div&gt;<br \/>\n<\/code><\/p>\n<p> ... in a way we hadn't tried before that called on some inhouse cursor SVG creations <font size=1>(and so is, alas, just a non-mobile fully featured experience)<\/font>, in the sense that ...<\/p>\n<ol>\n<li>keyboard helps creating the \"what\" regarding content ...<br \/>\n<code><br \/>\n&lt;script type='text\/javascript'&gt;<br \/>\n  var lastkeymodifier=''<br \/>\n  var lastcursor=\"Url(\\\"data:image\/svg+xml;utf8,&lt;svg xmlns='http:\/\/www.w3.org\/2000\/svg' width='126' height='48' viewport='0 0 100 100' style='border-radius:15px;background-color:rgba(0,255,0,0.3);fill:black;font-family:Verdana;font-size:16px;'&gt;&lt;text y='80%'&gt;Shift\/Alt\/Ctrl\\\\002753&lt;\/text&gt;&lt;\/svg&gt;\\\") 16 0, crosshair\";<br \/>\n  var pos3=-1, pos4=-1;<br \/>\n  var subdiv=1;<br \/>\n  var lastpos3=-2, lastpos4=-1;<br \/>\n  var allowable=false;<br \/>\n<br \/>\n  function cursorlook(evt) {<br \/>\n    if (evt.altKey) {<br \/>\n      if (lastkeymodifier != 'alt') {<br \/>\n        lastcursor=\"Url(\\\"data:image\/svg+xml;utf8,&lt;svg xmlns='http:\/\/www.w3.org\/2000\/svg' width='66' height='48' viewport='0 0 100 100' style='border-radius:15px;background-color:rgba(0,0,255,0.3);fill:black;font-family:Verdana;font-size:17px;'&gt;&lt;text y='80%'&gt;Alt\\\\01f3d5&lt;\/text&gt;&lt;\/svg&gt;\\\") 16 0, progress\";<br \/>\n        document.head.innerHTML+='&lt;style&gt; html {  cursor: ' + lastcursor + '; } &lt;\/style&gt;';<br \/>\n        lastkeymodifier='alt';<br \/>\n      }<br \/>\n    } else if (evt.ctrlKey) {<br \/>\n      if (lastkeymodifier != 'ctrl') {<br \/>\n        lastcursor=\"Url(\\\"data:image\/svg+xml;utf8,&lt;svg xmlns='http:\/\/www.w3.org\/2000\/svg' width='66' height='48' viewport='0 0 100 100' style='border-radius:15px;background-color:rgba(0,255,0,0.3);fill:black;font-family:Verdana;font-size:17px;'&gt;&lt;text y='80%'&gt;Ctrl\\\\01f333&lt;\/text&gt;&lt;\/svg&gt;\\\") 16 0, pointer\";<br \/>\n        document.head.innerHTML+='&lt;style&gt; html {  cursor: ' + lastcursor + '; } &lt;\/style&gt;';<br \/>\n        lastkeymodifier='ctrl';<br \/>\n      }<br \/>\n    } else if (evt.shiftKey) {<br \/>\n      if (lastkeymodifier != 'shift') {<br \/>\n        lastcursor=\"Url(\\\"data:image\/svg+xml;utf8,&lt;svg xmlns='http:\/\/www.w3.org\/2000\/svg' width='66' height='48' viewport='0 0 100 100' style='border-radius:15px;background-color:rgba(255,0,0,0.3);fill:black;font-family:Verdana;font-size:17px;'&gt;&lt;text y='80%'&gt;Shift\\\\01f389&lt;\/text&gt;&lt;\/svg&gt;\\\") 16 0, grab\";<br \/>\n        document.head.innerHTML+='&lt;style&gt; html {  cursor: ' + lastcursor + '; } &lt;\/style&gt;';<br \/>\n        lastkeymodifier='shift';<br \/>\n      }<br \/>\n    } else {<br \/>\n      if (lastkeymodifier != '') {<br \/>\n        lastcursor=\"Url(\\\"data:image\/svg+xml;utf8,&lt;svg xmlns='http:\/\/www.w3.org\/2000\/svg' width='126' height='48' viewport='0 0 100 100' style='border-radius:15px;background-color:rgba(0,255,0,0.3);fill:black;font-family:Verdana;font-size:16px;'&gt;&lt;text y='80%'&gt;Shift\/Alt\/Ctrl\\\\002753&lt;\/text&gt;&lt;\/svg&gt;\\\") 16 0, crosshair\";<br \/>\n        document.head.innerHTML+='&lt;style&gt; html {  cursor: ' + lastcursor + '; } &lt;\/style&gt;';<br \/>\n        lastkeymodifier='';<br \/>\n      }<br \/>\n    }<br \/>\n  }<br \/>\n&lt;\/script&gt;<br \/>\n<\/code>\n<\/li>\n<li>mouse <a target=_blank title='Event onmousedown information from W3schools' href='https:\/\/www.w3schools.com\/jsref\/event_onmousedown.asp'>\"onmousemove\"<\/a> or <a target=_blank title='Event ontouchdown information from W3schools' href='https:\/\/www.w3schools.com\/jsref\/event_touchmove.asp'>\"ontouchmove\"<\/a> helps with the \"where\" regarding content above ...<br \/>\n<code><br \/>\n&lt;script type='text\/javascript'&gt;<br \/>\n  var pos3=-1, pos4=-1;<br \/>\n  var subdiv=1;<br \/>\n  var lastpos3=-2, lastpos4=-1;<br \/>\n  var allowable=false;<br \/>\n<br \/>\n  function xycursorlook(e) {<br \/>\n    e = e || window.event;<br \/>\n    e.preventDefault();<br \/>\n<br \/>\n       if (e.touches) {<br \/>\n       if (e.touches[0].pageX) {<br \/>\n       pos3 = e.touches[0].pageX;<br \/>\n       pos4 = e.touches[0].pageY;<br \/>\n       } else {<br \/>\n       pos3 = e.touches[0].clientX;<br \/>\n       pos4 = e.touches[0].clientY;<br \/>\n       }<br \/>\n       \/\/console.log('pos3=' + pos3 + ',pos4=' + pos4);<br \/>\n       } else if (e.clientX || e.clientY) {<br \/>\n        pos3 = e.clientX;<br \/>\n        pos4 = e.clientY;<br \/>\n       } else {<br \/>\n        pos3 = e.pageX;<br \/>\n        pos4 = e.pageY;<br \/>\n       }<br \/>\n  }<br \/>\n&lt;\/script&gt;<br \/>\n<\/code>\n<\/li>\n<li>preparations for \"onclick\" way a cursor can be plonked into (real lasting) content ...<br \/>\n<code><br \/>\n&lt;script type='text\/javascript'&gt;<br \/>\n  var lastcursor=\"Url(\\\"data:image\/svg+xml;utf8,&lt;svg xmlns='http:\/\/www.w3.org\/2000\/svg' width='126' height='48' viewport='0 0 100 100' style='border-radius:15px;background-color:rgba(0,255,0,0.3);fill:black;font-family:Verdana;font-size:16px;'&gt;&lt;text y='80%'&gt;Shift\/Alt\/Ctrl\\\\002753&lt;\/text&gt;&lt;\/svg&gt;\\\") 16 0, crosshair\";<br \/>\n  var pos3=-1, pos4=-1;<br \/>\n  var subdiv=1;<br \/>\n  var lastpos3=-2, lastpos4=-1;<br \/>\n  var allowable=false;<br \/>\n  <br \/>\n  function stamp(divo) {<br \/>\n    if (('' + pos3).indexOf('-') == -1) {<br \/>\n    if (allowable) {<br \/>\n    \/\/if (allowed) {<br \/>\n    \/\/allowed=false;<br \/>\n    \/\/setTimeout(reseta, 2000);<br \/>\n    divo.innerHTML+='&lt;div id=div' + subdiv + ' style=\"position:absolute;top:' + pos4 + 'px;left:' + pos3 + 'px;width:126px;height:48px;background-color:transparent;\"&gt;&lt;\/div&gt;&lt;style&gt; #div' + subdiv + ' { background:' + lastcursor.split(') ')[0] + ') no-repeat; } &lt;\/style&gt;';<br \/>\n    subdiv++;<br \/>\n    \/\/console.log('lastpos4=' + lastpos4 + ' and pos4=' + pos4);<br \/>\n    \/\/console.log('lastpos3=' + lastpos3 + ' and pos3=' + pos3);<br \/>\n    lastpos3=pos3;<br \/>\n    lastpos4=pos4;<br \/>\n    \/\/}<br \/>\n    }<br \/>\n    }<br \/>\n  }<br \/>\n&lt;\/script&gt;<br \/>\n<\/code>\n<\/ol>\n<p> ... with the <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/body_mouse_deepdive.html_GETME\">\"proof of concept\" body_mouse_deepdive.html<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/body_mouse_deepdive.html\" title=\"Click picture\">live run<\/a>.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d55848' onclick='var dv=document.getElementById(\"d55848\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/onkeydown\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d55848' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d55876' onclick='var dv=document.getElementById(\"d55876\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/onkeypress\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d55876' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d55891' onclick='var dv=document.getElementById(\"d55891\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/share\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d55891' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d55897' onclick='var dv=document.getElementById(\"d55897\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/canvas\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d55897' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>You may have noticed with yesterday&#8217;s Keyboard Based Cursor Share Content Copy Tutorial, crucial to the sharing code, was the use of the incredible HTML5 introduced canvas element, helped by that middleperson link to those public email and SMS sharing &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/keyboard-based-cursor-canvas-content-copy-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,14,37],"tags":[2098,2432,155,184,2442,260,2127,342,380,2713,3727,3983,576,2658,578,652,672,673,3982,739,812,861,1705,2337,2219,2723,894,907,997,2232,1776,1133,2587,1159,1200,1226,2324,1319,1433,3010],"class_list":["post-55897","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-tutorials","tag-accountability","tag-alt","tag-body","tag-canvas","tag-contenteditable","tag-control","tag-cursor","tag-div","tag-email","tag-emojiterra","tag-fileformat","tag-getelementsbytagname","tag-html","tag-html-entity","tag-html5","tag-javascript","tag-key","tag-keyboard","tag-lorem-picsum","tag-mailto","tag-mouse","tag-onclick","tag-onkeydown","tag-onkeypress","tag-onmousemove","tag-ontouchmove","tag-overlay","tag-paste","tag-programming","tag-property","tag-screenshot","tag-share","tag-shift","tag-sms","tag-stop-press","tag-svg","tag-todataurl","tag-tutorial","tag-window-open","tag-window-opener"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/55897"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=55897"}],"version-history":[{"count":13,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/55897\/revisions"}],"predecessor-version":[{"id":55912,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/55897\/revisions\/55912"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=55897"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=55897"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=55897"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}