From 4c9380e176efe355b446fb5940db8b2d9a80dff1 Mon Sep 17 00:00:00 2001 From: Zac Colley Date: Thu, 13 Nov 2014 22:38:14 +0000 Subject: [PATCH] Regex and matching for Soundcloud track URLS --- app/js/services.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/js/services.js b/app/js/services.js index 628417b0..f1a87b7b 100644 --- a/app/js/services.js +++ b/app/js/services.js @@ -3121,6 +3121,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) var twitterRegex = /https?:\/\/twitter\.com\/.+?\/status\/\d+/i; var facebookRegex = /https?:\/\/(?:www\.)?facebook\.com\/.+?\/posts\/\d+/i; var gplusRegex = /https?:\/\/plus\.google\.com\/\d+\/posts\/[a-zA-Z0-9\-\_]+/i; + var soundcloudRegex = /https?:\/\/(soundcloud.com|snd.sc)\/[a-zA-Z0-9\-\_]+\/[a-zA-Z0-9\-\_]+/i; return { wrapRichText: wrapRichText, @@ -3266,6 +3267,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) else if (embedUrlMatches = text.match(vineRegex)) { return ['vine', embedUrlMatches[1]]; } + else if (embedUrlMatches = text.match(soundcloudRegex)) { + return ['soundcloud', embedUrlMatches[0]]; + } if (!Config.Modes.chrome_packed) { // Need external JS if (embedUrlMatches = text.match(twitterRegex)) {