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