moodle/message/amd/build/message_user_button.min.js.map

1 line
6.3 KiB
Plaintext

{"version":3,"sources":["../src/message_user_button.js"],"names":["define","$","CustomEvents","MessageDrawerHelper","Templates","SELECTORS","MESSAGE_TEXTAREA","MESSAGE_USER_BUTTON","MESSAGE_JUMP","TEMPLATES","CONTENT","getUserId","element","parseInt","attr","getConversationId","send","args","conversationid","buttonid","userid","render","then","html","after","next","focus","events","activate","on","e","data","target","hasClass","hide","showConversation","createConversationWithUser","toggleClass","preventDefault","originalEvent"],"mappings":"AAsBAA,OAAM,oCAAC,CAAC,QAAD,CAAW,gCAAX,CAA6C,oCAA7C,CAAmF,gBAAnF,CAAD,CACF,SAASC,CAAT,CAAYC,CAAZ,CAA0BC,CAA1B,CAA+CC,CAA/C,CAA0D,IAGlDC,CAAAA,CAAS,CAAG,CACZC,gBAAgB,CAAE,oCADN,CAEZC,mBAAmB,CAAE,sBAFT,CAGZC,YAAY,CAAE,0BAHF,CAHsC,CASlDC,CAAS,CAAG,CACZC,OAAO,CAAE,6BADG,CATsC,CAmBlDC,CAAS,CAAG,SAASC,CAAT,CAAkB,CAC9B,MAAOC,CAAAA,QAAQ,CAACD,CAAO,CAACE,IAAR,CAAa,aAAb,CAAD,CAClB,CArBqD,CA6BlDC,CAAiB,CAAG,SAASH,CAAT,CAAkB,CACtC,MAAOC,CAAAA,QAAQ,CAACD,CAAO,CAACE,IAAR,CAAa,qBAAb,CAAD,CAClB,CA/BqD,CAgFtD,MAA6D,CACzDE,IAAI,CAzCG,QAAPA,CAAAA,IAAO,CAASJ,CAAT,CAAkB,CACzBA,CAAO,CAAGX,CAAC,CAACW,CAAD,CAAX,CAEA,GAAIK,CAAAA,CAAI,CAAG,CACPC,cAAc,CAAEH,CAAiB,CAACH,CAAD,CAD1B,CAEPO,QAAQ,CAAElB,CAAC,CAACW,CAAD,CAAD,CAAWE,IAAX,CAAgB,IAAhB,CAFH,CAGPM,MAAM,CAAET,CAAS,CAACC,CAAD,CAHV,CAAX,CAMAR,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I,CAACQ,aAAL,CAAmBD,cAAnB,EACH,CAhBD,CAiBH,CAE4D,CAGhE,CApFC,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 * Module to message a user from their profile page.\n *\n * @module core_message/message_user_button\n * @copyright 2019 Mark Nelson <markn@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/custom_interaction_events', 'core_message/message_drawer_helper', 'core/templates'],\n function($, CustomEvents, MessageDrawerHelper, Templates) {\n\n\n var SELECTORS = {\n MESSAGE_TEXTAREA: '[data-region=\"send-message-txt\"]',\n MESSAGE_USER_BUTTON: '#message-user-button',\n MESSAGE_JUMP: '[data-region=\"jumpto\"]'\n };\n\n var TEMPLATES = {\n CONTENT: 'core_message/message_jumpto'\n };\n\n /**\n * Get the id for the user being messaged.\n *\n * @param {object} element jQuery object for the button\n * @return {int}\n */\n var getUserId = function(element) {\n return parseInt(element.attr('data-userid'));\n };\n\n /**\n * Returns the conversation id, 0 if none.\n *\n * @param {object} element jQuery object for the button\n * @return {int}\n */\n var getConversationId = function(element) {\n return parseInt(element.attr('data-conversationid'));\n };\n\n /**\n * Handles opening the messaging drawer to send a\n * message to a given user.\n *\n * @method enhance\n * @param {object} element jQuery object for the button\n */\n var send = function(element) {\n element = $(element);\n\n var args = {\n conversationid: getConversationId(element),\n buttonid: $(element).attr('id'),\n userid: getUserId(element)\n };\n\n Templates.render(TEMPLATES.CONTENT, {})\n .then(function(html) {\n element.after(html);\n })\n .then(function() {\n $(SELECTORS.MESSAGE_USER_BUTTON).next().focus(function() {\n $(SELECTORS.MESSAGE_TEXTAREA).focus();\n });\n });\n\n CustomEvents.define(element, [CustomEvents.events.activate]);\n\n element.on(CustomEvents.events.activate, function(e, data) {\n if ($(e.target).hasClass('active')) {\n MessageDrawerHelper.hide();\n $(SELECTORS.MESSAGE_USER_BUTTON).next().attr('tabindex', -1);\n } else {\n $(SELECTORS.MESSAGE_USER_BUTTON).next().attr('tabindex', 0);\n if (args.conversationid) {\n MessageDrawerHelper.showConversation(args);\n } else {\n MessageDrawerHelper.createConversationWithUser(args);\n }\n }\n $(e.target).focus();\n $(e.target).toggleClass('active');\n e.preventDefault();\n data.originalEvent.preventDefault();\n });\n };\n\n return /** @alias module:core_message/message_user_button */ {\n send: send\n };\n });\n"],"file":"message_user_button.min.js"}