- if ( $('#title').val() == '' )
- $('#title').siblings('#title-prompt-text').css('visibility', '');
- $('#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);
- });
+ // word count
+ if ( typeof(wpWordCount) != 'undefined' ) {
+ $(document).triggerHandler('wpcountwords', [ co.val() ]);
+
+ co.keyup( function(e) {
+ var k = e.keyCode || e.charCode;
+
+ if ( k == last )
+ return true;
+
+ if ( 13 == k || 8 == last || 46 == last )
+ $(document).triggerHandler('wpcountwords', [ co.val() ]);
+
+ last = k;
+ return true;
+ });
+ }
+
+ wptitlehint = function(id) {
+ id = id || 'title';
+
+ var title = $('#' + id), titleprompt = $('#' + id + '-prompt-text');
+
+ if ( title.val() == '' )
+ titleprompt.css('visibility', '');
+
+ titleprompt.click(function(){
+ $(this).css('visibility', 'hidden');
+ title.focus();
+ });
+
+ title.blur(function(){
+ if ( this.value == '' )
+ titleprompt.css('visibility', '');
+ }).focus(function(){
+ titleprompt.css('visibility', 'hidden');
+ }).keydown(function(e){
+ titleprompt.css('visibility', 'hidden');
+ $(this).unbind(e);
+ });
+ }
+
+ wptitlehint();