1window.Project = (function (window, document, $) { 2 'use strict'; 3 4 //add search template 5 const searchIconBtn2 = $('a[href = "#rtrb-search-template"]'); 6 const blockUnickClass = searchIconBtn2.attr('data-blockid'); 7 const pText = searchIconBtn2.attr('data-ptext'); 8 const submitIcon = searchIconBtn2.attr('data-sbtn'); 9 if (searchIconBtn2 && blockUnickClass) { 10 document.body.innerHTML += ` 11 <div id="rtrb-search-template" class="${blockUnickClass} rtrb-search-box-overlay"> 12 <button type="button" class="rtrb-search-close-btn rtrb-close-btn2">Ã</button> 13 <form class="rtrb-search-form" role="search" action="/" method="get"> 14 <input type="search" placeholder="${pText}" name="s" title="Search" class="rtrb-search-input" /> 15 ${submitIcon ? '<button class="rtrb-search-btn" type="submit"><svg width="1em" height="1em" viewBox="0 0 25 25" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M24.3569 23.6399L18.0081 17.2885C19.6706 15.452 20.6921 13.0234 20.6921 10.3509C20.6913 4.63387 16.0596 0 10.3457 0C4.63172 0 0 4.63387 0 10.3509C0 16.0678 4.63172 20.7017 10.3457 20.7017C12.8145 20.7017 15.0788 19.8336 16.8575 18.3902L23.2309 24.7667C23.5414 25.0778 24.0456 25.0778 24.3561 24.7667C24.6674 24.4557 24.6674 23.9509 24.3569 23.6399ZM10.3457 19.1092C5.51104 19.1092 1.59183 15.188 1.59183 10.3509C1.59183 5.51376 5.51104 1.59254 10.3457 1.59254C15.1803 1.59254 19.0995 5.51376 19.0995 10.3509C19.0995 15.188 15.1803 19.1092 10.3457 19.1092Z"></path></svg></button>' : ''} 16 </form> 17 </div>`; 18 } 19 20 var app = { 21 initialize: function () { 22 app.buttonBock(); 23 app.accordionBlock(); 24 app.countDownBlock(); 25 app.countDownBlockLayout6(); 26 app.counterBlock(); 27 app.advancedTab(); 28 app.advancedVideo(); 29 app.searchBlock(); 30 app.noticeDisclosure(); 31 app.instagramFeed(); 32 app.socialShare(); 33 app.imageAccordion(); 34 app.addToCartButton(); 35 app.flipBox(); 36 }, 37 flipBox: function () { 38 let flipbox = document.querySelectorAll(".rtrb-fliper"); 39 for (let i = 0; i < flipbox.length; i++) { 40 let flipBehavior = flipbox[i].getAttribute("data-flip-behavior"); 41 if (flipBehavior === 'hover') { 42 $(flipbox[i]).mouseenter(function () { 43 $(flipbox[i]).addClass('flip-back-selected'); 44 }).mouseleave(function () { 45 $(flipbox[i]).removeClass('flip-back-selected'); 46 }); 47 } else if (flipBehavior === 'click') { 48 $(flipbox[i]).click(function () { 49 $(flipbox[i]).addClass('flip-back-selected'); 50 }).mouseleave(function () { 51 $(flipbox[i]).removeClass('flip-back-selected'); 52 }); 53 } 54 } 55 }, 56 instagramFeed: function () { 57 const instagrams = document.getElementsByClassName(`rtrb-instagram-gallery`); 58 59 setTimeout(() => { 60 for (let instagram of instagrams) { 61 var iso; 62 63 imagesLoaded(instagram, function () { 64 iso = new Isotope(instagram, { 65 itemSelector: ".rtrb-instagram-gallery-col", 66 percentPosition: true, 67 masonry: { 68 columnWidth: ".rtrb-instagram-gallery-col", 69 }, 70 }); 71 }); 72 } 73 }, 1000); 74 }, 75 76 noticeDisclosure: function () { 77 78 let notices = document.querySelectorAll(".rtrb-notice-wrapper"); 79 80 for (let i = 0; i < notices.length; i++) { 81 let dismissButton = notices[i].querySelector(".rtrb-notice-disclosure"); 82 83 //if dismissbutton is not found then return 84 if (!dismissButton) { 85 return; 86 } 87 88 let noticeId = notices[i].getAttribute("data-notice-id"); 89 let noticeAgain = notices[i].getAttribute("data-appear-again"); 90 let alreadyNoticeHiddenPermanently = localStorage.getItem(`rtrb-notice-hidden-permanently-${noticeId}`); 91 92 noticeAgain === 'true' && noticeAppearAgain(noticeId); 93 noticeAgain === 'false' && alreadyNoticeHiddenPermanently === '1' && removeNotice(notices[i]); 94 95 //dismissbutton click then fire 96 dismissButton.addEventListener('click', function () { 97 onDisclosureButtonClick(notices[i]); 98 }) 99 } 100 101 function noticeDeletePermanently(noticeId) { 102 localStorage.setItem(`rtrb-notice-hidden-permanently-${noticeId}`, '1') 103 } 104 105 function noticeAppearAgain(noticeId) { 106 localStorage.hasOwnProperty(`rtrb-notice-hidden-permanently-${noticeId}`) && localStorage.removeItem(`rtrb-notice-hidden-permanently-${noticeId}`) 107 } 108 109 function removeNotice(notice) { 110 notice.remove() 111 } 112 113 function onDisclosureButtonClick(notice) { 114 let noticeId = notice.getAttribute('data-notice-id'); 115 let noticeAgain = notice.getAttribute('data-appear-again'); 116 noticeAgain === 'true' && noticeAppearAgain(noticeId); 117 noticeAgain === 'false' && noticeDeletePermanently(noticeId); 118 removeNotice(notice); 119 } 120 }, 121 122 addToCartButton: function () { 123 124 $('.rtrb-button.add_to_cart_btn').on('click', function (event) { 125 event.preventDefault(); 126 var $thisproduct = $(this); 127 var product_id = $(this).data('product-id'); 128 var quantity = 1; 129 $.ajax({ 130 url: rtrbParams.ajaxurl, 131 type: 'POST', 132 dataType: 'json', 133 data: { 134 action: 'rtrb_add_to_cart', 135 product_id: product_id, 136 quantity: quantity 137 }, 138 success: function (data) { 139 if (data.success) { 140 $thisproduct.addClass('added'); 141 let viewcartHtml = `<a href="${data.cart_url}"> 142 <svg width="15" height="18" viewBox="0 0 20 18" fill="none" xmlns="http://www.w3.org/2000/svg"> 143 <path d="M19.7031 6.04049C19.439 5.68661 19.0428 5.4836 18.616 5.4836H14.7643L12.6756 0.375545C12.5461 0.0588394 12.2007 -0.0858914 11.9042 0.0524978C11.6076 0.190804 11.4722 0.559744 11.6017 0.876492L13.4855 5.48364H6.51449L8.39828 0.876492C8.52777 0.559744 8.39238 0.190845 8.09582 0.0524978C7.7993 -0.0858914 7.45387 0.058756 7.32438 0.375545L5.23574 5.48364H1.38403C0.957229 5.48364 0.561018 5.68661 0.296916 6.04053C0.0376587 6.38799 -0.0580053 6.83466 0.0344556 7.26614L2.09137 16.862C2.235 17.5321 2.78996 18 3.44094 18H16.5591C17.21 18 17.76
1435 17.5321 17.9086 16.862L19.9655 7.26609C20.058 6.83461 19.9623 6.38795 19.7031 6.04049ZM16.5591 16.7483H3.44094C3.34145 16.7483 3.2543 16.6786 3.23371 16.5826L1.1768 6.98681C1.16067 6.91151 1.18774 6.85485 1.21336 6.8206C1.23711 6.78872 1.2909 6.73528 1.38403 6.73528H4.72399L4.57051 7.11064C4.44102 7.42739 4.57641 7.79629 4.87297 7.93464C4.9493 7.97026 5.02883 7.98712 5.10715 7.98712C5.33301 7.98712 5.54824 7.84681 5.64441 7.61163L6.00274 6.73536H13.9973L14.3557 7.61163C14.4518 7.84685 14.6671 7.98712 14.8929 7.98712C14.9712 7.98712 15.0508 7.97026 15.1271 7.93464C15.4237 7.79633 15.5591 7.42739 15.4296 7.11064L15.2761 6.73528H18.6161C18.7092 6.73528 18.763 6.78872 18.7867 6.8206C18.8123 6.85489 18.8394 6.91155 18.8233 6.98677L16.7664 16.5826C16.7457 16.6786 16.6586 16.7483 16.5591 16.7483Z" fill="currentColor"></path> 144 <path d="M6.48438 9.44711C6.16078 9.44711 5.89844 9.72731 5.89844 10.0729V14.6623C5.89844 15.0079 6.16078 15.2881 6.48438 15.2881C6.80797 15.2881 7.07031 15.0079 7.07031 14.6623V10.0729C7.07031 9.72731 6.80801 9.44711 6.48438 9.44711Z" fill="currentColor"></path> 145 <path d="M10 9.44711C9.67641 9.44711 9.41406 9.72731 9.41406 10.0729V14.6623C9.41406 15.0079 9.67641 15.2881 10 15.2881C10.3236 15.2881 10.5859 15.0079 10.5859 14.6623V10.0729C10.5859 9.72731 10.3236 9.44711 10 9.44711Z" fill="currentColor"></path> 146 <path d="M13.5156 9.44711C13.192 9.44711 12.9297 9.72731 12.9297 10.0729V14.6623C12.9297 15.0079 13.192 15.2881 13.5156 15.2881C13.8392 15.2881 14.1016 15.0079 14.1016 14.6623V10.0729C14.1015 9.72731 13.8392 9.44711 13.5156 9.44711Z" fill="currentColor"></path> 147 </svg> 148 <span>View cart</span> 149 </a>`; 150 $(viewcartHtml).insertAfter($thisproduct); 151 } 152 } 153 }); 154 }); 155 }, 156 157 imageAccordion: function () { 158 if ($('.rtrb-image-accordion-wrapper')) { 159 $('.rtrb-image-accordion-wrapper').each(function () { 160 161 var imageAccordions = $(this); 162 let activeType = imageAccordions.find('.item').data('active-type') 163 164 if (activeType == 'click') { 165 166 imageAccordions.find('.item').click(function () { 167 $(this).parent().find('.item').removeClass('item-active'); 168 $(this).parent().find('.item').removeClass('checkedItem'); 169 $(this).addClass('item-active'); 170 }) 171 } 172 173 if (activeType == 'hover') { 174 imageAccordions.find('.item').mouseover(function () { 175 $(this).parent().find('.item').removeClass('checkedItem'); 176 }) 177 } 178 179 }) 180 } 181 }, 182 183 socialShare: function () { 184 $(document).on( 185 'click', 186 '.rtrb-share-btn[target="_blank"]', 187 function (event) { 188 event.preventDefault(); 189 190 let windowSize = ''; 191 const url = this.href, 192 domain = url.split('/')[2]; 193 194 switch (domain) { 195 case 'www.facebook.com': 196 windowSize = 'width=585,height=368'; 197 break; 198 case 'twitter.com': 199 windowSize = 'width=585,height=261'; 200 break; 201 case 'pinterest.com': 202 windowSize = 'width=750,height=550'; 203 break; 204 default: 205 windowSize = 'width=585,height=515'; 206 } 207 window.open( 208 url, 209 '', 210 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,' + 211 windowSize 212 ); 213 } 214 ); 215 }, 216 217 newsTicker: function () { 218 if ($('.rtrb-ticker-wrapper')) { 219 $(".rtrb-ticker-wrapper").each(function (i) { 220 221 // local variable 222 const rtrbTicker = $(this); 223 const _tickerType = $(this).data("ticker-type"); 224 const _tickerDirection = rtrbTicker.data("ticker-direction"); 225 const _tickerSpeed = rtrbTicker.data("ticker-speed"); 226 const _stopOnHover = Boolean(rtrbTicker.data("ticker-stop-hover")); 227 const _ticker = $(this).find('.rtrb-news-ticker-data'); 228 const _tickerPrev = $(this).find(".rtrb-news-ticker-prev"); 229 const _tickerNext = $(this).find(".rtrb-news-ticker-next"); 230 231 setTimeout(function () { 232 rtrbTicker.animate({ opacity: "1" }); 233 rtrbTicker.parents('.rtrb-preloader-wrapper').addClass('rtrb-preloader-init'); 234 }, 100) 235 236 // AcmeTicker init 237 _ticker.AcmeTicker({ 238 type: _tickerType || 'horizontal', 239 direction: _tickerDirection || 'right', 240 speed: _tickerSpeed || 1500, 241 pauseOnHover: _stopOnHover, 242 controls: { 243 prev: _tickerPrev, 244 next: _tickerNext 245 } 246 }); 247 248 }) 249 } 250 }, 251 252 searchBlock: function () { 253 const searchIconBtn2 = $('a[href = "#rtrb-search-template"]'); 254 const searchCloseBtn2 = $(".rtrb-search-close-btn.rtrb-close-btn2"); 255 const searchOverlay2 = $("#rtrb-search-template"); 256 if (searchIconBtn2) { 257 searchIconBtn2.on('click', function () { 258 searchOverlay2.css({ "bottom": "0", "opacity": "1" }); 259 searchCloseBtn2.css({ 'visibility': 'visible' }) 260 }) 261 } 262 if (searchCloseBtn2) { 263 searchCloseBtn2.on('click', function () { 264 searchOverlay2.css({ "bottom": "100%", "opacity": "0" }); 265 searchCloseBtn2.css({ 'visibility': 'hidden' }) 266 }) 267 } 268 269 $('#rtrb-search-icon3').on('click', function (event) { 270 event.preventDefault(); 271 272 var target = $("#rtrb-search-template3");
273 target.removeClass("close-change"); 274 target.addClass("header-search-open"); 275 276 var self_class = $('#rtrb-search-icon3'); 277 self_class.addClass("close-change"); 278 self_class.removeClass("open-change"); 279 280 var self_close = $('#rtrb-search-close-icon3'); 281 self_close.addClass("open-change"); 282 self_close.removeClass("close-change"); 283 284 setTimeout(function () { 285 target.find('input').focus(); 286 }, 600); 287 return false; 288 }); 289 290 $('#rtrb-search-close-icon3').on('click', function (event) { 291 event.preventDefault(); 292 293 var target = $("#rtrb-search-template3"); 294 target.addClass("close-change"); 295 target.removeClass("header-search-open"); 296 297 var self_class = $('#rtrb-search-icon3'); 298 self_class.removeClass("close-change"); 299 self_class.addClass("open-change"); 300 301 var self_close = $('#rtrb-search-close-icon3'); 302 self_close.removeClass("open-change"); 303 self_close.addClass("close-change"); 304 305 setTimeout(function () { 306 target.find('input').focus(); 307 }, 600); 308 return false; 309 }); 310 }, 311 312 advancedVideo: function () { 313 const videoContainer = $(".rtrb-advanced-video-area"); 314 if (videoContainer.length) { 315 for (let i = 0; i < videoContainer.length; i++) { 316 317 const tagElementVideo = videoContainer[i].querySelector('.rtrb-advanced-video-wrapper'); 318 const tagElementPlay = videoContainer[i].querySelector('.rtrb-video-play-show'); 319 const tagElementPlayIcon = videoContainer[i].querySelector('.rtrb-play-icon'); 320 321 let url = $(tagElementVideo).attr('data-url'); 322 let videoAutoplay = $(tagElementVideo).attr('data-autoplay') == 'on' ? true : false; 323 let videoMuted = $(tagElementVideo).attr('data-muted') == 'on' ? true : false; 324 let videoControl = $(tagElementVideo).attr('data-control') == 'on' ? true : false; 325 let videoLoop = $(tagElementVideo).attr('data-loop') == 'on' ? true : false; 326 327 if (tagElementPlay) { 328 $(tagElementPlayIcon).on("click", function (event) { 329 event.preventDefault(); 330 $(tagElementPlay).hide(); 331 $(tagElementVideo).show(); 332 }); 333 } 334 335 renderReactPlayer(tagElementVideo, { 336 url, 337 width: '100%', 338 height: '100%', 339 className: 'rtrb-video-player', 340 controls: videoControl, 341 playing: videoAutoplay, 342 muted: videoMuted, 343 loop: videoLoop 344 }); 345 } 346 } 347 }, 348 349 advancedTab: function () { 350 const rtrbTabWrappers = document.querySelectorAll('.rtrb-tabs-wrapper'); 351 if (rtrbTabWrappers.length) { 352 // for scoped 353 rtrbTabWrappers.forEach((rtrbTabWrapper) => { 354 const rtrbTabLabels = rtrbTabWrapper.querySelectorAll(".rtrb-tab-nav .rtrb-tab-nav-item"); 355 const rtrbTabPanes = rtrbTabWrapper.querySelectorAll(".rtrb-tab-pane-wrapper .rtrb-tab-pane"); 356 if (rtrbTabLabels.length) {
357 rtrbTabLabels.forEach(item => { 358 item.addEventListener('click', function () { 359 360 // menu item 361 rtrbTabLabels.forEach(lableItem => { 362 lableItem.classList.remove('active'); 363 }) 364 365 // tab pane item 366 rtrbTabPanes.forEach(paneItem => { 367 paneItem.classList.remove('active'); 368 }) 369 // matching by data-rt-tab-id and pass active class 370 const valueMatchingTab = this.getAttribute('data-rt-tab-id'); 371 const getMatchingTab = rtrbTabWrapper.querySelectorAll(`[data-rt-tab-id="${valueMatchingTab}"]`) 372 getMatchingTab.forEach(ele => ele.classList.add('active')) 373 }) 374 }) 375 } 376 }) 377 } 378 }, 379 380 buttonBock: function () { 381 if ($('.rt-position-aware-btn')) { 382 $('.rt-position-aware-btn') 383 .on('mouseenter', function (e) { 384 const parentOffset = $(this).offset(), 385 relX = e.pageX - parentOffset.left, 386 relY = e.pageY - parentOffset.top; 387 $(this).find('span').css({ top: relY, left: relX }) 388 }) 389 .on('mouseout', function (e) { 390 const parentOffset = $(this).offset(), 391 relX = e.pageX - parentOffset.left, 392 relY = e.pageY - parentOffset.top; 393 $(this).find('span').css({ top: relY, left: relX }) 394 }); 395 } 396 }, 397 398 accordionBlock: function () { 399 if ($('.rtrb-accordion__list')) { 400 $('.rtrb-accordion__list').each(function () { 401 var list = $(this) 402 var accordionType = $(this).attr('data-accordionType'); 403 list.find('.rtrb-accordion__item:not(.rt-expand-tab) > .rtrb-accordion__content').hide(); 404 405 if (accordionType == 'accordion') { 406 list.find('.rtrb-accordion__item > .rtrb-accordion__header').click(function () { 407 var item = $(this).parents('.rtrb-accordion__item'); 408 if (item.hasClass('rt-expand-tab')) { 409 item.removeClass("rt-expand-tab").find(".rtrb-accordion__content").slideUp(); 410 } else { 411 list.find('.rtrb-accordion__item.rt-expand-tab .rtrb-accordion__content').slideUp() 412 list.find('.rtrb-accordion__item.rt-expand-tab').removeClass('rt-expand-tab') 413 item.addClass("rt-expand-tab").find(".rtrb-accordion__content").slideDown(); 414 } 415 }) 416 } 417 418 if (accordionType == 'toggle') { 419 list.find('.rtrb-accordion__item > .rtrb-accordion__header').click(function () { 420 var item = $(this).parents('.rtrb-accordion__item'); 421 if (item.hasClass("rt-expand-tab")) { 422 item.removeClass("rt-expand-tab").find(".rtrb-accordion__content").slideToggle(); 423 } else { 424 item.addClass("rt-expand-tab").find(".rtrb-accordion__content").slideToggle(); 425 } 426 return false; 427 }) 428 } 429 }) 430 } 431 }, 432 433 countDownBlock: function () { 434 const countdowns = $(".rtrbcd1"); 435 436 // Return no countdown block 437 if (!countdowns) return; 438 439 for (let i = 0; i < countdowns.length; i++) { 440 const tagElement = countdowns[i]; 441 const deadlineDateTime = parseInt(tagElement.getAttribute("data-deadline-date-time")); 442 443 const fakeElement = { textContent: "00" }; 444 const fakeElement2 = { 445 textContent: "00", 446 r: { 447 baseVal: { 448 value: 95 449 } 450 } 451 }; 452 453 const daySpanTag = tagElement.querySelector(".rtrb-countdown__item.rt-day .rtrb-countdown__count") || fakeElement; 454 const hourSpanTag = tagElement.querySelector(".rtrb-countdown__item.rt-hr .rtrb-countdown__count") || fakeElement; 455 const minuteSpanTag = tagElement.querySelector(".rtrb-countdown__item.rt-min .rtrb-countdown__count") || fakeElement;
456 const secondSpanTag = tagElement.querySelector(".rtrb-countdown__item.rt-sec .rtrb-countdown__count") || fakeElement; 457 458 const dayCircleRef = tagElement.querySelector(".rtrb-countdown__item.rt-day .rtCircleTrackUp") || fakeElement2; 459 const hoursCircleRef = tagElement.querySelector(".rtrb-countdown__item.rt-hr .rtCircleTrackUp") || fakeElement2; 460 const minuteCirclesRef = tagElement.querySelector(".rtrb-countdown__item.rt-min .rtCircleTrackUp") || fakeElement2; 461 const secondsCircleRef = tagElement.querySelector(".rtrb-countdown__item.rt-sec .rtCircleTrackUp") || fakeElement2; 462 463 const dateTimeLeft = (deadlineDateTime, intervalId = null) => { 464 const now = Date.now(); 465 const secondsLeft = Math.round((deadlineDateTime - now) / 1000); 466 const seconds = secondsLeft % 60; 467 const minutes = Math.floor(secondsLeft / 60) % 60; 468 const hours = Math.floor(secondsLeft / 3600) % 24; 469 const days = Math.floor(secondsLeft / 86400); 470 471 if (secondsLeft < 0) { 472 clearInterval(intervalId); 473 daySpanTag.textContent = "00"; 474 hourSpanTag.textContent = "00"; 475 minuteSpanTag.textContent = "00";
476 secondSpanTag.textContent = "00"; 477 return; 478 } 479 480 daySpanTag.textContent = days < 10 ? `0${days}` : `${days}`; 481 hourSpanTag.textContent = hours < 10 ? `0${hours}` : `${hours}`; 482 minuteSpanTag.textContent = minutes < 10 ? `0${minutes}` : `${minutes}`; 483 secondSpanTag.textContent = seconds < 10 ? `0${seconds}` : `${seconds}`; 484 485 if (tagElement.classList.contains('rtrb-countdown--style-5')) { 486 // circular progress 487 488 // get deadline value (days, hours, minutes, seconds) 489 const dayRefValue = Number(daySpanTag.textContent) 490 const hrRefValue = Number(hourSpanTag.textContent) 491 const minRefValue = Number(minuteSpanTag.textContent) 492 const secRefValue = Number(secondSpanTag.textContent) 493 494 // get base value of svg circle tags (days, hours, minutes, seconds) 495 const radiusDay = dayCircleRef?.r?.baseVal?.value; 496 const radiusHr = hoursCircleRef?.r?.baseVal?.value; 497 const radiusMin = minuteCirclesRef?.r?.baseVal?.value; 498 const radiusSec = secondsCircleRef?.r?.baseVal?.value; 499 500 // get circumference (poridhi) value of svg circle (days, hours, minutes, seconds) 501 const circumferenceDay = radiusDay * 2 * Math.PI; 502 const circumferenceHr = radiusHr * 2 * Math.PI; 503 const circumferenceMin = radiusMin * 2 * Math.PI; 504 const circumferenceSec = radiusSec * 2 * Math.PI; 505 506 // get track value for current circle status 507 const dayDashOffVal = circumferenceDay - ((dayRefValue / 365) * circumferenceDay); 508 const hrDashOffVal = circumferenceHr - ((hrRefValue / 24) * circumferenceHr); 509 const minDashOffVal = circumferenceMin - ((minRefValue / 60) * circumferenceMin); 510 const secDashOffVal = circumferenceSec - ((secRefValue / 60) * circumferenceSec); 511 512 // css implement for circle tag strokeDasharray & strokeDashoffset 513 dayCircleRef.style.strokeDasharray = circumferenceDay 514 dayCircleRef.style.strokeDashoffset = dayDashOffVal 515 516 hoursCircleRef.style.strokeDasharray = circumferenceHr 517 hoursCircleRef.style.strokeDashoffset = hrDashOffVal 518 519 minuteCirclesRef.style.strokeDasharray = circumferenceMin 520 minuteCirclesRef.style.strokeDashoffset = minDashOffVal 521 522 secondsCircleRef.style.strokeDasharray = circumferenceSec 523 secondsCircleRef.style.strokeDashoffset = secDashOffVal 524 525 } 526 }; 527 528 dateTimeLeft(deadlineDateTime || 0); 529 530 const intervalId = setInterval(() => { 531 dateTimeLeft(deadlineDateTime || 0, intervalId); 532 }, 1000); 533 534 } 535 }, 536 537 countDownBlockLayout6: function () { 538 const countdowns = $(".rtrbcd2"); 539 540 // Return no countdown block 541 if (!countdowns) return; 542 543 for (let i = 0; i < countdowns.length; i++) { 544 const tagElement = countdowns[i]; 545 const deadlineDateTime = parseInt(tagElement.getAttribute("data-deadline-date-time")); 546 const fakeElement = { textContent: "0" }; 547 const daySpanTag1 = tagElement.querySelector(".rtrb-countdown__item.rt-day .rt-d1") || fakeElement; 548 const daySpanTag2 = tagElement.querySelector(".rtrb-countdown__item.rt-day .rt-d2") || fakeElement; 549 const daySpanTag3 = tagElement.querySelector(".rtrb-countdown__item.rt-day .rt-d3") || fakeElement; 550 const hourSpanTag1 = tagElement.querySelector(".rtrb-countdown__item.rt-hr .rt-h1") || fakeElement; 551 const hourSpanTag2 = tagElement.querySelector(".rtrb-countdown__item.rt-hr .rt-h2") || fakeElement; 552 const minuteSpanTag1 = tagElement.querySelector(".rtrb-countdown__item.rt-min .rt-m1") || fakeElement; 553 const minuteSpanTag2 = tagElement.querySelector(".rtrb-countdown__item.rt-min .rt-m2") || fakeElement;
554 const secondSpanTag1 = tagElement.querySelector(".rtrb-countdown__item.rt-sec .rt-s1") || fakeElement; 555 const secondSpanTag2 = tagElement.querySelector(".rtrb-countdown__item.rt-sec .rt-s2") || fakeElement; 556 557 const dateTimeLeft = (deadlineDateTime, intervalId = null) => { 558 const now = Date.now(); 559 const secondsLeft = Math.round((deadlineDateTime - now) / 1000); 560 const seconds = (secondsLeft % 60).toString().split(""); 561 const minutes = (Math.floor(secondsLeft / 60) % 60).toString().split(""); 562 const hours = (Math.floor(secondsLeft / 3600) % 24).toString().split(""); 563 const days = (Math.floor(secondsLeft / 86400)).toString().split(""); 564 565 if (secondsLeft < 0) { 566 clearInterval(intervalId); 567 daySpanTag1.textContent = "0"; 568 daySpanTag2.textContent = "0"; 569 daySpanTag3.textContent = "0"; 570 hourSpanTag1.textContent = "0"; 571 hourSpanTag2.textContent = "0"; 572 minuteSpanTag1.textContent = "0"; 573 minuteSpanTag2.textContent = "0"; 574 secondSpanTag1.textContent = "0";
575 secondSpanTag2.textContent = "0"; 576 return; 577 } 578 579 if (days.length == 2) { 580 days.unshift(0); 581 } 582 if (days.length == 1) { 583 days.unshift(0, 0); 584 } 585 if (hours.length == 1) { 586 hours.unshift(0); 587 } 588 if (minutes.length == 1) { 589 minutes.unshift(0); 590 } 591 if (seconds.length == 1) { 592 seconds.unshift(0); 593 } 594 595 daySpanTag1.textContent = `${days[0]}`; 596 daySpanTag2.textContent = `${days[1]}`; 597 daySpanTag3.textContent = `${days[2]}`; 598 hourSpanTag1.textContent = `${hours[0]}`; 599 hourSpanTag2.textContent = `${hours[1]}`; 600 minuteSpanTag1.textContent = `${minutes[0]}`; 601 minuteSpanTag2.textContent = `${minutes[1]}`; 602 secondSpanTag1.textContent = `${seconds[0]}`; 603 secondSpanTag2.textContent = `${seconds[1]}`; 604 }; 605 606 dateTimeLeft(deadlineDateTime || 0); 607 const intervalId = setInterval(() => { 608 dateTimeLeft(deadlineDateTime || 0, intervalId); 609 }, 1000); 610 611 } 612 }, 613 614 counterBlock: function () { 615 // odometer counter 616 const rtrbCountNumber = $('.rtrb-count-number'); 617 if (rtrbCountNumber.length) { 618 rtrbCountNumber.each(function () { 619 rtrbCountNumber.appear(function (e) { 620 const el = this; 621 const updateData = $(el).attr("data-count"); 622 const od = new Odometer({ 623 el: el, 624 format: $(el).attr("data-format"), 625 duration: $(el).attr("data-duration"), 626 }); 627 od.update(updateData); 628 }); 629 }); 630 } 631 }, 632 } 633 634 //swiper slider intialize 635 window.initRtrbSlider = function () { 636 637 const swiperMainWrapper = $(".rtrb-block-frontend.rtrb-swiper-main-wrapper"); 638 if (swiperMainWrapper.length) { 639 $(".rtrb-swiper-slider").each(function (i) { 640 let $thisSlider = $(this); 641 setTimeout(function () { 642 $thisSlider.parents('.rtrb-swiper-container').animate({ opacity: "1" }); 643 $thisSlider.parents('.rtrb-swiper-container').parents('.rtrb-swiper-main-wrapper').addClass('rtrb-swiper-init'); 644 }, 100) 645 646 this.defaultOptions = { 647 breakpointsInverse: true, 648 observer: true, 649 navigation: { 650 nextEl: $thisSlider.find(".rtrb-slider-btn-next").get(i), 651 prevEl: $thisSlider.find(".rtrb-slider-btn-prev").get(i) 652 } 653 }; 654 this.options = Object.assign({}, this.defaultOptions, $thisSlider.data("options") || {}); 655 new Swiper(this, this.options); 656 }); 657 } 658 //news ticker init 659 app.newsTicker(); 660 }; 661 setTimeout(initRtrbSlider, 500); 662 663 //app initialize 664 $(document).ready(app.initialize); 665 return app; 666})(window, document, jQuery); 667 668
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.