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

1 line
30 KiB
JavaScript
Raw Normal View History

2021-05-08 05:54:42 +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",t=>{t.stopPropagation(),$(".joe_header__above-search .result").addClass("active")}),$(document).on("click",function(){$(".joe_header__above-search .result").removeClass("active")});const t=()=>{$(".joe_header__above-search .result").hasClass("active")&&$(".joe_header__above-search .result").removeClass("active")};$(document).on("scroll",()=>{window.requestAnimationFrame?window.requestAnimationFrame(t):t()})}$(".joe_dropdown").each(function(t,e){const o=$(this).find(".joe_dropdown__menu"),a=$(e).attr("trigger")||"click",n=$(e).attr("placement")||$(this).height()||0;o.css("top",n),"hover"===a?$(this).hover(()=>$(this).addClass("active"),()=>$(this).removeClass("active")):($(this).on("click",function(t){$(this).toggleClass("active"),$(document).one("click",()=>$(this).removeClass("active")),t.stopPropagation()}),o.on("click",t=>t.stopPropagation()))});{const t=()=>(document.documentElement.scrollTop||document.body.scrollTop)>300?$(".joe_action_item.scroll").addClass("active"):$(".joe_action_item.scroll").removeClass("active");t(),$(document).on("scroll",()=>{window.requestAnimationFrame?window.requestAnimationFrame(t):t()}),$(".joe_action_item.scroll").on("click",()=>window.scrollTo({top:0,behavior:"smooth"}))}if($(".joe_aside__item.timelife").length){let t=[{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 e=+new Date,o=new Date((new Date).toLocaleDateString()).getTime(),a=(e-o)/1e3/60/60,n=a/24*100;t[0].num=parseInt(a),t[0].percent=parseInt(n)+"%"}{let e={0:7,1:1,2:2,3:3,4:4,5:5,6:6},o=e[(new Date).getDay()],a=o/7*100;t[1].num=parseInt(o),t[1].percent=parseInt(a)+"%"}{let e=(new Date).getFullYear(),o=(new Date).getDate(),a=(new Date).getMonth()+1,n=new Date(e,a,0).getDate(),i=o/n*100;t[2].num=o,t[2].percent=parseInt(i)+"%"}{let e=(new Date).getMonth()+1,o=e/12*100;t[3].num=e,t[3].percent=parseInt(o)+"%"}let e="";t.forEach((t,o)=>{e+=`\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${t.title}\n\t\t\t\t\t\t\t\t<span class="text">${t.num}</span>\n\t\t\t\t\t\t\t\t${t.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: ${t.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">${t.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(e)}if($(".joe_aside__item.weather").length){const t=$(".joe_aside__item.weather").attr("data-key"),e=$(".joe_aside__item.weather").attr("data-style"),o={1:"FFFFFF",2:"4A4A4A",3:"FFFFFF"};window.WIDGET={CONFIG:{layout:2,width:"220",height:"270",background:e,dataColor:o[e],language:"zh",key:t}},$.getScript("https://widget.qweather.net/standard/static/js/he-standard-common.js?v=2.0")}if($("