1(function($){ 2 3 'use strict'; 4 5 6 function isScrolledIntoViewport(elem) { 7 var docViewTop = $(window).scrollTop(); 8 var docViewBottom = docViewTop + $(window).height(); 9 10 var elemTop = $(elem).offset().top; 11 var elemBottom = elemTop + $(elem).height(); 12 13 return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop)); 14 } 15 16 // Site Preload & Fix transitions on load 17 $(window).on('load', function() { 18 $("body").addClass("site-loaded"); 19 }); 20 21 22 // Smooth Scroll 23 if( typeof SmoothScroll == 'function' && $('body').hasClass('rivax-smooth-scroll') ) { 24 SmoothScroll({ keyboardSupport: false }); 25 } 26 27 28 // Post Reading Progress Indicator 29 if($('.post-reading-progress-indicator').length) { 30 $(window).on('scroll', function () { 31 let docHeight = $("body").height(); 32 let winHeight = $(window).height(); 33 let viewport = docHeight - winHeight; 34 let scrollPos = $(window).scrollTop(); 35 let scrollPercent = (scrollPos / viewport) * 100; 36 $(".post-reading-progress-indicator span").css("width", scrollPercent + "%"); 37 38 }); 39 } 40 41 42 // Offcanvas 43 $('.offcanvas-container').on('click', function (e) { 44 e.stopPropagation(); 45 }); 46 $('body').on('click', '.offcanvas-opener', function (e) { 47 e.stopPropagation(); 48 $(this).closest('.rivax-offcanvas').find('.offcanvas-wrapper').addClass('open'); 49 }); 50 51 $('body, .offcanvas-closer').on('click', function (e) { 52 $('.offcanvas-wrapper').removeClass('open'); 53 }); 54 55 // Popup Search 56 $('body').on('click', '.popup-search-opener', function (e) { 57 e.stopPropagation(); 58 $(this).closest('.popup-search-wrapper').find('.popup-search').addClass('open'); 59 }); 60 61 $('.popup-search-container').on('click', function (e) { 62 e.stopPropagation(); 63 }); 64 65 $('body, .popup-search-closer').on('click', function (e) { 66 $('.popup-search').removeClass('open'); 67 }); 68 69 70 71 // Sticky Header 72 $(window).on('scroll', function () { 73 74 if ( $('#site-sticky-header').length == 0 ) { // Check sticky header is enabled 75 return; 76 } 77 78 var stickyPos = $('#site-header').outerHeight() + 500; 79 var scroll = $(window).scrollTop(); 80 81 if( scroll > stickyPos ) { 82 $('#site-sticky-header').addClass('fixed'); 83 84 // Smart Sticky Sidebar & Elementor Column 85 var stickyHeight = $('#site-sticky-header').outerHeight(); 86 $('.sidebar-container.sticky .sidebar-container-inner, .e-con.rivax-sticky-column').css('top', stickyHeight + 10); 87 } 88 else { 89 $('#site-sticky-header').removeClass('fixed'); 90 $('#site-sticky-header .popup-search').removeClass('open'); 91 $('#site-sticky-header .offcanvas-wrapper').removeClass('open'); 92 93 // Smart Sticky Sidebar & Elementor Column 94 $('.sidebar-container.sticky .sidebar-container-inner, .e-con.rivax-sticky-column').css('top', 10); 95 } 96 }); 97 98 99 // Header Nav prevent # jump 100 $('.rivax-header-nav li > a[href="#"]').on('click', function (e) { 101 e.preventDefault(); 102 }); 103 104 105 // Header Vertical Nav 106 $('.rivax-header-v-nav li.menu-item-has-children > a').on('click', function (e) { 107 e.preventDefault(); 108 $(this).siblings('.sub-menu').slideToggle(); 109 }); 110 111 112 113 114 // Header Mega Menu 115 $('.rivax-header-nav .sub-menu.mega-menu-content').css('display', 'block'); 116 $('.rivax-header-nav li.rivax-mega-menu-4-col > .sub-menu').css('display', 'flex'); 117 $('body').on('mouseenter', '.rivax-header-nav li.rivax-mega-menu-item, .rivax-header-nav li.rivax-mega-menu-4-col', function() { 118 119 var con = $(this).closest('div[data-elementor-type="wp-post"] > .e-con, div[data-elementor-type="wp-page"] > .e-con'); 120 121 122 // $('body').hasClass('elementor-editor-active') 123 if(con.length == 0) { 124 con = $(this).closest('div[data-elementor-type="wp-post"] .elementor-section-wrap > .e-con, div[data-elementor-type="wp-page"] .elementor-section-wrap > .e-con'); 125 } 126 127 128 if(con.length == 0) { 129 return; 130 } 131 132 if( con.hasClass('e-con-boxed') ) { 133 con = con.children('.e-con-inner'); 134 } 135 136 var megaMenuWidth = con.width(); 137 138 var subMenu = $(this).children('.sub-menu'); 139 subMenu.css('width', megaMenuWidth);
140 141 var menuPos = $(this).closest('.rivax-header-nav').offset().left; 142 var paddingLeft = ( con.innerWidth() - con.width() ) / 2; 143 var elementorContainerPos = con.offset().left + paddingLeft; 144 145 if( $('body').hasClass('rtl') ) { 146 var menuRightPos = menuPos + $(this).closest('.rivax-header-nav').width(); 147 var elementorContainerRightPos = elementorContainerPos + megaMenuWidth; 148 149 subMenu.css('right', parseInt(menuRightPos - elementorContainerRightPos)); 150 151 } 152 else { 153 subMenu.css('left', parseInt(elementorContainerPos - menuPos)); 154 } 155 156 157 }); 158 159 160 // Back to Top Button 161 $(window).on('scroll', function (e) { 162 163 var showPos = $('#site-header').outerHeight() + 200; 164 var scroll = $(window).scrollTop(); 165 166 if( scroll > showPos ) { 167 $('#back-to-top').addClass('show'); 168 } 169 else { 170 $('#back-to-top').removeClass('show'); 171 } 172 173 }); 174 175 $('#back-to-top').click(function(e) { 176 $('body,html').animate({scrollTop:0},800); 177 }); 178 179 180 // Fixed Next And Previous Posts 181 $(window).on('scroll', function (e) { 182 183 var scroll = $(window).scrollTop(); 184 185 if( scroll > 900 ) { 186 $('.single-fixed-next-prev-posts').addClass('show'); 187 } 188 else { 189 $('.single-fixed-next-prev-posts').removeClass('show'); 190 } 191 192 }); 193 194 195 // Footer Canvas Menu 196 $('.footer-canvas-menu-btn').click(function(e) { 197 if( $(this).hasClass('active') ) { 198 $(this).removeClass('active'); 199 $('html').removeClass('footer-canvas-menu-active'); 200 } 201 else { 202 $(this).addClass('active'); 203 $('html').addClass('footer-canvas-menu-active'); 204 } 205 206 }); 207 208 209 210 // Comments Area Collapsable 211 $('.comments-list-collapse-btn').on('click', function (e) { 212 var commentsArea = $('.comments-area'); 213 var btn = $(this); 214 215 if( commentsArea.hasClass('collapsed') ) { 216 commentsArea.slideDown(); 217 commentsArea.removeClass('collapsed'); 218 btn.text( btn.data('hide') ); 219 } 220 else { 221 commentsArea.slideUp(); 222 commentsArea.addClass('collapsed'); 223 btn.text( btn.data('show') ); 224 } 225 }); 226 227 228 // Single Post Share Link Box 229 $(".single-share-box-link .share-link-btn").on('click', function(){ 230 $(".single-share-box-link .share-link-text").select(); 231 document.execCommand('copy'); 232 $('.single-share-box-link .copied-popup-text').addClass('show'); 233 setTimeout(function () { 234 $('.single-share-box-link .copied-popup-text').removeClass('show'); 235 }, 2000); 236 }); 237 238 239 240 // Infinite Scroll Load More 241 $(window).on('scroll', function () { 242 243 $( ".rivax-post-load-more.infinite-scroll" ).each(function( index ) { 244 245 if( isScrolledIntoViewport($(this)) ) { 246 $(this).trigger("click"); 247 } 248 249 }); 250 251 }); 252 253 254 // Load more posts ajax 255 $('.rivax-post-load-more').on('click', function (e) { 256 e.preventDefault(); 257 if($(this).hasClass('hide')) return; 258 259 var loadMoreBtn = $(this); 260 var loadMoreLoader = loadMoreBtn.next('.rivax-post-load-more-loader'); 261 var scope = loadMoreBtn.closest('.rivax-posts-container').find('.rivax-posts-wrapper'); 262 263 var widgetId = $(this).data('widget-id'); 264 var postId = $(this).data('post-id'); 265 var pageNumber = $(this).data('current-page') + 1; 266 267 268 269 var data = { 270 action: 'rivax_get_load_more_posts', 271 widgetId: widgetId, 272 postId: postId, 273 pageNumber: pageNumber, 274 qVars: (typeof rivaxLoadMoreQVars !== 'undefined')? rivaxLoadMoreQVars : '', 275 }; 276 $.post({ 277 url: rivax_ajax_object.AjaxUrl, 278 data: data, 279 dataType: 'json', 280 beforeSend: function() {
281 loadMoreBtn.addClass('hide'); 282 loadMoreLoader.addClass('show'); 283 }, 284 success: function(response) { 285 if(response.data) { 286 var items = $(response.data); 287 288 scope.append(items); 289 if( scope.hasClass('layout-masonry') ) { 290 scope.masonry( 'appended', items ); 291 } 292 } 293 294 295 if(response.no_more) { 296 loadMoreLoader.remove(); 297 loadMoreBtn.remove(); 298 } 299 else { 300 loadMoreBtn.data('current-page', pageNumber); 301 } 302 }, 303 error: function() { 304 305 }, 306 complete: function() { 307 loadMoreBtn.removeClass('hide'); 308 loadMoreLoader.removeClass('show'); 309 } 310 }); 311 312 313 }); 314 315 316 // Contact Form 317 $('.rivax-contact-form').on('submit', function (e) { 318 e.preventDefault(); 319 var form = $(this); 320 var submitBtn = form.find('.submit-btn'); 321 var msgWrapper = form.parent('.rivax-contact-form-wrapper').find('.msg-wrapper'); 322 323 if(submitBtn.hasClass('loading')) { 324 return; 325 } 326 327 var data = { 328 action: 'rivax_submit_contact_form', 329 firstName: form.find('#first-name').val(), 330 lastName: form.find('#last-name').val(), 331 email: form.find('#email').val(), 332 subject: form.find('#subject').val(), 333 message: form.find('#message').val(), 334 }; 335 336 $.post({ 337 url: rivax_ajax_object.AjaxUrl, 338 data: data, 339 dataType: 'json', 340 beforeSend: function() { 341 submitBtn.addClass('loading'); 342 }, 343 success: function(response) { 344 if(response.msg == 'fill') { 345 msgWrapper.removeClass('success').addClass('error'); 346 msgWrapper.children('.msg').text( msgWrapper.children('.msg').data('fill') ); 347 } 348 else if(response.msg == 'error') { 349 msgWrapper.removeClass('success').addClass('error'); 350 msgWrapper.children('.msg').text( msgWrapper.children('.msg').data('error') ); 351 } 352 else if(response.msg == 'success') { 353 msgWrapper.removeClass('error').addClass('success'); 354 msgWrapper.children('.msg').text( msgWrapper.children('.msg').data('success') ); 355 form.trigger("reset"); 356 } 357 358 }, 359 error: function() { 360 msgWrapper.removeClass('success').addClass('error'); 361 msgWrapper.children('.msg').text( msgWrapper.children('.msg').data('error') ); 362 }, 363 complete: function() { 364 submitBtn.removeClass('loading'); 365 } 366 }); 367 368 }); 369 370 371 // Social Icon Widget 372 $('.rivax-social-icons a[href=""], .rivax-social-icons a[href="#"]').on('click', function(e) { 373 e.preventDefault(); 374 }); 375 376 377 var rivaxWidgetsHandler = function( $scope, $ ) { 378 379 // Post Masonry Layout 380 var masonryPosts = $scope.find('.rivax-posts-wrapper.layout-masonry'); 381 if ( masonryPosts.length ){ 382 masonryPosts.masonry({ 383 itemSelector: '.post-item', 384 percentPosition: true, 385 }); 386 } 387 388 389 // Post Carousel Layout 390 var carouselPosts = $scope.find('.rivax-posts-wrapper.layout-carousel .rivax-posts-carousel-wrapper'); 391 if ( carouselPosts.length ){ 392 var carouselSettings = carouselPosts.data('settings'); 393 var carouselContainer = carouselPosts.find('.swiper'); 394 var carouselSelector = '#' + carouselPosts.attr('id') + ' .swiper'; 395 396 397 if ( 'undefined' === typeof Swiper ) { 398 const asyncSwiper = elementorFrontend.utils.swiper; 399 400 new asyncSwiper( carouselContainer, carouselSettings ).then( ( newSwiperInstance ) => { 401 var swiper = newSwiperInstance; 402 } ); 403 } else { 404 var swiper = new Swiper(carouselSelector, carouselSettings); 405 } 406 407 } 408 409 410 411 // Single Post Gallery Hero 412 if ( $('.single-hero-gallery-container').length ){ 413 414 var gallerySettings = { 415 slidesPerView: 1, 416 slidesPerGroup: 1, 417 centeredSlides: true, 418 //loop: true, 419 autoplay: true, 420 spaceBetween: 30, 421 a11y: { 422 enabled: false, 423 }, 424 navigation: { 425 nextEl: ".single-hero-gallery-container .swiper-button-next", 426 prevEl: ".single-hero-gallery-container .swiper-button-prev", 427 }, 428 breakpoints: { 429 576: { 430 slidesPerView: 2, 431 }, 432 992: { 433 slidesPerView: 2, 434 } 435 } 436 }; 437 438 var carouselContainer = $('.single-hero-gallery-container .swiper'); 439 var carouselSelector = '.single-hero-gallery-container .swiper'; 440 441 if ( 'undefined' === typeof Swiper ) { 442 const asyncSwiper = elementorFrontend.utils.swiper; 443 444 new asyncSwiper( carouselContainer, gallerySettings ).then( ( newSwiperInstance ) => { 445 var swiper = newSwiperInstance; 446 } ); 447 } else { 448 var swiper = new Swiper(carouselSelector, gallerySettings); 449 } 450 451 } 452 453 454 455 // Mailchimp 456 if( $scope.find('.rivax-mailchimp-wrapper').length ) { 457 458 var elForm = $scope.find('.rivax-mailchimp-form'), 459 elMessage = $scope.find('.rivax-mailchimp-response-message'); 460 461 elForm.on('submit', function (e) { 462 e.preventDefault(); 463 var data = { 464 action: 'rivax_mailchimp_subscribe', 465 subscriber_info: elForm.serialize(), 466 list_id: elForm.data('list-id'), 467 }; 468 $.ajax({
469 type: 'post', 470 url: rivax_ajax_object.AjaxUrl, 471 data: data, 472 success: function success(response) { 473 elForm.trigger('reset'); 474 475 if (response.status) { 476 elMessage.removeClass('error'); 477 elMessage.addClass('success'); 478 elMessage.text(response.msg); 479 } else { 480 elMessage.addClass('error'); 481 elMessage.removeClass('success'); 482 elMessage.text(response.msg); 483 } 484 485 var hideMsg = setTimeout(function () { 486 elMessage.removeClass('error'); 487 elMessage.removeClass('success'); 488 clearTimeout(hideMsg); 489 }, 5000); 490 }, 491 error: function error() { 492 493 } 494 }); 495 }); 496 497 } 498 499 500 501 } 502 503 504 505 // Elementor Widgets 506 $( window ).on( 'elementor/frontend/init', function () { 507 508 elementorFrontend.hooks.addAction( 'frontend/element_ready/widget', rivaxWidgetsHandler ); 509 510 }); 511 512 513})( 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.