Proyectos de Subversion Moodle

Rev

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

{"version":3,"file":"rooms.min.js","sources":["../src/rooms.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 * JS actions for the rooms page for mod_bigbluebuttonbn.\n *\n * @module      mod_bigbluebuttonbn/rooms\n * @copyright   2021 Blindside Networks Inc\n * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport './actions';\nimport * as repository from './repository';\nimport * as roomUpdater from './roomupdater';\nimport {\n    exception as displayException,\n    fetchNotifications,\n} from 'core/notification';\nimport Pending from 'core/pending';\nimport {getString} from 'core/str';\nimport {add as addToast} from 'core/toast';\nimport {eventTypes, notifyCurrentSessionEnded} from './events';\n\n/**\n * Init the room\n *\n * @param {Number} bigbluebuttonbnid bigblubeutton identifier\n * @param {Number} pollInterval poll interval in miliseconds\n */\nexport const init = (bigbluebuttonbnid, pollInterval) => {\n    const completionElement = document.querySelector('a[href*=completion_validate]');\n    if (completionElement) {\n        completionElement.addEventListener(\"click\", event => {\n            event.preventDefault();\n\n            const pendingPromise = new Pending('mod_bigbluebuttonbn/completion:validate');\n\n            repository.completionValidate(bigbluebuttonbnid)\n                .then(() => getString('completionvalidatestatetriggered', 'mod_bigbluebuttonbn'))\n                .then(str => addToast(str))\n                .then(() => pendingPromise.resolve())\n                .catch(displayException);\n        });\n    }\n\n    document.addEventListener('click', e => {\n        const joinButton = e.target.closest('[data-action=\"join\"]');\n        if (joinButton) {\n            window.open(joinButton.href, 'bigbluebutton_conference');\n            e.preventDefault();\n            // Gives the user a bit of time to go into the meeting before polling the room.\n            setTimeout(() => {\n                roomUpdater.updateRoom(true);\n            }, pollInterval);\n        }\n    });\n\n    document.addEventListener(eventTypes.sessionEnded, () => {\n        roomUpdater.stop();\n        roomUpdater.updateRoom();\n        fetchNotifications();\n    });\n\n    window.addEventListener(eventTypes.currentSessionEnded, () => {\n        roomUpdater.stop();\n        roomUpdater.updateRoom();\n        fetchNotifications();\n    });\n    // Room update.\n    roomUpdater.start(pollInterval);\n};\n\n/**\n * Auto close child windows when clicking the End meeting button.\n * @param {Number} closeDelay time to wait in miliseconds before closing the window\n */\nexport const setupWindowAutoClose = (closeDelay = 2000) => {\n    notifyCurrentSessionEnded(window.opener);\n    window.addEventListener('onbeforeunload', () => {\n            window.opener.setTimeout(() => {\n                roomUpdater.updateRoom(true);\n            }, closeDelay);\n        },\n        {\n            once: true\n        });\n    window.close(); // This does not work as scripts can only close windows that are opened by themselves.\n};\n"],"names":["bigbluebuttonbnid","pollInterval","completionElement","document","querySelector","addEventListener","event","preventDefault","pendingPromise","Pending","repository","completionValidate","then","str","resolve","catch","displayException","e","joinButton","target","closest","window","open","href","setTimeout","roomUpdater","updateRoom","eventTypes","sessionEnded","stop","currentSessionEnded","start","closeDelay","opener","once","close"],"mappings":";;;;;;;wRAyCoB,CAACA,kBAAmBC,sBAC9BC,kBAAoBC,SAASC,cAAc,gCAC7CF,mBACAA,kBAAkBG,iBAAiB,SAASC,QACxCA,MAAMC,uBAEAC,eAAiB,IAAIC,iBAAQ,2CAEnCC,WAAWC,mBAAmBX,mBACzBY,MAAK,KAAM,kBAAU,mCAAoC,yBACzDA,MAAKC,MAAO,cAASA,OACrBD,MAAK,IAAMJ,eAAeM,YAC1BC,MAAMC,4BAInBb,SAASE,iBAAiB,SAASY,UACzBC,WAAaD,EAAEE,OAAOC,QAAQ,wBAChCF,aACAG,OAAOC,KAAKJ,WAAWK,KAAM,4BAC7BN,EAAEV,iBAEFiB,YAAW,KACPC,YAAYC,YAAW,KACxBzB,kBAIXE,SAASE,iBAAiBsB,mBAAWC,cAAc,KAC/CH,YAAYI,OACZJ,YAAYC,uDAIhBL,OAAOhB,iBAAiBsB,mBAAWG,qBAAqB,KACpDL,YAAYI,OACZJ,YAAYC,uDAIhBD,YAAYM,MAAM9B,6CAOc,eAAC+B,kEAAa,0CACpBX,OAAOY,QACjCZ,OAAOhB,iBAAiB,kBAAkB,KAClCgB,OAAOY,OAAOT,YAAW,KACrBC,YAAYC,YAAW,KACxBM,cAEP,CACIE,MAAM,IAEdb,OAAOc"}