+ var color_to_css = function(i) {
+ return 'color: #' +
+ ((i & 0xe0) ? 'ff' : '00') +
+ ((i & 0x1c) ? 'ff' : '00') +
+ ((i & 0x03) ? 'ff' : '00') +
+ '; ';
+ }
+ var stylize = function (txt, style) {
+ if(txt.length == 0 || style == 0) {
+ return txt
+ }
+ css = ''
+ if(style & 0x10000) css += 'font-weight: bold; ';
+ if(style & 0x20000) css += 'text-decoration: underline; ';
+ if(style & 0x40000) css += 'text-decoration: underline; '; // blink
+ if(style & 0x80000) css += 'text-decoration: line-through; '; // invisible
+ if(style & 0x000ff) css += color_to_css(style & 0xff);
+ if(style & 0x0ff00) css += 'background-' + color_to_css((style & 0xff00) >> 8);
+ return $('<span style="'+css+'"></span>').text(txt);
+ }