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8H,QAAU,OAEtC,CACA,qBAAA+E,GACI,IAAIC,EAAe3V,KAAK2K,WACpBiL,EAAiB5V,KAAK4K,aACtBiL,EAAe7V,KAAK6K,WACxB8K,EAAeA,EAAavR,QAAQ,KAAM,IAAI0R,MAAM,KACpDF,EAAiBA,EAAexR,QAAQ,KAAM,IAAI0R,MAAM,KACxDD,EAAeA,EAAazR,QAAQ,KAAM,IAAI0R,MAAM,KACpDpV,GAAE,WACE,IAAIqV,EAAerV,EAAE,yBACjBqV,EAAahG,SAAS,aACtBgG,EAAalT,YAAY,YAE7B,IAAK,IAAI4I,EAAI,EAAGA,EAAIkK,EAAalQ,OAAQgG,IAC1B5B,SAAS8L,EAAalK,IACjCsK,EACKC,GAAGnM,SAAS8L,EAAalK,IAAM,GAC/BhK,SAAS,gBAElB,IAAK,IAAIuO,EAAI,EAAGA,EAAI4F,EAAenQ,OAAQuK,IACvC+F,EACKC,GAAGnM,SAAS+L,EAAe5F,IAAM,GACjCvO,SAAS,kBAElB,IAAK,IAAIwU,EAAI,EAAGA,EAAIJ,EAAapQ,OAAQwQ,IACrCF,EACKC,GAAGnM,SAASgM,EAAaI,IAAM,GAC/BxU,SAAS,eAEtB,GACJ,EAMJf,EAAEa,UAAU0G,GAAG,4BAA4B,WACvCvH,EAAE,oCAAoCwH,MAAK,SAAUgO,GACjDrO,OAAOO,aAAapI,KAAKK,IAAM,IAAIiJ,EAAM,CACrCvJ,KAAMC,KACNC,qBAAsBC,YAAYD,sBAE1C,GACJ,G","sources":["webpack://WebComponents/./runestone/shortanswer/js/shortanswer.js","webpack://WebComponents/./runestone/shortanswer/js/timed_shortanswer.js","webpack://WebComponents/./runestone/timed/js/timed.js"],"sourcesContent":["/*==========================================\n======= Master shortanswer.js ========\n============================================\n=== This file contains the JS for ===\n=== the Runestone shortanswer component. ===\n============================================\n=== Created by ===\n=== Isaiah Mayerchak ===\n=== 7/2/15 ===\n=== Brad Miller ===\n=== 2019 ===\n==========================================*/\n\nimport RunestoneBase from \"../../common/js/runestonebase.js\";\nimport \"./../css/shortanswer.css\";\n\nexport default class ShortAnswer extends RunestoneBase {\n constructor(opts) {\n super(opts);\n if (opts) {\n var orig = opts.orig; // entire
element that will be replaced by new HTML\n this.useRunestoneServices =\n opts.useRunestoneServices || eBookConfig.useRunestoneServices;\n this.origElem = orig;\n this.divid = orig.id;\n this.question = this.origElem.innerHTML;\n this.optional = false;\n this.attachURL = opts.attachURL;\n if ($(this.origElem).is(\"[data-optional]\")) {\n this.optional = true;\n }\n if ($(this.origElem).is(\"[data-mathjax]\")) {\n this.mathjax = true;\n }\n if ($(this.origElem).is(\"[data-attachment]\")) {\n this.attachment = true;\n }\n this.placeholder =\n $(this.origElem).data(\"placeholder\") ||\n \"Write your answer here\";\n this.renderHTML();\n this.caption = \"shortanswer\";\n this.addCaption(\"runestone\");\n this.checkServer(\"shortanswer\", true);\n if (typeof Prism !== \"undefined\") {\n Prism.highlightAllUnder(this.containerDiv);\n }\n }\n }\n\n renderHTML() {\n this.containerDiv = document.createElement(\"div\");\n this.containerDiv.id = this.divid;\n $(this.containerDiv).addClass(this.origElem.getAttribute(\"class\"));\n this.newForm = document.createElement(\"form\");\n this.newForm.id = this.divid + \"_journal\";\n this.newForm.name = this.newForm.id;\n this.newForm.action = \"\";\n this.containerDiv.appendChild(this.newForm);\n this.fieldSet = document.createElement(\"fieldset\");\n this.newForm.appendChild(this.fieldSet);\n this.firstLegendDiv = document.createElement(\"div\");\n this.firstLegendDiv.innerHTML = this.question;\n $(this.firstLegendDiv).addClass(\"journal-question\");\n this.fieldSet.appendChild(this.firstLegendDiv);\n this.jInputDiv = document.createElement(\"div\");\n this.jInputDiv.id = this.divid + \"_journal_input\";\n this.fieldSet.appendChild(this.jInputDiv);\n this.jOptionsDiv = document.createElement(\"div\");\n $(this.jOptionsDiv).addClass(\"journal-options\");\n this.jInputDiv.appendChild(this.jOptionsDiv);\n this.jLabel = document.createElement(\"label\");\n $(this.jLabel).addClass(\"radio-inline\");\n this.jOptionsDiv.appendChild(this.jLabel);\n this.jTextArea = document.createElement(\"textarea\");\n let self = this;\n this.jTextArea.onchange = function() {\n self.isAnswered = true;\n };\n this.jTextArea.id = this.divid + \"_solution\";\n $(this.jTextArea).attr(\"aria-label\", \"textarea\");\n this.jTextArea.placeholder = this.placeholder;\n $(this.jTextArea).css(\"display:inline, width:530px\");\n $(this.jTextArea).addClass(\"form-control\");\n this.jTextArea.rows = 4;\n this.jTextArea.cols = 50;\n this.jLabel.appendChild(this.jTextArea);\n this.jTextArea.onchange = function() {\n this.feedbackDiv.innerHTML = \"Your answer has not been saved yet!\";\n $(this.feedbackDiv).removeClass(\"alert-success\");\n $(this.feedbackDiv).addClass(\"alert alert-danger\");\n }.bind(this);\n this.fieldSet.appendChild(document.createElement(\"br\"));\n if (this.mathjax) {\n this.renderedAnswer = document.createElement(\"div\");\n $(this.renderedAnswer).addClass(\"latexoutput\");\n this.fieldSet.appendChild(this.renderedAnswer);\n }\n this.buttonDiv = document.createElement(\"div\");\n this.fieldSet.appendChild(this.buttonDiv);\n this.submitButton = document.createElement(\"button\");\n $(this.submitButton).addClass(\"btn btn-success\");\n this.submitButton.type = \"button\";\n this.submitButton.textContent = \"Save\";\n this.submitButton.onclick = function() {\n this.checkCurrentAnswer();\n this.logCurrentAnswer();\n this.renderFeedback();\n }.bind(this);\n this.buttonDiv.appendChild(this.submitButton);\n this.randomSpan = document.createElement(\"span\");\n this.randomSpan.innerHTML = \"Instructor's Feedback\";\n this.fieldSet.appendChild(this.randomSpan);\n this.otherOptionsDiv = document.createElement(\"div\");\n $(this.otherOptionsDiv).css(\"padding-left:20px\");\n $(this.otherOptionsDiv).addClass(\"journal-options\");\n this.fieldSet.appendChild(this.otherOptionsDiv);\n // add a feedback div to give user feedback\n this.feedbackDiv = document.createElement(\"div\");\n //$(this.feedbackDiv).addClass(\"bg-info form-control\");\n //$(this.feedbackDiv).css(\"width:530px, background-color:#eee, font-style:italic\");\n $(this.feedbackDiv).css(\"width:530px, font-style:italic\");\n this.feedbackDiv.id = this.divid + \"_feedback\";\n this.feedbackDiv.innerHTML = \"You have not answered this question yet.\";\n $(this.feedbackDiv).addClass(\"alert alert-danger\");\n //this.otherOptionsDiv.appendChild(this.feedbackDiv);\n this.fieldSet.appendChild(this.feedbackDiv);\n if (this.attachment) {\n let attachDiv = document.createElement(\"div\")\n if (this.graderactive ) {\n // If in grading mode make a button to create a popup with the image\n let viewButton = document.createElement(\"button\")\n viewButton.type = \"button\"\n viewButton.innerHTML = \"View Attachment\"\n viewButton.onclick = this.viewFile.bind(this);\n attachDiv.appendChild(viewButton);\n } else {\n // Otherwise make a button for the student to select a file to upload.\n this.fileUpload = document.createElement(\"input\")\n this.fileUpload.type = \"file\";\n this.fileUpload.id = `${this.divid}_fileme`;\n attachDiv.appendChild(this.fileUpload);\n }\n this.containerDiv.appendChild(attachDiv);\n }\n //this.fieldSet.appendChild(document.createElement(\"br\"));\n $(this.origElem).replaceWith(this.containerDiv);\n // This is a stopgap measure for when MathJax is not loaded at all. There is another\n // more difficult case that when MathJax is loaded asynchronously we will get here\n // before MathJax is loaded. In that case we will need to implement something\n // like `the solution described here \n \n \n `);\n } else {\n alert(\"No attachment for this student.\")\n }\n }\n}\n\n/*=================================\n== Find the custom HTML tags and ==\n== execute our code on them ==\n=================================*/\n$(document).on(\"runestone:login-complete\", function() {\n $(\"[data-component=shortanswer]\").each(function() {\n if ($(this).closest(\"[data-component=timedAssessment]\").length == 0) {\n // If this element exists within a timed component, don't render it here\n try {\n window.componentMap[this.id] = new ShortAnswer({\n orig: this,\n useRunestoneServices: eBookConfig.useRunestoneServices,\n });\n } catch (err) {\n console.log(`Error rendering ShortAnswer Problem ${this.id}\n Details: ${err}`);\n }\n }\n });\n});\n","import ShortAnswer from \"./shortanswer.js\";\n\nexport default class TimedShortAnswer extends ShortAnswer {\n constructor(opts) {\n super(opts);\n this.renderTimedIcon(this.containerDiv);\n this.hideButtons();\n }\n hideButtons() {\n $(this.submitButton).hide();\n }\n renderTimedIcon(component) {\n // renders the clock icon on timed components. The component parameter\n // is the element that the icon should be appended to.\n var timeIconDiv = document.createElement(\"div\");\n var timeIcon = document.createElement(\"img\");\n $(timeIcon).attr({\n src: \"../_static/clock.png\",\n style: \"width:15px;height:15px\",\n });\n timeIconDiv.className = \"timeTip\";\n timeIconDiv.title = \"\";\n timeIconDiv.appendChild(timeIcon);\n $(component).prepend(timeIconDiv);\n }\n checkCorrectTimed() {\n return \"I\"; // we ignore this in the grading\n }\n hideFeedback() {\n $(this.feedbackDiv).hide();\n }\n}\n\nif (typeof window.component_factory === \"undefined\") {\n window.component_factory = {};\n}\n\nwindow.component_factory.shortanswer = function (opts) {\n if (opts.timed) {\n return new TimedShortAnswer(opts);\n }\n return new ShortAnswer(opts);\n};\n","/*==========================================\n======== Master timed.js =========\n============================================\n=== This file contains the JS for ===\n=== the Runestone timed component. ===\n============================================\n=== Created By ===\n=== Kirby Olson ===\n=== 6/11/15 ===\n==========================================*/\n\"use strict\";\n\nimport RunestoneBase from \"../../common/js/runestonebase.js\";\nimport TimedFITB from \"../../fitb/js/timedfitb.js\";\nimport TimedMC from \"../../mchoice/js/timedmc.js\";\nimport TimedShortAnswer from \"../../shortanswer/js/timed_shortanswer.js\";\nimport ACFactory from \"../../activecode/js/acfactory.js\";\nimport TimedClickableArea from \"../../clickableArea/js/timedclickable\";\nimport TimedDragNDrop from \"../../dragndrop/js/timeddnd.js\";\nimport TimedParsons from \"../../parsons/js/timedparsons.js\";\nimport SelectOne from \"../../selectquestion/js/selectone\";\nimport \"../css/timed.less\";\n\n// Timed constructor\nexport default class Timed extends RunestoneBase {\n constructor(opts) {\n super(opts);\n var orig = opts.orig;\n this.origElem = orig; // the entire element of this timed assessment and all of its children\n this.divid = orig.id;\n this.children = this.origElem.childNodes;\n this.visited = [];\n this.timeLimit = 0;\n this.limitedTime = false;\n if (!isNaN($(this.origElem).data(\"time\"))) {\n this.timeLimit = parseInt($(this.origElem).data(\"time\"), 10) * 60; // time in seconds to complete the exam\n this.startingTime = this.timeLimit;\n this.limitedTime = true;\n }\n this.showFeedback = true;\n if ($(this.origElem).is(\"[data-no-feedback]\")) {\n this.showFeedback = false;\n }\n this.showResults = true;\n if ($(this.origElem).is(\"[data-no-result]\")) {\n this.showResults = false;\n }\n this.random = false;\n if ($(this.origElem).is(\"[data-random]\")) {\n this.random = true;\n }\n this.showTimer = true;\n if ($(this.origElem).is(\"[data-no-timer]\")) {\n this.showTimer = false;\n }\n this.fullwidth = false;\n if ($(this.origElem).is(\"[data-fullwidth]\")) {\n this.fullwidth = true;\n }\n this.nopause = false;\n if ($(this.origElem).is(\"[data-no-pause]\")) {\n this.nopause = true;\n }\n eBookConfig.enableScratchAC = false;\n this.running = 0;\n this.paused = 0;\n this.done = 0;\n this.taken = 0;\n this.score = 0;\n this.incorrect = 0;\n this.correctStr = \"\";\n this.incorrectStr = \"\";\n this.skippedStr = \"\";\n this.skipped = 0;\n this.currentQuestionIndex = 0; // Which question is currently displaying on the page\n this.renderedQuestionArray = []; // list of all problems\n this.getNewChildren();\n // One small step to eliminate students from doing view source\n // this won't stop anyone with determination but may prevent casual peeking\n if (!eBookConfig.enableDebug) {\n document.body.oncontextmenu = function () {\n return false;\n };\n }\n this.checkAssessmentStatus().then(\n function () {\n this.renderTimedAssess();\n }.bind(this)\n );\n }\n\n getNewChildren() {\n this.newChildren = [];\n let runestoneChildren = this.origElem.querySelectorAll(\".runestone\");\n for (var i = 0; i < runestoneChildren.length; i++) {\n this.newChildren.push(runestoneChildren[i]);\n }\n }\n\n async checkAssessmentStatus() {\n // Has the user taken this exam? Inquiring minds want to know\n // If a user has not taken this exam then we want to make sure\n // that if a question has been seen by the student before we do\n // not populate previous answers.\n let sendInfo = {\n div_id: this.divid,\n course_name: eBookConfig.course,\n };\n console.log(sendInfo);\n if (eBookConfig.useRunestoneServices) {\n let request = new Request(\n `${eBookConfig.new_server_prefix}/assessment/tookTimedAssessment`,\n {\n method: \"POST\",\n headers: this.jsonHeaders,\n body: JSON.stringify(sendInfo),\n }\n );\n let response = await fetch(request);\n let data = await response.json();\n data = data.detail;\n this.taken = data.tookAssessment;\n this.assessmentTaken = this.taken;\n if (!this.taken) {\n localStorage.clear();\n }\n console.log(\"done with check status\");\n return response;\n } else {\n this.taken = false;\n this.assessmentTaken = false;\n return Promise.resolve();\n }\n }\n\n /*===============================\n === Generating new Timed HTML ===\n ===============================*/\n async renderTimedAssess() {\n console.log(\"rendering timed \");\n // create renderedQuestionArray returns a promise\n //\n this.createRenderedQuestionArray();\n if (this.random) {\n this.randomizeRQA();\n }\n this.renderContainer();\n this.renderTimer();\n await this.renderControlButtons();\n this.containerDiv.appendChild(this.timedDiv); // This can't be appended in renderContainer because then it renders above the timer and control buttons.\n if (this.renderedQuestionArray.length > 1) this.renderNavControls();\n this.renderSubmitButton();\n this.renderFeedbackContainer();\n this.useRunestoneServices = eBookConfig.useRunestoneServices;\n // Replace intermediate HTML with rendered HTML\n $(this.origElem).replaceWith(this.containerDiv);\n // check if already taken and if so show results\n this.styleExamElements(); // rename to renderPossibleResults\n this.checkServer(\"timedExam\", true);\n }\n\n renderContainer() {\n this.containerDiv = document.createElement(\"div\"); // container for the entire Timed Component\n if (this.fullwidth) {\n // allow the container to fill the width - barb\n $(this.containerDiv).attr({\n style: \"max-width:none\",\n });\n }\n this.containerDiv.classList.add(\"runestone-sphinx\");\n this.containerDiv.id = this.divid;\n this.timedDiv = document.createElement(\"div\"); // div that will hold the questions for the timed assessment\n this.navDiv = document.createElement(\"div\"); // For navigation control\n $(this.navDiv).attr({\n style: \"text-align:center\",\n });\n this.flagDiv = document.createElement(\"div\"); // div that will hold the \"Flag Question\" button\n $(this.flagDiv).attr({\n style: \"text-align: center\",\n });\n this.switchContainer = document.createElement(\"div\");\n this.switchContainer.classList.add(\"switchcontainer\");\n this.switchDiv = document.createElement(\"div\"); // is replaced by the questions\n this.timedDiv.appendChild(this.navDiv);\n this.timedDiv.appendChild(this.flagDiv); // add flagDiv to timedDiv, which holds components for navigation and questions for timed assessment\n this.timedDiv.appendChild(this.switchContainer);\n this.switchContainer.appendChild(this.switchDiv);\n $(this.timedDiv).attr({\n id: \"timed_Test\",\n style: \"display:none\",\n });\n }\n\n renderTimer() {\n this.wrapperDiv = document.createElement(\"div\");\n this.timerContainer = document.createElement(\"P\");\n this.wrapperDiv.id = this.divid + \"-startWrapper\";\n this.timerContainer.id = this.divid + \"-output\";\n this.wrapperDiv.appendChild(this.timerContainer);\n this.showTime();\n }\n\n renderControlButtons() {\n this.controlDiv = document.createElement(\"div\");\n $(this.controlDiv).attr({\n id: \"controls\",\n style: \"text-align: center\",\n });\n this.startBtn = document.createElement(\"button\");\n this.pauseBtn = document.createElement(\"button\");\n $(this.startBtn).attr({\n class: \"btn btn-success\",\n id: \"start\",\n tabindex: \"0\",\n role: \"button\",\n });\n this.startBtn.textContent = \"Start\";\n this.startBtn.addEventListener(\n \"click\",\n async function () {\n $(this.finishButton).hide(); // hide the finish button for now\n $(this.flagButton).show();\n let mess = document.createElement(\"p\");\n mess.innerHTML =\n \"Warning: You will not be able to continue the exam if you close this tab, close the window, or navigate away from this page! Make sure you click the Finish Exam button when you are done to submit your work!\";\n this.controlDiv.appendChild(mess);\n mess.classList.add(\"examwarning\");\n await this.renderTimedQuestion();\n this.startAssessment();\n }.bind(this),\n false\n );\n $(this.pauseBtn).attr({\n class: \"btn btn-default\",\n id: \"pause\",\n disabled: \"true\",\n tabindex: \"0\",\n role: \"button\",\n });\n this.pauseBtn.textContent = \"Pause\";\n this.pauseBtn.addEventListener(\n \"click\",\n function () {\n this.pauseAssessment();\n }.bind(this),\n false\n );\n if (!this.taken) {\n this.controlDiv.appendChild(this.startBtn);\n }\n if (!this.nopause) {\n this.controlDiv.appendChild(this.pauseBtn);\n }\n this.containerDiv.appendChild(this.wrapperDiv);\n this.containerDiv.appendChild(this.controlDiv);\n }\n\n renderNavControls() {\n // making \"Prev\" button\n this.pagNavList = document.createElement(\"ul\");\n $(this.pagNavList).addClass(\"pagination\");\n this.leftContainer = document.createElement(\"li\");\n this.leftNavButton = document.createElement(\"button\");\n this.leftNavButton.innerHTML = \"‹ Prev\";\n $(this.leftNavButton).attr(\"aria-label\", \"Previous\");\n $(this.leftNavButton).attr(\"tabindex\", \"0\");\n $(this.leftNavButton).attr(\"role\", \"button\");\n $(this.rightNavButton).attr(\"id\", \"prev\");\n $(this.leftNavButton).css(\"cursor\", \"pointer\");\n this.leftContainer.appendChild(this.leftNavButton);\n this.pagNavList.appendChild(this.leftContainer);\n // making \"Flag Question\" button\n this.flaggingPlace = document.createElement(\"ul\");\n $(this.flaggingPlace).addClass(\"pagination\");\n this.flagContainer = document.createElement(\"li\");\n this.flagButton = document.createElement(\"button\");\n $(this.flagButton).addClass(\"flagBtn\");\n this.flagButton.innerHTML = \"Flag Question\"; // name on button\n $(this.flagButton).attr(\"aria-labelledby\", \"Flag\");\n $(this.flagButton).attr(\"tabindex\", \"5\");\n $(this.flagButton).attr(\"role\", \"button\");\n $(this.flagButton).attr(\"id\", \"flag\");\n $(this.flagButton).css(\"cursor\", \"pointer\");\n this.flagContainer.appendChild(this.flagButton); // adding button to container\n this.flaggingPlace.appendChild(this.flagContainer); // adding container to flaggingPlace\n // making \"Next\" button\n this.rightContainer = document.createElement(\"li\");\n this.rightNavButton = document.createElement(\"button\");\n $(this.rightNavButton).attr(\"aria-label\", \"Next\");\n $(this.rightNavButton).attr(\"tabindex\", \"0\");\n $(this.rightNavButton).attr(\"role\", \"button\");\n $(this.rightNavButton).attr(\"id\", \"next\");\n this.rightNavButton.innerHTML = \"Next ›\";\n $(this.rightNavButton).css(\"cursor\", \"pointer\");\n this.rightContainer.appendChild(this.rightNavButton);\n this.pagNavList.appendChild(this.rightContainer);\n this.ensureButtonSafety();\n this.navDiv.appendChild(this.pagNavList);\n this.flagDiv.appendChild(this.flaggingPlace); // adds flaggingPlace to the flagDiv\n this.break = document.createElement(\"br\");\n this.navDiv.appendChild(this.break);\n // render the question number jump buttons\n this.qNumList = document.createElement(\"ul\");\n $(this.qNumList).attr(\"id\", \"pageNums\");\n this.qNumWrapperList = document.createElement(\"ul\");\n $(this.qNumWrapperList).addClass(\"pagination\");\n var tmpLi, tmpA;\n for (var i = 0; i < this.renderedQuestionArray.length; i++) {\n tmpLi = document.createElement(\"li\");\n tmpA = document.createElement(\"a\");\n tmpA.innerHTML = i + 1;\n $(tmpA).css(\"cursor\", \"pointer\");\n if (i === 0) {\n $(tmpLi).addClass(\"active\");\n }\n tmpLi.appendChild(tmpA);\n this.qNumWrapperList.appendChild(tmpLi);\n }\n this.qNumList.appendChild(this.qNumWrapperList);\n this.navDiv.appendChild(this.qNumList);\n this.navBtnListeners();\n this.flagBtnListener(); // listens for click on flag button\n $(this.flagButton).hide();\n }\n\n // when moving off of a question in an active exam:\n // 1. show that the question has been seen, or mark it broken if it is in error.\n // 2. check and log the current answer\n async navigateAway() {\n if (\n this.renderedQuestionArray[this.currentQuestionIndex].state ==\n \"broken_exam\"\n ) {\n $(\n \"ul#pageNums > ul > li:eq(\" + this.currentQuestionIndex + \")\"\n ).addClass(\"broken\");\n }\n if (\n this.renderedQuestionArray[this.currentQuestionIndex].state ==\n \"exam_ended\"\n ) {\n $(\n \"ul#pageNums > ul > li:eq(\" + this.currentQuestionIndex + \")\"\n ).addClass(\"toolate\");\n }\n if (\n this.renderedQuestionArray[this.currentQuestionIndex].question\n .isAnswered\n ) {\n $(\n \"ul#pageNums > ul > li:eq(\" + this.currentQuestionIndex + \")\"\n ).addClass(\"answered\");\n await this.renderedQuestionArray[\n this.currentQuestionIndex\n ].question.checkCurrentAnswer();\n if (!this.done) {\n await this.renderedQuestionArray[\n this.currentQuestionIndex\n ].question.logCurrentAnswer();\n }\n }\n }\n async handleNextPrev(event) {\n if (!this.taken) {\n await this.navigateAway();\n }\n var target = $(event.target).text();\n if (target.match(/Next/)) {\n // checks given text to match \"Next\"\n if ($(this.rightContainer).hasClass(\"disabled\")) {\n return;\n }\n this.currentQuestionIndex++;\n } else if (target.match(/Prev/)) {\n // checks given text to match \"Prev\"\n if ($(this.leftContainer).hasClass(\"disabled\")) {\n return;\n }\n this.currentQuestionIndex--;\n }\n await this.renderTimedQuestion();\n this.ensureButtonSafety();\n for (var i = 0; i < this.qNumList.childNodes.length; i++) {\n for (\n var j = 0;\n j < this.qNumList.childNodes[i].childNodes.length;\n j++\n ) {\n $(this.qNumList.childNodes[i].childNodes[j]).removeClass(\n \"active\"\n );\n }\n }\n $(\n \"ul#pageNums > ul > li:eq(\" + this.currentQuestionIndex + \")\"\n ).addClass(\"active\");\n if (\n $(\n \"ul#pageNums > ul > li:eq(\" + this.currentQuestionIndex + \")\"\n ).hasClass(\"flagcolor\")\n ) {\n // checking for class\n this.flagButton.innerHTML = \"Unflag Question\"; // changes text on button\n } else {\n this.flagButton.innerHTML = \"Flag Question\"; // changes text on button\n }\n }\n\n async handleFlag(event) {\n // called when flag button is clicked\n var target = $(event.target).text();\n if (target.match(/Flag Question/)) {\n $(\n \"ul#pageNums > ul > li:eq(\" + this.currentQuestionIndex + \")\"\n ).addClass(\"flagcolor\"); // class will change color of question block\n this.flagButton.innerHTML = \"Unflag Question\";\n } else {\n $(\n \"ul#pageNums > ul > li:eq(\" + this.currentQuestionIndex + \")\"\n ).removeClass(\"flagcolor\"); // will restore current color of question block\n this.flagButton.innerHTML = \"Flag Question\"; // also sets name back\n }\n }\n\n async handleNumberedNav(event) {\n if (!this.taken) {\n await this.navigateAway();\n }\n for (var i = 0; i < this.qNumList.childNodes.length; i++) {\n for (\n var j = 0;\n j < this.qNumList.childNodes[i].childNodes.length;\n j++\n ) {\n $(this.qNumList.childNodes[i].childNodes[j]).removeClass(\n \"active\"\n );\n }\n }\n\n var target = $(event.target).text();\n let oldIndex = this.currentQuestionIndex;\n this.currentQuestionIndex = parseInt(target) - 1;\n if (this.currentQuestionIndex > this.renderedQuestionArray.length) {\n console.log(`Error: bad index for ${target}`);\n this.currentQuestionIndex = oldIndex;\n }\n $(\n \"ul#pageNums > ul > li:eq(\" + this.currentQuestionIndex + \")\"\n ).addClass(\"active\");\n if (\n $(\n \"ul#pageNums > ul > li:eq(\" + this.currentQuestionIndex + \")\" // checking for flagcolor class\n ).hasClass(\"flagcolor\")\n ) {\n this.flagButton.innerHTML = \"Unflag Question\";\n } else {\n this.flagButton.innerHTML = \"Flag Question\";\n }\n await this.renderTimedQuestion();\n this.ensureButtonSafety();\n }\n\n // set up events for navigation\n navBtnListeners() {\n // Next and Prev Listener\n this.pagNavList.addEventListener(\n \"click\",\n this.handleNextPrev.bind(this),\n false\n );\n\n // Numbered Listener\n this.qNumList.addEventListener(\n \"click\",\n this.handleNumberedNav.bind(this),\n false\n );\n }\n\n // set up event for flag\n flagBtnListener() {\n this.flaggingPlace.addEventListener(\n \"click\",\n this.handleFlag.bind(this), // calls this to take action\n false\n );\n }\n\n renderSubmitButton() {\n this.buttonContainer = document.createElement(\"div\");\n $(this.buttonContainer).attr({\n style: \"text-align:center\",\n });\n this.finishButton = document.createElement(\"button\");\n $(this.finishButton).attr({\n id: \"finish\",\n class: \"btn btn-primary\",\n });\n this.finishButton.textContent = \"Finish Exam\";\n this.finishButton.addEventListener(\n \"click\",\n async function () {\n let skipped =\n this.renderedQuestionArray.filter((x) => !x.question.isAnswered).length;\n let skipstr = skipped > 0 ? `You have skipped ${skipped} question(s).` : \"\";\n if (\n window.confirm(\n `${skipstr} Clicking OK means you are ready to submit your answers and are finished with this assessment.`\n )\n ) {\n await this.finishAssessment();\n $(this.flagButton).hide();\n }\n }.bind(this),\n false\n );\n this.controlDiv.appendChild(this.finishButton);\n $(this.finishButton).hide();\n this.timedDiv.appendChild(this.buttonContainer);\n }\n ensureButtonSafety() {\n if (this.currentQuestionIndex === 0) {\n if (this.renderedQuestionArray.length != 1) {\n $(this.rightContainer).removeClass(\"disabled\");\n }\n $(this.leftContainer).addClass(\"disabled\");\n }\n if (\n this.currentQuestionIndex >=\n this.renderedQuestionArray.length - 1\n ) {\n if (this.renderedQuestionArray.length != 1) {\n $(this.leftContainer).removeClass(\"disabled\");\n }\n $(this.rightContainer).addClass(\"disabled\");\n }\n if (\n this.currentQuestionIndex > 0 &&\n this.currentQuestionIndex < this.renderedQuestionArray.length - 1\n ) {\n $(this.rightContainer).removeClass(\"disabled\");\n $(this.leftContainer).removeClass(\"disabled\");\n }\n }\n renderFeedbackContainer() {\n this.scoreDiv = document.createElement(\"P\");\n this.scoreDiv.id = this.divid + \"results\";\n this.scoreDiv.style.display = \"none\";\n this.containerDiv.appendChild(this.scoreDiv);\n }\n\n createRenderedQuestionArray() {\n // this finds all the assess questions in this timed assessment\n // We need to make a list of all the questions up front so we can set up navigation\n // but we do not want to render the questions until the student has navigated\n // Also adds them to this.renderedQuestionArray\n\n // todo: This needs to be updated to account for the runestone div wrapper.\n\n // To accommodate the selectquestion type -- which is async! we need to wrap\n // all of this in a promise, so that we don't continue to render the timed\n // exam until all of the questions have been realized.\n var opts;\n for (var i = 0; i < this.newChildren.length; i++) {\n var tmpChild = this.newChildren[i];\n opts = {\n state: \"prepared\",\n orig: tmpChild,\n question: {},\n useRunestoneServices: eBookConfig.useRunestoneServices,\n timed: true,\n assessmentTaken: this.taken,\n timedWrapper: this.divid,\n initAttempts: 0,\n };\n if ($(tmpChild).children(\"[data-component]\").length > 0) {\n tmpChild = $(tmpChild).children(\"[data-component]\")[0];\n opts.orig = tmpChild;\n }\n if ($(tmpChild).is(\"[data-component]\")) {\n this.renderedQuestionArray.push(opts);\n }\n }\n }\n\n randomizeRQA() {\n var currentIndex = this.renderedQuestionArray.length,\n temporaryValue,\n randomIndex;\n // While there remain elements to shuffle...\n while (currentIndex !== 0) {\n // Pick a remaining element...\n randomIndex = Math.floor(Math.random() * currentIndex);\n currentIndex -= 1;\n // And swap it with the current element.\n temporaryValue = this.renderedQuestionArray[currentIndex];\n this.renderedQuestionArray[currentIndex] =\n this.renderedQuestionArray[randomIndex];\n this.renderedQuestionArray[randomIndex] = temporaryValue;\n }\n }\n\n async renderTimedQuestion() {\n if (this.currentQuestionIndex >= this.renderedQuestionArray.length) {\n // sometimes the user clicks in the event area for the qNumList\n // But misses a number in that case the text is the concatenation\n // of all the numbers in the list!\n return;\n }\n // check the renderedQuestionArray to see if it has been rendered.\n let opts = this.renderedQuestionArray[this.currentQuestionIndex];\n let currentQuestion;\n if (\n opts.state === \"prepared\" ||\n opts.state === \"forreview\" ||\n (opts.state === \"broken_exam\" && opts.initAttempts < 3)\n ) {\n let tmpChild = opts.orig;\n if ($(tmpChild).is(\"[data-component=selectquestion]\")) {\n if (this.done && opts.state == \"prepared\") {\n this.renderedQuestionArray[\n this.currentQuestionIndex\n ].state = \"exam_ended\";\n } else {\n // SelectOne is async and will replace itself in this array with\n // the actual selected question\n opts.rqa = this.renderedQuestionArray;\n let newq = new SelectOne(opts);\n this.renderedQuestionArray[this.currentQuestionIndex] = {\n question: newq,\n };\n try {\n await newq.initialize();\n if (opts.state == \"broken_exam\") {\n // remove the broken class from this question if we get here.\n $(\n `ul#pageNums > ul > li:eq(${this.currentQuestionIndex})`\n ).removeClass(\"broken\");\n }\n } catch (e) {\n opts.state = \"broken_exam\";\n this.renderedQuestionArray[this.currentQuestionIndex] =\n opts;\n console.log(\n `Error initializing question: Details ${e}`\n );\n }\n }\n } else if ($(tmpChild).is(\"[data-component]\")) {\n let componentKind = $(tmpChild).data(\"component\");\n this.renderedQuestionArray[this.currentQuestionIndex] = {\n question: window.component_factory[componentKind](opts),\n state: opts.state,\n };\n }\n } else if (opts.state === \"broken_exam\") {\n return;\n }\n\n currentQuestion =\n this.renderedQuestionArray[this.currentQuestionIndex].question;\n if (opts.state === \"forreview\") {\n await currentQuestion.component_ready_promise;\n await currentQuestion.checkCurrentAnswer();\n currentQuestion.renderFeedback();\n currentQuestion.disableInteraction();\n }\n\n if (!this.visited.includes(this.currentQuestionIndex)) {\n this.visited.push(this.currentQuestionIndex);\n if (\n this.visited.length === this.renderedQuestionArray.length &&\n !this.done\n ) {\n $(this.finishButton).show();\n }\n }\n\n if (currentQuestion.containerDiv) {\n if (\n currentQuestion.containerDiv.classList.contains(\"runestone\") ==\n false\n ) {\n currentQuestion.containerDiv.classList.add(\"runestone\");\n }\n $(this.switchDiv).replaceWith(currentQuestion.containerDiv);\n this.switchDiv = currentQuestion.containerDiv;\n }\n\n // If the timed component has listeners, those might need to be reinitialized\n // This flag will only be set in the elements that need it--it will be undefined in the others and thus evaluate to false\n if (currentQuestion.needsReinitialization) {\n currentQuestion.reinitializeListeners(this.taken);\n }\n }\n\n /*=================================\n === Timer and control Functions ===\n =================================*/\n handlePrevAssessment() {\n $(this.startBtn).hide();\n $(this.pauseBtn).attr(\"disabled\", true);\n $(this.finishButton).attr(\"disabled\", true);\n this.running = 0;\n this.done = 1;\n // showFeedback sand showResults should both be true before we show the\n // questions and their state of correctness.\n if (this.showResults && this.showFeedback) {\n $(this.timedDiv).show();\n this.restoreAnsweredQuestions(); // do not log these results\n } else {\n $(this.pauseBtn).hide();\n $(this.timerContainer).hide();\n }\n }\n startAssessment() {\n if (!this.taken) {\n $(\"#relations-next\").hide(); // hide the next page button for now\n $(\"#relations-prev\").hide(); // hide the previous button for now\n $(this.startBtn).hide();\n $(this.pauseBtn).attr(\"disabled\", false);\n if (this.running === 0 && this.paused === 0) {\n this.running = 1;\n this.lastTime = Date.now();\n $(this.timedDiv).show();\n this.increment();\n this.logBookEvent({\n event: \"timedExam\",\n act: \"start\",\n div_id: this.divid,\n });\n var timeStamp = new Date();\n var storageObj = {\n answer: [0, 0, this.renderedQuestionArray.length, 0],\n timestamp: timeStamp,\n };\n localStorage.setItem(\n this.localStorageKey(),\n JSON.stringify(storageObj)\n );\n }\n $(window).on(\n \"beforeunload\",\n function (event) {\n // this actual value gets ignored by newer browsers\n if (this.done) {\n return;\n }\n event.preventDefault();\n event.returnValue =\n \"Are you sure you want to leave? Your work will be lost! And you will need your instructor to reset the exam!\";\n return \"Are you sure you want to leave? Your work will be lost!\";\n }.bind(this)\n );\n window.addEventListener(\n \"pagehide\",\n async function (event) {\n if (!this.done) {\n await this.finishAssessment();\n console.log(\"Exam exited by leaving page\");\n }\n }.bind(this)\n );\n } else {\n this.handlePrevAssessment();\n }\n }\n pauseAssessment() {\n if (this.done === 0) {\n if (this.running === 1) {\n this.logBookEvent({\n event: \"timedExam\",\n act: \"pause\",\n div_id: this.divid,\n });\n this.running = 0;\n this.paused = 1;\n this.pauseBtn.innerHTML = \"Resume\";\n $(this.timedDiv).hide();\n } else {\n this.logBookEvent({\n event: \"timedExam\",\n act: \"resume\",\n div_id: this.divid,\n });\n this.running = 1;\n this.paused = 0;\n this.increment();\n this.pauseBtn.innerHTML = \"Pause\";\n $(this.timedDiv).show();\n }\n }\n }\n\n showTime() {\n if (this.showTimer) {\n var mins = Math.floor(this.timeLimit / 60);\n var secs = Math.floor(this.timeLimit) % 60;\n var minsString = mins;\n var secsString = secs;\n if (mins < 10) {\n minsString = \"0\" + mins;\n }\n if (secs < 10) {\n secsString = \"0\" + secs;\n }\n var beginning = \"Time Remaining \";\n if (!this.limitedTime) {\n beginning = \"Time Taken \";\n }\n var timeString = beginning + minsString + \":\" + secsString;\n if (this.done || this.taken) {\n var minutes = Math.floor(this.timeTaken / 60);\n var seconds = Math.floor(this.timeTaken % 60);\n if (minutes < 10) {\n minutes = \"0\" + minutes;\n }\n if (seconds < 10) {\n seconds = \"0\" + seconds;\n }\n timeString = \"Time taken: \" + minutes + \":\" + seconds;\n }\n this.timerContainer.innerHTML = timeString;\n var timeTips = document.getElementsByClassName(\"timeTip\");\n for (var i = 0; i <= timeTips.length - 1; i++) {\n timeTips[i].title = timeString;\n }\n } else {\n $(this.timerContainer).hide();\n }\n }\n\n increment() {\n // if running (not paused) and not taken\n if (this.running === 1 && !this.taken) {\n setTimeout(\n function () {\n // When a browser loses focus, setTimeout may not be called on the\n // schedule expected. Browsers are free to save power by lengthening\n // the interval to some longer time. So we cannot just subtract 1\n // from the timeLimit we need to measure the elapsed time from the last\n // call to the current call and subtract that number of seconds.\n let currentTime = Date.now();\n if (this.limitedTime) {\n // If there's a time limit, count down to 0\n this.timeLimit =\n this.timeLimit -\n Math.floor((currentTime - this.lastTime) / 1000);\n } else {\n // Else count up to keep track of how long it took to complete\n this.timeLimit =\n this.timeLimit +\n Math.floor((currentTime - this.lastTime) / 1000);\n }\n this.lastTime = currentTime;\n localStorage.setItem(\n eBookConfig.email + \":\" + this.divid + \"-time\",\n this.timeLimit\n );\n this.showTime();\n if (this.timeLimit > 0) {\n this.increment();\n // ran out of time\n } else {\n $(this.startBtn).attr({\n disabled: \"true\",\n });\n $(this.finishButton).attr({\n disabled: \"true\",\n });\n this.running = 0;\n this.done = 1;\n if (!this.taken) {\n this.taken = true;\n // embed the message in the page -- an alert actually prevents\n // the answers from being submitted and if a student closes their\n // laptop then the answers will not be submitted ever! Even when they\n // reopen the laptop their session cookie is likely invalid.\n let mess = document.createElement(\"h1\");\n mess.innerHTML =\n \"Sorry but you ran out of time. Your answers are being submitted\";\n this.controlDiv.appendChild(mess);\n this.finishAssessment();\n }\n }\n }.bind(this),\n 1000\n );\n }\n }\n\n styleExamElements() {\n // Checks if this exam has been taken before\n $(this.timerContainer).css({\n width: \"50%\",\n margin: \"0 auto\",\n \"background-color\": \"#DFF0D8\",\n \"text-align\": \"center\",\n border: \"2px solid #DFF0D8\",\n \"border-radius\": \"25px\",\n });\n $(this.scoreDiv).css({\n width: \"50%\",\n margin: \"0 auto\",\n \"background-color\": \"#DFF0D8\",\n \"text-align\": \"center\",\n border: \"2px solid #DFF0D8\",\n \"border-radius\": \"25px\",\n });\n $(\".tooltipTime\").css({\n margin: \"0\",\n padding: \"0\",\n \"background-color\": \"black\",\n color: \"white\",\n });\n }\n\n async finishAssessment() {\n $(\"#relations-next\").show(); // show the next page button for now\n $(\"#relations-prev\").show(); // show the previous button for now\n if (!this.showFeedback) {\n // bje - changed from showResults\n $(this.timedDiv).hide();\n $(this.pauseBtn).hide();\n $(this.timerContainer).hide();\n }\n this.findTimeTaken();\n this.running = 0;\n this.done = 1;\n this.taken = 1;\n await this.finalizeProblems();\n this.checkScore();\n this.displayScore();\n this.storeScore();\n this.logScore();\n $(this.pauseBtn).attr(\"disabled\", true);\n this.finishButton.disabled = true;\n $(window).off(\"beforeunload\");\n // turn off the pagehide listener\n let assignment_id = this.divid;\n setTimeout(function () {\n jQuery.ajax({\n url: eBookConfig.app + \"/assignments/student_autograde\",\n type: \"POST\",\n dataType: \"JSON\",\n data: {\n assignment_id: assignment_id,\n is_timed: true,\n },\n success: function (retdata) {\n if (retdata.success == false) {\n console.log(retdata.message);\n } else {\n console.log(\"Autograder completed\");\n }\n },\n });\n }, 2000);\n }\n\n // finalizeProblems\n // ----------------\n async finalizeProblems() {\n // Because we have submitted each question as we navigate we only need to\n // send the final version of the question the student is on when they press the\n // finish exam button.\n\n var currentQuestion =\n this.renderedQuestionArray[this.currentQuestionIndex].question;\n await currentQuestion.checkCurrentAnswer();\n await currentQuestion.logCurrentAnswer();\n currentQuestion.renderFeedback();\n currentQuestion.disableInteraction();\n\n for (var i = 0; i < this.renderedQuestionArray.length; i++) {\n let currentQuestion = this.renderedQuestionArray[i];\n // set the state to forreview so we know that feedback may be appropriate\n if (currentQuestion.state !== \"broken_exam\") {\n currentQuestion.state = \"forreview\";\n currentQuestion.question.disableInteraction();\n }\n }\n\n if (!this.showFeedback) {\n this.hideTimedFeedback();\n }\n }\n\n // restoreAnsweredQuestions\n // ------------------------\n restoreAnsweredQuestions() {\n for (var i = 0; i < this.renderedQuestionArray.length; i++) {\n var currentQuestion = this.renderedQuestionArray[i];\n if (currentQuestion.state === \"prepared\") {\n currentQuestion.state = \"forreview\";\n }\n }\n }\n\n // hideTimedFeedback\n // -----------------\n hideTimedFeedback() {\n for (var i = 0; i < this.renderedQuestionArray.length; i++) {\n var currentQuestion = this.renderedQuestionArray[i].question;\n currentQuestion.hideFeedback();\n }\n }\n\n // checkScore\n // ----------\n // This is a simple all or nothing score of one point per question for\n // that includes our best guess if a question was skipped.\n checkScore() {\n this.correctStr = \"\";\n this.skippedStr = \"\";\n this.incorrectStr = \"\";\n // Gets the score of each problem\n for (var i = 0; i < this.renderedQuestionArray.length; i++) {\n var correct =\n this.renderedQuestionArray[i].question.checkCorrectTimed();\n if (correct == \"T\") {\n this.score++;\n this.correctStr = this.correctStr + (i + 1) + \", \";\n } else if (correct == \"F\") {\n this.incorrect++;\n this.incorrectStr = this.incorrectStr + (i + 1) + \", \";\n } else if (correct === null || correct === \"I\") {\n this.skipped++;\n this.skippedStr = this.skippedStr + (i + 1) + \", \";\n } else {\n // ignored question; just do nothing\n }\n }\n // remove extra comma and space at end if any\n if (this.correctStr.length > 0)\n this.correctStr = this.correctStr.substring(\n 0,\n this.correctStr.length - 2\n );\n else this.correctStr = \"None\";\n if (this.skippedStr.length > 0)\n this.skippedStr = this.skippedStr.substring(\n 0,\n this.skippedStr.length - 2\n );\n else this.skippedStr = \"None\";\n if (this.incorrectStr.length > 0)\n this.incorrectStr = this.incorrectStr.substring(\n 0,\n this.incorrectStr.length - 2\n );\n else this.incorrectStr = \"None\";\n }\n findTimeTaken() {\n if (this.limitedTime) {\n this.timeTaken = this.startingTime - this.timeLimit;\n } else {\n this.timeTaken = this.timeLimit;\n }\n }\n storeScore() {\n var storage_arr = [];\n storage_arr.push(\n this.score,\n this.correctStr,\n this.incorrect,\n this.incorrectStr,\n this.skipped,\n this.skippedStr,\n this.timeTaken\n );\n var timeStamp = new Date();\n var storageObj = JSON.stringify({\n answer: storage_arr,\n timestamp: timeStamp,\n });\n localStorage.setItem(this.localStorageKey(), storageObj);\n }\n // _`timed exam endpoint parameters`\n //----------------------------------\n logScore() {\n this.logBookEvent({\n event: \"timedExam\",\n act: \"finish\",\n div_id: this.divid,\n correct: this.score,\n incorrect: this.incorrect,\n skipped: this.skipped,\n time_taken: this.timeTaken,\n });\n }\n shouldUseServer(data) {\n // We override the RunestoneBase version because there is no \"correct\" attribute, and there are 2 possible localStorage schemas\n // --we also want to default to local storage because it contains more information specifically which questions are correct, incorrect, and skipped.\n var storageDate;\n if (localStorage.length === 0) return true;\n var storageObj = localStorage.getItem(this.localStorageKey());\n if (storageObj === null) return true;\n try {\n var storedData = JSON.parse(storageObj).answer;\n if (storedData.length == 4) {\n if (\n data.correct == storedData[0] &&\n data.incorrect == storedData[1] &&\n data.skipped == storedData[2] &&\n data.timeTaken == storedData[3]\n )\n return true;\n } else if (storedData.length == 7) {\n if (\n data.correct == storedData[0] &&\n data.incorrect == storedData[2] &&\n data.skipped == storedData[4] &&\n data.timeTaken == storedData[6]\n ) {\n return false; // In this case, because local storage has more info, we want to use that if it's consistent\n }\n }\n storageDate = new Date(JSON.parse(storageObj[1]).timestamp);\n } catch (err) {\n // error while parsing; likely due to bad value stored in storage\n console.log(err.message);\n localStorage.removeItem(this.localStorageKey());\n return true;\n }\n var serverDate = new Date(data.timestamp);\n if (serverDate < storageDate) {\n this.logScore();\n return false;\n }\n return true;\n }\n\n checkLocalStorage() {\n var len = localStorage.length;\n if (len > 0) {\n if (localStorage.getItem(this.localStorageKey()) !== null) {\n this.taken = 1;\n this.restoreAnswers(\"\");\n } else {\n this.taken = 0;\n }\n } else {\n this.taken = 0;\n }\n }\n async restoreAnswers(data) {\n this.taken = 1;\n var tmpArr;\n if (data === \"\") {\n try {\n tmpArr = JSON.parse(\n localStorage.getItem(this.localStorageKey())\n ).answer;\n } catch (err) {\n // error while parsing; likely due to bad value stored in storage\n console.log(err.message);\n localStorage.removeItem(this.localStorageKey());\n this.taken = 0;\n return;\n }\n } else {\n // Parse results from the database\n tmpArr = [\n parseInt(data.correct),\n parseInt(data.incorrect),\n parseInt(data.skipped),\n parseInt(data.time_taken),\n data.reset,\n ];\n this.setLocalStorage(tmpArr);\n }\n if (tmpArr.length == 1) {\n // Exam was previously reset\n this.reset = true;\n this.taken = 0;\n return;\n }\n if (tmpArr.length == 4) {\n // Accidental Reload OR Database Entry\n this.score = tmpArr[0];\n this.incorrect = tmpArr[1];\n this.skipped = tmpArr[2];\n this.timeTaken = tmpArr[3];\n } else if (tmpArr.length == 5) {\n this.score = tmpArr[0];\n this.incorrect = tmpArr[1];\n this.skipped = tmpArr[2];\n this.timeTaken = tmpArr[3];\n } else if (tmpArr.length == 7) {\n // Loaded Completed Exam\n this.score = tmpArr[0];\n this.correctStr = tmpArr[1];\n this.incorrect = tmpArr[2];\n this.incorrectStr = tmpArr[3];\n this.skipped = tmpArr[4];\n this.skippedStr = tmpArr[5];\n this.timeTaken = tmpArr[6];\n } else {\n // Set localStorage in case of \"accidental\" reload\n this.score = 0;\n this.incorrect = 0;\n this.skipped = this.renderedQuestionArray.length;\n this.timeTaken = 0;\n }\n if (this.taken) {\n if (this.skipped === this.renderedQuestionArray.length) {\n this.showFeedback = false;\n }\n this.handlePrevAssessment();\n }\n await this.renderTimedQuestion();\n this.displayScore();\n this.showTime();\n }\n setLocalStorage(parsedData) {\n var timeStamp = new Date();\n var storageObj = {\n answer: parsedData,\n timestamp: timeStamp,\n };\n localStorage.setItem(\n this.localStorageKey(),\n JSON.stringify(storageObj)\n );\n }\n displayScore() {\n if (this.showResults) {\n var scoreString = \"\";\n var numQuestions;\n var percentCorrect;\n // if we have some information\n if (\n this.correctStr.length > 0 ||\n this.incorrectStr.length > 0 ||\n this.skippedStr.length > 0\n ) {\n scoreString = `Num Correct: ${this.score}. Questions: ${this.correctStr}
Num Wrong: ${this.incorrect}. Questions: ${this.incorrectStr}
Num Skipped: ${this.skipped}. Questions: ${this.skippedStr}
`;\n numQuestions = this.score + this.incorrect + this.skipped;\n percentCorrect = (this.score / numQuestions) * 100;\n scoreString +=\n \"Percent Correct: \" + percentCorrect.toFixed(2) + \"%\";\n $(this.scoreDiv).html(scoreString);\n this.scoreDiv.style.display = \"block\";\n } else {\n scoreString = `Num Correct: ${this.score}
Num Wrong: ${this.incorrect}
Num Skipped: ${this.skipped}
`;\n numQuestions = this.score + this.incorrect + this.skipped;\n percentCorrect = (this.score / numQuestions) * 100;\n scoreString +=\n \"Percent Correct: \" + percentCorrect.toFixed(2) + \"%\";\n $(this.scoreDiv).html(scoreString);\n this.scoreDiv.style.display = \"block\";\n }\n this.highlightNumberedList();\n } else {\n $(this.scoreDiv).html(\n \"Thank you for taking the exam. Your answers have been recorded.\"\n );\n this.scoreDiv.style.display = \"block\";\n }\n }\n highlightNumberedList() {\n var correctCount = this.correctStr;\n var incorrectCount = this.incorrectStr;\n var skippedCount = this.skippedStr;\n correctCount = correctCount.replace(/ /g, \"\").split(\",\");\n incorrectCount = incorrectCount.replace(/ /g, \"\").split(\",\");\n skippedCount = skippedCount.replace(/ /g, \"\").split(\",\");\n $(function () {\n var numberedBtns = $(\"ul#pageNums > ul > li\");\n if (numberedBtns.hasClass(\"answered\")) {\n numberedBtns.removeClass(\"answered\");\n }\n for (var i = 0; i < correctCount.length; i++) {\n var test = parseInt(correctCount[i]) - 1;\n numberedBtns\n .eq(parseInt(correctCount[i]) - 1)\n .addClass(\"correctCount\");\n }\n for (var j = 0; j < incorrectCount.length; j++) {\n numberedBtns\n .eq(parseInt(incorrectCount[j]) - 1)\n .addClass(\"incorrectCount\");\n }\n for (var k = 0; k < skippedCount.length; k++) {\n numberedBtns\n .eq(parseInt(skippedCount[k]) - 1)\n .addClass(\"skippedCount\");\n }\n });\n }\n}\n\n/*=======================================================\n=== Function that calls the constructors on page load ===\n=======================================================*/\n$(document).on(\"runestone:login-complete\", function () {\n $(\"[data-component=timedAssessment]\").each(function (index) {\n window.componentMap[this.id] = new Timed({\n orig: this,\n useRunestoneServices: eBookConfig.useRunestoneServices,\n });\n });\n});\n"],"names":["ShortAnswer","constructor","opts","super","orig","this","useRunestoneServices","eBookConfig","origElem","divid","id","question","innerHTML","optional","attachURL","$","is","mathjax","attachment","placeholder","data","renderHTML","caption","addCaption","checkServer","Prism","highlightAllUnder","containerDiv","document","createElement","addClass","getAttribute","newForm","name","action","appendChild","fieldSet","firstLegendDiv","jInputDiv","jOptionsDiv","jLabel","jTextArea","self","onchange","isAnswered","attr","css","rows","cols","feedbackDiv","removeClass","bind","renderedAnswer","buttonDiv","submitButton","type","textContent","onclick","checkCurrentAnswer","logCurrentAnswer","renderFeedback","randomSpan","otherOptionsDiv","attachDiv","graderactive","viewButton","viewFile","fileUpload","replaceWith","MathJax","queueMathJax","renderMath","value","replace","text","sid","getElementById","val","setLocalStorage","answer","timestamp","Date","event","act","div_id","logBookEvent","uploadFile","key","localStorageKey","localStorage","setItem","JSON","stringify","checkLocalStorage","length","ex","getItem","parse","err","console","log","message","removeItem","restoreAnswers","p","tsString","toLocaleString","last_answer","current_answer","toggle_answer_button","click","display_timestamp","button_text","last_timestamp","feedbackStr","score","comment","disableInteraction","disabled","files","FormData","append","fetch","method","body","then","response","json","catch","error","window","open","write","alert","on","each","closest","componentMap","TimedShortAnswer","renderTimedIcon","hideButtons","hide","component","timeIconDiv","timeIcon","src","style","className","title","prepend","checkCorrectTimed","hideFeedback","component_factory","shortanswer","timed","Timed","children","childNodes","visited","timeLimit","limitedTime","isNaN","parseInt","startingTime","showFeedback","showResults","random","showTimer","fullwidth","nopause","enableScratchAC","running","paused","done","taken","incorrect","correctStr","incorrectStr","skippedStr","skipped","currentQuestionIndex","renderedQuestionArray","getNewChildren","enableDebug","oncontextmenu","checkAssessmentStatus","renderTimedAssess","newChildren","runestoneChildren","querySelectorAll","i","push","sendInfo","course_name","course","request","Request","new_server_prefix","headers","jsonHeaders","detail","tookAssessment","assessmentTaken","clear","Promise","resolve","createRenderedQuestionArray","randomizeRQA","renderContainer","renderTimer","renderControlButtons","timedDiv","renderNavControls","renderSubmitButton","renderFeedbackContainer","styleExamElements","classList","add","navDiv","flagDiv","switchContainer","switchDiv","wrapperDiv","timerContainer","showTime","controlDiv","startBtn","pauseBtn","class","tabindex","role","addEventListener","async","finishButton","flagButton","show","mess","renderTimedQuestion","startAssessment","pauseAssessment","tmpLi","tmpA","pagNavList","leftContainer","leftNavButton","rightNavButton","flaggingPlace","flagContainer","rightContainer","ensureButtonSafety","break","qNumList","qNumWrapperList","navBtnListeners","flagBtnListener","navigateAway","state","handleNextPrev","target","match","hasClass","j","handleFlag","handleNumberedNav","oldIndex","buttonContainer","filter","x","skipstr","confirm","finishAssessment","scoreDiv","display","tmpChild","timedWrapper","initAttempts","temporaryValue","randomIndex","currentIndex","Math","floor","currentQuestion","rqa","newq","initialize","e","componentKind","component_ready_promise","includes","contains","needsReinitialization","reinitializeListeners","handlePrevAssessment","restoreAnsweredQuestions","lastTime","now","increment","timeStamp","storageObj","preventDefault","returnValue","mins","secs","minsString","secsString","beginning","timeString","minutes","timeTaken","seconds","timeTips","getElementsByClassName","setTimeout","currentTime","email","width","margin","border","padding","color","findTimeTaken","finalizeProblems","checkScore","displayScore","storeScore","logScore","off","assignment_id","jQuery","ajax","url","app","dataType","is_timed","success","retdata","hideTimedFeedback","correct","substring","storage_arr","time_taken","shouldUseServer","storageDate","storedData","tmpArr","reset","parsedData","numQuestions","scoreString","toFixed","html","highlightNumberedList","correctCount","incorrectCount","skippedCount","split","numberedBtns","eq","k","index"],"sourceRoot":""}