1(function($) { 2 "use strict"; 3 var PENCI = PENCI || {}; 4 5 /* General functions 6 ---------------------------------------------------------------*/ 7 PENCI.general = function () { 8 // Top search 9 $( '#top-search a.search-click' ).on( 'click', function () { 10 $( '.show-search' ).fadeToggle(); 11 $( '.show-search input.search-input' ).focus(); 12 } ); 13 14 // Go to top 15 $( '.go-to-top' ).on( 'click', function () { 16 $( 'html, body' ).animate( { scrollTop: 0 }, 700 ); 17 return false; 18 } ); 19 20 // Double Touch To Go 21 if ( $().doubleTouchToGo ) { 22 $( '#navigation .menu li.menu-item-has-children, #navigation .menu li.penci-mega-menu' ).doubleTouchToGo(); 23 } // doubleTouchToGo 24 } 25 26 /* Sticky main navigation 27 ---------------------------------------------------------------*/ 28 PENCI.main_sticky = function () { 29 if ( $().sticky ) { 30 var spaceTop = 0; 31 if ( $( 'body' ).hasClass( 'admin-bar' ) ) { 32 spaceTop = 32; 33 } 34 $( "nav#navigation" ).each( function () { 35 $( this ).sticky( { topSpacing: spaceTop } ); 36 } ); 37 } // sticky 38 } 39 40 /* Countdown 41 ---------------------------------------------------------------*/ 42 PENCI.count_down = function () { 43 if ( $( '.penci-countdown' ).length > 0 ) { 44 var $this = $( '.penci-countdown' ), 45 count_time = $this.data( 'time' ); 46 $( '.penci-countdown' ).countdown( count_time ).on( 'update.countdown', function ( event ) { 47 var $this = $( this ).html( event.strftime( '<div class="countdown-row">' 48 + '<span class="countdown-section"><span class="countdown-amount">%-m</span><span class="countdown-period">Months</span></span>'
49 + '<span class="countdown-section"><span class="countdown-amount">%-d</span><span class="countdown-period">Days</span></span>' 50 + '<span class="countdown-section"><span class="countdown-amount">%H</span><span class="countdown-period">Hours</span></span>' 51 + '<span class="countdown-section"><span class="countdown-amount">%M</span><span class="countdown-period">Minutes</span></span>' 52 + '<span class="countdown-section"><span class="countdown-amount">%S</span><span class="countdown-period">Seconds</span></span>' 53 + '</div>') ); 54 } ); 55 } 56 } 57 58 /* Slick home page carousel featured posts 59 ---------------------------------------------------------------*/ 60 PENCI.carousel_homepage = function () { 61 if ( $().slick ) { 62 $( '.featured-carousel' ).each( function () { 63 var $this = $( this ), 64 autoplay = $this.data( 'auto' ), 65 autotime = $this.data( 'autotime' ), 66 autospeed = $this.data( 'speed' ); 67 if ( $this.hasClass( 'style-2' ) ) { 68 $this.slick( { 69 dots : false, 70 infinite : true, 71 speed : autospeed, 72 slidesToShow : 1, 73 slidesToScroll: 1, 74 autoplay : autoplay, 75 autoplaySpeed : autotime, 76 centerMode : true, 77 variableWidth : true, 78 nextArrow : '<button type="button" class="slick-next slick-nav"><i class="fa fa-angle-right"></i></button>', 79 prevArrow : '<button type="button" class="slick-prev slick-nav"><i class="fa fa-angle-left"></i></button>' 80 } ); // slick 81 } else if ( $this.hasClass( 'style-7' ) ) { 82 $this.slick( { 83 dots : false, 84 infinite : false, 85 speed : autospeed, 86 slidesToShow : 2, 87 slidesToScroll: 1, 88 autoplay : autoplay, 89 autoplaySpeed : autotime, 90 centerMode : false, 91 variableWidth : false, 92 nextArrow : '<button type="button" class="slick-next slick-nav"><i class="fa fa-angle-right"></i></button>', 93 prevArrow : '<button type="button" class="slick-prev slick-nav"><i class="fa fa-angle-left"></i></button>', 94 responsive : [ 95 { 96 breakpoint: 960, 97 settings : { 98 slidesToShow : 1, 99 slidesToScroll: 1 100 } 101 } 102 ] 103 } ); // slick 104 } 105 else { 106 $this.slick( { 107 dots : false, 108 infinite : true, 109 speed : autospeed, 110 slidesToShow : 1, 111 slidesToScroll: 1, 112 autoplay : autoplay, 113 autoplaySpeed : autotime, 114 centerMode : false, 115 variableWidth : false, 116 adaptiveHeight: true, 117 nextArrow : '<button type="button" class="slick-next slick-nav"><i class="fa fa-angle-right"></i></button>', 118 prevArrow : '<button type="button" class="slick-prev slick-nav"><i class="fa fa-angle-left"></i></button>' 119 } ); // slick 120 } 121 $this.on( 'setPosition', function ( event, slick, direction ) { 122 $this.parent().addClass( 'loaded' ); 123 PENCI.carousel_fixtop(); 124 PENCI.arrows_carousel(); 125 $(window ).load( function() { 126 $this.parent().addClass( 'loaded-wait' ); 127 } ); 128 } ); 129 } ); // each 130 } // if slick 131 } 132 133 134 /* Fix position arrows carousel homepage 135 ---------------------------------------------------------------*/ 136 PENCI.arrows_carousel = function () { 137 $('.featured-area.style-2 button.slick-prev' ).each( function(){ 138 var $this = $(this ), 139 $center_width = $this.parent().find( '.slick-center' ).width(), 140 $win_width = $this.closest( '.featured-area' ).width(); 141 var $pos_this = ( ( $win_width - $center_width )/2 ) - 22; 142 $this.css( "left", $pos_this + 'px' ); 143 $this.next().css( "right", $pos_this + 'px' ); 144 } ); 145 } 146 147 /* Fix top featured carousel slider 148 ---------------------------------------------------------------*/ 149 PENCI.carousel_fixtop = function () { 150 $('.featured-carousel .featured-content' ).each( function(){ 151 var $this = $(this ), 152 this_height = $this.height(), 153 parent_height = $this.parent().height(); 154 var top_this = ( parent_height - this_height )/2; 155 $this.css( "top", top_this + 'px' ); 156 } ); 157 } 158 159 /* Penci Slider 160 ---------------------------------------------------------------*/ 161 PENCI.flexslider = function () { 162 $( window ).load( function () { 163 /* Load all slider */ 164 $( '.penci-slider, .penci-magazine-slider' ).each( function () { 165 var $this = $( this ), 166 $smooth = false, 167 $control = false, 168 $dir = true; 169 if ( $this.attr( 'data-smooth' ) ) { $smooth = true; } 170 if ( $this.attr( 'data-control' ) ) { $control = true; } 171 if ( $this.attr( 'data-dir' ) ) { $dir = false; } 172 173 $this.flexslider( { 174 namespace : "penci-", 175 animation : 'slide', 176 slideshow : $this.data( 'auto' ), 177 slideshowSpeed: $this.data( 'autotime' ), 178 animationSpeed: $this.data( 'speed' ), 179 smoothHeight : $smooth, 180 controlNav : $control, 181 directionNav : $dir, 182 pauseOnHover : true, 183 prevText : '<i class="fa fa-angle-left"></i>', 184 nextText : '<i class="fa fa-angle-right"></i>', 185 start : function ( slider ) { 186 $this.parent().addClass( 'loaded' ); 187 PENCI.fixtop(); 188 $this.parent().addClass( 'loaded-wait' ); 189 } 190 } ); 191 } ); 192 } ); 193 } 194 195 /* Headline Posts 196 ----------------------------------------------------------------*/ 197 PENCI.headline = function () { 198 if ( $().slick ) { 199 $( '.penci-headline-posts' ).each( function () { 200 var $this = $( this ); 201 $this.slick( { 202 dots : false, 203 infinite : true, 204 speed : $this.data( 'speed' ), 205 slidesToShow : 1, 206 slidesToScroll: 1, 207 vertical : true, 208 autoplay : $this.data( 'auto' ), 209 autoplaySpeed : $this.data( 'autotime' ), 210 nextArrow : '<button type="button" class="slick-next slick-nav"><i class="fa fa-angle-right"></i></button>', 211 prevArrow : '<button type="button" class="slick-prev slick-nav"><i class="fa fa-angle-left"></i></button>' 212 } ); // slick 213 214 $this.on( 'setPosition', function ( event, slick, direction ) { 215 $(window ).load( function() { 216 PENCI.fixheadline(); 217 $this.parent().addClass( 'loaded' ); 218 } ); 219 } ); 220 } ); 221 } 222 } 223 224 /* Fix margin headline 225 ----------------------------------------------------------------*/ 226 PENCI.fixheadline = function () { 227 var $headline_title = $( '.penci-headline .headline-title' ); 228 if ( $headline_title.length ) { 229 var headline_w = $headline_title.outerWidth() + 70; 230 $('.penci-headline-posts' ).css( 'margin-left', headline_w + 'px' ); 231 } 232 } 233
234 /* Fix top penci slider 235 ---------------------------------------------------------------*/ 236 PENCI.fixtop = function () { 237 $('.penci-slider .pencislider-container' ).each( function(){ 238 var $this = $(this ), 239 parent_slider = $this.closest('.penci-slider' ), 240 this_height = $this.height(), 241 parent_height = $this.parent().height(); 242 if( parent_slider.hasClass('fixed-height') ){ 243 parent_height = parent_slider.height(); 244 } 245 var top_this = ( parent_height - this_height )/2; 246 $this.css( "top", top_this + 'px' ); 247 } ); 248 } 249 250 /* Fitvids 251 ---------------------------------------------------------------*/ 252 PENCI.fitvids = function() { 253 // Target your .container, .wrapper, .post, etc. 254 $( ".container" ).fitVids(); 255 } 256 257 /* Slick slider 258 ---------------------------------------------------------------*/ 259 PENCI.slider = function() { 260 if ( $().slick ) { 261 $( '.penci-slick-slider' ).each(function(){ 262 var $this = $(this), 263 adapheight = $this.data('auto-height'); 264 if( typeof adapheight === "undefined" ) { adapheight = true; } 265 $this.slick({ 266 dots: false, 267 infinite: true, 268 speed: 500, 269 slidesToShow: 1, 270 nextArrow : '<button type="button" class="slick-next slick-nav"><i class="fa fa-angle-right"></i></button>', 271 prevArrow : '<button type="button" class="slick-prev slick-nav"><i class="fa fa-angle-left"></i></button>', 272 adaptiveHeight: adapheight 273 }); // slick 274 275 $this.on('setPosition', function(event, slick, direction){ 276 $this.addClass('loaded'); 277 }); 278 }); // each 279 } 280 } 281 282 /* Slick carousel 283 ---------------------------------------------------------------*/ 284 PENCI.carousel = function() { 285 if ( $().slick ) { 286 $( '.penci-carousel' ).each(function(){ 287 var $this = $( this ), 288 slide = 4, 289 autoplay = $this.data( 'auto' ), 290 dots_show = $this.data( 'dots' ), 291 arrows_show = $this.data( 'arrows' ), 292 infiloop = false, 293 tablet_slide = 2; 294 if ( $( '.container-single' ).hasClass( 'penci_sidebar' ) ) { slide = 3; }
295 if ( $this.hasClass( 'penci-magcat-carousel' ) ) { slide = 2; infiloop = true; tablet_slide = 1; } 296 $this.slick( { 297 infinite : infiloop, 298 slidesToShow : slide, 299 slidesToScroll: slide, 300 dots : dots_show, 301 autoplay : autoplay, 302 autoplaySpeed : 5000, 303 speed : 700, 304 arrows : arrows_show, 305 nextArrow : '<button type="button" class="slick-next slick-nav"><i class="fa fa-angle-right"></i></button>', 306 prevArrow : '<button type="button" class="slick-prev slick-nav"><i class="fa fa-angle-left"></i></button>', 307 responsive : [ 308 { 309 breakpoint: 1169, 310 settings : { 311 slidesToShow : 2, 312 slidesToScroll: 2 313 } 314 }, 315 { 316 breakpoint: 960, 317 settings : { 318 slidesToShow : 2, 319 slidesToScroll: 2 320 } 321 }, 322 { 323 breakpoint: 768, 324 settings : { 325 slidesToShow : tablet_slide, 326 slidesToScroll: tablet_slide 327 } 328 }, 329 { 330 breakpoint: 480, 331 settings : { 332 slidesToShow : 1, 333 slidesToScroll: 1 334 } 335 } 336 ] 337 } ); // slick 338 339 $this.on( 'setPosition', function ( event, slick, direction ) { 340 $this.addClass( 'loaded' ); 341 } ); 342 }); // each 343 } 344 } 345 346 /* Sticky sidebar 347 ----------------------------------------------------------------*/ 348 PENCI.sticky_sidebar = function() { 349 if ( $().theiaStickySidebar ) { 350 var top_margin = 90; 351 if( $('body' ).hasClass('admin-bar') ) { 352 top_margin = 122; 353 } 354 $('#main.penci-main-sticky-sidebar, #sidebar.penci-sticky-sidebar' ).theiaStickySidebar({ 355 // settings 356 additionalMarginTop: top_margin 357 }); 358 } // if sticky 359 } 360 361 /* Mega menu 362 ----------------------------------------------------------------*/ 363 PENCI.mega_menu = function () { 364 $( '#navigation .penci-mega-child-categories a' ).mouseenter( function () { 365 if ( !$( this ).hasClass( 'cat-active' ) ) { 366 var $this = $( this ), 367 $row_active = $this.data( 'id' ), 368 $parentA = $this.parent().children( 'a' ), 369 $parent = $this.closest( '.penci-megamenu' ), 370 $rows = $this.closest( '.penci-megamenu' ).find( '.penci-mega-latest-posts' ).children( '.penci-mega-row' ); 371 $parentA.removeClass( 'cat-active' ); 372 $this.addClass( 'cat-active' ); 373 $rows.hide(); 374 $parent.find( '.' + $row_active ).fadeIn( 'normal' ).css( 'display', 'inline-block' ); 375 } 376 } ); 377 } 378 379 /* Mobile menu responsive 380 ----------------------------------------------------------------*/ 381 PENCI.mobile_menu = function () { 382 // Add indicator 383 $( '#sidebar-nav .menu li.menu-item-has-children > a' ).append( '<u class="indicator"><i class="fa fa-angle-down"></i></u>' ); 384 385 // Toggle menu when click show/hide menu 386 $( '#navigation .button-menu-mobile' ).on( 'click', function () { 387 $( 'body' ).addClass( 'open-sidebar-nav' ); 388 } ); 389 390 // indicator click 391 $( '#sidebar-nav .menu li a .indicator' ).on( 'click', function ( e ) { 392 var $this = $( this ); 393 e.preventDefault(); 394 $this.children().toggleClass( 'fa-angle-up' ); 395 $this.parent().next().slideToggle( 'fast' ); 396 } ); 397 398 // Close sidebar nav 399 $( '#close-sidebar-nav' ).on( 'click', function () { 400 $( 'body' ).removeClass( 'open-sidebar-nav' ); 401 } ); 402 } 403 404 /* Pinterest widget 405 ----------------------------------------------------------------*/ 406 PENCI.pinterest_widget = function() { 407 if ( $().isotope ) { 408 $( '.penci-pinterest-widget-container .penci-images-pin-widget' ).each( function () { 409 var $this = $( this ); 410 $( window ).load( function () { 411 $this.isotope( { 412 itemSelector : 'a', 413 transitionDuration: '.55s', 414 layoutMode : 'masonry' 415 } ); // isotope 416 $this.parent().removeClass( 'penci-loading' ); 417 } ); // load 418 } ); // each .penci-portfolio 419 } // end if isotope 420 } 421 422 /* Light box 423 ----------------------------------------------------------------*/ 424 PENCI.lightbox = function () { 425 if ( $().magnificPopup) { 426 $( 'a[data-rel^="penci-gallery-image-content"], .penci-enable-lightbox .gallery-item a' ).magnificPopup( { 427 type : 'image', 428 closeOnContentClick: true, 429 closeBtnInside : false, 430 fixedContentPos : true, 431 image : { 432 verticalFit: true 433 }, 434 gallery : { 435 enabled: true 436 }, 437 zoom : { 438 enabled : true, 439 duration: 300 // don't foget to change the duration also in CSS 440 } 441 } ); 442 } // if magnificPopup exists 443 } 444 445 /* Masonry layout 446 ----------------------------------------------------------------*/ 447 PENCI.masonry = function() { 448 $(window).load(function() { 449 var $masonry_container = $( '.penci-masonry' ); 450 if ( $masonry_container.length ) { 451 $masonry_container.each( function () { 452 var $this = $( this ); 453 // initialize isotope 454 $this.isotope( { 455 itemSelector : '.item-masonry', 456 transitionDuration: '.55s', 457 layoutMode : 'masonry' 458 } ); 459 } ); 460 } 461 }); 462 } 463
464 /* Video Background 465 ----------------------------------------------------------------*/ 466 PENCI.video_background = function() { 467 var $penci_videobg = $( '#penci-featured-video-bg' ); 468 if ( $().mb_YTPlayer && $penci_videobg.length ) { 469 $(window ).load( function() { 470 $("#penci-featured-video-bg").mb_YTPlayer(); 471 setTimeout(function(){ 472 $('.featured-area').addClass( 'loaded-wait' ).append('<div class="overlay-video-click"></div>'); 473 $('.overlay-video-click').on( 'click', function () { 474 var $this = $(this); 475 if( !$this.hasClass( 'pause-video' ) ) { 476 $this.addClass('pause-video'); 477 jQuery('#penci-featured-video-bg').pauseYTP(); 478 } else { 479 $this.removeClass('pause-video'); 480 jQuery('#penci-featured-video-bg').playYTP(); 481 } 482 }); 483 }, 4000); 484 } ); 485 } 486 } 487 488 /* Portfolio 489 ----------------------------------------------------------------*/ 490 PENCI.portfolio = function () { 491 var $penci_portfolio = $( '.penci-portfolio' ); 492 if ( $().isotope && $penci_portfolio.length ) { 493 $( '.penci-portfolio' ).each( function () { 494 var $this = $( this ); 495 $( window ).load( function () { 496 $this.isotope( { 497 itemSelector : '.portfolio-item', 498 animationEngine : 'best-available', 499 animationOptions: { 500 duration: 250, 501 queue : false 502 } 503 } ); // isotope 504 505 $this.addClass( 'loaded' ); 506 507 $('.portfolio-item .inner-item-portfolio').each( function () { 508 var $this = $( this ); 509 $this.one( 'inview', function ( event, isInView, visiblePartX, visiblePartY ) { 510 $this.addClass( 'animated' ); 511 } ); // inview 512 } ); // each 513 514 } ); // load 515 516 // filter items when filter link is clicked 517 $this.parent().find( '.penci-portfolio-filter' ).find( 'li' ).on( 'click', function () { 518 $this.parent().find( '.penci-portfolio-filter' ).find( 'li' ).removeClass( 'active' ); 519 $( this ).addClass( 'active' ); 520 var selector = $( this ).find( "a" ).attr( 'data-filter' ); 521 $this.isotope( { filter: selector } ); 522 return false; 523 } ); 524 } ); // each .penci-portfolio 525 526 } // end if isotope & portfolio 527 } 528 529 /* Init functions 530 ---------------------------------------------------------------*/ 531 $(document).ready(function() { 532 PENCI.general(); 533 PENCI.main_sticky(); 534 PENCI.count_down(); 535 PENCI.carousel_homepage(); 536 PENCI.flexslider(); 537 PENCI.headline(); 538 PENCI.fitvids(); 539 PENCI.slider(); 540 PENCI.carousel(); 541 PENCI.sticky_sidebar(); 542 PENCI.mega_menu(); 543 PENCI.mobile_menu(); 544 PENCI.pinterest_widget(); 545 PENCI.lightbox(); 546 PENCI.masonry(); 547 PENCI.video_background(); 548 PENCI.portfolio(); 549 $(window ).resize( function(){ PENCI.sticky_sidebar(); PENCI.fixtop(); PENCI.carousel_fixtop(); } ); 550 }); 551 552})(jQuery); // EOF
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.