Your IP : 192.168.165.1


Current Path : C:/Users/Mahmood/Desktop/moodle/lib/amd/build/
Upload File :
Current File : C:/Users/Mahmood/Desktop/moodle/lib/amd/build/userfeedback.min.js.map

{"version":3,"sources":["../src/userfeedback.js"],"names":["Selectors","regions","root","actions","give","remind","registerEventListeners","document","addEventListener","e","giveAction","target","closest","preventDefault","window","open","href","Error","Promise","resolve","then","hideRoot","recordAction","catch","Notification","exception","remindAction","clickedItem","dataset","record","Ajax","call","methodname","args","action","contextid","M","cfg","hide","remove"],"mappings":"sLAuBA,OACA,O,mDAEA,GAAMA,CAAAA,CAAS,CAAG,CACdC,OAAO,CAAE,CACLC,IAAI,CAAE,qCADD,CADK,CAIdC,OAAO,CAAE,EAJK,CAAlB,CAMAH,CAAS,CAACG,OAAV,CAAkBC,IAAlB,WAA4BJ,CAAS,CAACC,OAAV,CAAkBC,IAA9C,4BACAF,CAAS,CAACG,OAAV,CAAkBE,MAAlB,WAA8BL,CAAS,CAACC,OAAV,CAAkBC,IAAhD,8B,yBAKsC,QAAzBI,CAAAA,sBAAyB,EAAM,CACxCC,QAAQ,CAACC,gBAAT,CAA0B,OAA1B,CAAmC,SAAAC,CAAC,CAAI,CACpC,GAAMC,CAAAA,CAAU,CAAGD,CAAC,CAACE,MAAF,CAASC,OAAT,CAAiBZ,CAAS,CAACG,OAAV,CAAkBC,IAAnC,CAAnB,CACA,GAAIM,CAAJ,CAAgB,CACZD,CAAC,CAACI,cAAF,GAEA,GAAI,CAACC,MAAM,CAACC,IAAP,CAAYL,CAAU,CAACM,IAAvB,CAAL,CAAmC,CAC/B,KAAM,IAAIC,CAAAA,KAAJ,CAAU,sBAAV,CACT,CAEDC,OAAO,CAACC,OAAR,CAAgBT,CAAhB,EACKU,IADL,CACUC,CADV,EAEKD,IAFL,CAEUE,CAFV,EAGKC,KAHL,CAGWC,UAAaC,SAHxB,CAIH,CAED,GAAMC,CAAAA,CAAY,CAAGjB,CAAC,CAACE,MAAF,CAASC,OAAT,CAAiBZ,CAAS,CAACG,OAAV,CAAkBE,MAAnC,CAArB,CACA,GAAIqB,CAAJ,CAAkB,CACdjB,CAAC,CAACI,cAAF,GAEAK,OAAO,CAACC,OAAR,CAAgBO,CAAhB,EACKN,IADL,CACUC,CADV,EAEKD,IAFL,CAEUE,CAFV,EAGKC,KAHL,CAGWC,UAAaC,SAHxB,CAIH,CACJ,CAxBD,CAyBH,C,IAQKH,CAAAA,CAAY,CAAG,SAAAK,CAAW,CAAI,CAChC,GAAIA,CAAW,CAACC,OAAZ,CAAoBC,MAAxB,CAAgC,CAC5B,MAAOC,WAAKC,IAAL,CAAU,CAAC,CACdC,UAAU,CAAE,wCADE,CAEdC,IAAI,CAAE,CACFC,MAAM,CAAEP,CAAW,CAACC,OAAZ,CAAoBM,MAD1B,CAEFC,SAAS,CAAEC,CAAC,CAACC,GAAF,CAAMF,SAFf,CAFQ,CAAD,CAAV,EAMH,CANG,CAOV,CAED,MAAOjB,CAAAA,OAAO,CAACC,OAAR,EACV,C,CAQKE,CAAQ,CAAG,SAAAM,CAAW,CAAI,CAC5B,GAAIA,CAAW,CAACC,OAAZ,CAAoBU,IAAxB,CAA8B,CAC1BX,CAAW,CAACf,OAAZ,CAAoBZ,CAAS,CAACC,OAAV,CAAkBC,IAAtC,EAA4CqC,MAA5C,EACH,CAED,MAAOZ,CAAAA,CACV,C","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 * Handle clicking on action links of the feedback alert.\n *\n * @module     core/cta_feedback\n * @copyright  2020 Shamim Rezaie <shamim@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Ajax from 'core/ajax';\nimport Notification from 'core/notification';\n\nconst Selectors = {\n    regions: {\n        root: '[data-region=\"core/userfeedback\"]',\n    },\n    actions: {},\n};\nSelectors.actions.give = `${Selectors.regions.root} [data-action=\"give\"]`;\nSelectors.actions.remind = `${Selectors.regions.root} [data-action=\"remind\"]`;\n\n/**\n * Attach the necessary event handlers to the action links\n */\nexport const registerEventListeners = () => {\n    document.addEventListener('click', e => {\n        const giveAction = e.target.closest(Selectors.actions.give);\n        if (giveAction) {\n            e.preventDefault();\n\n            if (!window.open(giveAction.href)) {\n                throw new Error('Unable to open popup');\n            }\n\n            Promise.resolve(giveAction)\n                .then(hideRoot)\n                .then(recordAction)\n                .catch(Notification.exception);\n        }\n\n        const remindAction = e.target.closest(Selectors.actions.remind);\n        if (remindAction) {\n            e.preventDefault();\n\n            Promise.resolve(remindAction)\n                .then(hideRoot)\n                .then(recordAction)\n                .catch(Notification.exception);\n        }\n    });\n};\n\n/**\n * Record the action that the user took.\n *\n * @param {HTMLElement} clickedItem The action element that the user chose.\n * @returns {Promise}\n */\nconst recordAction = clickedItem => {\n    if (clickedItem.dataset.record) {\n        return Ajax.call([{\n            methodname: 'core_create_userfeedback_action_record',\n            args: {\n                action: clickedItem.dataset.action,\n                contextid: M.cfg.contextid,\n            }\n        }])[0];\n    }\n\n    return Promise.resolve();\n};\n\n/**\n * Hide the root node of the CTA notification.\n *\n * @param {HTMLElement} clickedItem The action element that the user chose.\n * @returns {HTMLElement}\n */\nconst hideRoot = clickedItem => {\n    if (clickedItem.dataset.hide) {\n        clickedItem.closest(Selectors.regions.root).remove();\n    }\n\n    return clickedItem;\n};\n"],"file":"userfeedback.min.js"}