plugins: (youtube) make video preview slicker

This commit is contained in:
Vivien Didelot 2013-10-17 16:11:31 -04:00
parent 9cd637704e
commit ea65c5dc44

View file

@ -127,20 +127,28 @@ plugins.factory('userPlugins', function() {
var urlRegexp = RegExp(/(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])?/);
/*
* YouTube Embedded Player
*
* See: https://developers.google.com/youtube/player_parameters
*/
var youtubePlugin = new Plugin(function(message) {
var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;
var match = message.match(regExp);
if (match && match[7].length==11){
var token = match[7];
var embedurl = "http://www.youtube.com/embed/" + token+ "?html5=1&autoplay=0&theme=dark&color=black&iv_load_policy=3";
var embedurl = "http://www.youtube.com/embed/" + token + "?html5=1&iv_load_policy=3&modestbranding=1&rel=0&showinfo=0";
return '<iframe width="560" height="315" src="'+ embedurl + '" frameborder="0" allowfullscreen frameborder="0"></iframe>';
}
return null;
});
youtubePlugin.name = 'youtube video';
youtubePlugin.name = 'YouTube video';
/*
* Image Preview
*/
var imagePlugin = new Plugin(function(message) {
var url = message.match(urlRegexp);