mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-12-06 12:51:58 +00:00
Auto add preview link after autosaving a new post or page. Props filosofo. see #5847
git-svn-id: https://develop.svn.wordpress.org/trunk@6953 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -46,9 +46,26 @@ function autosave_update_post_ID(response) {
|
||||
message = autosaveL10n.failText;
|
||||
}
|
||||
jQuery('#autosave').html(message);
|
||||
autosave_update_preview_link(res);
|
||||
autosave_enable_buttons();
|
||||
}
|
||||
|
||||
function autosave_update_preview_link(post_id) {
|
||||
// Add preview button if not already there
|
||||
if ( ! jQuery('#previewview > *').get()[0] ) {
|
||||
var post_type = jQuery('#post_type').val();
|
||||
var previewText = 'page' == post_type ? autosaveL10n.previewPageText : autosaveL10n.previewPostText;
|
||||
jQuery.post(autosaveL10n.requestFile, {
|
||||
action: "get-permalink",
|
||||
post_id: post_id,
|
||||
getpermalinknonce: jQuery('#getpermalinknonce').val()
|
||||
}, function(permalink) {
|
||||
jQuery('#previewview').html('<a target="_blank" href="'+permalink+'">'+previewText+'</a>');
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function autosave_loading() {
|
||||
jQuery('#autosave').html(autosaveL10n.savingText);
|
||||
}
|
||||
@@ -63,6 +80,7 @@ function autosave_saved(response) {
|
||||
message = autosaveL10n.saveText.replace(/%time%/g, autosave_cur_time());
|
||||
}
|
||||
jQuery('#autosave').html(message);
|
||||
autosave_update_preview_link(res);
|
||||
autosave_enable_buttons();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user