View source for MediaWiki:Gadget-WordCount.js
You do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page.
//<nowiki>
// This code is based on https://en.wikipedia.org/wiki/User:Dr_pda/prosesize.js
// but adds CJK support (http://stackoverflow.com/questions/2315488) and support
// for references and other lists.
//
function getWordCount(html) {
var str = html.innerHTML.replace(/(<([^>]+)>)/ig,"").trim();
var wordCount = 0;
var arr = str.match(/[\u3040-\u309F]|[\u30A0-\u30FF]|[\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF]|\S+/g);
if (arr) {
wordCount = arr.length;
}
return wordCount;
}
function getContentDiv() {
000
1:0
Return to MediaWiki:Gadget-WordCount.js.