���ѧۧݧ�ӧ�� �ާ֧ߧ֧էا֧� - ���֧էѧܧ�ڧ��ӧѧ�� - /home3/cpr76684/moodledata/filedir/e2/e6/e2e66d4c59b7d0907305769e11e1df9c9a5e8b1d
���ѧ٧ѧ�
!function(){"use strict";let t=function(){function t(){}return t.extend=function(){for(let t=1;t<arguments.length;t++)for(let e in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],e)&&("object"==typeof arguments[0][e]&&"object"==typeof arguments[t][e]?this.extend(arguments[0][e],arguments[t][e]):arguments[0][e]=arguments[t][e]);return arguments[0]},t.htmlDecode=function(t){return(new DOMParser).parseFromString(t,"text/html").documentElement.textContent},t.revertRTL=function(e){let s=[],i=[];return e.forEach((e=>{t.containsRTLCharacters(e.solution)?i.push(e):(s=s.concat(i.reverse()),i=[],s.push(e))})),0!==i.length&&(s=s.concat(i.reverse())),s},t.splitWordAlternatives=function(t){return t.split("").reverse().join("").split(/\|(?!\\)/).map((t=>t.split("").reverse().join("").replace("\\|","|"))).reverse()},t.containsRTLCharacters=function(e){return new RegExp("^[^"+t.RTL+"]*?["+t.RTL+"]").test(e)},t.buildCombinations=function(t,e){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:" ";const i=[];return t.forEach((t=>{i.push(...e.map((e=>""===e?t:`${e}${s}${t}`)))})),i},t.formatLanguageCode=function(t){if("string"!=typeof t)return t;const e=t.split("-");return e[0]=e[0].toLowerCase(),e.length>1&&(e[1]=e[1].toUpperCase()),t=e.join("-")},t.shuffleArray=function(t){let e,s,i;for(i=t.length-1;i>0;i--)e=Math.floor(Math.random()*(i+1)),s=t[i],t[i]=t[e],t[e]=s;return t},t}();t.RTL="֑-ࣿ";var e=t;let s=function(){function t(s,i){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.params=e.extend({audioNotSupported:"Your browser does not support this audio.",a11y:{play:"Play",playSlowly:"Play slowly",triesLeft:"number of tries left: @number",infinite:"infinite",sentence:"Sentence",solution:"Solution",enterText:"Enter what you have heard"},disablePause:!1,type:t.BUTTON_TYPE_NORMAL,callbacks:{playAudio:()=>{}}},i),this.previousState=a,void 0===a.triesLeft?this.triesLeft=this.params.maxTries:null===a.triesLeft?this.triesLeft=1/0:this.triesLeft=a.triesLeft,this.dom=this.createAudioDOM(s,this.params),null===this.dom.firstChild&&this.dom.appendChild(this.getDummyButtonDOM()),this.status=t.STATUS_ENDED}var s=t.prototype;return s.createAudioDOM=function(e,s){const i=H5P.jQuery("<div>",{class:t.AUDIO_WRAPPER});if(void 0!==s.sample){const a={files:s.sample,audioNotSupported:s.audioNotSupported};this.audioInstance=new H5P.Audio(a,e,{previousState:this.previousState.audio}),this.audioInstance.playOriginal=this.audioInstance.play,this.audioInstance.play=this.playOverride.bind(this),this.audioInstance.attach(i),this.button=this.audioInstance.$audioButton.get(0),this.audio=this.audioInstance,s.type===t.BUTTON_TYPE_SLOW?(this.audioInstance.$audioButton.removeClass(t.BUTTON_PLAY).addClass(t.BUTTON_SLOW),this.setLabel(s.a11y.playSlowly)):this.setLabel(s.a11y.play),this.triesLeft<1&&this.audio.disableToggleButton(),this.previousState.audio&&0!==this.previousState.audio.currentTime&&(this.status=t.STATUS_PAUSE,this.audioInstance.$audioButton.addClass(t.BUTTON_PLAY_PAUSED)),this.audioInstance.audio.addEventListener("play",(()=>{s.disablePause&&this.audioInstance.$audioButton.get(0).classList.add("h5p-audio-disabled"),s.type===t.BUTTON_TYPE_SLOW&&this.audioInstance.$audioButton.removeClass(t.BUTTON_SLOW).addClass(t.BUTTON_PAUSE),this.status=t.STATUS_PLAYING,this.params.callbacks.playAudio(this)})),this.audioInstance.audio.addEventListener("pause",(()=>{s.type===t.BUTTON_TYPE_SLOW&&this.audioInstance.$audioButton.removeClass(t.BUTTON_PAUSE).addClass(t.BUTTON_SLOW),this.status=t.STATUS_PAUSE})),this.audioInstance.audio.addEventListener("ended",(()=>{this.handleAudioEnded()})),this.audioInstance.audio&&this.audioInstance.audio.preload&&(this.audioInstance.audio.preload="none")}return i.get(0)},s.getDOM=function(){return this.dom},s.getDummyButtonDOM=function(){const e=document.createElement("div");e.classList.add(t.BUTTON),e.classList.add(t.BUTTON_NONE);const s=document.createElement("div");return s.classList.add(t.INNER_CONTAINER),s.appendChild(e),s},s.play=function(){this.status!==t.STATUS_PLAYING&&this.button.click()},s.pause=function(){this.status===t.STATUS_PLAYING&&this.button.click()},s.stop=function(){this.status===t.STATUS_PLAYING&&(this.resetAudio(),this.handleAudioEnded())},s.handleAudioEnded=function(){this.params.disablePause&&this.audio.$audioButton.get(0).classList.remove("h5p-audio-disabled"),this.handlePlayed(),this.params.type===t.BUTTON_TYPE_SLOW?(this.audio.$audioButton.removeClass(t.BUTTON_PAUSE).addClass(t.BUTTON_SLOW),this.setLabel(this.params.a11y.playSlowly)):this.setLabel(this.params.a11y.play),this.status=t.STATUS_ENDED},s.handlePlayed=function(){this.triesLeft--,0===this.triesLeft&&this.disable()},s.setLabel=function(t){const e=isFinite(this.triesLeft)?this.triesLeft:this.params.a11y.infinite,s=this.params.a11y.triesLeft.replace(/@number/g,e);this.button&&(this.button.setAttribute("aria-label",`${t}. ${s}`),this.button.setAttribute("title",s))},s.reset=function(){this.triesLeft=this.params.maxTries,this.audio&&this.audio.seekTo(0),this.status=t.STATUS_ENDED,this.enable(),this.params.type===t.BUTTON_TYPE_SLOW?this.setLabel(this.params.a11y.playSlowly):this.setLabel(this.params.a11y.play),this.resetAudio()},s.enable=function(){this.button&&this.audio.enableToggleButton()},s.setUntabbable=function(){this.button&&this.button.setAttribute("tabindex","-1")},s.setTabbable=function(){this.button&&this.button.setAttribute("tabindex","0")},s.disable=function(){this.button&&this.audio.disableToggleButton()},s.isEnabled=function(){return!!this.button&&this.audio.isEnabled()},s.resetAudio=function(){this.audio&&this.audio.audio&&this.audio.audio.load&&this.audio.audio.load(),this.button&&(this.button.classList.remove(t.BUTTON_PAUSE),this.button.classList.remove(t.BUTTON_PLAY_PAUSED),this.params.type===t.BUTTON_TYPE_SLOW?this.button.classList.add(t.BUTTON_SLOW):this.button.classList.add(t.BUTTON_PLAY))},s.getCurrentState=function(){return{audio:this.audio?this.audio.getCurrentState():void 0,triesLeft:this.triesLeft}},s.focus=function(){this.button&&this.button.focus()},s.playOverride=function(){this.isDelayingPlay||(0!==this.params.playButtonDelay?(this.isDelayingPlay=!0,this.button.classList.add("h5p-dictation-delay-animation"),this.button.style.animationDuration=`${this.params.playButtonDelay+.01}s`,window.clearTimeout(this.playTimeout),this.playTimeout=window.setTimeout((()=>{this.audioInstance.playOriginal(),this.button.classList.remove("h5p-dictation-delay-animation"),this.button.style.animationDuration="",this.isDelayingPlay=!1}),1e3*this.params.playButtonDelay)):this.audioInstance.playOriginal())},s.isAudioPlaying=function(){return this.audio?.audio?.currentTime>0},t}();s.BUTTON_TYPE_NORMAL=0,s.BUTTON_TYPE_SLOW=1,s.STATUS_PAUSE=0,s.STATUS_PLAYING=1,s.STATUS_ENDED=2,s.AUDIO_WRAPPER="h5p-dictation-audio-wrapper",s.BUTTON="h5p-audio-minimal-button",s.BUTTON_PLAY="h5p-audio-minimal-play",s.BUTTON_PLAY_PAUSED="h5p-audio-minimal-play-paused",s.BUTTON_PAUSE="h5p-audio-minimal-pause",s.BUTTON_SLOW="h5p-audio-minimal-slow",s.BUTTON_NONE="h5p-audio-minimal-none",s.INNER_CONTAINER="h5p-audio-inner";var i=s;let a=function(){function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.params=e,this.words=document.createElement("div"),this.words.classList.add(t.SOLUTION_TEXT),this.words.setAttribute("role","list"),this.words.setAttribute("aria-label",this.params.a11y.solution),this.words.setAttribute("aria-expanded","false"),this.words.setAttribute("tabindex","0"),this.words.addEventListener("keydown",(t=>{const e=this.words.getAttribute("aria-expanded"),s=this.wordMarked||(this.params.containsRTL?this.words.lastChild:this.words.firstChild);switch(t.code){case"Enter":case"Space":if(t.target!==t.currentTarget)break;"false"===e?(this.words.setAttribute("aria-expanded","true"),s&&s.focus()):(this.words.setAttribute("aria-expanded","false"),s.setAttribute("tabindex","-1"))}})),this.solutionInner=document.createElement("div"),this.solutionInner.classList.add(t.SOLUTION_INNER),this.solutionInner.appendChild(this.words),this.container=document.createElement("div"),this.container.classList.add(t.SOLUTION_CONTAINER),this.container.classList.add(t.HIDE),this.container.appendChild(this.solutionInner)}var s=t.prototype;return s.getDOM=function(){return this.container},s.createSolution=function(t){return this.params.containsRTL&&(t.words=e.revertRTL(t.words)),t.words.map(((e,s)=>this.createSolutionWordDOM(s,e,t.words.length-1!==s)))},s.createSolutionWordDOM=function(t,s){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"first"===this.params.alternateSolution&&"match"!==s.type&&"typo"!==s.type&&(s.solution=s.solution?e.splitWordAlternatives(s.solution)[0]:"");const a=document.createElement("span");!1===this.params.customTypoDisplay&&"typo"===s.type?a.classList.add("h5p-wrapper-wrong"):a.classList.add(`h5p-wrapper-${s.type}`),i&&a.classList.add("h5p-spacer"),a.setAttribute("tabindex","-1"),a.setAttribute("role","listitem"),this.addSolutionWordListeners(a);const n=`${this.params.a11y.item} ${t+1}.`,o=this.createAriaExplanation(s),r=this.createAriaScore(s.type);return a.setAttribute("aria-label",`${n} ${o} ${r}`),this.appendExplanationTo(a,s),a},s.addSolutionWordListeners=function(t){t.addEventListener("focus",(t=>{this.wordMarked=t.target,t.target.setAttribute("tabindex","0")})),t.addEventListener("keydown",(t=>{const e=this.params.containsRTL?t.target.parentNode.lastChild:t.target.parentNode.firstChild,s=this.params.containsRTL?t.target.parentNode.firstChild:t.target.parentNode.lastChild;switch(t.keyCode){case 37:case 38:t.preventDefault(),t.target.previousSibling&&(t.target.setAttribute("tabindex","-1"),t.target.previousSibling.focus());break;case 39:case 40:t.preventDefault(),t.target.nextSibling&&(t.target.setAttribute("tabindex","-1"),t.target.nextSibling.focus());break;case 36:t.preventDefault(),t.target!==e&&(t.target.setAttribute("tabindex","-1"),e.focus());break;case 35:t.preventDefault(),t.target!==s&&(t.target.setAttribute("tabindex","-1"),s.focus())}}))},s.createAriaExplanation=function(t){const s={match:this.params.a11y.correct,wrong:this.params.a11y.wrong,typo:this.params.a11y.typo,missing:this.params.a11y.missing,added:this.params.a11y.added},i=this.makeReadable(t.answer),a="match"===t.type||"typo"===t.type?e.splitWordAlternatives(t.solution).join(` ${this.params.a11y.or} `):t.solution,n=this.makeReadable(a);let o=`${i}${""===i?"":". "}${s[t.type]}.`;return"wrong"!==t.type&&"typo"!==t.type&&"missing"!==t.type||(o+=` ${this.params.a11y.shouldHaveBeen}. ${n}.`),o},s.makeReadable=function(t){return void 0===t?"":t.replace(/\./g,this.params.a11y.period).replace(/!/g,this.params.a11y.exclamationPoint).replace(/\?/g,this.params.a11y.questionMark).replace(/,/g,this.params.a11y.comma).replace(/'/g,this.params.a11y.singleQuote).replace(/["\u201C\u201E]/g,this.params.a11y.doubleQuote).replace(/:/g,this.params.a11y.colon).replace(/;/g,this.params.a11y.semicolon).replace(/\+/g,this.params.a11y.plus).replace(/-/g,this.params.a11y.minus).replace(/\*/g,this.params.a11y.asterisk).replace(/\//g,this.params.a11y.forwardSlash)},s.createAriaScore=function(t){let e;if(this.params.zeroMistakeMode?(e=0,"match"===t?e=1:"typo"===t&&(e=1-this.params.typoFactor)):(e=-1,"match"===t?e=0:"typo"===t&&(e*=this.params.typoFactor)),0===e)e="";else{e=`${e} ${-1===e||1===e?this.params.a11y.point:this.params.a11y.points}.`}return e},s.appendExplanationTo=function(t,e){const s=new H5P.Question.ScorePoints;if("wrong"===e.type||"added"===e.type||"typo"===e.type){const s=document.createElement("span");s.classList.add(`h5p-answer-${e.type}`),s.innerHTML=e.answer,t.appendChild(s)}if("added"!==e.type){const s=document.createElement("span");s.classList.add(`h5p-solution-${e.type}`),s.innerHTML=e.solution,t.appendChild(s)}if(this.params.zeroMistakeMode){const i=s.getElement(!0);"match"===e.type&&t.appendChild(i),"typo"===e.type&&.5===this.params.typoFactor&&(i.classList.remove("h5p-question-minus-one"),i.classList.add("h5p-question-plus-one-half")),"typo"===e.type&&this.params.typoFactor<1&&t.appendChild(i)}else{const i=s.getElement(!1);"match"!==e.type&&("typo"===e.type&&.5===this.params.typoFactor&&(i.classList.remove("h5p-question-minus-one"),i.classList.add("h5p-question-minus-one-half")),("typo"!==e.type||this.params.typoFactor>0)&&t.appendChild(i))}},s.show=function(e){const s=this.createSolution(e);s.length>0&&"match"===e.words[s.length-1].type?this.words.classList.add("h5p-solution-last-correct"):this.words.classList.remove("h5p-solution-last-correct"),this.words.firstChild||s.forEach((e=>{this.words.appendChild(e),this.container.classList.remove(t.HIDE)}))},s.hide=function(){for(;this.words.firstChild;)this.words.removeChild(this.words.firstChild);this.container.classList.add(t.HIDE)},s.focus=function(){this.words.focus()},s.reset=function(){this.wordMarked=void 0,this.words.setAttribute("aria-expanded","false")},t}();a.SOLUTION_CONTAINER="h5p-solution-container",a.SOLUTION_INNER="h5p-solution-inner",a.SOLUTION_TEXT="h5p-solution-text",a.HIDE="hide";var n=a;let o=function(){function t(s,a,o){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};this.index=s,this.position=s+1,this.params=a,this.contentId=o,this.maxTries=a.tries,this.maxTriesAlternative=a.triesAlternative,this.params.sentence.description=(this.params.sentence.description||"").trim(),this.params.callbacks=e.extend({playAudio:()=>{},onInteracted:()=>{},onContextChanged:()=>{},resize:()=>{}},a.callbacks),this.solutionText=e.htmlDecode(a.sentence.text).trim(),this.solutionText=a.ignorePunctuation?t.stripPunctuation(this.solutionText):this.solutionText,this.containsRTL="auto"===this.params.overrideRTL?e.containsRTLCharacters(this.solutionText):"on"===this.params.overrideRTL,this.mistakesMax=t.addSpaces(this.solutionText,{autosplit:this.params.autosplit,wordSeparator:this.params.wordSeparator}).split(a.wordSeparator).length,this.content=document.createElement("div"),this.content.setAttribute("role","group"),this.content.setAttribute("aria-label",`${this.params.a11y.sentence} ${this.position}`),this.content.classList.add(t.CONTENT_WRAPPER);const l=document.createElement("div");l.classList.add(t.CONTENT_DESCRIPTION),l.innerHTML=this.params.sentence.description;const u=document.createElement("div");u.classList.add(t.CONTENT_INTERACTION),this.buttonPlayNormal=new i(o,{sample:a.sentence.sample,audioNotSupported:a.audioNotSupported,disablePause:a.disablePause,type:i.BUTTON_TYPE_NORMAL,maxTries:a.tries,playButtonDelay:a.playButtonDelay,a11y:a.a11y,callbacks:{playAudio:t=>{this.handleButtonClicked(t)}}},r.buttonPlayNormal),u.appendChild(this.buttonPlayNormal.getDOM()),!0===this.params.hasAlternatives&&(this.buttonPlaySlow=new i(o,{sample:a.sentence.sampleAlternative,audioNotSupported:a.audioNotSupported,disablePause:a.disablePause,type:i.BUTTON_TYPE_SLOW,maxTries:a.triesAlternative,playButtonDelay:a.playButtonDelay,a11y:a.a11y,callbacks:{playAudio:t=>{this.handleButtonClicked(t)}}},r.buttonPlaySlow),u.appendChild(this.buttonPlaySlow.getDOM())),l.classList.add(!0===this.params.hasAlternatives?t.CONTENT_DESCRIPTION_TWO_BUTTONS:t.CONTENT_DESCRIPTION_ONE_BUTTON),this.inputField=document.createElement("textarea"),this.inputField.setAttribute("rows",1),this.inputField.setAttribute("spellcheck","false"),this.inputField.setAttribute("autocorrect","off"),this.inputField.setAttribute("autocapitalize","off"),this.inputField.setAttribute("aria-label",this.params.a11y.enterText),this.inputField.addEventListener("input",(()=>{-1===this.inputField.value.indexOf("\n")&&-1===this.inputField.value.indexOf("\r")||(this.inputField.value=this.inputField.value.replace(/[\n\r]/g,"")),this.inputField.style.height="auto";const t=this.previousScrollHeight!==this.inputField.scrollHeight;this.inputField.style.height=this.inputField.scrollHeight+this.inputField.offsetHeight-this.inputField.clientHeight+"px",t&&(this.previousScrollHeight=this.inputField.scrollHeight,this.params.callbacks.resize())})),this.inputField.classList.add(t.INPUT_FIELD),r.userInput?(this.inputField.value=r.userInput,this.oldValue=this.inputField.value||""):this.oldValue="",this.inputField.addEventListener("keydown",(()=>{this.params.callbacks.onContextChanged(this.index)})),this.inputField.addEventListener("blur",(()=>{this.oldValue!==this.inputField.value&&this.params.callbacks.onInteracted(),this.oldValue=this.inputField.value})),this.solution=new n({alternateSolution:this.params.alternateSolution,zeroMistakeMode:this.params.zeroMistakeMode,customTypoDisplay:this.params.customTypoDisplay,typoFactor:this.params.typoFactor,containsRTL:this.containsRTL,a11y:{match:this.params.a11y.correct,wrong:this.params.a11y.wrong,typo:this.params.a11y.typo,missing:this.params.a11y.missing,added:this.params.a11y.added,correct:this.params.a11y.correct,point:this.params.a11y.point,points:this.params.a11y.points,item:this.params.a11y.item,solution:this.params.a11y.solution,or:this.params.a11y.or,shouldHaveBeen:this.params.a11y.shouldHaveBeen,period:this.params.a11y.period,exclamationPoint:this.params.a11y.exclamationPoint,questionMark:this.params.a11y.questionMark,comma:this.params.a11y.comma,singleQuote:this.params.a11y.singleQuote,doubleQuote:this.params.a11y.doubleQuote,colon:this.params.a11y.colon,semicolon:this.params.a11y.semicolon,plus:this.params.a11y.plus,minus:this.params.a11y.minus,asterisk:this.params.a11y.asterisk,forwardSlash:this.params.a11y.forwardSlash}}),this.inputWrapper=document.createElement("div"),this.inputWrapper.classList.add(t.INPUT_WRAPPER),this.inputWrapper.appendChild(this.inputField),this.inputWrapper.appendChild(this.solution.getDOM()),u.appendChild(this.inputWrapper),this.content.appendChild(l),this.content.appendChild(u)}var s=t.prototype;return s.getDOM=function(){return this.content},s.getUserInput=function(){return this.inputField.value},s.setPosition=function(t){this.position=t,this.content.setAttribute("aria-label",`${this.params.a11y.sentence} ${this.position}`)},s.showSolution=function(t){this.solution.show(t),this.buttonPlayNormal&&this.buttonPlayNormal.setUntabbable(),this.buttonPlaySlow&&this.buttonPlaySlow.setUntabbable()},s.hideSolution=function(){this.solution.hide(),this.buttonPlayNormal&&this.buttonPlayNormal.setTabbable(),this.buttonPlaySlow&&this.buttonPlaySlow.setTabbable()},s.getCorrectText=function(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?t.addSpaces(this.solutionText,{autosplit:this.params.autosplit,wordSeparator:this.params.wordSeparator}).split(this.params.wordSeparator):this.solutionText},s.getCurrentState=function(){return{index:this.index,userInput:this.getUserInput(),buttonPlayNormal:this.buttonPlayNormal?this.buttonPlayNormal.getCurrentState():void 0,buttonPlaySlow:this.buttonPlaySlow?this.buttonPlaySlow.getCurrentState():void 0}},s.getMaxMistakes=function(){return this.mistakesMax},s.getXAPIDescription=function(){return this.params.sentence.description?`<p>${this.params.sentence.description}</p>`:""},s.reset=function(){this.inputField.value="",this.oldValue="",this.solution.reset(),this.buttonPlayNormal&&this.buttonPlayNormal.reset(),this.buttonPlaySlow&&this.buttonPlaySlow.reset()},s.disable=function(){this.inputField.disabled=!0,this.buttonPlayNormal&&(this.buttonPlayNormal.disable(),this.buttonPlayNormal.resetAudio()),this.buttonPlaySlow&&(this.buttonPlaySlow.disable(),this.buttonPlaySlow.resetAudio())},s.enable=function(){this.inputField.disabled=!1,this.buttonPlayNormal&&this.buttonPlayNormal.enable(),this.buttonPlaySlow&&this.buttonPlaySlow.enable()},s.pauseButtons=function(t){this.buttonPlayNormal&&this.buttonPlayNormal!==t&&this.buttonPlayNormal.pause(),this.buttonPlaySlow&&this.buttonPlaySlow!==t&&this.buttonPlaySlow.pause()},s.stopButtons=function(t){this.buttonPlayNormal&&this.buttonPlayNormal!==t&&this.buttonPlayNormal.stop(),this.buttonPlaySlow&&this.buttonPlaySlow!==t&&this.buttonPlaySlow.stop()},s.handleButtonClicked=function(t){this.params.callbacks.playAudio(t),this.params.callbacks.onInteracted(),this.params.callbacks.onContextChanged(this.index)},s.focus=function(){this.buttonPlayNormal&&this.buttonPlayNormal.focus()},t.addSpaces=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(s.autosplit="boolean"!=typeof s.autosplit||s.autosplit,s.wordSeparator=s.wordSeparator||" "," "!==s.wordSeparator)return e;const i=new RegExp(`(${t.WORD}|^)(${t.PUNCTUATION.replace("'","")})( |$)`,"g"),a=new RegExp(`( |^)(${t.PUNCTUATION})(${t.WORD}|$)`,"g");return e=e.replace(i,"$1 $2 ").replace(a," $2 $3"),!0===s.autosplit&&(e=(e=(e=e.replace(new RegExp(`(${t.AUTOSPLIT})(?=${t.AUTOSPLIT})`,"g"),"$1 ")).replace(new RegExp(`(${t.AUTOSPLIT})(?=${t.WORD}|d|${t.PUNCTUATION})`,"g"),"$1 ")).replace(new RegExp(`(${t.WORD}|d|${t.PUNCTUATION})(?=${t.AUTOSPLIT})`,"g"),"$1 ")),e.trim()},t.stripPunctuation=function(e){let s=!1;"string"==typeof e&&(s=!0,e=[e]);const i=new RegExp(`^${t.PUNCTUATION}`),a=new RegExp(`${t.PUNCTUATION}$`),n=new RegExp(` ${t.PUNCTUATION}`,"g"),o=new RegExp(`${t.PUNCTUATION.replace("'","")} `,"g");return e=e.map((t=>t.replace(i,"").replace(a,"").replace(n," ").replace(o," "))),s?e.toString().replace(/[ ]{2}/g," "):e},s.computeResults=function(){const e=t.addSpaces(this.getCorrectText(),{autosplit:this.params.autosplit,wordSeparator:this.params.wordSeparator}).split(this.params.wordSeparator);let s=this.getUserInput();this.params.ignorePunctuation&&(s=t.stripPunctuation(s))," "!==this.params.wordSeparator&&(e.forEach((e=>{e.split("|").forEach((e=>{if(-1!==(e=e.trim()).indexOf(" ")){const i=e.replace(/ /g,t.SPACE_ESCAPE);s=s.replace(new RegExp(e,"g"),i)}}))})),s=s.replace(/ /g,this.params.wordSeparator),s=s.replace(new RegExp(t.SPACE_ESCAPE,"g")," "));let i=""===s.trim()?[]:t.addSpaces(s,{autosplit:this.params.autosplit,wordSeparator:this.params.wordSeparator}).split(this.params.wordSeparator).filter((t=>t.length>0));" "!==this.params.wordSeparator&&(i=i.map(((t,e)=>e===i.length-1?t:`${t} `)));const a=this.alignWords(e,i),n=this.computeScore(a),o=n.scoreTotal,r=n.words;return{score:{added:o[t.TYPE_ADDED],missing:o[t.TYPE_MISSING],typo:o[t.TYPE_TYPO],wrong:o[t.TYPE_WRONG],match:o[t.TYPE_MATCH],total:Math.min(o[t.TYPE_ADDED]+o[t.TYPE_MISSING]+o[t.TYPE_TYPO]+o[t.TYPE_WRONG],this.getMaxMistakes())},words:r}},s.computeScore=function(e){const s=[];let i=[];i[t.TYPE_ADDED]=0,i[t.TYPE_MISSING]=0,i[t.TYPE_TYPO]=0,i[t.TYPE_WRONG]=0,i[t.TYPE_MATCH]=0;for(let a=0;a<e.words1.length;a++){const n=e.words1[a],o=e.words2[a];let r="";r=void 0===n?t.TYPE_ADDED:void 0===o?t.TYPE_MISSING:o===n?t.TYPE_MATCH:H5P.TextUtilities.areSimilar(n,o)?t.TYPE_TYPO:t.TYPE_WRONG,i[r]++,s.push({solution:n,answer:o,type:r})}return{scoreTotal:i,words:s}},s.alignWords=function(t,s){const i=t=>t.words1.map(((e,s)=>e===t.words2[s]||H5P.TextUtilities.areSimilar(e,t.words2[s])||!1)),a=function(t,s){let i,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(void 0===s)return;const n=e.splitWordAlternatives(s);return a?n.forEach((e=>{H5P.TextUtilities.areSimilar(e,t)&&(i=i||e)})):n.forEach((e=>{e===t&&(i=i||e)})),i},n=(t,e)=>{e=e.map((t=>""===t?void 0:t));let s=t.map((t=>Array.apply(null,Array(e.length)).concat(t))).reduce(((t,e)=>t.concat(e)),[]);s=s.concat(Array.apply(null,Array(e.length)));const i=Array.apply(null,Array(s.length));let n=0;for(let t=0;t<e.length;t++){const o=e[t];for(let r=s.length-1;r>=n;r--){const l=a(o,s[r]),u=void 0!==o&&void 0!==l,h=-1===e.slice(t+1).indexOf(o);if(u&&h||r===n){s[r]=l,i[r]=o,n=r+1;break}}}for(let t=i.length-1;t>=0;t--){const e=i[t];if(void 0!==e&&e!==s[t]){let n,o=0,r=0;for(;t+o+1<i.length&&void 0===i[t+o+1];){const i=a(e,s[t+o+1]);void 0!==i&&(r=t+o+1,n=i),o++}i[r||t+o]=e,void 0!==n&&(s[r]=n),i[t]=void 0}}for(let t=0;t<i.length;t++){const e=i[t];if(void 0!==e&&e!==s[t]){let n,o=0,r=0;for(;t+o-1>=0&&void 0===i[t+o-1];){const i=a(e,s[t+o-1],!0);void 0!==i&&(r=t+o-1,n=i),o--}i[r||t+o]=e,void 0!==n&&(s[r]=n),i[t]=void 0}}for(let t=s.length-1;t>=0;t--)void 0===s[t]&&void 0===i[t]&&(s.splice(t,1),i.splice(t,1));for(let t=0;t<s.length-1;t++)void 0===s[t]&&void 0===i[t+1]&&(s[t]=s[t+1],s.splice(t+1,1),i.splice(t+1,1));for(let t=0;t<s.length-1;t++)if(i[t]===s[t]&&void 0===s[t+1]&&i[t]!==i[t+1]){let e=0;for(;t+e+1<s.length&&void 0===s[t+e+1];)e++;t+e+1<s.length&&-1!==i.slice(t+1,t+e+1).lastIndexOf(i[t])&&(s[t+e+1]=s[t],s[t]=void 0)}s.reverse(),i.reverse();for(let t=0;t<s.length-1;t++)if(i[t]===s[t]&&void 0===s[t+1]&&i[t]!==i[t+1]){let e=0;for(;t+e+1<s.length&&void 0===s[t+e+1];)e++;t+e+1<s.length&&-1!==i.slice(t+1,t+e+1).lastIndexOf(i[t])&&(s[t+e+1]=s[t],s[t]=void 0)}return s.reverse(),i.reverse(),{words1:s,words2:i}},o=t=>i(t).reduce(((t,e)=>t+(e?1:0)),0);let r=n(t,s);const l=n(t.reverse(),s.reverse());o(l)>o(r)&&(r={words1:l.words1.reverse(),words2:l.words2.reverse()});const u=i(r);let h=-1,d=u.length-1;do{for(h=u.lastIndexOf(!0,d);void 0===r.words1[h+1]&&void 0===r.words2[d];)r.words1.splice(h+1,1),r.words2.splice(d,1),d-=1;d=h-1}while(h>0);return r},s.focusSolution=function(){this.solution.focus()},t}();o.CONTENT_WRAPPER="h5p-sentence",o.CONTENT_DESCRIPTION="h5p-sentence-description",o.CONTENT_DESCRIPTION_ONE_BUTTON="h5p-sentence-description-one-button",o.CONTENT_DESCRIPTION_TWO_BUTTONS="h5p-sentence-description-two-buttons",o.CONTENT_INTERACTION="h5p-sentence-interaction",o.INPUT_WRAPPER="h5p-input-wrapper",o.INPUT_FIELD="h5p-text-input",o.TYPE_ADDED="added",o.TYPE_MISSING="missing",o.TYPE_WRONG="wrong",o.TYPE_MATCH="match",o.TYPE_TYPO="typo",o.AUTOSPLIT="[-ヿ一-拿挀-矿砀-賿贀-鿿]",o.PUNCTUATION="[.?!,'\";\\:\\-\\(\\)/\\+\\-\\*«»¿“-„،؟־׀׃׆ -⋯ -。〈-】!(),:;?[]﹁﹂﹏~]",o.WORD="\\w|[À-ÖØ-öø-ÿĀ-ʯ֑-ׇֽֿׁׂׅׄ-؋؍-؞ؠ-ࣿ]",o.SPACE_ESCAPE="astringthatwillneverhappen123@@";var r=o;function l(t,e){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},l(t,e)}let u=function(t){function s(s,i,a){var n;(n=t.call(this,"dictation")||this).params=e.extend({media:{},taskDescription:"Please listen carefully and write what you hear.",sentences:[],behaviour:{tries:1/0,triesAlternative:1/0,shuffleSentences:"never",playButtonDelay:0,scoring:{ignorePunctuation:!0,zeroMistakeMode:!1,typoFactor:"100"},textual:{wordSeparator:" ",overrideRTL:"auto",autosplit:!0},feedbackPresentation:{customTypoDisplay:!1,alternateSolution:"first"},enableRetry:!0,enableSolutionsButton:!0,enableCheckButton:!0,enableSolutionOnCheck:!1},l10n:{generalFeedback:"You have made @total mistake(s).",generalFeedbackZeroMistakesMode:"You have entered @total word(s) correctly and @typo word(s) with minor mistakes.",checkAnswer:"Check",tryAgain:"Retry",showSolution:"Show solution",audioNotSupported:"Your browser does not support this audio.",submitAnswer:"Submit"},a11y:{check:"Check the answers. The responses will be marked as correct, incorrect, or unanswered.",showSolution:"Show the solution. The task will be marked with its correct solution.",retry:"Retry the task. Reset all responses and start the task over again.",play:"Play",playSlowly:"Play slowly",triesLeft:"Number of tries left: @number",infinite:"infinite",enterText:"Enter what you have heard.",yourResult:"You got @score out of @total points",solution:"Solution",sentence:"Sentence",item:"Item",correct:"correct",wrong:"wrong",typo:"small mistake",missing:"missing",added:"added",shouldHaveBeen:"Should have been",or:"or",point:"point",points:"points",period:"period",exclamationPoint:"exclamation point",questionMark:"question mark",comma:"comma",singleQuote:"single quote",doubleQuote:"double quote",colon:"colon",semicolon:"semicolon",plus:"plus",minus:"minus",asterisk:"asterisk",forwardSlash:"forward slash"}},s);const o=a&&a.metadata&&a.metadata.defaultLanguage||"en";if(n.languageTag=e.formatLanguageCode(o),!s)return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(n);n.correctTotal=0,n.contentId=i,n.contentData=a||{},n.randomId=H5P.createUUID(),n.contextId=0,n.sentences=[],window.MSInputMethodContext&&document.documentMode&&n.params.sentences.forEach(((t,e)=>{t.sample&&"audio/x-wav"===t.sample[0].mime&&delete t.sample,t.sampleAlternative&&"audio/x-wav"===t.sampleAlternative[0].mime&&delete t.sampleAlternative}));const l=n.params.sentences.some((t=>void 0!==t.sampleAlternative));return n.params.behaviour.scoring.typoFactor=parseInt(n.params.behaviour.scoring.typoFactor)/100,n.params.sentences=n.params.sentences.filter((t=>void 0!==t.text&&void 0!==t.sample)),n.previousSentenceStates=[...Array(n.params.sentences.length)],n.contentData.previousState&&Array.isArray(n.contentData.previousState)&&n.contentData.previousState.forEach(((t,e)=>{n.previousSentenceStates.length>e&&(t.index=t.index??e,n.previousSentenceStates[e]=t)})),n.params.sentences=n.params.sentences.forEach(((t,e)=>{n.sentences.push(new r(e,{sentence:t,audioNotSupported:n.params.l10n.audioNotSupported,tries:n.params.behaviour.tries,triesAlternative:n.params.behaviour.triesAlternative,ignorePunctuation:n.params.behaviour.scoring.ignorePunctuation,hasAlternatives:l,a11y:n.params.a11y,customTypoDisplay:n.params.behaviour.feedbackPresentation.customTypoDisplay,zeroMistakeMode:n.params.behaviour.scoring.zeroMistakeMode,typoFactor:n.params.behaviour.scoring.typoFactor,alternateSolution:n.params.behaviour.feedbackPresentation.alternateSolution,overrideRTL:n.params.behaviour.textual.overrideRTL,autosplit:n.params.behaviour.textual.autosplit,wordSeparator:n.params.behaviour.textual.wordSeparator,disablePause:n.params.behaviour.disablePause,playButtonDelay:n.params.behaviour.playButtonDelay,callbacks:{playAudio:t=>{n.handlePlayAudio(t)},onInteracted:()=>{n.handleInteracted()},onContextChanged:t=>{n.handleContextChanged(t)},resize:()=>{n.trigger("resize")}}},n.contentId,n.previousSentenceStates.filter((t=>t?.index===e)).shift()))})),n.maxMistakes=n.sentences.map((t=>t.getMaxMistakes())).reduce(((t,e)=>t+e),0),n.mistakesCapped=n.maxMistakes,n.isAnswered=!1,n}var i,a;a=t,(i=s).prototype=Object.create(a.prototype),i.prototype.constructor=i,l(i,a);var n=s.prototype;return n.registerDomElements=function(){const t=this.params.media.type;if(t&&t.library){const e=t.library.split(" ")[0];"H5P.Image"===e?t.params.file&&this.setImage(t.params.file.path,{disableImageZooming:this.params.media.disableImageZooming,alt:t.params.alt,title:t.params.title,expandImage:t.params.expandImage,minimizeImage:t.params.minimizeImage}):"H5P.Video"===e?t.params.sources&&this.setVideo(t):"H5P.Audio"===e&&t.params.files&&this.setAudio(t)}if(this.params.taskDescription&&(this.introduction=document.createElement("div"),this.introduction.innerHTML=this.params.taskDescription,this.setIntroduction(this.introduction)),this.content=document.createElement("div"),this.content.classList.add("h5p-dictation-sentences"),this.contentData.previousState){const t=this.previousSentenceStates.reduce(((t,e,s)=>[...t,e?e?.index:s]),[]);this.reorderSentences(t)}else"never"!==this.params.behaviour.shuffleSentences&&this.shuffleSentences();this.addSentences(),this.setContent(this.content),0!==this.sentences.length&&this.addButtons()},n.addButtons=function(){this.addButton("show-solution",this.params.l10n.showSolution,(()=>{this.showSolutions(),this.hideButton("show-solution")}),!1,{"aria-label":this.params.a11y.showSolution},{}),this.addButton("check-answer",this.params.l10n.checkAnswer,(()=>{this.showEvaluation(),this.isAnswered=!0,this.triggerXAPIAnswered(),this.params.behaviour.enableRetry&&!this.isPassed()&&this.showButton("try-again")}),this.params.behaviour.enableCheckButton,{"aria-label":this.params.a11y.check},{contentData:this.contentData,textIfSubmitting:this.params.l10n.submitAnswer}),this.addButton("try-again",this.params.l10n.tryAgain,(()=>{this.resetTask(),this.sentences[0].focus()}),!1,{"aria-label":this.params.a11y.retry},{})},n.addSentences=function(){if(this.content.innerHTML="",0===this.sentences.length){const t=document.createElement("div");t.classList.add("h5p-dictation-no-content"),t.innerHTML="I really need at least one sound sample and text for it :-)",this.content.appendChild(t)}else this.sentences.forEach((t=>{this.content.appendChild(t.getDOM())}))},n.shuffleSentences=function(){this.sentences=e.shuffleArray(this.sentences),this.sentences.forEach(((t,e)=>{t.setPosition(e+1)}))},n.reorderSentences=function(t){const e=[];for(let s=0;s<t.length;s++)e.push(this.sentences[t[s]]);this.sentences=e},n.handlePlayAudio=function(t){this.sentences.forEach((e=>{this.params.behaviour.disablePause?e.stopButtons(t):e.pauseButtons(t)}))},n.handleInteracted=function(){this.triggerXAPI("interacted")},n.handleContextChanged=function(t){this.contextId=t},n.showEvaluation=function(){this.hideButton("check-answer"),this.params.behaviour.enableSolutionsButton&&!this.params.behaviour.enableSolutionOnCheck&&this.showButton("show-solution"),this.computedResults=this.sentences.map((t=>t.computeResults())),this.sentences.forEach((t=>{t.disable()}));const t=this.computedResults.map((t=>t.score)).reduce(((t,e)=>({added:t.added+e.added,missing:t.missing+e.missing,typo:t.typo+e.typo,wrong:t.wrong+e.wrong,match:t.match+e.match})),{added:0,missing:0,typo:0,wrong:0,match:0}),e=t.added+t.missing+t.wrong+t.typo*this.params.behaviour.scoring.typoFactor;let s;this.mistakesCapped=Math.min(e,this.maxMistakes),this.correctTotal=t.match+t.typo*(1-this.params.behaviour.scoring.typoFactor),s=this.params.behaviour.scoring.zeroMistakeMode?(this.params.l10n.generalFeedbackZeroMistakesMode||"").replace("@added",t.added).replace("@missing",t.missing).replace("@wrong",t.wrong).replace("@typo",t.typo).replace("@matches",t.match).replace("@total",t.match):(this.params.l10n.generalFeedback||"").replace("@added",t.added).replace("@missing",t.missing).replace("@wrong",t.wrong).replace("@typo",t.typo).replace("@matches",t.match).replace("@total",e).replace("@capped",this.mistakesCapped);const i=H5P.Question.determineOverallFeedback(this.params.overallFeedback,this.getScore()/this.getMaxScore()),a=this.params.a11y.yourResult.replace("@score",":num").replace("@total",":total");this.setFeedback(`${s} ${i}`.trim(),this.getScore(),this.getMaxScore(),a),this.params.behaviour.enableSolutionOnCheck&&this.showSolutions(),this.trigger("resize")},n.isPassed=function(){return 0===this.mistakesCapped},n.getAnswerGiven=function(){return this.isAnswered||this.sentences.some((t=>t.getUserInput().length>0))},n.getScore=function(){return this.params.behaviour.scoring.zeroMistakeMode?Math.round(this.correctTotal):Math.round(this.maxMistakes-this.mistakesCapped)},n.getMaxScore=function(){return this.maxMistakes},n.showSolutions=function(){this.sentences.forEach(((t,e)=>{t.showSolution(this.computedResults[e])})),this.sentences[0].focusSolution(),this.trigger("resize")},n.resetTask=function(){this.contentWasReset=!0,"onRetry"===this.params.behaviour.shuffleSentences&&(this.shuffleSentences(),this.addSentences()),this.sentences.forEach((t=>{t.reset(),t.enable(),t.hideSolution()})),this.removeFeedback(),this.hideButton("try-again"),this.hideButton("show-solution"),this.params.behaviour.enableCheckButton&&this.showButton("check-answer"),this.introduction?this.introduction.focus():this.sentences[0].focus(),this.mistakesCapped=this.maxMistakes,this.isAnswered=!1,this.correctTotal=0},n.getXAPIData=function(){return{statement:this.getXAPIAnswerEvent().data.statement}},n.triggerXAPIAnswered=function(){this.trigger(this.getXAPIAnswerEvent())},n.getXAPIAnswerEvent=function(){this.computedResults=this.sentences.map((t=>t.computeResults()));const t=this.createDictationXAPIEvent("answered"),e=t.getVerifiedStatementValue(["object","definition"]);if(e.extensions&&e.extensions[s.XAPI_ALTERNATIVE_EXTENSION]){const e=t.getVerifiedStatementValue(["context"]);e.extensions=e.extensions||{},e.extensions[s.XAPI_REPORTING_VERSION_EXTENSION]=s.XAPI_REPORTING_VERSION}t.setScoredResult(this.getScore(),this.getMaxScore(),this,!0,this.isPassed());const i=this.computedResults.reduce(((t,e)=>t.concat(e.words.reduce(((t,e)=>t.concat(e.answer||"")),[]))),[]).join("[,]");return t.data.statement.result.response=i,t},n.createDictationXAPIEvent=function(t){const s=this.createXAPIEventTemplate(t);return e.extend(s.getVerifiedStatementValue(["object","definition"]),this.getxAPIDefinition()),s},n.getxAPIDefinition=function(){const t=this.computedResults.reduce(((t,e,i)=>`${t}${this.sentences[i].getXAPIDescription()}<p>${e.words.map((()=>s.FILL_IN_PLACEHOLDER)).join(" ")}</p>`),""),e={name:{}};e.name[this.languageTag]=this.getTitle(),e.name["en-US"]=e.name[this.languageTag],e.description={},e.description[this.languageTag]=`${this.getDescription()}${t}`,e.description["en-US"]=e.description[this.languageTag],e.type="http://adlnet.gov/expapi/activities/cmi.interaction",e.interactionType="fill-in",e.extensions=e.extensions||{},e.extensions[s.XAPI_CASE_SENSITIVITY]=!0;const i=this.buildCorrectGapVariations();return e.extensions[s.XAPI_ALTERNATIVE_EXTENSION]=i,e.correctResponsesPattern=this.buildxAPICRP(i.slice()),e},n.buildCorrectGapVariations=function(){return this.computedResults.reduce(((t,e)=>t.concat(e.words.map((t=>t.solution?t.solution.split("|"):[])))),[])},n.buildxAPICRP=function(t){let s=[""];return t?(arguments.length>1&&void 0!==arguments[1]&&arguments[1]?(t.forEach((t=>{s=e.buildCombinations(t,s,"[,]")})),s=s.map((t=>`{case_matters=true}${t}`))):(s=t.map((t=>t[0])).join("[,]"),s=[`{case_matters=true}${s}`]),s):s},n.getCurrentState=function(){return this.getAnswerGiven()||this.isAudioPlayBackStarted()?this.sentences.map((t=>t.getCurrentState())):this.contentWasReset?{}:void 0},n.getContext=function(){return{type:"sentence",value:this.contextId+1}},n.getTitle=function(){let t;return this.contentData&&this.contentData.metadata&&(t=this.contentData.metadata.title),t=t||s.DEFAULT_DESCRIPTION,H5P.createTitle(t)},n.getDescription=function(){return this.params.taskDescription||s.DEFAULT_DESCRIPTION},n.isAudioPlayBackStarted=function(){return this.sentences?.some((t=>t.buttonPlayNormal?.isAudioPlaying()||t.buttonPlaySlow?.isAudioPlaying()))},s}(H5P.Question);u.DEFAULT_DESCRIPTION="Dictation",u.XAPI_ALTERNATIVE_EXTENSION="https://h5p.org/x-api/alternatives",u.XAPI_CASE_SENSITIVITY="https://h5p.org/x-api/case-sensitivity",u.XAPI_REPORTING_VERSION_EXTENSION="https://h5p.org/x-api/h5p-reporting-version",u.XAPI_REPORTING_VERSION="1.0.0",u.FILL_IN_PLACEHOLDER="__________";var h=u;H5P.Dictation=h}();
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | ���֧ߧ֧�ѧ�ڧ� ����ѧߧڧ��: 0 |
proxy
|
phpinfo
|
���ѧ����ۧܧ