Add 'enter title here' text to title box. see #12591

git-svn-id: http://svn.automattic.com/wordpress/trunk@13964 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin
2010-04-03 10:23:17 +00:00
parent 2c4c31118e
commit d05e120d44
6 changed files with 26 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1765,6 +1765,7 @@ div.inside {
}
#titlediv {
position: relative;
margin-bottom: 20px;
}
#titlediv label { cursor: text; }
@@ -1792,6 +1793,13 @@ div.inside {
outline: none;
}
#titlediv #title-prompt-text {
color: #bbb;
position: absolute;
font-size: 1.7em;
padding: 8px;
}
#poststuff .inside-submitbox,
#side-sortables .inside-submitbox {
margin: 0 3px;

View File

@@ -192,7 +192,7 @@ $side_meta_boxes = do_meta_boxes($post_type, 'side', $post);
<?php if ( post_type_supports($post_type, 'title') ) { ?>
<div id="titlediv">
<div id="titlewrap">
<label class="screen-reader-text" for="title"><?php _e('Title') ?></label>
<label class="hide-if-no-js" id="title-prompt-text" for="title"><?php _e('Enter title here') ?></label>
<input type="text" name="post_title" size="30" tabindex="1" value="<?php echo esc_attr( htmlspecialchars( $post->post_title ) ); ?>" id="title" autocomplete="off" />
</div>
<div class="inside">

View File

@@ -599,4 +599,17 @@ jQuery(document).ready( function($) {
}
makeSlugeditClickable();
}
$('#title-prompt-text').click(function(){
$(this).css('visibility', 'hidden').siblings('#title').focus();
});
$('#title').blur(function(){
if (this.value == '')
$(this).siblings('#title-prompt-text').css('visibility', '');
}).focus(function(){
$(this).siblings('#title-prompt-text').css('visibility', 'hidden');
}).keydown(function(e){
$(this).siblings('#title-prompt-text').css('visibility', 'hidden');
$(this).unbind(e);
});
});

File diff suppressed because one or more lines are too long