Changeset 19966
- Timestamp:
- 02/21/2012 03:35:05 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/js/word-count.dev.js
r17936 r19966 1 2 (function($) { 1 (function($,undefined) { 3 2 wpWordCount = { 4 3 … … 6 5 strip : /<[a-zA-Z\/][^<>]*>/g, // strip HTML tags 7 6 clean : /[0-9.(),;:!?%#$¿'"_+=\\/-]+/g, // regexp to remove punctuation, etc. 8 count : /\S\s+/g // counting regexp 7 w : /\S\s+/g, // word-counting regexp 8 c : /\S/g // char-counting regexp for asian languages 9 9 }, 10 10 11 11 block : 0, 12 12 13 wc : function(tx ) {13 wc : function(tx, type) { 14 14 var t = this, w = $('.word-count'), tc = 0; 15 16 if ( type === undefined ) 17 type = wordCountL10n.type; 18 if ( type !== 'w' && type !== 'c' ) 19 type = 'w'; 15 20 16 21 if ( t.block ) … … 23 28 tx = tx.replace( t.settings.strip, ' ' ).replace( / | /gi, ' ' ); 24 29 tx = tx.replace( t.settings.clean, '' ); 25 tx.replace( t.settings .count, function(){tc++;} );30 tx.replace( t.settings[type], function(){tc++;} ); 26 31 } 27 32 w.html(tc.toString()); -
trunk/wp-includes/script-loader.php
r19897 r19966 279 279 280 280 $scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array( 'jquery' ), false, 1 ); 281 $scripts->localize( 'word-count', 'wordCountL10n', array( 282 /* translators: If your word count is based on single characters (East Asian characters), 283 enter 'characters'. Otherwise, enter 'words'. Do not translate into your own language. */ 284 'type' => 'characters' == _x( 'words', 'word count: words or characters?' ) ? 'c' : 'w', 285 ) ); 281 286 282 287 $scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox' ), false, 1 );
Note: See TracChangeset
for help on using the changeset viewer.