]> git.mxchange.org Git - friendica.git/commitdiff
tinyMCE loads "source" version of bbcode plugin istead of "compressed" one
authorFabio Comuni <fabrix.xm@gmail.com>
Thu, 30 Jun 2011 14:44:06 +0000 (16:44 +0200)
committerFabio Comuni <fabrix.xm@gmail.com>
Thu, 30 Jun 2011 14:44:06 +0000 (16:44 +0200)
library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin.js
library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_cmp.js [new file with mode: 0644]
library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js [deleted file]

index b0926c92a8a4e73598e3cac68f754ad08047a91b..db676cd908d75c25e0de3d9662d7b80f2db388d3 100644 (file)
@@ -1 +1,155 @@
-(function(){tinymce.create('tinymce.plugins.BBCodePlugin',{init:function(ed,url){var t=this,dialect=ed.getParam('bbcode_dialect','dfrn').toLowerCase();ed.onBeforeSetContent.add(function(ed,o){o.content=t['_'+dialect+'_bbcode2html'](o.content)});ed.onPostProcess.add(function(ed,o){if(o.set)o.content=t['_'+dialect+'_bbcode2html'](o.content);if(o.get)o.content=t['_'+dialect+'_html2bbcode'](o.content)})},getInfo:function(){return{longname:'BBCode Plugin',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode',version:tinymce.majorVersion+"."+tinymce.minorVersion version:tinymce.majorVersion+"."+tinymce.minorVersion}},_dfrn_html2bbcode:function(s){s=tinymce.trim(s);function rep(re,str){s=s.replace(re,str)};rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");rep(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]");rep(/<font>(.*?)<\/font>/gi,"$1");rep(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");rep(/<code>(.*?)<\/code>/gi,"[code]$1[/code]");rep(/<\/(strong|b)>/gi,"[/b]");rep(/<(strong|b)>/gi,"[b]");rep(/<\/(em|i)>/gi,"[/i]");rep(/<(em|i)>/gi,"[i]");rep(/<\/u>/gi,"[/u]");rep(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]");rep(/<u>/gi,"[u]");rep(/<blockquote[^>]*>/gi,"[quote]");rep(/<\/blockquote>/gi,"[/quote]");rep(/<br \/>/gi,"\n");rep(/<br\/>/gi,"\n");rep(/<br>/gi,"\n");rep(/<p>/gi,"");rep(/<\/p>/gi,"\n");rep(/&nbsp;/gi," ");rep(/&quot;/gi,"\"");rep(/&lt;/gi,"<");rep(/&gt;/gi,">");rep(/&amp;/gi,"&");return s},_dfrn_bbcode2html:function(s){s=tinymce.trim(s);function rep(re,str){s=s.replace(re,str)};rep(/\n/gi,"<br />");rep(/\[b\]/gi,"<strong>");rep(/\[\/b\]/gi,"</strong>");rep(/\[i\]/gi,"<em>");rep(/\[\/i\]/gi,"</em>");rep(/\[u\]/gi,"<u>");rep(/\[\/u\]/gi,"</u>");rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"<a href=\"$1\">$2</a>");rep(/\[url\](.*?)\[\/url\]/gi,"<a href=\"$1\">$1</a>");rep(/\[img\](.*?)\[\/img\]/gi,"<img src=\"$1\" />");rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"<font color=\"$1\">$2</font>");rep(/\[code\](.*?)\[\/code\]/gi,"<code>$1</code>");rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<blockquote>$1</blockquote>");return s}});tinymce.PluginManager.add('bbcode',tinymce.plugins.BBCodePlugin)})();
\ No newline at end of file
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+/* Macgirvin Aug-2010 changed from punbb to dfrn dialect */\r
+\r
+(function() {\r
+       tinymce.create('tinymce.plugins.BBCodePlugin', {\r
+               init : function(ed, url) {\r
+                       var t = this, dialect = ed.getParam('bbcode_dialect', 'dfrn').toLowerCase();\r
+\r
+                       ed.onBeforeSetContent.add(function(ed, o) {\r
+                               o.content = t['_' + dialect + '_bbcode2html'](o.content);\r
+                       });\r
+\r
+                       ed.onPostProcess.add(function(ed, o) {\r
+                               if (o.set)\r
+                                       o.content = t['_' + dialect + '_bbcode2html'](o.content);\r
+\r
+                               if (o.get)\r
+                                       o.content = t['_' + dialect + '_html2bbcode'](o.content);\r
+                       });\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'BBCode Plugin',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               },\r
+\r
+               // Private methods\r
+\r
+               // HTML -> BBCode in DFRN dialect\r
+               _dfrn_html2bbcode : function(s) {\r
+                       s = tinymce.trim(s);\r
+\r
+                       function rep(re, str) {\r
+                               s = s.replace(re, str);\r
+                       };\r
+
+
+
+
+                       /* oembed */
+                       function _h2b_cb(match) {
+                               text = bin2hex(match);
+                               function s_h2b(data) {
+                                               match = data;
+                               }
+                               $.ajax({
+                                       url: 'oembed/h2b?text=' + text,
+                                       async: false,
+                                       success: s_h2b,
+                                       dataType: 'html'
+                               });
+                               return match;
+                       }
+                       s = s.replace(/<span class=\"oembed(.*?)<\/span>/gi, _h2b_cb);
+                       /* /oembed */
+
+\r
+                       // example: <strong> to [b]\r
+                       rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");\r
+                       rep(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]");\r
+                       rep(/<span style=\"color:(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]");\r
+                       rep(/<font>(.*?)<\/font>/gi,"$1");\r
+                       rep(/<img.*?width=\"(.*?)\".*?height=\"(.*?)\".*?src=\"(.*?)\".*?\/>/gi,"[img=$1x$2]$3[/img]");\r
+                       rep(/<img.*?height=\"(.*?)\".*?width=\"(.*?)\".*?src=\"(.*?)\".*?\/>/gi,"[img=$2x$1]$3[/img]");\r
+                       rep(/<img.*?src=\"(.*?)\".*?height=\"(.*?)\".*?width=\"(.*?)\".*?\/>/gi,"[img=$3x$2]$1[/img]");\r
+                       rep(/<img.*?src=\"(.*?)\".*?width=\"(.*?)\".*?height=\"(.*?)\".*?\/>/gi,"[img=$2x$3]$1[/img]");\r
+                       rep(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");\r
+                       rep(/<code>(.*?)<\/code>/gi,"[code]$1[/code]");\r
+                       rep(/<\/(strong|b)>/gi,"[/b]");\r
+                       rep(/<(strong|b)>/gi,"[b]");\r
+                       rep(/<\/(em|i)>/gi,"[/i]");\r
+                       rep(/<(em|i)>/gi,"[i]");\r
+                       rep(/<\/u>/gi,"[/u]");\r
+                       rep(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]");\r
+                       rep(/<u>/gi,"[u]");\r
+                       rep(/<blockquote[^>]*>/gi,"[quote]");\r
+                       rep(/<\/blockquote>/gi,"[/quote]");\r
+                       rep(/<br \/>/gi,"\n\n");\r
+                       rep(/<br\/>/gi,"\n\n");\r
+                       rep(/<br>/gi,"\n");\r
+                       rep(/<p>/gi,"");\r
+                       rep(/<\/p>/gi,"\n");\r
+                       rep(/&nbsp;/gi," ");\r
+                       rep(/&quot;/gi,"\"");\r
+                       rep(/&lt;/gi,"<");\r
+                       rep(/&gt;/gi,">");\r
+                       rep(/&amp;/gi,"&");\r
+\r
+                       return s; \r
+               },\r
+\r
+               // BBCode -> HTML from DFRN dialect\r
+               _dfrn_bbcode2html : function(s) {\r
+                       s = tinymce.trim(s);\r
+\r
+                       function rep(re, str) {\r
+                               s = s.replace(re, str);\r
+                       };\r
+\r
+                       // example: [b] to <strong>\r
+                       rep(/\n/gi,"<br />");\r
+                       rep(/\[b\]/gi,"<strong>");\r
+                       rep(/\[\/b\]/gi,"</strong>");\r
+                       rep(/\[i\]/gi,"<em>");\r
+                       rep(/\[\/i\]/gi,"</em>");\r
+                       rep(/\[u\]/gi,"<u>");\r
+                       rep(/\[\/u\]/gi,"</u>");\r
+                       rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"<a href=\"$1\">$2</a>");\r
+                       rep(/\[url\](.*?)\[\/url\]/gi,"<a href=\"$1\">$1</a>");\r
+                       rep(/\[img=(.*?)x(.*?)\](.*?)\[\/img\]/gi,"<img width=\"$1\" height=\"$2\" src=\"$3\" />");\r
+                       rep(/\[img\](.*?)\[\/img\]/gi,"<img src=\"$1\" />");\r
+                       rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"<span style=\"color: $1;\">$2</span>");\r
+                       rep(/\[size=(.*?)\](.*?)\[\/size\]/gi,"<span style=\"font-size: $1;\">$2</span>");\r
+                       rep(/\[code\](.*?)\[\/code\]/gi,"<code>$1</code>");\r
+                       rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<blockquote>$1</blockquote>");\r
+
+                       /* oembed */
+                       function _b2h_cb(match, url) {
+                               url = bin2hex(url);
+                               function s_b2h(data) {
+                                               match = data;
+                               }
+                               $.ajax({
+                                       url: 'oembed/b2h?url=' + url,
+                                       async: false,
+                                       success: s_b2h,
+                                       dataType: 'html'
+                               });
+                               return match;
+                       }
+                       s = s.replace(/\[embed\](.*?)\[\/embed\]/gi, _b2h_cb);
+                       
+                       /* /oembed */
+\r
+                       return s; \r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('bbcode', tinymce.plugins.BBCodePlugin);\r
+})();
\ No newline at end of file
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_cmp.js b/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_cmp.js
new file mode 100644 (file)
index 0000000..b0926c9
--- /dev/null
@@ -0,0 +1 @@
+(function(){tinymce.create('tinymce.plugins.BBCodePlugin',{init:function(ed,url){var t=this,dialect=ed.getParam('bbcode_dialect','dfrn').toLowerCase();ed.onBeforeSetContent.add(function(ed,o){o.content=t['_'+dialect+'_bbcode2html'](o.content)});ed.onPostProcess.add(function(ed,o){if(o.set)o.content=t['_'+dialect+'_bbcode2html'](o.content);if(o.get)o.content=t['_'+dialect+'_html2bbcode'](o.content)})},getInfo:function(){return{longname:'BBCode Plugin',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode',version:tinymce.majorVersion+"."+tinymce.minorVersion version:tinymce.majorVersion+"."+tinymce.minorVersion}},_dfrn_html2bbcode:function(s){s=tinymce.trim(s);function rep(re,str){s=s.replace(re,str)};rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");rep(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]");rep(/<font>(.*?)<\/font>/gi,"$1");rep(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");rep(/<code>(.*?)<\/code>/gi,"[code]$1[/code]");rep(/<\/(strong|b)>/gi,"[/b]");rep(/<(strong|b)>/gi,"[b]");rep(/<\/(em|i)>/gi,"[/i]");rep(/<(em|i)>/gi,"[i]");rep(/<\/u>/gi,"[/u]");rep(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]");rep(/<u>/gi,"[u]");rep(/<blockquote[^>]*>/gi,"[quote]");rep(/<\/blockquote>/gi,"[/quote]");rep(/<br \/>/gi,"\n");rep(/<br\/>/gi,"\n");rep(/<br>/gi,"\n");rep(/<p>/gi,"");rep(/<\/p>/gi,"\n");rep(/&nbsp;/gi," ");rep(/&quot;/gi,"\"");rep(/&lt;/gi,"<");rep(/&gt;/gi,">");rep(/&amp;/gi,"&");return s},_dfrn_bbcode2html:function(s){s=tinymce.trim(s);function rep(re,str){s=s.replace(re,str)};rep(/\n/gi,"<br />");rep(/\[b\]/gi,"<strong>");rep(/\[\/b\]/gi,"</strong>");rep(/\[i\]/gi,"<em>");rep(/\[\/i\]/gi,"</em>");rep(/\[u\]/gi,"<u>");rep(/\[\/u\]/gi,"</u>");rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"<a href=\"$1\">$2</a>");rep(/\[url\](.*?)\[\/url\]/gi,"<a href=\"$1\">$1</a>");rep(/\[img\](.*?)\[\/img\]/gi,"<img src=\"$1\" />");rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"<font color=\"$1\">$2</font>");rep(/\[code\](.*?)\[\/code\]/gi,"<code>$1</code>");rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<blockquote>$1</blockquote>");return s}});tinymce.PluginManager.add('bbcode',tinymce.plugins.BBCodePlugin)})();
\ No newline at end of file
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js b/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js
deleted file mode 100644 (file)
index db676cd..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-/**\r
- * editor_plugin_src.js\r
- *\r
- * Copyright 2009, Moxiecode Systems AB\r
- * Released under LGPL License.\r
- *\r
- * License: http://tinymce.moxiecode.com/license\r
- * Contributing: http://tinymce.moxiecode.com/contributing\r
- */\r
-\r
-/* Macgirvin Aug-2010 changed from punbb to dfrn dialect */\r
-\r
-(function() {\r
-       tinymce.create('tinymce.plugins.BBCodePlugin', {\r
-               init : function(ed, url) {\r
-                       var t = this, dialect = ed.getParam('bbcode_dialect', 'dfrn').toLowerCase();\r
-\r
-                       ed.onBeforeSetContent.add(function(ed, o) {\r
-                               o.content = t['_' + dialect + '_bbcode2html'](o.content);\r
-                       });\r
-\r
-                       ed.onPostProcess.add(function(ed, o) {\r
-                               if (o.set)\r
-                                       o.content = t['_' + dialect + '_bbcode2html'](o.content);\r
-\r
-                               if (o.get)\r
-                                       o.content = t['_' + dialect + '_html2bbcode'](o.content);\r
-                       });\r
-               },\r
-\r
-               getInfo : function() {\r
-                       return {\r
-                               longname : 'BBCode Plugin',\r
-                               author : 'Moxiecode Systems AB',\r
-                               authorurl : 'http://tinymce.moxiecode.com',\r
-                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode',\r
-                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
-                       };\r
-               },\r
-\r
-               // Private methods\r
-\r
-               // HTML -> BBCode in DFRN dialect\r
-               _dfrn_html2bbcode : function(s) {\r
-                       s = tinymce.trim(s);\r
-\r
-                       function rep(re, str) {\r
-                               s = s.replace(re, str);\r
-                       };\r
-
-
-
-
-                       /* oembed */
-                       function _h2b_cb(match) {
-                               text = bin2hex(match);
-                               function s_h2b(data) {
-                                               match = data;
-                               }
-                               $.ajax({
-                                       url: 'oembed/h2b?text=' + text,
-                                       async: false,
-                                       success: s_h2b,
-                                       dataType: 'html'
-                               });
-                               return match;
-                       }
-                       s = s.replace(/<span class=\"oembed(.*?)<\/span>/gi, _h2b_cb);
-                       /* /oembed */
-
-\r
-                       // example: <strong> to [b]\r
-                       rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");\r
-                       rep(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]");\r
-                       rep(/<span style=\"color:(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]");\r
-                       rep(/<font>(.*?)<\/font>/gi,"$1");\r
-                       rep(/<img.*?width=\"(.*?)\".*?height=\"(.*?)\".*?src=\"(.*?)\".*?\/>/gi,"[img=$1x$2]$3[/img]");\r
-                       rep(/<img.*?height=\"(.*?)\".*?width=\"(.*?)\".*?src=\"(.*?)\".*?\/>/gi,"[img=$2x$1]$3[/img]");\r
-                       rep(/<img.*?src=\"(.*?)\".*?height=\"(.*?)\".*?width=\"(.*?)\".*?\/>/gi,"[img=$3x$2]$1[/img]");\r
-                       rep(/<img.*?src=\"(.*?)\".*?width=\"(.*?)\".*?height=\"(.*?)\".*?\/>/gi,"[img=$2x$3]$1[/img]");\r
-                       rep(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");\r
-                       rep(/<code>(.*?)<\/code>/gi,"[code]$1[/code]");\r
-                       rep(/<\/(strong|b)>/gi,"[/b]");\r
-                       rep(/<(strong|b)>/gi,"[b]");\r
-                       rep(/<\/(em|i)>/gi,"[/i]");\r
-                       rep(/<(em|i)>/gi,"[i]");\r
-                       rep(/<\/u>/gi,"[/u]");\r
-                       rep(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]");\r
-                       rep(/<u>/gi,"[u]");\r
-                       rep(/<blockquote[^>]*>/gi,"[quote]");\r
-                       rep(/<\/blockquote>/gi,"[/quote]");\r
-                       rep(/<br \/>/gi,"\n\n");\r
-                       rep(/<br\/>/gi,"\n\n");\r
-                       rep(/<br>/gi,"\n");\r
-                       rep(/<p>/gi,"");\r
-                       rep(/<\/p>/gi,"\n");\r
-                       rep(/&nbsp;/gi," ");\r
-                       rep(/&quot;/gi,"\"");\r
-                       rep(/&lt;/gi,"<");\r
-                       rep(/&gt;/gi,">");\r
-                       rep(/&amp;/gi,"&");\r
-\r
-                       return s; \r
-               },\r
-\r
-               // BBCode -> HTML from DFRN dialect\r
-               _dfrn_bbcode2html : function(s) {\r
-                       s = tinymce.trim(s);\r
-\r
-                       function rep(re, str) {\r
-                               s = s.replace(re, str);\r
-                       };\r
-\r
-                       // example: [b] to <strong>\r
-                       rep(/\n/gi,"<br />");\r
-                       rep(/\[b\]/gi,"<strong>");\r
-                       rep(/\[\/b\]/gi,"</strong>");\r
-                       rep(/\[i\]/gi,"<em>");\r
-                       rep(/\[\/i\]/gi,"</em>");\r
-                       rep(/\[u\]/gi,"<u>");\r
-                       rep(/\[\/u\]/gi,"</u>");\r
-                       rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"<a href=\"$1\">$2</a>");\r
-                       rep(/\[url\](.*?)\[\/url\]/gi,"<a href=\"$1\">$1</a>");\r
-                       rep(/\[img=(.*?)x(.*?)\](.*?)\[\/img\]/gi,"<img width=\"$1\" height=\"$2\" src=\"$3\" />");\r
-                       rep(/\[img\](.*?)\[\/img\]/gi,"<img src=\"$1\" />");\r
-                       rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"<span style=\"color: $1;\">$2</span>");\r
-                       rep(/\[size=(.*?)\](.*?)\[\/size\]/gi,"<span style=\"font-size: $1;\">$2</span>");\r
-                       rep(/\[code\](.*?)\[\/code\]/gi,"<code>$1</code>");\r
-                       rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<blockquote>$1</blockquote>");\r
-
-                       /* oembed */
-                       function _b2h_cb(match, url) {
-                               url = bin2hex(url);
-                               function s_b2h(data) {
-                                               match = data;
-                               }
-                               $.ajax({
-                                       url: 'oembed/b2h?url=' + url,
-                                       async: false,
-                                       success: s_b2h,
-                                       dataType: 'html'
-                               });
-                               return match;
-                       }
-                       s = s.replace(/\[embed\](.*?)\[\/embed\]/gi, _b2h_cb);
-                       
-                       /* /oembed */
-\r
-                       return s; \r
-               }\r
-       });\r
-\r
-       // Register plugin\r
-       tinymce.PluginManager.add('bbcode', tinymce.plugins.BBCodePlugin);\r
-})();
\ No newline at end of file