var Video = function(){};
var a = new Video();
a.ex = function(obj){
var config = {
Width:"800",
Height:"400",
Src:"",
Type:"flv",
unit:'px'
};
a.d = obj? $.extend(config,obj):config;
};
a.genereteHtml = function(){
var d = a.d;
var type = a.d.Type;
var width = d.Width+d.unit,height = d.Height+d.unit;
console.log(width,height);
if(type == 'mp4'){
var html = '
';
html += '
';
html += '
';
}else{
var html = '
';
html += '
';
html += '
';
}
return html;
};
a.countCss = function(){
var d = a.d;
var css = {
width: d.Width+d.unit,
height: d.Height+d.unit
};
var mar = '-'+ (d.Height/2)+d.unit+' 0 0 -'+(d.Width/2)+d.unit;
$(".AlertVideo-main").css(css)
$(".AlertVideo").css("margin",mar)
};
a.closedVideo = function(){
$(".Alert-cover").remove();
$("#AlertVideo").remove();
a.isShow = false;
};
a.isShow = false;
a.showVideo = function(){
if(a.isShow){return false}
var html = a.genereteHtml();
$("body").append(html);
a.countCss();
a.isShow = true;
};
a.Init = function(obj){
a.ex(obj);
a.showVideo();
};
$.fn.extend({
insertVideo:function(obj){
$(this).click(function(){
a.Init(obj)
})
}
})