tinymce.create("tinymce.plugins.WordCount",{block:0,id:null,countre:null,cleanre:null,init:function(t,e){var n=this,o=0,r=tinymce.VK;function i(t){return t===r.DELETE||t===r.BACKSPACE}n.countre=t.getParam("wordcount_countregex",/[\w\u2019\u00co-\u00ff^\uc397^u00f7\'-]+/g),n.cleanre=t.getParam("wordcount_cleanregex",/[0-9.(),;:!?%#$?\'\"_+=\\\/-]*/g),n.update_rate=t.getParam("wordcount_update_rate",2e3),n.update_on_delete=t.getParam("wordcount_update_on_delete",!1),n.id=t.id+"-word-count",t.onPostRender.add((function(t,e){var o,r;(r=t.getParam("wordcount_target_id"))?tinymce.DOM.add(r,"span",{},'<span id="'+n.id+'">0</span>'):(o=tinymce.DOM.get(t.id+"_path_row"))&&tinymce.DOM.add(o.parentNode,"div",{style:"float: right"},t.getLang("wordcount.words","Words: ")+'<span id="'+n.id+'">0</span>')})),t.onInit.add((function(t){t.selection.onSetContent.add((function(){n._count(t)})),n._count(t)})),t.onSetContent.add((function(t){n._count(t)})),t.onKeyUp.add((function(t,e){var c;((c=e.keyCode)!==o&&(c===r.ENTER||o===r.SPACEBAR||i(o))||n.update_on_delete&&i(e.keyCode))&&n._count(t),o=e.keyCode}))},_getCount:function(t){var e=0,n=t.getContent({format:"raw"});if(n){var o=(n=(n=(n=(n=n.replace(/\.\.\./g," ")).replace(/<.[^<>]*?>/g," ").replace(/&nbsp;|&#160;/gi," ")).replace(/(\w+)(&.+?;)+(\w+)/,"$1$3").replace(/&.+?;/g," ")).replace(this.cleanre,"")).match(this.countre);o&&(e=o.length)}return e},_count:function(t){var e=this;e.block||(e.block=1,setTimeout((function(){if(!t.destroyed){var n=e._getCount(t);tinymce.DOM.setHTML(e.id,n.toString()),setTimeout((function(){e.block=0}),e.update_rate)}}),1))},getInfo:function(){return{longname:"Word Count plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/wordcount",version:tinymce.majorVersion+"."+tinymce.minorVersion}}}),tinymce.PluginManager.add("wordcount",tinymce.plugins.WordCount);
