HEX
Server: Apache
System: Linux WWW 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64
User: web11 (1011)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/karjerosdiena.lt/wp-content/plugins/simple-custom-post-order/assets/taxonomy_order.js
jQuery(function( $ )
{
	// if it is taxonomy page
	if( adminpage == 'edit-tags-php' )
	{
		// make table rows sortable
		$( '.wp-list-table.tags tbody' ).sortable({
			items: 'tr:not(.inline-edit-row)',
			cursor: 'move',
			axis: 'y',
			containment: 'table.widefat',
			scrollSensitivity: 40,
			stop: function( event, ui ) {
				// array for the ids and positions
				var rows	= new Array([]);

				// show "activity" with spinner
				hsam_taxonomy_sort_activity_spinner( true );

				$( '.wp-list-table.tags tbody tr:not(.inline-edit-row)' ).each( function( i, e ) {
					var rowID	= parseInt( $( e ).attr( 'id' ).substr( 4 ) );
					rows[i]		= rowID;
				} );

				// post rows for sorting
				$.post( ajaxurl, { 'rows' : rows, 'action' : 'get_inline_boxes' }, function(response) {
					// stop activity spinner
					hsam_taxonomy_sort_activity_spinner( false );
				});
			}
		});
	}

	/**
	 * Adds, shows or hides the activity status spinner
 
	 */
	function hsam_taxonomy_sort_activity_spinner( status ) {
		var actions_table	= $( '.tablenav .actions' );

		if( actions_table.find( '.spinner' ).length === 0 && status === true ) {
			// add spinner
			actions_table.prepend( '<div class="spinner" style="display: inline;" />' );
		}
		else if ( status === true ) {
			// show spinner
			actions_table.find( '.spinner' ).show();
		}
		else {
			// hide spinner
			actions_table.find( '.spinner' ).hide();
		}
	}
} );