|
|
@ -1721,6 +1721,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
|
|
|
|
|
|
|
|
if (message.message && message.message.length) { |
|
|
|
if (message.message && message.message.length) { |
|
|
|
message.richMessage = RichTextProcessor.wrapRichText(message.message); |
|
|
|
message.richMessage = RichTextProcessor.wrapRichText(message.message); |
|
|
|
|
|
|
|
if (!Config.Navigator.mobile) { |
|
|
|
|
|
|
|
message.richUrlEmbed = RichTextProcessor.extractExternalEmbed(message.message); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return messagesForHistory[msgID] = message; |
|
|
|
return messagesForHistory[msgID] = message; |
|
|
@ -3062,7 +3065,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
.service('RichTextProcessor', function ($sce, $sanitize, ExternalResourcesManager) { |
|
|
|
.service('RichTextProcessor', function ($sce, $sanitize) { |
|
|
|
|
|
|
|
|
|
|
|
var emojiUtf = [], |
|
|
|
var emojiUtf = [], |
|
|
|
emojiMap = {}, |
|
|
|
emojiMap = {}, |
|
|
@ -3111,7 +3114,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
wrapRichText: wrapRichText, |
|
|
|
wrapRichText: wrapRichText, |
|
|
|
wrapPlainText: wrapPlainText |
|
|
|
wrapPlainText: wrapPlainText, |
|
|
|
|
|
|
|
extractExternalEmbed: extractExternalEmbed |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
function getEmojiSpritesheetCoords(emojiCode) { |
|
|
|
function getEmojiSpritesheetCoords(emojiCode) { |
|
|
@ -3233,35 +3237,27 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
'<span class="emoji emoji-spritesheet-$1" style="background-position: -$2px -$3px;" $4</span>'); |
|
|
|
'<span class="emoji emoji-spritesheet-$1" style="background-position: -$2px -$3px;" $4</span>'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// console.log(4, text, html);
|
|
|
|
return $sce.trustAs('html', text); |
|
|
|
if (!options.noLinks && !Config.Navigator.mobile) { |
|
|
|
} |
|
|
|
var embedUrlMatches, |
|
|
|
|
|
|
|
embedTag = Config.Modes.chrome_packed ? 'webview' : 'iframe'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (embedUrlMatches = text.match(youtubeRegex)) { |
|
|
|
function extractExternalEmbed (text) { |
|
|
|
var videoID = embedUrlMatches[1] |
|
|
|
var embedUrlMatches, |
|
|
|
text = text + '<div class="im_message_media_embed im_message_video_embed"><' + embedTag + ' type="text/html" frameborder="0" ' + |
|
|
|
result; |
|
|
|
'src="//www.youtube.com/embed/' + videoID + |
|
|
|
|
|
|
|
'?autoplay=0&controls=2"></' + embedTag + '></div>' |
|
|
|
if (embedUrlMatches = text.match(youtubeRegex)) { |
|
|
|
} |
|
|
|
return ['youtube', embedUrlMatches[1]]; |
|
|
|
else if (embedUrlMatches = text.match(instagramRegex)) { |
|
|
|
} |
|
|
|
var instaID = embedUrlMatches[1]; |
|
|
|
else if (embedUrlMatches = text.match(instagramRegex)) { |
|
|
|
text = text + '<div class="im_message_media_embed im_message_insta_embed"><' + embedTag + ' type="text/html" frameborder="0" ' + |
|
|
|
return ['instagram', embedUrlMatches[1]]; |
|
|
|
'src="//instagram.com/p/' + instaID + |
|
|
|
} |
|
|
|
'/embed/"></' + embedTag + '></div>'; |
|
|
|
else if (embedUrlMatches = text.match(vineRegex)) { |
|
|
|
} |
|
|
|
return ['vine', embedUrlMatches[1]]; |
|
|
|
else if (embedUrlMatches = text.match(vineRegex)) { |
|
|
|
} |
|
|
|
var vineID = embedUrlMatches[1]; |
|
|
|
else if (embedUrlMatches = !Config.Modes.chrome_packed && text.match(twitterRegex)) { |
|
|
|
text = text + '<div class="im_message_media_embed im_message_vine_embed"><' + embedTag + ' type="text/html" frameborder="0" ' + |
|
|
|
return ['twitter', embedUrlMatches[0]]; |
|
|
|
'src="//vine.co/v/' + vineID + '/embed/simple"></' + embedTag + '></div>'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (embedUrlMatches = !Config.Modes.chrome_packed && text.match(twitterRegex)) { |
|
|
|
|
|
|
|
text = text + '<div class="im_message_twitter_embed"><blockquote class="twitter-tweet" lang="en"><a href="' + embedUrlMatches[0] + '"></a></blockquote></div>'; |
|
|
|
|
|
|
|
onContentLoaded(ExternalResourcesManager.attachTwitterScript); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $sce.trustAs('html', text); |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function wrapPlainText (text, options) { |
|
|
|
function wrapPlainText (text, options) { |
|
|
|