Files
sean 0e8a8b3028
Some checks are pending
deploy-testing / deploy (push) Waiting to run
Initial testing snapshot
2026-11-17 16:15:01 -05:00

1 line
3.2 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
!function(){tinymce.create("tinymce.plugins.BBCodePlugin",{init:function(b){var a=this,c=b.getParam("bbcode_dialect","punbb").toLowerCase();b.on("beforeSetContent",function(d){d.content=a["_"+c+"_bbcode2html"](d.content)}),b.on("postProcess",function(d){d.set&&(d.content=a["_"+c+"_bbcode2html"](d.content)),d.get&&(d.content=a["_"+c+"_html2bbcode"](d.content))})},getInfo:function(){return{longname:"BBCode Plugin",author:"Moxiecode Systems AB",authorurl:"http://www.tinymce.com",infourl:"http://www.tinymce.com/wiki.php/Plugin:bbcode"}},_punbb_html2bbcode:function(b){function a(c,d){b=b.replace(c,d)}return b=tinymce.trim(b),a(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]"),a(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),a(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),a(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),a(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),a(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]"),a(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]"),a(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]"),a(/<font>(.*?)<\/font>/gi,"$1"),a(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]"),a(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]"),a(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]"),a(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"),a(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"),a(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"),a(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"),a(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"),a(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]"),a(/<\/(strong|b)>/gi,"[/b]"),a(/<(strong|b)>/gi,"[b]"),a(/<\/(em|i)>/gi,"[/i]"),a(/<(em|i)>/gi,"[i]"),a(/<\/u>/gi,"[/u]"),a(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]"),a(/<u>/gi,"[u]"),a(/<blockquote[^>]*>/gi,"[quote]"),a(/<\/blockquote>/gi,"[/quote]"),a(/<br \/>/gi,"\n"),a(/<br\/>/gi,"\n"),a(/<br>/gi,"\n"),a(/<p>/gi,""),a(/<\/p>/gi,"\n"),a(/ |\u00a0/gi," "),a(/"/gi,'"'),a(/</gi,"<"),a(/>/gi,">"),a(/&/gi,"&"),b},_punbb_bbcode2html:function(b){function a(c,d){b=b.replace(c,d)}return b=tinymce.trim(b),a(/\n/gi,"<br />"),a(/\[b\]/gi,"<strong>"),a(/\[\/b\]/gi,"</strong>"),a(/\[i\]/gi,"<em>"),a(/\[\/i\]/gi,"</em>"),a(/\[u\]/gi,"<u>"),a(/\[\/u\]/gi,"</u>"),a(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'<a href="../../../../../admin/editors/tinymce/plugins/bbcode/$1">$2</a>'),a(/\[url\](.*?)\[\/url\]/gi,'<a href="../../../../../admin/editors/tinymce/plugins/bbcode/$1">$1</a>'),a(/\[img\](.*?)\[\/img\]/gi,'<img src="../../../../../admin/editors/tinymce/plugins/bbcode/$1" />'),a(/\[color=(.*?)\](.*?)\[\/color\]/gi,'<font color="$1">$2</font>'),a(/\[code\](.*?)\[\/code\]/gi,'<span class="codeStyle">$1</span> '),a(/\[quote.*?\](.*?)\[\/quote\]/gi,'<span class="quoteStyle">$1</span> '),b}}),tinymce.PluginManager.add("bbcode",tinymce.plugins.BBCodePlugin)}();