中国公共关系讲坛:从历史到未来的中国公共关系
更新时间:2023-02-15
// if (window.jQuery) {
// $('#video_play_20200520_136').bind('contextmenu',function() { return false; });
// }
if ('video' == document.getElementById('video_play_20200520_136').tagName.toLowerCase()) {
if (!document.getElementById('video_play_20200520_136').controls) {
document.getElementById('video_play_20200520_136').controls = 'controls';
}
document.getElementById('video_play_20200520_136').setAttribute('controlslist', 'nodownload');
document.getElementById('video_play_20200520_136').setAttribute('oncontextmenu', 'return false');
}
/**记录播放时长**/
var video = document.getElementById('video_play_20200520_136');
var timeDisplay;
var times = 0;
video.addEventListener('pause', function () { //暂停开始执行的函数
submitPlayRecord();
});
video.addEventListener('waiting', function() {
if(times == 1){
timeDisplay = this.duration;
submitPlayRecord();
}
times ++;
}, false);
// video.addEventListener('canplaythrough', function() {
// if(times == 1){
// timeDisplay = this.duration;
// submitPlayRecord();
// }
// times ++;
// }, false);
video.addEventListener('ended', function () { //结束
submitPlayRecord();
}, false);
//监听播放时间
//使用事件监听方式捕捉事件
video.addEventListener("timeupdate",function(){
//用秒数来显示当前播放进度
timeDisplay = Math.floor(this.currentTime);
},false);
window.addEventListener('unload', function() {
//窗口关闭后
submitPlayRecord();
});
function submitPlayRecord() {
if (document.getElementById('fid1616057948')) {
var fid = document.getElementById('fid1616057948').value;
if (fid > 0) {
var ajax = new XMLHttpRequest();
ajax.open("post", "/index.php?m=home&c=Media&a=record_process", true);
ajax.setRequestHeader("X-Requested-With","XMLHttpRequest");
ajax.setRequestHeader("Content-type","application/x-www-form-urlencoded");
ajax.send("aid=136&file_id="+fid+"&timeDisplay="+timeDisplay);
ajax.onreadystatechange = function () {
};
}
}
}
/**记录播放时长**/
// 视频购买
function MediaOrderBuy_1592878548() {
var ajax = new XMLHttpRequest();
ajax.open("post", '/index.php?m=user&c=Media&a=media_order_buy', true);
ajax.setRequestHeader("X-Requested-With","XMLHttpRequest");
ajax.setRequestHeader("Content-type","application/x-www-form-urlencoded");
ajax.send('aid=136');
ajax.onreadystatechange = function () {
if (ajax.readyState==4 && ajax.status==200) {
var json = ajax.responseText;
var res = JSON.parse(json);
if (1 == res.code && res.url) {
window.location.href = res.url;
} else if (0 == res.code && res.url) {
window.location.href = res.url;
} else {
if (!window.layer) {
alert(res.msg);
} else {
layer.alert(res.msg, {icon: 5, title: false, closeBtn: false});
}
}
}
};
}
if (!window.jQuery) {
document.write(unescape("%3Cscript src='/public/static/common/js/jquery.min.js' type='text/javascript'%3E%3C/script%3E"));
document.write(unescape("%3Cscript type='text/javascript'%3E try{jQuery.noConflict();}catch(e){} %3C/script%3E"));
}
if (window.jQuery) {
(function($){
default_switch();
//简体繁体互换
function default_switch()
{
var home_lang = getCookie('home_lang');
if (home_lang == '') {
home_lang = 'cn';
}
if ($.inArray(home_lang, ['zh','cn'])) {
var obj = $('#jquerys2t_1573822909');
var isSimplified = getCookie('jquerys2t_1573822909');
if ('cn' == isSimplified) {
$('body').t2s();
$(obj).text('繁體');
} else if ('zh' == isSimplified) {
$('body').s2t();
$(obj).text('简体');
}
}
}
//简体繁体互换
$('#jquerys2t_1573822909').click(function(){
var obj = this;
var isSimplified = getCookie('jquerys2t_1573822909');
if ('' == isSimplified || 'cn' == isSimplified) {
$('body').s2t(); // 简体转繁体
setCookie('jquerys2t_1573822909', 'zh');
$(obj).text('简体');
} else {
$('body').t2s(); // 繁体转简体
setCookie('jquerys2t_1573822909', 'cn');
$(obj).text('繁體');
}
});
})(jQuery);
}