HEX
Server: LiteSpeed
System: Linux linux31.centraldnserver.com 4.18.0-553.83.1.lve.el8.x86_64 #1 SMP Wed Nov 12 10:04:12 UTC 2025 x86_64
User: salamatk (1501)
PHP: 8.1.33
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open
Upload Files
File: /home/salamatk/takarzan.ir/wp-content/themes/xts-luman/js/scripts/videoElementPopup.js
/* global xts_settings */
(function($) {
	XTSThemeModule.$document.on('xtsMenuDropdownsAJAXRenderResults', function() {
		XTSThemeModule.videoElementPopup();
	});

	XTSThemeModule.xtsElementorAddAction('frontend/element_ready/xts_video.default', function() {
		XTSThemeModule.videoElementPopup();
	});

	XTSThemeModule.videoElementPopup = function() {
		if ('undefined' === typeof ($.fn.magnificPopup)) {
			return;
		}

		$.magnificPopup.close();

		$('.xts-el-video-btn:not(.xts-el-video-hosted), .xts-el-video-btn-overlay.xts-el-video-lightbox:not(.xts-el-video-hosted), .xts-action-btn.xts-video-btn a').magnificPopup({
			tClose         : xts_settings.magnific_close,
			tLoading       : xts_settings.magnific_loading,
			removalDelay   : 400,
			type           : 'iframe',
			preloader      : false,
			fixedContentPos: false,
			iframe         : {
				patterns: {
					youtube: {
						index: 'youtube.com/',
						id   : 'v=',
						src  : '//www.youtube.com/embed/%id%?rel=0&autoplay=1&mute=1'
					},
					vimeo  : {
						index: 'vimeo.com/',
						id   : '/',
						src  : '//player.vimeo.com/video/%id%?autoplay=1'
					}
				}
			},
			callbacks      : {
				beforeOpen: function() {
					this.st.mainClass = 'xts-popup-effect';
				}
			}
		});

		$('.xts-el-video-btn-overlay.xts-el-video-lightbox.xts-el-video-hosted,.xts-el-video-btn.xts-el-video-hosted').magnificPopup({
			type        : 'inline',
			removalDelay: 400,
			tClose      : xts_settings.magnific_close,
			tLoading    : xts_settings.magnific_loading,
			preloader   : false,
			callbacks   : {
				beforeOpen  : function() {
					this.st.mainClass = 'xts-popup-effect xts-popup-video-holder';
				},
				elementParse: function(item) {
					var $video = $(item.src).find('video');
					var videoScr = $video.data('lazy-load');
					$video.attr('src', videoScr);
					$video.attr('autoplay', '1');
				},
				open        : function() {
					XTSThemeModule.$document.trigger('xtsImagesLoaded');
					XTSThemeModule.$window.resize();
				},
				close       : function(e) {
					var magnificPopup = $.magnificPopup.instance;

					var $video = $(magnificPopup.items[0].src).find('video');
					$video.attr('src', '');
				}
			}
		});
	};

	$(document).ready(function() {
		XTSThemeModule.videoElementPopup();
	});
})(jQuery);