You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
3.0 KiB
JavaScript

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

function loadjscssfile(filename,filetype){
if(filetype == "js"){
var fileref = document.createElement('script');
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src",filename);
}else if(filetype == "css"){
var fileref = document.createElement('link');
fileref.setAttribute("rel","stylesheet");
fileref.setAttribute("type","text/css");
fileref.setAttribute("href",filename);
}
if(typeof fileref != "undefined"){
document.getElementsByTagName("head")[0].appendChild(fileref);
}
}
function getVars(Parameter)
{
var vars = [], hash;
var hashes = Parameter.substring(Parameter.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
if ( typeof jQuery == 'undefined' ) {
loadjscssfile("https://data.chinahighlights.com/js/jquery-1.8.2.min.js","js");
}
loadjscssfile("https://data.chinahighlights.com/video/ckplayer/ckplayer.js","js");
function resizeVideoJS(){
var aspectRatio = 3/4; // Make up an aspect ratio
var v_width =document.getElementById('jsvideoa1').parentElement.offsetWidth;
var v_height = v_width * aspectRatio;
CKobject.getObjectById('jsvideo_jsvideoa1').width=v_width;
  CKobject.getObjectById('jsvideo_jsvideoa1').height=v_height;
}
function loadedHandler(){
if(CKobject.getObjectById('jsvideo_jsvideoa1').getType()){
$('#jsvideoa1').click(function(event) {
var playstatus = CKobject.getObjectById('jsvideo_jsvideoa1').getStatus();
if(playstatus.play !== true){
CKobject.getObjectById('jsvideo_jsvideoa1').videoPlay();
}else{
CKobject.getObjectById('jsvideo_jsvideoa1').videoPause();
}
});
}else{
resizeVideoJS();
window.onresize = resizeVideoJS;
}
}
$(function(){
// $("#js_chtvideo").after('<div id="jsvideoa1"></div>');
// chkVideo();
});
//判断加载
function chkVideo()
{
vstate=false;
if(typeof CKobject != 'undefined'){
vstate=true;
var obj=document.getElementById("js_chtvideo");
var arr=getVars(obj.getAttribute("data"));
var v_width=arr["v_width"];
var v_height=arr["v_height"];
var v_url=arr["v_url"];
var v_image=arr["v_image"];
var v_adimage=arr["v_adimage"];
var v_adurl=arr["v_adurl"];
var v_type=arr["v_type"];
var v_sn=arr["v_sn"];
var v_t=arr["t"];
var v_sourc=arr["sourc"];
var video_str="";
var flashvars={
f:v_url,
c:0,
i:v_image,
m:1,
loaded:'loadedHandler'
};
var params={bgcolor:'#FFF',allowFullScreen:true,allowScriptAccess:'always',wmode:'transparent'};
var video=[v_url+'->video/mp4'];
CKobject.embed('//www.chinahighlights.com/video/ckplayer/ckplayer.swf','jsvideoa1','jsvideo_jsvideoa1','100%','100%',false,flashvars,video,params);
}
if(vstate){return;}
stopt=setTimeout("chkVideo()", 1000);
}
$("#js_chtvideo").after('<div id="jsvideoa1"></div>');
chkVideo();