PageSourceSearch

https://4comply.io/wp-content/plugins/mfn-header-builder/functions/assets/scripts.js?ver=1.0.7.3

js 4comply.io collected 2026-10-07 00:42:14 UTC 4,856 bytes, 273 lines download raw bytes

1/**
2 * BeTheme Header Builder
3 *
4 * @package Betheme
5 * @author Muffin group
6 * @link https://muffingroup.com
7 */
8
9(function($) {
10
11  /* globals jQuery */
12
13  "use strict";
14
15  var Mfn_HB = (function($) {
16
17    /**
18     * Init
19     */
20
21    function init() {
22
23      menu.init();
24      menu.onePage();
25
26      bind();
27
28    }
29
30    /**
31     * Menu related functions
32     */
33
34    var menu = {
35
36      init: function() {
37
38        var mobileInit = '';
39
40        $('.mhb-menu ul.menu').each(function(index) {
41
42          if ($(this).parent().hasClass('tabletMobile')) {
43            mobileInit = 959;
44          } else {
45            mobileInit = 768;
46          }
47
48          $(this).mfnMenu({
49            addLast: false,
50            arrows: false,
51            responsive: true,
52            mobileInit: mobileInit
53          });
54
55        });
56
57      },
58
59      toggle: function(button) {
60
61        var menu = $(button).siblings('ul.menu');
62
63        menu.stop(true, true).slideToggle(200);
64
65      },
66
67      onePage: function() {
68
69        if( ! $('body').hasClass('one-page') ){
70          return false;
71        }
72
73        $('.mhb-menu ul.menu').each(function(index) {
74
75          var menu = $(this);
76
77          // add attr [data-hash] & [data-id]
78
79          $('a[href]', menu).each(function() {
80
81            var url = $(this).attr('href');
82            if (url && url.split('#')[1]) {
83
84              // data-hash
85              var hash = '#' + url.split('#')[1];
86              if (hash && $(hash).length) {
87                // check if element with specified ID exists
88                $(this).attr('data-hash', hash);
89                $(hash).attr('data-id', hash);
90              }
91
92            }
93
94          });
95
96          // click
97
98          $('a[data-hash]', menu).on('click', function(e) {
99
100            e.preventDefault();
101
102            var currentView = $('.mhb-view').filter(':visible');
103            var hash = $(this).attr('data-hash');
104
105            hash = '[data-id="' + hash + '"]';
106
107            // offset
108
109            var headerH = currentView.height() || 0;
110            var adminBarH = $('#wpadminbar').height() || 0;
111
112            var offset = headerH + adminBarH;
113
114            // animate scroll
115
116            $('html, body').animate({
117              scrollTop: $(hash).offset().top - offset
118            }, 500);
119
120          });
121
122        });
123
124      }
125
126    };
127
128    /**
129     * Retina logo
130     */
131
132    function retinaLogo() {
133
134      if (window.devicePixelRatio > 1) {
135
136        $('.mhb-logo img[data-retina]').each(function() {
137
138          var height = 0;
139
140          if (!$(this).data('retina')) {
141            return false;
142          }
143
144          if (!$(this).attr('height')) {
145            height = $(this).height() || 0;
146          }
147
148          $(this).attr('src', $(this).data('retina'));
149
150          if (height) {
151            $(this).attr('height', height);
152          }
153
154        });
155
156      }
157
158    }
159
160    /**
161     * Sticky header
162     */
163
164    var sticky = {
165
166      init: function() {
167
168        var sticky_wrapper = $('.mhb-grid');
169        var start_y = 0;
170        var window_y = $(window).scrollTop();
171        var current_view = $('.mhb-view').filter(':visible');
172
173        if (window_y > start_y) {
174
175          if (!sticky_wrapper.hasClass('is-sticky')) {
176            sticky_wrapper.addClass('is-sticky');
177
178            this.placeholderHeight(current_view);
179          }
180
181        } else {
182
183          if (sticky_wrapper.hasClass('is-sticky')) {
184            sticky_wrapper.removeClass('is-sticky');
185          }
186
187        }
188
189      },
190
191      placeholderHeight: function(current_view) {
192
193        if( current_view.hasClass('on-top') ){
194          $('.mhb-placeholder').height(0);
195          return false;
196        }
197
198        var current_view_H = current_view.height() || 0;
199
200        $('.mhb-placeholder').height( current_view_H );
201
202      }
203
204    };
205
206    /**
207     * Search icon
208     */
209
210    var search = {
211
212      toggle: function(search_wrapper) {
213        $(search_wrapper).next('form').fadeToggle()
214          .find('.field').focus();
215      }
216
217    };
218
219    /**
220     * Bind
221     */
222
223    function bind() {
224
225      // menu | menu toggle click | mobile menu open
226
227      $('.mhb-menu').on('click', '.mobile-menu-toggle', function(e) {
228        e.preventDefault();
229        menu.toggle(this);
230      });
231
232      // search | icon click | form open
233
234      $('.mhb-extras').on('click', '.search-icon', function(e) {
235        e.preventDefault();
236        search.toggle(this);
237      });
238
239      // window.scroll
240
241      $(window).scroll(function() {
242        sticky.init();
243      });
244
245      // window.load
246
247      $(window).load(function() {
248        retinaLogo();
249      });
250
251    }
252
253    /**
254     * Return
255     */
256
257    return {
258      init: init
259
260    };
261
262  })(jQuery);
263
264  /**
265   * $(document).ready
266   * Specify a function to execute when the DOM is fully loaded.
267   */
268
269  $(function() {
270    Mfn_HB.init();
271  });
272
273})(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.