document.write("");
document.write("");
var ifMaxShowDate=false;//是否开启过滤日期(开启:true,关闭:false)
var MaxshowData=10; //最多能看7天
var ListStatus=0; //概率页面用
var searchurl = "http://fullsearch.cnepaper.com/eso/bjrb.aspx";//全文检索页面地址
var dbids = "2107";//检索报纸ID
$(function(){
//广告视频不允许自动播放
var video=$('#AdBox video')[0];
if(video){
video.setAttribute('poster','https://qnres.aheading.com/video/bjrbszb/poster.jpg')
video.pause();
}
//兼容动态跳转到手机版
pcBrowserRedirect();
//显示顶部右侧时间
//displayCurDate();
//顶部系列报刊加载
nvaXlbkInit();
//顶部banner加载-微信矩阵
topBannerInit();
//调整文章链接
//addTitle2Link();
$('#downpdfLink').css({bottom:'0'})
if(!DateMaxDiff(1)){
alert("对不起,只能查看最新七天数据!");
location.href="../../../paperindex.htm";
return;
}
// 通版情况下,动态加入广告
if ( $("#Bantu").width()>$("#Bantu").height() ){
//$("#Bantu").after("
");
$('.mainBox').css({display:'block',height:'auto',})
$("#Bantu").css({width:'calc(100% - 40px'})
$('.listRMain_list').css({display:'block',width:0,position:'absolute',right:0,padding:0})
$('.leftMain').css({display:'block',width:'100%',float:'none'})
$('.main-l').css({width:'100%',height:'100%',margin:0})
$('.listRMain').css({float:'none',width:'100%',position:'static'})
$('.downPDF').css({top:'666px'})
$('.bottom_BmBack').css({top:'165px'})
$('.bottom_read').css({top:'220px'})
if (window.location.href.indexOf("node")>=0){
$('.detailMain').hide();
}
}
//文章页面新闻图片轮播效果
if ( location.href.indexOf("content")>=0 ) {
$("#imgTextBox").piroBox({my_speed: 400,bg_alpha: 0.1,slideShow : true,slideSpeed : 4});
}
// 版面概率页面初始化
if ( location.href.indexOf("index_")>=0 ) {
quickNavJpg(1);//初始化显示所以叠次
//左侧版面概览页面切换效果
$("#mu_right_img").on("click", function() {
if (ListStatus==0){
$(this).attr("src","../../../images2023/picture/listdown.png");
$(".paperList").hide();
ListStatus=1;
}else{
$(this).attr("src","../../../images2023/picture/listup.png");
$(".paperList").show();
ListStatus=0;
}
});
}
var _time;
$(".hoverLi").on("mouseover", function(i,e){
var _pos = $(this).position();
var _offset = $(this).offset();
var _id = $(this).data("type");
if(_time) clearTimeout(_time);
$(".hoverBox1").addClass("hid");
$("#"+_id).removeClass("hid").css("top", _pos.top);
if(_id == 'pastPeriod'){ // 显示如期插件
showDate();
}else{
hideDate();
}
})
$(".hoverBox1").on("mouseover",function(){
if(_time) clearTimeout(_time);
$(this).removeClass("hid");
})
$(".hoverBox1").on("mouseleave",function(){
if($(".form_date").css("display") == 'none'){
$(this).addClass("hid");
}
})
$(".form_date").on("mouseleave", function(){
showDate();
$("#pastPeriod").addClass("hid");
})
$(".hoverLi").on("mouseleave", function(){
var _id = $(this).data("type");
if($(".form_date").css("display") == 'none'){
_time = setTimeout(function(){
if($(".form_date").css("display") != 'none'){
hideDate();
}
$("#"+_id).addClass("hid");
clearTimeout(_time);
},1000)
}
});
$("#nav_xbj").on("mouseover",function(){
$('#xbj').removeClass("hid");
})
$("#nav_xbj").on("mouseleave",function(){
$('#xbj').addClass("hid");
})
});
//顶部系列报刊加载
function nvaXlbkInit(){
var nva_xlbkHtml = "";
nva_xlbkHtml += "
广州日报";
nva_xlbkHtml += "信息时报";
$("#nva_xlbk_list").html(nva_xlbkHtml);
}
//顶部banner加载
function topBannerInit(){
//滚动加载
var isbool = false;
$("#listBox").scroll(function () {
var _height = $(this).height();
var _scrollTop = $(this).scrollTop(); //滚动条top
var _totlaH = $(this).context.scrollHeight;
if (_height + _scrollTop == _totlaH && isbool == false) {
isbool = true;
// alert("获取数据")
}
})
$("#nav_wxgzg").click(function () {
var html = '';
html += ''
html += ''
html += '
'
html += '
毕节日报'
html += '
看见毕节'
html += '
'
html += '
'
html += '
'
html += '
'
html += '
'
html += '
《毕节日报》数字报
'
html += '
'
html += '
'
html += '
新毕节APP
'
html += '
'
html += '
'
html += '
“毕节发布”公众号
'
html += '
'
html += '
'
html += '
'
html += '
'
html += '
'
html += '
'
html += '
“看见毕节”公众号
'
html += '
'
html += '
'
html += '
毕节试验区
'
html += '
'
html += '
'
html += '
“看见毕节”快手
'
html += '
'
html += '
'
html += '
《毕节日报》抖音号
'
html += '
'
html += '
'
html += '
'
html += '
'
html += '
'
//iframe层
layer.open({
type: 1,
title: '融媒体平台',
shadeClose: true,
shade: 0.8,
offset: '50px',
area: ['980px', '520px'],
content: html //iframe的url
});
$('.index_tab a').click(function () {
// 当前点击的tab高亮,其他的tab取消高亮
$(this).addClass("cur").siblings("a").removeClass("cur");
//获取当前点击tab的id
var index = $(this).index();
//让对应索引的盒子显示 类名控制是否显示
$(".index_cont .list:eq(" + index + ")").addClass("selected").siblings("div").removeClass("selected");
})
$('.mask').click(function () {
$(this).hide();
})
$('.qrcontent').click(function () {
var img = $(this).find("img").attr('src');
$('.mask').append('').show()
})
});
}
function backBM(){ //内容页面返回版面页面
var bmLink=window.location.href.split("_");
window.location.href = bmLink[0].replace("content","node")+"_"+bmLink[1]+".htm";
}
function pcBrowserRedirect() { //移动页面跳转
var sUserAgent = navigator.userAgent.toLowerCase();
var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
var bIsMidp = sUserAgent.match(/midp/i) == "midp";
var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
var bIsAndroid = sUserAgent.match(/android/i) == "android";
var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM){
// 移动页面
window.location.href= window.location.href.replace("html","h5/html5");
//$('body').show();
}else{
// PC页面
$('body').show();
}
}
// 检索
function SearchText() {
var url = "";
var keyword = $("#J_search_content").val();
if (keyword) {
url = searchurl + "?key=" + encodeURI(keyword) + "&dbids=" + dbids;
window.open(url);
} else {
alert("搜索内容不能为空!");
}
}
var month = getDate("month");//获取当前月份
$(function(){
if (window.location.href.indexOf("index_")<0){//非版面概览页面
//日历实例化
$('.form_date').datetimepicker({
pickerPosition: "top-right",
bootcssVer: 3,
format: "yyyy-mm-dd",
language: "zh-CN",
weekStart: 1,
autoclose: 1,
startView: 2,
minView: 2,
forceParse: 0,
viewSelect: "month",
initialDate: getDate("day"),
}).on("show", function(ev){
displayDate(month);
//$(".datetimepicker-days th.switch").addClass("disabled");
}).on('changeDate', function(ev){
var date = new Date(ev.date.valueOf());
var year = date.getFullYear();
var month = date.getMonth()+1;
month = month<10?("0" + month): month;
var day = date.getDate();
day = day<10?("0" + day): day;
var url = "../../" + year + "-" + month + "/" + day + "/node_1.htm";
var isUseful = checkUrl(url);
if(isUseful){
location.href = url;
}
});
//监听切换月份
var i = 0;
// 选择您想要监听子节点变动的元素
var targetNode = document.querySelector('.datetimepicker-days tbody');
// 创建一个观察者实例并传入回调函数
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.type === 'childList') {
if (i == 5) {
var date = $(".datetimepicker-days thead th.switch").text().split(" ");
switch (date[0]) {
case "一月":
month = date[1] + "-01";
break;
case "二月":
month = date[1] + "-02";
break;
case "三月":
month = date[1] + "-03";
break;
case "四月":
month = date[1] + "-04";
break;
case "五月":
month = date[1] + "-05";
break;
case "六月":
month = date[1] + "-06";
break;
case "七月":
month = date[1] + "-07";
break;
case "八月":
month = date[1] + "-08";
break;
case "九月":
month = date[1] + "-09";
break;
case "十月":
month = date[1] + "-10";
break;
case "十一月":
month = date[1] + "-11";
break;
case "十二月":
month = date[1] + "-12";
break;
}
displayDate(month);
i = -1;
}
i++;
}
});
});
// 配置观察选项:
// 子节点的添加或删除将触发观察者的回调
var config = { attributes: false, childList: true, subtree: true };
// 传入目标节点和观察选项
observer.observe(targetNode, config);
}
})
// 日历相关设置
//显示日期
function showDate(){
$('.form_date').datetimepicker('update');
$(".form_date").datetimepicker("show");
}
//隐藏日期
function hideDate(){
$(".form_date").val(getDate("day"));
$(".form_date").datetimepicker("hide");
}
//获取当前页日期
function getDate(str){
var url = location.href;
var re = /(\d{4})\-(\d{2})\/(\d{2})/;
var r = url.match(re);
//精确到日
if(!r){
return
}
if(str == "day"){
var date = r[1]+"-" + r[2] + "-" + r[3];
//精确到月
}else if(str == "month"){
var date = r[1]+"-" + r[2];
}
return date
}
//获取当前月份报纸xml数据
function getPaper(date){
var myXmlUrl = "../../../html/" + date + "/navi.xml?time="+Date.parse(new Date());
var data = {'day':[],'url':[]};
$.ajax({
url:myXmlUrl,
type: 'GET',
dataType: 'xml',
async: false,
timeout: 1000,
error: function(xml){
},
success: function(xml){
var date= new Array();
var day= new Array();
var url= new Array();
$(xml).find("date").each(function(){
date.push($(this).text());
day.push(parseInt($(this).text().split("-")[2]))
});
$(xml).find("url").each(function(){
url.push($(this).text());
});
data = {"day":day,"url":url}
}
});
console.log('获取当前月份报纸xml数据:',date)
return data
}
//需要黑色显示的日期数组
function displayDate(date){
var data = getPaper(date);
var day=1,count=0,count2=0;
$(".datetimepicker-days .day").each(function(i){
if (parseInt($(this).text())>day){
$(this).html("");
count++
}else{
day=parseInt($(this).text())+1;
if ( (i>20)&&( parseInt($(this).text())<14 ) ){
$(this).html("").removeClass("active");
count2++;
}
}
});
if (count==7){$(".datetimepicker-days tr:eq(2)").hide();}
if (count2>=7){$(".datetimepicker-days tr:eq(7)").hide();}
$(".datetimepicker-days .day").each(function(){
var index = data["day"].indexOf(parseInt($(this).text()))
if(index == -1){
$(this).addClass('old');
$(this).addClass('disabled');
}else{
if (!ifMaxShowDate){
$(this).attr('url',data["url"][index]);
}else{
var temp = date.split("-");
temp = temp[0]+"/"+temp[1]+"/"+ parseInt($(this).text());
if (DateMaxDiff(2,temp) ){
$(this).attr('url',data["url"][index]);
}else{
$(this).addClass('old');
$(this).addClass('disabled');
}
}
}
});
}
//检查链接是否有效
function checkUrl(url){
isUseful = false;
$.ajax({
url:url,
type: 'GET',
async: false,
success: function(xml){
isUseful = true;
}
});
return isUseful
}
//判断当前时间和报纸刊期之间的时间差。 如在MaxshowData天内,返回true,否则返回false
// type=1,忽略dtStartStr,日期根据浏览器地址获取;type=2,根据前一个参数,格式(YYYY/MM/DD)
function DateMaxDiff(type,dtStartStr){
if (!ifMaxShowDate){return true;}
var maxinterval=MaxshowData;//允许看的天数
var re = /(\d{4})-(\d{2})\/(\d{2})/i;
var sUrl = location.href;
var r = sUrl.match(re);
var dtEnd = new Date();
var dtStart;
if (type==1){
if (r) {
dtStart = new Date(r[1] + "/" + r[2]+"/"+r[3]);
}else{
dtStart = new Date();
}
}else if (type==2){
dtStart = new Date(dtStartStr);
if (isNaN(dtStart)) dtStart = new Date();
}
var date3=dtEnd.getTime()-dtStart.getTime(); //时间差的毫秒数
var days=Math.floor(date3/(24*3600*1000));//计算出相差天数
if ( (days) >= maxinterval){
return false;
}else{
return true;
}
}
//调整文章链接
function addTitle2Link(){
var hrefLink;
//版面页面
if (location.href.indexOf("node")>=0){
$(".listTitle,.box1Li").each(function(i){
hrefLink = $(this).attr("href")+"?title="+$(this).html();
$(this).attr("href",hrefLink);
})
}
//文章页面
if (location.href.indexOf("content")>=0){
$(".box1Li a").each(function(i){
hrefLink = $(this).attr("href")+"?title="+$(this).html();
$(this).attr("href",hrefLink);
})
}
}
//显示顶部右侧当天的日历时间
function displayCurDate(){
//页面日期
var myDate = new Date();
var year = myDate.getFullYear(); //年
var month = myDate.getMonth() + 1; //月
var day = myDate.getDate(); //日
var days = myDate.getDay();
switch (days) {
case 1:
days = '星期一';
break;
case 2:
days = '星期二';
break;
case 3:
days = '星期三';
break;
case 4:
days = '星期四';
break;
case 5:
days = '星期五';
break;
case 6:
days = '星期六';
break;
case 0:
days = '星期日';
break;
}
var str = "今日 " + year + "年" + month + "月" + day + "日 " + days;
document.getElementById("weather-date").innerHTML = str;
return str;
}
//版面概率页面-点击切换效果-版面概览页面
function quickNavJpg(pileId){
$(".shortjpg").hide();
if (pileId==1){
pileId="shortjpg";
$(".quickNavAll").addClass("current-Pile").siblings().removeClass("current-Pile");
}else{
$(".pile_"+pileId).addClass("current-Pile").siblings().removeClass("current-Pile");
pileId = "pile"+pileId;
}
$("."+pileId).each(function(i){
$(this).show();
});
}
// cnzz统计
loadCnzz();
function loadCnzz(){
var la = document.createElement('script');
la.type = 'text/javascript';
la.async = true;
la.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 's4.cnzz.com/z_stat.php?id=1260792396&web_id=1260792396';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(la, s);
}