%PDF- %PDF-
Direktori : /home/vacivi36/ava/question/bank/usage/amd/build/ |
Current File : /home/vacivi36/ava/question/bank/usage/amd/build/usage.min.js.map |
{"version":3,"file":"usage.min.js","sources":["../src/usage.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 * Usage column selector js.\n *\n * @module qbank_usage/usage\n * @copyright 2021 Catalyst IT Australia Pty Ltd\n * @author Safat Shahin <safatshahin@catalyst-au.net>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Fragment from 'core/fragment';\nimport ModalFactory from 'core/modal_factory';\nimport Notification from 'core/notification';\nimport * as Str from 'core/str';\n\n/**\n * Event listeners for the module.\n *\n * @method clickEvent\n * @param {int} questionId\n * @param {int} contextId\n */\nconst usageEvent = (questionId, contextId) => {\n let args = {\n questionid: questionId\n };\n ModalFactory.create({\n type: ModalFactory.types.CANCEL,\n title: Str.get_string('usageheader', 'qbank_usage'),\n body: Fragment.loadFragment('qbank_usage', 'question_usage', contextId, args),\n large: true,\n }).then((modal) => {\n modal.show();\n modal.getRoot().on('click', 'a[href].page-link', function(e) {\n e.preventDefault();\n let attr = e.target.getAttribute(\"href\");\n if (attr !== '#') {\n args.querystring = attr;\n modal.setBody(Fragment.loadFragment('qbank_usage', 'question_usage', contextId, args));\n }\n });\n // Version selection event.\n modal.getRoot().on('change', '#question_usage_version_dropdown', function(e) {\n args.questionid = e.target.value;\n modal.setBody(Fragment.loadFragment('qbank_usage', 'question_usage', contextId, args));\n });\n return modal;\n }).fail(Notification.exception);\n};\n\n/**\n * Entrypoint of the js.\n *\n * @method init\n * @param {string} questionSelector the question usage identifier.\n * @param {int} contextId the question context id.\n */\nexport const init = (questionSelector, contextId) => {\n let target = document.querySelector(questionSelector);\n let questionId = target.getAttribute('data-questionid');\n target.addEventListener('click', () => {\n // Call for the event listener to listed for clicks in any usage count row.\n usageEvent(questionId, contextId);\n });\n};\n"],"names":["questionSelector","contextId","target","document","querySelector","questionId","getAttribute","addEventListener","args","questionid","create","type","ModalFactory","types","CANCEL","title","Str","get_string","body","Fragment","loadFragment","large","then","modal","show","getRoot","on","e","preventDefault","attr","querystring","setBody","value","fail","Notification","exception","usageEvent"],"mappings":";;;;;;;;44BAuEoB,CAACA,iBAAkBC,iBAC/BC,OAASC,SAASC,cAAcJ,kBAChCK,WAAaH,OAAOI,aAAa,mBACrCJ,OAAOK,iBAAiB,SAAS,KAtClB,EAACF,WAAYJ,iBACxBO,KAAO,CACPC,WAAYJ,mCAEHK,OAAO,CAChBC,KAAMC,uBAAaC,MAAMC,OACzBC,MAAOC,IAAIC,WAAW,cAAe,eACrCC,KAAMC,kBAASC,aAAa,cAAe,iBAAkBnB,UAAWO,MACxEa,OAAO,IACRC,MAAMC,QACLA,MAAMC,OACND,MAAME,UAAUC,GAAG,QAAS,qBAAqB,SAASC,GACtDA,EAAEC,qBACEC,KAAOF,EAAEzB,OAAOI,aAAa,QACpB,MAATuB,OACArB,KAAKsB,YAAcD,KACnBN,MAAMQ,QAAQZ,kBAASC,aAAa,cAAe,iBAAkBnB,UAAWO,WAIxFe,MAAME,UAAUC,GAAG,SAAU,oCAAoC,SAASC,GACtEnB,KAAKC,WAAakB,EAAEzB,OAAO8B,MAC3BT,MAAMQ,QAAQZ,kBAASC,aAAa,cAAe,iBAAkBnB,UAAWO,UAE7Ee,SACRU,KAAKC,sBAAaC,YAejBC,CAAW/B,WAAYJ"}