View source for MediaWiki:Gadget-WordCount.js

You do not have permission to edit this page, for the following reasons:

  • The action you have requested is limited to users in the group: Users.
  • This page provides interface text for the software on this wiki, and is protected to prevent abuse. To add or change translations for all wikis, please use translatewiki.net, the MediaWiki localisation project.
  • You do not have permission to edit this JavaScript page because it may affect all visitors.

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() {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
000
1:0

Return to MediaWiki:Gadget-WordCount.js.