Socket
Socket
Sign inDemoInstall

bbcodejs

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.3 to 0.0.4

12

bbcode.js

@@ -47,7 +47,9 @@ // Generated by CoffeeScript 1.9.1

this.bbcode.Renderer = (function() {
function Renderer() {
this._contexts = [];
this.options = {
linkify: true
};
function Renderer(options) {
options = options || {};
this._contexts = [];
this.options = {
linkify: !!options.linkify
};
}

@@ -54,0 +56,0 @@

(function(){this.bbcode={};"undefined"!==typeof module&&(module.exports=this.bbcode)}).call(this);
(function(){var l,g,c,d,f,e,a=[].slice;d=/[&<>"]/g;c={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};f=/\b((?:([\w-]+):(\/{1,3})|www[.])(?:(?:(?:[^\s&()]|&amp;|&quot;)*(?:[^!"#$%&'()*+,.:;<=>?@\[\]^`{|}~\s]))|(?:\((?:[^\s&()]|&amp;|&quot;)*\)))+)/g;l={"--":"&ndash;","---":"&mdash;","...":"&#8230;","(c)":"&copy;","(reg)":"&reg;","(tm)":"&trade;"};g=new RegExp(function(){var a;a=[];for(e in l)a.push(e.replace(/(\.|\)|\()/g,"\\$1"));return a}().join("|"));this.bbcode.Renderer=function(){function b(){this._contexts=
[];this.options={linkify:!0}}b.prototype.context=function(a,b){var d,c,f,e;c={};f=this.options;for(d in f)e=f[d],c[d]=e;for(d in a)e=a[d],c[d]=e;this._contexts.push(this.options);this.options=c;e=b();this.options=this._contexts.pop();return e};b.prototype.escape=function(a){return a.replace(d,function(a){return c[a]})};b.prototype.linkify=function(b){return b.replace(f,function(){var b,d,c;b=1<=arguments.length?a.call(arguments,0):[];c=b[1];if((d=b[2])&&"http"!==d&&"https"!==d)return c;b=b[1];d||
(b="http://"+b);return'<a href="'+b+'" target="_blank">'+c+"</a>"})};b.prototype.strip=function(a){return a.replace(/^\s+|\s+$/g,"")};b.prototype.cosmeticReplace=function(b){return b.replace(g,function(){var b;b=(1<=arguments.length?a.call(arguments,0):[])[0];return l[b]||b})};b.prototype.htmlAttributes=function(a){var b,d;if(!a)return"";var c;c=[];for(b in a)d=a[b],c.push(b+'="'+d+'"');return c.join(" ")};return b}()}).call(this);
(function(){var l,g,c,d,f,e,a=[].slice;d=/[&<>"]/g;c={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};f=/\b((?:([\w-]+):(\/{1,3})|www[.])(?:(?:(?:[^\s&()]|&amp;|&quot;)*(?:[^!"#$%&'()*+,.:;<=>?@\[\]^`{|}~\s]))|(?:\((?:[^\s&()]|&amp;|&quot;)*\)))+)/g;l={"--":"&ndash;","---":"&mdash;","...":"&#8230;","(c)":"&copy;","(reg)":"&reg;","(tm)":"&trade;"};g=new RegExp(function(){var a;a=[];for(e in l)a.push(e.replace(/(\.|\)|\()/g,"\\$1"));return a}().join("|"));this.bbcode.Renderer=function(){function b(a){a=
a||{};this._contexts=[];this.options={linkify:!!a.linkify}}b.prototype.context=function(a,b){var d,c,f,e;c={};f=this.options;for(d in f)e=f[d],c[d]=e;for(d in a)e=a[d],c[d]=e;this._contexts.push(this.options);this.options=c;e=b();this.options=this._contexts.pop();return e};b.prototype.escape=function(a){return a.replace(d,function(a){return c[a]})};b.prototype.linkify=function(b){return b.replace(f,function(){var b,d,c;b=1<=arguments.length?a.call(arguments,0):[];c=b[1];if((d=b[2])&&"http"!==d&&"https"!==
d)return c;b=b[1];d||(b="http://"+b);return'<a href="'+b+'" target="_blank">'+c+"</a>"})};b.prototype.strip=function(a){return a.replace(/^\s+|\s+$/g,"")};b.prototype.cosmeticReplace=function(b){return b.replace(g,function(){var b;b=(1<=arguments.length?a.call(arguments,0):[])[0];return l[b]||b})};b.prototype.htmlAttributes=function(a){var b,d;if(!a)return"";var c;c=[];for(b in a)d=a[b],c.push(b+'="'+d+'"');return c.join(" ")};return b}()}).call(this);
(function(){var l,g,c,d,f,e,a,b,v,w,m,n,p=[].indexOf||function(a){for(var h=0,b=this.length;h<b;h++)if(h in this&&this[h]===a)return h;return-1},k=function(a,h){function b(){this.constructor=a}for(var d in h)r.call(h,d)&&(a[d]=h[d]);b.prototype=h.prototype;a.prototype=new b;a.__super__=h.prototype;return a},r={}.hasOwnProperty;n=/\r?\n/g;this.bbcode.Tag=function(){function a(h,b){var d,c,e,f,g;this.renderer=h;null==b&&(b={});this.CLOSED_BY=[];this.DISCARD_TEXT=this.STRIP_OUTER=this.STRIP_INNER=this.SELF_CLOSE=
!1;this.name=b.name||null;this.parent=b.parent||null;this.text=b.text||"";this.parent&&this.parent.children.push(this);null==b.params&&(b.params=[]);this.params={};f=b.params;d=0;for(e=f.length;d<e;d++)g=f[d],c=g[0],(g=g[1])&&(this.params[c]=g);this.children=[]}a.prototype.getContent=function(a){var b,d,c,f,e;null==a&&(a=!1);c=[];this.text&&(b=this.renderer.escape(this.text),a||(this.renderer.options.linkify&&(b=this.renderer.linkify(b)),b=this.renderer.cosmeticReplace(b.replace(n,"<br />"))),c.push(b));
d=this.children;f=0;for(e=d.length;f<e;f++)b=d[f],a?c.push(b.toText()):this.DISCARD_TEXT&&null===b.name||c.push(b.toHTML());c=c.join("");if(!a&&this.STRIP_INNER){for(c=this.renderer.strip(c);"<br />"===c.slice(0,6);)c=c.slice(6);for(;"<br />"===c.slice(-6);)c=c.slice(0,-6);c=this.renderer.strip(c)}return c};a.prototype.toText=function(b){var a,c,d,f;null==b&&(b=!1);c=[];if(null!==this.name)if(this.params.length){var e,g;e=this.params;g=[];for(a in e)f=e[a],g.push([a,f].join("="));a=g.join(" ");this.name in
this.params?c.push("["+a+"]"):c.push("["+this.name+" "+a+"]")}else c.push("["+this.name+"]");c.push(this.getContent(!b));null!==this.name&&(d=this.name,0>p.call(this.CLOSED_BY,d))&&c.push("[/"+this.name+"]");return c.join("")};a.prototype._toHTML=function(){return this.toText(!0)};a.prototype.toHTML=function(){var b;b=this._toHTML();return"string"===typeof b?b:b.join("")};return a}();g=function(b){function a(){a.__super__.constructor.apply(this,arguments);this.STRIP_INNER=!0;this._inline="inline"===
d=this.children;f=0;for(e=d.length;f<e;f++)b=d[f],a?c.push(b.toText()):this.DISCARD_TEXT&&null===b.name||c.push(b.toHTML());c=c.join("");if(!a&&this.STRIP_INNER){for(c=this.renderer.strip(c);"<br />"===c.slice(0,6);)c=c.slice(6);for(;"<br />"===c.slice(-6);)c=c.slice(0,-6);c=this.renderer.strip(c)}return c};a.prototype.toText=function(a){var b,c,d,f;null==a&&(a=!1);c=[];if(null!==this.name)if(this.params.length){var e,g;e=this.params;g=[];for(b in e)f=e[b],g.push([b,f].join("="));b=g.join(" ");this.name in
this.params?c.push("["+b+"]"):c.push("["+this.name+" "+b+"]")}else c.push("["+this.name+"]");c.push(this.getContent(!a));null!==this.name&&(d=this.name,0>p.call(this.CLOSED_BY,d))&&c.push("[/"+this.name+"]");return c.join("")};a.prototype._toHTML=function(){return this.toText(!0)};a.prototype.toHTML=function(){var b;b=this._toHTML();return"string"===typeof b?b:b.join("")};return a}();g=function(b){function a(){a.__super__.constructor.apply(this,arguments);this.STRIP_INNER=!0;this._inline="inline"===
this.params.code;this._inline||(this.STRIP_OUTER=!0)}k(a,b);a.prototype._toHTML=function(){var b;return this._inline?["<code>",this.getContent(!0),"</code>"]:(b=this.params.lang||this.params[this.name])?['<pre class="prettyprint lang-'+b+'">',this.getContent(!0),"</pre>"]:["<pre>",this.getContent(!0),"</pre>"]};return a}(this.bbcode.Tag);f=function(b){function a(){return a.__super__.constructor.apply(this,arguments)}k(a,b);a.prototype._toHTML=function(){var b;b={src:this.renderer.strip(this.getContent(!0))};

@@ -14,4 +14,4 @@ "width"in this.params&&(b.width=this.params.width);"height"in this.params&&(b.height=this.params.height);return"<img "+this.renderer.htmlAttributes(b)+" />"};return a}(this.bbcode.Tag);m=function(b){function a(){return a.__super__.constructor.apply(this,arguments)}k(a,b);a.prototype._toHTML=function(){var b;b=this.params.size;return isNaN(b)?this.getContent():['<span style="font-size:'+b+'px">',this.getContent(),"</span>"]};return a}(this.bbcode.Tag);c=function(b){function a(){return a.__super__.constructor.apply(this,

"</ol>"]:"a"===a?['<ol style="list-style-type:lower-alpha;">',this.getContent(),"</ol>"]:"A"===a?['<ol style="list-style-type:upper-alpha;">',this.getContent(),"</ol>"]:["<ul>",this.getContent(),"</ul>"]};return a}(this.bbcode.Tag);a=function(a){function b(){b.__super__.constructor.apply(this,arguments);this.CLOSED_BY=["*","/list"];this.STRIP_INNER=!0}k(b,a);b.prototype._toHTML=function(){return["<li>",this.getContent(),"</li>"]};return b}(this.bbcode.Tag);v=function(a){function b(){b.__super__.constructor.apply(this,
arguments);this.STRIP_OUTER=this.STRIP_INNER=!0}k(b,a);b.prototype._toHTML=function(){var a,b;b=["<blockquote>",this.getContent()];if(a=this.params.quote)b.push("<small>"),b.push(a),b.push("</small>");b.push("</blockquote>");return b};return b}(this.bbcode.Tag);e=function(b){function a(){return a.__super__.constructor.apply(this,arguments)}k(a,b);a.prototype._toHTML=function(){var a;a=this.renderer.strip(this.params[this.name]||this.getContent(!0));/javascript:/i.test(a)&&(a="");return a?this.renderer.context({linkify:!1},
function(b){return function(){return['<a href="'+a+'" target="_blank">',b.getContent(),"</a>"]}}(this)):this.getContent()};return a}(this.bbcode.Tag);this.bbcode.createSimpleTag=function(a){return function(b,c){return function(a){function d(){var a,b;d.__super__.constructor.apply(this,arguments);for(a in c)b=c[a],this[a]=b}k(d,a);d.prototype._toHTML=function(){var a;(a=this.renderer.htmlAttributes(this.params))&&(a=" "+a);return["<"+b+a+">",this.getContent(),"</"+b+">"]};return d}(a.bbcode.Tag)}}(this);
arguments);this.STRIP_OUTER=this.STRIP_INNER=!0}k(b,a);b.prototype._toHTML=function(){var b,a;a=["<blockquote>",this.getContent()];if(b=this.params.quote)a.push("<small>"),a.push(b),a.push("</small>");a.push("</blockquote>");return a};return b}(this.bbcode.Tag);e=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}k(b,a);b.prototype._toHTML=function(){var a;a=this.renderer.strip(this.params[this.name]||this.getContent(!0));/javascript:/i.test(a)&&(a="");return a?this.renderer.context({linkify:!1},
function(b){return function(){return['<a href="'+a+'" target="_blank">',b.getContent(),"</a>"]}}(this)):this.getContent()};return b}(this.bbcode.Tag);this.bbcode.createSimpleTag=function(a){return function(b,c){return function(a){function d(){var a,b;d.__super__.constructor.apply(this,arguments);for(a in c)b=c[a],this[a]=b}k(d,a);d.prototype._toHTML=function(){var a;(a=this.renderer.htmlAttributes(this.params))&&(a=" "+a);return["<"+b+a+">",this.getContent(),"</"+b+">"]};return d}(a.bbcode.Tag)}}(this);
this.bbcode.BUILTIN={b:this.bbcode.createSimpleTag("strong"),i:this.bbcode.createSimpleTag("em"),u:this.bbcode.createSimpleTag("u"),s:this.bbcode.createSimpleTag("strike"),h1:this.bbcode.createSimpleTag("h1",{STRIP_OUTER:!0}),h2:this.bbcode.createSimpleTag("h2",{STRIP_OUTER:!0}),h3:this.bbcode.createSimpleTag("h3",{STRIP_OUTER:!0}),h4:this.bbcode.createSimpleTag("h4",{STRIP_OUTER:!0}),h5:this.bbcode.createSimpleTag("h5",{STRIP_OUTER:!0}),h6:this.bbcode.createSimpleTag("h6",{STRIP_OUTER:!0}),pre:this.bbcode.createSimpleTag("pre"),

@@ -18,0 +18,0 @@ table:this.bbcode.createSimpleTag("table",{DISCARD_TEXT:!0}),thead:this.bbcode.createSimpleTag("thead",{DISCARD_TEXT:!0}),tbody:this.bbcode.createSimpleTag("tbody",{DISCARD_TEXT:!0}),tr:this.bbcode.createSimpleTag("tr",{DISCARD_TEXT:!0}),th:this.bbcode.createSimpleTag("th"),td:this.bbcode.createSimpleTag("td"),code:g,img:f,hr:d,size:m,center:l,right:w,color:c,list:b,"*":a,quote:v,url:e,link:e}}).call(this);

{
"name": "bbcodejs",
"version": "0.0.3",
"version": "0.0.4",
"description": "BBCODE.JS =========",

@@ -5,0 +5,0 @@ "main": "bbcode.js",

@@ -38,7 +38,9 @@ // Generated by CoffeeScript 1.9.1

this.bbcode.Renderer = (function() {
function Renderer() {
this._contexts = [];
this.options = {
linkify: true
};
function Renderer(options) {
options = options || {};
this._contexts = [];
this.options = {
linkify: !!options.linkify
};
}

@@ -45,0 +47,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc