Browse Source

Merge pull request #738 from learnlearnin/fbRegEx

More regexes for Facebook
master
Igor Zhukov 10 years ago
parent
commit
b04b718490
  1. 5
      app/js/services.js

5
app/js/services.js

@ -3814,7 +3814,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -3814,7 +3814,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;
@ -4058,6 +4058,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -4058,6 +4058,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.

Loading…
Cancel
Save