1(function( $, sr ){ 2 "use strict"; 3 /*global jQuery */ 4 5 // smartresize function from Paul Irish 6 // http://www.paulirish.com/2009/throttled-smartresize-jquery-event-handler/ 7 // debouncing function from John Hann 8 // http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/ 9 var debounce = function ( func, threshold, execAsap ) { 10 var timeout; 11 12 return function debounced () { 13 var obj = this, args = arguments; 14 function delayed () { 15 if ( !execAsap ) 16 func.apply( obj, args ); 17 timeout = null; 18 } 19 20 if ( timeout ) 21 clearTimeout( timeout ); 22 else if ( execAsap ) 23 func.apply( obj, args ); 24 25 timeout = setTimeout( delayed, threshold || 100 ); 26 }; 27 }; 28 // smartresize 29 jQuery.fn[ sr ] = function( fn ){ return fn ? this.bind( 'resize', debounce( fn ) ) : this.trigger( sr ); }; 30 31})( jQuery, 'smartresize' ); 32 33 34 35(function( $ ) { 36 37 "use strict"; 38 /*global jQuery */ 39 /*jslint bitwise: true */ 40 41 var INTERPOL = INTERPOL || {}; 42 43 INTERPOL.body = $( document.documentElement ); 44 45 /*---------------------------------------------*/ 46 /* Window width/height check 47 /*---------------------------------------------*/ 48 49 INTERPOL.viewport = function() { 50 51 var e = window, 52 a = 'inner'; 53 if ( ! ( 'innerWidth' in window ) ) { 54 a = 'client'; 55 e = document.documentElement || document.body; 56 } 57 return { width : e[ a + 'Width' ] , height : e[ a + 'Height' ] }; 58 }; 59 60 /*---------------------------------------------*/ 61 /* Firefox check 62 /*---------------------------------------------*/ 63 64 INTERPOL.firefoxCheck = function() { 65 66 var is_firefox = navigator.userAgent.toLowerCase().indexOf( 'firefox' ) > -1; 67 if ( is_firefox ) { 68 if ( document.documentElement.classList ) { 69 document.documentElement.classList.add( 'firefox' ); 70 } 71 } 72 }; 73 74 /*---------------------------------------------*/ 75 /* Logo Retina 76 /*---------------------------------------------*/ 77 78 INTERPOL.retina = function() { 79 if ( $( '#retina-logo' ).length > 0 ) { 80 var pixelRatio = !!window.devicePixelRatio ? window.devicePixelRatio : 1, 81 desktopLogo = $( '#desktop-logo' ), 82 retinaLogo = $( '#retina-logo' ), 83 logoWidth = desktopLogo.width(), 84 logoHeight = desktopLogo.height(); 85 if ( pixelRatio > 1 ) { 86 retinaLogo.attr({ height: logoHeight, width: logoWidth }); 87 retinaLogo.css( 'display', 'inline-block' ); 88 desktopLogo.hide(); 89 } 90 } 91 }; 92 93 /*---------------------------------------------*/ 94 /* Navigation Menu 95 /*---------------------------------------------*/ 96 97 INTERPOL.navigation = function() { 98 99 $( '#site-navigation' ).find( '.sf-menu' ).superfish({
100 autoArrows: false, 101 delay: 500, 102 speed: 200, 103 speedOut: 200, 104 useClick: false 105 }); 106 107 }; 108 109 /*---------------------------------------------*/ 110 /* Mobile Menu 111 /*---------------------------------------------*/ 112 113 INTERPOL.mobile_m = function() { 114 115 var mobileOpen = false, 116 mobileMenu = $( document.getElementById( 'mobile-navigation' ) ), 117 mobileToggle = $( document.getElementById( 'site-mobile-navigation-toggle' ) ); 118 119 $( '#site-navigation' ).find( '.sf-menu' ).clone().appendTo( '#mobile-navigation' ); 120 121 mobileToggle.on( 'click', function( e ) { 122 e.preventDefault(); 123 if ( mobileOpen === false ) { 124 openMobileMenu(); 125 } else { 126 closeMobileMenu(); 127 } 128 }); 129 130 function openMobileMenu() { 131 mobileOpen = true; 132 mobileMenu.slideDown(); 133 } 134 135 function closeMobileMenu() { 136 if ( mobileOpen === true ) { 137 mobileOpen = false; 138 mobileMenu.slideUp(); 139 mobileMenu.find( '.sub-menu' ).slideUp(); 140 } 141 } 142 143 $( window ).smartresize( function() { 144 if ( mobileOpen === true ) { 145 closeMobileMenu(); 146 } 147 }); 148 149 mobileMenu.find( '.menu-item-has-children' ).on( 'click', function( e ) { 150 e.preventDefault(); 151 $( this ).addClass( 'active' ); 152 $( this ).children( '.sub-menu' ).slideToggle(); 153 $( this ).find( '.sub-menu .sub-menu' ).slideUp(); 154 }); 155 mobileMenu.find( '.sub-menu' ).not( 'menu-item-has-children a' ).on( 'click', function( e ) { 156 e.stopPropagation(); 157 }); 158 159 }; 160 161 /*---------------------------------------------*/ 162 /* Sticky header 163 /*---------------------------------------------*/ 164 165 INTERPOL.sticky = function() { 166 var t = 0; 167 168 function addStickyClass() { 169 if ( INTERPOL.viewport().width >= 992 || INTERPOL.body.hasClass( 'no-responsive' ) ) { 170 var st = $( window ).scrollTop(); 171 if ( st > t ) { 172 INTERPOL.body.addClass( 'fixed-yes' ); 173 } else { 174 INTERPOL.body.removeClass( 'fixed-yes' ); 175 } 176 } else { 177 INTERPOL.body.removeClass( 'fixed-yes' ); 178 } 179 } 180 181 addStickyClass(); 182 $( window ).scroll( addStickyClass ); 183 $( window ).smartresize( function() { 184 addStickyClass(); 185 }); 186 }; 187 188 /*---------------------------------------------*/ 189 /* Init Functions 190 /*---------------------------------------------*/ 191 192 $( document ).ready( function() { 193 INTERPOL.firefoxCheck(); 194 INTERPOL.mobile_m(); 195 INTERPOL.navigation(); 196 if ( INTERPOL.body.hasClass( 'interpol-sticky-header-yes' ) ) { 197 INTERPOL.sticky(); 198 } 199 }); 200 201 $( window ).load( function() { 202 INTERPOL.retina(); 203 }); 204 205})( 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.