template: 'website.editor.dialog.video',
events : _.extend({}, website.editor.Dialog.prototype.events, {
'blur input#urlvideo': 'get_video',
+ 'blur input#embedvideo': 'get_embed_video',
}),
start: function () {
this.$iframe = this.$("iframe");
return "//player.vimeo.com/video/" + video_id + "?autoplay=" + (this.$("#autoplay").is(":checked") ? 1 : 0);
case "dailymotion":
return "//www.dailymotion.com/embed/video/" + video_id + "?autoplay=" + (this.$("#autoplay").is(":checked") ? 1 : 0);
+ default:
+ return video_id;
}
},
+ get_embed_video: function () {
+ var embedvideo = this.$("input#embedvideo").val().match(/src=["']?([^"']+)["' ]?/);
+ this.$("input#urlvideo").val(embedvideo ? embedvideo[1] : "");
+ this.get_video();
+ },
get_video: function () {
var needle = this.$("input#urlvideo").val();
var video_id;
} else if (needle.indexOf(".dailymotion.") != -1) {
video_type = "dailymotion";
video_id = needle.match(/dailymotion\.[a-z]+\/(embed\/)?(video\/)?([^\/?&]+)/i)[3];
+ } else {
+ video_type = "";
+ video_id = needle;
}
this.$("#video_id").val(video_id);
<form action="#" class="form-inline">
<div class="well">
<div class="form-group">
- <label for="urlvideo">Video URL</label>
+ <label for="urlvideo" style="width: 200px;">Video URL</label>
<input type="text"
name="url"
class="form-control url"
placeholder="http://openerp.com"
value="//www.youtube.com/embed/yws1tbgNV7k"/>
<span class="text-muted">
- Youtube, Vimeo, Dailymotion
+ (Youtube, Vimeo, Dailymotion)
</span>
</div>
+ <div class="form-group">
+ <label for="urlvideo" style="width: 200px;">Html Embed Video</label>
+ <input type="text"
+ name="embed"
+ class="form-control url"
+ style="width: 400px;"
+ id="embedvideo"
+ placeholder='<iframe src="//www.youtube.com/embed/yws1tbgNV7k"></iframe>'/>
+ </div>
</div>
<div id="video-preview" style="width: 450px; margin: 0 auto;">