1(function($){ 2$(document).ready(function() { 3 4 'use strict'; 5 /** 6 * Init 7 */ 8 9 // iOS button fixes 10 var iOS = false, 11 p = navigator.platform; 12 13 if (p === 'iPad' || p === 'iPhone' || p === 'iPod') { 14 iOS = true; 15 } 16 if (iOS) { 17 $('input.button, input[type="text"],input[type="button"],input[type="password"],textarea, input.input-text').css('-webkit-appearance', 'none'); 18 $('input').css('border-radius', '0'); 19 } 20 21 // Remove animations on touch devices 22 function isTouchDevice(){ 23 return true == ("ontouchstart" in window || window.DocumentTouch && document instanceof DocumentTouch); 24 } 25 26 if(isTouchDevice()===true) { 27 $("#animations-css").remove(); 28 } 29 30 $("select").select2({ 31 allowClear: true, 32 minimumResultsForSearch: 10 33 }); 34 35 // Body class 36 if($("body.single-post .container-page-item-title.with-bg, body.page .container-page-item-title.with-bg").length > 0) { 37 $("body").addClass('blog-post-header-with-bg'); 38 39 } 40 41 // Add images backgrounds 42 $('.carrie-post-image').each(function( index ) { 43 $(this).attr('style', ($(this).attr('data-style'))); 44 }); 45 $('.carrie-next-post').each(function( index ) { 46 $(this).attr('style', ($(this).attr('data-style'))); 47 }); 48 $('.blog-post-list-layout .blog-post-thumb').each(function( index ) { 49 $(this).attr('style', ($(this).attr('data-style'))); 50 }); 51 $('.blog-style-4 .blog-post .blog-post-thumb').each(function( index ) { 52 $(this).attr('style', ($(this).attr('data-style'))); 53 }); 54 $('.post-content-wrapper').each(function( index ) { 55 $(this).attr('style', ($(this).attr('data-style'))); 56 }); 57 $('.blog-post-related.blog-post-related-loop .blog-post-related-item .blog-post-related-image').each(function( index ) { 58 $(this).attr('style', ($(this).attr('data-style'))); 59 }); 60 $('.carrie-editorspick-post-image').each(function( index ) { 61 $(this).attr('style', ($(this).attr('data-style'))); 62 }); 63 $('.carrie-popular-post-image').each(function( index ) { 64 $(this).attr('style', ($(this).attr('data-style'))); 65 }); 66 $('.sidebar .widget.widget_carrie_text .carrie-textwidget').each(function( index ) { 67 $(this).attr('style', ($(this).attr('data-style'))); 68 }); 69 $('.container-fluid.container-page-item-title').each(function( index ) { 70 $(this).attr('style', ($(this).attr('data-style'))); 71 }); 72 $('.widget-post-thumb-wrapper').each(function( index ) { 73 $(this).attr('style', ($(this).attr('data-style'))); 74 }); 75 $('.widget-post-thumbsmall-wrapper').each(function( index ) { 76 $(this).attr('style', ($(this).attr('data-style'))); 77 }); 78 $('.footer-html-block').each(function( index ) { 79 $(this).attr('style', ($(this).attr('data-style'))); 80 }); 81 82 // Fullscreen search 83 $('.search-toggle-btn').on('click', function(e){ 84 85 $(document).keyup(function(e){ 86 if(e.keyCode === 27) 87 $('.search-fullscreen-wrapper').fadeOut(); 88 }); 89 90 $('.search-fullscreen-wrapper').fadeIn(); 91 $('.search-fullscreen-wrapper .search-fullscreen-form input[type="search"]').focus(); 92 $('.search-fullscreen-wrapper .search-fullscreen-form input[type="search"]').val(''); 93 }); 94 95 $('.search-close-btn').on('click', function(e){ 96 $('.search-fullscreen-wrapper').fadeOut(); 97 }); 98 99 // Top mobile menu 100 var topmenuopened = 0; 101 $( document ).on( "click", ".menu-top-menu-container-toggle", function(e) { 102 if(topmenuopened == 0) { 103 $(this).next().slideDown(); 104 topmenuopened = 1; 105 } else { 106 topmenuopened = 0; 107 $(this).next().slideUp(); 108 } 109 }); 110 111 // Mobile menu clicks 112 $('.nav li > a, .header-menu li > a').on('click', function(e){ 113 114 if($(window).width() < 767) { 115 116 if ( $(this).next(".sub-menu").length > 0 ) { 117 var sm = $(this).next(".sub-menu"); 118 119 if(sm.data('open') !== 1) 120 { 121 e.preventDefault(); 122 e.stopPropagation(); 123 sm.slideDown(); 124 125 sm.data('open', 1); 126 127 $(this).parent().addClass('mobile-submenu-opened'); 128 129 } 130 131 } 132 } else { 133 // Mobile menu clicks for touch devices 134 if(isTouchDevice()===true) { 135 136 if ( $(this).next(".sub-menu").length > 0 ) { 137 var sm = $(this).next(".sub-menu"); 138 139 if(sm.data('open') !== 1) 140 { 141 e.preventDefault(); 142 e.stopPropagation(); 143 sm.slideDown(); 144 145 sm.data('open', 1); 146 } 147 148 } 149 150 } 151 152 } 153 }); 154 155 // Float sidebar menu clicks
156 $('.sidebar .widget.widget_nav_menu a').on('click', function(e){ 157 158 if ( $(this).next(".sub-menu").length > 0 ) { 159 var sm = $(this).next(".sub-menu"); 160 161 if(sm.data('open') !== 1) 162 { 163 e.preventDefault(); 164 e.stopPropagation(); 165 sm.slideDown(); 166 167 sm.data('open', 1); 168 169 $(this).parent().addClass('mobile-submenu-opened'); 170 171 } 172 173 } 174 175 }); 176 177 // Offcanvas menu 178 function carrie_offCanvasSidebarInit() { 179 $( ".st-sidebar-menu" ).wrapInner('<div class="nano"></div>'); 180 $( ".st-sidebar-menu .nano" ).wrapInner('<div class="nano-content"></div>'); 181 182 $(".st-sidebar-menu .nano").nanoScroller(); 183 184 $("html").addClass('offcanvassidebar'); 185 186 var wp_adminbar_height = 0; 187 188 if($("#wpadminbar").length > 0) { 189 wp_adminbar_height = $("#wpadminbar").height(); 190 } 191 192 $("html.offcanvassidebar .st-sidebar-content-inner").css("margin-top", wp_adminbar_height); 193 194 var container = $('#st-container'), //-sidebar 195 buttons = $("#st-sidebar-trigger-effects > a"), 196 // event type (if mobile use touch events) 197 eventtype = mobilecheck() ? 'touchstart' : 'click', 198 resetMenu = function() { 199 $(container).removeClass("st-sidebar-menu-open"); 200 $("html").removeClass('offcanvassidebar-open'); 201 setTimeout( function() { 202 $('.sg_widget_custom_box_left').fadeIn(); 203 }, 1000 ); 204 }, 205 bodyClickFn = function(evt) { 206 207 if( !hasParentClass( evt.target, 'st-sidebar-menu' ) ) { 208 resetMenu(); 209 $("html").unbind( eventtype, bodyClickFn ); 210 } 211 if( hasParentClass( evt.target, 'st-sidebar-menu-close-btn' )) { 212 resetMenu(); 213 $("html").unbind( eventtype, bodyClickFn ); 214 } 215 }; 216 217 buttons.each( function( i ) { 218 219 var el = $( this ); 220 221 var effect = el.attr( 'data-effect' ); 222 223 el.on( eventtype, function( ev ) { 224 ev.stopPropagation(); 225 ev.preventDefault(); 226 container.attr('class', 'st-sidebar-container');// clear 227 container.addClass(effect); 228 $("html").addClass('offcanvassidebar-open'); 229 $('.sg_widget_custom_box_left').fadeOut(); 230 setTimeout( function() { 231 232 container.addClass('st-sidebar-menu-open'); 233 }, 25 ); 234 $("html").on( eventtype, bodyClickFn ); 235 }); 236 } ); 237 238 } 239 240 if($("#st-sidebar-trigger-effects").length > 0) { 241 242 $( "body" ).wrapInner('<div id="st-container" class="st-sidebar-container"></div>'); 243 $( ".st-sidebar-container" ).wrapInner('<div class="st-sidebar-pusher"></div>'); 244 $( ".st-sidebar-pusher" ).wrapInner("<div class='st-sidebar-content'></div>"); 245 $( ".st-sidebar-content" ).wrapInner("<div class='st-sidebar-content-inner'></div>"); 246 247 $( ".st-sidebar-menu" ).insertBefore($(".st-sidebar-pusher")); 248 249 carrie_offCanvasSidebarInit(); 250 } 251 252 /** 253 * Scroll functions 254 */ 255 // Vertical bar 256 if($(".carrie-verticalbar").length > 0) { 257 var verticalbar_top_position = $('.header-menu-bg').height()+$('header').height()+$('.carrie-blog-posts-slider').height()+$('.container-page-item-title').height()+30; 258 $(".carrie-verticalbar").css('top', verticalbar_top_position); 259 $(".carrie-verticalbar").show(); 260 261 var verticalbaroffset = $(".carrie-verticalbar").offset().top; 262 var verticalbarfixed = 0; 263 var vboffset1 = 150; 264 var vboffset2 = 140; 265 } 266 267 $(window).scroll(function () { 268 269 var scrollonscreen = $(window).scrollTop() + $(window).height(); 270 271 // Scroll to top function 272 if(scrollonscreen > $(window).height() + 350){ 273 $('#top-link').css("bottom", "22px"); 274 } 275 else { 276 $('#top-link').css("bottom", "-60px"); 277 } 278 279 // Vertical bar 280 if($(".carrie-verticalbar").length > 0) { 281 if(verticalbarfixed == 0) { 282 if($(".carrie-verticalbar").offset().top < ($(window).scrollTop() + vboffset1)) { 283 $(".carrie-verticalbar").addClass('fixed'); 284 verticalbarfixed = 1; 285 } 286 } else { 287 if(verticalbarfixed == 1) { 288 if($(".carrie-verticalbar").offset().top < verticalbaroffset - vboffset2) { 289 $(".carrie-verticalbar").removeClass('fixed'); 290 verticalbarfixed = 0; 291 } 292 293 } 294 } 295 } 296 297 }); 298 299 // Sticky header 300 function carrie_stickyHeaderWorker() { 301 // Sticky header 302 if(isTouchDevice()==false) { 303 304 var scrolltop = $(document).scrollTop(); 305 306 if(scrolltop > $("header").height() + $('.header-menu-bg').height()) { 307 308 if((header_hided == 1) && (header_fixed == 1)) { 309 header_fixed = 0; 310 } 311 312 if(header_fixed == 0) { 313 314 315 316 header_fixed = 1; 317 318 $(".mainmenu-belowheader.sticky-header").addClass('fixed'); 319 320 $(".mainmenu-belowheader.sticky-header").css("top", -50 + wp_adminbar_height); 321 322 $(".mainmenu-belowheader.sticky-header").css("top", wp_adminbar_height); 323 324 325 $("header").css("margin-top", header_original_height + wp_adminbar_height - top_menu_height); 326 327 } 328 329 } else { 330 331 if(header_fixed == 1) { 332 333 $(".mainmenu-belowheader.sticky-header").css("top", -90 - wp_adminbar_height); 334 335 header_hided = 1; 336 337 if((scrolltop < ($(window).height()/2) -100)) { 338 339 $(".mainmenu-belowheader.sticky-header").removeClass('fixed'); 340 $("header").css("margin-top", 0); 341 342 header_fixed = 0; 343 header_hided = 0; 344 345 } 346 } 347 348 } 349 350 } 351 } 352 353 if($(".mainmenu-belowheader.sticky-header").length > 0) { 354 if($(window).width() > 767) { 355 356 var header_fixed = 0; 357 var header_original_height = $(".mainmenu-belowheader.sticky-header").height(); 358 var top_menu_height = 0; 359 var wp_adminbar_height = 0; 360 var header_hided = 0; 361 362 if($("#wpadminbar").length > 0) { 363 wp_adminbar_height = $("#wpadminbar").height(); 364 } 365 366 if($('.header-menu-bg').length > 0) { 367 top_menu_height = $('.header-menu-bg').height() - 15; 368 } 369 370 371 $(".mainmenu-belowheader.sticky-header").css("top", -90 - wp_adminbar_height); 372 373 // Run first time 374 carrie_stickyHeaderWorker(); 375 376 // Run on scroll 377 $(window).scroll(function () { 378 379 carrie_stickyHeaderWorker(); 380 381 }); 382 383 } 384 385 } 386 387 //scroll up event 388 $('#top-link, footer #footer-top-button').on('click', function(e){ 389 $('body,html').stop().animate({ 390 scrollTop:0 391 },800,'easeOutCubic') 392 return false;
393 }); 394 395 396/** 397* Resize events 398*/ 399 400 $(window).resize(function () { 401 402 }); 403 404/** 405* Other scripts 406*/ 407 408 409/** 410* Social share for posts 411*/ 412 413function carrie_facebookShare(){ 414 window.open( 'https://www.facebook.com/sharer/sharer.php?u='+$(this).attr('href'), "facebookWindow", "height=380,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" ) 415 return false; 416} 417function carrie_googlePlusShare(){ 418 window.open( 'https://plus.google.com/share?url='+$(this).attr('href'), "googleplusWindow", "height=380,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" ) 419 return false; 420} 421function carrie_twitterShare(){ 422 423 var $page_title = encodeURIComponent($(this).attr('data-title')); 424 425 window.open( 'http://twitter.com/intent/tweet?text='+$page_title +' '+$(this).attr('href'), "twitterWindow", "height=370,width=600,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" ) 426 return false; 427} 428function carrie_pinterestShare(){ 429 var $sharingImg; 430 431 $sharingImg = $(this).attr('data-image'); 432 433 var $page_title = encodeURIComponent($(this).attr('data-title')); 434 435 window.open( 'http://pinterest.com/pin/create/button/?url='+$(this).attr('href')+'&media='+$sharingImg+'&description='+$page_title, "pinterestWindow", "height=620,width=600,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" ) 436 return false; 437} 438if( $('a.facebook-share').length > 0 || $('a.twitter-share').length > 0 || $('a.pinterest-share').length > 0 || $('a.googleplus-share').length > 0) { 439 440 $('.facebook-share').on('click', carrie_facebookShare); 441 442 $('.twitter-share').on('click', carrie_twitterShare); 443 444 $('.pinterest-share').on('click', carrie_pinterestShare); 445 446 $('.googleplus-share').on('click', carrie_googlePlusShare); 447 448} 449// Common functions 450function hasParentClass( e, classname ) { 451 if(e === document) return false; 452 453 if( $( e ).hasClass( classname ) ) { 454 return true; 455 } 456 if( $( e ).parents().hasClass( classname ) ) { 457 return true; 458 } 459} 460 461function mobilecheck() { 462 var check = false; 463 (function(a){if(/(android|ipad|playbook|silk|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera); 464 return check; 465} 466 467}); 468})(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.