diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index ec9a831432..366e0d7216 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -555,11 +555,13 @@ function get_sample_permalink_html($id, $new_slug=null) { if (false === strpos($permalink, '%postname%')) { return ''; } - $title = __('You can edit this part of the permalink using the Edit button on the right'); + $title = __('Click to edit this part of the permalink'); if (strlen($post_name) > 30) { - $post_name = substr($post_name, 0, 14). '…' . substr($post_name, -14); + $post_name_abridged = substr($post_name, 0, 14). '…' . substr($post_name, -14); + } else { + $post_name_abridged = $post_name; } - $post_name_html = ''.$post_name.''; + $post_name_html = ''.$post_name_abridged.''.$post_name.''; $display_link = str_replace('%postname%', $post_name_html, $permalink); return $display_link; } diff --git a/wp-admin/js/slug.js b/wp-admin/js/slug.js index 1851914ef5..c391198cd9 100644 --- a/wp-admin/js/slug.js +++ b/wp-admin/js/slug.js @@ -3,9 +3,10 @@ function edit_permalink(post_id) { var e = jQuery('#editable-post-name'); var revert_e = e.html(); var real_slug = jQuery('#post_name'); + var revert_slug = real_slug.html(); var b = jQuery('#edit-slug-buttons'); var revert_b = b.html(); - var old_slug = e.children('span').html(); + var full = jQuery('#editable-post-name-full').html(); b.html(''+slugL10n.save+' '+slugL10n.cancel+''); b.children('.save').click(function() { @@ -25,13 +26,13 @@ function edit_permalink(post_id) { jQuery('#edit-slug-buttons .cancel').click(function() { e.html(revert_e); b.html(revert_b); - real_slug.attr('value', revert_e); + real_slug.attr('value', revert_slug); return false; }); - for(i=0; i < revert_e.length; ++i) { - if ('%' == revert_e.charAt(i)) c++; + for(i=0; i < full.length; ++i) { + if ('%' == full.charAt(i)) c++; } - slug_value = (c > revert_e.length/4)? '' : revert_e; + slug_value = (c > full.length/4)? '' : full; e.html('').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 diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css index e88fb9aba0..385bd219f5 100644 --- a/wp-admin/wp-admin.css +++ b/wp-admin/wp-admin.css @@ -1053,6 +1053,7 @@ html, body { } #edit-slug-box strong {color: #777;} #editable-post-name {background-color: #FFFBCC;} +#editable-post-name-full {display: none;} #editable-post-name input {width: 16em;} #edit-slug-buttons a.save { background-color: #ebebeb;