Ticket #4807: word-count3.2.patch
| File word-count3.2.patch, 6.3 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 || 46 == last ) t.wc(co.val()); 14 last = e.keyCode; 15 return true; 16 }); 17 }, 18 19 wc : function(tx) { 20 var t = this, w = JQ('#word-count'), tc = 0; 21 22 if ( t.block ) return; 23 t.block = 1; 24 tx = tx.replace( /^\s*|\s*$/g, '' ); 25 setTimeout( function() { 26 if ( tx ) { 27 tx = tx.replace( /<.[^<>]*?>/g, ' ' ).replace( / /gi, ' ' ); 28 tx = tx.replace( /[0-9.(),;:!?%#$¿'"_+=\\/-]*/g, '' ); 29 tx.replace( /\S\s+/g, function(){tc++;} ); 30 } 31 w.html(tc.toString()); 32 33 setTimeout( function() { t.block = 0; }, 2000 ); 34 }, 1 ); 35 } 36 } 37 }(jQuery)); 38 39 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 87 88 if ( current_user_can('edit_page', $page_ID) ) { 88 89 if ( $last = wp_check_post_lock( $post->ID ) ) { -
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 94 95 if ( current_user_can('edit_post', $post_ID) ) { 95 96 if ( $last = wp_check_post_lock( $post->ID ) ) { -
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 // Add listeners to handle more break 135 // Word count if script is loaded 136 if ( 'undefined' != 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 || 46 == last ) wpWordCount.wc( ed.getContent({format : 'raw'}) ); 141 last = e.keyCode; 142 }); 143 }; 144 145 // Add listeners to handle more break 136 146 t._handleMoreBreak(ed, url); 137 147 138 148 // Add custom shortcuts -
wp-includes/js/tinymce/tiny_mce_config.php
226 226 // Setup cache info 227 227 if ( $disk_cache ) { 228 228 229 $cacheKey = apply_filters('tiny_mce_version', '200804 14');229 $cacheKey = apply_filters('tiny_mce_version', '20080423'); 230 230 231 231 foreach ( $initArray as $v ) 232 232 $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', '20080423'); 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' ), '20080423' ); 198 $this->localize( 'word-count', 'wordCountL10n', array( 199 'count' => __('Word count: %d') 200 )); 197 201 } 198 202 } 199 203