1 (function($,undefined) {
5 strip : /<[a-zA-Z\/][^<>]*>/g, // strip HTML tags
6 clean : /[0-9.(),;:!?%#$¿'"_+=\\/-]+/g, // regexp to remove punctuation, etc.
7 w : /\S\s+/g, // word-counting regexp
8 c : /\S/g // char-counting regexp for asian languages
13 wc : function(tx, type) {
14 var t = this, w = $('.word-count'), tc = 0;
16 if ( type === undefined )
17 type = wordCountL10n.type;
18 if ( type !== 'w' && type !== 'c' )
26 setTimeout( function() {
28 tx = tx.replace( t.settings.strip, ' ' ).replace( / | /gi, ' ' );
29 tx = tx.replace( t.settings.clean, '' );
30 tx.replace( t.settings[type], function(){tc++;} );
32 w.html(tc.toString());
34 setTimeout( function() { t.block = 0; }, 2000 );
39 $(document).bind( 'wpcountwords', function(e, txt) {