下载客户端
苹果IOS
安卓
弹幕
");
}
$(this).find(".hh").show();
})
$("#scrollbar").on("mouseleave",".overview ul li",function(){
$(this).find(".hh").hide();
})
/*表情的显隐及发送弹幕的点击事件*/
//
//$(".xmpddbbf17036_ind01").on("click","#text",function(){
// $("#end_pt").show()
//})
//$(".xmpddbbf17036_ind01").on("click","span.btn",function(){
// $("#end_pt").show();
//})
$("#end_pt").on("click","span.look",function(){
if($("#end_pt").find(".lookbox").is(":hidden")){
$("#end_pt").find(".lookbox").show();
$("#end_pt").find(".wenzibox").hide();
}else{
$("#end_pt").find(".lookbox").hide();
}
})
$("#end_pt").on("click","span.wenzi",function(){
if($("#end_pt").find(".wenzibox").is(":hidden")){
$("#end_pt").find(".wenzibox").show();
$("#end_pt").find(".lookbox").hide();
}else{
$("#end_pt").find(".wenzibox").hide()
}
})
$("body").on("click",function(e){
var that = e.target;
if($(that).hasClass("look") || $(that).hasClass("wenzi") || $(that).parent().hasClass("look") || $(that).hasClass("lookbox") || $(that).hasClass("wenzibox") || $(that).parents("div").hasClass("wenzibox") || $(that).parents("div").hasClass("lookbox")){
}else{
$(".wenzibox").hide();$(".lookbox").hide();
}
})
//颜文字点击
$("#end_pt").on("click",".wenzibox a",function(){
var yansenzi = $(this).text();
var areaval = $("#tts").val();
$("#tts").val(areaval+yansenzi);
areaval = $("#tts");
$(this).parents(".replybox").find(".tag i").html(140-areaval.length);
$(this).parents(".discuss-box").find(".tag i").html(140-areaval.length);
})
//表情点击[em:1]
$("#end_pt").on("click",".lookbox img",function(){
var yansenzi = $(this).attr("data");
var areaval = $("#tts").val();
$("#tts").val(areaval+yansenzi);
areaval = $("#tts");
$(this).parents(".replybox").find(".tag i").html(140-areaval.length);
$(this).parents(".discuss-box").find(".tag i").html(140-areaval.length);
})
//弹出输入框
$("#text").focus(function(){
if(getCookie("userSeqId") == null || getCookie("userSeqId") == ""){//验证是否已登录
$("#password_view").val("请输入密码");
$(".xmpdgqqt17036_cover_box").show();
$(".zhanghaodenglu").show();
return
}
$("#end_pt").show();
$("#tts").focus();
})
var danmuarry=["~( ̄▽ ̄~)(~ ̄▽ ̄)~","o(////▽////)o","Σ(っ °Д °;)っ","d====( ̄▽ ̄)b",'(╯‵□′)╯""┻━┻',"(..•˘_˘•..)","o( ̄ヘ ̄o#)","(∪。∪)。。。zzz","(lll¬ω¬)","ヾ(≧▽≦)o","(*/ω\*)","( ̄3 ̄)╭","o(╥﹏╥)o","╮(╯▽╰)╭","(☆w☆)","(→_→)",'[/微笑]','[/机智]','[/捂脸]','[/惊恐]','[/奸笑]','[/疑问]','[/抓狂]','[/耶]','[/抠鼻]','[/亲亲]'];
var mianshen=false;
//新增窄版点击发送弹幕
$(".xmpddbbf17036_ind01_17036_20170926 .con .dm_lists").on("click",".send .btn",function(){
//验证是否登录,未登录弹出登录框
if(getCookie("userSeqId") == null || getCookie("userSeqId") == ""){
$("#password_view").val("请输入密码");
$(".xmpdgqqt17036_cover_box").show();
$(".zhanghaodenglu").show();
return
}
var jen = $("#tts").val()
//校验字数
var dm_msg =jen;
if(dm_msg==null||dm_msg==""){
$("#tm_box").html("您还未输入内容哦~")
$("#tm_box").show()
setTimeout(function(){$("#tm_box").hide()},1500)
return;
}
if(detectStr(dm_msg)>100){
$("#tm_box").html("回复字数最多100字符")
$("#tm_box").show()
setTimeout(function(){$("#tm_box").hide()},1500)
return;
}
var jiance=jen
jiance=escape(dm_msg);
if(jiance.indexOf("*")>-1){
var jiancelist=jiance.split("*");
var newjiance=""
for (var j=0;j
-1){
var reg=new RegExp(escape(danmuarry[i].replace(/\s*/g,"")),"g")
newjiance=newjiance.replace(reg,'')
}
}
if(newjiance.length==0){
mianshen=true;
}else{
mianshen=false;
}
console.log(mianshen)
//发送弹幕对应的视频时间
//发送弹幕对应的视频时间
if(typeof thisMovie == "function"){
try{
var relative_time = parseInt(thisMovie("flashplayer_flash_video").getTimeInSeconds()*1000);//20171027新增
}catch(e){
var relative_time = 0;
}
}
if(typeof _player=="object"){
relative_time =parseInt(_player.currentTime()*1000)
}
dm_msg = decodeURIComponent(dm_msg);
var dm_send_url = "//newcomment.cctv.cn/comment/post"
if(mianshen){
var danmurul=dm_send_url+"?app="+danmudata.app+"&itemid="+danmudata.itemid+"&relative_time="+relative_time+"&common_words_id=87940&authorid="+danmudata.authorid+"&message="+dm_msg+"&author="+danmudata.author+"&jsonp_callback=?";
}else{
var danmurul=dm_send_url+"?app="+danmudata.app+"&itemid="+danmudata.itemid+"&relative_time="+relative_time+"&authorid="+danmudata.authorid+"&message="+dm_msg+"&author="+danmudata.author+"&jsonp_callback=?";
}
$.ajax({
type:"post",
url:danmurul,
async:true,
// timeout:5000,
dataType:'jsonp',
jsonp:"jsonp_Callback",
jsonpCallback:"callback_"+danmudata.app+"_"+danmudata.itemid,
cache:true,
success:function(data,textStatus,jqXHR){
if(data.code == "20000"){//用户未登录,但有cookie时
$("#tm_box").html("请登录后再评论");
$("#tm_box").show();
setTimeout(function(){$("#tm_box").hide()},1500);
delCookie("userSeqId");
return
}
if(textStatus != "success"){
return
}
var code = data.code;
if(code=="20927"){
window.location.href= "//reg.cctv.cn/authenicateAction/mobile/bind.html?service="+window.location.href;
}else if(code==0){
if(!$(".video_btnBar .rightBar .danmu").hasClass("cur")){
$(".video_btnBar .rightBar .danmu").addClass("cur");
danmu_status = 1;
if(typeof showOrHideBarrage !== "undefined") {
showOrHideBarrage(playerParas.divId, "show"); //player_container为播放器容器id
}else{
$(".barrage_list_"+playerParas.divId).show()
}
setCookie("brstaut",danmu_status)
}
if(mianshen){
$("#tm_box").html("已发送成功")
try{
thisMovie("flashplayer_flash_video").commitBarrage(decodeURIComponent(jen))
}catch(e){
//TODO handle the exception
}
try{
_player = vodh5player.namespace.getVodPlayer();
_player.showBarrage(decodeURIComponent(jen));
}catch(e){
//TODO handle the exception
}
}else{
$("#tm_box").html("已提交审核")
}
$("#tm_box").show()
setTimeout(function(){$("#tm_box").hide()},1500)
$("#tts").val('')
$("#end_pt").hide()
$("#text").show()
$("#text").val('')
}
}
});
//暂撤实名认证接口
//
// }
//
// }
// });
//
//暂撤实名认证接口
})
//发送弹幕
$("#senddm").on("click",function(){
//验证是否登录,未登录弹出登录框
if(getCookie("userSeqId") == null || getCookie("userSeqId") == ""){
$("#password_view").val("请输入密码");
$(".xmpdgqqt17036_cover_box").show();
$(".zhanghaodenglu").show();
return
}
var jen = $("#tts").val()
//校验字数
var dm_msg =jen;
if(dm_msg==null||dm_msg==""){
$("#tm_box").html("您还未输入内容哦~")
$("#tm_box").show()
setTimeout(function(){$("#tm_box").hide()},1500)
return;
}
if(detectStr(dm_msg)>100){
$("#tm_box").html("回复字数最多100字符")
$("#tm_box").show()
setTimeout(function(){$("#tm_box").hide()},1500)
return;
}
var jiance=jen
jiance=escape(dm_msg);
if(jiance.indexOf("*")>-1){
var jiancelist=jiance.split("*");
var newjiance=""
for (var j=0;j-1){
var reg=new RegExp(escape(danmuarry[i].replace(/\s*/g,"")),"g")
newjiance=newjiance.replace(reg,'')
}
}
if(newjiance.length==0){
mianshen=true;
}else{
mianshen=false;
}
console.log(mianshen)
//发送弹幕对应的视频时间
//发送弹幕对应的视频时间
if(typeof thisMovie == "function"){
try{
var relative_time = parseInt(thisMovie("flashplayer_flash_video").getTimeInSeconds()*1000);//20171027新增
}catch(e){
var relative_time = 0;
}
}
if(typeof _player=="object"){
relative_time =parseInt(_player.currentTime()*1000)
}
dm_msg = decodeURIComponent(dm_msg);
var dm_send_url = "//newcomment.cctv.cn/comment/post"
if(mianshen){
var danmurul=dm_send_url+"?app="+danmudata.app+"&itemid="+danmudata.itemid+"&relative_time="+relative_time+"&common_words_id=87940&authorid="+danmudata.authorid+"&message="+dm_msg+"&author="+danmudata.author+"&jsonp_callback=?";
}else{
var danmurul=dm_send_url+"?app="+danmudata.app+"&itemid="+danmudata.itemid+"&relative_time="+relative_time+"&authorid="+danmudata.authorid+"&message="+dm_msg+"&author="+danmudata.author+"&jsonp_callback=?";
}
$.ajax({
type:"post",
url:danmurul,
async:true,
// timeout:5000,
dataType:'jsonp',
jsonp:"jsonp_Callback",
jsonpCallback:"callback_"+danmudata.app+"_"+danmudata.itemid,
cache:true,
success:function(data,textStatus,jqXHR){
if(data.code == "20000"){//用户未登录,但有cookie时
$("#tm_box").html("请登录后再评论");
$("#tm_box").show();
setTimeout(function(){$("#tm_box").hide()},1500);
delCookie("userSeqId");
return
}
if(textStatus != "success"){
return
}
var code = data.code;
if(code=="20927"){
window.location.href= "//reg.cctv.cn/authenicateAction/mobile/bind.html?service="+window.location.href;
}else if(code==0){
if(!$(".video_btnBar .rightBar .danmu").hasClass("cur")){
$(".video_btnBar .rightBar .danmu").addClass("cur");
danmu_status = 1;
try{
thisMovie("flashplayer__video").showBarrage();
}catch(e){
try{
_player.barrageToggle( true );
}catch(e){
$(".vjs-barrage-layer").show()
}
}
setCookie("brstaut",danmu_status)
}
if(mianshen){
$("#tm_box").html("已发送成功")
try{
thisMovie("flashplayer_flash_video").commitBarrage(decodeURIComponent(jen))
}catch(e){
//TODO handle the exception
}
try{
_player = vodh5player.namespace.getVodPlayer();
_player.showBarrage(decodeURIComponent(jen));
}catch(e){
//TODO handle the exception
}
}else{
$("#tm_box").html("已提交审核")
}
$("#tm_box").show()
setTimeout(function(){$("#tm_box").hide()},1500)
$("#tts").val('')
$("#end_pt").hide()
$("#text").show()
$("#text").val('')
}
}
});
//暂撤实名认证接口
//
// }
//
// }
// });
//
//暂撤实名认证接口
})
//评论留言点赞
$("#danmu_cont").on("click",".zan",function(){
var dingurl= "//newcomment.cntv.cn/comment/agree";
if($(this).hasClass("cur")){return}
var pid = $(this).attr("pid")
var tid = $(this).attr("tid")
var message = $(this).parents(".cont").find(".txt").eq(0).text()
var that = this
// //验证是否登录,未登录弹出登录框
//
// if(getCookie("userSeqId") == null || getCookie("userSeqId") == ""){
// $(".xmpdgqqt17036_cover_box").show();
// $(".zhanghaodenglu").show();
// return
// }
//验证是否登录,未登录弹出登录框 /*最新要求,无需登录可实现点赞*/
if(getCookie("userSeqId") == null || getCookie("userSeqId") == ""){
var data = '';
var base = new Base64();
var _uid = parseInt(Math.random()*10);
var _time = Date.parse(new Date());
_time = _time / 1000;
data =encodeURI(base.encode("uid="+_uid+"&time="+_time));
var zanUrl = dingurl+"?app="+danmudata.app+"&itemid="+danmudata.itemid+"&tid="+tid+"&pid="+pid+"&data="+data+"&jsonp_callback=?";
}else{
var zanUrl = dingurl+"?app="+danmudata.app+"&itemid="+danmudata.itemid+"&tid="+tid+"&pid="+pid+"&jsonp_callback=?";
}
$.ajax({
type:"get",
url:zanUrl,
async:true,
// data:data1,
// timeout:5000,
dataType:'jsonp',
jsonp:"jsonp_callback",
jsonpCallback:"callback_"+danmudata.app+"_"+danmudata.itemid,
cache:true,
success:function(data,textStatus,jqXHR){
if(textStatus != "success"){
return
}
if(data.msg =="已经顶过"){
alert(data.msg)
return
}
$(that).addClass("cur")
$(that).find("i").delay(200).fadeIn();
$(that).find("i").delay(600).fadeOut(function(){
if(parseInt($(that).text()) < 100){//20171201
$(that).text(parseInt($(that).text())+1);
}
});
}
});
})
//弹幕展示时间转换
function dmchangetime(dtime){
var dmTime = parseInt(dtime/1000)
var dmMinute = parseInt(dmTime/60)
var dmSecond = dmTime - dmMinute*60
if(dmMinute < 10){
dmMinute = "0"+dmMinute
}
if(dmSecond < 10){
dmSecond = "0"+dmSecond
}
var resultTime = dmMinute+":"+dmSecond
return resultTime
}
//获取的评论表情字符替换为图片
function biaoqingtihuan(str){
var arrbiaoqing = [
'',
'',
'',
'',
'',
'',
'',
'',
'',
''
];
var biaoqing="";
var strbiaoqing = str.replace(/\[\/([\u4e00-\u9fa5]+)\]/g, function(item, index){
switch(index){
case "微笑":
return arrbiaoqing[0]
break;
case "机智":
return arrbiaoqing[1]
break;
case "捂脸":
return arrbiaoqing[2]
break;
case "惊恐":
return arrbiaoqing[3]
break;
case "奸笑":
return arrbiaoqing[4]
break;
case "疑问":
return arrbiaoqing[5]
break;
case "抓狂":
return arrbiaoqing[6]
break;
case "耶":
return arrbiaoqing[7]
break;
case "抠鼻":
return arrbiaoqing[8]
break;
case "亲亲":
return arrbiaoqing[9]
break;
default :
return index
}
});
return strbiaoqing;
}
//展示弹幕
// var itemid=url.substring(url.indexOf('ARTI'), url.indexOf('.shtml'));
function showBarrage(){
// var danmuurl = "http://common.newcomment.cntv.cn/data/barrage?app=ipandaAPP&itemid=af43b7887de3485a8d8f3634203b0bcf&prepage=100"
var danmuurl = "//common.newcomment.cntv.cn/data/pandabarrage"
$.ajax({
type:"get",
url:danmuurl+"?app="+danmudata.app+"&itemid="+danmudata.itemid+"&prepage="+danmudata.prepage+"&relative_time=0&relative_end_time=9999999999",
async:true,
// timeout:5000,
dataType:'jsonp',
jsonp:"jsonp_callback",
jsonpCallback:"callback_"+danmudata.app+"_"+danmudata.itemid,
cache:true,
success:function(data,textStatus,jqXHR){
if(data.data.total == 0){
$("#scrollbar").find(".scrollbar").hide();
$("#noBarrage").show();
return
}
$("#noBarrage").hide();
var danmu = data.data.content
$.each(danmu,function(i,con){
var str = "";
str += ""+dmchangetime(con.relative_time)+"
";
str += ""+biaoqingtihuan(con.message)+"
";
if(con.agree < 100){//20171201新增
str += ""+con.agree+"+1
";
}else if(con.agree >= 100){
str += "100++1
";
}
str += "";
$("#danmu_cont").append(str)
})
$scrollbar.tinyscrollbar();//重塑滚动条
}
});
}
showBarrage();
/*字号切换*/
$(".cnt_box .infobox .font a").eq(1).click(function(){
var fontSize=$(".con p").css("font-size");
fontSize=parseInt(fontSize.substr(0,2))+2;
if(fontSize <= 25){
$(".con p").css({"font-size":fontSize+"px"});
}
$(this).blur();
});
$(".cnt_box .infobox .font a").eq(0).click(function(){
var fontSize=$(".con p").css("font-size");
fontSize=parseInt(fontSize.substr(0,2))-2;
if(fontSize>10){
$(".con p").css({"font-size":fontSize+"px"});
}
$(this).blur();
});
})
//获取cookie
function getCookie(name) {
var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
if (arr = document.cookie.match(reg)) return unescape(arr[2]);
else return null
}
function changeDmBut(){
if($(".dm_lists .send .btn").length > 0){
if(getCookie("userSeqId") == null || getCookie("userSeqId") == ""){
$(".dm_lists .send .btn").removeClass("cur")
$(".dm_lists .send .end_pt .bot span.bt").addClass("unlog")
return
}else{
$(".dm_lists .send .btn").addClass("cur")
$(".dm_lists .send .end_pt .bot span.bt").removeClass("unlog")
}
}
}
function detectStr(strL){
var len = 0;
for (var i=0; i127 || strL.charCodeAt(i)==94) {
len += 2;
} else {
len ++;
}
}
return len;
}
//base64
function Base64() {
// private property
_keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
// public method for encoding
this.encode = function (input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = _utf8_encode(input);
while (i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
output = output +
_keyStr.charAt(enc1) + _keyStr.charAt(enc2) +
_keyStr.charAt(enc3) + _keyStr.charAt(enc4);
}
return output;
}
// public method for decoding
this.decode = function (input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length) {
enc1 = _keyStr.indexOf(input.charAt(i++));
enc2 = _keyStr.indexOf(input.charAt(i++));
enc3 = _keyStr.indexOf(input.charAt(i++));
enc4 = _keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {
output = output + String.fromCharCode(chr3);
}
}
output = _utf8_decode(output);
return output;
}
// private method for UTF-8 encoding
_utf8_encode = function (string) {
string = string.replace(/\r\n/g,"\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
} else if((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
} else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
}
// private method for UTF-8 decoding
_utf8_decode = function (utftext) {
var string = "";
var i = 0;
var c = c1 = c2 = 0;
while ( i < utftext.length ) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
} else if((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i+1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
} else {
c2 = utftext.charCodeAt(i+1);
c3 = utftext.charCodeAt(i+2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return string;
}
}