|
|
|
@ -157,7 +157,7 @@ function htmlFormatMsg( msg, output, mentions ) {
@@ -157,7 +157,7 @@ function htmlFormatMsg( msg, output, mentions ) {
|
|
|
|
|
if( match ) { |
|
|
|
|
index = (match[0] === match[1]) ? match.index : match.index + 1; |
|
|
|
|
if( match[1] == "@" ) { |
|
|
|
|
output.append($.emotions(msg.substr(0, index))); |
|
|
|
|
output.append(_parseText(msg.substr(0, index))); |
|
|
|
|
tmp = msg.substr(index+1); |
|
|
|
|
var username = _extractUsername(tmp); |
|
|
|
|
if( username.length ) { |
|
|
|
@ -177,7 +177,7 @@ function htmlFormatMsg( msg, output, mentions ) {
@@ -177,7 +177,7 @@ function htmlFormatMsg( msg, output, mentions ) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if( reHttp.exec(match[1]) ) { |
|
|
|
|
output.append($.emotions(msg.substr(0, index))); |
|
|
|
|
output.append(_parseText(msg.substr(0, index))); |
|
|
|
|
tmp = msg.substring(index); |
|
|
|
|
var space = tmp.indexOf(" "); |
|
|
|
|
var url; |
|
|
|
@ -195,7 +195,7 @@ function htmlFormatMsg( msg, output, mentions ) {
@@ -195,7 +195,7 @@ function htmlFormatMsg( msg, output, mentions ) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if( reEmail.exec(match[1]) ) { |
|
|
|
|
output.append($.emotions(msg.substr(0, index))); |
|
|
|
|
output.append(_parseText(msg.substr(0, index))); |
|
|
|
|
tmp = msg.substring(index); |
|
|
|
|
var space = tmp.indexOf(" "); |
|
|
|
|
var email; |
|
|
|
@ -213,7 +213,7 @@ function htmlFormatMsg( msg, output, mentions ) {
@@ -213,7 +213,7 @@ function htmlFormatMsg( msg, output, mentions ) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if( match[1] == "#" ) { |
|
|
|
|
output.append($.emotions(msg.substr(0, index))); |
|
|
|
|
output.append(_parseText(msg.substr(0, index))); |
|
|
|
|
tmp = msg.substr(index+1); |
|
|
|
|
var hashtag = _extractHashtag(tmp); |
|
|
|
|
if( hashtag.length ) { |
|
|
|
@ -231,11 +231,19 @@ function htmlFormatMsg( msg, output, mentions ) {
@@ -231,11 +231,19 @@ function htmlFormatMsg( msg, output, mentions ) {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
output.append($.emotions(msg)); |
|
|
|
|
output.append(_parseText(msg)); |
|
|
|
|
msg = ""; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function _parseText(text) |
|
|
|
|
{ |
|
|
|
|
text = unescapeHtmlEntities(text); |
|
|
|
|
text = $.emotions(text); |
|
|
|
|
text = escapeHtmlEntities(text); |
|
|
|
|
return text; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// internal function for htmlFormatMsg
|
|
|
|
|
function _extractUsername(s) { |
|
|
|
|
var username = ""; |
|
|
|
@ -270,3 +278,7 @@ function escapeHtmlEntities(str) {
@@ -270,3 +278,7 @@ function escapeHtmlEntities(str) {
|
|
|
|
|
return str.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, '''); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function unescapeHtmlEntities(str) { |
|
|
|
|
return str.replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, '&'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|