Current Path : C:/Users/Mahmood/Desktop/moodle/lib/amd/build/ |
Current File : C:/Users/Mahmood/Desktop/moodle/lib/amd/build/page_global.min.js.map |
{"version":3,"sources":["../src/page_global.js"],"names":["define","$","CustomEvents","Str","Network","initActionOptionDropdownHandler","body","events","activate","on","e","option","target","closest","menuContainer","hasClass","dropdownItems","find","removeClass","removeAttr","attr","addClass","activeOptionText","text","dropdownToggle","parent","dropdownToggleText","length","html","activeItemAriaLabelComponent","strParams","split","push","get_string","trim","then","string","catch","init"],"mappings":"AAuBAA,OAAM,oBACN,CACI,QADJ,CAEI,gCAFJ,CAGI,UAHJ,CAII,cAJJ,CADM,CAON,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKE,IAuBMC,CAAAA,CAA+B,CAAG,UAAW,CAC7C,GAAIC,CAAAA,CAAI,CAAGL,CAAC,CAAC,MAAD,CAAZ,CAEAC,CAAY,CAACF,MAAb,CAAoBM,CAApB,CAA0B,CAACJ,CAAY,CAACK,MAAb,CAAoBC,QAArB,CAA1B,EACAF,CAAI,CAACG,EAAL,CAAQP,CAAY,CAACK,MAAb,CAAoBC,QAA5B,CAAsC,yBAAtC,CAAiE,SAASE,CAAT,CAAY,IAErEC,CAAAA,CAAM,CAAGV,CAAC,CAACS,CAAC,CAACE,MAAH,CAAD,CAAYC,OAAZ,CAAoB,gBAApB,CAF4D,CAIrEC,CAAa,CAAGH,CAAM,CAACE,OAAP,CAAe,yBAAf,CAJqD,CAMzE,GAAI,CAACF,CAAM,CAACI,QAAP,CAAgB,eAAhB,CAAL,CAAuC,CAEnC,MACH,CAED,GAAIJ,CAAM,CAACI,QAAP,CAAgB,QAAhB,CAAJ,CAA+B,CAE3B,MACH,CAGD,GAAIC,CAAAA,CAAa,CAAGF,CAAa,CAACG,IAAd,CAAmB,gBAAnB,CAApB,CACAD,CAAa,CAACE,WAAd,CAA0B,QAA1B,EACAF,CAAa,CAACG,UAAd,CAAyB,cAAzB,EAEA,GAA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Content":["// 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 * Provide global helper code to enhance page elements.\n *\n * @module core/page_global\n * @package core\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/str',\n 'core/network'\n],\nfunction(\n $,\n CustomEvents,\n Str,\n Network\n) {\n\n /**\n * Add an event handler for dropdown menus that wish to show their active item\n * in the dropdown toggle element.\n *\n * By default the handler will add the \"active\" class to the selected dropdown\n * item and set it's text as the HTML for the dropdown toggle.\n *\n * The behaviour of this handler is controlled by adding data attributes to\n * the HTML and requires the typically Bootstrap dropdown markup.\n *\n * data-show-active-item - Add to the .dropdown-menu element to enable default\n * functionality.\n * data-skip-active-class - Add to the .dropdown-menu to prevent this code from\n * adding the active class to the dropdown items\n * data-active-item-text - Add to an element within the data-toggle=\"dropdown\" element\n * to use it as the active option text placeholder otherwise the\n * data-toggle=\"dropdown\" element itself will be used.\n * data-active-item-button-aria-label-components - String components to set the aria\n * lable on the dropdown button. The string will be given the\n * active item text.\n */\n var initActionOptionDropdownHandler = function() {\n var body = $('body');\n\n CustomEvents.define(body, [CustomEvents.events.activate]);\n body.on(CustomEvents.events.activate, '[data-show-active-item]', function(e) {\n // The dropdown item that the user clicked on.\n var option = $(e.target).closest('.dropdown-item');\n // The dropdown menu element.\n var menuContainer = option.closest('[data-show-active-item]');\n\n if (!option.hasClass('dropdown-item')) {\n // Ignore non Bootstrap dropdowns.\n return;\n }\n\n if (option.hasClass('active')) {\n // If it's already active then we don't need to do anything.\n return;\n }\n\n // Clear the active class from all other options.\n var dropdownItems = menuContainer.find('.dropdown-item');\n dropdownItems.removeClass('active');\n dropdownItems.removeAttr('aria-current');\n\n if (!menuContainer.attr('data-skip-active-class')) {\n // Make this option active unless configured to ignore it.\n // Some code, for example the Bootstrap tabs, may want to handle\n // adding the active class itself.\n option.addClass('active');\n }\n\n // Update aria attribute for active item.\n option.attr('aria-current', true);\n\n var activeOptionText = option.text();\n var dropdownToggle = menuContainer.parent().find('[data-toggle=\"dropdown\"]');\n var dropdownToggleText = dropdownToggle.find('[data-active-item-text]');\n\n if (dropdownToggleText.length) {\n // We have a specific placeholder for the active item text so\n // use that.\n dropdownToggleText.html(activeOptionText);\n } else {\n // Otherwise just replace all of the toggle text with the active item.\n dropdownToggle.html(activeOptionText);\n }\n\n var activeItemAriaLabelComponent = menuContainer.attr('data-active-item-button-aria-label-components');\n if (activeItemAriaLabelComponent) {\n // If we have string components for the aria label then load the string\n // and set the label on the dropdown toggle.\n var strParams = activeItemAriaLabelComponent.split(',');\n strParams.push(activeOptionText);\n\n Str.get_string(strParams[0].trim(), strParams[1].trim(), strParams[2].trim())\n .then(function(string) {\n dropdownToggle.attr('aria-label', string);\n return string;\n })\n .catch(function() {\n // Silently ignore that we couldn't load the string.\n return false;\n });\n }\n });\n };\n\n /**\n * Initialise the global helper functions.\n */\n var init = function() {\n initActionOptionDropdownHandler();\n Network.init();\n };\n\n return {\n init: init\n };\n});\n"],"file":"page_global.min.js"}