Ticket #4807: word-count2.patch
| File word-count2.patch, 6.6 KB (added by , 18 years ago) |
|---|
-
wp-admin/edit-form-advanced.php
157 157 <br class="clear" /> 158 158 <?php endif; ?> 159 159 <span id="autosave"></span> 160 <span id="wp-word-count"></span> 160 161 </p> 161 162 162 163 <div class="side-info"> -
wp-admin/edit-page-form.php
140 140 <br class="clear" /> 141 141 <?php endif; ?> 142 142 <span id="autosave"></span> 143 <span id="wp-word-count"></span> 143 144 </p> 144 145 145 146 <div class="side-info"> -
wp-admin/js/word-count.js
1 // Word count 2 (function(JQ) { 3 wpWordCount = { 4 5 init : function() { 6 var t = this, last = 0, co = JQ('#content'); 7 8 JQ('#wp-word-count').html( wordCountL10n.count.replace( /%d/, '<span id="word-count">0</span>' ) ); 9 t.block = 0; 10 t.wc(co.val()); 11 co.keyup( function(e) { 12 if ( e.keyCode == last ) return true; 13 if ( 13 == e.keyCode || 8 == last ) t.wc(co.val()); 14 else if ( 32 == last ) t.fwc(); 15 last = e.keyCode; 16 return true; 17 }); 18 }, 19 20 wc : function(text) { 21 var t = this, w = JQ('#word-count'), co = JQ('#content'); 22 23 if ( t.block ) return; 24 t.block = 1; 25 26 setTimeout( function() { 27 var tx = JQ.trim(text), tc = 0; 28 29 if ( tx ) { 30 tx = tx.replace( /<.[^<>]*?>/g, ' ' ) + ' '; 31 tx = tx.replace( /[^A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\xff ]*/g, '' ); 32 tx.replace( /\S\s+/g, function(){tc++;} ); 33 } 34 w.html(tc.toString()); 35 36 setTimeout( function() { t.block = 0; }, 2000 ); 37 }, 1 ); 38 }, 39 40 fwc : function() { 41 var w = JQ('#word-count'), tc = parseInt(w.text()) + 1; 42 w.html( tc.toString() ); 43 } 44 } 45 }(jQuery)); 46 47 jQuery(document).ready( function(){ wpWordCount.init(); } ); -
wp-admin/page-new.php
9 9 wp_enqueue_script('editor'); 10 10 wp_enqueue_script('thickbox'); 11 11 wp_enqueue_script('media-upload'); 12 wp_enqueue_script('word-count'); 12 13 13 14 require_once('admin-header.php'); 14 15 ?> -
wp-admin/page.php
83 83 wp_enqueue_script('editor'); 84 84 wp_enqueue_script('thickbox'); 85 85 wp_enqueue_script('media-upload'); 86 wp_enqueue_script('word-count'); 86 87 if ( $last = wp_check_post_lock( $post->ID ) ) { 87 88 $last_user = get_userdata( $last ); 88 89 $last_user_name = $last_user ? $last_user->display_name : __('Somebody'); -
wp-admin/post-new.php
9 9 wp_enqueue_script('editor'); 10 10 wp_enqueue_script('thickbox'); 11 11 wp_enqueue_script('media-upload'); 12 wp_enqueue_script('word-count'); 12 13 13 14 require_once ('./admin-header.php'); 14 15 -
wp-admin/post.php
90 90 wp_enqueue_script('editor'); 91 91 wp_enqueue_script('thickbox'); 92 92 wp_enqueue_script('media-upload'); 93 wp_enqueue_script('word-count'); 93 94 if ( $last = wp_check_post_lock( $post->ID ) ) { 94 95 $last_user = get_userdata( $last ); 95 96 $last_user_name = $last_user ? $last_user->display_name : __('Somebody'); -
wp-admin/wp-admin.css
1503 1503 table.diff .diff-deletedline del, table.diff .diff-addedline ins { 1504 1504 text-decoration: none; 1505 1505 } 1506 1507 #wp-word-count { 1508 display: block; 1509 } -
wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
132 132 } 133 133 }); 134 134 135 // Word count if script is loaded 136 if ( 'undefined' != typeof wpWordCount ) { 137 var last = 0; 138 ed.onKeyUp.add(function(ed, e) { 139 if ( e.keyCode == last ) return; 140 if ( 13 == e.keyCode || 8 == last ) wpWordCount.wc( ed.getContent({format : 'raw'}) ); 141 else if ( 32 == last ) wpWordCount.fwc(); 142 last = e.keyCode; 143 }); 144 }; 145 135 146 // Add listeners to handle more break 136 147 t._handleMoreBreak(ed, url); 137 148 -
wp-includes/js/tinymce/tiny_mce_config.php
223 223 // Setup cache info 224 224 if ( $disk_cache ) { 225 225 226 $cacheKey = apply_filters('tiny_mce_version', '200804 14');226 $cacheKey = apply_filters('tiny_mce_version', '20080421'); 227 227 228 228 foreach ( $initArray as $v ) 229 229 $cacheKey .= $v; -
wp-includes/script-loader.php
36 36 $this->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080325' ); 37 37 38 38 // Modify this version when tinyMCE plugins are changed. 39 $mce_version = apply_filters('tiny_mce_version', '200804 14');39 $mce_version = apply_filters('tiny_mce_version', '20080421'); 40 40 $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('editor_functions'), $mce_version ); 41 41 42 42 $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6'); … … 193 193 'edit' => __('Edit'), 194 194 'cancel' => __('Cancel'), 195 195 )); 196 $this->add( 'editor', '/wp-admin/js/editor.js', array('tiny_mce'), '20080221' ); 196 197 $this->add( 'word-count', '/wp-admin/js/word-count.js', array( 'jquery' ), '20080416' ); 198 $this->localize( 'word-count', 'wordCountL10n', array( 199 'count' => __('Word count: %d') 200 )); 197 201 } 198 202 } 199 203