Browse Source

Supported G+,GH hashtags, GH mentions

master
Igor Zhukov 10 years ago
parent
commit
a3ac59a73f
  1. 18
      app/js/services.js

18
app/js/services.js

@ -2793,9 +2793,17 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
apiWebPage.title || apiWebPage.author, apiWebPage.title || apiWebPage.author,
{noLinks: true, noLinebreaks: true} {noLinks: true, noLinebreaks: true}
); );
var contextHashtag = '';
if (apiWebPage.site_name == 'GitHub') {
var matches = apiWebPage.url.match(/(https?:\/\/github\.com\/[^\/]+\/[^\/]+)/);
if (matches) {
contextHashtag = matches[0] + '/issues/{1}';
}
}
apiWebPage.rDescription = RichTextProcessor.wrapRichText( apiWebPage.rDescription = RichTextProcessor.wrapRichText(
apiWebPage.description, { apiWebPage.description, {
contextSite: apiWebPage.site_name || 'external' contextSite: apiWebPage.site_name || 'external',
contextHashtag: contextHashtag
} }
); );
@ -3936,13 +3944,15 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
var siteHashtags = { var siteHashtags = {
Telegram: '#/im?q=%23{1}', Telegram: '#/im?q=%23{1}',
Twitter: 'https://twitter.com/hashtag/{1}', Twitter: 'https://twitter.com/hashtag/{1}',
Instagram: 'https://instagram.com/explore/tags/{1}/' Instagram: 'https://instagram.com/explore/tags/{1}/',
'Google Plus': 'https://plus.google.com/explore/{1}'
}; };
var siteMentions = { var siteMentions = {
Telegram: '#/im?p=%40{1}', Telegram: '#/im?p=%40{1}',
Twitter: 'https://twitter.com/{1}', Twitter: 'https://twitter.com/{1}',
Instagram: 'https://instagram.com/{1}/' Instagram: 'https://instagram.com/{1}/',
GitHub: 'https://github.com/{1}'
}; };
return { return {
@ -4103,7 +4113,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
} }
} }
else if (match[10]) { else if (match[10]) {
var contextUrl = !options.noLinks && siteHashtags[contextSite]; var contextUrl = !options.noLinks && siteHashtags[contextSite] || options.contextHashtag;
if (contextUrl) { if (contextUrl) {
html.push( html.push(
encodeEntities(match[9]), encodeEntities(match[9]),

Loading…
Cancel
Save