Linux moodl-moodle-3s8bw1nuh5yqd9-5b875fdd66-8hs4m 4.4.0-186-generic #216-Ubuntu SMP Wed Jul 1 05:34:05 UTC 2020 x86_64
Apache/2.4.41 (Ubuntu)
: 10.39.0.36 | : 10.36.0.0
Cant Read [ /etc/named.conf ]
7.4.3
www-data
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
var /
moodledata /
filedir /
2f /
1c /
[ HOME SHELL ]
Name
Size
Permission
Action
2f1c3761fd20b1378f19b193ddaf2a...
29.8
KB
-rw-rw-rw-
Delete
Unzip
Zip
${this.title}
Close
Code Editor : 2f1c3761fd20b1378f19b193ddaf2a245df2c22f
(()=>{"use strict";const t=H5P.jQuery;class s{constructor(s,e,a,r,i={}){return this.card=s,this.params=e||{},this.id=a,this.contentId=r,this.callbacks=i,this.$cardWrapper=t("<div>",{class:"h5p-dialogcards-cardwrap",role:"group",tabindex:"-1"}),"repetition"!==this.params.mode&&this.$cardWrapper.attr("aria-labelledby","h5p-dialogcards-progress-"+H5P.Dialogcards.idCounter),this.$cardHolder=t("<div>",{class:"h5p-dialogcards-cardholder"}).appendTo(this.$cardWrapper),this.createCardContent(s).appendTo(this.$cardHolder),this}createCardContent(s){const e=t("<div>",{class:"h5p-dialogcards-card-content"});this.createCardImage(s).appendTo(e);const a=t("<div>",{class:"h5p-dialogcards-card-text-wrapper"}).appendTo(e),r=t("<div>",{class:"h5p-dialogcards-card-text-inner"}).appendTo(a),i=t("<div>",{class:"h5p-dialogcards-card-text-inner-content"}).appendTo(r);this.createCardAudio(s).appendTo(i);const d=t("<div>",{class:"h5p-dialogcards-card-text"}).appendTo(i);return this.$cardTextArea=t("<div>",{class:"h5p-dialogcards-card-text-area",tabindex:"-1",html:s.text}).appendTo(d),s.text&&s.text.length||d.addClass("hide"),this.createCardFooter().appendTo(a),e}createCardImage(s){this.$image;const e=t("<div>",{class:"h5p-dialogcards-image-wrapper"});return void 0!==s.image?(this.image=s.image,this.$image=t('<img class="h5p-dialogcards-image" src="'+H5P.getPath(s.image.path,this.contentId)+'"/>'),s.imageAltText&&this.$image.attr("alt",s.imageAltText)):this.$image=t('<div class="h5p-dialogcards-image"></div>'),this.$image.appendTo(e),e}createCardAudio(s){if(this.audio,this.$audioWrapper=t("<div>",{class:"h5p-dialogcards-audio-wrapper"}),void 0!==s.audio){const t={files:s.audio,audioNotSupported:this.params.audioNotSupported};this.audio=new H5P.Audio(t,this.contentId),this.audio.attach(this.$audioWrapper),this.audio.audio&&this.audio.audio.preload&&(this.audio.audio.preload="none")}else this.$audioWrapper.addClass("hide");return this.$audioWrapper}createCardFooter(){const s=t("<div>",{class:"h5p-dialogcards-card-footer"});let e="h5p-dialogcards-button-hidden",a="-1";return"repetition"===this.params.mode&&(e="",this.params.behaviour.quickProgression&&(e="h5p-dialogcards-quick-progression",a="0")),this.$buttonTurn=H5P.JoubelUI.createButton({class:"h5p-dialogcards-turn",html:this.params.answer}).appendTo(s),this.$buttonShowSummary=H5P.JoubelUI.createButton({class:"h5p-dialogcards-show-summary h5p-dialogcards-button-gone",html:this.params.showSummary}).appendTo(s),this.$buttonIncorrect=H5P.JoubelUI.createButton({class:"h5p-dialogcards-answer-button",html:this.params.incorrectAnswer}).addClass("incorrect").addClass(e).attr("tabindex",a).appendTo(s),this.$buttonCorrect=H5P.JoubelUI.createButton({class:"h5p-dialogcards-answer-button",html:this.params.correctAnswer}).addClass("correct").addClass(e).attr("tabindex",a).appendTo(s),s}createButtonListeners(){this.$buttonIncorrect.unbind("click").click((t=>{t.target.classList.contains("h5p-dialogcards-quick-progression")&&this.callbacks.onNextCard({cardId:this.id,result:!1})})),this.$buttonTurn.unbind("click").click((()=>{this.turnCard()})),this.$buttonCorrect.unbind("click").click((t=>{t.target.classList.contains("h5p-dialogcards-quick-progression")&&this.callbacks.onNextCard({cardId:this.id,result:!0})}))}showSummaryButton(t){this.getDOM().find(".h5p-dialogcards-answer-button").addClass("h5p-dialogcards-button-hidden").attr("tabindex","-1"),this.$buttonTurn.addClass("h5p-dialogcards-button-gone"),this.$buttonShowSummary.click((()=>t())).removeClass("h5p-dialogcards-button-gone").focus()}hideSummaryButton(){"normal"!==this.params.mode&&(this.getDOM().find(".h5p-dialogcards-answer-button").removeClass("h5p-dialogcards-button-hidden").attr("tabindex","0"),this.$buttonTurn.removeClass("h5p-dialogcards-button-gone"),this.$buttonShowSummary.addClass("h5p-dialogcards-button-gone"))}turnCard(){const t=this.getDOM(),s=t.find(".h5p-dialogcards-card-content"),e=t.find(".h5p-dialogcards-cardholder").addClass("h5p-dialogcards-collapse");s.find(".joubel-tip-container").remove();const a=s.hasClass("h5p-dialogcards-turned");s.toggleClass("h5p-dialogcards-turned",!a),setTimeout((()=>{if(e.removeClass("h5p-dialogcards-collapse"),this.changeText(a?this.getText():this.getAnswer()),a?e.find(".h5p-audio-inner").removeClass("hide"):this.removeAudio(e),"repetition"===this.params.mode&&!this.params.behaviour.quickProgression){const s=t.find(".h5p-dialogcards-answer-button");!1===s.hasClass("h5p-dialogcards-quick-progression")&&s.addClass("h5p-dialogcards-quick-progression").attr("tabindex",0)}setTimeout((()=>{this.addTipToCard(s,a?"front":"back"),"function"==typeof this.callbacks.onCardTurned&&this.callbacks.onCardTurned(a)}),200),this.resizeOverflowingText(),this.$cardTextArea.focus()}),200)}changeText(t){this.$cardTextArea.html(t),this.$cardTextArea.toggleClass("hide",!t||!t.length)}setProgressText(t,s){if("repetition"!==this.params.mode)return;const e=this.params.progressText.replace("@card",t.toString()).replace("@total",s.toString());this.$cardWrapper.attr("aria-label",e)}resizeOverflowingText(){if(!this.params.behaviour.scaleTextNotCard)return;const t=this.getDOM().find(".h5p-dialogcards-card-text"),s=t.children();this.resizeTextToFitContainer(t,s)}resizeTextToFitContainer(t,e){e.css("font-size","");const a=t.get(0).getBoundingClientRect().height;let r=e.get(0).getBoundingClientRect().height;const i=parseFloat(t.css("font-size"));let d=parseFloat(e.css("font-size"));const o=this.getDOM().closest(".h5p-container"),n=parseFloat(o.css("font-size"));if(r>a){let t=!0;for(;t;){if(d-=s.SCALEINTERVAL,d<s.MINSCALE){t=!1;break}e.css("font-size",d/i+"em"),r=e.get(0).getBoundingClientRect().height,r<=a&&(t=!1)}}else{let t=!0;for(;t;){if(d+=s.SCALEINTERVAL,d>n){t=!1;break}e.css("font-size",d/i+"em"),r=e.get(0).getBoundingClientRect().height,r>=a&&(t=!1,d-=s.SCALEINTERVAL,e.css("font-size",d/i+"em"))}}}addTipToCard(t,s,e){"back"!==s&&(s="front"),void 0===e&&(e=this.id),t.find(".joubel-tip-container").remove();const a=this.card.tips;if(void 0!==a&&void 0!==a[s]){const e=a[s].trim();e.length&&t.find(".h5p-dialogcards-card-text-wrapper .h5p-dialogcards-card-text-inner").after(H5P.JoubelUI.createTip(e,{tipLabel:this.params.tipButtonLabel}))}}setCardFocus(t){if(!0===t)this.$cardTextArea.focus();else{const t=this.getDOM();t.one("transitionend",(()=>{t.focus()}))}}stopAudio(){if(!this.audio||!this.audio.audio)return;const t=this.audio.audio.duration;t>0&&t<Number.MAX_SAFE_INTEGER&&this.audio.seekTo(t),this.audio.audio.load&&setTimeout((()=>{this.audio.audio.load()}),100)}removeAudio(){this.stopAudio(),this.getDOM().find(".h5p-audio-inner").addClass("hide")}getDOM(){return this.$cardWrapper}getText(){return this.card.text}getAnswer(){return this.card.answer}getImage(){return this.$image}getImageSize(){return this.image?{width:this.image.width,height:this.image.height}:this.image}getAudio(){return this.$audioWrapper}reset(){const t=this.getDOM();t.removeClass("h5p-dialogcards-previous"),t.removeClass("h5p-dialogcards-current"),this.changeText(this.getText());const s=t.find(".h5p-dialogcards-card-content");s.removeClass("h5p-dialogcards-turned"),this.addTipToCard(s,"front",this.id),this.params.behaviour.quickProgression||t.find(".h5p-dialogcards-answer-button").removeClass("h5p-dialogcards-quick-progression"),this.hideSummaryButton()}}s.SCALEINTERVAL=.2,s.MAXSCALE=16,s.MINSCALE=4;const e=s;const a=class{constructor(t,s,e){return this.params=t,this.contentId=s,this.callbacks=e,this.cards=[],this.params.dialogs.forEach(((t,s)=>{t.id=s,this.cards.push(s)})),this}getCard(t){if(!(t<0||t>this.cards.length))return"number"==typeof this.cards[t]&&this.loadCard(t),this.cards[t]}getCardIds(){return this.cards.map(((t,s)=>s))}loadCard(t){t<0||t>this.cards.length||"number"==typeof this.cards[t]&&(this.cards[t]=new e(this.params.dialogs[t],this.params,t,this.contentId,this.callbacks))}};const r=class{constructor(t=[]){return this.cards=t.filter(((s,e)=>t.indexOf(s)>=e)),this}getCards(){return this.cards}peek(t,s=1){return s=Math.max(0,s),"top"===t&&(t=0),"bottom"===t&&(t=this.cards.length-s),t<0||t>this.cards.length-1?[]:this.cards.slice(t,t+s)}add(t,s="top"){"number"==typeof t&&(t=[t]),t.forEach((e=>{-1===this.cards.indexOf(e)&&("top"===s?s=0:"bottom"===s?s=this.cards.length:"random"===s&&(s=Math.floor(Math.random()*this.cards.length)),this.cards.splice(s,0,...t))}))}push(t){this.add(t,"top")}pull(t=1,s="top"){return t=Math.max(1,Math.min(t,this.cards.length)),"top"===s&&(s=0),"bottom"===s&&(s=-t),s=Math.max(0,Math.min(s,this.cards.length-1)),this.cards.splice(s,t)}remove(t){"number"==typeof t&&(t=[t]),t.forEach((t=>{const s=this.cards.indexOf(t);s>-1&&this.cards.splice(s,1)}))}shuffle(){for(let t=this.cards.length-1;t>0;t--){const s=Math.floor(Math.random()*(t+1));[this.cards[t],this.cards[s]]=[this.cards[s],this.cards[t]]}return this.cards}contains(t){return-1!==this.cards.indexOf(t)}length(){return this.cards.length}};const i=class{constructor(t,s,e){return this.params=t,this.cardPool=new a(t,s,e),this.reset(t.cardPiles),this}createSelection(){let t=[];if("repetition"===this.params.mode)t=this.createSelectionRepetition();else t=this.cardPool.getCardIds();return t}createPiles(t){if(t)return void(this.cardPiles=t.map((t=>new r(t.cards))));this.cardPiles=[];const s=this.cardPool.getCardIds();switch(this.params.mode){case"repetition":for(let t=0;t<this.params.behaviour.maxProficiency;t++)0===t?this.cardPiles.push(new r(s)):this.cardPiles.push(new r);break;case"normal":this.cardPiles.push(new r(s))}}updatePiles(t){return t.forEach((t=>{const s=this.find(t.cardId);if(-1===s)return;let e=!0===t.result?s+1:0;e=Math.max(0,Math.min(e,this.cardPiles.length-1)),this.cardPiles[s].remove(t.cardId),this.cardPiles[e].add(t.cardId,"bottom")})),this.getPileSizes()}createSelectionRepetition(){let t=[],s=null;for(let e=0;e<this.cardPiles.length-1;e++){const a=this.cardPiles[e].length();if(null===s&&0===a)continue;null===s&&(s=e);const r=Math.ceil(1*a/(1+e-s)),i=this.cardPiles[e].peek(0,r);t=t.concat(...i)}return t=this.shuffle(t),t}shuffle(t){const s=t.slice();for(let t=s.length-1;t>0;t--){const e=Math.floor(Math.random()*(t+1));[s[t],s[e]]=[s[e],s[t]]}return s}find(t){let s=-1;return this.cardPiles.forEach(((e,a)=>{if(-1!==s)return s;e.contains(t)&&(s=a)})),s}reset(t){this.createPiles(t)}getCard(t){return this.cardPool.getCard(t)}getSize(){return this.cardPool.getCardIds().length}getPiles(){return this.cardPiles}getPileSizes(){return this.cardPiles.map((t=>t.length()))}};const d=class{constructor(t,s){this.params=t,this.callbacks=s,this.currentCallback=s.nextRound,this.fields=[],this.container=document.createElement("div"),this.container.classList.add("h5p-dialogcards-summary-screen");const e=this.createContainerDOM(t.summary);this.fields.round=e.getElementsByClassName("h5p-dialogcards-summary-subheader")[0],this.fields["h5p-dialogcards-round-cards-right"]=this.addTableRow(e,{category:this.params.summaryCardsRight,symbol:"h5p-dialogcards-check"}),this.fields["h5p-dialogcards-round-cards-wrong"]=this.addTableRow(e,{category:this.params.summaryCardsWrong,symbol:"h5p-dialogcards-times"}),this.fields["h5p-dialogcards-round-cards-not-shown"]=this.addTableRow(e,{category:this.params.summaryCardsNotShown});const a=this.createContainerDOM(t.summaryOverallScore);this.fields["h5p-dialogcards-overall-cards-completed"]=this.addTableRow(a,{category:this.params.summaryCardsCompleted,symbol:"h5p-dialogcards-check"}),this.fields["h5p-dialogcards-overall-completed-rounds"]=this.addTableRow(a,{category:this.params.summaryCompletedRounds,symbol:""});const r=document.createElement("div");r.classList.add("h5p-dialogcards-summary-message"),this.fields.message=r;const i=H5P.JoubelUI.createButton({class:"h5p-dialogcards-buttonNextRound",title:this.params.nextRound.replace("@round",2),html:this.params.nextRound.replace("@round",2)}).click(this.currentCallback).get(0);this.fields.button=i;const d=H5P.JoubelUI.createButton({class:"h5p-dialogcards-button-restart",title:this.params.startOver,html:this.params.startOver}).get(0),o=this.createConfirmationDialog({l10n:this.params.confirmStartingOver,instance:this},(()=>{setTimeout((()=>{this.callbacks.retry()}),100)}));d.addEventListener("click",(t=>{o.show(t.target.offsetTop)})),this.fields.buttonStartOver=d;const n=document.createElement("div");return n.classList.add("h5p-dialogcards-summary-footer"),n.appendChild(d),n.appendChild(i),this.container.appendChild(e),this.container.appendChild(a),this.container.appendChild(r),this.container.appendChild(n),this.hide(),this}getDOM(){return this.container}createContainerDOM(t,s=""){const e=document.createElement("div");e.classList.add("h5p-dialogcards-summary-container");const a=document.createElement("div");a.classList.add("h5p-dialogcards-summary-header"),a.innerHTML=t,e.appendChild(a);const r=document.createElement("div");r.classList.add("h5p-dialogcards-summary-subheader"),r.innerHTML=s,e.appendChild(r);const i=document.createElement("table");return i.classList.add("h5p-dialogcards-summary-table"),e.appendChild(i),e}addTableRow(t,s){const e=t.getElementsByClassName("h5p-dialogcards-summary-table")[0],a=document.createElement("tr"),r=document.createElement("td");r.classList.add("h5p-dialogcards-summary-table-row-category"),r.innerHTML=s.category,a.appendChild(r);const i=document.createElement("td");i.classList.add("h5p-dialogcards-summary-table-row-symbol"),void 0!==s.symbol&&""!==s.symbol&&i.classList.add(s.symbol),a.appendChild(i);const d=document.createElement("td");return d.classList.add("h5p-dialogcards-summary-table-row-score"),a.appendChild(d),e.appendChild(a),d}update({done:t=!1,round:s,message:e,results:a=[]}={}){!0===t?(this.fields.buttonStartOver.classList.add("h5p-dialogcards-button-gone"),this.params.behaviour.enableRetry?(this.fields.button.classList.remove("h5p-dialogcards-button-next-round"),this.fields.button.classList.add("h5p-dialogcards-button-restart"),this.fields.button.innerHTML=this.params.retry,this.fields.button.title=this.params.retry,this.currentCallback=this.callbacks.retry):this.fields.button.classList.add("h5p-dialogcards-button-gone")):(this.fields.buttonStartOver.classList.remove("h5p-dialogcards-button-gone"),this.fields.button.classList.add("h5p-dialogcards-button-next-round"),this.fields.button.classList.remove("h5p-dialogcards-button-restart"),this.fields.button.innerHTML=this.params.nextRound,this.fields.button.title=this.params.nextRound,this.currentCallback=this.callbacks.nextRound),H5P.jQuery(this.fields.button).unbind("click").click(this.currentCallback),this.fields.round.innerHTML=this.params.round.replace("@round",s),t||void 0===s||(this.fields.button.innerHTML=this.params.nextRound.replace("@round",s+1),this.fields.button.title=this.params.nextRound.replace("@round",s+1)),t&&void 0!==e&&""!==e?(this.fields.message.classList.remove("h5p-dialogcards-gone"),this.fields.message.innerHTML=e):this.fields.message.classList.add("h5p-dialogcards-gone"),a.forEach((t=>{let s=void 0!==t.score.value?t.score.value:"";void 0!==t.score.max&&(s=`${s} <span class="h5p-dialogcards-summary-table-row-score-divider">/</span> ${t.score.max}`),this.fields[t.field].innerHTML=s}))}show(){this.container.classList.remove("h5p-dialogcards-gone"),this.fields.button.focus()}hide(){this.container.classList.add("h5p-dialogcards-gone")}createConfirmationDialog(t,s){t=t||{};var e=new H5P.ConfirmationDialog({instance:t.instance,headerText:t.l10n.header,dialogText:t.l10n.body,cancelText:t.l10n.cancelLabel,confirmText:t.l10n.confirmLabel});return e.on("confirmed",(()=>{s()})),e.appendTo(this.getContainer()),e}getContainer(){const t=H5P.jQuery('[data-content-id="'+self.contentId+'"].h5p-content'),s=t.parents(".h5p-container");let e;return e=0!==s.length?s.last():0!==t.length?t:H5P.jQuery(document.body),e.get(0)}},o=H5P.jQuery,n=H5P.JoubelUI;class h extends H5P.EventDispatcher{constructor(t,s,e){h.idCounter++,super(),this.contentId=this.id=s,this.previousState=e.previousState||{},this.contentData=e||{},this.params=o.extend({title:"",mode:"normal",description:"Sit in pairs and make up sentences where you include the expressions below.<br/>Example: I should have said yes, HOWEVER I kept my mouth shut.",next:"Next",prev:"Previous",retry:"Retry",answer:"Turn",correctAnswer:"I got it right!",incorrectAnswer:"I got it wrong",round:"Round @round",cardsLeft:"Cards left: @number",nextRound:"Proceed to round @round",startOver:"Start over",showSummary:"Next",summary:"Summary",summaryCardsRight:"Cards you got right:",summaryCardsWrong:"Cards you got wrong:",summaryCardsNotShown:"Cards in pool not shown:",summaryOverallScore:"Overall Score",summaryCardsCompleted:"Cards you have completed learning:",summaryCompletedRounds:"Completed rounds:",summaryAllDone:"Well done! You got all @cards cards correct @max times in a row each!",progressText:"Card @card of @total",cardFrontLabel:"Card front",cardBackLabel:"Card back",tipButtonLabel:"Show tip",audioNotSupported:"Your browser does not support this audio",confirmStartingOver:{header:"Start over?",body:"All progress will be lost. Are you sure you want to start over?",cancelLabel:"Cancel",confirmLabel:"Start over"},dialogs:[{text:"Horse",answer:"Hest"},{text:"Cow",answer:"Ku"}],behaviour:{enableRetry:!0,disableBackwardsNavigation:!1,scaleTextNotCard:!1,randomCards:!1,maxProficiency:5,quickProgression:!1}},t),this.cards=[],this.currentCardId=0,this.round=0,this.results=this.previousState.results||[],this.attach=t=>{this.$inner=t.addClass("h5p-dialogcards"),this.params.behaviour.scaleTextNotCard&&t.addClass("h5p-text-scaling");const s={mode:this.params.mode,dialogs:this.params.dialogs,audioNotSupported:this.params.audioNotSupported,answer:this.params.answer,showSummary:this.params.showSummary,incorrectAnswer:this.params.incorrectAnswer,correctAnswer:this.params.correctAnswer,progressText:this.params.progressText,tipButtonLabel:this.params.tipButtonLabel,behaviour:{scaleTextNotCard:this.params.behaviour.scaleTextNotCard,maxProficiency:this.params.behaviour.maxProficiency,quickProgression:this.params.behaviour.quickProgression},cardPiles:this.previousState.cardPiles};this.cardManager=new i(s,this.id,{onCardTurned:this.handleCardTurned,onNextCard:this.nextCard}),this.createDOM(0===this.round),void 0!==this.previousState.currentCardId&&(this.gotoCard(this.previousState.currentCardId),"repetition"===this.params.mode&&this.results.length===this.cardIds.length&&this.showSummary(!0)),this.updateNavigation(),this.trigger("resize")},this.createDOM=t=>{if(this.cardIds=t&&this.previousState.cardIds?this.previousState.cardIds:this.cardManager.createSelection(),this.cardPoolSize=this.cardPoolSize||this.cardManager.getSize(),!0===t){const t=o("<div>"+this.params.title+"</div>").text().trim();this.$header=o((t?'<div class="h5p-dialogcards-title"><div class="h5p-dialogcards-title-inner">'+this.params.title+"</div></div>":"")+'<div class="h5p-dialogcards-description">'+this.params.description+"</div>"),this.summaryScreen=new d(this.params,{nextRound:this.nextRound,retry:this.restartRepetition})}!0===t?this.$cardwrapperSet=this.initCards(this.cardIds):(this.$cardwrapperSet.detach(),this.$cardwrapperSet=this.initCards(this.cardIds),this.$cardSideAnnouncer.before(this.$cardwrapperSet)),this.$cardwrapperSet.prepend(this.summaryScreen.getDOM()),!0===t&&(this.$cardSideAnnouncer=o("<div>",{html:this.params.cardFrontLabel,class:"h5p-dialogcards-card-side-announcer","aria-live":"polite","aria-hidden":"true"}),this.$footer=this.createFooter(),this.$mainContent=o("<div>").append(this.$header).append(this.$cardwrapperSet).append(this.$cardSideAnnouncer).append(this.$footer).appendTo(this.$inner),this.on("reset",(function(){this.reset()})),this.on("resize",this.resize),this.round=void 0!==this.previousState.round?this.previousState.round:1)},this.createFooter=()=>{const t=o("<nav>",{class:"h5p-dialogcards-footer",role:"navigation"}),s=function(t,s){o(t).append('<span class="button-tooltip">'+s+"</span>"),o(t).find(".button-tooltip").hide().fadeIn("fast")},e=function(t){o(t).find(".button-tooltip").remove()};if("normal"===this.params.mode){const a=this;this.$prev=n.createButton({class:"h5p-dialogcards-footer-button h5p-dialogcards-prev truncated","aria-label":this.params.prev}).click((()=>{this.prevCard()})).appendTo(t),this.$prev.hover((function(t){s(a.$prev,a.params.prev)}),(function(){e(a.$prev)})),this.$next=n.createButton({class:"h5p-dialogcards-footer-button h5p-dialogcards-next truncated","aria-label":this.params.next}).click((()=>{this.nextCard()})).appendTo(t),this.$next.hover((function(t){s(a.$next,a.params.next)}),(function(){e(a.$next)})),this.$retry=n.createButton({class:"h5p-dialogcards-footer-button h5p-dialogcards-retry h5p-dialogcards-disabled",html:this.params.retry}).click((()=>{this.trigger("reset")})).appendTo(t),this.$retry.hover((function(t){s(a.$retry,a.params.retry)}),(function(){e(a.$retry)})),this.$progress=o("<div>",{id:"h5p-dialogcards-progress-"+h.idCounter,class:"h5p-dialogcards-progress","aria-live":"assertive"}).appendTo(t)}else this.$round=o("<div>",{class:"h5p-dialogcards-round"}).appendTo(t),this.$progress=o("<div>",{class:"h5p-dialogcards-cards-left","aria-live":"assertive"}).appendTo(t);return t},this.updateImageSize=()=>{let t=0;const s=this.cards[this.currentCardId].getDOM().find(".h5p-dialogcards-card-content");if(this.params.dialogs.forEach((e=>{if(!e.image)return;const a=e.image.height/e.image.width*s.get(0).getBoundingClientRect().width;a>t&&(t=a)})),t>0){let s=t/parseFloat(this.$inner.css("font-size"));s>15&&(s=15),this.cards.forEach((t=>{t.getImage().parent().css("height",s+"em")}))}},this.initCards=t=>{this.cards=[],this.currentCardId=0,this.params.behaviour.randomCards&&(t=H5P.shuffleArray(t));const s=o("<div>",{class:"h5p-dialogcards-cardwrap-set"});for(let e=0;e<t.length&&!(e>=2);e++){const a=this.getCard(t[e]);a.setProgressText(e+1,t.length),this.cards.push(a);const r=a.getDOM();e===this.currentCardId&&(r.addClass("h5p-dialogcards-current"),this.$current=r),a.addTipToCard(r.find(".h5p-dialogcards-card-content"),"front",e),s.append(r)}return s},this.handleCardTurned=t=>{this.$cardSideAnnouncer.html(t?this.params.cardFrontLabel:this.params.cardBackLabel),this.params.behaviour.enableRetry&&this.currentCardId+1===this.cardIds.length&&this.$retry&&(this.$retry.removeClass("h5p-dialogcards-disabled"),this.truncateRetryButton())},this.updateNavigation=()=>{if("normal"===this.params.mode)this.getCurrentSelectionIndex()<this.cardIds.length-1?(this.$next.removeClass("h5p-dialogcards-disabled"),this.$retry.addClass("h5p-dialogcards-disabled")):this.$next.addClass("h5p-dialogcards-disabled"),this.currentCardId>0&&!this.params.behaviour.disableBackwardsNavigation?this.$prev.removeClass("h5p-dialogcards-disabled"):this.$prev.addClass("h5p-dialogcards-disabled"),this.$progress.text(this.params.progressText.replace("@card",this.getCurrentSelectionIndex()+1).replace("@total",this.cardIds.length)),this.cards[this.findCardPosition(this.cards[this.currentCardId].id)].resizeOverflowingText();else{this.$round.text(this.params.round.replace("@round",this.round));const t=this.getCurrentSelectionIndex();this.$progress.text(this.params.cardsLeft.replace("@number",this.cardIds.length-t))}this.trigger("resize")},this.showSummary=(t=!1)=>{const s=t?this.cardManager.getPileSizes():this.cardManager.updatePiles(this.results),e=this.results.filter((t=>!0===t.result)).length,a=this.results.length-e,r=this.cardPoolSize-e-a,i=s.slice(-1)[0],d=i===this.cardPoolSize,o={round:this.round,results:[{field:"h5p-dialogcards-round-cards-right",score:{value:e,max:a+e}},{field:"h5p-dialogcards-round-cards-wrong",score:{value:a,max:a+e}},{field:"h5p-dialogcards-round-cards-not-shown",score:{value:r}},{field:"h5p-dialogcards-overall-cards-completed",score:{value:i,max:this.cardPoolSize}},{field:"h5p-dialogcards-overall-completed-rounds",score:{value:this.round}}]};d&&(o.done=!0,o.message=this.params.summaryAllDone.replace("@cards",this.cardPoolSize).replace("@max",this.params.behaviour.maxProficiency-1)),this.summaryScreen.update(o),this.summaryScreen.show(),this.hideCards(),this.trigger("resize")},this.showCards=()=>{this.$cardwrapperSet.find(".h5p-dialogcards-cardwrap").removeClass("h5p-dialogcards-gone"),this.$footer.removeClass("h5p-dialogcards-gone"),this.cardsShown=!0},this.hideCards=()=>{this.$cardwrapperSet.find(".h5p-dialogcards-cardwrap").addClass("h5p-dialogcards-gone"),this.$footer.addClass("h5p-dialogcards-gone"),this.cardsShown=!1},this.nextCard=t=>{void 0!==t&&this.results.push(t),this.cards[this.currentCardId].stopAudio(),this.cardIds.length-this.getCurrentSelectionIndex()!=1?this.gotoCard(this.getCurrentSelectionIndex()+1):"repetition"===this.params.mode&&(this.$progress.text(this.params.cardsLeft.replace("@number",0)),this.cards[this.currentCardId].showSummaryButton(this.showSummary))},this.getCard=t=>{const s=this.cardManager.getCard(t);return s.createButtonListeners(),s},this.findCardPosition=t=>{let s;return this.cards.forEach(((e,a)=>{s||e.id!==t||(s=a)})),s},this.insertCardToDOM=(t,s)=>{const e=t.getDOM();void 0===s?e.appendTo(this.$cardwrapperSet):0===s?this.$cardwrapperSet.prepend(e):this.$cardwrapperSet.children().eq(s).after(e),t.addTipToCard(e.find(".h5p-dialogcards-card-content"),"front",s)},this.gotoCard=t=>{if(t<0||t>=this.cardIds.length)return;const s=this.cards[this.currentCardId];s.stopAudio(),s.getDOM().removeClass("h5p-dialogcards-current");const e=[];t>0&&e.push(t-1),e.push(t),t+1<this.cardIds.length&&e.push(t+1),e.forEach((t=>{if(void 0===this.findCardPosition(this.cardIds[t])){const s=this.getCard(this.cardIds[t]);s.setProgressText(t+1,this.cardIds.length);const e=Math.min(t+1,this.cardIds.length-1),a=this.findCardPosition(this.cardIds[e])||this.cards.length;this.cards.splice(a,0,s),this.insertCardToDOM(s,a)}})),this.resize(),t=this.findCardPosition(this.cardIds[t]),this.cards.forEach(((s,e)=>{e<t?s.getDOM().addClass("h5p-dialogcards-previous"):(s.getDOM().removeClass("h5p-dialogcards-previous"),e===t&&s.getDOM().addClass("h5p-dialogcards-current"))})),this.currentCardId=t,this.updateNavigation(),this.cards[this.currentCardId].setCardFocus()},this.prevCard=()=>{this.gotoCard(this.getCurrentSelectionIndex()-1)},this.showAllAudio=()=>{this.$cardwrapperSet.find(".h5p-audio-inner").removeClass("hide")},this.restartRepetition=()=>{this.cardManager.reset(),this.round=0,this.nextRound()},this.nextRound=()=>{this.round++,this.summaryScreen.hide(),this.showCards(),this.reset(),this.createDOM(),this.updateNavigation(),this.cards[this.currentCardId].setCardFocus(!0),this.trigger("resize")},this.reset=()=>{this.results=[],this.cards[this.currentCardId].stopAudio(this.$current.index()),this.cards.forEach((t=>{t.reset()})),this.currentCardId=0,"normal"===this.params.mode&&this.cards[this.currentCardId].getDOM().addClass("h5p-dialogcards-current"),this.updateNavigation(),this.$retry&&this.$retry.addClass("h5p-dialogcards-disabled"),this.showAllAudio(),this.cards[this.currentCardId].resizeOverflowingText(),this.cards[this.currentCardId].setCardFocus()},this.resize=()=>{let t=0;this.updateImageSize(),this.params.behaviour.scaleTextNotCard||!1===this.cardsShown||this.determineCardSizes(),this.$cardwrapperSet.css("height","auto"),this.$cardwrapperSet.children(":not(.h5p-dialogcards-gone)").each((function(){const s=o(this).css("height","initial").outerHeight();if(o(this).css("height","inherit"),t=s>t?s:t,!o(this).next(".h5p-dialogcards-cardwrap").length){const s=o(this).find(".h5p-dialogcards-cardholder").css("height","initial").outerHeight();t=s>t?s:t,o(this).find(".h5p-dialogcards-cardholder").css("height","inherit")}}));const s=t/parseFloat(this.$cardwrapperSet.css("font-size"));this.$cardwrapperSet.css("height",s+"em"),this.scaleToFitHeight(),this.truncateRetryButton(),this.cards[this.currentCardId].resizeOverflowingText()},this.determineCardSizes=()=>{const t=this;void 0===this.cardSizeDetermined&&(this.cardSizeDetermined=[]),this.$cardwrapperSet.children(":visible").each((function(s){const e=t.cards[s].id;if(-1!==t.cardSizeDetermined.indexOf(e))return;t.cardSizeDetermined.push(e);const a=o(".h5p-dialogcards-card-content",this),r=o(".h5p-dialogcards-card-text-inner-content",a),i=r[0].getBoundingClientRect().height,d=t.cards[s];d.changeText(d.getAnswer());const n=r[0].getBoundingClientRect().height;let h=i>n?i:n;const c=parseFloat(r.parent().parent().css("minHeight"));h<c&&(h=c);h/=parseFloat(a.css("fontSize")),r.parent().css("height",h+"em"),d.changeText(d.getText())}))},this.scaleToFitHeight=()=>{if(this.$cardwrapperSet&&this.$cardwrapperSet.is(":visible")&&this.params.behaviour.scaleTextNotCard)if(this.$inner.parents(".h5p-course-presentation").length){let t=this.$inner.parent();this.$inner.parents(".h5p-popup-container").length&&(t=this.$inner.parents(".h5p-popup-container"));const s=t.get(0).getBoundingClientRect().height,e=()=>{let t=0;return this.$inner.children().each((function(){const s=o(this);t+=this.getBoundingClientRect().height+parseFloat(s.css("margin-top"))+parseFloat(s.css("margin-bottom"))})),t};let a=e();const r=parseFloat(this.$inner.parent().css("font-size"));let i=parseFloat(this.$inner.css("font-size"));if(s<a)for(;s<a&&(i-=h.SCALEINTERVAL,!(i<h.MINSCALE));)this.$inner.css("font-size",i/r+"em"),a=e();else{let t=!0;for(;t;){if(i+=h.SCALEINTERVAL,i>h.MAXSCALE){t=!1;break}let d=i/r;this.$inner.css("font-size",d+"em"),a=e(),s<=a&&(t=!1,d=(i-h.SCALEINTERVAL)/r,this.$inner.css("font-size",d+"em"))}}}else this.cards[this.currentCardId].resizeOverflowingText()},this.truncateRetryButton=()=>{if(!this.$retry)return;this.$retry.removeClass("truncated"),this.$retry.html(this.params.retry);(this.$retry.get(0).getBoundingClientRect().width+parseFloat(this.$retry.css("margin-left"))+parseFloat(this.$retry.css("margin-right")))/this.$retry.parent().get(0).getBoundingClientRect().width>.3&&(this.$retry.addClass("truncated"),this.$retry.html(""))},this.getCurrentSelectionIndex=()=>this.cardIds.indexOf(this.cards[this.currentCardId].id),this.getTitle=()=>H5P.createTitle(this.contentData&&this.contentData.metadata&&this.contentData.metadata.title?this.contentData.metadata.title:"Dialog Cards"),this.getCurrentState=()=>{if(this.cardManager)return{cardPiles:this.cardManager.getPiles(),cardIds:this.cardIds,round:this.round,currentCardId:this.getCurrentSelectionIndex(),results:this.results}}}}h.idCounter=0,h.SCALEINTERVAL=.2,h.MAXSCALE=16,h.MINSCALE=4;const c=h;H5P.Dialogcards=c})();
Close