2012-10-06 23:46:14 -04:00
|
|
|
var editPermalink,makeSlugeditClickable;(function(a){if(!a("#edit-slug-box").length){return}editPermalink=function(d){var f,j=0,h=a("#editable-post-name"),k=h.html(),n=a("#post_name"),o=n.val(),l=a("#edit-slug-buttons"),m=l.html(),g=a("#editable-post-name-full").html();a("#view-post-btn").hide();l.html('<a href="#" class="save button button-small">'+samplePermalinkL10n.ok+'</a> <a class="cancel" href="#">'+samplePermalinkL10n.cancel+"</a>");l.children(".save").click(function(){var b=h.children("input").val();if(b==a("#editable-post-name-full").text()){return a(".cancel","#edit-slug-buttons").click()}a.post(ajaxurl,{action:"sample-permalink",post_id:d,new_slug:b,new_title:a("#title").val(),screen:pagenow,samplepermalinknonce:a("#samplepermalinknonce").val()},function(c){a("#edit-slug-box").html(c);l.html(m);n.val(b);makeSlugeditClickable();a("#view-post-btn").show()});return false});a(".cancel","#edit-slug-buttons").click(function(){a("#view-post-btn").show();h.html(k);l.html(m);n.val(o);return false});for(f=0;f<g.length;++f){if("%"==g.charAt(f)){j++}}slug_value=(j>g.length/4)?"":g;h.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(c){var b=c.keyCode||0;if(13==b){l.children(".save").click();return false}if(27==b){l.children(".cancel").click();return false}n.val(this.value)}).focus()};makeSlugeditClickable=function(){a("#editable-post-name").click(function(){a("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()})(jQuery);
|