1/* Custom Front-End jQuery scripts */ 2jQuery(document).ready(function($) { 3 4 'use strict'; 5 6 /* Nav Menu */ 7 $(function() { 8 9 $('.menu .sub-links').not($('.sub-menu .sub-links')).wrap('<div class="sub-menu" />');/* Fix for Custom Link only */ 10 11 var $main_menu = $('.main-menu'); 12 13 $main_menu.find('> ul > li > .sub-menu').each(function (index, element) { 14 if ($(element).children().hasClass('sub-posts') && $(element).children().hasClass('sub-links')) { 15 $(element).parent().addClass('sub-menu-two-columns menu-item-has-mega-menu'); 16 } else if ($(element).children().hasClass('sub-posts') && (!$(element).children().hasClass('sub-links'))) { 17 $(element).parent().addClass('sub-menu-full-width menu-item-has-mega-menu'); 18 } else if ($(element).parent().hasClass('columns-menu')) { 19 $(element).parent().addClass('sub-menu-columns'); 20 } else { 21 $(element).parent().addClass('sub-links-only'); 22 } 23 24 if ($(element).children().length) { 25 $(element).parent().addClass('link-arrow'); 26 } 27 }); 28 29 $('.sub-menu-columns > .sub-menu > .sub-links').each(function (index, element) { 30 var count = $(element).children().length; 31 $(element).parents('.sub-menu-columns').addClass('sub-menu-columns-'+count); 32 }); 33 34 $('.sub-menu').each(function (index, element) { 35 if ($(element).children().length === 0) { 36 $(element).remove(); 37 } 38 }); 39 40 $main_menu.find('li:has(ul)') 41 .add( $main_menu.find('.sub-links li') ) 42 .add( $('.secondary-menu li:has(ul)') ) 43 .doubleTapToGo(); 44 45 }); 46 47 48 /* Sticky menu */ 49 $('.main-menu-fixed').hcSticky({ 50 offResolutions: [-960], 51 stickTo: document, 52 wrapperClassName: 'sticky-menu-container' 53 }); 54 55 56 /* Mobile Menu */ 57 $(function() { 58 59 $('#mobile-menu-toggle').click(function(e) { 60 e.preventDefault(); 61 $('body').toggleClass('mobile-menu-open'); 62 }); 63 64 var mobile_menu = $('#pageslide'); 65 66 $('.main-menu').children().clone().removeAttr('id').appendTo($(mobile_menu)).wrap('<nav class="block main-menu-mobile" />'); 67 $('body:not(.hide-strip) .secondary-menu').children().clone().removeAttr('id').appendTo($(mobile_menu)).wrap('<nav class="block secondary-menu-mobile" />'); 68 69 $.each($(mobile_menu).find('.menu li').not('.sub-menu-full-width'), function() { 70 $(this).find('> .sub-menu').before('<span class="sub-menu-arrow"></span>'); 71 }); 72 73 $(mobile_menu).find('.menu li .sub-menu').prepend('<span class="sub-menu-back"><i class="icomoon-arrow-left"></i></span>'); 74 75 var $sub_parent = $(mobile_menu).find('.sub-menu-arrow'); 76 77 $sub_parent.click(function(){ 78 var $that = $(this); 79 var $parent_menu = $that.parents('.menu'); 80 var $current_item = $that.next('.sub-menu'); 81 $parent_menu.addClass('sub-level-open'); 82 $current_item.addClass('sub-menu-open'); 83 }); 84 85 var $sub_back = $('.sub-menu-back'); 86 87 $sub_back.click(function(){ 88 var $that = $(this); 89 var $currentItem = $that.parent('.sub-menu'); 90 var $parent_menu = $that.parents('.menu'); 91 $currentItem.removeClass('sub-menu-open'); 92 $parent_menu.removeClass('sub-level-open'); 93 }); 94 95 }); 96 97 /* Mobile Search Form */ 98 $('.top-strip .mobile-search-button').click(function(){ 99 $('.top-strip').toggleClass('search-form-open'); 100 $('.top-strip .search-form input').focus(); 101 }); 102 103 /* Header search button */ 104 function header_search() { 105 106 var input = '#searchform #s', 107 button = '#searchform button'; 108 109 $(button).attr('disabled', 'disabled'); 110 111 $(input).keyup(function() { 112 if ($(input).val() == '' ) { 113 $(button).attr('disabled', 'disabled'); 114 } else { 115 $(button).removeAttr('disabled'); 116 } 117 }); 118 119 } header_search(); 120 121 122 /* Sliders */ 123 $(function() { 124 125 var $slider_arrows = { 126 prevArrow:'<a heref="#" class="slider-nav-arrow prev-arrow"></a>', 127 nextArrow:'<a heref="#" class="slider-nav-arrow next-arrow"></a>' 128 }; 129 130 $(function() { 131 // Posts slider 132 $('.posts-slider').slick( 133 $.extend({ 134 dots:true, 135 autoplay:true, 136 autoplaySpeed:5000, 137 adaptiveHeight:true 138 }, $slider_arrows) 139 ); 140 141 $('.posts-slider .slick-dots').each(function(){ 142 var slider_image_count = $(this).children().length; 143 $(this).append( '<li class="slider-image-count">' + slider_image_count + '</li>'); 144 }); 145 146 }); 147 148 // Widgets slider 149 $('.widget-slider').slick( 150 $.extend({ 151 autoplay:true, 152 autoplaySpeed:5000, 153 adaptiveHeight:true 154 }, $slider_arrows) 155 ); 156 157 // Featured Posts carousel 158 $('.featured-carousel').slick( 159 $.extend({ 160 rows:2, 161 vertical:true, 162 slidesToShow:2, 163 slidesToScroll:2, 164 infinite:false, 165 verticalSwiping:true, 166 appendArrows:$('.featured-posts .carousel-navigation'), 167 responsive:[ 168 { 169 breakpoint:750, 170 settings: { 171 vertical:false, 172 slidesToShow:1, 173 slidesToScroll:1, 174 infinite:true, 175 adaptiveHeight:true, 176 verticalSwiping:false 177 } 178 } 179 ] 180 }, $slider_arrows) 181 ); 182 183 184 $(function() { 185 186 var $FullWidthCarousel = $('.full-width-media .gallery-carousel'), 187 $AboveContentCarousel = $('.above-content-media .gallery-carousel'); 188 189 var $GalleryCaption = $('.gallery-caption'); 190 191 // Page Composer and Post Format carousel 192 $FullWidthCarousel.slick( 193 $.extend({ 194 dots:true, 195 centerMode:true, 196 variableWidth:true, 197 responsive: [{ 198 breakpoint:480, 199 settings: { 200 centerMode:false, 201 variableWidth:false, 202 adaptiveHeight:true 203 } 204 }] 205 }, $slider_arrows) 206 ); 207 208 // Gallery Above the Content 209 $AboveContentCarousel.slick({ 210 arrows:false, 211 adaptiveHeight:true, 212 asNavFor:$GalleryCaption 213 }); 214 215 // Gallery Caption 216 $GalleryCaption.slick( 217 $.extend({ 218 dots:true, 219 fade:true, 220 adaptiveHeight:true, 221 asNavFor:$AboveContentCarousel 222 }, $slider_arrows) 223 ); 224 225 $([$FullWidthCarousel, $GalleryCaption]).each( function(){ 226 var $slider_image_count = $(this).find('.slick-dots li').length; 227 $(this).find('.slick-dots').append( '<li class="slider-image-count">' + $slider_image_count + '</li>'); 228 }); 229 230 }); 231 232 // Related posts 233 $(function() { 234 var $carousel = $('.related-posts').find('.carousel'); 235 $carousel.slick( 236 $.extend({ 237 slidesToShow:3, 238 adaptiveHeight:true, 239 responsive: [{ 240 breakpoint:750, 241 settings: { 242 slidesToShow:1 243 } 244 }] 245 }, $slider_arrows) 246 ) 247 .on('afterChange', function() { 248 $carousel.find('.entry-image').addClass('inview'); 249 }); 250 }); 251 252 // Authors widget 253 $(function(){ 254 255 var $carousel = $('.widget_ti_site_authors .carousel'); 256 var n = $carousel.find('.item').length; 257 if (n > 10) { 258 259 $carousel.slick( 260 $.extend({ 261 rows:2, 262 slidesToShow:5, 263 variableWidth:true 264 }, $slider_arrows) 265 ); 266 267 $carousel.addClass('with-arrows'); 268 269 } 270 271 }); 272 273 // Latest Reviews Slider 274 $(function() { 275 276 var $carousel = $('.latest-reviews-carousel'); 277 278 var $flag = $('#content').find('> .wrapper'), 279 number_slides = 4; 280 if ( $flag.hasClass('with-sidebar') ) { 281 number_slides = 3; 282 } 283 284 $carousel.on('init', function(){ 285 $(this).addClass('carousel-initialized'); 286 }); 287 288 $carousel.slick({ 289 dots:true, 290 arrows:false, 291 infinite:false, 292 slidesToShow:number_slides, 293 slidesToScroll:number_slides, 294 adaptiveHeight:true, 295 responsive:[{ 296 breakpoint:960, 297 settings: { 298 slidesToShow:2, 299 slidesToScroll:2 300 } 301 },{ 302 breakpoint:750, 303 settings: { 304 slidesToShow:1, 305 slidesToScroll:1 306 } 307 }] 308 }); 309 310 }); 311 312 // Latest By Format Slider 313 $(function LatestFormatSlider() { 314 315 var Container = $('.media-posts'); 316 317 $(Container).each(function() { 318 319 var Slides = $(this).find('.media-post-slides'), 320 Thumbs = $(this).find('.media-post-thumbs'), 321 Details = $(this).find('.media-post-details'), 322 BgImage = $(this).find('.media-post-bg'); 323 324 Slides.on('init', function(){ 325 $(this).parents().eq(1).addClass('section-init'); 326 }); 327 328 Slides.on('beforeChange', function() { 329 $(this).find('.media-content').empty(); 330 $(this).find('.entry-image').removeClass('content-loading content-added'); 331 }); 332 333 Slides.slick( 334 $.extend({ 335 slidesToShow:1, 336 fade:true, 337 asNavFor:Thumbs.add(Details).add(BgImage), 338 responsive: [{ 339 breakpoint:750, 340 settings: { 341 fade:false, 342 adaptiveHeight:true 343 } 344 }] 345 }, $slider_arrows) 346 ); 347 348 Details.slick({ 349 slidesToShow:1, 350 fade:true, 351 arrows:false, 352 asNavFor:Slides.add(Thumbs) 353 }); 354 355 Thumbs.slick({ 356 slidesToShow:3, 357 slidesToScroll:1, 358 centerMode:true, 359 centerPadding:0, 360 focusOnSelect:true, 361 dots:true, 362 arrows:false, 363 asNavFor:Slides.add(Details).add(BgImage) 364 }); 365 366 BgImage.slick({ 367 slidesToShow:1, 368 fade:true, 369 arrows:false, 370 asNavFor:Slides.add(Thumbs) 371 }); 372 373 }); 374 375 }); 376 377 // Single Rating. Add slider if more than six items were added 378 $('.rating-labels').slick( 379 $.extend({ 380 slidesToShow:7, 381 responsive:[{ 382 breakpoint:960, 383 settings: { 384 slidesToShow:4 385 } 386 }] 387 }, $slider_arrows) 388 ); 389 390 }); // end of sliders 391 392 393 /* Masonry Layout */ 394 $(function() { 395 var $m_container = $('.ltr .masonry-layout'); 396 $m_container.imagesLoaded( function() { 397 $m_container.masonry({ 398 itemSelector:'.post-item' 399 }); 400 }); 401 });
402 403 $(function() { // Right-To-Left direction 404 var $m_container = $('.rtl .masonry-layout'); 405 $m_container.imagesLoaded( function() { 406 $m_container.masonry({ 407 itemSelector:'.post-item', 408 isOriginLeft:false 409 }); 410 }); 411 }); 412 413 414 /* Tabs */ 415 var tabContainers = $('.tab-box .tab-box-content > div'); 416 tabContainers.addClass('tab-hidden').filter(':first').addClass('tab-visible'); 417 418 $('.tab-box .tab-box-button a').click(function(e) { 419 e.preventDefault(); 420 tabContainers.addClass('tab-hidden').removeClass('tab-visible'); 421 tabContainers.filter(this.hash).addClass('tab-visible').removeClass('tab-hidden'); 422 $('.tab-box .tab-box-button a').removeClass('active'); 423 $(this).addClass('active'); 424 }).filter(':first').click(); 425 426 427 /* WordPress Editor Gallery */ 428 if ( $().imgLiquid ){ 429 $('.custom-gallery').find('.gallery-item').imgLiquid({ 430 fill:true 431 }); 432 } 433 434 435 /* Sticky sidebar */ 436 function stickySidebar() { 437 $('.sidebar-fixed').hcSticky({ 438 top:70, 439 bottomEnd:0, 440 offResolutions:[-1024], 441 wrapperClassName:'sticky-bar-container' 442 }); 443 } 444 445 if ($(window).width() > 1024) { 446 stickySidebar(); 447 } 448 449 450 /* Force equal height in Grid layout */ 451 $('.grid-layout:not(".details-hover")').each(function() { 452 $(this).find('.entry-header').responsiveEqualHeightGrid(); 453 }); 454 455 /* Show an animation when images are loaded */ 456 $(window).on('load resize scroll', function() { 457 $('.entry-image:in-viewport').addClass('inview'); 458 }); 459 460 /* Show bottom single post slide dock */ 461 function slideDock() { 462 var random_post = $('.slide-dock'), 463 image = random_post.find('.entry-image'), 464 viewport = $('#footer'); 465 466 if ( $(window).width() < 960 ) { 467 viewport = $('#footer .copyright'); 468 } 469 470 if ( viewport.is( ':in-viewport' ) ) { 471 random_post.addClass('slide-dock-on'); 472 image.addClass('inview'); 473 } else { 474 random_post.removeClass('slide-dock-on'); 475 } 476 477 } 478 479 $(window).scroll(function() { 480 slideDock(); 481 }); 482 483 $('.close-dock').click(function(e){ 484 e.preventDefault(); 485 $('.slide-dock').toggleClass('slide-dock-on slide-dock-off'); 486 }); 487 488 /* Sitemap toggle */ 489 $('.sitemap .row .trigger').click(function(e){ 490 e.preventDefault(); 491 $(this).toggleClass('active').next().slideToggle('fast'); 492 }); 493 494 495 /* LightBox */ 496 if ( $().swipebox ){ 497 $('.custom-gallery .gallery-item a').swipebox({ 498 hideBarsDelay:0 499 }); 500 501 $('.entry-content a[href$="jpg"],.entry-content a[href$="jpeg"],.entry-content a[href$="png"],.entry-content a[href$="gif"]').swipebox({ 502 hideBarsDelay:0 503 }); 504 } 505 506 507 /* Fluid Width Video */ 508 if ( $().fitVids ){ 509 $('.video-wrapper, .entry-content, .page-content, .advertising').fitVids({ignore:'[src*="youtube.com/subscribe_widget"]'}); 510 } 511 512 513 /* Social icons */ 514 $('.share-more').click(function(){ 515 $(this).toggleClass('share-more-opened'); 516 }); 517 518 519 /* Scroll to comments form */ 520 $('[href^="#comments"]').click(function(e){ 521 e.preventDefault(); 522 $('html, body').animate({scrollTop: $('#comments').offset().top}, 700); 523 }); 524 525 /* Back to Top link */ 526 $('.back-top').click(function(e){ 527 e.preventDefault(); 528 $('html, body').animate({scrollTop:0}, 'fast'); 529 }); 530 531});// - document ready
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.