HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
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,pcntl_unshare,
Upload Files
File: /var/www/linde/wp-content/plugins/custom-taxonomy-order-ne/js/customtaxorder.js
/*
 * Custom Taxonomy Order NE
 */


jQuery(document).ready(function(jQuery) {

	/* Submit button click event */
	jQuery("#custom-loading").hide();
	jQuery("#order-submit").on( 'click', function() {
		customtaxorder_ordersubmit();
	});

	/* Button to sort the list alphabetically */
	jQuery("#order-alpha").on( 'click', function(e) {
		e.preventDefault();
		jQuery("#custom-loading").show();
		customtaxorder_orderalpha();
		setTimeout(function(){
			jQuery("#custom-loading").hide();
		},500);
		jQuery("#order-alpha").trigger('blur');
	});

	/* Button to sort the list on slug */
	jQuery("#order-slug").on( 'click', function(e) {
		e.preventDefault();
		jQuery("#custom-loading").show();
		customtaxorder_orderslug();
		setTimeout(function(){
			jQuery("#custom-loading").hide();
		},500);
		jQuery("#order-slug").trigger('blur');
	});

});


function customtaxorder_addloadevent(){

	/* Make the Terms sortable */
	jQuery("#custom-order-list").sortable({
		placeholder: "sortable-placeholder",
		revert: false,
		tolerance: "pointer"
	});

	/* The same for the Taxonomies */
	jQuery("#custom-taxonomy-list").sortable({
		placeholder: "sortable-placeholder",
		revert: false,
		tolerance: "pointer"
	});

};
addLoadEvent(customtaxorder_addloadevent);


/* Get all the term_orders and send it in a submit. */
function customtaxorder_ordersubmit() {

	/* Terms */
	var newOrder = jQuery("#custom-order-list").sortable("toArray");
	jQuery("#custom-loading").show();
	jQuery("#hidden-custom-order").val(newOrder);

	/* Taxonomies */
	var newOrder_tax = jQuery("#custom-taxonomy-list").sortable("toArray");
	jQuery("#custom-loading").show();
	jQuery("#hidden-taxonomy-order").val(newOrder_tax);

	return true;
}

/* Alphabetical ascending sort based on text. */
function customtaxorder_orderalpha() {
	jQuery("#custom-order-list li").sort(customtaxorder_asc_sort).appendTo('#custom-order-list');
	var newOrder = jQuery("#custom-order-list").sortable("toArray");
	jQuery("#custom-loading").show();
	jQuery("#hidden-custom-order").val(newOrder);
	return true;
}
function customtaxorder_asc_sort(a, b) {
	return jQuery(a).text().localeCompare(jQuery(b).text(), undefined, {numeric: true, sensitivity: 'base'});
}


/* Alphabetical ascending sort based on slug. */
function customtaxorder_orderslug() {
	jQuery("#custom-order-list li").sort(customtaxorder_slug_sort).appendTo('#custom-order-list');
	var newOrder = jQuery("#custom-order-list").sortable("toArray");
	jQuery("#custom-loading").show();
	jQuery("#hidden-custom-order").val(newOrder);
	return true;
}
function customtaxorder_slug_sort(a, b) {
	return jQuery(a).attr('data-slug').localeCompare(jQuery(b).attr('data-slug'), undefined, {numeric: true, sensitivity: 'base'});
}


/* Keep menu for Tools.php open on our pages. */
jQuery(document).ready(function($) {

	if ( jQuery( "div.customtaxorder" ).hasClass( 'wrap-customtaxorder' ) ) {
		jQuery( 'li#menu-tools' ).removeClass( 'wp-not-current-submenu' );
		jQuery( 'li#menu-tools' ).addClass( 'wp-has-current-submenu' );
		jQuery( 'li#menu-tools' ).addClass( 'wp-menu-open' );
	}

});


/*
 * Show slug of term as well.
 *
 * @since 4.0.1
 */
jQuery(document).ready(function($) {
	jQuery( '#customtaxorder-toggle-slug' ).on( 'click', function() {

		var height = jQuery( '.customtaxorder li.lineitem' ).first().css( 'height' );
		if ( height == '24px' ) {
			jQuery( '.customtaxorder li.lineitem' ).css( 'height', '48px' );
		} else if ( height == '48px' ) {
			jQuery( '.customtaxorder li.lineitem' ).css( 'height', '24px' );
		}

	});
});