-
+ A83BE8C8D6717497D784DEDA4A4E3934B1C0189DEB86B593788C3B98CB4AFBFAA9EAE77F8F48BF5B2ECD01FC6DB9FA5473BAF5C978F4448766E070F16ECAE201
mp-wp/wp-admin/js/page.js
(0 . 0)(1 . 202)
50543 jQuery(document).ready( function($) {
50544 postboxes.add_postbox_toggles('page');
50545 make_slugedit_clickable();
50546
50547 // close postboxes that should be closed
50548 jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
50549
50550 jQuery('#title').blur( function() { if ( (jQuery("#post_ID").val() > 0) || (jQuery("#title").val().length == 0) ) return; autosave(); } );
50551
50552 var stamp = $('#timestamp').html();
50553
50554 var visibility = $('#post-visibility-display').html();
50555
50556 function updateVisibility() {
50557 if ( $('#post-visibility-select input:radio:checked').val() != 'public' ) {
50558 $('#sticky').attr('checked', false);
50559 $('#sticky-span').hide();
50560 } else {
50561 $('#sticky-span').show();
50562 }
50563 if ( $('#post-visibility-select input:radio:checked').val() != 'password' ) {
50564 $('#password-span').hide();
50565 } else {
50566 $('#password-span').show();
50567 }
50568 }
50569
50570 function updateText() {
50571 var attemptedDate = new Date( $('#aa').val(), $('#mm').val() -1, $('#jj').val(), $('#hh').val(), $('#mn').val());
50572 var originalDate = new Date( $('#hidden_aa').val(), $('#hidden_mm').val() -1, $('#hidden_jj').val(), $('#hidden_hh').val(), $('#hidden_mn').val());
50573 var currentDate = new Date( $('#cur_aa').val(), $('#cur_mm').val() -1, $('#cur_jj').val(), $('#cur_hh').val(), $('#cur_mn').val());
50574 if ( attemptedDate > currentDate && $('#original_post_status').val() != 'future' ) {
50575 var publishOn = postL10n.publishOnFuture;
50576 $('#publish').val( postL10n.schedule );
50577 } else if ( attemptedDate <= currentDate && $('#original_post_status').val() != 'publish' ) {
50578 var publishOn = postL10n.publishOn;
50579 $('#publish').val( postL10n.publish );
50580 } else {
50581 var publishOn = postL10n.publishOnPast;
50582 $('#publish').val( postL10n.update );
50583 }
50584 if ( originalDate.toUTCString() == attemptedDate.toUTCString() ) { //hack
50585 $('#timestamp').html(stamp);
50586 } else {
50587 $('#timestamp').html(
50588 publishOn + ' <b>' +
50589 $( '#mm option[value=' + $('#mm').val() + ']' ).text() + ' ' +
50590 $('#jj').val() + ', ' +
50591 $('#aa').val() + ' @ ' +
50592 $('#hh').val() + ':' +
50593 $('#mn').val() + '</b> '
50594 );
50595 }
50596
50597 if ( $('#post-visibility-select input:radio:checked').val() == 'private' ) {
50598 $('#publish').val( postL10n.update );
50599 if ( $('#post_status option[value=publish]').length == 0 ) {
50600 $('#post_status').append('<option value="publish">' + postL10n.privatelyPublished + '</option>');
50601 }
50602 $('#post_status option[value=publish]').html( postL10n.privatelyPublished );
50603 $('#post_status option[value=publish]').attr('selected', true);
50604 $('.edit-post-status').hide();
50605 } else {
50606 if ( $('#original_post_status').val() == 'future' || $('#original_post_status').val() == 'draft' ) {
50607 if ( $('#post_status option[value=publish]').length != 0 ) {
50608 $('#post_status option[value=publish]').remove();
50609 $('#post_status').val($('#hidden_post_status').val());
50610 }
50611 } else {
50612 $('#post_status option[value=publish]').html( postL10n.published );
50613 }
50614 $('.edit-post-status').show();
50615 }
50616 $('#post-status-display').html($('#post_status :selected').text());
50617 if ( $('#post_status :selected').val() == 'private' || $('#post_status :selected').val() == 'publish' ) {
50618 $('#save-post').hide();
50619 } else {
50620 $('#save-post').show();
50621 if ( $('#post_status :selected').val() == 'pending' ) {
50622 $('#save-post').show().val( postL10n.savePending );
50623 } else {
50624 $('#save-post').show().val( postL10n.saveDraft );
50625 }
50626 }
50627 }
50628
50629 $('.edit-visibility').click(function () {
50630 if ($('#post-visibility-select').is(":hidden")) {
50631 updateVisibility();
50632 $('#post-visibility-select').slideDown("normal");
50633 $('.edit-visibility').hide();
50634 }
50635 return false;
50636 });
50637
50638 $('.cancel-post-visibility').click(function () {
50639 $('#post-visibility-select').slideUp("normal");
50640 $('#visibility-radio-' + $('#hidden-post-visibility').val()).attr('checked', true);
50641 $('#post_password').val($('#hidden_post_password').val());
50642 $('#post-visibility-display').html(visibility);
50643 $('.edit-visibility').show();
50644 updateText();
50645 return false;
50646 });
50647
50648 $('.save-post-visibility').click(function () { // crazyhorse - multiple ok cancels
50649 $('#post-visibility-select').slideUp("normal");
50650 $('.edit-visibility').show();
50651 updateText();
50652
50653 $('#post-visibility-display').html(
50654 postL10n[$('#post-visibility-select input:radio:checked').val()]
50655 );
50656
50657 return false;
50658 });
50659
50660 $('#post-visibility-select input:radio').change(function() {
50661 updateVisibility();
50662 });
50663
50664 $('.edit-timestamp').click(function () {
50665 if ($('#timestampdiv').is(":hidden")) {
50666 $('#timestampdiv').slideDown("normal");
50667 $('.edit-timestamp').hide();
50668 }
50669
50670 return false;
50671 });
50672
50673 $('.cancel-timestamp').click(function() {
50674 $('#timestampdiv').slideUp("normal");
50675 $('#mm').val($('#hidden_mm').val());
50676 $('#jj').val($('#hidden_jj').val());
50677 $('#aa').val($('#hidden_aa').val());
50678 $('#hh').val($('#hidden_hh').val());
50679 $('#mn').val($('#hidden_mn').val());
50680 $('.edit-timestamp').show();
50681
50682 updateText();
50683 return false;
50684 });
50685
50686 $('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels
50687 $('#timestampdiv').slideUp("normal");
50688 $('.edit-timestamp').show();
50689 updateText();
50690
50691 return false;
50692 });
50693
50694 $('.edit-post-status').click(function() {
50695 if ($('#post-status-select').is(":hidden")) {
50696 $('#post-status-select').slideDown("normal");
50697 $(this).hide();
50698 }
50699
50700 return false;
50701 });
50702
50703 $('.save-post-status').click(function() {
50704 $('#post-status-select').slideUp("normal");
50705 $('.edit-post-status').show();
50706 updateText();
50707 return false;
50708 });
50709
50710 $('.cancel-post-status').click(function() {
50711 $('#post-status-select').slideUp("normal");
50712 $('#post_status').val($('#hidden_post_status').val());
50713 $('.edit-post-status').show();
50714
50715 updateText();
50716 return false;
50717 });
50718
50719 // Custom Fields
50720 jQuery('#the-list').wpList( { addAfter: function( xml, s ) {
50721 $('table#list-table').show();
50722 if ( jQuery.isFunction( autosave_update_post_ID ) ) {
50723 autosave_update_post_ID(s.parsed.responses[0].supplemental.postid);
50724 }
50725 }, addBefore: function( s ) {
50726 s.data += '&post_id=' + jQuery('#post_ID').val();
50727 return s;
50728 }
50729 });
50730
50731 // preview
50732 $('#post-preview').click(function(e){
50733 if ( 1 > $('#post_ID').val() && autosaveFirst ) {
50734 autosaveDelayPreview = true;
50735 autosave();
50736 return false;
50737 }
50738
50739 $('input#wp-preview').val('dopreview');
50740 $('form#post').attr('target', 'wp-preview').submit().attr('target', '');
50741 $('input#wp-preview').val('');
50742 return false;
50743 });
50744 });