1var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{ 2let window = _____WB$wombat$assign$function_____("window"); 3let self = _____WB$wombat$assign$function_____("self"); 4let document = _____WB$wombat$assign$function_____("document"); 5let location = _____WB$wombat$assign$function_____("location"); 6let top = _____WB$wombat$assign$function_____("top"); 7let parent = _____WB$wombat$assign$function_____("parent"); 8let frames = _____WB$wombat$assign$function_____("frames"); 9let opens = _____WB$wombat$assign$function_____("opens"); 10/* 11 * SmartMenus jQuery Bootstrap 4 Addon - v0.1.0+ 12 * http://www.smartmenus.org/ 13 * 14 * Copyright Vasil Dinkov, Vadikom Web Ltd. 15 * http://vadikom.com/ 16 * 17 * Released under the MIT license: 18 * http://www.opensource.org/licenses/MIT 19 */ 20 21(function(factory) { 22 if (typeof define === 'function' && define.amd) { 23 // AMD 24 define(['jquery', 'smartmenus'], factory); 25 } else if (typeof module === 'object' && typeof module.exports === 'object') { 26 // CommonJS 27 module.exports = factory(require('jquery')); 28 } else { 29 // Global jQuery 30 factory(jQuery); 31 } 32} (function($) { 33 34 $.extend($.SmartMenus.Bootstrap = {}, { 35 keydownFix: false, 36 init: function() { 37 // init all navbars that don't have the "data-sm-skip" attribute set 38 var $navbars = $('ul.navbar-nav:not([data-sm-skip])'); 39 $navbars.each(function() { 40 var $this = $(this), 41 obj = $this.data('smartmenus'); 42 // if this navbar is not initialized 43 if (!obj) { 44 var skipBehavior = $this.is('[data-sm-skip-collapsible-behavior]'), 45 rightAligned = $this.hasClass('ml-auto') || $this.prevAll('.mr-auto').length > 0; 46 47 $this.smartmenus({ 48 // these are some good default options that should work for all 49 subMenusSubOffsetX: 2, 50 subMenusSubOffsetY: -9, 51 subIndicators: !skipBehavior, 52 collapsibleShowFunction: null, 53 collapsibleHideFunction: null, 54 rightToLeftSubMenus: rightAligned, 55 bottomToTopSubMenus: $this.closest('.fixed-bottom').length > 0, 56 // custom option(s) for the Bootstrap 4 addon 57 bootstrapHighlightClasses: 'text-dark bg-light' 58 }) 59 .on({ 60 // set/unset proper Bootstrap classes for some menu elements 61 'show.smapi': function(e, menu) { 62 var $menu = $(menu), 63 $scrollArrows = $menu.dataSM('scroll-arrows'); 64 if ($scrollArrows) { 65 $scrollArrows.css('background-color', $menu.css('background-color')); 66 } 67 $menu.parent().addClass('show'); 68 if (obj.opts.keepHighlighted && $menu.dataSM('level') > 2) { 69 $menu.prevAll('a').addClass(obj.opts.bootstrapHighlightClasses); 70 } 71 }, 72 'hide.smapi': function(e, menu) { 73 var $menu = $(menu); 74 $menu.parent().removeClass('show'); 75 if (obj.opts.keepHighlighted && $menu.dataSM('level') > 2) { 76 $menu.prevAll('a').removeClass(obj.opts.bootstrapHighlightClasses); 77 } 78 } 79 }); 80 81 obj = $this.data('smartmenus'); 82 83 function onInit() { 84 // set Bootstrap's "active" class to SmartMenus "current" items (should someone decide to enable markCurrentItem: true) 85 $this.find('a.current').each(function() { 86 var $this = $(this); 87 // dropdown items require the class to be set to the A's while for nav items it should be set to the parent LI's 88 ($this.hasClass('dropdown-item') ? $this : $this.parent()).addClass('active'); 89 }); 90 // parent items fixes 91 $this.find('a.has-submenu').each(function() { 92 var $this = $(this); 93 // remove Bootstrap required attributes that might cause conflicting issues with the SmartMenus script 94 if ($this.is('[data-toggle="dropdown"]')) { 95 $this.dataSM('bs-data-toggle-dropdown', true).removeAttr('data-toggle'); 96 } 97 // remove Bootstrap's carets generating class 98 if (!skipBehavior && $this.hasClass('dropdown-toggle')) { 99 $this.dataSM('bs-dropdown-toggle', true).removeClass('dropdown-toggle'); 100 } 101 }); 102 } 103 104 onInit(); 105 106 function onBeforeDestroy() { 107 $this.find('a.current').each(function() { 108 var $this = $(this); 109 ($this.hasClass('active') ? $this : $this.parent()).removeClass('active'); 110 }); 111 $this.find('a.has-submenu').each(function() { 112 var $this = $(this); 113 if ($this.dataSM('bs-dropdown-toggle')) { 114 $this.addClass('dropdown-toggle').removeDataSM('bs-dropdown-toggle'); 115 } 116 if ($this.dataSM('bs-data-toggle-dropdown')) { 117 $this.attr('data-toggle', 'dropdown').removeDataSM('bs-data-toggle-dropdown'); 118 } 119 }); 120 } 121 122 // custom "refresh" method for Bootstrap 123 obj.refresh = function() { 124 $.SmartMenus.prototype.refresh.call(this); 125 onInit(); 126 // update collapsible detection 127 detectCollapsible(true); 128 }; 129 130 // custom "destroy" method for Bootstrap 131 obj.destroy = function(refresh) { 132 onBeforeDestroy(); 133 $.SmartMenus.prototype.destroy.call(this, refresh); 134 }; 135 136 // keep Bootstrap's default behavior (i.e. use the whole item area just as a sub menu toggle) 137 if (skipBehavior) { 138 obj.opts.collapsibleBehavior = 'toggle'; 139 } 140 141 // onresize detect when the navbar becomes collapsible and add it the "sm-collapsible" class 142 var winW; 143 function detectCollapsible(force) { 144 var newW = obj.getViewportWidth(); 145 if (newW != winW || force) { 146 if (obj.isCollapsible()) { 147 $this.addClass('sm-collapsible'); 148 } else { 149 $this.removeClass('sm-collapsible'); 150 } 151 winW = newW; 152 } 153 } 154 detectCollapsible(); 155 $(window).on('resize.smartmenus' + obj.rootId, detectCollapsible); 156 } 157 }); 158 // keydown fix for Bootstrap 4 conflict 159 if ($navbars.length && !$.SmartMenus.Bootstrap.keydownFix) { 160 // unhook BS keydown handler for all dropdowns 161 $(document).off('keydown.bs.dropdown.data-api', '.dropdown-menu'); 162 // restore BS keydown handler for dropdowns that are not inside SmartMenus navbars 163 // SmartMenus won't add the "show" class so it's handy here 164 if ($.fn.dropdown && $.fn.dropdown.Constructor && typeof $.fn.dropdown.Constructor._dataApiKeydownHandler == 'function') { 165 $(document).on('keydown.bs.dropdown.data-api', '.dropdown-menu.show', $.fn.dropdown.Constructor._dataApiKeydownHandler); 166 } 167 $.SmartMenus.Bootstrap.keydownFix = true; 168 } 169 } 170 }); 171 172 // init ondomready 173 $($.SmartMenus.Bootstrap.init); 174 175 return $; 176})); 177}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.