| @@ -14,9 +14,9 @@ | ||
| 14 | 14 | var freeMode = $slider.data('free-mode') === true || $slider.data('free-mode') === 'true'; |
| 15 | 15 | var spaceBetween = parseInt($slider.data('space-between'), 10) || 0; |
| 16 | 16 | var slidesPerViewTablet = parseInt($slider.data('slides-per-view-tablet'), 10) || 2; |
| 17 | 17 | var slidesPerViewMobile = parseInt($slider.data('slides-per-view-mobile'), 10) || 1; |
| 18 | - var paginationType = $slider.data('pagination') !== 'none' ? $slider.data('pagination') : false; | |
| 18 | + var paginationType = $slider.data('pagination') !== 'none' ? $slider.data('pagination') : false; | |
| 19 | 19 | var navigation = $slider.data('navigation') === true || $slider.data('navigation') === 'true'; |
| 20 | 20 | var effect = $slider.data('effect') || 'slide'; |
| 21 | 21 | var cubeShadow = $slider.data('cube-shadow') === true || $slider.data('cube-shadow') === 'true'; |
| 22 | 22 | var coverflowRotate = parseInt($slider.data('coverflow-rotate'), 10) || 50; |
| @@ -277,390 +277,25 @@ | ||
| 277 | 277 | elementorFrontend.hooks.addAction('frontend/element_ready/global', addWidgetTypeToBody); |
| 278 | 278 | elementorFrontend.hooks.addAction('frontend/element_ready/global', initReveal); |
| 279 | 279 | }); |
| 280 | 280 | |
| 281 | - | |
| 282 | - $(window).on("elementor/frontend/init", function ($) { | |
| 283 | - var EasyJarallax = function ($scope, $) { | |
| 284 | - var $wrappers = $scope.hasClass('eele-has-jarallax') ? $scope : $scope.find('.eele-has-jarallax, .eele-inner-jarallax'); | |
| 285 | - if (!$wrappers.length) return; | |
| 286 | - $wrappers.each(function () { | |
| 287 | - var $wrapper = $(this); | |
| 288 | - var bg = $wrapper.data('jarallax-bg'); | |
| 289 | - var speed = $wrapper.data('jarallax-speed') || 0.5; | |
| 290 | - if (!bg) return; | |
| 291 | - // Check if jarallax div already exists | |
| 292 | - var $jarallaxDiv = $wrapper.find('.jarallax'); | |
| 293 | - if ($jarallaxDiv.length === 0) { | |
| 294 | - var jarallaxMarkup = '<div class="jarallax eele-jarallax-bg" data-speed="' + speed + '">\ | |
| 295 | - <img class="jarallax-img" src="' + bg + '" alt="">\ | |
| 296 | - </div>'; | |
| 297 | - $wrapper.append(jarallaxMarkup); | |
| 298 | - $jarallaxDiv = $wrapper.find('.jarallax'); | |
| 299 | - } | |
| 300 | - | |
| 301 | - // Initialize jarallax | |
| 302 | - $jarallaxDiv.each(function () { | |
| 303 | - jarallax(this, { | |
| 304 | - speed: $(this).data('speed') | |
| 305 | - }); | |
| 306 | - }); | |
| 307 | - }); | |
| 308 | - }; | |
| 309 | - elementorFrontend.hooks.addAction("frontend/element_ready/global", EasyJarallax); | |
| 310 | - }); | |
| 311 | - | |
| 312 | - | |
| 313 | - | |
| 314 | - jQuery(window).on('elementor/frontend/init', function() { | |
| 315 | - | |
| 316 | - elementorFrontend.hooks.addAction('frontend/element_ready/eel-video-popup.default', function($scope, $) { | |
| 317 | - | |
| 318 | - const wrapper = $scope.find('.eel-video-popup-wrapper'); | |
| 319 | - const overlay = wrapper.find('.eel-video-overlay'); | |
| 320 | - // Find video element (try with class first, then without) | |
| 321 | - let videoEl = wrapper.find('video.eel-normal-video'); | |
| 322 | - if (!videoEl.length) { | |
| 323 | - videoEl = wrapper.find('video'); | |
| 281 | + document.addEventListener('DOMContentLoaded', function () { | |
| 282 | + // Remove motion effects inline styles | |
| 283 | + document.querySelectorAll('[data-settings]').forEach(function (element) { | |
| 284 | + let settings = element.getAttribute('data-settings'); | |
| 285 | + if (settings.includes('motion_effects')) { | |
| 286 | + element.removeAttribute('data-settings'); | |
| 324 | 287 | } |
| 325 | - // Find iframe element (try with class first, then without) | |
| 326 | - let iframeEl = wrapper.find('iframe.eel-normal-video'); | |
| 327 | - if (!iframeEl.length) { | |
| 328 | - iframeEl = wrapper.find('iframe'); | |
| 329 | - } | |
| 330 | - | |
| 331 | - // Helper function to get YouTube embed URL | |
| 332 | - function getYouTubeEmbedUrl(url) { | |
| 333 | - const regExp = /(?:v=|\/)([0-9A-Za-z_-]{11}).*/; | |
| 334 | - const match = url.match(regExp); | |
| 335 | - if (match && match[1]) { | |
| 336 | - return 'https://www.youtube.com/embed/' + match[1] + '?autoplay=1'; | |
| 337 | - } | |
| 338 | - return null; | |
| 339 | - } | |
| 340 | - | |
| 341 | - // Helper function to get Vimeo embed URL | |
| 342 | - function getVimeoEmbedUrl(url) { | |
| 343 | - const match = url.match(/(\d+)/); | |
| 344 | - if (match && match[1]) { | |
| 345 | - return 'https://player.vimeo.com/video/' + match[1] + '?autoplay=1'; | |
| 346 | - } | |
| 347 | - return null; | |
| 348 | - } | |
| 349 | - | |
| 350 | - // Helper function to open lightbox | |
| 351 | - function openLightbox(videoType, videoUrl, popupId, animation) { | |
| 352 | - const lightboxOverlay = $('#' + popupId); | |
| 353 | - const iframeWrapper = lightboxOverlay.find('.eel-video-popup-iframe-wrapper'); | |
| 354 | - const lightboxContent = lightboxOverlay.find('.eel-video-popup-content'); | |
| 355 | - | |
| 356 | - if (!lightboxOverlay.length) return; | |
| 357 | - | |
| 358 | - // Prevent duplicate opening if already active | |
| 359 | - if (lightboxOverlay.hasClass('active')) { | |
| 360 | - return; | |
| 361 | - } | |
| 362 | - | |
| 363 | - let embedHtml = ''; | |
| 364 | - | |
| 365 | - if (videoType === 'youtube') { | |
| 366 | - const embedUrl = getYouTubeEmbedUrl(videoUrl); | |
| 367 | - if (embedUrl) { | |
| 368 | - embedHtml = '<iframe src="' + embedUrl + '" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe>'; | |
| 369 | - } | |
| 370 | - } else if (videoType === 'vimeo') { | |
| 371 | - const embedUrl = getVimeoEmbedUrl(videoUrl); | |
| 372 | - if (embedUrl) { | |
| 373 | - embedHtml = '<iframe src="' + embedUrl + '" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe>'; | |
| 374 | - } | |
| 375 | - } else if (videoType === 'self_hosted') { | |
| 376 | - embedHtml = '<video src="' + videoUrl + '" controls autoplay></video>'; | |
| 377 | - } | |
| 378 | - | |
| 379 | - if (embedHtml) { | |
| 380 | - iframeWrapper.html(embedHtml); | |
| 381 | - | |
| 382 | - // Apply animation if set | |
| 383 | - if (animation && animation.trim() !== '') { | |
| 384 | - // Remove any existing animation classes | |
| 385 | - const currentClasses = lightboxContent.attr('class') || ''; | |
| 386 | - const animationClasses = currentClasses.match(/\banimated\s+\S+/g); | |
| 387 | - if (animationClasses) { | |
| 388 | - lightboxContent.removeClass(animationClasses.join(' ')); | |
| 389 | - } | |
| 390 | - // Add new animation classes | |
| 391 | - lightboxContent.addClass('animated ' + animation.trim()); | |
| 392 | - } else { | |
| 393 | - // Remove animation classes if no animation | |
| 394 | - const currentClasses = lightboxContent.attr('class') || ''; | |
| 395 | - const animationClasses = currentClasses.match(/\banimated\s+\S+/g); | |
| 396 | - if (animationClasses) { | |
| 397 | - lightboxContent.removeClass(animationClasses.join(' ')); | |
| 398 | - } | |
| 399 | - } | |
| 400 | - | |
| 401 | - lightboxOverlay.addClass('active'); | |
| 402 | - $('body').css('overflow', 'hidden'); | |
| 403 | - } | |
| 404 | - } | |
| 405 | - | |
| 406 | - // Close lightbox handler | |
| 407 | - $(document).on('click', '.eel-video-popup-close', function(e) { | |
| 408 | - e.preventDefault(); | |
| 409 | - const lightboxOverlay = $(this).closest('.eel-video-popup-overlay'); | |
| 410 | - const lightboxContent = lightboxOverlay.find('.eel-video-popup-content'); | |
| 411 | - lightboxOverlay.removeClass('active'); | |
| 412 | - lightboxContent.removeClass('animated'); | |
| 413 | - lightboxOverlay.find('.eel-video-popup-iframe-wrapper').html(''); | |
| 414 | - $('body').css('overflow', ''); | |
| 415 | - }); | |
| 416 | - | |
| 417 | - // Close lightbox on overlay click | |
| 418 | - $(document).on('click', '.eel-video-popup-overlay', function(e) { | |
| 419 | - if ($(e.target).hasClass('eel-video-popup-overlay')) { | |
| 420 | - const lightboxContent = $(this).find('.eel-video-popup-content'); | |
| 421 | - $(this).removeClass('active'); | |
| 422 | - lightboxContent.removeClass('animated'); | |
| 423 | - $(this).find('.eel-video-popup-iframe-wrapper').html(''); | |
| 424 | - $('body').css('overflow', ''); | |
| 425 | - } | |
| 426 | - }); | |
| 427 | - | |
| 428 | - // Close lightbox on ESC key | |
| 429 | - $(document).on('keydown', function(e) { | |
| 430 | - if (e.keyCode === 27) { // ESC key | |
| 431 | - $('.eel-video-popup-overlay.active').each(function() { | |
| 432 | - const lightboxContent = $(this).find('.eel-video-popup-content'); | |
| 433 | - $(this).removeClass('active'); | |
| 434 | - lightboxContent.removeClass('animated'); | |
| 435 | - $(this).find('.eel-video-popup-iframe-wrapper').html(''); | |
| 436 | - $('body').css('overflow', ''); | |
| 437 | - }); | |
| 438 | - } | |
| 439 | - }); | |
| 440 | - | |
| 441 | - if (overlay.length) { | |
| 442 | - // Remove existing handler to prevent duplicate | |
| 443 | - overlay.off('click.eelVideoOverlay'); | |
| 444 | - overlay.on('click.eelVideoOverlay', function(e) { | |
| 445 | - e.preventDefault(); | |
| 446 | - e.stopPropagation(); | |
| 447 | - | |
| 448 | - const $overlay = $(this); | |
| 449 | - const useLightbox = $overlay.data('lightbox') === 'yes'; | |
| 450 | - const videoType = $overlay.data('video-type'); | |
| 451 | - const videoUrl = $overlay.data('video-url'); | |
| 452 | - const popupId = $overlay.data('popup-id'); | |
| 453 | - const animation = $overlay.data('animation') || ''; | |
| 454 | - | |
| 455 | - // If lightbox is enabled, open lightbox | |
| 456 | - if (useLightbox && videoType && videoUrl && popupId) { | |
| 457 | - // Check if lightbox is already open to prevent duplicate | |
| 458 | - const lightboxOverlay = $('#' + popupId); | |
| 459 | - if (lightboxOverlay.hasClass('active')) { | |
| 460 | - return; | |
| 461 | - } | |
| 462 | - openLightbox(videoType, videoUrl, popupId, animation); | |
| 463 | - return; | |
| 464 | - } | |
| 465 | - | |
| 466 | - // Otherwise, play inline (original behavior) | |
| 467 | - // Self-hosted video play | |
| 468 | - if (videoEl.length) { | |
| 469 | - const video = videoEl.get(0); | |
| 470 | - | |
| 471 | - // Function to play video | |
| 472 | - const playVideo = function() { | |
| 473 | - const playPromise = video.play(); | |
| 474 | - if (playPromise !== undefined) { | |
| 475 | - playPromise.catch(function(error) { | |
| 476 | - console.log('Video play failed:', error); | |
| 477 | - // If play fails due to autoplay policy, try with muted | |
| 478 | - if (error.name === 'NotAllowedError' && !video.muted) { | |
| 479 | - video.muted = true; | |
| 480 | - video.play().then(function() { | |
| 481 | - // Unmute after play starts (if user wants sound) | |
| 482 | - setTimeout(function() { | |
| 483 | - video.muted = false; | |
| 484 | - }, 100); | |
| 485 | - }).catch(function(err) { | |
| 486 | - console.log('Video play with mute also failed:', err); | |
| 487 | - }); | |
| 488 | - } | |
| 489 | - }); | |
| 490 | - } | |
| 491 | - }; | |
| 492 | - | |
| 493 | - // Always try to load and play | |
| 494 | - if (video.readyState >= 2) { | |
| 495 | - // Video is already loaded, play immediately | |
| 496 | - playVideo(); | |
| 497 | - } else { | |
| 498 | - // Video not loaded, load it first then play | |
| 499 | - video.load(); | |
| 500 | - // Wait for video to be ready to play | |
| 501 | - const tryPlay = function() { | |
| 502 | - if (video.readyState >= 2) { | |
| 503 | - playVideo(); | |
| 504 | - } else { | |
| 505 | - video.addEventListener('canplay', playVideo, { once: true }); | |
| 506 | - video.addEventListener('loadeddata', playVideo, { once: true }); | |
| 507 | - } | |
| 508 | - }; | |
| 509 | - tryPlay(); | |
| 510 | - } | |
| 511 | - } | |
| 512 | - | |
| 513 | - // YouTube / Vimeo iframe autoplay | |
| 514 | - if (iframeEl.length) { | |
| 515 | - let src = iframeEl.attr('src'); | |
| 516 | - if (src) { | |
| 517 | - // Check if it's YouTube or Vimeo | |
| 518 | - const isYouTube = src.indexOf('youtube.com') !== -1 || src.indexOf('youtu.be') !== -1; | |
| 519 | - const isVimeo = src.indexOf('vimeo.com') !== -1; | |
| 520 | - | |
| 521 | - if (isYouTube || isVimeo) { | |
| 522 | - try { | |
| 523 | - // Use URL object for proper parsing | |
| 524 | - const url = new URL(src); | |
| 525 | - | |
| 526 | - if (isYouTube) { | |
| 527 | - // YouTube: add autoplay, preserve original mute setting | |
| 528 | - url.searchParams.set('autoplay', '1'); | |
| 529 | - // Only set mute=1 if it was already in the URL (preserve original setting) | |
| 530 | - // If mute was not in original URL, don't add it | |
| 531 | - if (!url.searchParams.has('mute')) { | |
| 532 | - // Don't add mute if it wasn't there originally | |
| 533 | - } else { | |
| 534 | - // Keep the original mute value | |
| 535 | - } | |
| 536 | - // Reload iframe with new src | |
| 537 | - iframeEl.attr('src', url.toString()); | |
| 538 | - } else if (isVimeo) { | |
| 539 | - // Vimeo: add autoplay (Vimeo doesn't need mute for autoplay) | |
| 540 | - url.searchParams.set('autoplay', '1'); | |
| 541 | - // Reload iframe with new src | |
| 542 | - iframeEl.attr('src', url.toString()); | |
| 543 | - } | |
| 544 | - } catch (e) { | |
| 545 | - // Fallback for browsers that don't support URL constructor | |
| 546 | - // Remove existing autoplay parameter if present | |
| 547 | - src = src.replace(/[?&]autoplay=[^&]*/g, ''); | |
| 548 | - | |
| 549 | - if (isYouTube) { | |
| 550 | - // Check if mute parameter exists in original URL | |
| 551 | - const hasMute = /[?&]mute=/.test(src); | |
| 552 | - // Add autoplay=1 | |
| 553 | - const separator = src.indexOf('?') === -1 ? '?' : '&'; | |
| 554 | - src += separator + 'autoplay=1'; | |
| 555 | - // Only add mute if it was already there (preserve original setting) | |
| 556 | - // Don't add mute if it wasn't in original URL | |
| 557 | - } else if (isVimeo) { | |
| 558 | - // Vimeo: just add autoplay=1 | |
| 559 | - const separator = src.indexOf('?') === -1 ? '?' : '&'; | |
| 560 | - src += separator + 'autoplay=1'; | |
| 561 | - } | |
| 562 | - | |
| 563 | - // Update src without clearing first | |
| 564 | - iframeEl.attr('src', src); | |
| 565 | - } | |
| 566 | - } | |
| 567 | - } | |
| 568 | - } | |
| 569 | - | |
| 570 | - // Remove overlay after a small delay to ensure video starts | |
| 571 | - setTimeout(function() { | |
| 572 | - overlay.fadeOut(300, function() { | |
| 573 | - $(this).remove(); | |
| 574 | - }); | |
| 575 | - }, 200); | |
| 576 | - }); | |
| 577 | - } | |
| 578 | - | |
| 579 | - // Handle popup button clicks (for display_type = 'popup') | |
| 580 | - const popupBtn = wrapper.find('.entro-all-video-popup'); | |
| 581 | - if (popupBtn.length) { | |
| 582 | - // Remove existing handler to prevent duplicate | |
| 583 | - popupBtn.off('click.eelVideoPopup'); | |
| 584 | - popupBtn.on('click.eelVideoPopup', function(e) { | |
| 585 | - e.preventDefault(); | |
| 586 | - e.stopPropagation(); | |
| 587 | - const $btn = $(this); | |
| 588 | - const videoType = $btn.data('video-type'); | |
| 589 | - const videoUrl = $btn.data('video-src'); | |
| 590 | - const popupId = $btn.data('popup-id'); | |
| 591 | - const lightboxOverlay = $('#' + popupId); | |
| 592 | - const animation = lightboxOverlay.data('animation') || ''; | |
| 593 | - | |
| 594 | - if (videoType && videoUrl && popupId) { | |
| 595 | - // Check if lightbox is already open to prevent duplicate | |
| 596 | - if (lightboxOverlay.hasClass('active')) { | |
| 597 | - return; | |
| 598 | - } | |
| 599 | - openLightbox(videoType, videoUrl, popupId, animation); | |
| 600 | - } | |
| 601 | - }); | |
| 602 | - } | |
| 603 | 288 | }); |
| 604 | 289 | |
| 605 | - }); | |
| 606 | - | |
| 607 | - | |
| 608 | - document.addEventListener('click', function (e) { | |
| 609 | - const link = e.target.closest('.eel-single-nav-list .eel-nav-item a'); | |
| 610 | - if (!link) return; | |
| 611 | - const href = link.getAttribute('href'); | |
| 612 | - if (href && href.startsWith('#') && href.length > 1) { | |
| 613 | - e.preventDefault(); | |
| 614 | - | |
| 615 | - const target = document.querySelector(href); | |
| 616 | - if (target) { | |
| 617 | - target.scrollIntoView({ | |
| 618 | - behavior: 'smooth', | |
| 619 | - block: 'start' | |
| 620 | - }); | |
| 290 | + // Remove any animation-related stylesheets | |
| 291 | + document.querySelectorAll('link').forEach(function (link) { | |
| 292 | + if (link.href.includes('animations') || link.href.includes('motion')) { | |
| 293 | + link.parentNode.removeChild(link); | |
| 621 | 294 | } |
| 622 | - } | |
| 623 | - | |
| 624 | - document.querySelectorAll('.eel-single-nav-list .eel-nav-item').forEach(function (el) { | |
| 625 | - el.classList.remove('active'); | |
| 626 | 295 | }); |
| 627 | - | |
| 628 | - link.closest('.eel-nav-item').classList.add('active'); | |
| 629 | 296 | }); |
| 297 | + | |
| 298 | +})(jQuery); | |
| 630 | 299 | |
| 631 | - | |
| 632 | - // Sticky Navigation single page | |
| 633 | - | |
| 634 | - function applyStickyToContainer($container) { | |
| 635 | - if ($container.find('.elementor-widget-eel-single-nav').length === 0) { | |
| 636 | - return; | |
| 637 | - } | |
| 638 | - | |
| 639 | - $container.addClass('eel-single-nav-sticky-enabled'); | |
| 640 | - } | |
| 641 | - | |
| 642 | - /* ===== Frontend ===== */ | |
| 643 | - $(window).on('elementor/frontend/init', function () { | |
| 644 | - elementorFrontend.hooks.addAction( | |
| 645 | - 'frontend/element_ready/container', | |
| 646 | - function ($scope) { | |
| 647 | - applyStickyToContainer($scope); | |
| 648 | - } | |
| 649 | - ); | |
| 650 | - }); | |
| 651 | - | |
| 652 | - /* ===== Editor ===== */ | |
| 653 | - if (window.elementor && elementor.isEditMode()) { | |
| 654 | - elementor.hooks.addAction('editor:init', function () { | |
| 655 | - elementorFrontend.hooks.addAction( | |
| 656 | - 'frontend/element_ready/container', | |
| 657 | - function ($scope) { | |
| 658 | - applyStickyToContainer($scope); | |
| 659 | - } | |
| 660 | - ); | |
| 661 | - }); | |
| 662 | - } | |
| 663 | - | |
| 664 | -})(jQuery); | |
| 665 | 300 | |
| 666 | 301 | |