+ $(window).unload( function(e) {
+ if ( ! autosaveLockRelease )
+ return;
+
+ // unload fires (twice) on removing the Thickbox iframe. Make sure we process only the main document unload.
+ if ( e.target && e.target.nodeName != '#document' )
+ return;
+
+ $.ajax({
+ type: 'POST',
+ url: ajaxurl,
+ async: false,
+ data: {
+ action: 'wp-remove-post-lock',
+ _wpnonce: $('#_wpnonce').val(),
+ post_ID: $('#post_ID').val(),
+ active_post_lock: $('#active_post_lock').val()
+ }
+ });
+ } );
+