Created
February 16, 2015 22:46
-
-
Save IPRIT/c3b4295453ee8ed3abcd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
else if (match[4]) { // URL & e-mail | |
if (!options.noLinks) { | |
var matchEmojiInURL; | |
if (match[4].match(emojiRegex)) { | |
if (matchEmojiInURL = match[4].match(emojiRegex)) { | |
if ((emojiCode = emojiMap[matchEmojiInURL[0]]) && | |
(emojiCoords = getEmojiSpritesheetCoords(emojiCode))) { | |
emojiTitle = encodeEntities(emojiData[emojiCode][1][0]); | |
emojiFound = true; | |
html.push(encodeEntities(match[0].substr(0, matchEmojiInURL.index))); | |
html.push( | |
'<span class="emoji emoji-', | |
emojiCoords.category, | |
'-', | |
(emojiIconSize * emojiCoords.column), | |
'-', | |
(emojiIconSize * emojiCoords.row), | |
'" ', | |
'title="',emojiTitle, '">', | |
':', emojiTitle, ':</span>' | |
); | |
html.push(encodeEntities(match[0].substr(matchEmojiInURL.index + matchEmojiInURL[0].length, match[0].length))); | |
} else { | |
html.push(encodeEntities(matchEmojiInURL[0])); | |
} | |
} | |
} else { | |
if (emailRegex.test(match[4])) { | |
html.push( | |
'<a href="', | |
encodeEntities('mailto:' + match[4]), | |
'" target="_blank">', | |
encodeEntities(match[4]), | |
'</a>' | |
); | |
} else { | |
var url = false, | |
protocol = match[5], | |
tld = match[6], | |
excluded = ''; | |
if (tld) { | |
if (!protocol && (tld.substr(0, 4) === 'xn--' || Config.TLD.indexOf(tld.toLowerCase()) !== -1)) { | |
protocol = 'http://'; | |
} | |
if (protocol) { | |
var balanced = checkBrackets(match[4]); | |
if (balanced.length !== match[4].length) { | |
excluded = match[4].substring(balanced.length); | |
match[4] = balanced; | |
} | |
url = (match[5] ? '' : protocol) + match[4]; | |
} | |
} else { // IP address | |
url = (match[5] ? '' : 'http://') + match[4]; | |
} | |
if (url) { | |
html.push( | |
'<a href="', | |
encodeEntities(url), | |
'" target="_blank">', | |
encodeEntities(match[4]), | |
'</a>', | |
excluded | |
); | |
if (options.extractUrlEmbed && | |
!options.extractedUrlEmbed) { | |
options.extractedUrlEmbed = findExternalEmbed(url); | |
} | |
} else { | |
html.push(encodeEntities(match[0])); | |
} | |
} | |
} | |
} else { | |
html.push(encodeEntities(match[0])); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment