summaryrefslogtreecommitdiff
path: root/public/javascripts/tiny_mce/plugins/wordcount
diff options
context:
space:
mode:
Diffstat (limited to 'public/javascripts/tiny_mce/plugins/wordcount')
-rw-r--r--public/javascripts/tiny_mce/plugins/wordcount/editor_plugin.js1
-rw-r--r--public/javascripts/tiny_mce/plugins/wordcount/editor_plugin_src.js95
2 files changed, 0 insertions, 96 deletions
diff --git a/public/javascripts/tiny_mce/plugins/wordcount/editor_plugin.js b/public/javascripts/tiny_mce/plugins/wordcount/editor_plugin.js
deleted file mode 100644
index f192835..0000000
--- a/public/javascripts/tiny_mce/plugins/wordcount/editor_plugin.js
+++ /dev/null
@@ -1 +0,0 @@
1(function(){tinymce.create("tinymce.plugins.WordCount",{block:0,id:null,countre:null,cleanre:null,init:function(a,b){var c=this,d=0;c.countre=a.getParam("wordcount_countregex",/\S\s+/g);c.cleanre=a.getParam("wordcount_cleanregex",/[0-9.(),;:!?%#$¿'"_+=\\/-]*/g);c.id=a.id+"-word-count";a.onPostRender.add(function(f,e){var g,h;h=f.getParam("wordcount_target_id");if(!h){g=tinymce.DOM.get(f.id+"_path_row");if(g){tinymce.DOM.add(g.parentNode,"div",{style:"float: right"},f.getLang("wordcount.words","Words: ")+'<span id="'+c.id+'">0</span>')}}else{tinymce.DOM.add(h,"span",{},'<span id="'+c.id+'">0</span>')}});a.onInit.add(function(e){e.selection.onSetContent.add(function(){c._count(e)});c._count(e)});a.onSetContent.add(function(e){c._count(e)});a.onKeyUp.add(function(f,g){if(g.keyCode==d){return}if(13==g.keyCode||8==d||46==d){c._count(f)}d=g.keyCode})},_count:function(b){var c=this,a=0;if(c.block){return}c.block=1;setTimeout(function(){var d=b.getContent({format:"raw"});if(d){d=d.replace(/<.[^<>]*?>/g," ").replace(/&nbsp;|&#160;/gi," ");d=d.replace(c.cleanre,"");d.replace(c.countre,function(){a++})}tinymce.DOM.setHTML(c.id,a.toString());setTimeout(function(){c.block=0},2000)},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)})(); \ No newline at end of file
diff --git a/public/javascripts/tiny_mce/plugins/wordcount/editor_plugin_src.js b/public/javascripts/tiny_mce/plugins/wordcount/editor_plugin_src.js
deleted file mode 100644
index 41b78a9..0000000
--- a/public/javascripts/tiny_mce/plugins/wordcount/editor_plugin_src.js
+++ /dev/null
@@ -1,95 +0,0 @@
1/**
2 * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
3 *
4 * @author Moxiecode
5 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
6 */
7
8(function() {
9 tinymce.create('tinymce.plugins.WordCount', {
10 block : 0,
11 id : null,
12 countre : null,
13 cleanre : null,
14
15 init : function(ed, url) {
16 var t = this, last = 0;
17
18 t.countre = ed.getParam('wordcount_countregex', /\S\s+/g);
19 t.cleanre = ed.getParam('wordcount_cleanregex', /[0-9.(),;:!?%#$¿'"_+=\\/-]*/g);
20 t.id = ed.id + '-word-count';
21
22 ed.onPostRender.add(function(ed, cm) {
23 var row, id;
24
25 // Add it to the specified id or the theme advanced path
26 id = ed.getParam('wordcount_target_id');
27 if (!id) {
28 row = tinymce.DOM.get(ed.id + '_path_row');
29
30 if (row)
31 tinymce.DOM.add(row.parentNode, 'div', {'style': 'float: right'}, ed.getLang('wordcount.words', 'Words: ') + '<span id="' + t.id + '">0</span>');
32 } else
33 tinymce.DOM.add(id, 'span', {}, '<span id="' + t.id + '">0</span>');
34 });
35
36 ed.onInit.add(function(ed) {
37 ed.selection.onSetContent.add(function() {
38 t._count(ed);
39 });
40
41 t._count(ed);
42 });
43
44 ed.onSetContent.add(function(ed) {
45 t._count(ed);
46 });
47
48 ed.onKeyUp.add(function(ed, e) {
49 if (e.keyCode == last)
50 return;
51
52 if (13 == e.keyCode || 8 == last || 46 == last)
53 t._count(ed);
54
55 last = e.keyCode;
56 });
57 },
58
59 _count : function(ed) {
60 var t = this, tc = 0;
61
62 // Keep multiple calls from happening at the same time
63 if (t.block)
64 return;
65
66 t.block = 1;
67
68 setTimeout(function() {
69 var tx = ed.getContent({format : 'raw'});
70
71 if (tx) {
72 tx = tx.replace(/<.[^<>]*?>/g, ' ').replace(/&nbsp;|&#160;/gi, ' '); // remove html tags and space chars
73 tx = tx.replace(t.cleanre, ''); // remove numbers and punctuation
74 tx.replace(t.countre, function() {tc++;}); // count the words
75 }
76
77 tinymce.DOM.setHTML(t.id, tc.toString());
78
79 setTimeout(function() {t.block = 0;}, 2000);
80 }, 1);
81 },
82
83 getInfo: function() {
84 return {
85 longname : 'Word Count plugin',
86 author : 'Moxiecode Systems AB',
87 authorurl : 'http://tinymce.moxiecode.com',
88 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/wordcount',
89 version : tinymce.majorVersion + "." + tinymce.minorVersion
90 };
91 }
92 });
93
94 tinymce.PluginManager.add('wordcount', tinymce.plugins.WordCount);
95})();