diff --git a/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin.js b/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin.js index b0926c92a8..db676cd908 100644 --- a/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin.js +++ b/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin.js @@ -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>/gi,"[url=$1]$2[/url]");rep(/(.*?)<\/span>/gi,"[size=$1]$2[/size]");rep(/(.*?)<\/font>/gi,"$1");rep(//gi,"[img]$1[/img]");rep(/(.*?)<\/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>/gi,"[u]$1[/u]");rep(//gi,"[u]");rep(/]*>/gi,"[quote]");rep(/<\/blockquote>/gi,"[/quote]");rep(/
/gi,"\n");rep(//gi,"\n");rep(/
/gi,"\n");rep(/

/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,"
");rep(/\[b\]/gi,"");rep(/\[\/b\]/gi,"");rep(/\[i\]/gi,"");rep(/\[\/i\]/gi,"");rep(/\[u\]/gi,"");rep(/\[\/u\]/gi,"");rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"$2");rep(/\[url\](.*?)\[\/url\]/gi,"$1");rep(/\[img\](.*?)\[\/img\]/gi,"");rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"$2");rep(/\[code\](.*?)\[\/code\]/gi,"$1");rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"

$1
");return s}});tinymce.PluginManager.add('bbcode',tinymce.plugins.BBCodePlugin)})(); \ No newline at end of file +/** + * editor_plugin_src.js + * + * Copyright 2009, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://tinymce.moxiecode.com/license + * Contributing: http://tinymce.moxiecode.com/contributing + */ + +/* Macgirvin Aug-2010 changed from punbb to dfrn dialect */ + +(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 + }; + }, + + // Private methods + + // HTML -> BBCode in DFRN dialect + _dfrn_html2bbcode : function(s) { + s = tinymce.trim(s); + + function rep(re, str) { + s = s.replace(re, str); + }; + + + + + /* 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(//gi, _h2b_cb); + /* /oembed */ + + + // example: to [b] + rep(/(.*?)<\/a>/gi,"[url=$1]$2[/url]"); + rep(/(.*?)<\/span>/gi,"[size=$1]$2[/size]"); + rep(/(.*?)<\/span>/gi,"[color=$1]$2[/color]"); + rep(/(.*?)<\/font>/gi,"$1"); + rep(//gi,"[img=$1x$2]$3[/img]"); + rep(//gi,"[img=$2x$1]$3[/img]"); + rep(//gi,"[img=$3x$2]$1[/img]"); + rep(//gi,"[img=$2x$3]$1[/img]"); + rep(//gi,"[img]$1[/img]"); + rep(/(.*?)<\/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>/gi,"[u]$1[/u]"); + rep(//gi,"[u]"); + rep(/]*>/gi,"[quote]"); + rep(/<\/blockquote>/gi,"[/quote]"); + rep(/
/gi,"\n\n"); + rep(//gi,"\n\n"); + rep(/
/gi,"\n"); + rep(/

/gi,""); + rep(/<\/p>/gi,"\n"); + rep(/ /gi," "); + rep(/"/gi,"\""); + rep(/</gi,"<"); + rep(/>/gi,">"); + rep(/&/gi,"&"); + + return s; + }, + + // BBCode -> HTML from DFRN dialect + _dfrn_bbcode2html : function(s) { + s = tinymce.trim(s); + + function rep(re, str) { + s = s.replace(re, str); + }; + + // example: [b] to + rep(/\n/gi,"
"); + rep(/\[b\]/gi,""); + rep(/\[\/b\]/gi,""); + rep(/\[i\]/gi,""); + rep(/\[\/i\]/gi,""); + rep(/\[u\]/gi,""); + rep(/\[\/u\]/gi,""); + rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"$2"); + rep(/\[url\](.*?)\[\/url\]/gi,"$1"); + rep(/\[img=(.*?)x(.*?)\](.*?)\[\/img\]/gi,""); + rep(/\[img\](.*?)\[\/img\]/gi,""); + rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"$2"); + rep(/\[size=(.*?)\](.*?)\[\/size\]/gi,"$2"); + rep(/\[code\](.*?)\[\/code\]/gi,"$1"); + rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"

