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
git-svn-id: http://svn.automattic.com/wordpress/trunk@7529 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
07697db8d1
commit
e6f396880b
|
@ -194,7 +194,3 @@ th.check-column + th, th.check-column + td {
|
|||
padding-bottom: 7px;
|
||||
padding-right: 280px;
|
||||
}
|
||||
|
||||
#timestampdiv {
|
||||
display: none;
|
||||
}
|
||||
|
|
|
@ -121,9 +121,9 @@ if ($post_ID) {
|
|||
?>
|
||||
<?php if ( current_user_can( 'publish_posts' ) ) : // Contributors don't get to choose the date of publish ?>
|
||||
<p class="curtime"><?php printf($stamp, $date, $time); ?>
|
||||
<a href="#edit_timestamp" class="edit-timestamp" tabindex='4'><?php _e('Edit') ?></a></p>
|
||||
<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a></p>
|
||||
|
||||
<div id='timestampdiv'><?php touch_time(($action == 'edit'),1,4); ?></div>
|
||||
<div id='timestampdiv' class='hide-if-js'><?php touch_time(($action == 'edit'),1,4); ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
@ -205,7 +205,7 @@ endif; ?>
|
|||
<?php echo $form_pingback ?>
|
||||
<?php echo $form_prevstatus ?>
|
||||
|
||||
<div id="tagsdiv" class="postbox <?php echo postbox_classes('tagsdiv', 'post'); ?>">
|
||||
<div id="tagsdiv" class="postbox <?php echo postbox_classes('tagsdiv', 'post'); ?> hide-if-no-js">
|
||||
<h3><?php _e('Tags'); ?></h3>
|
||||
<div class="inside">
|
||||
<p id="jaxtag"><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post_ID ); ?>" /></p>
|
||||
|
@ -218,7 +218,7 @@ endif; ?>
|
|||
<div class="inside">
|
||||
|
||||
<div id="category-adder" class="wp-hidden-children">
|
||||
<h4><a id="category-add-toggle" href="#category-add" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>
|
||||
<h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>
|
||||
<p id="category-add" class="wp-hidden-child">
|
||||
<input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" />
|
||||
<?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>
|
||||
|
|
|
@ -37,9 +37,9 @@ $date = mysql2date(get_option('date_format'), $comment->comment_date);
|
|||
$time = mysql2date(get_option('time_format'), $comment->comment_date);
|
||||
?>
|
||||
<p class="curtime"><?php printf($stamp, $date, $time); ?>
|
||||
<a href="#edit_timestamp" class="edit-timestamp"><?php _e('Edit') ?></a></p>
|
||||
<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js"><?php _e('Edit') ?></a></p>
|
||||
|
||||
<div id='timestampdiv'><?php touch_time(('editcomment' == $action), 0, 5); ?></div>
|
||||
<div id='timestampdiv' class='hide-if-js'><?php touch_time(('editcomment' == $action), 0, 5); ?></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -106,9 +106,9 @@ if ($post_ID) {
|
|||
}
|
||||
?>
|
||||
<p class="curtime"><?php printf($stamp, $date, $time); ?>
|
||||
<a href="#edit_timestamp" class="edit-timestamp" tabindex='4'><?php _e('Edit') ?></a></p>
|
||||
<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a></p>
|
||||
|
||||
<div id='timestampdiv'><?php touch_time(($action == 'edit'),1,4); ?></div>
|
||||
<div id='timestampdiv' class='hide-if-js'><?php touch_time(($action == 'edit'),1,4); ?></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -589,10 +589,10 @@ function postbox_classes( $id, $page ) {
|
|||
$current_user = wp_get_current_user();
|
||||
if ( $closed = get_usermeta( $current_user->ID, 'closedpostboxes_'.$page ) ) {
|
||||
if ( !is_array( $closed ) ) return '';
|
||||
return in_array( $id, $closed )? 'closed' : '';
|
||||
return in_array( $id, $closed )? 'if-js-closed' : '';
|
||||
} else {
|
||||
if ( 'tagsdiv' == $id || 'categorydiv' == $id ) return '';
|
||||
else return 'closed';
|
||||
else return 'if-js-closed';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,25 @@
|
|||
jQuery(document).ready( function() {
|
||||
add_postbox_toggles('comment');
|
||||
|
||||
// close postboxes that should be closed
|
||||
jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
|
||||
|
||||
// show things that should be visible, hide what should be hidden
|
||||
jQuery('.hide-if-no-js').show();
|
||||
jQuery('.hide-if-js').hide();
|
||||
|
||||
jQuery('.edit-timestamp').click(function () {
|
||||
if (jQuery('#timestampdiv').is(":hidden")) {
|
||||
jQuery('#timestampdiv').slideDown("normal");
|
||||
jQuery('.edit-timestamp').text(commentL10n.cancel);
|
||||
} else {
|
||||
jQuery('#timestampdiv').hide();
|
||||
jQuery('#mm').val(jQuery('#hidden_mm').val());
|
||||
jQuery('#jj').val(jQuery('#hidden_jj').val());
|
||||
jQuery('#aa').val(jQuery('#hidden_aa').val());
|
||||
jQuery('#hh').val(jQuery('#hidden_hh').val());
|
||||
jQuery('#mn').val(jQuery('#hidden_mn').val());
|
||||
jQuery('.edit-timestamp').text(commentL10n.edit);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
|
|
@ -2,6 +2,13 @@ jQuery(document).ready( function() {
|
|||
add_postbox_toggles('page');
|
||||
make_slugedit_clickable();
|
||||
|
||||
// close postboxes that should be closed
|
||||
jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
|
||||
|
||||
// show things that should be visible, hide what should be hidden
|
||||
jQuery('.hide-if-no-js').show();
|
||||
jQuery('.hide-if-js').hide();
|
||||
|
||||
jQuery('#title').blur( function() { if ( (jQuery("#post_ID").val() > 0) || (jQuery("#title").val().length == 0) ) return; autosave(); } );
|
||||
|
||||
// hide advanced slug field
|
||||
|
|
|
@ -59,6 +59,13 @@ function tag_press_key( e ) {
|
|||
}
|
||||
|
||||
jQuery(document).ready( function() {
|
||||
// close postboxes that should be closed
|
||||
jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
|
||||
|
||||
// show things that should be visible, hide what should be hidden
|
||||
jQuery('.hide-if-no-js').show();
|
||||
jQuery('.hide-if-js').hide();
|
||||
|
||||
// postboxes
|
||||
add_postbox_toggles('post');
|
||||
|
||||
|
|
|
@ -1455,4 +1455,8 @@ td.action-links, th.action-links {
|
|||
|
||||
#poststuff h3, #poststuff .closed h3 {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.hide-if-no-js {
|
||||
display: none;
|
||||
}
|
|
@ -940,7 +940,7 @@ function the_editor($content, $id = 'content', $prev_id = 'title', $media_button
|
|||
}
|
||||
|
||||
if ( $media_buttons ) { ?>
|
||||
<div id="media-buttons">
|
||||
<div id="media-buttons" class="hide-if-no-js">
|
||||
<?php do_action( 'media_buttons' ); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
|
|
@ -160,6 +160,10 @@ class WP_Scripts {
|
|||
) );
|
||||
$this->add( 'link', '/wp-admin/js/link.js', array('jquery-ui-tabs', 'wp-lists', 'postbox'), '20080131' );
|
||||
$this->add( 'comment', '/wp-admin/js/comment.js', array('postbox'), '20080219' );
|
||||
$this->localize( 'comment', 'commentL10n', array(
|
||||
'cancel' => __('Cancel'),
|
||||
'edit' => __('Edit'),
|
||||
) );
|
||||
$this->add( 'media-upload', '/wp-admin/js/media-upload.js', false, '20080109' );
|
||||
$this->localize( 'upload', 'uploadL10n', array(
|
||||
'browseTitle' => attribute_escape(__('Browse your files')),
|
||||
|
|
Loading…
Reference in New Issue