CoreFiles by mySites.guru
slug.dev.js44 lines, 1,821 bytes, from wordpress-2.8.zip
Raw History Compare with 2.7.1
md5
216b3181cccbf143cef4cae1d09dcb1d
sha1
904518208ad66a85af4dfd5bfa78a78973c73bca
sha256
1d6609da7869426f501ae656c69b2f1621ebddf379d879c904baa1e77e4407ee
function edit_permalink(post_id) {
	var i, c = 0, e = jQuery('#editable-post-name'), revert_e = e.html(), real_slug = jQuery('#post_name'), revert_slug = real_slug.html(), b = jQuery('#edit-slug-buttons'), revert_b = b.html(), full = jQuery('#editable-post-name-full').html();

	jQuery('#view-post-btn').hide();
	b.html('<a href="#" class="save button">'+slugL10n.save+'</a> <a class="cancel" href="#">'+slugL10n.cancel+'</a>');
	b.children('.save').click(function() {
		var new_slug = e.children('input').val();
		jQuery.post(slugL10n.requestFile, {
			action: 'sample-permalink',
			post_id: post_id,
			new_slug: new_slug,
			new_title: jQuery('#title').val(),
			samplepermalinknonce: jQuery('#samplepermalinknonce').val()}, function(data) {
				jQuery('#edit-slug-box').html(data);
				b.html(revert_b);
				real_slug.attr('value', new_slug);
				make_slugedit_clickable();
				jQuery('#view-post-btn').show();
			});
		return false;
	});
	jQuery('#edit-slug-buttons .cancel').click(function() {
		jQuery('#view-post-btn').show();
		e.html(revert_e);
		b.html(revert_b);
		real_slug.attr('value', revert_slug);
		return false;
	});
	for(i=0; i < full.length; ++i) {
		if ('%' == full.charAt(i)) c++;
	}
	slug_value = (c > full.length/4)? '' : full;
	e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children('input').keypress(function(e){
		var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
		// on enter, just save the new slug, don't save the post
		if (13 == key) {b.children('.save').click();return false;}
		if (27 == key) {b.children('.cancel').click();return false;}
		real_slug.attr('value', this.value)}).focus();
}

function make_slugedit_clickable() {
	jQuery('#editable-post-name').click(function() {jQuery('#edit-slug-buttons').children('.edit-slug').click()});
}

The same content is in 15 releases, WordPress 2.8-beta1 to 2.8.6. See them all, or every version of this file.