-(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(/ /gi," ");rep(/"/gi,"\"");rep(/</gi,"<");rep(/>/gi,">");rep(/&/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(/ /gi," ");\r
+ rep(/"/gi,"\"");\r
+ rep(/</gi,"<");\r
+ rep(/>/gi,">");\r
+ rep(/&/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
--- /dev/null
+(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(/ /gi," ");rep(/"/gi,"\"");rep(/</gi,"<");rep(/>/gi,">");rep(/&/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
+++ /dev/null
-/**\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(/ /gi," ");\r
- rep(/"/gi,"\"");\r
- rep(/</gi,"<");\r
- rep(/>/gi,">");\r
- rep(/&/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