Jony/assets/js/joe.global.min.js

1 line
28 KiB
JavaScript
Raw Normal View History

2021-05-17 02:27:29 +00:00
document.addEventListener("DOMContentLoaded",()=>{localStorage.getItem("data-night")?($(".joe_action_item.mode .icon-1").addClass("active"),$(".joe_action_item.mode .icon-2").removeClass("active")):($("html").removeAttr("data-night"),$(".joe_action_item.mode .icon-1").removeClass("active"),$(".joe_action_item.mode .icon-2").addClass("active")),$(".joe_action_item.mode").on("click",()=>{localStorage.getItem("data-night")?($(".joe_action_item.mode .icon-1").removeClass("active"),$(".joe_action_item.mode .icon-2").addClass("active"),$("html").removeAttr("data-night"),localStorage.removeItem("data-night")):($(".joe_action_item.mode .icon-1").addClass("active"),$(".joe_action_item.mode .icon-2").removeClass("active"),$("html").attr("data-night","night"),localStorage.setItem("data-night","night"))}),Joe.IS_MOBILE||"off"===Joe.DYNAMIC_BACKGROUND||!Joe.DYNAMIC_BACKGROUND||Joe.WALLPAPER_BACKGROUND_PC||$.getScript(window.Joe.THEME_URL+`assets/backdrop/${Joe.DYNAMIC_BACKGROUND}`);{$(".joe_header__above-search .input").on("click",e=>{e.stopPropagation(),$(".joe_header__above-search .result").addClass("active")}),$(document).on("click",function(){$(".joe_header__above-search .result").removeClass("active")});const e=()=>{$(".joe_header__above-search .result").hasClass("active")&&$(".joe_header__above-search .result").removeClass("active")};$(document).on("scroll",()=>{window.requestAnimationFrame?window.requestAnimationFrame(e):e()})}$(".joe_dropdown").each(function(e,t){const o=$(this).find(".joe_dropdown__menu"),a=$(t).attr("trigger")||"click",n=$(t).attr("placement")||$(this).height()||0;o.css("top",n),"hover"===a?$(this).hover(()=>$(this).addClass("active"),()=>$(this).removeClass("active")):($(this).on("click",function(e){$(this).toggleClass("active"),$(document).one("click",()=>$(this).removeClass("active")),e.stopPropagation()}),o.on("click",e=>e.stopPropagation()))});{const e=()=>(document.documentElement.scrollTop||document.body.scrollTop)>300?$(".joe_action_item.scroll").addClass("active"):$(".joe_action_item.scroll").removeClass("active");e(),$(document).on("scroll",()=>{window.requestAnimationFrame?window.requestAnimationFrame(e):e()}),$(".joe_action_item.scroll").on("click",()=>window.scrollTo({top:0,behavior:"smooth"}))}if($(".joe_aside__item.timelife").length){let e=[{title:"今日已经过去",endTitle:"小时",num:0,percent:"0%"},{title:"这周已经过去",endTitle:"天",num:0,percent:"0%"},{title:"本月已经过去",endTitle:"天",num:0,percent:"0%"},{title:"今年已经过去",endTitle:"个月",num:0,percent:"0%"}];{let t=+new Date,o=new Date((new Date).toLocaleDateString()).getTime(),a=(t-o)/1e3/60/60,n=a/24*100;e[0].num=parseInt(a),e[0].percent=parseInt(n)+"%"}{let t={0:7,1:1,2:2,3:3,4:4,5:5,6:6},o=t[(new Date).getDay()],a=o/7*100;e[1].num=parseInt(o),e[1].percent=parseInt(a)+"%"}{let t=(new Date).getFullYear(),o=(new Date).getDate(),a=(new Date).getMonth()+1,n=new Date(t,a,0).getDate(),i=o/n*100;e[2].num=o,e[2].percent=parseInt(i)+"%"}{let t=(new Date).getMonth()+1,o=t/12*100;e[3].num=t,e[3].percent=parseInt(o)+"%"}let t="";e.forEach((e,o)=>{t+=`\n\t\t\t\t\t\t<div class="item">\n\t\t\t\t\t\t\t<div class="title">\n\t\t\t\t\t\t\t\t${e.title}\n\t\t\t\t\t\t\t\t<span class="text">${e.num}</span>\n\t\t\t\t\t\t\t\t${e.endTitle}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class="progress">\n\t\t\t\t\t\t\t\t<div class="progress-bar">\n\t\t\t\t\t\t\t\t\t<div class="progress-bar-inner progress-bar-inner-${o}" style="width: ${e.percent}"></div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class="progress-percentage">${e.percent}</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>`}),$(".joe_aside__item.timelife .joe_aside__item-contain").html(t)}if($(".joe_aside__item.weather").length){const e=$(".joe_aside__item.weather").attr("data-key"),t=$(".joe_aside__item.weather").attr("data-style"),o={1:"FFFFFF",2:"4A4A4A",3:"FFFFFF"};window.WIDGET={CONFIG:{layout:2,width:"220",height:"270",background:t,dataColor:o[t],language:"zh",key:e}},$.getScript("https://widget.qweather.net/standard/static/js/he-standard-common.js?v=2.0")}if($("