From 59479ea406cf39d13a13843cec719e969298f161 Mon Sep 17 00:00:00 2001 From: Madh93 Date: Tue, 14 Oct 2014 21:31:09 +0100 Subject: [PATCH 1/3] Added /?#/ and /#/ --- app/js/services.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/js/services.js b/app/js/services.js index c7fc6d87..3680d237 100644 --- a/app/js/services.js +++ b/app/js/services.js @@ -3182,7 +3182,7 @@ angular.module('myApp.services', ['myApp.i18n']) var regexAlphaNumericChars = "0-9\.\_" + regexAlphaChars; var regExp = new RegExp('((?:(ftp|https?)://|(?:mailto:)?([A-Za-z0-9._%+-]+@))(\\S*\\.\\S*[^\\s.;,(){}<>"\']))|(\\n)|(' + emojiUtf.join('|') + ')|(^|\\s)(#[' + regexAlphaNumericChars + ']{3,20})', 'i'); - var youtubeRegex = /(?:https?:\/\/)?(?:www\.)?youtu(?:|.be|be.com|.b)(?:\/v\/|\/watch\\?v=|e\/|\/watch(?:.+)v=)(.{11})(?:\&[^\s]*)?/; + var youtubeRegex = /(?:https?:\/\/)?(?:www\.)?youtu(?:|.be|be.com|.b)(?:\/v\/|\/watch\\?v=|e\/|(\/(\?#|#))?\/watch(?:.+)v=)(.{11})(?:\&[^\s]*)?/; return { wrapRichText: wrapRichText, From bc5a03c99a05bda59596300cc791bcc9c33084db Mon Sep 17 00:00:00 2001 From: Madh93 Date: Tue, 14 Oct 2014 21:32:47 +0100 Subject: [PATCH 2/3] VideoID is equal to last youtubeMatches --- app/js/services.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/js/services.js b/app/js/services.js index 3680d237..c3dddbc2 100644 --- a/app/js/services.js +++ b/app/js/services.js @@ -3321,7 +3321,7 @@ angular.module('myApp.services', ['myApp.i18n']) // console.log(4, text, html); if (!options.noLinks) { var youtubeMatches = text.match(youtubeRegex), - videoID = youtubeMatches && youtubeMatches[1]; + videoID = youtubeMatches && youtubeMatches[youtubeMatches.length-1]; if (videoID) { var tag = Config.Modes.chrome_packed ? 'webview' : 'iframe'; From a5fd4198630b6abca5dffc9f1126db5ebee33397 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Wed, 15 Oct 2014 15:50:15 +0400 Subject: [PATCH 3/3] Added no-capture prefix for youtube --- app/js/services.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/js/services.js b/app/js/services.js index c3dddbc2..979734cc 100644 --- a/app/js/services.js +++ b/app/js/services.js @@ -3182,7 +3182,7 @@ angular.module('myApp.services', ['myApp.i18n']) var regexAlphaNumericChars = "0-9\.\_" + regexAlphaChars; var regExp = new RegExp('((?:(ftp|https?)://|(?:mailto:)?([A-Za-z0-9._%+-]+@))(\\S*\\.\\S*[^\\s.;,(){}<>"\']))|(\\n)|(' + emojiUtf.join('|') + ')|(^|\\s)(#[' + regexAlphaNumericChars + ']{3,20})', 'i'); - var youtubeRegex = /(?:https?:\/\/)?(?:www\.)?youtu(?:|.be|be.com|.b)(?:\/v\/|\/watch\\?v=|e\/|(\/(\?#|#))?\/watch(?:.+)v=)(.{11})(?:\&[^\s]*)?/; + var youtubeRegex = /(?:https?:\/\/)?(?:www\.)?youtu(?:|.be|be.com|.b)(?:\/v\/|\/watch\\?v=|e\/|(?:\/\??#)?\/watch(?:.+)v=)(.{11})(?:\&[^\s]*)?/; return { wrapRichText: wrapRichText, @@ -3321,7 +3321,7 @@ angular.module('myApp.services', ['myApp.i18n']) // console.log(4, text, html); if (!options.noLinks) { var youtubeMatches = text.match(youtubeRegex), - videoID = youtubeMatches && youtubeMatches[youtubeMatches.length-1]; + videoID = youtubeMatches && youtubeMatches[1]; if (videoID) { var tag = Config.Modes.chrome_packed ? 'webview' : 'iframe';