Ticket #8759: 8759.diff
File 8759.diff, 2.0 KB (added by , 13 years ago) |
---|
-
wp-includes/script-loader.php
276 276 $scripts->add( 'wpdialogs-popup', "/wp-includes/js/tinymce/plugins/wpdialogs/js/popup$suffix.js", array( 'wpdialogs' ), false, 1 ); 277 277 278 278 $scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array( 'jquery' ), false, 1 ); 279 $scripts->localize( 'word-count', 'wordCountL10n', array( 280 /* translators: If your word count is based on single characters (East Asian characters), 281 enter 'characters'. Otherwise, enter 'words'. Do not translate into your own language. */ 282 'type' => 'characters' == _x( 'words', 'word count: words or characters?' ) ? 'c' : 'w', 283 ) ); 279 284 280 285 $scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox' ), false, 1 ); 281 286 -
wp-admin/js/word-count.dev.js
1 2 (function($) { 1 (function($,undefined) { 3 2 wpWordCount = { 4 3 5 4 settings : { 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 15 16 if ( type === undefined ) 17 type = wordCountL10n.type; 18 if ( type !== 'w' && type !== 'c' ) 19 type = 'w'; 20 16 21 if ( t.block ) 17 22 return; 18 23 … … 22 27 if ( tx ) { 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()); 28 33