PageSourceSearch

https://smlny.com/wp-content/plugins/diviflash/public/js/df-menu-ext-script.js?ver=5.5.0

js smlny.com collected 2026-10-02 11:19:15 UTC 14,418 bytes, 287 lines download raw bytes

1(function($){
2    const dfMenuEx = {
3        navItem: $('.df-menu-nav li'),
4        mMenuButton: $('.df-mobile-menu-button'),
5        subMenu: $('.df-normal-menu-wrap .df-custom-submenu'),
6        ofcButton: $('.df-offcanvas-menu-button'),
7        ofcSubMenu: $('.df-offcanvas-menu .sub-menu'),
8        ofcbMenuItem: $('.df-offcanvas-menu .menu-item a'),
9        mSubMenu: $('.df-mobile-menu .sub-menu'),
10        fullWidthType: $('.df-normal-menu-wrap [data-menu-width-type="full_width"]'),
11        positionBottomCenter: $('.df-normal-menu-wrap [data-submenu-position="bottom_center"]'),
12        searchModalTriggerButton: $('.df-am-search-button'),
13        leftWidth: 460,
14        leftStatus: false,
15        init: function() {
16            this.subMenuReveal();
17            this.mobileMenuSlide();
18            this.revealOfc();
19            this.searchBoxModal();
20            this.megaMenuColumn();
21            this.hideOnSticky();
22            //this.button_show_on_hover_class_add();
23        },
24        hideOnSticky: function() {
25            $(window).on('scroll', function(ev){
26                if($('.et_pb_module').hasClass('et_pb_sticky')) {
27                    $('.hide_on_sticky').slideUp();
28                } else {
29                    $('.hide_on_sticky').slideDown();
30                }
31            })
32        },
33        megaMenuColumn: function() {
34            $('.df-normal-menu-wrap .df-mega-menu').each(function(i, ele) {
35                const _col_number = Number(ele.dataset.column);
36                let _c = 1;
37                $(this).find(".df-mega-menu-item>li").each(function(index, element){
38                    if(!$(this).attr("data-column")) {
39                        $(this).attr("data-column", _c);
40                        if(_c === _col_number) {
41                            _c = 1;
42                        } else {
43                            _c++;
44                        }
45                    }
46                });
47                if(!$(this).find('>ul:not(.df-vertical-menu-nav)').hasClass('col-added')) {
48                    $(this).find('li:not(.df-vertical-menu-item)[data-column="1"]').wrapAll('<div class="col col-1"></div>');
49                    $(this).find('li:not(.df-vertical-menu-item)[data-column="2"]').wrapAll('<div class="col col-2"></div>');
50                    $(this).find('li:not(.df-vertical-menu-item)[data-column="3"]').wrapAll('<div class="col col-3"></div>');
51                    $(this).find('li:not(.df-vertical-menu-item)[data-column="4"]').wrapAll('<div class="col col-4"></div>');
52                    $(this).find('li:not(.df-vertical-menu-item)[data-column="5"]').wrapAll('<div class="col col-5"></div>');
53                    $(this).find('li:not(.df-vertical-menu-item)[data-column="6"]').wrapAll('<div class="col col-6"></div>');
54                    $(this).find('li:not(.df-vertical-menu-item)[data-column="7"]').wrapAll('<div class="col col-7"></div>');
55                    $(this).find('>ul:not(.df-vertical-menu-nav)').addClass('col-added');
56                }
57            })
58        },
59        megaMenu: function($obj) {
60            if($obj.hasClass('df-mega-menu')) {
61                var _dataSet = $obj[0].dataset;
62                var offsetLeft = $obj.offset().left;
63                var containerOffsetLeft = $obj.closest('.row-inner').offset().left;
64
65                if( _dataSet.width === 'full_width' ) {
66                    $obj.find(">.sub-menu")
67                        .css('width', $(window).width())
68                        .css('left', `-${$obj.offset().left}px`);
69                } else if ( _dataSet.width === 'custom_width' ) {
70                    var _width = _dataSet.widthValue ? parseInt(_dataSet.widthValue) : '270';
71                    var _left = '0';
72                    if( _dataSet.alignment === 'bottom_center' ) {
73                        _left = `-${Number(_width)/2 - ($obj.width() /2)}`;
74                    } else if ( _dataSet.alignment === 'bottom_right' ) {
75                        _left = `-${Number(_width) - $obj.width()}`;
76                    }
77                    $obj.find(">.sub-menu")
78                        .css('width', _width)
79                        .css('left', `${_left}px`);
80                } else {
81                    $obj.find(">.sub-menu")
82                        .css('width', $obj.closest('.row-inner').width())
83                        .css('left', -`${offsetLeft - containerOffsetLeft}`);
84                }
85                $obj.find(">.sub-menu").css('display', '')
86            }
87        },
88        megaMenuHide: function($obj) {
89            if($obj.hasClass('df-mega-menu')) {
90                $obj.find(">.sub-menu")
91                    .css('width', '')
92                    .css('left', '')
93                    .css('display', 'none');
94            }
95        },
96        subMenuReveal: function() {
97            $('.df-mega-menu > .sub-menu').addClass('df-mega-menu-item');
98            $('.df-mega-menu > .sub-menu .sub-menu').addClass('df-inside-mega-menu');
99            $('.df-normal-menu-wrap .df-menu-nav > li.menu-item-has-children').each(function(index, ele){
100                var $this = $(this);
101                const isInsideMegaMenu = $this.parent().hasClass('df-mega-menu-item') || $this.parent().hasClass('df-inside-mega-menu') || $this.parent().hasClass('col') ? true : false;
102                if(!isInsideMegaMenu && !$this.hasClass('df-mega-menu')) {
103                    var $sub = $this.find('> .sub-menu');
104                    if(!$sub.length) { return; }
105                    var subWidth = $sub.outerWidth() || 240;
106                    if( ele.getBoundingClientRect().left + subWidth > $(window).width() ) {
107                       $this.addClass('df-submenu-reverse');
108                    }
109                }
110            });
111
112            $('.df-normal-menu-wrap .df-menu-nav').on({
113                mouseenter: function() {
114                    var _this = $(this);
115                    const isInsideMegaMenu = _this.parent().hasClass('df-mega-menu-item') || _this.parent().hasClass('df-inside-mega-menu') || _this.parent().hasClass('col') ? true : false;
116                    dfMenuEx.megaMenu(_this);
117                    _this.css('overflow', 'visible');
118                    if(!isInsideMegaMenu) {
119                        _this.addClass('df-hover')
120                            .addClass('df-show-dropdown');
121                    }
122                    if(_this.hasClass('menu-item-level-0')) {
123                        const _zIndex = _this.closest('.et_pb_section').css('z-index');
124                        if(_zIndex === 'auto') {
125                            _this.closest('.et_pb_section').css('z-index', '999');
126                        } else {
127                            _this.closest('.et_pb_section').css('z-index', _zIndex);
128                        }
129                        if(!_this.hasClass('df-mega-menu') && _this.hasClass('df-submenu-reverse')){
130                            _this.find('>.sub-menu').css('right', '0');
131                            _this.find('>.sub-menu').css('left', 'auto');
132                        }
133                    } else {
134                        if(!isInsideMegaMenu) {
135                            if(_this.closest('li.df-submenu-reverse').length){
136                                _this.find('>.sub-menu').css('right', _this.outerWidth());
137                                _this.find('>.sub-menu').css('left', 'auto');
138                            }else{
139                                _this.find('>.sub-menu').css('left', _this.outerWidth());
140                            }
141                        }
142                    }
143                    _this.find(">.sub-menu").addClass('df-hover');
144                },
145                mouseleave: function () {
146                    var _this = $(this);
147                    dfMenuEx.megaMenuHide(_this);
148                    const isInsideMegaMenu = _this.parent().hasClass('df-mega-menu-item') || _this.parent().hasClass('df-inside-mega-menu') || _this.parent().hasClass('col') ? true : false;
149                    if(!isInsideMegaMenu) {
150                        _this.removeClass('df-hover')
151                            .removeClass('df-show-dropdown');
152                    }
153                    setTimeout(function(){
154                        if(!_this.hasClass('df-show-dropdown')) {
155                            _this.find(">.sub-menu").removeClass('df-hover');
156                        }
157                    }, 200);
158                }
159            }, 'li');
160
161            $('.sub-menu').on({
162                mouseenter: function() {
163                    $(this).css('z-index', '99');
164                },
165                mouseleave: function () {
166                    $(this).css('z-index', '');
167                }
168            }, '.col');
169        },
170        revealOfc: function() {
171            dfMenuEx.ofcButton.on('click', function(ev) {
172                ev.preventDefault();
173                var ofcClass = $(`.df-offcanvas-wrap[data-menu="${ev.target.dataset.menu}"]`);
174                ofcClass.toggleClass('df-menu-show');
175                ofcClass.css('z-index', '999999');
176                ofcClass.find('.df-ofc-close').on('click', function() {
177                    ofcClass.removeClass('df-menu-show');
178                })
179            })
180            dfMenuEx.ofcSubMenuReveal();
181        },
182        ofcSubMenuReveal: function() {
183            dfMenuEx.ofcbMenuItem.on('click', function(ev) {
184                if(ev.originalEvent.detail === 2 ) return;
185                var _this = $(this);
186                var item = _this.siblings('.sub-menu');
187                if(item.length > 0) {
188                    ev.preventDefault();
189                    _this.siblings('.sub-menu').toggleClass('open');
190                    _this.siblings('.sub-menu').slideToggle("slow")
191                }
192            })
193        },
194        mSubmenuReveal: function() {
195            dfMenuEx.mSubMenu.each(function(){
196                var $this = $(this);
197                $this.siblings("a").on('click', function(ev){
198                    $this.parent().siblings().find('> .sub-menu').slideUp('slow').parent().removeClass('df-show-dropdown');
199                    if(ev.originalEvent.detail === 2 ) return;
200                    ev.preventDefault();
201                    $this.slideToggle("slow");
202                    $(this).parent().toggleClass('df-show-dropdown');
203                })
204            })
205        },
206        mobileMenuSlide: function() {
207            dfMenuEx.mMenuButton.on('click', function(ev){
208                ev.preventDefault();
209                var mobileMenuClass = ev.target.dataset.menu;
210                let parentSection = $(this).closest('.difl_advancedmenu');
211                parentSection.find(`.${mobileMenuClass}`).slideToggle('slow')
212                    .closest('.et_pb_section:not(.et_pb_sticky_module)').css('z-index', '99');
213
214                const open_status = ev.target.dataset.open;
215                const inner_content = 'off' === open_status ? $(ev.target).html() : ev.target.dataset.content;
216
217                $(this).html('off' === open_status ? 'M' : inner_content)
218                    .attr("style", 'off' === open_status ? "font-family:ETmodules !important;" : "")
219                    .attr('data-content', 'off' === open_status ? inner_content : '')
220                    .removeAttr('on' === open_status ? "data-content" : "")
221                    .removeAttr('on' === open_status ? "style" : "");
222
223                $(this).attr('data-open', ('on' === open_status) ? 'off' : 'on');
224            })
225            dfMenuEx.mSubmenuReveal();
226            dfMenuEx.mMenuScrollableItemClickControll();
227        },
228        searchBoxModal: function() {
229            $('.df-searchbox-style-5.df-am-search').css('opacity', 1);
230            $(document).click(function(event) {
231                const target = event.target;
232                const $popup = $('.df-searchbox-style-5.df-am-search.show');
233                if(!target.classList.value.includes('df-am-search-button')) {
234                    if (!$popup.is(target) && !$popup.has(target).length) {
235                        $popup.removeClass('show');
236                    }
237                }
238            })
239            dfMenuEx.searchModalTriggerButton.on('click', function(ev){
240                var searchModal = ev.target.dataset.search;
241                $(`.${searchModal}_modal`).toggleClass('show');
242            })
243            $('.serach-box-close').on('click', function(){
244                $(this).parent().removeClass('show');
245            })
246        },
247        button_show_on_hover_class_add: function(){
248            var selectors = document.querySelectorAll('.difl_advancedmenu');
249            [].forEach.call(selectors, function (selector, index) {
250                var elements = selector.querySelectorAll('.df-am-col.right .df-menu-button.show_icon_on_hover');
251                // Check if any elements were found
252                if (elements.length > 0) {
253                    selector.querySelector('.df-am-col.right').classList.add('show_icon_on_hover');
254                }
255
256
257            });
258        },
259        mMenuScrollableItemClickControll: function (){
260            $(".df-mobile-menu li:not(:has(.sub-menu)) a").on('click', function(ev){
261                const select_parent = parent_selector($(this));
262                $(select_parent[0]).slideToggle('slow');
263                let menuClass = select_parent[0].classList.value.split(" ").filter(function (class_name) {
264                    return class_name.indexOf('difl_advancedmenu_') !== -1;
265                });
266                if(menuClass.length === 0) {
267                    menuClass = select_parent[0].classList.value.split(" ").filter(function (class_name) {
268                        return class_name.indexOf('difl_advancedmenuitem_') !== -1;
269                    });
270                }
271
272                const menu_button = $(`button.df-mobile-menu-button[data-menu="${menuClass[0]}"][data-open="on"]`);
273                $(menu_button[0]).html('a');
274                $(menu_button[0]).attr('data-open', 'off');
275                function parent_selector(data) {
276                    if($(data).parent().hasClass("df-mobile-menu")){
277                        return $(data).parent();
278                    }
279                    return parent_selector($(data).parent());
280                }
281            });
282        }
283    }
284    document.addEventListener( 'DOMContentLoaded', () => {
285        dfMenuEx.init();
286    } );
287})(jQuery)

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.