/* * Javascript BBCode Parser Config Options * @author Philip Nicolcev * @license MIT License */ var parserColors = [ 'gray', 'silver', 'white', 'yellow', 'orange', 'red', 'fuchsia', 'blue', 'green', 'black', '#cd38d9' ]; var parserTags = { 'b': { openTag: function(params,content) { return ''; }, closeTag: function(params,content) { return ''; } }, 'code': { openTag: function(params,content) { return ''; }, closeTag: function(params,content) { return ''; }, noParse: true }, 'color': { openTag: function(params,content) { var colorCode = params.substr(1) || "inherit"; BBCodeParser.regExpAllowedColors.lastIndex = 0; BBCodeParser.regExpValidHexColors.lastIndex = 0; if ( !BBCodeParser.regExpAllowedColors.test( colorCode ) ) { if ( !BBCodeParser.regExpValidHexColors.test( colorCode ) ) { colorCode = "inherit"; } else { if (colorCode.substr(0,1) !== "#") { colorCode = "#" + colorCode; } } } return ''; }, closeTag: function(params,content) { return ''; } }, 'i': { openTag: function(params,content) { return ''; }, closeTag: function(params,content) { return ''; } }, 'img': { openTag: function(params,content) { var myUrl = content; BBCodeParser.urlPattern.lastIndex = 0; if ( !BBCodeParser.urlPattern.test( myUrl ) ) { myUrl = ""; } return ''; }, closeTag: function(params,content) { return ''; }, content: function(params,content) { return ''; } }, 'list': { openTag: function(params,content) { return ''; }, restrictChildrenTo: ["*", "li"] }, 'noparse': { openTag: function(params,content) { return ''; }, closeTag: function(params,content) { return ''; }, noParse: true }, 'quote': { openTag: function(params,content) { return '
'; }, closeTag: function(params,content) { return '
'; } }, 's': { openTag: function(params,content) { return ''; }, closeTag: function(params,content) { return ''; } }, 'size': { openTag: function(params,content) { var mySize = parseInt(params.substr(1),10) || 0; if (mySize < 10 || mySize > 20) { mySize = 'inherit'; } else { mySize = mySize + 'px'; } return ''; }, closeTag: function(params,content) { return ''; } }, 'u': { openTag: function(params,content) { return ''; }, closeTag: function(params,content) { return ''; } }, 'url': { openTag: function(params,content) { var myUrl; if (!params) { myUrl = content.replace(/<.*?>/g,""); } else { myUrl = params.substr(1); } BBCodeParser.urlPattern.lastIndex = 0; if ( !BBCodeParser.urlPattern.test( myUrl ) ) { myUrl = "#"; } BBCodeParser.urlPattern.lastIndex = 0; if ( !BBCodeParser.urlPattern.test( myUrl ) ) { myUrl = ""; } return ''; }, closeTag: function(params,content) { return ''; } }, //COMUNIC ADD BEGIN 'left': { openTag: function(params,content) { return '

'; }, closeTag: function(params,content) { return '

'; } }, 'center': { openTag: function(params,content) { return '

'; }, closeTag: function(params,content) { return '

'; } }, 'right': { openTag: function(params,content) { return '

'; }, closeTag: function(params,content) { return '

'; } }, 'justify': { openTag: function(params,content) { return '

'; }, closeTag: function(params,content) { return '

'; } }, 'ul': { openTag: function(params,content) { return ''; } }, 'ol': { openTag: function(params,content) { return '
    '; }, closeTag: function(params,content) { return '
'; } }, 'li': { openTag: function(params,content) { return '
  • '; }, closeTag: function(params,content) { return '
  • '; } }, 'sup': { openTag: function(params,content) { return ''; }, closeTag: function(params,content) { return ''; } }, 'sub': { openTag: function(params,content) { return ''; }, closeTag: function(params,content) { return ''; } }, 'ltr': { openTag: function(params,content) { return '
    '; }, closeTag: function(params,content) { return '
    '; } }, 'rtl': { openTag: function(params,content) { return '
    '; }, closeTag: function(params,content) { return '
    '; } }, 'table': { openTag: function(params,content) { return ''; }, closeTag: function(params,content) { return '
    '; } }, 'tr': { openTag: function(params,content) { return ''; }, closeTag: function(params,content) { return ''; } }, 'td': { openTag: function(params,content) { return ''; }, closeTag: function(params,content) { return ''; } }, 'hr': { openTag: function(params,content) { return '
    '; }, closeTag: function(params,content) { return ''; }, content: function(params, content){ return ''; } }, //COMUNIC ADD END };