/** * Provide global helper code to enhance page elements. * * @module core/page_global * @copyright 2018 Ryan Wyllie * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define("core/page_global",["jquery","core/custom_interaction_events","core/str","core/network"],(function($,CustomEvents,Str,Network){return{init:function(){var body;body=$("body"),CustomEvents.define(body,[CustomEvents.events.activate]),body.on(CustomEvents.events.activate,"[data-show-active-item]",(function(e){var option=$(e.target).closest(".dropdown-item"),menuContainer=option.closest("[data-show-active-item]");if(option.hasClass("dropdown-item")&&!option.hasClass("active")){var dropdownItems=menuContainer.find(".dropdown-item");dropdownItems.removeClass("active"),dropdownItems.removeAttr("aria-current"),menuContainer.attr("data-skip-active-class")||option.addClass("active"),option.attr("aria-current",!0);var activeOptionText=option.text(),dropdownToggle=menuContainer.parent().find('[data-toggle="dropdown"]'),dropdownToggleText=dropdownToggle.find("[data-active-item-text]");dropdownToggleText.length?dropdownToggleText.html(activeOptionText):dropdownToggle.html(activeOptionText);var activeItemAriaLabelComponent=menuContainer.attr("data-active-item-button-aria-label-components");if(activeItemAriaLabelComponent){var strParams=activeItemAriaLabelComponent.split(",");strParams.push(activeOptionText),Str.get_string(strParams[0].trim(),strParams[1].trim(),strParams[2].trim()).then((function(string){return dropdownToggle.attr("aria-label",string),string})).catch((function(){return!1}))}}})),Network.init()}}})); //# sourceMappingURL=page_global.min.js.map