1'use strict'; 2 3var bt_initHeader; 4 5(function( $ ) { 6 7 var hasCentralMenu, verticalMenuEnabled, belowMenu, btStickyEnabled, responsiveMenuPosition, fullScreenMenuEnabled; 8 9 function initial_header_setup() { 10 11 var isTouchDevice = ( 'ontouchstart' in window ) || ( navigator.MaxTouchPoints > 0 ) || ( navigator.msMaxTouchPoints > 0 ); 12 13 if ( isTouchDevice ) { 14 $( 'html' ).addClass( 'touch' ); 15 $( 'html' ).removeClass( 'no-touch' ); 16 } else { 17 $( 'html' ).addClass( 'no-touch' ); 18 $( 'html' ).removeClass( 'touch' ); 19 } 20 21 hasCentralMenu = $( 'body' ).hasClass( 'btMenuCenterEnabled' ); 22 verticalMenuEnabled = $( 'body' ).hasClass( 'btMenuVerticalLeftEnabled' ) || $( 'body' ).hasClass( 'btMenuVerticalRightEnabled' ); 23 fullScreenMenuEnabled = $( 'body' ).hasClass( 'btMenuFullScreenCenter' ); 24 25 if ( $( 'body' ).hasClass( 'rtl' ) ) { 26 responsiveMenuPosition = 'Right'; 27 } else { 28 responsiveMenuPosition = 'Left'; 29 } 30 31 belowMenu = $( 'body' ).hasClass( 'btBelowMenu' ); 32 btStickyEnabled = $( 'body' ).hasClass( 'btStickyEnabled' ); 33 34 if ( typeof window.btStickyOffset == 'undefined' ) window.btStickyOffset = 300; 35 if ( typeof window.btStickyOpenTimeout == 'undefined' ) window.btStickyOpenTimeout = 50; 36 if ( typeof window.btStickyCloseTimeout == 'undefined' ) window.btStickyCloseTimeout = 200; 37 if ( typeof window.responsiveResolution == 'undefined' ) window.responsiveResolution = '1200'; 38 } 39 40 function final_header_setup() { 41 42 $( 'li.btMenuWideDropdown' ).addClass(function(){ 43 return 'btMenuWideDropdownCols-' + $( this ).children( 'ul' ).children( 'li' ).length; 44 }); 45 46 $( 'li.btMenuWideDropdown' ).each(function() { 47 var maxChildItems = 0; 48 $( this ).find( '> ul > li > ul' ).each(function( index ) { 49 if ( $( this ).children().length > maxChildItems ) { 50 maxChildItems = $( this ).children().length; 51 } 52 }); 53 $( this ).find( '> ul > li > ul' ).each(function( index ) { 54 var bt_menu_base_length = $( this ).children().length; 55 if ( bt_menu_base_length < maxChildItems ) { 56 for ( var i = 0; i < maxChildItems - bt_menu_base_length; i++ ) { 57 $( this ).append( '<li class="btEmptyParentElement"><a class="btEmptyElement"> </a></li>' ); 58 } 59 } 60 }); 61 }); 62 63 /* Show hide menu */ 64 65 $( '.btHorizontalMenuTrigger, .bt-horizontal-menu-trigger' ).on( 'click', function () { 66 $( 'body' ).toggleClass( 'btShowMenu' ); 67 return false; 68 }); 69 70 $( '.bt-fullscreen-menu-trigger' ).on( 'click', function () { 71 $( 'body' ).toggleClass( 'bt-show-fullscreen-menu' ); 72 return false; 73 }); 74 75 /* responsive menu toggler */ 76 77 $( '.btVerticalMenuTrigger, .bt-vertical-menu-trigger' ).on( 'click', function () { 78 $( 'body' ).toggleClass( 'btMenuVerticalOn' ); 79 return false; 80 }); 81 } 82 83 if ( typeof window.top_tools_search !== 'function' ) { 84 window.top_tools_search = function() { 85 /* Top tools search */ 86 87 $('.mainHeader .btSearch').parent().addClass( 'btParentFromTopBox' ); 88 $('.mainHeader .btSearchInner').prependTo('body').addClass( 'btFromTopBox' ); 89 90 $('.mainHeader .widget_search').addClass( 'btIconWidget' ); 91 $( '.mainHeader .btSearch, .btFromTopBox .btSearchInnerClose' ).on( 'click', function () { 92 $( 'body' ).toggleClass( 'btTopToolsSearchOpen' ); 93 94 if( $( 'body' ).hasClass( 'btTopToolsSearchOpen' ) ) { 95 if ( $( '.btSearchInnerContent form input:text:visible:first' ).length ) boldthemes_requestTimeout( add_focus_to_serach, 500); 96 } 97 return false; 98 }); 99 } 100 } 101 102 103 function add_focus_to_serach() { 104 // Focus to search field 105 $( '.btSearchInnerContent form input:text:visible:first' ).focus(); 106 } 107 108 function divide_menu() { 109 110 if ( $( '.btTextLogo' ).length ) { 111 var logoWidth = $( '.mainHeader .logo' ).width(); 112 } else { 113 if ( $( '.mainHeader .logo .btMainLogo' ).data( 'hw' ) ) { 114 var logoWidth = $( '.mainHeader .logo' ).height() * $( '.mainHeader .logo .btMainLogo' ).data( 'hw' ); 115 } else { 116 var logoWidth = $( '.mainHeader .logo' ).height() * 3; 117 } 118 119 } 120 121 $( '.menuPort nav' ).addClass( 'leftNav' ); 122 $( '.menuPort' ).append( '<nav class="rightNav"><ul></ul></nav>' ); 123 var halfItems = Math.ceil( $( '.menuPort nav.leftNav ul>
123li:not(li li)' ).length * .5 ); 124 $( '.menuPort nav.rightNav > ul' ).append( $( '.menuPort nav.leftNav > ul > li' ).slice ( halfItems ) ); 125 $( '.menuPort nav.leftNav > ul > li' ).slice( halfItems ).remove(); 126 127 $( '.mainHeader .logo' ).css( 'transform', 'translateX(' + Math.round(-logoWidth * .5) + 'px)' ); 128 $( '.mainHeader .logo' ).css( 'width', logoWidth + 'px' ); 129 $( '.menuPort nav.leftNav' ).attr( 'style', '--margin:' + Math.round( logoWidth * .5 ) + 'px;margin-right:' + Math.round( logoWidth * .5 ) + 'px;' ); 130 $( '.menuPort nav.rightNav' ).attr( 'style', '--margin:' + Math.round( logoWidth * .5 ) + 'px;margin-left:' + Math.round( logoWidth * .5 ) + 'px;' ); 131 boldthemes_calculate_content_padding(); 132 } 133 134 /* Activate sticky function and call */ 135 136 function boldthemes_activate_sticky() { 137 138 var fromTop = $( window ).scrollTop(); 139 if ( fromTop > window.btStickyOffset && !$('body').hasClass('btStickyHeaderActive') ) { 140 $( 'body' ).addClass( 'btStickyHeaderActive' ); 141 boldthemes_requestTimeout( boldthemes_activate_sticky_open, window.btStickyOpenTimeout); 142 } else if ( fromTop <= window.btStickyOffset && $('body').hasClass('btStickyHeaderActive') && !$('body').hasClass('btStickyHeaderClosed') ) { 143 $( 'body' ).addClass( 'btStickyHeaderClosed' ); 144 boldthemes_requestTimeout( boldthemes_activate_sticky_close, window.btStickyCloseTimeout); 145 } 146 if ( fromTop <= 100 ) { 147 $( 'body' ).removeClass( 'btStickyHeaderActive btStickyHeaderOpen btStickyHeaderClosed' ); 148 } 149 } 150 151 function boldthemes_activate_sticky_open() { 152 $( 'body' ).addClass( 'btStickyHeaderOpen' ); 153 } 154 function boldthemes_activate_sticky_close() { 155 $( 'body' ).removeClass( 'btStickyHeaderActive btStickyHeaderOpen btStickyHeaderClosed' ); 156 } 157 158 window.boldthemes_requestTimeout = function(fn, delay) { 159 if( !window.requestAnimationFrame && 160 !window.webkitRequestAnimationFrame && 161 !(window.mozRequestAnimationFrame && window.mozCancelRequestAnimationFrame) && // Firefox 5 ships without cancel support 162 !window.oRequestAnimationFrame && 163 !window.msRequestAnimationFrame) 164 return window.setTimeout(fn, delay); 165 166 var start = new Date().getTime(), 167 handle = new Object(); 168 169 function loop(){ 170 var current = new Date().getTime(), 171 delta = current - start; 172 173 delta >= delay ? fn.call() : handle.value = boldthemes_requestAnimFrame(loop); 174 }; 175 176 handle.value = boldthemes_requestAnimFrame(loop); 177 return handle; 178 }; 179 180 window.boldthemes_requestAnimFrame = (function() { 181 return window.requestAnimationFrame || 182 window.webkitRequestAnimationFrame || 183 window.mozRequestAnimationFrame || 184 window.oRequestAnimationFrame || 185 window.msRequestAnimationFrame || 186 function(/* function */ callback, /* DOMElement */ element){ 187 window.setTimeout(callback, 1000 / 60); 188 }; 189 })(); 190 191 /* Vertical menu setup */ 192 193 function responsive_menu_handler() { 194 if ( !fullScreenMenuEnabled ) { 195 if ( !verticalMenuEnabled ) { 196 $(window).on("resize", function(event){ 197 if( window.innerWidth < window.responsiveResolution ) { 198 $( 'body' ).addClass( 'btMenuVertical' + responsiveMenuPosition + ' btMenuVertical' ).removeClass( 'btMenuHorizontal' ); 199 } else { 200 $( 'body' ).removeClass( 'btMenuVertical btMenuVertical' + responsiveMenuPosition + ' btMenuVerticalOn' ).addClass( 'btMenuHorizontal' ); 201 } 202 boldthemes_calculate_content_padding(); 203 }); 204 } 205 } 206 } 207 208 function init_menu() { 209 210 initial_header_setup(); 211 212 if ( !fullScreenMenuEnabled ) { 213 if ( verticalMenuEnabled ) { 214 if ( $( 'body' ).hasClass( 'btMenuVerticalLeftEnabled' )) $( 'body' ).addClass( 'btMenuVerticalLeft btMenuVertical' ); 215 if ( $( 'body' ).hasClass( 'btMenuVerticalRightEnabled' )) $( 'body' ).addClass( 'btMenuVerticalRight btMenuVertical' ); 216 } else { 217 if ( $( 'body' ).hasClass( 'btMenuRightEnabled' )) $( 'body' ).addClass( 'btMenuRight btMenuHorizontal' ); 218 if ( $( 'body' ).hasClass( 'btMenuLeftEnabled' )) $( 'body' ).addClass( 'btMenuLeft btMenuHorizontal' ); 219 if ( $( 'body' ).hasClass( 'btMenuCenterBelowEnabled' )) $( 'body' ).addClass( 'btMenuCenterBelow btMenuHorizontal' ); 220 if ( $( 'body' ).hasClass( 'btMenuCenterEnabled' )) $( 'body' ).addClass( 'btMenuCenter btMenuHorizontal' ); 221 /* Switch to vertical */ 222 if( window.innerWidth < window.responsiveResolution ) { 223 $( 'body' ).addClass( 'btMenuVertical' + responsiveMenuPosition + ' btMenuVertical' ).removeClass( 'btMenuHorizontal' ); 224 } else { 225 $( 'body' ).removeClass( 'btMenuVertical btMenuVertical' + responsiveMenuPosition + ' btMenuVerticalOn' ).addClass( 'btMenuHorizontal' ); 226 } 227 } 228 } 229 230 // Move content below menu, must be donne after menu switch 231 if ( ! belowMenu ) { 232 boldthemes_calculate_content_padding(); 233 } 234 235 setTimeout( function() { $( 'body' ).addClass( 'btMenuInitFinished' ); }, 100 ); 236 237 if ( btStickyEnabled ) { 238 setTimeout( function() { 239 $( window ).scroll(function(){ 240 boldthemes_activate_sticky(); 241 }); 242 }, 1000 ); 243 } 244 245 /* Menu split */ 246 247 if ( hasCentralMenu ) divide_menu(); 248 249 /* Menu sub togglers */ 250 251 $( '.menuPort ul ul' ).parent().prepend( '<div class="subToggler"></div>'); 252 253 $( '.menuPort ul li' ).on( 'mouseenter mouseleave', function (e) { 254 if ( $( 'body' ).hasClass( 'btMenuVertical' ) || $( 'body' ).hasClass( 'btMenuFullScreenCenter' ) || $( 'html' ).hasClass( 'touch' ) ) { 255 return false; 256 } 257 e.preventDefault(); 258 $( this ).siblings().removeClass( 'on' ); 259 $( this ).toggleClass( 'on' ); 260 }); 261 262 $( '.menuPort ul.menu' ).on( 'mouseenter mouseleave', function (e) { 263 if ( $( 'body' ).hasClass( 'btMenuVertical' ) || $( 'body' ).hasClass( 'btMenuFullScreenCenter' ) || $( 'html' ).hasClass( 'touch' ) ) { 264 return false; 265 } 266 $( this ).toggleClass( 'hover' ); 267 }); 268 269 $( 'div.subToggler' ).on( 'click', function(e) { 270 var parent_item = $( this ).parent(); 271 parent_item.siblings().removeClass( 'on' ); 272 parent_item.siblings().find( 'li' ).removeClass( 'on' ); 273 parent_item.siblings().find( 'ul' ).hide(); 274 parent_item.toggleClass( 'on' ); 275 if ( parent_item.parent().hasClass( 'menu' ) ) parent_item.parent().toggleClass( 'hover' ); 276 if ( $( 'body' ).hasClass( 'btMenuVertical' ) ) { 277 parent_item.find( 'ul' ).first().slideToggle( 200 ); 278 } 279 return false; 280 }); 281 282 final_header_setup(); 283 284 } 285 286 /* Calculate content padding for not below menu */ 287 288 function boldthemes_calculate_content_padding() { 289 if ( ! belowMenu ) { 290 if( $( window ).width() < window.responsiveResolution || verticalMenuEnabled || fullScreenMenuEnabled ) { 291 $( '.btContentWrap, .bt-content-wrap' ).css( 'padding-top', $( '.btVerticalHeaderTop, .bt-vertical-header-top' ).height() +'px'); 292 } else if ( !$( 'body' ).hasClass( 'btStickyHeaderActive' ) ) { 293 $( '.btContentWrap, .bt-content-wrap' ).css( 'padding-top', $( '.mainHeader' ).height() +'px'); 294 } 295 /*alert(1);*/ 296 } 297 } 298 299 function reinit_menu() { 300 top_tools_search(); 301 setTimeout(function(){ init_menu(); }, 100); 302 boldthemes_calculate_content_padding(); 303 } 304 305 $( window ).on( 'load', function() { 306 boldthemes_calculate_content_padding(); 307 }); 308 309 bt_initHeader = reinit_menu; 310 top_tools_search(); 311 init_menu(); 312 responsive_menu_handler(); 313 314 315})( 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.