HEX
Server: Apache/2.4.59 (Debian)
System: Linux skycube.cz 4.19.0-25-amd64 #1 SMP Debian 4.19.289-2 (2023-08-08) x86_64
User: ilya (534)
PHP: 7.3.31-1~deb10u7
Disabled: 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_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: /var/www/ilya/data/www/eeggs.ru/wp-content/plugins/search-unleashed/js/admin.js
SearchUnleashed = {
  module_list : function(ajax_url, nonce) {
    jQuery('.modules a').click(function() {
    	jQuery(this).parent().parent().load( jQuery(this).attr('href'), { _ajax_nonce: nonce} );				
    	return false;
    });
    
    jQuery('.modules input[type=checkbox]').click(function() {
    	var action = 'su_module_off';
    	var item   = jQuery(this);

      if (item.attr('checked'))
    		action = 'su_module_on';

      jQuery.ajax( {
    			type: 'POST',
    			url: ajax_url,
    			data: ({ action: action, module: jQuery(this).attr('name'), _ajax_nonce: nonce }),
    			success: function(data) { item.parent().parent().toggleClass('disabled'); },
    			error: this.error_message
    	});
    });
  },
  
  module_form : function(form_id, module_id, nonce) {
    jQuery(form_id + ' input[name=cancel]').click(function () {
  	  jQuery(module_id).load (jQuery(form_id).attr('action'), {
  	      action: 'su_module_load',
  	      id: jQuery(form_id + ' input[name=id]').val(),
  	      _ajax_nonce: nonce
  	  }, function() {
  	    SearchUnleashed.module_list(jQuery(form_id).attr('action'), nonce);
  	  });
  	  
  		return false;
  	});

  	jQuery(form_id).ajaxForm({
  		target: module_id,
  		success: function() {
  	    SearchUnleashed.module_list(jQuery(form_id).attr('action'), nonce);
  		}
  	});
	},
	
  error_message : function() {
    alert('There is an error');
  }
};


(function($){
 $.fn.Progressor = function(args){
	args = args || {};

	return this.each(function() {
		// Store value in a cookie
		function timer() {
		  if (running) {
  		  $.ajax({
  		    url: opts.url,
  		    cache: false,
  		    data: ({ action: 'su_index', offset: offset, limit: opts.limit, _ajax_nonce: opts.nonce }),
  		    type: 'POST',
  		    error: SearchUnleashed.error_message,
  		    success: function(data) {
  		      var parts   = data.split(' ');
  		      var left    = parseInt(parts.shift());
  		      var percent = parts.shift();
  		      var message = parts.join(' ')
  		      
		        $(wrapper).find('p').html(message);
		        $('#' + opts.inside).css('width', percent);

  		      if (left > 0) {
  		        // More to come
  		        offset += opts.limit;
          		setTimeout(timer, 0);
  		      }
  		      else {
  		        // Finished
		          $(opts.start).val(original);
        		  $(opts.loading).hide();
  		        running = false;
  		      }
  		    }
  		  });
  		}
		}
	
    // Load values from args and merge with defaults
    var opts = $.extend({
      cancel: 'Cancel',
      inside: 'inner',
      limit: 20,
      nonce: '',
      loading: '#loading'
    }, args);
		
		var offset  = 0;
		var running = false;
		var wrapper = this;
		var original = $(opts.start).val();
		
		$(opts.start).click(function() {
		  var button = this;

		  if (running) {
		    // Cancel
		    running = false;
		    $(button).val(original);
  		  $(opts.loading).hide();
		  }
		  else {
		    offset = 0;
  		  running = true;
		  
  		  // Hide the button
  		  $(button).val(opts.cancel);
  		  $(opts.loading).show();
        
  		  // Setup the progress bar
  		  $(wrapper).empty();
  		  $(wrapper).append('<div id="' + opts.inside + '"></div><p></p>');
  		  $(wrapper).fadeIn();
        $('#' + opts.inside).css('width', '0px');
  		
    		// Now kick-start a timer to perform the progressor
    		setTimeout(timer, 0);
    	}
    	
  		return false;
		});
	  });
  };
})(jQuery);

function highlight (index,item)
{
  jQuery('#color_' + index).css ('backgroundColor', '#' + item.value);
}