CoreFiles by mySites.guru
word-count.dev.js39 lines, 967 bytes, from wordpress-3.2-beta1.zip
Raw History Compare with 3.1-beta2
md5
cf750b08b754798a54d82a15c4e4b818
sha1
bf78b1bc5fe5eb9f988dbb67c923ea77b9de3c73
sha256
fa9c1892433b5f0073561db98d9c98e8856844890fb1a47bb456fe4bfdfadaa5
// Word count
(function($) {
	wpWordCount = {

		init : function() {
			var t = this, last = 0, co = $('#content');

			$('#wp-word-count').html( wordCountL10n.count.replace( /%d/, '<span class="word-count">0</span>' ) );
			t.block = 0;
			t.wc(co.val());
			co.keyup( function(e) {
				if ( e.keyCode == last ) return true;
				if ( 13 == e.keyCode || 8 == last || 46 == last ) t.wc(co.val());
				last = e.keyCode;
				return true;
			});
		},

		wc : function(tx) {
			var t = this, w = $('.word-count'), tc = 0;

			if ( t.block ) return;
			t.block = 1;

			setTimeout( function() {
				if ( tx ) {
					tx = tx.replace( /<.[^<>]*?>/g, ' ' ).replace( /&nbsp;|&#160;/gi, ' ' );
					tx = tx.replace( /[0-9.(),;:!?%#$¿'"_+=\\/-]*/g, '' );
					tx.replace( /\S\s+/g, function(){tc++;} );
				}
				w.html(tc.toString());

				setTimeout( function() { t.block = 0; }, 2000 );
			}, 1 );
		}
	}

	$(document).ready( function(){ wpWordCount.init(); } );
}(jQuery));

No other release has this exact content. See every version of this file.