{"name":"Speechcards","key":"speechcards","version":"1.0.8","instructions":"Poodll Speechcards","showatto":"1","showplayers":"0","requirecss":"//cdn.jsdelivr.net/npm/@glidejs/glide@3.6.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\" data-glide-el=\"controls\">\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\">\n       <div class=\"glide__track\" data-glide-el=\"track\">\n            <ul id=\"@@AUTOID@@_thelist\" class=\"glide__slides\"></ul>\n        </div>\n     </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\nfunction setCurrent(newcurrent){\n current=newcurrent;\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\nrequire(['https://cdn.jsdelivr.net/npm/@glidejs/glide@3.6.0/dist/glide.min.js'], function(Glide) {\n    const glideElement = document.querySelector(\"#\" + @@AUTOID@@ + \"_glide\");\n    glider = new Glide(glideElement,{\n        type: \"carousel\",\n        autoplay: false,\n    });\n\n    // 2. Attach the \"After Init\" (mount.after) event\n    glider.on('mount.after', function() {\n        setCurrent(glider.index);\n    });\n\n    // 3. Attach the \"After Transition\" (run.after) event\n    glider.on('run.after', function() {\n        setCurrent(glider.index);\n    });\n\n    // 4. Now mount it\n    glider.mount();\n\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]){\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":""}