1 line
15 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

$(function(){var e=window.location.href;if(e.indexOf("category_")>-1){var o=function(){var e=setInterval(function(){if(document.getElementById("csdn-toolbar")){clearInterval(e),r=document.getElementById("csdn-toolbar").offsetHeight;var o=document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop;o-l>0&&o<n-a&&a>0?t.css({position:"fixed","z-index":"999",left:c+"px",top:r,width:s}):t.css({position:"unset","z-index":"10",left:"0px",top:"0",width:s})}},100)},t=$("#column .column_info_box"),n=$("#column .column_article_list").height(),a=$("#column .column_article_list li").length?$("#column .column_article_list li").height():0,i=document.getElementsByTagName("main")[0],c=i.offsetLeft,s=i.offsetWidth,l=document.getElementsByTagName("header")[0].offsetHeight,r=0;o(),$(window).scroll(function(){o()}),$(window).resize(function(){c=i.offsetLeft,s=i.offsetWidth,o()})}}),$(function(){function e(){P="https://csdnimg.cn/release/download/images/pay_error.png",j="已扫码<br>请在手机端操作",$("#payCode").html('<div class="renovate"><img src="'+P+'"><span>'+j+"</span></div>"),$("#payCodeImg").html('<img class="repeat-again" src="'+P+'"><span class="text">'+j+"</span>")}function o(o){var c={goods_id:o,product_id:o,flag:17,request_type:4,is_use_balance:_,coupon_key:T,sale_source:N,success_function:t,error_function:a,timeout_function:i,get_pay_success_callback:n,payment_function:e,report_ext:{spm:"1001.2101.3001.10043"},spm:"1001.2101.3001.10043"};$("#payCode").html(S),$("#payCodeImg").html(D),cart.qrPay(c)}function t(e,o){E?r("payCode",o.pay_url):r("payCodeImg",o.pay_url),I=o.pay_url}function n(){q.boxshadow.fadeOut(function(){showToast({text:"支付成功",bottom:"10%",zindex:9e3,speed:500,time:1500}),window.location.reload(),q.payCode.fadeOut(function(){window.location.reload()})})}function a(e){showToast({text:e.errorMessage,bottom:"10%",zindex:9e3,speed:500,time:1500})}function i(){E?q.payCode.find("#payCode").html(F):q.getPay.find("#payCodeImg").html(R)}function c(e,o){var t=Number(e)-Number(o);return t>0?t.toFixed(2):t<0?t.toFixed(2):t}function s(e){$.ajax({type:"GET",url:"https://mall.csdn.net/mp/mallorder/api/internal/goods/getGoodsInfo?goods_id="+e+"&product_id="+e+"&flag=17",xhrFields:{withCredentials:!0},crossDomain:!0,success:function(t){k=t.data.available_amount,t.data.coupon_discount&&t.data.coupon_key&&(B=1*t.data.coupon_discount,T=t.data.coupon_key),V++,V<=1&&(0==k?(_=0,$(".pay-code-radio").prop("disabled",!0)):c(L,B)>0?(_=1,$(".pay-code-radio").attr("data-flag","true"),$(".pay-code-radio").prop("checked",!0)):(_=0,$(".pay-code-radio").prop("disabled",!0))),$(".pay-balance .balance").text(k),$(".pay-code-balance .balance").text(k),l(),o(e)}})}function l(){$(".subscribe-available-balance .subscribe-available-balance-t").css({display:"block"}),B?(c(L,B)>0?_?(c(c(L,B),k)>0?($(".available-balance-0").text("¥"+k),$(".available-balance-1").text("¥"+c(c(L,B),k))):($(".available-balance-0").text("¥"+c(L,B)),$(".available-balance-1").text("¥0")),$(".subscribe-price-box").css({display:"none"}),$(".subscribe-available-balance").css({display:"block"})):($(".available-balance-1").text("¥"+c(L,B)),$(".subscribe-price-box").css({display:"none"}),$(".subscribe-available-balance .subscribe-available-balance-t").css({display:"none"}),$(".subscribe-available-balance").css({display:"block"})):($(".available-balance-1").text("¥0"),$(".subscribe-price-box").css({display:"none"}),$(".subscribe-available-balance .subscribe-available-balance-t").css({display:"none"}),$(".subscribe-available-balance").css({display:"block"})),$(".coupons-box .coupons-money").html("¥"+B),$(".coupons-box").fadeIn()):_?(c(L,k)>0?($(".available-balance-0").text("¥"+k),$(".available-balance-1").text("¥"+c(L,k))):($(".available-balance-0").text("¥"+L),$(".available-balance-1").text("¥0")),$(".subscribe-price-box").css({display:"none"}),$(".subscribe-available-balance").css({display:"block"})):($(".now-price").text("¥"+L),$(".subscribe-available-balance").css({display:"none"}),$(".subscribe-price-box").css({display:"block"}))}function r(e,o){var t=qrcode(6,"M");t.addData(o),t.make(),$("#"+e).html(t.createImgTag(3,3)),$("#"+e).html($("#"+e).html()),E&&q.boxshadow.fadeIn(function(){q.payCode.fadeIn()})}function d(e){+new Date,+new Date(e);U-=1;var o=parseInt(U/60/60%24);o=o<10?"0"+o:o;var t=parseInt(U/60%60);t=t<10?"0"+t:t;var n=parseInt(U%60);n=n<10?"0"+n:n,$(".time-hour").text(o),$(".time-minite").text(t),$(".time-second").text(n)}function u(){$(".directory-boxshadow-dialog").hide(),setCookieBaseHour("vip_limited_time_num",(new Date).getTime(),24)}function p(e,o){if("popup"==e)window.csdn&&window.csdn.userOrderTip&&window.csdn.userOrderTip.show({tabs:["superVipForPopup"]});else{var t=document.createElement("a");t.style.display="none";var n=vipUrlV;o&&n.indexOf("spm")===-1&&(n+=n.indexOf("?")===-1?"?spm="+o:"&spm="+o),t.href=n,t.target="_blank",document.body.appendChild(t),t.click(),document.body.removeChild(t)}}function m(){var e=$(this),o=e.data("id");if(e.data("type"))var t=blogUrl+"phoenix/web/v1/subscribe/un-subscribe-study?columnId="+o;else var t=blogUrl+"phoenix/web/v1/subscribe/subscribe-study?columnId="+o;getCookie("UserName")?$.ajax({url:t,type:"post",dataType:"json",xhrFields:{withCredentials:!0},success:function(o){200==o.code&&o.data.status?e.data("type")?z.indexOf("/article/details/")>-1?window.location.reload():($(".studyvip-unsubscribe").css("display","inline-block"),$(".studyvip-subscribe").css("display","none")):z.indexOf("/article/details/")>-1?window.location.reload():($(".studyvip-subscribe").css("display","inline-block"),$(".studyvip-unsubscribe").css("display","none")):showToast({text:o.data.msg||"操作失败,请重试!",bottom:"10%",zindex:9e3,speed:500,time:1500})},error:function(e){showToast({text:e.data.msg||"操作失败,请重试!",bottom:"10%",zindex:9e3,speed:500,time:1500})}}):window.csdn.loginBox.show()}function b(e){var o=new RegExp("(^|&)"+e+"=([^&]*)(&|$)","i"),t=window.location.search.substr(1).match(o);return null!=t?unescape(t[2]):""}function f(e,o,t,n,a){if(window.csdn&&window.csdn.userOrderPayment){var i={params:[{flag:17,goodsId:e,productId:e}],goodsExtraInfo:{columnArticlesNum:o||0,columnSubscribeNum:t||0,hotSellingRank:n||0,viewCount:0,level:0,nickName:nickName}};a&&a.spm&&(i.report_ext={spm:a.spm},i.spm=a.spm),$.ajax({type:"GET",url:blogUrl+"phoenix/web/v1/column/purchase-info",dataType:"json",xhrFields:{withCredentials:!0},data:{columnId:e},success:function(e){200==e.code&&e.data&&(i.goodsExtraInfo.level=e.data.level,i.goodsExtraInfo.viewCount=e.data.viewCount)},complete:function(){window.csdn.userOrderPayment.show(i)}})}}function w(e,o){if(e.show){var t='<div class="column_coupon_main '+(e.receive?"active":"")+'"> <img class="column_coupon_icon" src="'+e.activityIcon+'" alt=""> <div class="column_coupon_text"> <span class="column_coupon_l">'+e.couponDesc+'</span> <span class="column_coupon_m"></span> <span class="column_coupon_r" data-couponId="'+e.groupNumber+'" data-columnId="'+o+'">'+(e.receive?"已领取":"立即领取")+"</span> </div> </div>";q.columnCouponBox.html(t),q.columnCouponBox.css({display:"flex"})}}function h(e,o,t){$.ajax({type:"GET",url:blogUrl+e,dataType:"json",xhrFields:{withCredentials:!0},data:{columnId:t},success:function(e){200==e.code?w(e.data,t):o.remove()},error:function(e){o.remove()}})}function g(e,o,t,n,a,i){$.ajax({type:"GET",url:blogUrl+e,dataType:"json",xhrFields:{withCredentials:!0},data:{columnId:t},success:function(c){200==c.code?c.data?(o.find(".column_coupon_main").addClass("active"),o.find(".column_coupon_r").html("已领取"),E?f(t,n,a,i):s(t)):setTimeout(function(){g(e,o,t)},500):showToast({text:c.message||"操作失败,请重试!",bottom:"10%",zindex:9e3,speed:500,time:1500})},error:function(e){showToast({text:e.message||"操作失败,请重试!",bottom:"10%",zindex:9e3,speed:500,time:1500})}})}function x(e,o,t,n,a,i){$.ajax({url:blogUrl+e,type:"post",dataType:"json",data:{columnId:t,groupNumber:o},xhrFields:{withCredentials:!0},success:function(e){200==e.code&&e.data?g(q.columnCouponStatus,q.columnCouponBox,t,n,a,i):showToast({text:e.message||"操作失败,请重试!",bottom:"10%",zindex:9e3,speed:500,time:1500})},error:function(e){showToast({text:e.message||"操作失败,请重试!",bottom:"10%",zindex:9e3,speed:500,time:1500})}})}function y(e){M.clear(),M.makeCode(e)}function v(e,o){var t={fromshare:"column"==A?"blogcolumn":"blogdetail"};e&&o&&(t={fromshare:"column"==A?"blogcolumn":"blogdetail",sharetype:e,shareId:o}),H="column"==A?currentUrl:articleDetailUrl,H+="?fromshare="+t.fromshare+"&sharetype="+("column"==A?"blogcolumn":"blogdetail")+"&sharerId="+("column"==A?SharecolumnId:articleId)+"&sharerefer=PC&sharesource="+currentUserName,y(H+"&sharefrom=qr"),Q=!0,setTimeout(function(){window.csdn.report&&"function"==typeof window.csdn.report.reportView&&window.csdn.report.reportView({spm:"3001.7493",extra:{type:"column"==A?"blogcolumn":"blogdetail"}}),$("#tool-QRcode").show()},100)}function C(e){var o=document.createElement("input");o.value=e,document.body.appendChild(o),o.select(),document.execCommand("Copy"),o.remove()}var _=0,k=0,I="",T="",B=0,N="",U=300;$(document).on("click",".tip-subscribe-column>span",function(){$(this).parent().find(".tip").fadeIn()}),$(document).on("click",".tip-subscribe-column .bt-close",function(){$(".tip-subscribe-column").find(".tip").fadeOut()});var O="",q={boxshadow:$(".skin-boxshadow"),btClose:$(".bt-close"),payCode:$(".pay-code"),btSubscribe:$(".bt-subscribe-article"),btSubscribeColumn:$(".bt-subscribe-text"),getPay:$(".get-pay"),columnCouponBox:$("#columnCouponBox"),columnCouponCheck:"phoenix/web/v1/coupon/check-column-coupon",columnCouponStatus:"phoenix/web/v1/coupon/get-column-coupon-status",columnCouponLook:"phoenix/web/v1/coupon/get-column-coupon"},E=!1,z=window.location.href;z.indexOf("category_")>-1&&(q.columnCouponBox.length&&(O=q.columnCouponBox.data("id"),h(q.columnCouponCheck,q.columnCouponBox,O)),q.getPay.length&&(E=!1,O=q.getPay.data("id"),getCookie("UserName")&&(N=b("sale_source"),s(O)))),z.indexOf("/article/details/")>-1&&q.columnCouponBox.length&&(E=!0,O=q.columnCouponBox.data("id"),h(q.columnCouponCheck,q.columnCouponBox,O)),$(document).on("click",".bt-subscribe",function(){getCookie("UserName")||window.csdn.loginBox.show()}),q.getPay.on("click",function(){E=!1,O=$(this).data("id"),o(O)}),q.payCode.on("click",".renovate",function(){o(O||$(this).parent().data("id"))}),q.btClose.on("click",function(){q.payCode.fadeOut(function(){q.boxshadow.fadeOut()})});var P=blogStaticHost+"dist/pc/img/pay-time-out.png",j="获取中",D='<img class="repeat-again" src="'+P+'"><span class="text">'+j+"</span>",S='<div class="renov-men"><img src="'+P+'"><span>'+j+"</span></div>",F='<div class="renovate"> <img src="'+blogStaticHost+'dist/pc/img/pay-time-out.png"> <span>点击重新获取</span></div>',R='<img class="repeat-again" src="'+blogStaticHost+'dist/pc/img/pay-time-out.png"><span class="text">点击重新获取</span>';$(".now-price").text();$(".pay-code-radio").click(function(){var e=$(this).attr("data-flag");"true"==e?(_=0,$(this).attr("data-flag","false"),$(this).prop("checked",!1)):(_=1,$(this).attr("data-flag","true"),$(this).prop("checked",!0)),s(O)});var L=$(".subscribe-price .now-price").text().slice(1),V=0;q.payCode.on("click",".blance-bt",function(){window.open(I)}),$(document).on("click",".articleColumnBt",function(){if(getCookie("UserName")){var e=$(this).data("id"),o=$(this).data("report-click"),t=$(this).data("sum")||0,n=$(this).data("people")||0,a=$(this).data("hotrank")||0;f(e,t,n,a,o)}else window.csdn.loginBox.show({spm:"1001.2101.3001.8610"})}),$(document).on("click",".ordertip_header_btn",function(){getCookie("vip_limited_time_num")||$.ajax({type:"GET",url:blogUrl+"phoenix/web/v1/coupon/get-vip-coupon-info",dataType:"json",xhrFields:{withCredentials:!0},success:function(e){if(200==e.code&&e.data&&e.data.canShow){$(".directory-boxshadow-dialog").show(),setCookieBaseHour("vip_limited_time_num",(new Date).getTime(),24),window.csdn.report&&"function"==typeof window.csdn.report.reportView&&window.csdn.report.reportView({spm:"1001.2101.3001.9621"}),$(".limited-num").text(parseInt(e.data.price/100)),e.data.title&&$(".vip-limited-time-top").text(e.data.title),d(e.data.expireDate);var o=setInterval(function(){U<=0?clearInterval(o):d(e.data.expireDate)},1e3)}},error:function(e){}})}),$(document).on("click",".limited-img",function(){u()}),$(document).on("click",".directory-boxshadow-dialog-box",function(){u()}),$(document).on("click",".column-studyvip-pass",function(){if(getCookie("UserName")){var e="",o=JSON.parse($(this).attr("data-report-click"));o&&o.spm&&(e=o.spm),p("control",e)}else window.csdn.loginBox.show()}),$(document).on("click",".column-studyvip-ajax",m),$(document).on("click","#columnCouponBox",function(e){if(getCookie("UserName")){if("column_coupon_r"==e.target.className&&!$(this).find(".column_coupon_main").hasClass("active")){var o=e.target.dataset.couponid,t=e.target.dataset.columnid,n=e.target.dataset.sum||0,a=e.target.dataset.people||0,i=e.target.dataset.hotrank||0;x(q.columnCouponLook,o,t,n,a,i)}}else window.csdn.loginBox.show()});var H="",G=!0,Q=!1,A=$("#tool-share").data("type"),M=new QRCode(document.getElementById("shareCode"),{width:120,height:120,colorDark:"#000000",colorLight:"#ffffff",correctLevel:QRCode.CorrectLevel.L});$("#tool-share").on({mouseenter:function(){setTimeout(function(){window.csdn.report&&"function"==typeof window.csdn.report.reportView&&window.csdn.report.reportView({spm:"3001.7493",extra:{type:"column"==A?"blogcolumn":"blogdetail"}})},50)},mouseover:function(){G?(v(),G=!1):Q&&$("#tool-QRcode").show()},mouseout:function(){$("#tool-QRcode").hide()}}),$("#copyPosterUrl").on("click",function(){H&&(window.csdn.report&&"function"==typeof window.csdn.report.reportClick&&window.csdn.report.reportClick({spm:"3001.7493",extra:{type:"column"==A?"blogcolumn":"blogdetail",from:"from_link"}}),C(H+"&sharefrom=from_link"),showToast({text:"文章链接已复制",bottom:"10%",zindex:9002,speed:500,time:1500}))}),$("#tool-QRcode").on("click",".btn-share",function(){console.log($(this).data("type"));var e=$(this).data("type"),o="",t="";switch("column"===A?(o=$(".column_title").text(),t=$(".column_text_desc").text()):(o=articleTitle,t=articleDesc),e){case"qq":window.csdn.report&&"function"==typeof window.csdn.report.reportClick&&window.csdn.report.reportClick({spm:"3001.7493",extra:{type:"column"==A?"blogcolumn":"blogdetail",from:"qq"}});var n=o+"-"+nickName+" "+H+"&sharefrom=qq想看更多下载CSDN APPhttps://www.csdn.net/apps/download/";window.open("https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url="+(H+"&sharefrom=qq")+"&title="+o+"&desc="+encodeURIComponent(n)+"&summary="+t,"_blank","width=615,height=600");break;case"weibo":window.csdn.report&&"function"==typeof window.csdn.report.reportClick&&window.csdn.report.reportClick({spm:"3001.7493",extra:{type:"column"==A?"blogcolumn":"blogdetail",from:"weibo"}});var a=o+"-"+nickName+" "+H+"&sharefrom=weibo想看更多下载@CSDN APPhttps://www.csdn.net/apps/download/";window.open("https://service.weibo.com/share/share.php?title="+encodeURIComponent(a),"_blank","width=615,height=600")}})});