{"name":" Text Reader","key":"textreader","version":"1.0.0","instructions":"Reads text aloud\n","showatto":"1","showplayers":"0","requirecss":"","requirejs":"","shim":"","defaults":"","amd":"1","body":"<textarea id=\"@@AUTOID@@_textarea\"></textarea>\n<button type=\"button\" id=\"@@AUTOID@@_button\" style=\"margin: auto;\"><i class=\"fa fa-qrcode\"></i></button>\n<audio id=\"@@AUTOID@@_player\" src=\"\"></audio>","bodyend":"","script":"var poodllfilelib = M.cfg.wwwroot + '/filter/poodll/poodllfilelib.php?datatype=speaktext&paramone=';\nvar thebutton=$('#' + @@AUTOID@@ + '_button');\nvar theplayer=$('#' + @@AUTOID@@ + '_player');\n\nthebutton.click(function(){\n\n    var textarea = $('#' + @@AUTOID@@ + '_textarea');\n\n    var usetext = textarea.val();\n    usetext = usetext.replace(/</gi, \"PPPP\");\n    usetext = usetext.replace(/>/gi, \"dddd\");\n     var src = poodllfilelib+encodeURIComponent(usetext);\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}//end of if pp \n\n});\n\n ","style":"","dataset":"","datasetvars":"","alternate":"","alternateend":""}