-
+ C8362405DC31E654A6C1D6419442A6254754D3F9C6176EA037827208EF40E22A0708B4F2FAD08F961BBF7A829F5C12CC1C5BF897B3FFC92EE2B167130AB1039Emp-wp/wp-admin/js/slug.js(0 . 0)(1 . 48)
51442 function edit_permalink(post_id) {
51443 var i, c = 0;
51444 var e = jQuery('#editable-post-name');
51445 var revert_e = e.html();
51446 var real_slug = jQuery('#post_name');
51447 var revert_slug = real_slug.html();
51448 var b = jQuery('#edit-slug-buttons');
51449 var revert_b = b.html();
51450 var full = jQuery('#editable-post-name-full').html();
51451
51452 b.html('<a href="" class="save button">'+slugL10n.save+'</a> <a class="cancel" href="">'+slugL10n.cancel+'</a>');
51453 b.children('.save').click(function() {
51454 var new_slug = e.children('input').val();
51455 jQuery.post(slugL10n.requestFile, {
51456 action: 'sample-permalink',
51457 post_id: post_id,
51458 new_slug: new_slug,
51459 new_title: jQuery('#title').val(),
51460 samplepermalinknonce: jQuery('#samplepermalinknonce').val()}, function(data) {
51461 jQuery('#edit-slug-box').html(data);
51462 b.html(revert_b);
51463 real_slug.attr('value', new_slug);
51464 make_slugedit_clickable();
51465 });
51466 return false;
51467 });
51468 jQuery('#edit-slug-buttons .cancel').click(function() {
51469 e.html(revert_e);
51470 b.html(revert_b);
51471 real_slug.attr('value', revert_slug);
51472 return false;
51473 });
51474 for(i=0; i < full.length; ++i) {
51475 if ('%' == full.charAt(i)) c++;
51476 }
51477 slug_value = (c > full.length/4)? '' : full;
51478 e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children('input').keypress(function(e){
51479 var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
51480 // on enter, just save the new slug, don't save the post
51481 if (13 == key) {b.children('.save').click();return false;}
51482 if (27 == key) {b.children('.cancel').click();return false;}
51483 real_slug.attr('value', this.value)}).focus();
51484 }
51485
51486 function make_slugedit_clickable() {
51487 jQuery('#editable-post-name').click(function() {jQuery('#edit-slug-buttons').children('.edit-slug').click()});
51488 }
51489