-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added new placeholders, improved QR templates and tweaked animations
- Loading branch information
iShineGuy
authored and
iShineGuy
committed
Feb 12, 2018
1 parent
5d939d0
commit d965800
Showing
11 changed files
with
17 additions
and
11 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"name":"QR Text Reader","key":"qrtextreader","version":"1.0.0","instructions":"Reads text encoded in QR codes aloud\n","showatto":"1","showplayers":"0","requirecss":"","requirejs":"/filter/poodll/amd/src/poodll_qrscanner.js","shim":"","defaults":"width=320,height=240","amd":"1","body":"<div style=\"width: @@width@@px\"><button type=\"button\" id=\"@@AUTOID@@_button\" style=\"margin: auto;\"><i class=\"fa fa-qrcode\"></i></button>\n</div>\n<video id=\"@@AUTOID@@\" width=\"@@width@@px\" height=\"@@height@@px\" class=\"hide\" playsinline></video>\n<audio id=\"@@AUTOID@@_player\" src=\"\"></audio>\n</div>","bodyend":"","script":"var qrs= requiredjs_qrtextreader;\nvar poodllfilelib = M.cfg.wwwroot + '/filter/poodll/poodllfilelib.php?datatype=speaktext¶mone=';\nvar thecam=$('#' + @@AUTOID@@);\nvar thebutton=$('#' + @@AUTOID@@ + '_button');\nvar theplayer=$('#' + @@AUTOID@@ + '_player');\n\nthebutton.click(function(){\n var pp = theplayer[0].play();\nif (pp !== undefined) {\n pp.then(function() {\n console.log('playing');\n }).catch(function(error) {\n console.log('error');\n });\n}\n qrs.startWebCam('' + @@AUTOID@@);\n qrs.setCallback(function(data){\n console.log(data);\n var src = poodllfilelib+encodeURI(data);\n theplayer.attr('src',src);\n var pp = theplayer[0].play();\n if (pp !== undefined) {\n pp.then(function() {\n console.log('playing');\n }).catch(function(error) {\n console.log('error');\n });\n}\n qrs.startScan('' + @@AUTOID@@);\n});\n\n qrs.startScan('' + @@AUTOID@@);\n thecam.show();\n});\n\n ","style":"","dataset":"","datasetvars":"","alternate":"","alternateend":""} | ||
{"name":"QR Text Reader","key":"qrtextreader","version":"1.0.1","instructions":"Reads text encoded in QR codes aloud\n","showatto":"1","showplayers":"0","requirecss":"","requirejs":"/filter/poodll/amd/src/poodll_qrscanner.js","shim":"","defaults":"width=320,height=240","amd":"1","body":"<div style=\"width: @@width@@px\"><button type=\"button\" id=\"@@AUTOID@@_button\" style=\"margin: auto;\"><i class=\"fa fa-qrcode\"></i></button>\n</div>\n<video id=\"@@AUTOID@@\" width=\"@@width@@px\" height=\"@@height@@px\" class=\"hide\" playsinline></video>\n<audio id=\"@@AUTOID@@_player\" src=\"\"></audio>\n</div>","bodyend":"","script":"var qrs= requiredjs_qrtextreader;\nvar poodllfilelib = M.cfg.wwwroot + '/filter/poodll/poodllfilelib.php?datatype=speaktext¶mone=';\nvar thecam=$('#' + @@AUTOID@@);\nvar thebutton=$('#' + @@AUTOID@@ + '_button');\nvar theplayer=$('#' + @@AUTOID@@ + '_player');\n\n//This flag is so we dont scan while playing\nvar suspendScan=false;\n\n//when the player stops we recommence scan\n$(theplayer).bind('ended',function(){suspendScan=false; qrs.startScan('' + @@AUTOID@@);});\n\n\nthebutton.click(function(){\n theplayer[0].setAttribute('src',M.cfg.wwwroot + '/filter/poodll/ding.mp3');\n\n//we play a ding to warm up the touch device audio player\n var pp = theplayer[0].play();\nif (pp !== undefined) {\n pp.then(function() {\n console.log('playing');\n }).catch(function(error) {\n //do nothing . This is just so we trigger something for touch devices\n });\n}\n\n//we start the webcam\n qrs.startWebCam('' + @@AUTOID@@);\n\n//we tell what to do when a scan happened\n qrs.setCallback(function(data){\n \n //The logic here: https://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript\n // bytes->utf8 = unescape(encodeURIComponent(data));\n // utf-8->bytes = decodeURIComponent(escape(data))\n //we encode utf8 for qrcode writing but after reading we we need encode right away to send as url\n //so we simply escape the data read from qrcode. make sense? \n //console.log(decodeURIComponent(escape(data)));\n var src = poodllfilelib+ escape(data);\n\n //we do not continue if we are already processing a previous scan\n if(suspendScan){return;}\n\n //we set data to player and play\n theplayer.attr('src',src);\n var pp = theplayer[0].play();\n suspendScan=true;\n if (pp !== undefined) {\n pp.then(function() {\n console.log('playing');\n }).catch(function(error) {\n console.log(error);\n suspendScan=false;\n });\n }//end of if PP\n\n //TO DO: I think we could delete this line\n qrs.startScan('' + @@AUTOID@@);\n\n});//end of callback\n\n qrs.startScan('' + @@AUTOID@@);\n thecam.show();\n}); //end of button click\n\n ","style":"","dataset":"","datasetvars":"","alternate":"","alternateend":""} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"name":"QR Voice Maker","key":"qrvoicemaker","version":"1.0.2","instructions":"Enter the text to be read between the qrvoicemaker tags after they are inserted on the page.","showatto":"1","showplayers":"0","requirecss":"","requirejs":"https://cdnjs.cloudflare.com/ajax/libs/qrcode-generator/1.3.1/qrcode.min.js","shim":"","defaults":"format=\"text|ssml\",voice=\"Mizuki|Takumi|Nicole|Russell|Maxim|Tatyana|Miguel|Penelope\",size=6","amd":"1","body":"<div id=\"@@AUTOID@@\">","bodyend":"</div>","script":"//this writes the data as UTF8 bytes for non ascii. We decode in qr text reader\nqrcode.stringToBytes = qrcode.stringToBytesFuncs['UTF-8'];\n\nvar usetext = $('#' + @@AUTOID@@).text();\nconsole.log(usetext);\nvar typeNumber = 0; //the higher the number ... the more data\nvar errorCorrectionLevel = 'L';\nvar qr = qrcode(typeNumber, errorCorrectionLevel);\nqr.addData(@@format@@ + '|' + @@voice@@ + '|' + usetext);\nqr.make();\ndocument.getElementById(@@AUTOID@@).innerHTML = qr.createImgTag(@@size@@,8);","style":"","dataset":"","datasetvars":"","alternate":"","alternateend":""} |