-function autosave_update_post_ID( postID ) {
- if ( !isNaN(postID) && postID > 0 ) {
- if ( postID == parseInt(jQuery('#post_ID').val()) ) { return; } // no need to do this more than once
- jQuery('#post_ID').attr({name: "post_ID"});
- jQuery('#post_ID').val(postID);
- // We need new nonces
- jQuery.post(autosaveL10n.requestFile, {
- action: "autosave-generate-nonces",
- post_ID: postID,
- autosavenonce: jQuery('#autosavenonce').val(),
- post_type: jQuery('#post_type').val()
- }, function(html) {
- jQuery('#_wpnonce').val(html);
- autosave_enable_buttons(); // re-enable disabled form buttons
- });
- jQuery('#hiddenaction').val('editpost');
- }
-}
-
-function autosave_update_preview_link(post_id) {
- // Add preview button if not already there
- if ( !jQuery('#previewview > *').size() ) {
- 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+'" tabindex="4">'+previewText+'</a>');
-
- // Autosave when the preview button is clicked.
- jQuery('#previewview a').click(function(e) {
- autosave();
- autosaveDelayURL = this.href;
- previewwin = window.open('','_blank');
-
- e.preventDefault();
- return false;
- });
- });
- }
-}
-