Jony/assets/js/joe.leaving.min.js

1 line
2.7 KiB
JavaScript
Raw Normal View History

2021-03-06 07:03:39 +00:00
document.addEventListener("DOMContentLoaded",()=>{const e=e=>window.btoa(unescape(encodeURIComponent(e))),o=e=>decodeURIComponent(escape(window.atob(e))),t=$(".joe_detail").attr("data-cid");$.ajax({url:Joe.BASE_API,type:"POST",data:{routeType:"baidu_record",site:window.location.href},success(e){if(e.data&&"已收录"===e.data)$("#Joe_Baidu_Record").css("color","#67C23A"),$("#Joe_Baidu_Record").html("已收录");else if(Joe.BAIDU_PUSH){$("#Joe_Baidu_Record").html('<span style="color: #E6A23C">未收录,推送中...</span>');const e=setTimeout(function(){$.ajax({url:Joe.BASE_API,type:"POST",data:{routeType:"baidu_push",domain:encodeURI(window.location.hostname),url:encodeURI(window.location.href)},success(e){e.error?$("#Joe_Baidu_Record").html('<span style="color: #F56C6C">推送失败,请检查!</span>'):$("#Joe_Baidu_Record").html('<span style="color: #67C23A">推送成功!</span>')}}),clearTimeout(e)},1e3)}else{const e=`https://ziyuan.baidu.com/linksubmit/url?sitename=${encodeURI(window.location.href)}`;$("#Joe_Baidu_Record").html(`<a target="_blank" href="${e}" rel="noopener noreferrer nofollow" style="color: #F56C6C">未收录,提交收录</a>`)}}});{let a=localStorage.getItem(e("views"))?JSON.parse(o(localStorage.getItem(e("views")))):[];const i=a.includes(t);i||$.ajax({url:Joe.BASE_API,type:"POST",data:{routeType:"handle_views",cid:t},success(o){if(1!==o.code)return;$("#Joe_Article_Views").html(`${o.data.views} 阅读`),a.push(t);const i=e("views"),n=e(JSON.stringify(a));localStorage.setItem(i,n)}})}{let e=100;const o=["#F8D800","#0396FF","#EA5455","#7367F0","#32CCBC","#F6416C","#28C76F","#9F44D3","#F55555","#736EFE","#E96D71","#DE4313","#D939CD","#4C83FF","#F072B6","#C346C2","#5961F9","#FD6585","#465EFB","#FFC600","#FA742B","#5151E5","#BB4E75","#FF52E5","#49C628","#00EAFF","#F067B4","#F067B4","#ff9a9e","#00f2fe","#4facfe","#f093fb","#6fa3ef","#bc99c4","#46c47c","#f9bb3c","#e8583d","#f68e5f"],t=(e,o)=>Math.floor(Math.random()*(o-e+1))+e,a=$(".joe_detail__leaving-list").width(),i=$(".joe_detail__leaving-list").height(),n=["20px 300px","20px 400px","20px 500px","30px 300px","30px 400px","30px 500px","40px 300px","40px 400px","40px 500px"],d=["300px 20px","400px 20px","500px 20px","300px 30px","400px 30px","500px 30px","300px 40px","400px 40px","500px 40px"];$(".joe_detail__leaving-list .item").each((l,c)=>{const s=t(1,99),p=o[t(0,o.length-1)],r=Math.ceil($(c).width()),x=Math.ceil($(c).height()),u=t(0,i-x),h=t(0,a-r);$(c).css({display:"block",zIndex:s,background:p,top:u,left:h,borderTopLeftRadius:d[t(0,d.length-1)],borderTopRightRadius:n[t(0,n.length-1)],borderBottomLeftRadius:n[t(0,n.length-1)],borderBottomRightRadius:n[t(0,n.length-1)]}),$(c).draggabilly({containment:!0}),$(c).on("dragStart",o=>{e++,$(c).css({zIndex:e})})})}});