PageSourceSearch

https://www.msi.se/wp-content/plugins/mobile-menu-premium/includes…?ver=bf095e5d00b7f82d8bcafd916de9a654

js msi.se collected 2026-10-09 17:46:46 UTC 6,439 bytes, 191 lines download raw bytes

1
2  /*
3    *
4    *   Javascript PRO Functions
5    *   ------------------------------------------------
6    *   WP Mobile Menu 
7    *   Copyright WP Mobile Menu 2018 - http://www.wpmobilemenu.com
8    *
9    *
10    *
11    */
12
13    "use strict";
14    var previousTerm = '';
15
16    jQuery( document ).ready( function($) {
17
18      
19
20      $( document ).on( 'click, mouseover', '.mobmenu-language-wrapper .mm-active-flag' , function ( e ) {
21        e.preventDefault();
22        $( '.mobmenu-language-wrapper li' ).show();
23      });
24    
25      $( document ).on( 'mouseleave', '.mobmenu-language-wrapper' , function ( e ) {
26        e.preventDefault();
27        $( '.mobmenu-language-wrapper li:not(.mm-active-flag)' ).hide();
28      });
29
30      $( document ).on( 'click', '.mobmenu-language-selector li.mm-current-language' , function ( e ) {
31        e.preventDefault();
32        $( '.mobmenu-language-selector' ).toggleClass( 'language-selector-opened' );
33      });
34
35      $( document ).on( 'click', '.sliding-back-menu' , function ( e ) {
36        jQuery(this).parent().removeClass( 'show-sub-menu' );
37        jQuery('.show-sub').removeClass( 'show-sub' );
38        e.stopPropagation();
39      });
40
41      $( ".mobmenu-search" ).click(function() {
42
43        if ( $( 'html').hasClass( 'show-mob-menu-search' ) ) {
44          $( '.mob-menu-search-form' ).fadeOut();
45          $( '.mobmenu-search-holder' ).slideUp( 800 );
46          $( '.mobmenu-ajax-search-results' ).slideUp( 800 );
47          $( '.mobmenu-search .mob-search-cancel-button' ).hide();
48          $( '.mobmenu-search .mob-search-button' ).show();
49          $( 'html' ).removeClass( 'show-mob-menu-search' );
50        } else {
51        
52            $( '.mob-menu-search-form' ).fadeIn( 800 ); 
53            $( '.mobmenu-search-holder' ).slideDown();
54            $( '.mobmenu-search .mob-search-cancel-button' ).show();
55            $( '.mobmenu-search .mob-search-button' ).hide();
56            $( '.mob-menu-search-field' ).focus();
57            $( 'html').addClass( 'show-mob-menu-search' );
58
59        }
60      });
61
62      function delaySearch(fn, ms) {
63        let timer = 0
64        return function(...args) {
65          clearTimeout(timer)
66          timer = setTimeout(fn.bind(this, ...args), ms || 0)
67        }
68      }
69  
70      $( '.header-ajax-search .mob-menu-search-field' ).on( 'keyup', delaySearch(function( e ){
71      
72
73        var searchTerm = $( this ).val();
74        e.preventDefault();
75
76        if ( searchTerm == previousTerm ) return;
77          previousTerm = searchTerm;
78
79          if ( searchTerm && searchTerm.length > 2 ) {
80              var types = '';
81
82              if ( $( '#post_type' ).length ) {
83                types = $( '#post_type' ).val();
84              }
85              
86            $.ajax({
87              url : frontend.ajaxurl, 
88              data : {
89                  action : 'mobile_menu_search__premium_only',
90                  terms : searchTerm,
91                  post_types: types,
92              },
93              type : 'POST',
94              success : function( response ) {
95                $( '.mobmenu-ajax-search-results').html( response ).show();
96              },
97              error : function(error){
98                console.log(error);
99              }
100            })
101          }
102          else {
103            $( '.mobmenu-ajax-search-results' ).html( '' ).hide();
104          }
105      }, parseInt( frontend.search_delay ) ) );
106
107      $( document ).on( 'click', '.mobmenu-tabs-header li' , function ( e ) {
108
109        e.preventDefault();
110        $( '.active-tab' ).removeClass( 'active-tab' );
111        $( this ).addClass( 'active-tab' );
112        $( '.mobmenu-tabs-container .mobmenu-tab' ).hide();
113        $('.' + $( this ).attr('data-tab-id')).show();
114      });
115
116    });
117
118    //Function that will hide/show the header/footer when scrolling down.
119    jQuery( function($){
120
121      // Autohide Header.
122      if ( $( 'body' ).hasClass( 'mob-menu-autohide-header' ) ) {
123        var lastScrollTop = 0, delta = 5, scrollAmount = 0;
124        $( window ).scroll( function( event ){
125          var st = $(this).scrollTop();
126          var htmlTop = $('html').scrollTop();
127
128          if ( htmlTop < jQuery('.mob-menu-header-holder').height() ) {
129            $( '.mob-menu-header-holder' ).removeClass( 'hide-mm-element' );
130            return;
131          }
132
133          if ( $(window).height() +  htmlTop + 80 > $(document).height() ) {
134            $( '.mobmenu-footer-menu-holder' ).removeClass( 'hide-mm-element' ); 
135            return;
136          }
137
138          if ( Math.abs(lastScrollTop - st) <= delta )
139              return;
140              
141            if ( st > lastScrollTop ) {
142              //Scroll Down. 
143              $( '.mob-menu-header-holder' ).addClass( 'hide-mm-element' );
144              scrollAmount = 0;
145              if ( $( 'body' ).hasClass( 'mob-menu-autohide-footer' ) ) {
146                $( '.mobmenu-footer-menu-holder' ).removeClass( 'hide-mm-element' ); 
147              }
148
149          } else {
150              //Scroll Up.
151              if ( scrollAmount > 40 ) {
152                $( '.mob-menu-header-holder' ).removeClass( 'hide-mm-element' ); 
153              }
154              scrollAmount += (lastScrollTop -  st);
155              if ( $( 'body' ).hasClass( 'mob-menu-autohide-footer' ) ) {
156                $( '.mobmenu-footer-menu-holder' ).addClass( 'hide-mm-element' ); 
157              }
158              }
159
160          lastScrollTop = st;
161
162        });
163      }
164
165      // Autohide Footer.
166      if ( $( 'body' ).hasClass( 'mob-menu-autohide-footer' ) ) { 
167        var lastScrollTop = 0, delta = 5, scrollAmount = 0;;
168        $( window ).scroll( function( event ){
169          var st = $(this).scrollTop();
170
171          if ( Math.abs(lastScrollTop - st) <= delta )
172              return;
173
174            if ( st > lastScrollTop ) {
175              //Scroll Down. 
176              $( '.mobmenu-footer-menu-holder' ).addClass( 'hide-mm-element' );
177              scrollAmount = 0;
178
179          } else {
180              //Scroll Up.
181              if ( scrollAmount > 40 ) {
182                $( '.mobmenu-footer-menu-holder' ).removeClass( 'hide-mm-element' ); 
183              }
184              scrollAmount += (lastScrollTop -  st);
185              }
186
187          lastScrollTop = st;
188
189        });
190      }
191  });

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.