470 return buf; |
470 return buf; |
471 } |
471 } |
472 |
472 |
473 function convertTag(tag, fulltag, tagContent) { |
473 function convertTag(tag, fulltag, tagContent) { |
474 tag = tag.toLowerCase(); |
474 tag = tag.toLowerCase(); |
|
475 var param = null; |
|
476 var eqsign = fulltag.indexOf("="); // onclick=\"openURL('" + item.url + "'); |
|
477 if (eqsign > -1) { |
|
478 param = fulltag.substring(eqsign+1); |
|
479 } |
475 switch(tag) { |
480 switch(tag) { |
|
481 case '*': return bbcode2html(tagContent); |
476 case 'b':case 'i':case 'u':case 's':case 'sup':case 'sub':case 'h1':case 'h2':case 'h3':case 'h4':case 'h5':case 'h6':case 'table':case 'tr':case 'th':case 'td': |
482 case 'b':case 'i':case 'u':case 's':case 'sup':case 'sub':case 'h1':case 'h2':case 'h3':case 'h4':case 'h5':case 'h6':case 'table':case 'tr':case 'th':case 'td': |
477 { |
483 { |
478 return '<' + tag + '>' + tagContent + "</" + tag + ">"; |
484 return '<' + tag + '>' + bbcode2html(tagContent) + "</" + tag + ">"; |
479 } |
485 } |
480 case 'quote': return '<blockquote><i>' + tagContent + '</i></blockquote>'; |
486 case 'font': return '<font face="'+param+'">' + bbcode2html(tagContent) + '</font>'; |
|
487 case 'size': return '<font size="'+param+'">' + bbcode2html(tagContent) + '</font>'; |
|
488 case 'color': return '<font color="'+param+'">' + bbcode2html(tagContent) + '</font>'; |
|
489 case 'left': return '<div align="left">' + bbcode2html(tagContent) + '</div>'; |
|
490 case 'right': return '<div align="right">' + bbcode2html(tagContent) + '</div>'; |
|
491 case 'center': return '<div align="center">' + bbcode2html(tagContent) + '</div>'; |
|
492 case 'list': return tagContent; // todo |
|
493 case 'php': |
|
494 case 'code': return '<div class=codebox><code>' + tagContent + '</code></div>'; |
|
495 case 'html':{ |
|
496 var escaped = tagContent.replace(/</g, "<").replace(/>/g, ">"); |
|
497 return '<div class=codebox><code>' + escaped + '</code></div>'; |
|
498 } |
|
499 case 'quote': return '<div class=codebox><b>Quote:</b><br><i>' + tagContent + '</i></div>'; |
481 case 'url': { |
500 case 'url': { |
482 var eqsign = fulltag.indexOf("="); // onclick=\"openURL('" + item.url + "'); |
|
483 if ( eqsign > -1 ) { |
501 if ( eqsign > -1 ) { |
484 return "<div class=\"FeedItemLink\"><a href=\"JavaScript:void(0)\" onclick=\"openURL( '" |
502 return "<div class=\"FeedItemLink\"><a href=\"JavaScript:void(0)\" onclick=\"openURL( '" |
485 + fulltag.substring(eqsign+1) |
503 + param |
486 + "')\" ><i>" |
504 + "')\" ><i>" |
487 + tagContent |
505 + tagContent |
488 + '</i></a></div>'; |
506 + '</i></a></div>'; |
489 } else { |
507 } else { |
490 return "<div class=\"FeedItemLink\"><a href=\"JavaScript:void(0)\" onclick=\"openURL( '" |
508 return "<div class=\"FeedItemLink\"><a href=\"JavaScript:void(0)\" onclick=\"openURL( '" |