Make WordPress Core

Changeset 7529


Ignore:
Timestamp:
03/26/2008 08:06:18 PM (18 years ago)
Author:
markjaquith
Message:

Clean up the Write Post/Write Page/Edit Comment screens for people without JS. Introduce the hide-if-no-js and hide-if-js automagical classes. fixes #6395

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/css/global.css

    r7512 r7529  
    195195    padding-right: 280px;
    196196}
    197 
    198 #timestampdiv {
    199     display: none;
    200 }
  • trunk/wp-admin/edit-form-advanced.php

    r7527 r7529  
    122122<?php if ( current_user_can( 'publish_posts' ) ) : // Contributors don't get to choose the date of publish ?>
    123123<p class="curtime"><?php printf($stamp, $date, $time); ?>
    124 &nbsp;<a href="#edit_timestamp" class="edit-timestamp" tabindex='4'><?php _e('Edit') ?></a></p>
    125 
    126 <div id='timestampdiv'><?php touch_time(($action == 'edit'),1,4); ?></div>
     124&nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a></p>
     125
     126<div id='timestampdiv' class='hide-if-js'><?php touch_time(($action == 'edit'),1,4); ?></div>
    127127<?php endif; ?>
    128128
     
    206206<?php echo $form_prevstatus ?>
    207207
    208 <div id="tagsdiv" class="postbox <?php echo postbox_classes('tagsdiv', 'post'); ?>">
     208<div id="tagsdiv" class="postbox <?php echo postbox_classes('tagsdiv', 'post'); ?> hide-if-no-js">
    209209<h3><?php _e('Tags'); ?></h3>
    210210<div class="inside">
     
    219219
    220220<div id="category-adder" class="wp-hidden-children">
    221     <h4><a id="category-add-toggle" href="#category-add" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>
     221    <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>
    222222    <p id="category-add" class="wp-hidden-child">
    223223        <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" />
  • trunk/wp-admin/edit-form-comment.php

    r7391 r7529  
    3838?>
    3939<p class="curtime"><?php printf($stamp, $date, $time); ?>
    40 &nbsp;<a href="#edit_timestamp" class="edit-timestamp"><?php _e('Edit') ?></a></p>
     40&nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js"><?php _e('Edit') ?></a></p>
    4141
    42 <div id='timestampdiv'><?php touch_time(('editcomment' == $action), 0, 5); ?></div>
     42<div id='timestampdiv' class='hide-if-js'><?php touch_time(('editcomment' == $action), 0, 5); ?></div>
    4343
    4444</div>
  • trunk/wp-admin/edit-page-form.php

    r7527 r7529  
    107107?>
    108108<p class="curtime"><?php printf($stamp, $date, $time); ?>
    109 &nbsp;<a href="#edit_timestamp" class="edit-timestamp" tabindex='4'><?php _e('Edit') ?></a></p>
    110 
    111 <div id='timestampdiv'><?php touch_time(($action == 'edit'),1,4); ?></div>
     109&nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a></p>
     110
     111<div id='timestampdiv' class='hide-if-js'><?php touch_time(($action == 'edit'),1,4); ?></div>
    112112
    113113</div>
  • trunk/wp-admin/includes/post.php

    r7458 r7529  
    590590    if ( $closed = get_usermeta( $current_user->ID, 'closedpostboxes_'.$page ) ) {
    591591        if ( !is_array( $closed ) ) return '';
    592         return in_array( $id, $closed )? 'closed' : '';
     592        return in_array( $id, $closed )? 'if-js-closed' : '';
    593593    } else {
    594594        if ( 'tagsdiv' == $id || 'categorydiv' == $id ) return '';
    595         else return 'closed';
     595        else return 'if-js-closed';
    596596    }
    597597}
  • trunk/wp-admin/js/comment.js

    r7325 r7529  
    11jQuery(document).ready( function() {
    22    add_postbox_toggles('comment');
     3
     4    // close postboxes that should be closed
     5    jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
     6
     7    // show things that should be visible, hide what should be hidden
     8    jQuery('.hide-if-no-js').show();
     9    jQuery('.hide-if-js').hide();
    310
    411    jQuery('.edit-timestamp').click(function () {
    512        if (jQuery('#timestampdiv').is(":hidden")) {
    613            jQuery('#timestampdiv').slideDown("normal");
     14            jQuery('.edit-timestamp').text(commentL10n.cancel);
    715        } else {
    816            jQuery('#timestampdiv').hide();
     17            jQuery('#mm').val(jQuery('#hidden_mm').val());
     18            jQuery('#jj').val(jQuery('#hidden_jj').val());
     19            jQuery('#aa').val(jQuery('#hidden_aa').val());
     20            jQuery('#hh').val(jQuery('#hidden_hh').val());
     21            jQuery('#mn').val(jQuery('#hidden_mn').val());
     22            jQuery('.edit-timestamp').text(commentL10n.edit);
    923        }
    1024        return false;
  • trunk/wp-admin/js/page.js

    r7394 r7529  
    22    add_postbox_toggles('page');
    33    make_slugedit_clickable();
     4
     5    // close postboxes that should be closed
     6    jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
     7
     8    // show things that should be visible, hide what should be hidden
     9    jQuery('.hide-if-no-js').show();
     10    jQuery('.hide-if-js').hide();
    411
    512    jQuery('#title').blur( function() { if ( (jQuery("#post_ID").val() > 0) || (jQuery("#title").val().length == 0) ) return; autosave(); } );
  • trunk/wp-admin/js/post.js

    r7479 r7529  
    6060
    6161jQuery(document).ready( function() {
     62    // close postboxes that should be closed
     63    jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
     64
     65    // show things that should be visible, hide what should be hidden
     66    jQuery('.hide-if-no-js').show();
     67    jQuery('.hide-if-js').hide();
     68
    6269    // postboxes
    6370    add_postbox_toggles('post');
  • trunk/wp-admin/wp-admin.css

    r7502 r7529  
    14571457    cursor: pointer;
    14581458}
     1459
     1460.hide-if-no-js {
     1461    display: none;
     1462}
  • trunk/wp-includes/general-template.php

    r7477 r7529  
    941941
    942942    if ( $media_buttons ) { ?>
    943         <div id="media-buttons">
     943        <div id="media-buttons" class="hide-if-no-js">
    944944        <?php do_action( 'media_buttons' ); ?>
    945945        </div>
  • trunk/wp-includes/script-loader.php

    r7513 r7529  
    161161            $this->add( 'link', '/wp-admin/js/link.js', array('jquery-ui-tabs', 'wp-lists', 'postbox'), '20080131' );
    162162            $this->add( 'comment', '/wp-admin/js/comment.js', array('postbox'), '20080219' );
     163            $this->localize( 'comment', 'commentL10n', array(
     164                    'cancel' => __('Cancel'),
     165                    'edit' => __('Edit'),
     166                ) );
    163167            $this->add( 'media-upload', '/wp-admin/js/media-upload.js', false, '20080109' );
    164168            $this->localize( 'upload', 'uploadL10n', array(
Note: See TracChangeset for help on using the changeset viewer.