Browse Source

revert some codes back

master
Denis Ryabov 10 years ago
parent
commit
15036dbbad
  1. 21
      js/twister_formatpost.js

21
js/twister_formatpost.js

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

Loading…
Cancel
Save