CoreFiles by mySites.guru
gallery.js28 lines, 684 bytes, from wordpress-2.6.2.zip
Raw History Compare with 2.6.1
md5
80af48faad6e78172a7a3f4b612afd64
sha1
bde5a9b28e1e68bd483cc5a1b1c2a174213b29fa
sha256
3d2aae9c4934e956a122c4e17317eb9beb92087f019fbc64b8ed303f7d3160be
jQuery(function($) {
	var gallerySortable;
	var gallerySortableInit = function() {
		gallerySortable = $('#media-items').sortable( {
			items: '.media-item',
			placeholder: 'sorthelper',
			axis: 'y',
			distance: 2,
			update: galleryReorder
		} );
	}

	// When an update has occurred, adjust the order for each item
	var galleryReorder = function(e, sort) {
		jQuery.each(sort['element'].sortable('toArray'), function(i, id) {
			jQuery('#' + id + ' .menu_order input')[0].value = (1+i);
		});
	}

	// initialize sortable
	gallerySortableInit();
});

jQuery(document).ready(function($){
	$('.menu_order_input').each(function(){
		if ( this.value == '0' ) this.value = '';
	});
});

The same content is in 11 releases, WordPress 2.6-RC1 to 2.7-beta3. See them all, or every version of this file.