{"version":3,"file":"view.min.js","sources":["https:\/\/www.alsg.org\/home\/course\/amd\/src\/view.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';\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 * Function to intialise and register event listeners for this module.\n *\/\nexport const init = () => {\n if (registered) {\n return;\n }\n \/\/ Listen for toggled manual completion states of activities.\n document.addEventListener(CourseEvents.manualCompletionToggled, (e) => {\n const withAvailability = parseInt(e.detail.withAvailability);\n if (withAvailability) {\n \/\/ Reload the page when the toggled manual completion button has availability conditions linked to it.\n window.location.reload();\n }\n });\n registered = true;\n};\n"],"names":["registered","document","addEventListener","CourseEvents","manualCompletionToggled","e","parseInt","detail","withAvailability","window","location","reload"],"mappings":";;;;;;;wBA8BIA,YAAa,gBAKG,KACZA,aAIJC,SAASC,iBAAiBC,aAAaC,yBAA0BC,IACpCC,SAASD,EAAEE,OAAOC,mBAGvCC,OAAOC,SAASC,YAGxBX,YAAa"}