]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/js/page.js
Wordpress 2.8
[autoinstalls/wordpress.git] / wp-admin / js / page.js
index 943c1de96b44ed0c8d1ecef9889861b313abf09a..7d7dd9bfa29319acdf2b69de967a757f87df06b6 100644 (file)
@@ -1,202 +1 @@
-jQuery(document).ready( function($) {
-       postboxes.add_postbox_toggles('page');
-       make_slugedit_clickable();
-
-       // close postboxes that should be closed
-       jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
-
-       jQuery('#title').blur( function() { if ( (jQuery("#post_ID").val() > 0) || (jQuery("#title").val().length == 0) ) return; autosave(); } );
-
-       var stamp = $('#timestamp').html();
-
-       var visibility = $('#post-visibility-display').html();
-
-       function updateVisibility() {
-               if ( $('#post-visibility-select input:radio:checked').val() != 'public' ) {
-                       $('#sticky').attr('checked', false);
-                       $('#sticky-span').hide();
-               } else {
-                       $('#sticky-span').show();
-               }
-               if ( $('#post-visibility-select input:radio:checked').val() != 'password' ) {
-                       $('#password-span').hide();
-               } else {
-                       $('#password-span').show();
-               }
-       }
-
-       function updateText() {
-               var attemptedDate = new Date( $('#aa').val(), $('#mm').val() -1, $('#jj').val(), $('#hh').val(), $('#mn').val());
-               var originalDate = new Date( $('#hidden_aa').val(), $('#hidden_mm').val() -1, $('#hidden_jj').val(), $('#hidden_hh').val(), $('#hidden_mn').val());
-               var currentDate = new Date( $('#cur_aa').val(), $('#cur_mm').val() -1, $('#cur_jj').val(), $('#cur_hh').val(), $('#cur_mn').val());
-               if ( attemptedDate > currentDate && $('#original_post_status').val() != 'future' ) {
-                       var publishOn = postL10n.publishOnFuture;
-                       $('#publish').val( postL10n.schedule );
-               } else if ( attemptedDate <= currentDate && $('#original_post_status').val() != 'publish' ) {
-                       var publishOn = postL10n.publishOn;
-                       $('#publish').val( postL10n.publish );
-               } else {
-                       var publishOn = postL10n.publishOnPast;
-                       $('#publish').val( postL10n.update );
-               }
-               if ( originalDate.toUTCString() == attemptedDate.toUTCString() ) { //hack
-                       $('#timestamp').html(stamp);
-               } else {
-                       $('#timestamp').html(
-                               publishOn + ' <b>' +
-                               $( '#mm option[value=' + $('#mm').val() + ']' ).text() + ' ' +
-                               $('#jj').val() + ', ' +
-                               $('#aa').val() + ' @ ' +
-                               $('#hh').val() + ':' +
-                               $('#mn').val() + '</b> '
-                       );
-               }
-
-               if ( $('#post-visibility-select input:radio:checked').val() == 'private' ) {
-                       $('#publish').val( postL10n.update );
-                       if ( $('#post_status option[value=publish]').length == 0 ) {
-                               $('#post_status').append('<option value="publish">' + postL10n.privatelyPublished + '</option>');
-                       }
-                       $('#post_status option[value=publish]').html( postL10n.privatelyPublished );
-                       $('#post_status option[value=publish]').attr('selected', true);
-                       $('.edit-post-status').hide();
-               } else {
-                       if ( $('#original_post_status').val() == 'future' || $('#original_post_status').val() == 'draft' ) {
-                               if ( $('#post_status option[value=publish]').length != 0 ) {
-                                       $('#post_status option[value=publish]').remove();
-                                       $('#post_status').val($('#hidden_post_status').val());
-                               }
-                       } else {
-                               $('#post_status option[value=publish]').html( postL10n.published );
-                       }
-                       $('.edit-post-status').show();
-               }
-               $('#post-status-display').html($('#post_status :selected').text());
-               if ( $('#post_status :selected').val() == 'private' || $('#post_status :selected').val() == 'publish' ) {
-                       $('#save-post').hide();
-               } else {
-                       $('#save-post').show();
-                       if ( $('#post_status :selected').val() == 'pending' ) {
-                               $('#save-post').show().val( postL10n.savePending );
-                       } else {
-                               $('#save-post').show().val( postL10n.saveDraft );
-                       }
-               }
-       }
-
-       $('.edit-visibility').click(function () {
-               if ($('#post-visibility-select').is(":hidden")) {
-                       updateVisibility();
-                       $('#post-visibility-select').slideDown("normal");
-                       $('.edit-visibility').hide();
-               }
-               return false;
-       });
-
-       $('.cancel-post-visibility').click(function () {
-               $('#post-visibility-select').slideUp("normal");
-               $('#visibility-radio-' + $('#hidden-post-visibility').val()).attr('checked', true);
-               $('#post_password').val($('#hidden_post_password').val());
-               $('#post-visibility-display').html(visibility);
-               $('.edit-visibility').show();
-               updateText();
-               return false;
-       });
-
-       $('.save-post-visibility').click(function () { // crazyhorse - multiple ok cancels
-               $('#post-visibility-select').slideUp("normal");
-               $('.edit-visibility').show();
-               updateText();
-
-               $('#post-visibility-display').html(
-                       postL10n[$('#post-visibility-select input:radio:checked').val()]
-               );
-
-               return false;
-       });
-
-       $('#post-visibility-select input:radio').change(function() {
-               updateVisibility();
-       });
-
-       $('.edit-timestamp').click(function () {
-               if ($('#timestampdiv').is(":hidden")) {
-                       $('#timestampdiv').slideDown("normal");
-                       $('.edit-timestamp').hide();
-               }
-
-               return false;
-       });
-
-       $('.cancel-timestamp').click(function() {
-               $('#timestampdiv').slideUp("normal");
-               $('#mm').val($('#hidden_mm').val());
-               $('#jj').val($('#hidden_jj').val());
-               $('#aa').val($('#hidden_aa').val());
-               $('#hh').val($('#hidden_hh').val());
-               $('#mn').val($('#hidden_mn').val());
-               $('.edit-timestamp').show();
-
-               updateText();
-               return false;
-       });
-
-       $('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels
-               $('#timestampdiv').slideUp("normal");
-               $('.edit-timestamp').show();
-               updateText();
-
-               return false;
-       });
-
-       $('.edit-post-status').click(function() {
-               if ($('#post-status-select').is(":hidden")) {
-                       $('#post-status-select').slideDown("normal");
-                       $(this).hide();
-               }
-
-               return false;
-       });
-
-       $('.save-post-status').click(function() {
-               $('#post-status-select').slideUp("normal");
-               $('.edit-post-status').show();
-               updateText();
-               return false;
-       });
-
-       $('.cancel-post-status').click(function() {
-               $('#post-status-select').slideUp("normal");
-               $('#post_status').val($('#hidden_post_status').val());
-               $('.edit-post-status').show();
-
-               updateText();
-               return false;
-       });
-
-       // Custom Fields
-       jQuery('#the-list').wpList( { addAfter: function( xml, s ) {
-               $('table#list-table').show();
-               if ( jQuery.isFunction( autosave_update_post_ID ) ) {
-                       autosave_update_post_ID(s.parsed.responses[0].supplemental.postid);
-               }
-       }, addBefore: function( s ) {
-               s.data += '&post_id=' + jQuery('#post_ID').val();
-               return s;
-       }
-       });
-
-       // preview
-       $('#post-preview').click(function(e){
-               if ( 1 > $('#post_ID').val() && autosaveFirst ) {
-                       autosaveDelayPreview = true;
-                       autosave();
-                       return false;
-               }
-
-               $('input#wp-preview').val('dopreview');
-               $('form#post').attr('target', 'wp-preview').submit().attr('target', '');
-               $('input#wp-preview').val('');
-               return false;
-       });
-});
+jQuery(document).ready(function(e){postboxes.add_postbox_toggles("page");make_slugedit_clickable();e("#title").blur(function(){if((e("#post_ID").val()>0)||(e("#title").val().length==0)){return}autosave()});var b=e("#timestamp").html(),a=e("#post-visibility-display").html();function d(){if(e("#post-visibility-select input:radio:checked").val()!="public"){e("#sticky").attr("checked",false);e("#sticky-span").hide()}else{e("#sticky-span").show()}if(e("#post-visibility-select input:radio:checked").val()!="password"){e("#password-span").hide()}else{e("#password-span").show()}}function c(){var f,h,g,i;f=new Date(e("#aa").val(),e("#mm").val()-1,e("#jj").val(),e("#hh").val(),e("#mn").val());h=new Date(e("#hidden_aa").val(),e("#hidden_mm").val()-1,e("#hidden_jj").val(),e("#hidden_hh").val(),e("#hidden_mn").val());g=new Date(e("#cur_aa").val(),e("#cur_mm").val()-1,e("#cur_jj").val(),e("#cur_hh").val(),e("#cur_mn").val());if(f>g&&e("#original_post_status").val()!="future"){i=postL10n.publishOnFuture;e("#publish").val(postL10n.schedule)}else{if(f<=g&&e("#original_post_status").val()!="publish"){i=postL10n.publishOn;e("#publish").val(postL10n.publish)}else{i=postL10n.publishOnPast;e("#publish").val(postL10n.update)}}if(h.toUTCString()==f.toUTCString()){e("#timestamp").html(b)}else{e("#timestamp").html(i+" <b>"+e("#mm option[value="+e("#mm").val()+"]").text()+" "+e("#jj").val()+", "+e("#aa").val()+" @ "+e("#hh").val()+":"+e("#mn").val()+"</b> ")}if(e("#post-visibility-select input:radio:checked").val()=="private"){e("#publish").val(postL10n.update);if(e("#post_status option[value=publish]").length==0){e("#post_status").append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}e("#post_status option[value=publish]").html(postL10n.privatelyPublished);e("#post_status option[value=publish]").attr("selected",true);e(".edit-post-status").hide()}else{if(e("#original_post_status").val()=="future"||e("#original_post_status").val()=="draft"){if(e("#post_status option[value=publish]").length!=0){e("#post_status option[value=publish]").remove();e("#post_status").val(e("#hidden_post_status").val())}}else{e("#post_status option[value=publish]").html(postL10n.published)}e(".edit-post-status").show()}e("#post-status-display").html(e("#post_status :selected").text());if(e("#post_status :selected").val()=="private"||e("#post_status :selected").val()=="publish"){e("#save-post").hide()}else{e("#save-post").show();if(e("#post_status :selected").val()=="pending"){e("#save-post").show().val(postL10n.savePending)}else{e("#save-post").show().val(postL10n.saveDraft)}}}e(".edit-visibility").click(function(){if(e("#post-visibility-select").is(":hidden")){d();e("#post-visibility-select").slideDown("normal");e(".edit-visibility").hide()}return false});e(".cancel-post-visibility").click(function(){e("#post-visibility-select").slideUp("normal");e("#visibility-radio-"+e("#hidden-post-visibility").val()).attr("checked",true);e("#post_password").val(e("#hidden_post_password").val());e("#post-visibility-display").html(a);e(".edit-visibility").show();c();return false});e(".save-post-visibility").click(function(){e("#post-visibility-select").slideUp("normal");e(".edit-visibility").show();c();e("#post-visibility-display").html(postL10n[e("#post-visibility-select input:radio:checked").val()]);return false});e("#post-visibility-select input:radio").change(function(){d()});e(".edit-timestamp").click(function(){if(e("#timestampdiv").is(":hidden")){e("#timestampdiv").slideDown("normal");e(".edit-timestamp").hide()}return false});e(".cancel-timestamp").click(function(){e("#timestampdiv").slideUp("normal");e("#mm").val(e("#hidden_mm").val());e("#jj").val(e("#hidden_jj").val());e("#aa").val(e("#hidden_aa").val());e("#hh").val(e("#hidden_hh").val());e("#mn").val(e("#hidden_mn").val());e(".edit-timestamp").show();c();return false});e(".save-timestamp").click(function(){e("#timestampdiv").slideUp("normal");e(".edit-timestamp").show();c();return false});e(".edit-post-status").click(function(){if(e("#post-status-select").is(":hidden")){e("#post-status-select").slideDown("normal");e(this).hide()}return false});e(".save-post-status").click(function(){e("#post-status-select").slideUp("normal");e(".edit-post-status").show();c();return false});e(".cancel-post-status").click(function(){e("#post-status-select").slideUp("normal");e("#post_status").val(e("#hidden_post_status").val());e(".edit-post-status").show();c();return false});e("#the-list").wpList({addAfter:function(f,g){e("table#list-table").show();if(e.isFunction(autosave_update_post_ID)){autosave_update_post_ID(g.parsed.responses[0].supplemental.postid)}},addBefore:function(f){f.data+="&post_id="+e("#post_ID").val();return f}})});
\ No newline at end of file