function fontResizer(smallFont, medFont, largeFont) { function clearSelected() { $(".smallFont").removeClass("curFont"); $(".medFont").removeClass("curFont"); $(".largeFont").removeClass("curFont"); } function saveState(curSize) { var date = new Date(); date.setTime(date.getTime() + (7 * 24 * 60 * 60 * 1000)); var expires = "; expires=" + date.toGMTString(); document.cookie = "fontSizer" + "=" + curSize + expires + "; path=/"; } $(".smallFont").click(function() { $('#Zoom').css('font-size', smallFont); $('#Zoom p').css('font-size', smallFont); $('#Zoom span').css('font-size', smallFont); $('#Zoom font').css('font-size', smallFont); clearSelected(); $(".smallFont").addClass("curFont"); saveState(smallFont); }); $(".medFont").click(function() { $('#Zoom').css('font-size', medFont); $('#Zoom p').css('font-size', medFont); $('#Zoom span').css('font-size', medFont); $('#Zoom font').css('font-size', medFont); clearSelected(); $(".medFont").addClass("curFont"); saveState(medFont); }); $(".largeFont").click(function() { $('#Zoom').css('font-size', largeFont); $('#Zoom p').css('font-size', largeFont); $('#Zoom span').css('font-size', largeFont); $('#Zoom font').css('font-size', largeFont); $('#Zoom').css('line-height', '40px'); $('#Zoom p').css('line-height', '40px'); $('#Zoom span').css('line-height', '40px'); $('#Zoom font').css('line-height', '40px'); clearSelected(); $(".largeFont").addClass("curFont"); saveState(largeFont); }); function getCookie(c_name) { if(document.cookie.length > 0) { c_start = document.cookie.indexOf(c_name + "="); if(c_start != -1) { c_start = c_start + c_name.length + 1; c_end = document.cookie.indexOf(";", c_start); if(c_end == -1) c_end = document.cookie.length; return unescape(document.cookie.substring(c_start, c_end)); } } return ""; } var savedSize = getCookie('fontSizer'); if(savedSize != "") { $('#Zoom').css('font-size', savedSize); switch(savedSize) { case smallFont: $(".smallFont").addClass("curFont"); break; case medFont: $(".medFont").addClass("curFont"); break; case largeFont: $(".largeFont").addClass("curFont"); break; default: $(".medFont").addClass("curFont"); } } else { $('#Zoom').css('font-size', medFont); $(".medFont").addClass("curFont"); } } $(document).ready(function() { fontResizer('14px', '18px', '22px'); if(isMobile){ SetTableStyle(); // 重置表格 // 清除图片缩进 $("#Zoom img").each(function() { $(this).parents("span,p").css("text-indent","0"); }) } if($(".Article_zw .sp video").length>0){ $("#Zoom video").each(function() { $(".Article_zw .sp video source[src='"+ $(this).attr("src") +"']").parent('video').remove(); }) } }); function ChangeColor(ColorName) { document.getElementById("c").style.background = ColorName; $('#Zoom').css('background', ColorName); $('#Zoom p').css('background', ColorName); $('#Zoom span').css('background', ColorName); $('#Zoom font').css('background', ColorName); } $(function(){ if($("#Zoom a[href*='.pdf']").length>0){ //window.location.href = $("#Zoom a[href*='.pdf']").eq(0).attr("href"); var _thePdf = $("#Zoom a[href*='.pdf']").eq(0).html().replace(/\s+/g,''); var _Zoomhtml = removeHTMLTag($("#Zoom").html()); if(_thePdf == _Zoomhtml){ //window.location.href = $("#Zoom a[href*='.pdf']").eq(0).attr("href"); window.location.href = '/viewpdf/web/viewer.html?file=' + $("#Zoom a[href*='.pdf']").eq(0).attr("href"); } } }); function removeHTMLTag(str) { str = str.replace(/<\/?[^>]*>/g,''); //去除HTML tag str = str.replace(/[ | ]*\n/g,'\n'); //去除行尾空白 str = str.replace(/\n[\s| | ]*\r/g,'\n'); //去除多余空行 str=str.replace(/ /ig,'');//去掉  str=str.replace(/\s/g,''); //将空格去掉 return str; } function openBox(titles,src){ var hwin = $(window).height(); var TisH = 620; if(hwin0){ cb(result.data[0].countValue) } } }); } //提交站点访问量 function SaveVisitBySite(siteId) { var formData = new FormData(); formData.append("siteId", siteId); $.ajax({ contentType: 'multipart/form-data;charset=UTF-8', url: "/stat/v1/siteVisit/saveSiteVisitRecord", type: 'POST', data: formData, dataType: "json", processData: false, // jQuery不要去处理发送的数据 contentType: false, success: function(result) { if(result.code == 200){ $("#VisitBySite").html("总访问量:"+result.data) } } }); } //提交栏目访问量 function SaveVisitByChannel(siteId, channelId) { var formData = new FormData(); formData.append("siteId", siteId); formData.append("channelId", channelId); $.ajax({ contentType: 'multipart/form-data;charset=UTF-8', url: "/stat/v1/channelVisit/saveChannelVisitRecord", type: 'POST', data: formData, dataType: "json", processData: false, contentType: false, success: function(result) { console.log(result); } }); } //提交文章访问量 function SaveVisitByDoc(ID, channelId, docId) { $.ajax({ url: "/stat/v1/docVisit/saveDocVisitRecord?docId="+docId, async:true, type:'get', dataType:'json', success: function(result) { //console.log(result); if(result.code==200){ $(".fwltj").html('浏览量:'+result.data+'次'); //$(DomeId).html("浏览量:"+result.data+"次"); } } }); } // 重置表格 function SetTableStyle() { let ZoomWidth = $("#Zoom").width(); let alertMsg = false; $("#Zoom table").each(function(index) { let theTable = $(this); theTable.css({"margin":"0"}); if(theTable.outerWidth() > ZoomWidth){ theTable.after('
'); $(".TableNum_"+index).append(theTable); alertMsg = true; } }) if(alertMsg){ layer.msg('当前页面存在较大表格,请左右滑动表格查看',{offset: 'b'}); } }