Server IP : 192.168.23.10  /  Your IP : 216.73.216.247
Web Server : Apache
System : Linux echo.premieradvertising.com 5.14.0-362.8.1.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Nov 7 14:54:22 EST 2023 x86_64
User : rrrallyteam ( 1049)
PHP Version : 8.1.32
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF
Directory (0555) :  /home/rrrallyteam/public_html/wp-content/plugins/foogallery/js/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/rrrallyteam/public_html/wp-content/plugins/foogallery/js/foogallery.admin.datasources.js
jQuery(function ($) {
	$('.gallery_datasources_button').on('click', function(e) {
		e.preventDefault();
		$('.foogallery-datasources-modal-wrapper').show();
	});

	$('.foogallery-datasources-modal-wrapper').on('click', '.media-modal-close, .foogallery-datasource-modal-cancel', function(e) {
		$('.foogallery-datasources-modal-wrapper').hide();
	});

	$('.foogallery-datasources-modal-wrapper').on('click', '.foogallery-datasource-modal-insert', function(e) {
		var activeDatasource = $('.foogallery-datasource-modal-selector.active').data('datasource');

		//set the datasource
		$('#foogallery_datasource').val( activeDatasource );

		//raise a general event so that other datasources can clean up
		$(document).trigger('foogallery-datasource-changed', activeDatasource);

		//raise a specific event for the new datasource so that things can be done
		$(document).trigger('foogallery-datasource-changed-' + activeDatasource);

		//hide the datasource modal
		$('.foogallery-datasources-modal-wrapper').hide();
	});

	$('.foogallery-datasources-modal-wrapper').on('click', '.foogallery-datasource-modal-reload', function(e) {
		e.preventDefault();

		var $wrapper = $('.foogallery-datasources-modal-wrapper'),
			datasource = $wrapper.data('datasource'),
			$content = $('.foogallery-datasource-modal-container-inner.' + datasource);

		$content.addClass('not-loaded');

		//force the refresh
		$('.foogallery-datasource-modal-selector.active').click();
	});

	$('.foogallery-datasource-modal-selector').on('click', function(e) {
		e.preventDefault();

		var datasource = $(this).data('datasource'),
			$content = $('.foogallery-datasource-modal-container-inner.' + datasource),
			$wrapper = $('.foogallery-datasources-modal-wrapper');

		$('.foogallery-datasource-modal-selector').removeClass('active');
		$(this).addClass('active');

		$('.foogallery-datasource-modal-container-inner').hide();

		$content.show();

		var datasource_value = $('#_foogallery_datasource_value').val();

		if ( $content.hasClass('not-loaded') ) {
			$content.find('.spinner').addClass('is-active');

			$content.removeClass('not-loaded');

			var data = 'action=foogallery_load_datasource_content' +
				'&datasource=' + datasource +
				'&datasource_value=' + encodeURIComponent(datasource_value) +
				'&foogallery_id=' + $wrapper.data('foogalleryid') +
				'&nonce=' + $wrapper.data('nonce');

			$.ajax({
				type: "POST",
				url: ajaxurl,
				data: data,
				success: function(data) {
					$('.foogallery-datasource-modal-reload').show();
					$wrapper.data('datasource', datasource );

					$content.html(data);
					//raise a event so that datasource-specific code can run
					$(document).trigger('foogallery-datasource-content-loaded-' + datasource);
				}
			});
		}
	});
});