$1
"); + + /* 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 */ + + return s; + } + }); + + // Register plugin + 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_cmp.js b/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_cmp.js new file mode 100644 index 0000000000..b0926c92a8 --- /dev/null +++ b/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_cmp.js @@ -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>/gi,"[url=$1]$2[/url]");rep(/(.*?)<\/span>/gi,"[size=$1]$2[/size]");rep(/(.*?)<\/font>/gi,"$1");rep(//gi,"[img]$1[/img]");rep(/(.*?)<\/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>/gi,"[u]$1[/u]");rep(//gi,"[u]");rep(/]*>/gi,"[quote]");rep(/<\/blockquote>/gi,"[/quote]");rep(/
/gi,"\n");rep(//gi,"\n");rep(/
/gi,"\n");rep(/

/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,"
");rep(/\[b\]/gi,"");rep(/\[\/b\]/gi,"");rep(/\[i\]/gi,"");rep(/\[\/i\]/gi,"");rep(/\[u\]/gi,"");rep(/\[\/u\]/gi,"");rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"$2");rep(/\[url\](.*?)\[\/url\]/gi,"$1");rep(/\[img\](.*?)\[\/img\]/gi,"");rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"$2");rep(/\[code\](.*?)\[\/code\]/gi,"$1");rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"

$1
");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 index db676cd908..0000000000 --- a/library/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js +++ /dev/null @@ -1,155 +0,0 @@ -/** - * editor_plugin_src.js - * - * Copyright 2009, Moxiecode Systems AB - * Released under LGPL License. - * - * License: http://tinymce.moxiecode.com/license - * Contributing: http://tinymce.moxiecode.com/contributing - */ - -/* Macgirvin Aug-2010 changed from punbb to dfrn dialect */ - -(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 - }; - }, - - // Private methods - - // HTML -> BBCode in DFRN dialect - _dfrn_html2bbcode : function(s) { - s = tinymce.trim(s); - - function rep(re, str) { - s = s.replace(re, str); - }; - - - - - /* 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(//gi, _h2b_cb); - /* /oembed */ - - - // example: to [b] - rep(/(.*?)<\/a>/gi,"[url=$1]$2[/url]"); - rep(/(.*?)<\/span>/gi,"[size=$1]$2[/size]"); - rep(/(.*?)<\/span>/gi,"[color=$1]$2[/color]"); - rep(/(.*?)<\/font>/gi,"$1"); - rep(//gi,"[img=$1x$2]$3[/img]"); - rep(//gi,"[img=$2x$1]$3[/img]"); - rep(//gi,"[img=$3x$2]$1[/img]"); - rep(//gi,"[img=$2x$3]$1[/img]"); - rep(//gi,"[img]$1[/img]"); - rep(/(.*?)<\/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>/gi,"[u]$1[/u]"); - rep(//gi,"[u]"); - rep(/]*>/gi,"[quote]"); - rep(/<\/blockquote>/gi,"[/quote]"); - rep(/
/gi,"\n\n"); - rep(//gi,"\n\n"); - rep(/
/gi,"\n"); - rep(/

/gi,""); - rep(/<\/p>/gi,"\n"); - rep(/ /gi," "); - rep(/"/gi,"\""); - rep(/</gi,"<"); - rep(/>/gi,">"); - rep(/&/gi,"&"); - - return s; - }, - - // BBCode -> HTML from DFRN dialect - _dfrn_bbcode2html : function(s) { - s = tinymce.trim(s); - - function rep(re, str) { - s = s.replace(re, str); - }; - - // example: [b] to - rep(/\n/gi,"
"); - rep(/\[b\]/gi,""); - rep(/\[\/b\]/gi,""); - rep(/\[i\]/gi,""); - rep(/\[\/i\]/gi,""); - rep(/\[u\]/gi,""); - rep(/\[\/u\]/gi,""); - rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"$2"); - rep(/\[url\](.*?)\[\/url\]/gi,"$1"); - rep(/\[img=(.*?)x(.*?)\](.*?)\[\/img\]/gi,""); - rep(/\[img\](.*?)\[\/img\]/gi,""); - rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"$2"); - rep(/\[size=(.*?)\](.*?)\[\/size\]/gi,"$2"); - rep(/\[code\](.*?)\[\/code\]/gi,"$1"); - rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"

$1
"); - - /* 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 */ - - return s; - } - }); - - // Register plugin - tinymce.PluginManager.add('bbcode', tinymce.plugins.BBCodePlugin); -})(); \ No newline at end of file