plugins: (youtube) make video preview slicker
This commit is contained in:
parent
9cd637704e
commit
ea65c5dc44
1 changed files with 10 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue