From 4078df09d7e704d681bea0982ebf6fefae8cc12d Mon Sep 17 00:00:00 2001 From: Akshay S Dinesh Date: Mon, 23 Mar 2015 03:51:26 +0530 Subject: [PATCH] more regexes for facebook --- app/js/services.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/js/services.js b/app/js/services.js index 8f8c1d9c..ee46c2fc 100755 --- a/app/js/services.js +++ b/app/js/services.js @@ -3813,7 +3813,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) var instagramRegex = /^https?:\/\/(?:instagr\.am\/p\/|instagram\.com\/p\/)([a-zA-Z0-9\-\_]+)/i; var vineRegex = /^https?:\/\/vine\.co\/v\/([a-zA-Z0-9\-\_]+)/i; var twitterRegex = /^https?:\/\/twitter\.com\/.+?\/status\/\d+/i; - var facebookRegex = /^https?:\/\/(?:www\.)?facebook\.com\/.+?\/posts\/\d+/i; + var facebookRegex = /^https?:\/\/(?:www\.|m\.)?facebook\.com\/(?:.+?\/posts\/\d+|(?:story\.php|permalink\.php)\?story_fbid=(\d+)(?:&substory_index=\d+)?&id=(\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; var spotifyRegex = /(https?:\/\/(open\.spotify\.com|play\.spotify\.com|spoti\.fi)\/(.+)|spotify:(.+))/i; @@ -4057,6 +4057,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) return ['twitter', embedUrlMatches[0]]; } else if (embedUrlMatches = url.match(facebookRegex)) { + if (embedUrlMatches[2]!= undefined){ + return ['facebook', "https://www.facebook.com/"+embedUrlMatches[2]+"/posts/"+embedUrlMatches[1]]; + } return ['facebook', embedUrlMatches[0]]; } // Sorry, GPlus widget has no `xfbml.render` like callback and is too wide.