{"name":"Speechcards","key":"speechcards","version":"1.0.6","instructions":"Poodll Speechcards","showatto":"1","showplayers":"0","requirecss":"//cdn.jsdelivr.net/npm/glidejs@2.1.0/dist/css/glide.core.min.css","requirejs":"https://cdn.jsdelivr.net/gh/justinhunt/cloudpoodll@latest/amd/build/cloudpoodll.min.js","shim":"","defaults":"language=en-US|en-AU|ja-JP","amd":"1","body":" <div id=\"@@AUTOID@@_glide\" class=\"glide\">\n    <div class=\"glide__arrows speechcards_toprow\">\n        <button class=\"glide__arrow prev btn btn-success\" data-glide-dir=\"<\">prev</button>\n        <div id='@@AUTOID@@_whatheard' class='speechcards_whatheard'>........</div>\n        <button class=\"glide__arrow next btn btn-success\" data-glide-dir=\">\">Next</button>\n    </div>\n \n    <div class=\"glide__wrapper\"><ul id=\"@@AUTOID@@_thelist\" class=\"glide__track\"></ul></div>\n\n</div>\n\n<div id=\"@@AUTOID@@\" class=\"poodllrecorder\" data-parent=\"@@WWWROOT@@\" data-type=\"push\" data-width=\"240\" data-height=\"80\" data-id=\"@@AUTOID@@_widget\" data-media=\"audio\" data-speechevents=\"1\" data-language=\"@@language@@\" data-token=\"@@CLOUDPOODLLTOKEN@@\" ></div>\n\n<div id=\"@@AUTOID@@_bullets\" class=\"poodllspeechcards__bullets\" style=\"display: none\">","bodyend":"</div>\n\n","script":"CloudPoodll = requiredjs_speechcards;\nvar whatheard =$('#' + @@AUTOID@@ + '_whatheard');\nvar current=1;\nvar items =[];\nvar glider;\n\nfunction cleanText(text){\n  return text.toLowerCase().replace(/[^\\w\\s]|_/g, \"\").replace(/\\s+/g, \" \").trim();\n}\n\n\n$.getScript('https://cdn.jsdelivr.net/npm/glidejs@2.1.0/dist/glide.min.js').done(function(){\n\nfunction setCurrent(newcurrent){\n current=newcurrent;\n}\n\n\nvar li_template =\"<li class='glide__slide'><div class='poodllspeechcards_box'>@thetext@</div></li>\";\nvar thelist = $(\"#\" + @@AUTOID@@ + \"_thelist\");\n\n$(\"#\" + @@AUTOID@@ + \"_bullets li\").each(function( index ) {\n  items[index]= cleanText($( this ).text());\n  thelist.append(li_template.replace('@thetext@',$(this).text()))\n});\n\n\n\n glider = $(\"#\" + @@AUTOID@@ + \"_glide\").glide({\n        type: \"carousel\",\n        autoplay: false,\n        afterTransition: function(data){setCurrent(data.index);},\n        afterInit: function(data){setCurrent(data.index);},\n    }).data('glide_api');\n});\n\n//CloudPoodll.autoCreateRecorders();\nCloudPoodll.createRecorder(@@AUTOID@@);\n\nCloudPoodll.theCallback = function(message){\n   console.log(message);\n   switch(message.type){\n     case 'speech':\n       var speechtext = message.capturedspeech;\n       whatheard.text(speechtext);\n      if(cleanText(speechtext)==items[current-1]){\n         whatheard.addClass('speechcards_gotit');\n         setTimeout(function(){\n         whatheard.removeClass('speechcards_gotit');\n         whatheard.text('........');\n         glider.go('>');\n         },700);\n      };\n  }\n};\nCloudPoodll.initEvents();\n\n\n\n ","style":".poodllspeechcards_box {\n    text-align: center;\n    color: #fff;\n    width: 50%;\n    background: #868686;\n    padding: 54px 18px;\n    font-size: 2em;\n    margin-left: 15px;\n    margin-right: 15px;\n    border-radius: 6px;\n}\n.speechcards_toprow{\n   display: flex;\n   margin-left: 15px;\n   margin-bottom: 15px;\n}\n.poodllrecorder{\n  margin-left: 15px;\n}\n.speechcards_whatheard{\n width: 400px;\n border: dotted 1px;\n border-color: green;\n text-align: center;\n margin: 1px;\n}\n.speechcards_gotit{\n color: white;\n background-color: green;\n}","dataset":"","datasetvars":"","alternate":"","alternateend":""}