Proyectos de Subversion Moodle

Rev

Autoría | Ultima modificación | Ver Log |

{"version":3,"file":"actions.min.js","sources":["../src/actions.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 * JS actions.\n *\n * @module      mod_bigbluebuttonbn/actions\n * @copyright   2021 Blindside Networks Inc\n * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {endMeeting as requestEndMeeting} from './repository';\nimport {\n    exception as displayException,\n    saveCancel,\n} from 'core/notification';\nimport {notifySessionEnded} from './events';\nimport {getString} from 'core/str';\n\nconst confirmedPromise = (title, question, saveLabel) => new Promise(resolve => {\n    saveCancel(title, question, saveLabel, resolve);\n});\n\nconst registerEventListeners = () => {\n    document.addEventListener('click', e => {\n        const actionButton = e.target.closest('.bbb-btn-action[data-action=\"end\"]');\n        if (!actionButton) {\n            return;\n        }\n\n        e.preventDefault();\n\n        const bbbId = actionButton.dataset.bbbId;\n        const groupId = actionButton.dataset.groupId ? actionButton.dataset.groupId : 0;\n\n        confirmedPromise(\n            getString('end_session_confirm_title', 'mod_bigbluebuttonbn'),\n            getString('end_session_confirm', 'mod_bigbluebuttonbn'),\n            getString('yes', 'moodle')\n        )\n        .then(() => requestEndMeeting(bbbId, groupId))\n        .then(() => {\n            notifySessionEnded(bbbId, groupId);\n\n            return;\n        })\n        .catch(displayException);\n    });\n};\n\nlet listening = false;\nif (!listening) {\n    registerEventListeners();\n    listening = true;\n}\n"],"names":["listening","document","addEventListener","e","actionButton","target","closest","preventDefault","bbbId","dataset","groupId","title","question","saveLabel","Promise","resolve","then","catch","displayException","registerEventListeners"],"mappings":"sJA6DIA,WAAY,EACXA,YA5B0B,MAC3BC,SAASC,iBAAiB,SAASC,UACzBC,aAAeD,EAAEE,OAAOC,QAAQ,0CACjCF,oBAILD,EAAEI,uBAEIC,MAAQJ,aAAaK,QAAQD,MAC7BE,QAAUN,aAAaK,QAAQC,QAAUN,aAAaK,QAAQC,QAAU,EAd7D,IAACC,MAAOC,SAAUC,WAAjBF,OAiBd,kBAAU,4BAA6B,uBAjBlBC,UAkBrB,kBAAU,sBAAuB,uBAlBFC,WAmB/B,kBAAU,MAAO,UAnB4B,IAAIC,SAAQC,uCACtDJ,MAAOC,SAAUC,UAAWE,aAoBlCC,MAAK,KAAM,0BAAkBR,MAAOE,WACpCM,MAAK,oCACiBR,MAAOE,YAI7BO,MAAMC,6BAMXC,GACAnB,WAAY"}