From 540f6f31d513e0ecab70fc23daa9dead89670ba9 Mon Sep 17 00:00:00 2001
From: David
Date: Thu, 16 Nov 2023 13:37:59 -0700
Subject: [PATCH] hotfix - minor fixes for snap.js
---
theme/snap/amd/build/snap.min.js | 2 +-
theme/snap/amd/build/snap.min.js.map | 2 +-
theme/snap/amd/src/snap.js | 12 +++++++-----
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/theme/snap/amd/build/snap.min.js b/theme/snap/amd/build/snap.min.js
index e5ede0082800e..85dc945e51777 100644
--- a/theme/snap/amd/build/snap.min.js
+++ b/theme/snap/amd/build/snap.min.js
@@ -18,6 +18,6 @@
* @copyright Copyright (c) 2015 Open LMS (https://www.openlms.net)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-define("theme_snap/snap",["jquery","core/log","theme_snap/headroom","theme_snap/util","theme_snap/personal_menu","theme_snap/cover_image","theme_snap/progressbar","core/templates","core/str","theme_snap/accessibility","theme_snap/messages","theme_snap/scroll"],(function($,log,Headroom,util,personalMenu,coverImage,ProgressBar,templates,str,accessibility,messages,Scroll){M.theme_snap=M.theme_snap||{};log.disableAll(!0);var brandColorSuccess="",brandColorWarning="",GRADE_DISPLAY_TYPE_PERCENTAGE="",GRADE_DISPLAY_TYPE_PERCENTAGE_REAL="",GRADE_DISPLAY_TYPE_PERCENTAGE_LETTER="",GRADE_DISPLAY_TYPE_REAL="",GRADE_DISPLAY_TYPE_REAL_PERCENTAGE="",GRADE_DISPLAY_TYPE_REAL_LETTER="",getURLParams=function(href){var ta=href.split("?");if(ta.length<2)return!1;for(var urlparams=ta[1],items=(urlparams=urlparams.split("#")[0]).split("&"),params=[],i=0;i div.form-group.fitem"),savebuttonsformadvanced=$("div[role=main] .mform div.snap-form-advanced > div:nth-of-type(3)"),width=$(window).width();width<992?$(".snap-form-advanced").append(savebuttonsformrequired):width>992&&$(".snap-form-required fieldset#id_general").append(savebuttonsformadvanced)};const updateGraderHeadersTop=function(){const graderHeader=$(".path-grade-report-grader .gradeparent tr.heading");graderHeader.length&&graderHeader.css("top",$("#mr-nav").height()+"px")},regionMain=$('.path-grade-report-grader #region-main div[role="main"]');if(regionMain.length>0){regionMain[0].querySelector(".gradeparent")&®ionMain.addClass("snap-grade-reporter")}updateGraderHeadersTop();var onCoursePage=function(){return 0===$("body").attr("id").indexOf("page-course-view-")},processSearchString=function(searchString){return searchString=searchString.trim().toLowerCase()},createColoredDataCircle=function(nodePointer,dataCallback){let valueCallback=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;var circle=new ProgressBar.Circle(nodePointer,{color:"inherit",easing:"linear",strokeWidth:6,trailWidth:3,duration:1400,text:{value:"0"}}),value=$(nodePointer).attr("value")/100,endColor=brandColorSuccess;0===value||"-"===$(nodePointer).attr("value")?circle.setText("-"):($(nodePointer).attr("value")<50&&(endColor=brandColorWarning),circle.setText(dataCallback(nodePointer)));var valueAnimate=0;valueAnimate=null===valueCallback?value:valueCallback(nodePointer),circle.animate(valueAnimate,{from:{color:"#999"},to:{color:endColor},step:function(state,circle){circle.path.setAttribute("stroke",state.color)}})},addListeners=function(){$(document).on("click",[".chapters a",".section_footer a"," #toc-search-results a"].join(", "),(function(e){var href=this.getAttribute("href");window.history&&window.history.pushState?(history.pushState(null,null,href),$(window).trigger("hashchange"),e.preventDefault()):location.hash=href}));var myElement=document.querySelector("#mr-nav"),headroom=new Headroom(myElement,{tolerance:5,offset:100,classes:{initial:"headroom",pinned:"headroom--pinned",unpinned:"headroom--unpinned",top:"headroom--top",notTop:"headroom--not-top"},onPin:()=>{$(".snap-drawer-no-headroom").addClass("snap-drawer-headroom"),$(".snap-drawer-headroom").removeClass("snap-drawer-no-headroom")},onUnpin:()=>{$(".snap-drawer-headroom").addClass("snap-drawer-no-headroom"),$(".snap-drawer-no-headroom").removeClass("snap-drawer-headroom")}});$(".notloggedin").length||headroom.init();var dataList=$("#toc-searchables").find("li").clone(!0);$("#course-toc").on("keyup","#toc-search-input",(function(){!function(dataList){var i,ua=window.navigator.userAgent;(ua.indexOf("MSIE ")||ua.indexOf("Trident/"))&&(dataList=$("#toc-searchables").find("li").clone(!0));var searchString=$("#toc-search-input").val();if(0===(searchString=processSearchString(searchString)).length)$("#toc-search-results").html(""),$("#toc-search-input").removeClass("state-active");else{$("#toc-search-input").addClass("state-active");var matches=[];for(i=0;i-1&&matches.push(dataItem)}$("#toc-search-results").html(matches)}}(dataList)})),$("#course-toc").on("keydown","#toc-search-input",(function(e){9===(e.keyCode||e.which)&&$("#toc-search-results a").last().blur((function(){$(this).off("blur"),$("#toc-search-input").val(""),$("#toc-search-results").html(""),$("#toc-search-input").removeClass("state-active")}))})),$("#course-toc").on("click","#toc-search-results a",(function(){$("#toc-search-input").val(""),$("#toc-search-results").html(""),$("#toc-search-input").removeClass("state-active")})),$(document).on("click",(function(event){$(event.target).closest("#toc-search-input").length||($("#toc-search-input").val(""),$("#toc-search-results").html(""),$("#toc-search-input").removeClass("state-active"))})),$(document).on("click","#admin-menu-trigger, #toc-mobile-menu-toggle",(function(e){var href=this.getAttribute("href");"admin-menu-trigger"===this.getAttribute("id")&&($(this).toggleClass("active"),$("#page").toggleClass("offcanvas")),$(href).attr("tabindex","0"),$(href).toggleClass("state-visible").focus(),e.preventDefault(),0===$(".message-app.main").length&&document.dispatchEvent(new Event("messages-drawer:toggle"))})),$(document).on("click","#course-toc.state-visible a",(function(){$("#course-toc").removeClass("state-visible")})),$(document).on("click",".section_footer a, .chapter-title, .toc-footer a",(function(){const videos=$('[title="watch"], .video-js, iframe:not([id])');for(let i=0;i div > a[role="button"]');util.scrollToElement($news),$(".news-article").not($news).removeClass("state-expanded"),$(".news-article .toggle").not($newstoggle).attr("aria-expanded","false"),$('.news-article-message > div > a[role="button"]').not($newsclose).attr("aria-expanded","false"),$(".news-article-message").css("display","none"),$news.toggleClass("state-expanded"),$news.attr("state-expanded")||($news.focus(),$newstoggle.attr("aria-expanded","false"),$newsclose.attr("aria-expanded","false")),$(".state-expanded").find(".news-article-message").slideDown("fast",(function(){$news.is(".state-expanded")?($news.find(".news-article-message").focus(),$newstoggle.attr("aria-expanded","true"),$newsclose.attr("aria-expanded","true")):($news.focus(),$newstoggle.attr("aria-expanded","false"),$newsclose.attr("aria-expanded","false")),$(document).trigger("snapContentRevealed")})),e.preventDefault()})),$(document).on("click",".anim-play-button",(function(){$(this).parent().prev().css("visibility","visible")})),$(document).on("click",".anim-pause-button",(function(){$(this).parent().prev().css("visibility","hidden")})),(new Scroll).init(),$((function(){var supportsTouch=!1;if(("ontouchstart"in window||window.navigator.msPointerEnabled)&&(supportsTouch=!0),!supportsTouch){var tooltipNode=$('[data-toggle="tooltip"]');$.isFunction(tooltipNode.tooltip)&&tooltipNode.tooltip()}}))};return{snapInit:function(courseConfig,pageHasCourseContent,siteMaxBytes,forcePassChange,messageBadgeCountEnabled,userId,sitePolicyAcceptReqd,inAlternativeRole,brandColors,gradingConstants){brandColorSuccess=brandColors.success,brandColorWarning=brandColors.warning,GRADE_DISPLAY_TYPE_PERCENTAGE=gradingConstants.gradepercentage,GRADE_DISPLAY_TYPE_PERCENTAGE_REAL=gradingConstants.gradepercentagereal,GRADE_DISPLAY_TYPE_PERCENTAGE_LETTER=gradingConstants.gradepercentageletter,GRADE_DISPLAY_TYPE_REAL=gradingConstants.gradereal,GRADE_DISPLAY_TYPE_REAL_PERCENTAGE=gradingConstants.graderealpercentage,GRADE_DISPLAY_TYPE_REAL_LETTER=gradingConstants.graderealletter,M.cfg.context=courseConfig.contextid,M.snapTheme={forcePassChange:forcePassChange},personalMenu.init(sitePolicyAcceptReqd),pageHasCourseContent&&require(["theme_snap/course-lazy"],(function(CourseLibAmd){!function(courseLib){var lastHash=location.hash;$(window).on("popstate hashchange",(function(e){var newHash=location.hash;log.info("hashchange"),newHash!==lastHash&&("#primary-nav"===location.hash?personalMenu.update():($("#page, #moodle-footer, #js-snap-pm-trigger, #logo, .skiplinks").css("display",""),onCoursePage()&&(log.info("show section",e.target),courseLib.showSection()))),lastHash=newHash}))}(new CourseLibAmd(courseConfig))})),$(document).ready((function(){var extraclasses;!function(){var xdebugs=$(".xdebug-error");if(xdebugs.length)for(var x=0;x
")}var modSettingsIdRe=/^page-mod-.*-mod$/,onModSettings=modSettingsIdRe.test($("body").attr("id"))&&location.href.indexOf("modedit")>-1;onModSettings||(onModSettings=(modSettingsIdRe=/^page-mod-.*-general$/).test($("body").attr("id"))&&location.href.indexOf("modedit")>-1);var onCourseSettings="page-course-edit"===$("body").attr("id"),onSectionSettings="page-course-editsection"===$("body").attr("id");$("#page-mod-hvp-mod .h5p-editor-iframe").parent().css({display:"block"});var pageNotInBlacklist=-1===["page-mod-hvp-mod"].indexOf($("body").attr("id"));if((onModSettings||onCourseSettings||onSectionSettings)&&pageNotInBlacklist){var vital=[":first","#page-course-edit #id_descriptionhdr","#id_contentsection","#id_general + #id_general","#id_content","#page-mod-choice-mod #id_optionhdr","#page-mod-workshop-mod #id_gradingsettings","#page-mod-choicegroup-mod #id_miscellaneoussettingshdr","#page-mod-choicegroup-mod #id_groups","#page-mod-scorm-mod #id_packagehdr"];vital=vital.join(),$('form[id^="mform1"] > fieldset').not(vital).wrapAll(''),$(".snap-form-advanced").append($(".collapsible-actions")),$("#page-course-edit").length||$(".snap-form-advanced fieldset").addClass("collapsed");for(var mainForm=$('form[id^="mform1"] fieldset:first'),appendTo=$('form[id^="mform1"] fieldset:first .fcontainer'),required=$('form[id^="mform1"] > fieldset').not('form[id^="mform1"] > fieldset:first'),i=0;i'),$("body#page-mod-lti-mod").length){var multipleLTIActivities=document.querySelector('section#region-main form.mform > div[data-attribute="dynamic-import"]');new MutationObserver((function(){$("fieldset#id_general > :nth-child(5)").detach().appendTo('section#region-main > div[role="main"] > form.mform')})).observe(multipleLTIActivities,{childList:!0})}var description=$('form[id^="mform1"] fieldset:first .fitem_feditor:not(.required)');if(onModSettings&&description){0===$(["body#page-mod-assign-mod","body#page-mod-choice-mod","body#page-mod-turnitintool-mod","body#page-mod-workshop-mod"].join()).length&&($(appendTo).append(description),$(appendTo).append($("#fitem_id_showdescription"))),$(["body#page-mod-url-mod","body#page-mod-resource-mod","body#page-mod-folder-mod","body#page-mod-imscp-mod","body#page-mod-lightboxgallery-mod","body#page-mod-scorm-mod"].join()).length>0&&str.get_strings([{key:"multimediacard",component:"theme_snap"}]).done((function(stringsjs){var activityCards=stringsjs[0],cardmultimedia=$("[id='id_showdescription']").closest(".form-group");$(cardmultimedia).append(activityCards)}))}description=$("#page-mod-resource-mod [data-fieldtype='editor']").closest(".form-group");var showdescription=$("#page-mod-resource-mod [id='id_showdescription']").closest(".form-group");$("#page-mod-resource-mod .snap-form-advanced #id_modstandardelshdr .fcontainer").append(description),$("#page-mod-resource-mod .snap-form-advanced #id_modstandardelshdr .fcontainer").append(showdescription);var duedate=$("#page-mod-assign-mod [for='id_duedate']").closest(".form-group");$("#page-mod-assign-mod .snap-form-required .fcontainer").append(duedate);var availablity=$("#id_visible").closest(".form-group").addClass("snap-form-visibility"),label=$(availablity).find("label"),select=$(availablity).find("select");if($(label).insertBefore(select),$(label).text(M.util.get_string("visibility","theme_snap")+" "),$("#page-course-edit").length){var strDisabled="";str.get_strings([{key:"showallsectionsdisabled",component:"theme_snap"},{key:"disabled",component:"theme_snap"}]).then((function(strings){var strMessage=strings[0];return strDisabled=strings[1],templates.render("theme_snap/form_alert",{type:"warning",classes:"",message:strMessage})})).then((function(html){var op0=$('[name="coursedisplay"] > option[value="0"]'),op1=$('[name="coursedisplay"] > option[value="1"]'),selectNode=$('[name="coursedisplay"]');op0.attr("disabled","disabled"),op0.append(" ("+strDisabled+")"),op0.removeAttr("selected"),op1.attr("selected","selected"),selectNode.parent().append(html)}))}$(".snap-form-advanced").prepend(availablity);var savebuttons=$('form[id^="mform1"] > .form-group:last');$(mainForm).append(savebuttons);var errorElements=$(".form-group.has-danger");onModSettings&&errorElements.length&&errorElements.closest(".collapsible").removeClass("collapsed"),$("#page-mod-page-mod").length&&(str.get_strings([{key:"showappearancedisabled",component:"theme_snap"}]).then((function(localizedstring){return templates.render("theme_snap/form_alert",{type:"warning",classes:"",message:localizedstring})})).then((function(html){var pageInputs=$('[id="id_printheading"], [id="id_printintro"], [id="id_printlastmodified"], [id="id_display"], [id="id_popupwidth"], [id="id_popupheight"]');$("#id_display option:not(:selected)").attr("disabled",!0),pageInputs.attr("readonly",!0),$("#id_display").attr("disabled",!0),pageInputs.attr("tabindex",-1),pageInputs.click((function(e){return e.preventDefault(),!1})),pageInputs.parent().parent().parent().css("background-color","#f1f1f1"),pageInputs.parent().parent().parent().css("color","#d5d5d5"),$("#id_appearancehdrcontainer").append(html)})),$("#id_showdescription").parent().parent().parent().hide())}if(onSectionSettings&&$("#page-course-editsection.format-topics .form-group #id_name_value").length){document.getElementById("id_name_value").hasAttribute("disabled")&&document.getElementById("id_name_value").removeAttribute("disabled")}messageBadgeCountEnabled&&require(["theme_snap/conversation_badge_count-lazy"],(function(conversationBadgeCount){conversationBadgeCount.init(userId)})),$(".message-app .list-group").on("click",".list-group-item.list-group-item-action",(function(e){require(["theme_snap/conversation_badge_count-lazy"],(function(conversationBadgeCount){let conversationId=e.currentTarget.attributes["data-conversation-id"].value;conversationBadgeCount.init(userId,conversationId)}))}));var focustarget=$("#snap-coverimagecontrol label");focustarget&&focustarget.length&&focustarget.keypress((function(e){13===e.which&&$("#snap-coverfiles").trigger("click")})),$(".block_settings").length||($("#admin-menu-trigger").hide(),inAlternativeRole&&require(["theme_snap/alternative_role_handler-lazy"],(function(alternativeRoleHandler){alternativeRoleHandler.init(courseConfig.id)})));var lastElement,customMenu=$("ul.snap-navbar-content li:first-child a"),moodlePage=$("#moodle-page a:first"),notificationsBtn=$("#nav-notification-popover-container > div.popover-region-toggle.nav-link"),searchButton=$("#mr-nav .simplesearchform a.btn.btn-open"),adminMenuTrigger=$("#admin-menu-trigger");lastElement=customMenu.length?customMenu:moodlePage,notificationsBtn.length&&searchButton.length&&adminMenuTrigger.length&&lastElement.length&&require(["theme_snap/rearrange_tab_handler-lazy"],(function(searchTabHandler){searchTabHandler.init([notificationsBtn,searchButton,adminMenuTrigger,lastElement])})),$(".snap-settings-tab-link").on("click",(function(){var tab=$('a[href="'+$(this).attr("href")+'"].nav-link');tab.length&&tab.tab("show")})),"#course-detail-title"===window.location.hash&&$("#mr-nav").removeClass("headroom--pinned").addClass("headroom--unpinned");var savebuttonsformrequired=$("div[role=main] .mform div.snap-form-required fieldset > div.form-group.fitem");if($(window).width()<767&&$(".snap-form-advanced").append(savebuttonsformrequired),$(".path-mod.theme-snap #id_coursecontentnotification").length){const notificationCheck=document.getElementById("id_coursecontentnotification").closest(".form-group.fitem"),submitButtons=$('.snap-form-required [data-groupname="buttonar"]');null!==notificationCheck&&submitButtons.length&&(notificationCheck.classList.add("snap_content_notification_check"),submitButtons.before(notificationCheck))}if($("#page-home.theme-snap .intelliboard-page").length&&$(".snap-page-heading-button").length){document.getElementsByClassName("snap-page-heading-button")[0].classList.add("hidden")}const editingButton=$("#page-grade-report-singleview-index .grade_report_edit_button");editingButton.length&&!$(".search-widget.dropdown").length&&editingButton.addClass("hidden");var targetTilesSect=document.querySelector("section#tiles-section");new MutationObserver((function(){util.processAnimatedImages()})).observe(targetTilesSect,{childList:!0,subtree:!0}),function(){var i=0,checker=setInterval((function(){(i+=1)>15?clearInterval(checker):0!=$("button.atto_fullscreen_button").length&&0!=$("div.editor_atto").length&&($("button.atto_fullscreen_button").click((function(){$("div.editor_atto").css("background-color","#eee"),$("div.editor_atto").css("z-index","1")})),$("button.atto_html_button").click((function(){$("#id_introeditor").css("z-index","1")})),clearInterval(checker))}),2e3)}()})),accessibility.snapAxInit(),messages.init(),$("div#goto-top-link > a").click((function(){window.scrollTo({top:0,behavior:"smooth"}),$("body").find("a, [tabindex=0]").first().focus()}));var noneditingblocks={blockxp:"#page-blocks-xp-index"};for(var block in noneditingblocks){!0===$(noneditingblocks[block]).hasClass("editing")&&$(noneditingblocks[block]).removeClass("editing")}$(".togglecompletion").on("submit",(function(){!0===$(".togglecompletion").hasClass("forcereload")&&setTimeout((function(){location.reload(!0)}),1500)})),document.body.classList.contains("snap-resource-card")||document.querySelectorAll(".activityiconcontainer.url").forEach((urlDiv=>{urlDiv.querySelector('img[src*="/theme/image.php/snap/core/"][src*="/f/"]')&&(urlDiv.style.backgroundColor="inherit")}))}}}));
+define("theme_snap/snap",["jquery","core/log","theme_snap/headroom","theme_snap/util","theme_snap/personal_menu","theme_snap/cover_image","theme_snap/progressbar","core/templates","core/str","theme_snap/accessibility","theme_snap/messages","theme_snap/scroll"],(function($,log,Headroom,util,personalMenu,coverImage,ProgressBar,templates,str,accessibility,messages,Scroll){M.theme_snap=M.theme_snap||{};log.disableAll(!0);var brandColorSuccess="",brandColorWarning="",GRADE_DISPLAY_TYPE_PERCENTAGE="",GRADE_DISPLAY_TYPE_PERCENTAGE_REAL="",GRADE_DISPLAY_TYPE_PERCENTAGE_LETTER="",GRADE_DISPLAY_TYPE_REAL="",GRADE_DISPLAY_TYPE_REAL_PERCENTAGE="",GRADE_DISPLAY_TYPE_REAL_LETTER="",getURLParams=function(href){var ta=href.split("?");if(ta.length<2)return!1;for(var urlparams=ta[1],items=(urlparams=urlparams.split("#")[0]).split("&"),params=[],i=0;i div.form-group.fitem"),savebuttonsformadvanced=$("div[role=main] .mform div.snap-form-advanced > div:nth-of-type(3)"),width=$(window).width();width<992?$(".snap-form-advanced").append(savebuttonsformrequired):width>992&&$(".snap-form-required fieldset#id_general").append(savebuttonsformadvanced)};const updateGraderHeadersTop=function(){const graderHeader=$(".path-grade-report-grader .gradeparent tr.heading");graderHeader.length&&graderHeader.css("top",$("#mr-nav").height()+"px")},regionMain=$('.path-grade-report-grader #region-main div[role="main"]');if(regionMain.length>0){regionMain[0].querySelector(".gradeparent")&®ionMain.addClass("snap-grade-reporter")}updateGraderHeadersTop();var onCoursePage=function(){return 0===$("body").attr("id").indexOf("page-course-view-")},processSearchString=function(searchString){return searchString=searchString.trim().toLowerCase()},createColoredDataCircle=function(nodePointer,dataCallback){let valueCallback=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;var circle=new ProgressBar.Circle(nodePointer,{color:"inherit",easing:"linear",strokeWidth:6,trailWidth:3,duration:1400,text:{value:"0"}}),value=$(nodePointer).attr("value")/100,endColor=brandColorSuccess;0===value||"-"===$(nodePointer).attr("value")?circle.setText("-"):($(nodePointer).attr("value")<50&&(endColor=brandColorWarning),circle.setText(dataCallback(nodePointer)));var valueAnimate=0;valueAnimate=null===valueCallback?value:valueCallback(nodePointer),circle.animate(valueAnimate,{from:{color:"#999"},to:{color:endColor},step:function(state,circle){circle.path.setAttribute("stroke",state.color)}})},addListeners=function(){$(document).on("click",[".chapters a",".section_footer a"," #toc-search-results a"].join(", "),(function(e){var href=this.getAttribute("href");window.history&&window.history.pushState?(history.pushState(null,null,href),$(window).trigger("hashchange"),e.preventDefault()):location.hash=href}));var myElement=document.querySelector("#mr-nav"),headroom=new Headroom(myElement,{tolerance:5,offset:100,classes:{initial:"headroom",pinned:"headroom--pinned",unpinned:"headroom--unpinned",top:"headroom--top",notTop:"headroom--not-top"},onPin:()=>{$(".snap-drawer-no-headroom").addClass("snap-drawer-headroom"),$(".snap-drawer-headroom").removeClass("snap-drawer-no-headroom")},onUnpin:()=>{$(".snap-drawer-headroom").addClass("snap-drawer-no-headroom"),$(".snap-drawer-no-headroom").removeClass("snap-drawer-headroom")}});$(".notloggedin").length||headroom.init();var dataList=$("#toc-searchables").find("li").clone(!0);$("#course-toc").on("keyup","#toc-search-input",(function(){!function(dataList){var i,ua=window.navigator.userAgent;(ua.indexOf("MSIE ")||ua.indexOf("Trident/"))&&(dataList=$("#toc-searchables").find("li").clone(!0));var searchString=$("#toc-search-input").val();if(0===(searchString=processSearchString(searchString)).length)$("#toc-search-results").html(""),$("#toc-search-input").removeClass("state-active");else{$("#toc-search-input").addClass("state-active");var matches=[];for(i=0;i-1&&matches.push(dataItem)}$("#toc-search-results").html(matches)}}(dataList)})),$("#course-toc").on("keydown","#toc-search-input",(function(e){9===(e.keyCode||e.which)&&$("#toc-search-results a").last().blur((function(){$(this).off("blur"),$("#toc-search-input").val(""),$("#toc-search-results").html(""),$("#toc-search-input").removeClass("state-active")}))})),$("#course-toc").on("click","#toc-search-results a",(function(){$("#toc-search-input").val(""),$("#toc-search-results").html(""),$("#toc-search-input").removeClass("state-active")})),$(document).on("click",(function(event){$(event.target).closest("#toc-search-input").length||($("#toc-search-input").val(""),$("#toc-search-results").html(""),$("#toc-search-input").removeClass("state-active"))})),$(document).on("click","#admin-menu-trigger, #toc-mobile-menu-toggle",(function(e){var href=this.getAttribute("href");"admin-menu-trigger"===this.getAttribute("id")&&($(this).toggleClass("active"),$("#page").toggleClass("offcanvas")),$(href).attr("tabindex","0"),$(href).toggleClass("state-visible").focus(),e.preventDefault(),0===$(".message-app.main").length&&document.dispatchEvent(new Event("messages-drawer:toggle"))})),$(document).on("click","#course-toc.state-visible a",(function(){$("#course-toc").removeClass("state-visible")})),$(document).on("click",".section_footer a, .chapter-title, .toc-footer a",(function(){const videos=$('[title="watch"], .video-js, iframe:not([id])');for(let i=0;i div > a[role="button"]');util.scrollToElement($news),$(".news-article").not($news).removeClass("state-expanded"),$(".news-article .toggle").not($newstoggle).attr("aria-expanded","false"),$('.news-article-message > div > a[role="button"]').not($newsclose).attr("aria-expanded","false"),$(".news-article-message").css("display","none"),$news.toggleClass("state-expanded"),$news.attr("state-expanded")||($news.focus(),$newstoggle.attr("aria-expanded","false"),$newsclose.attr("aria-expanded","false")),$(".state-expanded").find(".news-article-message").slideDown("fast",(function(){$news.is(".state-expanded")?($news.find(".news-article-message").focus(),$newstoggle.attr("aria-expanded","true"),$newsclose.attr("aria-expanded","true")):($news.focus(),$newstoggle.attr("aria-expanded","false"),$newsclose.attr("aria-expanded","false")),$(document).trigger("snapContentRevealed")})),e.preventDefault()})),$(document).on("click",".anim-play-button",(function(){$(this).parent().prev().css("visibility","visible")})),$(document).on("click",".anim-pause-button",(function(){$(this).parent().prev().css("visibility","hidden")})),(new Scroll).init(),$((function(){var supportsTouch=!1;if(("ontouchstart"in window||window.navigator.msPointerEnabled)&&(supportsTouch=!0),!supportsTouch){var tooltipNode=$('[data-toggle="tooltip"]');$.isFunction(tooltipNode.tooltip)&&tooltipNode.tooltip()}}))};return{snapInit:function(courseConfig,pageHasCourseContent,siteMaxBytes,forcePassChange,messageBadgeCountEnabled,userId,sitePolicyAcceptReqd,inAlternativeRole,brandColors,gradingConstants){brandColorSuccess=brandColors.success,brandColorWarning=brandColors.warning,GRADE_DISPLAY_TYPE_PERCENTAGE=gradingConstants.gradepercentage,GRADE_DISPLAY_TYPE_PERCENTAGE_REAL=gradingConstants.gradepercentagereal,GRADE_DISPLAY_TYPE_PERCENTAGE_LETTER=gradingConstants.gradepercentageletter,GRADE_DISPLAY_TYPE_REAL=gradingConstants.gradereal,GRADE_DISPLAY_TYPE_REAL_PERCENTAGE=gradingConstants.graderealpercentage,GRADE_DISPLAY_TYPE_REAL_LETTER=gradingConstants.graderealletter,M.cfg.context=courseConfig.contextid,M.snapTheme={forcePassChange:forcePassChange},personalMenu.init(sitePolicyAcceptReqd),pageHasCourseContent&&require(["theme_snap/course-lazy"],(function(CourseLibAmd){!function(courseLib){var lastHash=location.hash;$(window).on("popstate hashchange",(function(e){var newHash=location.hash;log.info("hashchange"),newHash!==lastHash&&("#primary-nav"===location.hash?personalMenu.update():($("#page, #moodle-footer, #js-snap-pm-trigger, #logo, .skiplinks").css("display",""),onCoursePage()&&(log.info("show section",e.target),courseLib.showSection()))),lastHash=newHash}))}(new CourseLibAmd(courseConfig))})),$(document).ready((function(){var extraclasses;!function(){var xdebugs=$(".xdebug-error");if(xdebugs.length)for(var x=0;x