2 lines
22 KiB
JavaScript
2 lines
22 KiB
JavaScript
"use strict";(self.webpackChunkWebComponents=self.webpackChunkWebComponents||[]).push([[349],{8152:(e,t,r)=>{r.d(t,{s:()=>i});class i{constructor(e){const t=new DOMParser;this.doc=t.parseFromString(e,"text/html");const r=this.doc.querySelector("parsererror");if(r)throw new Error("XML parse error: "+r.textContent)}getStatement(){const e=this.doc.querySelector("statement");return e?e.innerHTML.trim():""}getFeedback(){const e=this.doc.querySelector("feedback");return e?e.innerHTML.trim():""}itemsFrom(e){return Array.from(this.doc.querySelectorAll(e)).map((e=>{const t=e.querySelector("id"),r=e.querySelector("label");return{id:t?t.textContent.trim():"",label:r?r.innerHTML.trim():""}}))}correctAnswers(){throw new Error("correctAnswers() must be implemented by a subclass of QuestionXmlConverter")}toJson(){return{statement:this.getStatement(),feedback:this.getFeedback(),left:this.itemsFrom("premise"),right:this.itemsFrom("response"),correctAnswers:this.correctAnswers()}}}},83349:(e,t,r)=>{r.r(t),r.d(t,{default:()=>h});var i=r(78673),s=r(54250),a=r(8152);class o extends a.s{correctAnswers(){return Array.from(this.doc.querySelectorAll("answer")).map((e=>[e.getAttribute("premise"),e.getAttribute("response")]))}}(0,s.Hh)({en:{msg_dragndrop_correct_answer:"You are correct!",msg_dragndrop_incorrect_answer:"Incorrect. Of the cards you have sorted you placed $1 correctly and $2 incorrectly. You have $4 left to place.",msg_dragndrop_place_more:"Please place all of the cards before checking your answer. You have $1 left to place.",msg_dragndrop_check_me:"Check me",msg_dragndrop_reset:"Reset"}}),(0,s.Hh)({"pt-br":{msg_dragndrop_correct_answer:"Correto!",msg_dragndrop_incorrect_answer:"Incorreto. Você teve $1 correto(s) e $2 incorreto(s) de $3. Você deixou $4 em branco.",msg_dragndrop_place_more:"Por favor, posicione todos os cartões antes de verificar sua resposta. Você ainda tem $1 para posicionar.",msg_dragndrop_check_me:"Verificar",msg_dragndrop_reset:"Resetar"}}),(0,s.Hh)({"sr-Cyrl":{msg_dragndrop_correct_answer:"Тачан одговор!",msg_dragndrop_incorrect_answer:"Нетачно. Добили сте $1 тачних и $2 нетачних од $3. Остало вам је $4 празнина.",msg_dragndrop_place_more:"Молимо вас да поставите све картице пре провере одговора. Остало вам је још $1 за постављање.",msg_dragndrop_check_me:"Провери",msg_dragndrop_reset:"Поништи"}});class n extends i.A{constructor(e){super(e);var t=e.orig;this.origElem=t,this.divid=t.id,this.useRunestoneServices=e.useRunestoneServices,this.random=!0,"no"===this.origElem.dataset.random&&(this.random=!1),this.feedback="",this.question="",this.selectedPremise=null,this.tries=0,this.populate(),this.createNewElements(),this.caption="Drag-N-Drop",this.addCaption("runestone"),"undefined"!=typeof Prism&&Prism.highlightAllUnder(this.containerDiv)}populate(){this.responseArray=[],this.premiseArray=[];let e=document.createElement("div");e.classList.add("ptx-runestone-container"),document.body.appendChild(e),console.log("Populating DragNDrop with premises and responses");const t=this.origElem.querySelector("script");t?this.populateFromScript(t,e):this.populateFromHtml(e)}populateFromHtml(e){this.cards=this.origElem.querySelectorAll("[data-subcomponent='draggable']");for(let t of this.cards)this.makePremise(t.id,t.innerHTML,this.getCategory(t),e);this.random&&(this.premiseArray=d(this.premiseArray));for(let e of this.origElem.querySelectorAll("[data-subcomponent='dropzone']"))this.makeResponse(e.getAttribute("for").replace("drag","drop"),e.innerHTML,this.getCategory(e));this.question=this.origElem.querySelector("[data-subcomponent='question']").innerHTML;let t=this.origElem.querySelector("[data-subcomponent='feedback']");t&&(this.feedback=t.innerHTML)}populateFromScript(e,t){let r;try{r="text/xml"==e.type?new o(e.textContent).toJson():JSON.parse(e.textContent)}catch(e){return void console.error("Failed to parse dragndrop question data:",e)}this.boxData=r;let i={};for(let e of r.correctAnswers||[])i[e[0]]=e[1];for(let e of r.left||[]){let r=i[e.id]||"distractor-"+e.id;this.makePremise(e.id,e.label,r,t)}this.random&&(this.premiseArray=d(this.premiseArray));for(let e of r.right||[])this.makeResponse(e.id,e.label,e.id);this.question=r.statement||"",this.feedback=r.feedback||""}makePremise(e,t,r,i){let s=document.createElement("span");s.innerHTML=t,s.id=e,s.setAttribute("draggable","true"),s.classList.add("draggable-drag"),s.classList.add("premise"),s.tabIndex=0,s.setAttribute("role","button"),s.dataset.category=r,s.dataset.parent_id=this.divid,this.premiseArray.push(s),this.setDragListeners(s);let a=document.createElement("div");return a.classList.add("vh-dnd-error"),a.innerHTML="Incorrect drop zone for "+s.innerHTML,a.setAttribute("role","alert"),a.id=s.id+"_error",i.appendChild(a),s}makeResponse(e,t,r){let i=document.createElement("span");return i.innerHTML=t,i.id=e,i.classList.add("draggable-drop","drop-label","response"),i.tabIndex=-1,i.setAttribute("role","button"),i.dataset.category=r,i.dataset.parent_id=this.divid,this.responseArray.push(i),this.setDropListeners(i),i}getCategory(e){return e.dataset.category?e.dataset.category:e.hasAttribute("for")?e.getAttribute("for"):e.id}createNewElements(){this.containerDiv=document.createElement("div"),this.containerDiv.id=this.divid,this.containerDiv.classList.add("draggable-container"),this.containerDiv.addEventListener("keydown",(e=>{"Escape"!==e.key&&"Esc"!==e.key||!this.selectedPremise||(e.preventDefault(),this.deselectPremise({restoreFocus:!0}))})),this.statementDiv=document.createElement("div"),this.statementDiv.classList.add("cardsort-statement"),this.statementDiv.classList.add("exercise-statement");try{this.statementDiv.innerHTML=this.question}catch(e){console.error("Error setting statementDiv innerHTML:",e)}this.containerDiv.appendChild(this.statementDiv),this.dragDropWrapDiv=document.createElement("div"),this.dragDropWrapDiv.style.display="block",this.containerDiv.appendChild(this.dragDropWrapDiv),this.draggableDiv=document.createElement("div"),this.draggableDiv.classList.add("rsdraggable","dragzone"),this.addDragDivListeners(),this.dropZoneDiv=document.createElement("div"),this.dropZoneDiv.classList.add("rsdraggable"),this.dragDropWrapDiv.appendChild(this.draggableDiv),this.dragDropWrapDiv.appendChild(this.dropZoneDiv),this.createButtons(),this.checkServer("dragNdrop",!0),eBookConfig.practice_mode&&this.finishSettingUp(),this.ivp=this.isValidPremise.bind(this),this.queueMathJax(this.containerDiv)}finishSettingUp(){this.appendReplacementSpans(),this.createFeedbackDiv(),console.log("Replacing origElem with containerDiv"),this.origElem.parentNode.replaceChild(this.containerDiv,this.origElem),this.hasStoredDropzones||(this.minheight=this.draggableDiv.offsetHeight,this.queueMathJax(this.containerDiv).then((()=>{this.adjustDragDropWidths()}))),this.draggableDiv.style.minHeight=this.minheight.toString()+"px",this.dropZoneDiv.offsetHeight>this.minheight?this.dragDropWrapDiv.style.minHeight=this.dropZoneDiv.offsetHeight.toString()+"px":this.dragDropWrapDiv.style.minHeight=this.minheight.toString()+"px",this.draggableDiv.style.width=`${this.dragwidth}%`,this.dropZoneDiv.style.width=`${this.dropwidth}%`}addDragDivListeners(){this.draggableDiv.addEventListener("dragover",function(e){e.preventDefault(),this.draggableDiv.classList.contains("possibleDrop")||this.draggableDiv.classList.add("possibleDrop")}.bind(this)),this.draggableDiv.addEventListener("drop",function(e){this.isAnswered=!0,e.preventDefault(),this.setPointerDragActive(!1),this.draggableDiv.classList.contains("possibleDrop")&&this.draggableDiv.classList.remove("possibleDrop");var t=e.dataTransfer.getData("draggableID"),r=document.getElementById(t);this.draggableDiv.contains(r)||this.strangerDanger(r)||(this.draggableDiv.appendChild(r),this.adjustDragDropWidths(),this.minheight=this.draggableDiv.offsetHeight,this.dragDropWrapDiv.style.minHeight=this.minheight.toString()+"px",this.logBookEvent({event:"dragNdrop-drop",div_id:this.divid,act:`${t} -> dragzone`}))}.bind(this)),this.draggableDiv.addEventListener("dragleave",function(e){this.draggableDiv.classList.contains("possibleDrop")&&this.draggableDiv.classList.remove("possibleDrop")}.bind(this))}createButtons(){this.buttonDiv=document.createElement("div"),this.buttonDiv.classList.add("dnd-button-container"),this.submitButton=document.createElement("button"),this.submitButton.textContent=(0,s.t)("msg_dragndrop_check_me"),this.submitButton.setAttribute("class","btn btn-success drag-button"),this.submitButton.setAttribute("name","do answer"),this.submitButton.setAttribute("type","button"),this.submitButton.onclick=function(){this.checkCurrentAnswer(),this.enoughPlaced&&this.tries++,this.renderFeedback(),this.logCurrentAnswer()}.bind(this),this.resetButton=document.createElement("button"),this.resetButton.textContent=(0,s.t)("msg_dragndrop_reset"),this.resetButton.setAttribute("class","btn btn-default drag-button drag-reset"),this.resetButton.setAttribute("name","do answer"),this.resetButton.onclick=function(){this.resetDraggables()}.bind(this),this.buttonDiv.appendChild(this.submitButton),this.buttonDiv.appendChild(this.resetButton),this.containerDiv.appendChild(this.buttonDiv)}appendReplacementSpans(){if(void 0===this.answerState||0===Object.keys(this.answerState).length){this.answerState={};for(let e of this.premiseArray)this.draggableDiv.appendChild(e);for(let e of this.responseArray)this.dropZoneDiv.appendChild(e)}else{let e=[];for(let t of this.responseArray)if(this.dropZoneDiv.appendChild(t),this.answerState[t.id])for(let r of this.answerState[t.id]){e.push(r);let i=this.findPremise(r);i?t.appendChild(i):console.warn(`Premise with ID ${r} not found in premiseArray`)}for(let t of this.premiseArray)-1==e.indexOf(t.id)&&this.draggableDiv.appendChild(t)}}findPremise(e){for(let t of this.premiseArray)if(t.id==e)return t}countSavedPremises(){let e=0,t={};for(let r of this.answerState)if(r.length>0)for(let i of r)t[i]||(e++,t[i]=!0);return e}setDragListeners(e){e.setAttribute("aria-pressed","false"),e.addEventListener("dragstart",(e=>{this.deselectPremise(),this.setPointerDragActive(!0),e.dataTransfer.setData("draggableID",e.target.id)})),e.addEventListener("dragend",(()=>{this.setPointerDragActive(!1)})),e.addEventListener("dragover",(function(e){e.preventDefault()})),e.addEventListener("drop",function(e){this.isAnswered=!0,e.preventDefault(),this.setPointerDragActive(!1);var t=e.dataTransfer.getData("draggableID"),r=document.getElementById(t);r==e.target||this.strangerDanger(r)||this.draggableDiv.appendChild(r)}.bind(this)),e.addEventListener("keydown",(t=>{"Enter"===t.key||" "===t.key?(t.preventDefault(),this.selectedPremise===e?this.deselectPremise():this.selectPremise(e)):this.selectedPremise||"ArrowUp"!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),this.movePremiseFocus(e,"ArrowDown"===t.key))}))}movePremiseFocus(e,t){const r=this.premiseArray.indexOf(e),i=Math.max(0,Math.min(r+(t?1:-1),this.premiseArray.length-1));this.premiseArray[i]?.focus()}setDropListeners(e){e.addEventListener("dragover",function(e){this.isAnswered=!0,e.preventDefault(),e.target.classList.contains("possibleDrop")||e.target.classList.contains("draggable-drop")&&e.target.classList.add("possibleDrop")}.bind(this)),e.addEventListener("dragleave",function(e){this.isAnswered=!0,e.preventDefault(),e.target.classList.contains("possibleDrop")&&e.target.classList.remove("possibleDrop")}.bind(this)),e.addEventListener("drop",function(e){this.isAnswered=!0,e.preventDefault(),this.setPointerDragActive(!1),e.target.classList.contains("possibleDrop")&&e.target.classList.remove("possibleDrop");var t=e.dataTransfer.getData("draggableID"),r=document.getElementById(t);!e.target.classList.contains("draggable-drop")||this.strangerDanger(r)||this.premiseArray.includes(e.target)||(e.target.appendChild(r),this.logBookEvent({event:"dragNdrop-drop",div_id:this.divid,act:`${t} -> ${e.target.id}`})),this.queueMathJax(this.containerDiv).then((()=>{this.adjustDragDropWidths()}))}.bind(this)),e.addEventListener("keydown",(t=>{t.target===e&&this.selectedPremise&&("Enter"===t.key||" "===t.key?(t.preventDefault(),this.placeSelectedPremise(e)):"Tab"===t.key?(t.preventDefault(),this.moveResponseFocus(e,t.shiftKey)):"ArrowUp"===t.key||"ArrowDown"===t.key?(t.preventDefault(),this.moveSelectedPremiseVertically("ArrowDown"===t.key)):"ArrowLeft"===t.key?(t.preventDefault(),this.returnSelectedPremise()):"ArrowRight"===t.key&&(t.preventDefault(),this.moveSelectedPremiseRight(e)))})),e.addEventListener("focus",(()=>{this.selectedPremise&&this.selectedPremise.parentElement!==e&&this.moveSelectedPremise(e,e.id)}))}setPointerDragActive(e){this.containerDiv.classList.toggle("pointer-drag-active",e)}moveResponseFocus(e,t){const r=(this.responseArray.indexOf(e)+(t?-1:1)+this.responseArray.length)%this.responseArray.length;this.responseArray[r]?.focus()}moveSelectedPremiseVertically(e){const t=this.selectedPremise;if(!t||0===this.responseArray.length)return;const r=this.responseArray.indexOf(t.parentElement);let i;-1===r?i=e?0:this.responseArray.length-1:(i=r+(e?1:-1),i=Math.max(0,Math.min(i,this.responseArray.length-1)));const s=this.responseArray[i];s!==t.parentElement&&this.moveSelectedPremise(s,s.id),s.focus()}returnSelectedPremise(){const e=this.selectedPremise;e&&e.parentElement!==this.draggableDiv&&this.moveSelectedPremise(this.draggableDiv,"dragzone")}moveSelectedPremiseRight(e){const t=this.selectedPremise;t&&t.parentElement===this.draggableDiv&&this.moveSelectedPremise(e,e.id)}moveSelectedPremise(e,t){const r=this.selectedPremise;r&&r.parentElement!==e&&(e.appendChild(r),this.isAnswered=!0,this.logBookEvent({event:"dragNdrop-drop",div_id:this.divid,act:`${r.id} -> ${t}`}),this.queueMathJax(this.containerDiv).then((()=>{this.adjustDragDropWidths()})))}placeSelectedPremise(e){const t=this.selectedPremise;t&&!this.strangerDanger(t)&&(this.moveSelectedPremise(e,e.id),this.deselectPremise(),t.focus())}selectPremise(e){this.deselectPremise(),this.selectedPremise=e,e.classList.add("selected"),e.setAttribute("aria-pressed","true"),this.updateKeyboardNavigation();const t=this.responseArray.includes(e.parentElement)?e.parentElement:this.responseArray[0];t?.focus()}deselectPremise({restoreFocus:e=!1}={}){const t=this.selectedPremise;t&&(t.classList.remove("selected"),t.setAttribute("aria-pressed","false"),this.selectedPremise=null,this.updateKeyboardNavigation(),e&&t.focus())}updateKeyboardNavigation(){const e=this.selectedPremise?-1:0,t=this.selectedPremise?0:-1;for(const t of this.premiseArray)t.tabIndex=e;for(const e of this.responseArray)e.tabIndex=t}adjustDragDropWidths(){this.draggableDiv.style.width="fit-content";const e=this.draggableDiv.offsetWidth,t=this.dragDropWrapDiv.offsetWidth;let r=Math.ceil(e/t*100);r=Math.max(28,Math.min(r,48));const i=100-r-4;this.dragwidth=r,this.dropwidth=i,this.draggableDiv.style.width=`${r}%`,this.dropZoneDiv.style.width=`${i}%`}createFeedbackDiv(){this.feedBackDiv||(this.feedBackDiv=document.createElement("div"),this.feedBackDiv.id=this.divid+"_feedback",this.feedBackDiv.classList.add("exercise-content"),this.feedBackDiv.setAttribute("aria-live","polite"),this.feedBackDiv.setAttribute("role","status"),this.containerDiv.appendChild(this.feedBackDiv))}strangerDanger(e){return e.dataset.parent_id!=this.divid}resetDraggables(){this.deselectPremise(),this.dropZoneDiv.innerHTML="";for(let e of this.responseArray)e.classList.remove("drop-incorrect"),this.dropZoneDiv.appendChild(e);this.draggableDiv.innerHTML="",this.random&&(this.premiseArray=d(this.premiseArray));for(let e of this.premiseArray)e.classList.remove("drop-incorrect"),e.setAttribute("aria-invalid","false"),e.removeAttribute("aria-errormessage"),this.draggableDiv.appendChild(e);this.answerState={},this.tries=0,this.feedBackDiv.style.display="none",this.adjustDragDropWidths(),this.minheight=this.draggableDiv.offsetHeight,this.dragDropWrapDiv.style.minHeight=this.minheight.toString()+"px",this.feedBackDiv.style.visibility="hidden",this.logBookEvent({event:"dragNdrop-reset",div_id:this.divid,act:"reset"}),this.setLocalStorage({correct:"F"})}getAllCategories(){this.categories=[];for(let e of this.dropZoneDiv.childNodes)this.categories.push(e.dataset.category);return this.categories}checkCurrentAnswer(){let e=this.getAllCategories();this.correct=!0,this.unansweredNum=0,this.incorrectNum=0,this.correctNum=0,this.placedNum=0,this.dragNum=this.premiseArray.length;let t=0;for(let e of this.dropZoneDiv.childNodes)for(let t of Array.from(e.childNodes).filter(this.ivp))this.placedNum++,t.dataset.category==e.dataset.category?this.correctNum++:this.incorrectNum++;for(let r of this.premiseArray)-1==e.indexOf(r.dataset.category)&&t++;for(let t of Array.from(this.draggableDiv.childNodes).filter((e=>e.nodeType!==Node.TEXT_NODE)))-1==e.indexOf(t.dataset.category)?this.correctNum++:this.unansweredNum++;this.requiredPlacements=this.premiseArray.length-t,this.enoughPlaced=this.placedNum>=this.requiredPlacements,this.percent=this.correctNum/this.premiseArray.length,console.log(this.percent,this.incorrectNum,this.unansweredNum),this.percent<1&&(this.correct=!1),this.setLocalStorage({correct:this.correct?"T":"F"})}isCorrectDrop(e){let t=!0,r=0;for(let i of Array.from(e.childNodes).filter(this.ivp))i.dataset.category!=e.dataset.category?t=!1:r++;let i=0;for(let t of this.premiseArray)t.dataset.category==e.dataset.category&&i++;return t&&r==i}isValidPremise(e){return!!this.premiseArray.includes(e)}async logCurrentAnswer(e){let t=JSON.stringify(this.answerState),r={event:"dragNdrop",act:t,answer:t,min_height:Math.round(this.minheight),drag_width:this.dragwidth,drop_width:this.dropwidth,div_id:this.divid,correct:this.correct,correctNum:this.correctNum,dragNum:this.dragNum};void 0!==e&&(r.sid=e),await this.logBookEvent(r)}clearIncorrectHighlights(){for(let e of this.dropZoneDiv.childNodes)for(let t of Array.from(e.childNodes).filter(this.ivp))t.classList.remove("drop-incorrect"),t.setAttribute("aria-invalid","false"),t.removeAttribute("aria-errormessage")}renderFeedback(){if(this.feedBackDiv||this.createFeedbackDiv(),this.feedBackDiv.style.display="",this.feedBackDiv.style.visibility="visible",!this.enoughPlaced){this.clearIncorrectHighlights();let t=this.requiredPlacements-this.placedNum;var e=(0,s.t)("msg_dragndrop_place_more",t);return setTimeout((()=>{this.feedBackDiv.innerHTML=`<div class="para">${e}</div>`}),10),this.feedBackDiv.className="alert alert-warning draggable-feedback exercise-content",void this.queueMathJax(this.feedBackDiv)}let t=this.tries>=3;for(let e of this.dropZoneDiv.childNodes)for(let r of Array.from(e.childNodes).filter(this.ivp))t&&r.dataset.category!=e.dataset.category?(r.classList.add("drop-incorrect"),r.setAttribute("aria-invalid","true"),r.setAttribute("aria-errormessage",r.id+"_error"),document.getElementById(r.id+"_error").classList.remove("vh-dnd-error")):(r.classList.remove("drop-incorrect"),r.setAttribute("aria-invalid","false"),r.removeAttribute("aria-errormessage"));if(this.correct){var r=(0,s.t)("msg_dragndrop_correct_answer");setTimeout((()=>{this.feedBackDiv.innerHTML=r}),10),this.feedBackDiv.className="alert alert-info draggable-feedback exercise-content"}else{var i=(0,s.t)("msg_dragndrop_incorrect_answer",this.correctNum,this.incorrectNum,this.dragNum,this.unansweredNum);setTimeout((()=>{this.feedBackDiv.innerHTML=`<div class="para">${i}</div> ${this.feedback}`}),10),this.feedBackDiv.className="alert alert-danger draggable-feedback exercise-content"}this.queueMathJax(this.feedBackDiv)}restoreAnswers(e){this.hasStoredDropzones=!0,this.minheight=e.min_height,this.dragwidth=e.drag_width,this.dropwidth=e.drop_width,this.answerState=JSON.parse(e.answer),this.correct=e.correct,this.finishSettingUp()}checkLocalStorage(){if(this.graderactive)this.finishSettingUp();else{var e;if(this.hasStoredDropzones=!1,localStorage.length>0){var t=localStorage.getItem(this.localStorageKey());if(null!==t){this.hasStoredDropzones=!0;let r=!1;try{e=JSON.parse(t),this.minheight=e.min_height,this.dragwidth=e.drag_width,this.dropwidth=e.drop_width}catch(e){console.log(`Error parsing stored DragNDrop data for ${this.divid}: ${e}`),r=!0}if(r||e.timestamp<eBookConfig.termStartDate)return localStorage.removeItem(this.localStorageKey()),this.hasStoredDropzones=!1,void this.finishSettingUp();if(localStorage.removeItem(this.localStorageKey()),this.answerState=e.answer,this.useRunestoneServices){let t=JSON.stringify(this.answerState);this.logBookEvent({event:"dragNdrop",act:t,answer:t,min_height:Math.round(this.minheight),drag_width:this.dragwidth,drop_width:this.dropwidth,div_id:this.divid,correct:e.correct})}}}this.finishSettingUp()}}setLocalStorage(e){if(void 0===e.answer){this.answerState={};for(let e of this.dropZoneDiv.childNodes){this.answerState[e.id]=[];for(let t of e.childNodes)t.nodeType!==Node.TEXT_NODE&&this.premiseArray.includes(t)&&this.answerState[e.id].push(t.id)}}var t=new Date,r=e.correct,i={answer:this.answerState,min_height:this.minheight,timestamp:t,correct:r,drag_width:this.dragwidth,drop_width:this.dropwidth};localStorage.setItem(this.localStorageKey(),JSON.stringify(i))}disableInteraction(){this.resetButton.style.display="none";for(var e=0;e<this.premiseArray.length;e++)this.premiseArray[e].draggable=!1,this.premiseArray[e].style.cursor="initial"}}function d(e){for(let t=e.length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1));[e[t],e[r]]=[e[r],e[t]]}return e}document.addEventListener("runestone:login-complete",(function(){document.querySelectorAll("[data-component=dragndrop]").forEach((e=>{const t={orig:e,useRunestoneServices:eBookConfig.useRunestoneServices};if(!e.closest("[data-component=timedAssessment]"))try{window.componentMap[e.id]=new n(t)}catch(t){console.log(`Error rendering DragNDrop Problem ${e.id}: ${t}`)}}))}));class h extends n{constructor(e){super(e),this.finishSettingUp(),this.renderTimedIcon(this.containerDiv),this.hideButtons()}hideButtons(){this.submitButton.style.display="none"}renderTimedIcon(e){var t=document.createElement("div"),r=document.createElement("img");r.src="../_static/clock.png",r.style.width="15px",r.style.height="15px",t.className="timeTip",t.title="",t.appendChild(r),e.insertBefore(t,e.firstChild)}checkCorrectTimed(){switch(this.unansweredNum===this.premiseArray.length&&(this.correct=null),this.correct){case!0:return"T";case!1:return"F";default:return null}}hideFeedback(){this.feedBackDiv.style.display="none"}}void 0===window.component_factory&&(window.component_factory={}),window.component_factory.dragndrop=function(e){return e.timed?new h(e):new n(e)}}}]);
|
|
//# sourceMappingURL=349.229775734b8c2564.js.map
|