1(function($){ 2 "use strict"; 3 4 CherryJsCore.utilites.namespace('theme_script'); 5 CherryJsCore.theme_script = { 6 init: function () { 7 var self = this; 8 9 // Document ready event check 10 if( CherryJsCore.status.is_ready ){ 11 self.document_ready_render( self ); 12 }else{ 13 CherryJsCore.variable.$document.on( 'ready', self.document_ready_render( self ) ); 14 } 15 16 // Windows load event check 17 if( CherryJsCore.status.on_load ){ 18 self.window_load_render( self ); 19 }else{ 20 CherryJsCore.variable.$window.on( 'load', self.window_load_render( self ) ); 21 } 22 }, 23 24 document_ready_render: function ( self ) { 25 var self = self; 26 27 self.smart_slider_init( self ); 28 self.swiper_carousel_init( self ); 29 self.featured_posts_block_init( self ); 30 self.news_smart_box_init( self ); 31 self.post_formats_custom_init( self ); 32 self.navbar_init( self ); 33 self.subscribe_init( self ); 34 self.main_menu( self, $( '.main-navigation' ) ); 35 self.to_top_init( self ); 36 }, 37 38 window_load_render: function ( self ) { 39 var self = self; 40 self.page_preloader_init( self ); 41 }, 42 43 smart_slider_init: function( self ) { 44 $( '.king_news-smartslider' ).each( function() { 45 var slider = $(this), 46 sliderId = slider.data('id'), 47 sliderWidth = slider.data('width'), 48 sliderHeight = slider.data('height'), 49 sliderOrientation = slider.data('orientation'), 50 slideDistance = slider.data('slide-distance'), 51 slideDuration = slider.data('slide-duration'), 52 sliderFade = slider.data('slide-fade'), 53 sliderNavigation = slider.data('navigation'), 54 sliderFadeNavigation = slider.data('fade-navigation'), 55 sliderPagination = slider.data('pagination'), 56 sliderAutoplay = slider.data('autoplay'), 57 sliderFullScreen = slider.data('fullscreen'), 58 sliderShuffle = slider.data('shuffle'), 59 sliderLoop = slider.data('loop'), 60 sliderThumbnailsArrows = slider.data('thumbnails-arrows'), 61 sliderThumbnailsPosition = slider.data('thumbnails-position'), 62 sliderThumbnailsWidth = slider.data('thumbnails-width'), 63 sliderThumbnailsHeight = slider.data('thumbnails-height'); 64 65 if ( $('.king_news-smartslider__slides', '#' + sliderId ).length > 0 ) { 66 $( '#' + sliderId ).sliderPro( { 67 width: sliderWidth, 68 height: sliderHeight, 69 orientation: sliderOrientation, 70 slideDistance: slideDistance, 71 slideAnimationDuration: slideDuration, 72 fade: sliderFade, 73 arrows: sliderNavigation, 74 fadeArrows: sliderFadeNavigation, 75 buttons: sliderPagination, 76 autoplay: sliderAutoplay, 77 fullScreen: sliderFullScreen, 78 shuffle: sliderShuffle, 79 loop: sliderLoop, 80 waitForLayers: false, 81 thumbnailArrows: sliderThumbnailsArrows, 82 thumbnailsPosition: sliderThumbnailsPosition, 83 thumbnailWidth: sliderThumbnailsWidth, 84 thumbnailHeight: sliderThumbnailsHeight, 85 init: function() { 86 $( this ).resize(); 87 slider.fadeTo(500, 1); 88 }, 89 breakpoints: { 90 992: { 91 height: parseFloat( sliderHeight ) * 0.75, 92 }, 93 768: { 94 height: parseFloat( sliderHeight ) * 0.5 95 } 96 } 97 } ); 98 } 99 });//each end 100 }, 101 102 swiper_carousel_init: function ( self ) { 103 104 // Enable swiper carousels 105 jQuery('.king_news-carousel').each( function() { 106 var swiper = null, 107 uniqId = jQuery(this).data('uniq-id'), 108 slidesPerView = parseFloat( jQuery(this).data('slides-per-view') ), 109 slidesPerGroup = parseFloat( jQuery(this).data('slides-per-group') ), 110 slidesPerColumn = parseFloat( jQuery(this).data('slides-per-column') ), 111 spaceBetweenSlides = parseFloat( jQuery(this).data('space-between-slides') ), 112 durationSpeed = parseFloat( jQuery(this).data('duration-speed') ), 113 swiperLoop = jQuery(this).data('swiper-loop'), 114 freeMode = jQuery(this).data('free-mode'), 115 grabCursor = jQuery(this).data('grab-cursor'), 116 mouseWheel = jQuery(this).data('mouse-wheel'); 117 118 var swiper = new Swiper( '#' + uniqId, { 119 slidesPerView: slidesPerView, 120 slidesPerGroup: slidesPerGroup, 121 slidesPerColumn: slidesPerColumn, 122 spaceBetween: spaceBetweenSlides, 123 speed: durationSpeed, 124 loop: swiperLoop, 125 freeMode: freeMode, 126 grabCursor: grabCursor, 127 mousewheelControl: mouseWheel, 128 paginationClickable: true, 129 nextButton: '#' + uniqId + '-next', 130 prevButton: '#' + uniqId + '-prev', 131 pagination: '#' + uniqId + '-pagination', 132 breakpoints: { 133 1200: { 134 slidesPerView: Math.floor( slidesPerView * 0.75 ), 135 spaceBetween: Math.floor( spaceBetweenSlides * 0.75 ) 136 }, 137 992: { 138 slidesPerView: Math.floor( slidesPerView * 0.5 ), 139 spaceBetween: Math.floor( spaceBetweenSlides * 0.5 ) 140 }, 141 503: { 142 slidesPerView: Math.floor( slidesPerView * 0.25 ), 143 spaceBetween: Math.floor( spaceBetweenSlides * 0.25 ) 144 }, 145 } 146 } 147 ); 148 }); 149 }, 150 151 152 153 news_smart_box_init: function ( self ) { 154 jQuery('.news-smart-box__instance').each( function() { 155 var uniqId = $( this ).data( 'uniq-id' ), 156 instanceSettings = $( this ).data( 'instance-settings' ), 157 instance = $( '#' + uniqId ), 158 $termItemList = $( '.terms-list .term-item', instance ), 159 $currentTerm = $( '.current-term span', instance ), 160 $listContainer = $( '.news-smart-box__wrapper', instance ), 161 $ajaxPreloader = $( '.nsb-spinner', instance ), 162 ajaxGetNewInstance = null, 163 ajaxGetNewInstanceSuccess = true, 164 showNewItems = null; 165 166 $termItemList.on( 'click', function(){ 167 var slug = $( this ).data( 'slug' ), 168 data = { 169 action: 'new_smart_box_instance', 170 value_slug: slug, 171 instance_settings: instanceSettings 172 }, 173 currentTermName = $( 'span', this ).text(), 174 counter = 0; 175 176 $currentTerm.html( currentTermName ); 177 178 if ( ajaxGetNewInstance !== null ) { 179 ajaxGetNewInstance.abort(); 180 } 181 ajaxGetNewInstance = $.ajax({ 182 type: 'GET', 183 url: king_news.ajaxurl, 184 data: data, 185 cache: false, 186 beforeSend: function(){ 187 ajaxGetNewInstanceSuccess = false;
188 $ajaxPreloader.css( { 'display' : 'block' } ).fadeTo( 300, 1 ); 189 }, 190 success: function( response ){ 191 192 /*for share icons hover appear*/ 193 setTimeout( function() { 194 share_hover_hide_selector = $('.widget-image-grid__footer-meta, .widget-new-smart__post__date, .meta-inner'); 195 // add/remove class for showing share-list in posts 196 $(".share-btns-main").on({ 197 mouseenter: function () { 198 //stuff to do on mouse enter 199 $(this).addClass('show-share-list'); 200 $(this).siblings(share_hover_hide_selector).fadeTo(300, 0); 201 }, 202 mouseleave: function () { 203 //stuff to do on mouse leave 204 $(this).removeClass('show-share-list'); 205 $(this).siblings(share_hover_hide_selector).fadeTo(400, 1); 206 } 207 }); 208 }, 1000 ); 209 210 ajaxGetNewInstanceSuccess = true; 211 212 $ajaxPreloader.fadeTo( 300, 0, function() { 213 $( this ).css( { 'display' : 'none' } ); 214 }); 215 216 $( '.news-smart-box__listing', $listContainer ).html( response ); 217 218 counter = 0; 219 $( '.news-smart-box__listing .post .inner', $listContainer ).addClass( 'animate-cycle-sh
219ow' ); 220 $( '.news-smart-box__listing .post', $listContainer ).each( function() { 221 showItem( $( this ), 100 * parseInt( counter ) + 200 ); 222 counter++; 223 }) 224 225 } 226 }); 227 228 }); 229 230 var showItem = function( itemList, delay ) { 231 var timeOutInterval = setTimeout( function() { 232 $('.inner', itemList).removeClass( 'animate-cycle-show' ); 233 }, delay ); 234 } 235 }); 236 }, 237 238 post_formats_custom_init: function ( self ) { 239 CherryJsCore.variable.$document.on( 'cherry-post-formats-custom-init', function( event ) { 240 241 if ( 'slider' !== event.object ) { 242 return; 243 } 244 245 var uniqId = '#' + event.item.attr( 'id' ), 246 swiper = new Swiper( uniqId, { 247 pagination: uniqId + ' .swiper-pagination', 248 paginationClickable: true, 249 nextButton: uniqId + ' .swiper-button-next', 250 prevButton: uniqId + ' .swiper-button-prev', 251 spaceBetween: 30 252 } ); 253 254 event.item.data( 'initalized', true ); 255 }); 256 }, 257 258 navbar_init: function ( self ) { 259 260 $( window ).load( function() { 261 262 var $navbar = $('.header-container'); 263 264 if ( ! $.isFunction( jQuery.fn.TMStickUp ) || ! $navbar.length ) { 265 return !1; 266 } 267 268 if ( $('#wpadminbar').length ) { 269 $navbar.addClass('has-bar'); 270 } 271 272 // $navbar.stickUp(); 273 $navbar.TMStickUp({}) 274 275 }); 276 }, 277 278 subscribe_init: function( self ) { 279 CherryJsCore.variable.$document.on( 'click', '.subscribe-block__submit', function( event ){ 280 281 event.preventDefault(); 282 283 var $this = $(this), 284 form = $this.parents( 'form' ),
285 nonce = form.find( 'input[name="king_news_subscribe"]' ).val(), 286 mail_input = form.find( 'input[name="subscribe-mail"]' ), 287 mail = mail_input.val(), 288 error = form.find( '.subscribe-block__error' ), 289 success = form.find( '.subscribe-block__success' ), 290 hidden = 'hidden'; 291 292 if ( '' == mail ) { 293 mail_input.addClass( 'error' ); 294 return !1; 295 } 296 297 if ( $this.hasClass( 'processing' ) ) { 298 return !1; 299 } 300 301 $this.addClass( 'processing' ); 302 error.empty(); 303 304 if ( ! error.hasClass( hidden ) ) { 305 error.addClass( hidden ); 306 } 307 308 if ( ! success.hasClass( hidden ) ) { 309 success.addClass( hidden ); 310 } 311 312 $.ajax({ 313 url: king_news.ajaxurl, 314 type: 'post', 315 dataType: 'json', 316 data: { 317 action: 'king_news_subscribe', 318 mail: mail, 319 nonce: nonce 320 }, 321 error: function() { 322 $this.removeClass( 'processing' ); 323 } 324 }).done( function( response ) { 325 326 $this.removeClass( 'processing' ); 327 328 if ( true === response.success ) { 329 success.removeClass( hidden ); 330 mail_input.val(''); 331 return 1; 332 } 333 334 error.removeClass( hidden ).html( response.data.message ); 335 return !1; 336 337 }); 338 339 }) 340 }, 341 342 main_menu: function ( self, target ) { 343 344 var menu = target, 345 duration_timeout, 346 closeSubs, 347 hideSub, 348 showSub, 349 init; 350 351 closeSubs = function() { 352 $( '.menu-hover > a', menu ).each( 353 function() { 354 hideSub( $(this) ); 355 } 356 ); 357 }; 358 359 hideSub = function( anchor ) { 360 361 anchor.parent().removeClass( 'menu-hover' ).triggerHandler( 'close_menu' ); 362 363 anchor.siblings('ul').addClass('in-transition'); 364 365 clearTimeout( duration_timeout ); 366 duration_timeout = setTimeout( 367 function() { 368 anchor.siblings('ul').removeClass( 'in-transition' ); 369 }, 370 200 371 ); 372 }; 373 374 showSub = function( anchor ) { 375 376 // all open children of open siblings 377 var item = anchor.parent(); 378 379 item 380 .siblings() 381 .find( '.menu-hover' ) 382 .addBack( '.menu-hover' ) 383 .children( 'a' ) 384 .each(function() { 385 hideSub( $( this ), true ); 386 }); 387 388 item.addClass( 'menu-hover' ).triggerHandler( 'open_menu' ); 389 }; 390 391 init = function() { 392 var $mainNavigation = $('.main-navigation'), 393 $mainMenu = $('ul.menu', $mainNavigation), 394 $menuToggle = $('.menu-toggle', $mainNavigation); 395 396 $( 'li.menu-item-has-children, li.page_item_has_children', menu ).hoverIntent( { 397 over: function () { 398 showSub( $(this).children('a') ); 399 }, 400 out: function () { 401 if ( $(this).hasClass( 'menu-hover' ) ) { 402 hideSub( $( this ).children( 'a' ) ); 403 } 404 }, 405 timeout: 300 406 } ); 407 408 409 $menuToggle.on( 'click', function(){ 410 $mainNavigation.toggleClass( 'toggled' ); 411 }); 412 }; 413 414 init(); 415 }, 416 417 page_preloader_init: function ( self ) { 418 419 if ( $( '.page-preloader-cover' )[0] ) { 420 $( '.page-preloader-cover' ).delay( 500 ).fadeTo( 500, 0, function() { 421 $( this ).remove(); 422 }); 423 } 424 }, 425 426 to_top_init: function ( self ) { 427 if ( $.isFunction( jQuery.fn.UItoTop ) ) { 428 $().UItoTop({ 429 text: '', 430 scrollSpeed: 600 431 }); 432 } 433 }, 434 435 436 437 438 439 440 featured_posts_block_init: function ( self ) { 441 var $wrappers = $( '.tm_fpblock' ), 442 $wrapper = null, 443 $item = null, 444 $items = [], 445 offset = 0, 446 height = 0; 447 448 /** 449 * Update images height 450 * 451 * @return {boolean} 452 */ 453 function _scaleImage() { 454 if ( ! $wrappers || 455 0 === $wrappers.length ) { 456 return false; 457 } 458 459 $wrappers.each( function() { 460 $wrapper = $( this ); 461 462 if ( $wrapper.hasClass( 'tm_fpblock-layout-4' ) ) { 463 464 $item = $wrapper.find( '.tm_fpblock__item-2' ); 465 height = $item.prev().height(); 466 467 $item.find( '.tm_fpblock__item__preview' ).css( 'height', height ); 468 469 if ( 992 > $( window ).width() && 767 < $( window ).width() ) { 470 $item = $wrapper.find( '.tm_fpblock__item-1' ); 471 offset = ( $item.height() / 2 ); 472
473 $wrapper.find( '.tm_fpblock__item-small:last' ).css( 'top', offset + 'px' ); 474 } else { 475 $wrapper.find( '.tm_fpblock__item-small:last' ).css( 'top', 'auto' ); 476 } 477 478 $item = $wrapper.find( '.tm_fpblock__item:first' ); 479 height = $item.height(); 480 481 $items = $wrapper.find( '.tm_fpblock__item:not(.tm_fpblock__item-1):not(.tm_fpblock__item-2)' ); 482 483 if ( 767 < $( window ).width() ) { 484 height = height / 2; 485 } 486 487 $items.each( function() { 488 $item = $( this ); 489 $item.css( 'height', height ); 490 $item.find( '.tm_fpblock__item__preview' ).css( 'height', height ); 491 $item.find( '.tm_fpblock__item__preview > img' ).css( 'height', height ); 492 } ); 493 } else if ( $wrapper.hasClass( 'tm_fpblock-layout-2' ) || 494 $wrapper.hasClass( 'tm_fpblock-layout-3' ) || 495 $wrapper.hasClass( 'tm_fpblock-layout-5' ) ) { 496 497 $item = $wrapper.find( '.tm_fpblock__item:first' ); 498 height = $item.height(); 499 500 $items = $wrapper.find( '.tm_fpblock__item:not(:first)' ); 501 502 if ( 767 < $( window ).width() ) { 503 height = height / 2; 504 } 505 506 $items.each( function() { 507 $item = $( this ); 508 509 $item.css( 'height', height ); 510 $item.find( '.tm_fpblock__item__preview' ).css( 'height', height ); 511 $item.find( '.tm_fpblock__item__preview > img' ).css( 'height', height ); 512 } ); 513 } else if ( $wrapper.hasClass( 'tm_fpblock-layout-1' ) ) { 514 515 $item = $wrapper.find( '.tm_fpblock__item-large' ); 516 height = $item.height(); 517 518 $items = $wrapper.find( '.tm_fpblock__item:not(.tm_fpblock__item-large)' ); 519 520 if ( 767 < $( window ).width() ) { 521 height = height / 2; 522 } 523 524 $items.each( function() { 525 $item = $( this ); 526 527 $item.css( 'height', height ); 528 $item.find( '.tm_fpblock__item__preview' ).css( 'height', height ); 529 $item.find( '.tm_fpblock__item__preview > img' ).css( 'height', height ); 530 } ); 531 } 532 } ); 533 534 return true; 535 } 536 537 setTimeout(_scaleImage, 10); 538 setTimeout(_scaleImage, 100); 539 540 window.onresize = function() { 541 _scaleImage(); 542 }; 543 } 544 545 546 } 547 CherryJsCore.theme_script.init(); 548}(jQuery)); 549 550 551 552 553 554 555jQuery(document).ready(function($){ 556 557share_hover_hide_selector = $('.widget-image-grid__footer-meta, .widget-new-smart__post__date, .meta-inner'); 558// add/remove class for showing share-list in posts 559$(".share-btns-main").on({ 560 mouseenter: function () { 561 $(this).addClass('show-share-list'); 562 $(this).siblings(share_hover_hide_selector).fadeTo(300, 0); 563 }, 564 mouseleave: function () { 565 $(this).removeClass('show-share-list'); 566 $(this).siblings(share_hover_hide_selector).fadeTo(400, 1); 567 } 568}); 569 570 571if ( $( ".post-left-column" ).length ) { 572 // function for sticky social icons in post and pages 573 (function(){ 574 var a = document.querySelector('.post-left-column'), b = null, P = 100; 575 window.addEventListener('scroll', Ascroll, false); 576 document.body.addEventListener('scroll', Ascroll, false); 577 function Ascroll() { 578 if (b == null) { 579 var Sa = getComputedStyle(a, ''), s = ''; 580 for (var i = 0; i < Sa.length; i++) { 581 if (Sa[i].indexOf('overflow') == 0 || Sa[i].indexOf('padding') == 0 || Sa[i].indexOf('border') == 0 || Sa[i].indexOf('outline') == 0 || Sa[i].indexOf('box-shadow') == 0 || Sa[i].indexOf('background') == 0) { 582 s += Sa[i] + ': ' +Sa.getPropertyValue(Sa[i]) + '; ' 583 } 584 } 585 b = document.createElement('div'); 586 b.style.cssText = s + ' box-sizing: border-box; width: ' + a.offsetWidth + 'px;'; 587 a.insertBefore(b, a.firstChild); 588 var l = a.childNodes.length; 589 for (var i = 1; i < l; i++) { 590 b.appendChild(a.childNodes[1]); 591 } 592 a.style.height = b.getBoundingClientRect().height + 'px'; 593 a.style.padding = '0'; 594 a.style.border = '0'; 595 } 596 var Ra = a.getBoundingClientRect(), 597 R = Math.round(Ra.top + b.getBoundingClientRect().height - document.querySelector('.post-right-column').getBoundingClientRect().bottom); // block selector when the lower edge of which you want to detach the adhesive element 598 if ((Ra.top - P) <= 0) { 599 if ((Ra.top - P) <= R) { 600 b.className = 'stop'; 601 b.style.top = - R +'px'; 602 } else { 603 b.className = 'sticky'; 604 b.style.top = P + 'px'; 605 } 606 } else { 607 b.className = ''; 608 b.style.top = ''; 609 } 610 window.addEventListener('resize', function() { 611 a.children[0].style.width = getComputedStyle(a, '').width 612 }, false); 613 } 614 })(); 615} 616 617 618 619 620});
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.