Rev 1 | AutorÃa | Comparar con el anterior | Ultima modificación | Ver Log |
{"version":3,"file":"feedback.min.js","sources":["../src/feedback.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 <http://www.gnu.org/licenses/>.\n\n/**\n * Backward compatibility file for the old popover.js\n *\n * @module qtype_multianswer/feedback\n * @copyright 2023 Jun Pataleta <jun@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport 'theme_boost/popover';\nimport Popover from 'theme_boost/bootstrap/popover';\n\n/** @property {object} Contains the list of selectors for this module. */\nconst SELECTORS = {\n FEEDBACK_TRIGGER: '.feedbacktrigger[data-bs-toggle=\"popover\"]',\n};\n\n/** @property {boolean} Flag to indicate whether the feedback popovers have been already initialised. */\nlet feedbackInitialised = false;\n\n/**\n * Function to initialise the feedback popovers.\n */\nconst initPopovers = () => {\n if (!feedbackInitialised) {\n const popoverTriggers = document.querySelectorAll(SELECTORS.FEEDBACK_TRIGGER);\n [...popoverTriggers].map((trigger) => new Popover(trigger));\n\n document.addEventListener('click', (e) => {\n if (e.target.closest(SELECTORS.FEEDBACK_TRIGGER)) {\n e.preventDefault();\n }\n });\n feedbackInitialised = true;\n }\n};\n\nexport default {\n initPopovers: initPopovers,\n};\n"],"names":["SELECTORS","feedbackInitialised","initPopovers","document","querySelectorAll","map","trigger","Popover","addEventListener","e","target","closest","preventDefault"],"mappings":";;;;;;;uJA2BMA,2BACgB,iDAIlBC,qBAAsB,eAmBX,CACXC,aAfiB,SACZD,oBAAqB,KACEE,SAASC,iBAAiBJ,6BAC7BK,KAAKC,SAAY,IAAIC,kBAAQD,WAElDH,SAASK,iBAAiB,SAAUC,IAC5BA,EAAEC,OAAOC,QAAQX,6BACjBS,EAAEG,oBAGVX,qBAAsB"}