Commit b9ee897d authored by 杨培's avatar 杨培

调整视频播放JS位置

parent 52249dfc
...@@ -95,40 +95,3 @@ function EmpireCMSShowJwplayer(furl,width,height,autostart,baseurl){ ...@@ -95,40 +95,3 @@ function EmpireCMSShowJwplayer(furl,width,height,autostart,baseurl){
str='<scri'+'pt type="text/javascript" src="'+baseurl+'e/data/modadd/moreplayer/jwplayer/jwplayer.js"></scri'+'pt><div id="EmpireCMSmyElement">Loading the player...</div><scri'+'pt type="text/javascript">jwplayer("EmpireCMSmyElement").setup({ autostart:'+autostart+',file: "'+furl+'",height:'+height+',width:'+width+' });</scri'+'pt>'; str='<scri'+'pt type="text/javascript" src="'+baseurl+'e/data/modadd/moreplayer/jwplayer/jwplayer.js"></scri'+'pt><div id="EmpireCMSmyElement">Loading the player...</div><scri'+'pt type="text/javascript">jwplayer("EmpireCMSmyElement").setup({ autostart:'+autostart+',file: "'+furl+'",height:'+height+',width:'+width+' });</scri'+'pt>';
return str; return str;
} }
if (typeof jQuery !== "undefined") {
(function($) {
//加载乐视视频
$("div.lecloud-video").each(function() {
var width = 640, height = 360, rate = width / height;
var video = createVideoElement(width, height);
$(this).replaceWith(video);
//按设定的比例调整大小
var pNode = video.parentNode,
toWidth = pNode.clientWidth >= 800 ? 800 : pNode.clientWidth,
toHeight = toWidth / rate;
setVideo(video, $(this).attr('vu'), toWidth, toHeight);
});
function createVideoElement(w, h) {
var node = document.createElement('iframe');
node.setAttribute("allowfullscreen", true);
node.setAttribute("allowtransparency", true);
node.setAttribute("frameborder", "0");
node.setAttribute("scrolling", "no");
//node.setAttribute("width", w);
//node.setAttribute("height", h);
node.style.maxWidth = "100%";
return node;
}
function setVideo(node, vu, w, h) {
node.setAttribute("width", w);
node.setAttribute("height", h);
node.src = 'http://yuntv.letv.com/bcloud.html?uu=pjseptwfce&vu=' + vu + '&pu=510360dfc7&auto_play=1&width=' + w + '&height=' + h + '&lang=zh_CN';
}
})(jQuery);
}
\ No newline at end of file
...@@ -252,3 +252,38 @@ $('#favor').click(function () { ...@@ -252,3 +252,38 @@ $('#favor').click(function () {
} }
}, 'json'); }, 'json');
}); });
(function($) {
//加载乐视视频
$("div.lecloud-video").each(function() {
var width = 640, height = 360, rate = width / height;
var video = createVideoElement(width, height);
$(this).replaceWith(video);
//按设定的比例调整大小
var pNode = video.parentNode,
toWidth = pNode.clientWidth >= 800 ? 800 : pNode.clientWidth,
toHeight = toWidth / rate;
setVideo(video, $(this).attr('vu'), toWidth, toHeight);
});
function createVideoElement(w, h) {
var node = document.createElement('iframe');
node.setAttribute("allowfullscreen", true);
node.setAttribute("allowtransparency", true);
node.setAttribute("frameborder", "0");
node.setAttribute("scrolling", "no");
//node.setAttribute("width", w);
//node.setAttribute("height", h);
node.style.maxWidth = "100%";
return node;
}
function setVideo(node, vu, w, h) {
node.setAttribute("width", w);
node.setAttribute("height", h);
node.src = 'http://yuntv.letv.com/bcloud.html?uu=pjseptwfce&vu=' + vu + '&pu=510360dfc7&auto_play=1&width=' + w + '&height=' + h + '&lang=zh_CN';
}
})(jQuery);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment