Your IP : 216.73.216.95


Current Path : /var/www/ljmtc/cbt/message/amd/build/
Upload File :
Current File : /var/www/ljmtc/cbt/message/amd/build/message_popover.min.js.map

{"version":3,"sources":["../src/message_popover.js"],"names":["define","$","CustomEvents","PubSub","MessageDrawerEvents","SELECTORS","COUNT_CONTAINER","toggleMessageDrawerVisibility","buttonid","publish","TOGGLE_VISIBILITY","handleDecrementConversationCount","button","countContainer","find","count","parseInt","text","isNaN","addClass","registerEventListeners","events","activate","on","e","data","attr","focus","originalEvent","preventDefault","subscribe","CONVERSATION_READ","CONTACT_REQUEST_ACCEPTED","CONTACT_REQUEST_DECLINED","init"],"mappings":"AAsBAA,OAAM,gCACN,CACI,QADJ,CAEI,gCAFJ,CAGI,aAHJ,CAII,oCAJJ,CADM,CAON,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKE,IACMC,CAAAA,CAAS,CAAG,CACZC,eAAe,CAAE,mCADL,CADlB,CAUMC,CAA6B,CAAG,SAASC,CAAT,CAAmB,CACnDL,CAAM,CAACM,OAAP,CAAeL,CAAmB,CAACM,iBAAnC,CAAsDF,CAAtD,CACH,CAZH,CAqBMG,CAAgC,CAAG,SAASC,CAAT,CAAiB,CACpD,MAAO,WAAW,IACVC,CAAAA,CAAc,CAAGD,CAAM,CAACE,IAAP,CAAYT,CAAS,CAACC,eAAtB,CADP,CAEVS,CAAK,CAAGC,QAAQ,CAACH,CAAc,CAACI,IAAf,EAAD,CAAwB,EAAxB,CAFN,CAId,GAAIC,KAAK,CAACH,CAAD,CAAT,CAAkB,CACdF,CAAc,CAACM,QAAf,CAAwB,QAAxB,CACH,CAFD,IAEO,IAAI,CAACJ,CAAD,EAAkB,CAAR,CAAAA,CAAd,CAAyB,CAC5BF,CAAc,CAACM,QAAf,CAAwB,QAAxB,CACH,CAFM,IAEA,CACHJ,CAAK,CAAGA,CAAK,CAAG,CAAhB,CACAF,CAAc,CAACI,IAAf,CAAoBF,CAApB,CACH,CACJ,CACJ,CAnCH,CA2CMK,CAAsB,CAAG,SAASR,CAAT,CAAiB,CAC1CV,CAAY,CAACF,MAAb,CAAoBY,CAApB,CAA4B,CAACV,CAAY,CAACmB,MAAb,CAAoBC,QAArB,CAA5B,EAEAV,CAAM,CAACW,EAAP,CAAUrB,CAAY,CAACmB,MAAb,CAAoBC,QAA9B,CAAwC,SAASE,CAAT,CAAYC,CAAZ,CAAkB,CACtDlB,CAA6B,CAACK,CAAM,CAACc,IAAP,CAAY,IAAZ,CAAD,CAA7B,CACAd,CAAM,CAACe,KAAP,GACAF,CAAI,CAACG,aAAL,CAAmBC,cAAnB,EACH,CAJD,EAMA1B,CAAM,CAAC2B,SAAP,CAAiB1B,CAAmB,CAAC2B,iBAArC,CAAwDpB,CAAgC,CAACC,CAAD,CAAxF,EACAT,CAAM,CAAC2B,SAAP,CAAiB1B,CAAmB,CAAC4B,wBAArC,CAA+DrB,CAAgC,CAACC,CAAD,CAA/F,EACAT,CAAM,CAAC2B,SAAP,CAAiB1B,CAAmB,CAAC6B,wBAArC,CAA+DtB,CAAgC,CAACC,CAAD,CAA/F,CACH,CAvDH,CAmEE,MAAO,CACHsB,IAAI,CANG,QAAPA,CAAAA,IAAO,CAAStB,CAAT,CAAiB,CACxBA,CAAM,CAAGX,CAAC,CAACW,CAAD,CAAV,CACAQ,CAAsB,CAACR,CAAD,CACzB,CAEM,CAGV,CAlFK,CAAN","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 * Controls the message popover in the nav bar.\n *\n * @module     core_message/message_popover\n * @copyright  2018 Ryan Wyllie <ryan@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(\n[\n    'jquery',\n    'core/custom_interaction_events',\n    'core/pubsub',\n    'core_message/message_drawer_events'\n],\nfunction(\n    $,\n    CustomEvents,\n    PubSub,\n    MessageDrawerEvents\n) {\n    var SELECTORS = {\n        COUNT_CONTAINER: '[data-region=\"count-container\"]'\n    };\n\n    /**\n     * Toggle the message drawer visibility.\n     *\n     * @param {String} button The button id for the popover.\n     */\n    var toggleMessageDrawerVisibility = function(buttonid) {\n        PubSub.publish(MessageDrawerEvents.TOGGLE_VISIBILITY, buttonid);\n    };\n\n    /**\n     * Decrement the unread conversation count in the nav bar if a conversation\n     * is read. When there are no unread conversations then hide the counter.\n     *\n     * @param {Object} button The button element for the popover.\n     * @return {Function}\n     */\n    var handleDecrementConversationCount = function(button) {\n        return function() {\n            var countContainer = button.find(SELECTORS.COUNT_CONTAINER);\n            var count = parseInt(countContainer.text(), 10);\n\n            if (isNaN(count)) {\n                countContainer.addClass('hidden');\n            } else if (!count || count < 2) {\n                countContainer.addClass('hidden');\n            } else {\n                count = count - 1;\n                countContainer.text(count);\n            }\n        };\n    };\n\n    /**\n     * Add events listeners for when the popover icon is clicked and when conversations\n     * are read.\n     *\n     * @param {Object} button The button element for the popover.\n     */\n    var registerEventListeners = function(button) {\n        CustomEvents.define(button, [CustomEvents.events.activate]);\n\n        button.on(CustomEvents.events.activate, function(e, data) {\n            toggleMessageDrawerVisibility(button.attr('id'));\n            button.focus();\n            data.originalEvent.preventDefault();\n        });\n\n        PubSub.subscribe(MessageDrawerEvents.CONVERSATION_READ, handleDecrementConversationCount(button));\n        PubSub.subscribe(MessageDrawerEvents.CONTACT_REQUEST_ACCEPTED, handleDecrementConversationCount(button));\n        PubSub.subscribe(MessageDrawerEvents.CONTACT_REQUEST_DECLINED, handleDecrementConversationCount(button));\n    };\n\n    /**\n     * Initialise the message popover.\n     *\n     * @param {Object} button The button element for the popover.\n     */\n    var init = function(button) {\n        button = $(button);\n        registerEventListeners(button);\n    };\n\n    return {\n        init: init,\n    };\n});\n"],"file":"message_popover.min.js"}