1( function( $ ) { 2 'use strict'; 3 4 $( window ).on( 'load', function() { 5 6 $( '.is-menu a, .is-menu a svg' ).on( 'click', function( e ) { 7 8 // Cancels the default actions. 9 e.stopPropagation(); 10 e.preventDefault(); 11 12 if ( 'static' === $( this ).closest('ul').css( 'position' ) ) { 13 $( this ).closest('ul').css( 'position', 'relative' ); 14 } 15 16 if ( $( this ).closest( '.is-menu-wrapper' ).length ) { 17 if ( $( this ).closest('.is-menu').hasClass( 'sliding' ) || $( this ).closest('.is-menu').hasClass( 'full-width-menu' ) ) { 18 $( this ).closest( '.is-menu-wrapper' ).addClass( 'is-expanded' ); 19 } 20 } 21 22 if ( $( this ).closest('.is-menu').hasClass( 'sliding' ) || $( this ).closest('.is-menu').hasClass( 'full-width-menu' ) ) { 23 $( this ).closest('.is-menu').find( 'button.is-search-submit' ).hide(); 24 var is_menu_height = $( this ).closest('li.is-menu').outerHeight(); 25 is_menu_height = ( is_menu_height / 2 ); 26 $( this ).closest('.is-menu').find( 'form' ).css({ 27 top: ( is_menu_height - 18 ) + "px" 28 }); 29 $( this ).closest('.is-menu').find( '.search-close' ).css({ 30 top: ( is_menu_height - 10 ) + "px" 31 }); 32 } 33 if ( $( this ).closest('.is-menu').hasClass( 'is-dropdown' ) ) { 34 $( this ).closest('.is-menu').find( 'form' ).fadeIn(); 35 } else if ( $( this ).closest('.is-menu').hasClass( 'sliding' ) ) { 36 $( this ).closest('.is-menu').find( 'form' ).animate( { 37 width: '310' 38 }, function() { 39 $( this ).closest('.is-menu').addClass( 'open' ); 40 $( this ).closest('.is-menu').find( 'button.is-search-submit' ).show(); 41 } ); 42 } else if ( $( this ).closest('.is-menu').hasClass( 'full-width-menu' ) ) { 43 var menu_width = $( this ).closest('ul').outerWidth(); 44 if ( $( this ).closest( '.is-menu-wrapper' ).hasClass( 'is-expanded' ) ) { 45 menu_width = $( window ).width(); 46 $( this ).closest('.is-menu').find( 'form' ).css( 'right', '-5px' ); 47 $( this ).closest('.is-menu').find( '.search-close' ).hide(); 48 } else { 49 var menu_pos = $( this ).offset(); 50 if ( ! $( this ).closest('.is-menu').hasClass( 'is-first' ) && menu_pos.left < menu_width ) { 51 menu_width = menu_pos.left; 52 var menu_item_width = $( this ).closest('li').outerWidth(); 53 if ( menu_item_width > menu_width ) { 54 menu_width = menu_item_width; 55 } 56 } 57 } 58 $( this ).closest('.is-menu').find( 'form' ).animate( { 59 width: menu_width+'px', 60 }, function() { 61 $( this ).closest('.is-menu').addClass( 'active-search' ); 62 $( this ).closest('.is-menu').addClass( 'open' ); 63 $( this ).closest('.is-menu').find( 'button.is-search-submit' ).show(); 64 } ); 65 } else if ( $( this ).closest('.is-menu').hasClass( 'popup' ) ) { 66 $( '#is-popup-wrapper' ).fadeIn(); 67 ivory_search_cursor_at_end( $( '#is-popup-wrapper form .is-search-input' ) ); 68 } 69 if ( ! $( this ).closest('.is-menu').hasClass( 'popup' ) ) { 70 ivory_search_cursor_at_end( $( this ).closest('.is-menu').find( 'form .is-search-input' )); 71 } 72 } ); 73 74 $( '#is-popup-wrapper .popup-search-close' ).on( 'click', function( e ) { 75 $( '#is-popup-wrapper, .is-ajax-search-result, .is-ajax-search-details' ).fadeOut(); 76 } ); 77 if ( typeof IvorySearchVars !== "undefined" && typeof IvorySearchVars.is_analytics_enabled !== "undefined" ) { 78 if ( typeof IvorySearchVars.is_search !== "undefined" && typeof IvorySearchVars.is_search ) { 79 var id = ( typeof IvorySearchVars.is_id !== "undefined" ) ? IvorySearchVars.is_id : 'Default'; 80 var label = ( typeof IvorySearchVars.is_label !== "undefined" ) ? IvorySearchVars.is_label : ''; 81 var category = ( typeof IvorySearchVars.is_cat !== "undefined" ) ? IvorySearchVars.is_cat : ''; 82 ivory_search_analytics( id, label, category ); 83 } 84 } 85 86 if ( window.matchMedia( '(max-width: 1024px)' ).matches ) { 87 $( '.is-menu a' ).attr( 'href', '' ); 88 } 89 $( window ).resize( function() { 90 if ( window.matchMedia( '(max-width: 1024px)' ).matches ) { 91 $( '.is-menu a' ).attr( 'href', '' ); 92 } 93 } ); 94 95 } ); 96 97 $( document ).keyup( function( e ) { 98 if ( e.keyCode === 27 ) { 99 $( '#is-popup-wrapper, .is-ajax-search-result, .is-ajax-search-details' ).hide(); 100 } 101 } ); 102 103 $( '.is-menu form input[type="search"], .is-menu form input[type="text"]' ).on( 'click', function( e ) { 104 e.stopPropagation(); 105 return false;
106 } ); 107 108 $( 'form.is-search-form, form.search-form' ).on( 'mouseover', function( e ) { 109 if ( $( this ).next( ".is-link-container" ).length ){ 110 $( this ).append( $( this ).next( ".is-link-container" ).remove() ); 111 } 112 } ); 113 114 $( window ).click( function( e ) { 115 if ( 0 === e.button && 0 === $( e.target ).closest( '.is-search-input' ).length && 0 === $( e.target ).closest( '.is-search-submit' ).length && 0 === $( e.target ).closest( '.is-ajax-search-result' ).length && 0 === $( e.target ).closest( '.is-ajax-search-details' ).length ) { 116 if ( $( '.is-menu' ).hasClass( 'open' ) ) { 117 $( '.is-menu button.is-search-submit' ).hide(); 118 $( '.is-menu form' ).animate( 119 { width: '0' }, 120 400, 121 function() { 122 $( '.is-menu' ).removeClass( 'active-search' ); 123 $( '.is-menu' ).removeClass( 'open' ); 124 $( '.is-menu-wrapper' ).removeClass( 'is-expanded' ); 125 } 126 ); 127 $( '.is-ajax-search-result, .is-ajax-search-details' ).hide(); 128 } else if ( $( '.is-menu' ).hasClass( 'is-dropdown' ) ) { 129 $( '.is-menu form' ).fadeOut(); 130 $( '.is-ajax-search-result, .is-ajax-search-details' ).hide(); 131 } 132 } 133 }); 134 135} )( jQuery ); 136 137function ivory_search_cursor_at_end( temp_search_input ) { 138 var len = temp_search_input.val().length; 139 temp_search_input.trigger( 'focus' ); 140 temp_search_input[0].setSelectionRange(len, len); 141} 142 143function ivory_search_analytics( id, label, category ) { 144 try { 145 // YOAST uses __gaTracker, if not defined check for ga, if nothing go null, FUN EH?? 146 var _ga = typeof __gaTracker == "function" ? __gaTracker : (typeof ga == "function" ? ga : false); 147 var _gtag = typeof gtag == "function" ? gtag : false; 148 if ( _gtag !== false ) { 149 _gtag('event', 'Ivory Search - '+id, { 150 'event_label': label, 151 'event_category': category 152 }); 153 return; 154 } 155 156 if ( _ga !== false ) { 157 _ga('send', { 158 hitType: 'event', 159 eventCategory: category, 160 eventAction: 'Ivory Search - '+id, 161 eventLabel: label 162 }); 163 //_ga( 'send', 'pageview', '/?s=' + encodeURIComponent( label ) + '&id=' + encodeURIComponent( id )+ '&result=' + encodeURIComponent( category ) ); 164 } 165 166 } catch (error) { 167 } 168}
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.