1/** 2 * Custom.js File 3 * 4 * @package NewsMunch 5 * @author Desert Themes 6 * @copyright Copyright (c) 2024, NewsMunch 7 * @link http:// 8 * @since NewsMunch 1.0.0 9*/ 10 11 12/*========================================================================= 13 Home Slider 14=========================================================================*/ 15jQuery(document).ready(function ($) { 16 17 // post-carousel-banner 18 $('.post-carousel-banner').each(function() { 19 if( $(this).prev(".widget-header").length > 0 ) { 20 $(this).siblings('.widget-header').append('<div class="slick-arrows-top"></div>'); 21 let append_Arrows = $(this).siblings('.widget-header').find('.slick-arrows-top'); 22 //console.log(append_Arrows); 23 $(this).slick({ 24 dots: true, 25 //arrows: true, 26 adaptiveHeight: true, 27 slidesToShow: 1, 28 slidesToScroll: 1, 29 /*fade: true, 30 cssEase: 'linear',*/ 31 autoplay: true, 32 autoplaySpeed: 12000, 33 infinite: true, 34 rtl: $("html").attr("dir") == 'rtl' ? true : false, 35 nextArrow: '<button type="button" class="slick-next slick-arrow" role="button"></button>', 36 prevArrow: '<button type="button" class="slick-prev slick-arrow" role="button"></button>', 37 appendArrows: append_Arrows, 38 responsive: [ 39 { 40 breakpoint: 768, 41 settings: { 42 slidesToShow: 1, 43 slidesToScroll: 1, 44 dots: true, 45 arrows: false, 46 } 47 } 48 ] 49 }); 50 } else { 51 $(this).slick({ 52 dots: false, 53 arrows: true, 54 adaptiveHeight: true, 55 slidesToShow: 1, 56 slidesToScroll: 1, 57 autoplay: true, 58 autoplaySpeed: 12000, 59 infinite: true, 60 rtl: $("html").attr("dir") == 'rtl' ? true : false, 61 responsive: [ 62 { 63 breakpoint: 768, 64 settings: { 65 slidesToShow: 1, 66 slidesToScroll: 1, 67 dots: true, 68 arrows: false, 69 } 70 } 71 ] 72 }); 73 } 74 }); 75 76 // post gallery 77 $('.post-gallery').each(function() { 78 $(this).slick({ 79 rtl: $('html').attr('dir') != "rtl" ? false : true, 80 dots: false, 81 arrows: true, 82 slidesToShow: 1, 83 slidesToScroll: 1, 84 fade: true, 85 cssEase: 'linear', 86 infinite: true, 87 adaptiveHeight: false, 88 responsive: [{ 89 breakpoint: 768, 90 settings: { 91 slidesToShow: 1, 92 slidesToScroll: 1, 93 dots: false, 94 arrows: true, 95 } 96 }] 97 }); 98 }); 99 100 // featured-posts-carousel 101 $('.featured-posts-carousel').each(function() { 102 $(this).siblings('.widget-header').append('<div class="slick-arrows-top"></div>'); 103 let append_Arrows = $(this).siblings('.widget-header').find('.slick-arrows-top'); 104 $(this).slick({ 105 dots: false, 106 //arrows: false, 107 slidesToShow: 5, 108 slidesToScroll: 3, 109 infinite: true, 110 rtl: $("html").attr("dir") == 'rtl' ? true : false, 111 nextArrow: '<button type="button" class="slick-next slick-arrow" role="button"></button>', 112 prevArrow: '<button type="button" class="slick-prev slick-arrow" role="button"></button>', 113 appendArrows: append_Arrows, 114 responsive: [ 115 { 116 breakpoint: 1440, 117 settings: { 118 slidesToShow: 4, 119 slidesToScroll: 4, 120 dots: true, 121 } 122 }, 123 { 124 breakpoint: 1024, 125 settings: { 126 slidesToShow: 3, 127 slidesToScroll: 3, 128 dots: true, 129 } 130 }, 131 { 132 breakpoint: 768, 133 settings: { 134 slidesToShow: 2, 135 slidesToScroll: 2, 136 dots: true, 137 } 138 } 139 , 140 { 141 breakpoint: 576, 142 settings: { 143 slidesToShow: 1, 144 slidesToScroll: 1, 145 dots: true, 146 } 147 } 148 ] 149 }); 150 });
151 152 $('.posts-vertical-carousel').each(function() { 153 $(this).siblings('.widget-header').append('<div class="slick-arrows-top"></div>'); 154 let append_Arrows = $(this).siblings('.widget-header').find('.slick-arrows-top'); 155 $(this).slick({ 156 autoplay: true, 157 vertical: true, 158 slidesToShow: 4, 159 slidesToScroll: 1, 160 verticalSwiping: true, 161 autoplaySpeed: 10000, 162 infinite: true, 163 nextArrow: '<button type="button" class="slick-next slick-arrow" role="button"></button>', 164 prevArrow: '<button type="button" class="slick-prev slick-arrow" role="button"></button>', 165 appendArrows: append_Arrows, 166 }); 167 }); 168 169 // post-carousel-threeCol 170 $('.post-carousel-threeCol').each(function() { 171 $(this).slick({ 172 rtl: $('html').attr('dir') != "rtl" ? false : true, 173 dots: true, 174 arrows: false, 175 infinite: true, 176 slidesToShow: 3, 177 slidesToScroll: 1, 178 responsive: [ 179 { 180 breakpoint: 768, 181 settings: { 182 slidesToShow: 3, 183 slidesToScroll: 3, 184 } 185 }, 186 { 187 breakpoint: 576, 188 settings: { 189 slidesToShow: 1, 190 slidesToScroll: 1, 191 } 192 } 193 ] 194 }); 195 }); 196 197 $('.post-carousel-missed').each(function() { 198 $(this).siblings('.widget-header').append('<div class="slick-arrows-top"></div>'); 199 let append_Arrows = $(this).siblings('.widget-header').find('.slick-arrows-top'); 200 $(this).slick({ 201 rtl: $('html').attr('dir') != "rtl" ? false : true, 202 dots: false, 203 autoplay: true, 204 slidesToShow: 4, 205 slidesToScroll: 1, 206 adaptiveHeight: true, 207 infinite: true, 208 nextArrow: '<button type="button" class="slick-next slick-arrow" role="button"></button>', 209 prevArrow: '<button type="button" class="slick-prev slick-arrow" role="button"></button>', 210 appendArrows: append_Arrows, 211 responsive: [ 212 { 213 breakpoint: 1201, 214 settings: { 215 slidesToShow: 3, 216 slidesToScroll: 3, 217 } 218 }, 219 { 220 breakpoint: 768, 221 settings: { 222 slidesToShow: 2, 223 slidesToScroll: 2, 224 } 225 }, 226 { 227 breakpoint: 576, 228 settings: { 229 slidesToShow: 1, 230 slidesToScroll: 1, 231 } 232 } 233 ] 234 }); 235 }); 236 237 // post-carousel-widget 238 $('.post-carousel-widget').each(function() { 239 $(this).siblings('.widget-header').append('<div class="slick-arrows-top"></div>'); 240 let append_Arrows = $(this).siblings('.slick-arrows-bot'); 241 $(this).slick({ 242 rtl: $('html').attr('dir') != "rtl" ? false : true, 243 dots: false, 244 slidesToShow: 1, 245 slidesToScroll: 1, 246 infinite: true, 247 nextArrow: '<button type="button" class="slick-next slick-arrow" role="button"></button>', 248 prevArrow: '<button type="button" class="slick-prev slick-arrow" role="button"></button>', 249 appendArrows: append_Arrows, 250 responsive: [ 251 { 252 breakpoint: 991, 253 settings: { 254 slidesToShow: 2, 255 slidesToScroll: 1, 256 } 257 }, 258 { 259 breakpoint: 576, 260 settings: { 261 slidesToShow: 1, 262 centerMode: true, 263 slidesToScroll: 1, 264 } 265 } 266 ] 267 }); 268 });
269 270 $('.post-carousel-post_list_sm').each(function() { 271 $(this).siblings('.widget-header').append('<div class="slick-arrows-top"></div>'); 272 let append_Arrows = $(this).siblings('.widget-header').find('.slick-arrows-top'); 273 $(this).slick({ 274 rtl: $('html').attr('dir') != "rtl" ? false : true, 275 dots: false, 276 autoplay: true, 277 slidesToShow: 4, 278 slidesToScroll: 1, 279 adaptiveHeight: true, 280 infinite: true, 281 nextArrow: '<button type="button" class="slick-next slick-arrow" role="button"></button>', 282 prevArrow: '<button type="button" class="slick-prev slick-arrow" role="button"></button>', 283 appendArrows: append_Arrows, 284 responsive: [ 285 { 286 breakpoint: 1201, 287 settings: { 288 slidesToShow: 3, 289 slidesToScroll: 3, 290 } 291 }, 292 { 293 breakpoint: 768, 294 settings: { 295 slidesToShow: 2, 296 slidesToScroll: 2, 297 } 298 }, 299 { 300 breakpoint: 576, 301 settings: { 302 slidesToShow: 1, 303 slidesToScroll: 1, 304 } 305 } 306 ] 307 }); 308 }); 309 310 // Video Slider 311 $('.dt_video_slider').each(function() { 312 $(this).sliderPro({ 313 width: '100%', 314 height: 460, 315 arrows: true,
316 buttons: false, 317 fullScreen: false, 318 thumbnailWidth: 160, 319 thumbnailHeight: 112, 320 thumbnailsPosition: 'bottom', 321 autoplay: false, 322 fadeArrows: false, 323 loop: true, 324 breakpoints: { 325 1920: { 326 thumbnailWidth: 200, 327 thumbnailHeight: 100, 328 height: 624, 329 }, 330 1600: { 331 thumbnailWidth: 142, 332 thumbnailHeight: 80, 333 height: 467, 334 }, 335 1366: { 336 thumbnailWidth: 142, 337 thumbnailHeight: 110, 338 height: 506, 339 }, 340 1024: { 341 thumbnailWidth: 142, 342 thumbnailHeight: 110, 343 height: 376, 344 }, 345 800: { 346 height: 423, 347 thumbnailsPosition: 'bottom', 348 thumbnailWidth: 142, 349 thumbnailHeight: 110 350 }, 351 500: { 352 height: 239, 353 thumbnailsPosition: 'bottom', 354 thumbnailWidth: 142, 355 thumbnailHeight: 110 356 }, 357 375: { 358 height: 199, 359 thumbnailsPosition: 'bottom', 360 thumbnailWidth: 142, 361 thumbnailHeight: 110 362 } 363 } 364 }); 365 }); 366 367 // Skillbars 368 $('.dt_skillbars-main').each(function() { 369 $(this).find('.dt_skillbars-line').animate({ 370 width: $(this).attr('data-percent') 371 }, 5000); 372 $(this).find('.dt_skillbars-percent').animate({ 373 left: $(this).attr('data-percent') 374 }, 5000); 375 }); 376 $('.dt_skillbars-count').each(function() { 377 var self = $(this); 378 $({ 379 Counter: 0 380 }).animate({ 381 Counter: self.text() 382 }, { 383 duration: 5000, 384 easing: 'swing', 385 step: function() { 386 self.text(Math.ceil(this.Counter)); 387 } 388 }); 389 }); 390 391 // Skillbars 392 $('.video-popup').each(function() { 393 $(this).fancybox({ 394 openEffect : 'fade', 395 closeEffect : 'fade', 396 helpers : { 397 media : {} 398 } 399 }); 400 }); 401 402 if($('.wp-block-gallery .wp-block-image a').length) { 403 $('.wp-block-gallery .wp-block-image').each(function() { 404 // set the rel for each gallery 405 $(this).find("a").attr('data-fancybox', 'gallery'); 406 }); 407 $('[data-fancybox="gallery"]').fancybox({ 408 buttons: [ 409 "slideShow", 410 "thumbs", 411 "zoom", 412 "fullScreen", 413 "share", 414 "close" 415 ], 416 loop: true, 417 protect: true 418 }); 419 } 420 421 $('.dt-posts-module.loadon .dt-posts').each(function () { 422 $(this).btnloadmore(); 423 }); 424 425 // Cookie Storage 426 var cookieStorage = { 427 setCookie: function setCookie(key, value, time, path) { 428 var expires = new Date(); 429 expires.setTime(expires.getTime() + time); 430 var pathValue = ''; 431 if (typeof path !== 'undefined') { 432 pathValue = 'path=' + path + ';' 433 } 434 document.cookie = key + '=' + value + ';' + pathValue + 'expires=' + expires.toUTCString() 435 }, 436 getCookie: function getCookie(key) { 437 var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)'); 438 return keyValue ? keyValue[2] : null 439 }, 440 removeCookie: function removeCookie(key) { 441 document.cookie = key + '=; Max-Age=0; path=/' 442 } 443 }; 444 445 $('.dt_switcherdarkbtn').click(function() { 446 $('.dt_switcherdarkbtn').toggleClass('active'); 447 if ($('.dt_switcherdarkbtn').hasClass('active')) { 448 $('body').addClass('dark'); 449 cookieStorage.setCookie('yonkovNightMode', 'true', 2628000000, '/'); 450 } else { 451 $('body').removeClass('dark'); 452 setTimeout(function() { 453 cookieStorage.removeCookie('yonkovNightMode'); 454 }, 100) 455 } 456 });
457 if (cookieStorage.getCookie('yonkovNightMode')) { 458 $('body').addClass('dark'); 459 $('.dt_switcherdarkbtn').addClass('active'); 460 } 461 462 // Social share toggle 463 $('.post button.toggle-button').each( function() { 464 $(this).on( 'click', function(e) { 465 $(this).next('.social-share:not(.single-post-share) .icons').toggleClass("visible"); 466 $(this).toggleClass('fa-close').toggleClass('fa-share-nodes'); 467 }); 468 }); 469 470 // Spacer with Data Attribute 471 let spacer = document.getElementsByClassName('spacer'); 472 for (let i = 0; i < spacer.length; i++) { 473 let spacerHeight = spacer[i].getAttribute('data-height'); 474 spacer[i].style.height = "" + spacerHeight + "px"; 475 } 476 477 // Background Image with Data Attribute 478 let bgimageset = document.getElementsByClassName('data-bg-image'); 479 for (let i = 0; i < bgimageset.length; i++) { 480 let bgimage = bgimageset[i].getAttribute('data-bg-image'); 481 bgimageset[i].style.backgroundImage = "url('" + bgimage + "')" 482 } 483 484 // Tab Content 485 $(".dt_tabs").each(function () { 486 let myTabs = $(this); 487 488 myTabs.find(".dt_tabslist li button").click(function () { 489 let myTabsButton = $(this); 490 491 // Check if the button is already active 492 if (myTabsButton.hasClass("active")) { 493 return false; // Ignore repeated clicks 494 } 495 496 let tab_id = myTabsButton.attr("data-tab"); 497 myTabs.find(".dt_tabslist li button").removeClass("active"); 498 myTabs.find(".tab-content .tab-pane").removeClass("active").removeClass("show"); 499 myTabsButton.addClass("active"); 500 $("#" + tab_id).addClass("active").addClass("show").addClass("loading"); 501 502 $('.lds-dual-ring').addClass("loading"); 503 504 setTimeout(function () { 505 $("#" + tab_id).removeClass("loading"); 506 $('.lds-dual-ring').removeClass("loading"); 507 }, 500); 508 509 return false; 510 }); 511 }); 512 513 /*SEARCH BY USING A CITY NAME (e.g. athens) OR A COMMA-SEPARATED CITY NAME ALONG WITH THE COUNTRY CODE (e.g. athens,gr)*/ 514 if (navigator.geolocation && document.querySelector(".dt-weather .cities")) { 515 navigator.geolocation.getCurrentPosition((position) => { 516 const list = document.querySelector(".dt-weather .cities"); 517 const apiKey = "4d8fb5b93d4af21d66a2948710284366"; 518 let lat = position.coords.latitude; 519 let lon = position.coords.longitude; 520 const listItems = list.querySelectorAll(".dt-weather .city"); 521 const listItemsArray = Array.from(listItems); 522 if (listItemsArray.length > 0) { 523 const filteredArray = listItemsArray.filter(el => { 524 let content = ""; 525 if (inputVal.includes(",")) { 526 if (inputVal.split(",")[1].length > 2) { 527 inputVal = inputVal.split(",")[0]; 528 content = el 529 .querySelector(".city-name span") 530 .textContent.toLowerCase(); 531 } else { 532 content = el.querySelector(".city-name").dataset.name.toLowerCase(); 533 } 534 } else { 535 content = el.querySelector(".city-name span").textContent.toLowerCase(); 536 } 537 return content == inputVal.toLowerCase(); 538 }); 539 540 if (filteredArray.length > 0) { 541 alert(`You already know the weather for ${ 542 filteredArray[0].querySelector(".city-name span").textContent 543 } ...otherwise be more specific by providing the country code as well ð`); 544 return; 545 } 546 } 547 const url = `https://api.openweathermap.org/data/2.5/weather?lat=${lat}&lon=${lon}&appid=${apiKey}&units=metric`; 548 $.getJSON(url, function(data) { 549 const { 550 main, 551 name, 552 sys, 553 weather 554 } = data; 555 const icon = `https://s3-us-west-2.amazonaws.com/s.cdpn.io/162656/${ 556 weather[0]["icon"] 557 }.svg`; 558 const createDiv = document.createElement("div"); 559 createDiv.classList.add("city"); 560 const markup = ` 561 <div class="city-name" data-name="${name},${sys.country}">
562 <span>${name}, ${sys.country}</span> 563 </div> 564 <div class="city-temp">${Math.round(main.temp)} °C </div> 565 <div class="city-description"> 566 <span class="icon"><img src="${icon}" alt="${ 567 weather[0]["description"] 568 }"></span> 569 <span class="text">${weather[0]["description"]}</span> 570 </div> 571 `; 572 createDiv.innerHTML = markup; 573 list.appendChild(createDiv); 574 }) 575 }); 576 } else { 577 $(".dt-weather").html("Geolocation is not supported by this browser."); 578 } 579 580 /*Time*/ 581 setInterval(function() { 582 var mydate = new Date(); 583 $(".dt-time").html( mydate.toLocaleTimeString() ); 584 }, 100); 585 586 if ( $('.marquee').hasClass('flash-slide-right') ) { 587 $('.marquee.flash-slide-right').marquee({ 588 //duration in milliseconds of the marquee 589 speed: 80000, 590 //gap in pixels between the tickers 591 gap: 0, 592 //time in milliseconds before the marquee will start animating 593 delayBeforeStart: 0, 594 //'left' or 'right' 595 //direction: 'right', 596 //true or false - should the marquee be duplicated to show an effect of continues flow 597 duplicated: true, 598 pauseOnHover: true, 599 startVisible: true 600 }); 601 } 602 603 if ( $('.marquee').hasClass('flash-slide-left') ) { 604 $('.marquee.flash-slide-left').marquee({ 605 //duration in milliseconds of the marquee 606 speed: 80000, 607 //gap in pixels between the tickers 608 gap: 0, 609 //time in milliseconds before the marquee will start animating 610 delayBeforeStart: 0, 611 //'left' or 'right' 612 //direction: 'left', 613 //true or false - should the marquee be duplicated to show an effect of continues flow 614 duplicated: true, 615 pauseOnHover: true, 616 startVisible: true 617 }); 618 } 619 620 //var $status = $('.status'); 621 $('.post-carousel-banner').imagesLoaded({ 622 background: '.data-bg-image' 623 }, function( imgLoad ) { 624 //$status.text( imgLoad.images.length + ' images loaded checking .box backgrounds' ); 625 //console.log(imgLoad.images.length); 626 } 627 ); 628 629 /*var imgLoad = imagesLoaded('body'); 630 imgLoad.on( 'always', function() { 631 console.log( imgLoad.images.length + ' images loaded' ); 632 // detect which image is broken 633 for ( var i = 0, len = imgLoad.images.length; i < len; i++ ) { 634 var image = imgLoad.images[i]; 635 var result = image.isLoaded ? 'loaded' : 'broken'; 636 console.log( 'image is ' + result + ' for ' + image.img.src ); 637 } 638 });*/ 639 // Accordion 640 $(document).on("click", ".accordion__title", function () { 641 const accordionWrapper = $(this).parent(); 642 const accordionContent = $(this).parent().find(".accordion__content").first(); 643 const accordionOpen = "accordion--open"; 644 645 // If this accordion is already open 646 if (accordionWrapper.hasClass(accordionOpen)) { 647 accordionContent.slideUp(); // Close the content. 648 accordionWrapper.removeClass(accordionOpen); // Remove the accordionm--open class. 649 } else { 650 accordionContent.slideDown(); // Show this accordion's content. 651 accordionWrapper.addClass(accordionOpen); // Add the accordion--open class. 652 } 653 }); 654}); 655 656( function( $ ) { 657 'use strict'; 658 659 //set animation timing 660 var animationDelay = 2500, 661 //loading bar effect 662 barAnimationDelay = 3800, 663 barWaiting = barAnimationDelay - 3000, //3000 is the duration of the transition on the loading bar - set in the scss/css file 664 //letters effect 665 lettersDelay = 50, 666 //type effect 667 typeLettersDelay = 150, 668 selectionDuration = 500, 669 typeAnimationDelay = selectionDuration + 800, 670 //clip effect 671 revealDuration = 600, 672 revealAnimationDelay = 1500; 673 674 function initHeadline() { 675 //insert <i> element for each letter of a changing word 676 singleLetters($('.dt_heading.dt_heading_2').find('b')); 677 singleLetters($('.dt_heading.dt_heading_3').find('b')); 678 singleLetters($('.dt_heading.dt_heading_8').find('b')); 679 singleLetters($('.dt_heading.dt_heading_9').find('b')); 680 //initialise headline animation 681 animateHeadline($('.dt_heading'));
682 } 683 684 function singleLetters($words) { 685 $words.each(function() { 686 var word = $(this), 687 letters = word.text().split(''), 688 selected = word.hasClass('is_on'); 689 for (var i in letters) { 690 if (word.parents('.dt_heading_3').length > 0) letters[i] = '<em>' + letters[i] + '</em>'; 691 letters[i] = (selected) ? '<i class="in">' + letters[i] + '</i>' : '<i>' + letters[i] + '</i>'; 692 } 693 var newLetters = letters.join(''); 694 word.html(newLetters).css('opacity', 1); 695 }); 696 } 697 698 function animateHeadline($headlines) { 699 var duration = animationDelay; 700 $headlines.each(function() { 701 var headline = $(this); 702 703 if (headline.hasClass('dt_heading_4')) { 704 duration = barAnimationDelay; 705 setTimeout(function() { 706 headline.find('.dt_heading_inner').addClass('is-loading') 707 }, barWaiting); 708 } else if (headline.hasClass('dt_heading_6')) { 709 var spanWrapper = headline.find('.dt_heading_inner'), 710 newWidth = spanWrapper.width() + 10 711 spanWrapper.css('width', newWidth); 712 } else if (!headline.hasClass('dt_heading_2')) { 713 //assign to .dt_heading_inner the width of its longest word 714 var words = headline.find('.dt_heading_inner b'), 715 width = 0; 716 words.each(function() { 717 var wordWidth = $(this).width(); 718 if (wordWidth > width) width = wordWidth; 719 }); 720 headline.find('.dt_heading_inner').css('width', width); 721 }; 722 723 //trigger animation 724 setTimeout(function() { 725 hideWord(headline.find('.is_on').eq(0)) 726 }, duration); 727 }); 728 } 729 730 function hideWord($word) { 731 var nextWord = takeNext($word); 732 733 if ($word.parents('.dt_heading').hasClass('dt_heading_2')) { 734 var parentSpan = $word.parent('.dt_heading_inner'); 735 parentSpan.addClass('selected').removeClass('waiting'); 736 setTimeout(function() { 737 parentSpan.removeClass('selected'); 738 $word.removeClass('is_on').addClass('is_off').children('i').removeClass('in').addClass('out'); 739 }, selectionDuration); 740 setTimeout(function() { 741 showWord(nextWord, typeLettersDelay) 742 }, typeAnimationDelay); 743 744 } else if ($word.parents('.dt_heading').hasClass('dt_heading_2') || $word.parents('.dt_heading').hasClass('dt_heading_3') || $word.parents('.dt_heading').hasClass('dt_heading_8') || $word.parents('.dt_heading').hasClass('dt_heading_9')) { 745 var bool = ($word.children('i').length >= nextWord.children('i').length) ? true : false; 746 hideLetter($word.find('i').eq(0), $word, bool, lettersDelay); 747 showLetter(nextWord.find('i').eq(0), nextWord, bool, lettersDelay); 748 749 } else if ($word.parents('.dt_heading').hasClass('dt_heading_6')) { 750 $word.parents('.dt_heading_inner').animate({ 751 width: '2px' 752 }, revealDuration, function() { 753 switchWord($word, nextWord); 754 showWord(nextWord); 755 }); 756 757 } else if ($word.parents('.dt_heading').hasClass('dt_heading_4')) { 758 $word.parents('.dt_heading_inner').removeClass('is-loading'); 759 switchWord($word, nextWord); 760 setTimeout(function() { 761 hideWord(nextWord) 762 }, barAnimationDelay); 763 setTimeout(function() { 764 $word.parents('.dt_heading_inner').addClass('is-loading') 765 }, barWaiting); 766 767 } else { 768 switchWord($word, nextWord); 769 setTimeout(function() { 770 hideWord(nextWord) 771 }, animationDelay); 772 } 773 } 774 775 function showWord($word, $duration) { 776 if ($word.parents('.dt_heading').hasClass('dt_heading_2')) { 777 showLetter($word.find('i').eq(0), $word, false, $duration); 778 $word.addClass('is_on').removeClass('is_off'); 779 780 } else if ($word.parents('.dt_heading').hasClass('dt_heading_6')) { 781 $word.parents('.dt_heading_inner').animate({ 782 'width': $word.width() + 10 783 }, revealDuration, function() { 784 setTimeout(function() { 785 hideWord($word) 786 }, revealAnimationDelay); 787 }); 788 } 789 } 790 791 function hideLetter($letter, $word, $bool, $duration) { 792 $letter.removeClass('in').addClass('out'); 793 794 if (!$letter.is(':last-child')) { 795 setTimeout(function() { 796 hideLetter($letter.next(), $word, $bool, $duration); 797 }, $duration); 798 } else if ($bool) { 799 setTimeout(function() { 800 hideWord(takeNext($word)) 801 }, animationDelay); 802 } 803 804 if ($letter.is(':last-child') && $('html').hasClass('no-csstransitions')) { 805 var nextWord = takeNext($word); 806 switchWord($word, nextWord); 807 } 808 } 809 810 function showLetter($letter, $word, $bool, $duration) { 811 $letter.addClass('in').removeClass('out'); 812 813 if (!$letter.is(':last-child')) { 814 setTimeout(function() { 815 showLetter($letter.next(), $word, $bool, $duration); 816 }, $duration); 817 } else { 818 if ($word.parents('.dt_heading').hasClass('dt_heading_2')) { 819 setTimeout(function() { 820 $word.parents('.dt_heading_inner').addClass('waiting'); 821 }, 200); 822 } 823 if (!$bool) { 824 setTimeout(function() { 825 hideWord($word) 826 }, animationDelay) 827 } 828 } 829 } 830 831 function takeNext($word) { 832 return (!$word.is(':last-child')) ? $word.next() : $word.parent().children().eq(0); 833 } 834 835 function switchWord($oldWord, $newWord) { 836 $oldWord.removeClass('is_on').addClass('is_off'); 837 $newWord.removeClass('is_off').addClass('is_on'); 838 } 839 840 /* ========================================================================== 841 When document is loaded, do 842 ========================================================================== */ 843 if ($(".is--sticky").length) { 844 let lastScrollTop = 0; 845 let isSticky = $( '.is--sticky' ); 846 let headerBottom = isSticky.position().top + $('.dt_header').outerHeight( true ); 847 848 const isStickyOn = () => { 849 let windowTop = $( window ).scrollTop(); 850 // Add custom sticky class 851 if ( windowTop >= headerBottom ) { 852 isSticky.addClass( 'show' ); 853 } else { 854 isSticky.removeClass( 'show' ); 855 isSticky.removeClass( 'on' ); 856 } 857 // Show/hide 858 if ( isSticky.hasClass( 'show' ) ) { 859 if ( windowTop <= headerBottom || windowTop < lastScrollTop ) { 860 isSticky.addClass( 'on' ); 861 } else { 862 isSticky.removeClass( 'on' ); 863 } 864 } 865 lastScrollTop = windowTop; 866 }; 867 868 $( window ).scroll( isStickyOn ); 869 } 870 871 $( window ).scroll( () => { 872 let docHeight = $(".site-wrapper").height(); 873 let winHeight = $( window ).height(); 874 let viewport = docHeight - winHeight; 875 let scrollPos = $( window ).scrollTop(); 876 let scrollPercent = ( scrollPos / viewport ) * 100; 877 $( ".dt_readingbar" ).css( "width", scrollPercent + "%" ); 878 });
879 880 // Top Up 881 if ($('.dt_uptop').length) { 882 var progressPath = document.querySelector('.dt_uptop path'); 883 var pathLength = progressPath.getTotalLength(); 884 progressPath.style.transition = progressPath.style.WebkitTransition = 'none'; 885 progressPath.style.strokeDasharray = pathLength + ' ' + pathLength; 886 progressPath.style.strokeDashoffset = pathLength; 887 progressPath.getBoundingClientRect(); 888 progressPath.style.transition = progressPath.style.WebkitTransition = 'stroke-dashoffset 10ms linear'; 889 var updateProgress = function() { 890 var scroll = $(window).scrollTop(); 891 var height = $(document).height() - $(window).height(); 892 var progress = pathLength - (scroll * pathLength / height); 893 progressPath.style.strokeDashoffset = progress; 894 } 895 updateProgress(); 896 $(window).scroll(updateProgress); 897 var offset = 50; 898 var duration = 550; 899 $(window).on('scroll', function() { 900 if ($(this).scrollTop() > offset) { 901 $('.dt_uptop').addClass('active'); 902 } else { 903 $('.dt_uptop').removeClass('active'); 904 } 905 }); 906 $('.dt_uptop').on('click', function(event) { 907 event.preventDefault(); 908 909 jQuery('html, body').animate({ 910 scrollTop: 0 911 }, duration); 912 return false; 913 }); 914 } 915 916 //Hide PreLoading 917 if ($(".dt_preloader-close").length) { 918 $(".dt_preloader-close").on("click", function(){ 919 $('.dt_preloader').delay(200).fadeOut(500); 920 }); 921 } 922 923 $(window).on('load', function() { 924 if($('.dt_preloader').length){ 925 $('.dt_preloader').delay(1000).fadeOut(500); 926 } 927 initHeadline(); 928 }); 929 930})( 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.