From a3ac59a73f20d7dc557b063ed0a914f30607145a Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Mon, 13 Apr 2015 16:48:49 +0300 Subject: [PATCH] Supported G+,GH hashtags, GH mentions --- app/js/services.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/app/js/services.js b/app/js/services.js index ac6ea1a3..2229b39c 100755 --- a/app/js/services.js +++ b/app/js/services.js @@ -2793,9 +2793,17 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) apiWebPage.title || apiWebPage.author, {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.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 = { Telegram: '#/im?q=%23{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 = { Telegram: '#/im?p=%40{1}', Twitter: 'https://twitter.com/{1}', - Instagram: 'https://instagram.com/{1}/' + Instagram: 'https://instagram.com/{1}/', + GitHub: 'https://github.com/{1}' }; return { @@ -4103,7 +4113,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) } } else if (match[10]) { - var contextUrl = !options.noLinks && siteHashtags[contextSite]; + var contextUrl = !options.noLinks && siteHashtags[contextSite] || options.contextHashtag; if (contextUrl) { html.push( encodeEntities(match[9]),