{"version":3,"file":"popup.min.js","sources":["https:\/\/moodle.tau.ac.il\/2023\/course\/format\/grid\/amd\/src\/popup.js"],"sourcesContent":["\/\/ This file is part of Moodle - http:\/\/moodle.org\/\n\/\/\n\/\/ Moodle is free software: you can redistribute it and\/or modify\n\/\/ it under the terms of the GNU General Public License as published by\n\/\/ the Free Software Foundation, either version 3 of the License, or\n\/\/ (at your option) any later version.\n\/\/\n\/\/ Moodle is distributed in the hope that it will be useful,\n\/\/ but WITHOUT ANY WARRANTY; without even the implied warranty of\n\/\/ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\/\/ GNU General Public License for more details.\n\/\/\n\/\/ You should have received a copy of the GNU General Public License\n\/\/ along with Moodle. If not, see .\n\n\/**\n * JS module for the course homepage.\n *\n * @module core_course\/view\n * @copyright 2021 Jun Pataleta \n * @license http:\/\/www.gnu.org\/copyleft\/gpl.html GNU GPL v3 or later\n *\/\n\nimport * as CourseEvents from 'core_course\/events';\nimport jQuery from 'jquery';\n\n\/**\n * Whether the event listener has already been registered for this module.\n *\n * @type {boolean}\n *\/\nlet registered = false;\n\n\/**\n * If the manualCompletionToggled event has fired.\n *\n * @type {boolean}\n *\/\nlet mctFired = false;\n\n\/**\n * Function to intialise and register event listeners for this module.\n *\n * @param {boolean} showcompletion Show completion is on.\n *\/\nexport const init = (showcompletion) => {\n if (registered) {\n return;\n }\n \/\/ Listen for toggled manual completion states of activities.\n document.addEventListener(CourseEvents.manualCompletionToggled, () => {\n mctFired = true;\n });\n registered = true;\n\n jQuery('#gridPopup').on('show.bs.modal', function(event) {\n var trigger = jQuery(event.relatedTarget);\n var section = trigger.data('section');\n\n var gml = jQuery('#gridPopupLabel');\n var triggersectionname = jQuery('#gridpopupsection-' + section).data('sectiontitle');\n gml.text(triggersectionname);\n\n var modal = jQuery(this);\n modal.find('#gridpopupsection-' + section).addClass('active');\n\n jQuery('#gridPopupCarousel').on('slid.bs.carousel', function() {\n var sno = jQuery('.gridcarousel-item.active').data('sectiontitle');\n gml.text(sno);\n });\n });\n jQuery('#gridPopup').on('hidden.bs.modal', function() {\n jQuery('.gridcarousel-item').removeClass('active');\n if (showcompletion && mctFired) {\n mctFired = false;\n window.location.reload();\n }\n });\n};\n"],"names":["registered","mctFired","showcompletion","document","addEventListener","CourseEvents","manualCompletionToggled","on","event","section","relatedTarget","data","gml","triggersectionname","text","this","find","addClass","sno","removeClass","window","location","reload"],"mappings":";;;;;;;gFA+BIA,YAAa,EAObC,UAAW,gBAOMC,iBACbF,aAIJG,SAASC,iBAAiBC,aAAaC,yBAAyB,KAC5DL,UAAW,CAAX,IAEJD,YAAa,sBAEN,cAAcO,GAAG,iBAAiB,SAASC,WAE1CC,SADU,mBAAOD,MAAME,eACLC,KAAK,WAEvBC,KAAM,mBAAO,mBACbC,oBAAqB,mBAAO,qBAAuBJ,SAASE,KAAK,gBACrEC,IAAIE,KAAKD,qBAEG,mBAAOE,MACbC,KAAK,qBAAuBP,SAASQ,SAAS,8BAE7C,sBAAsBV,GAAG,oBAAoB,eAC5CW,KAAM,mBAAO,6BAA6BP,KAAK,gBACnDC,IAAIE,KAAKI,+BAGV,cAAcX,GAAG,mBAAmB,+BAChC,sBAAsBY,YAAY,UACrCjB,gBAAkBD,WAClBA,UAAW,EACXmB,OAAOC,SAASC"}