PageSourceSearch

https://adonothing.github.io/js/fomal.js

js adonothing.github.io collected 2026-10-03 08:33:00 UTC 120,212 bytes, 3,561 lines download raw bytes

1/* 阅读进度 start */
2document.addEventListener('pjax:complete', function () {
3  window.onscroll = percent;
4});
5document.addEventListener('DOMContentLoaded', function () {
6  window.onscroll = percent;
7});
8// 页面百分比
9function percent() {
10
11  // 先让菜单栏消失
12  try {
13    rmf.showRightMenu(false);
14    $('.rmMask').attr('style', 'display: none');
15  } catch (err) {
16
17  }
18
19  let a = document.documentElement.scrollTop, // 卷去高度
20    b = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight) - document.documentElement.clientHeight, // 整个网页高度 减去 可视高度
21    result = Math.round(a / b * 100), // 计算百分比
22    btn = document.querySelector("#go-up"); // 获取按钮
23
24  if (result < 95) { // 如果阅读进度小于95% 就显示百分比
25    btn.childNodes[0].style.display = 'none'
26    btn.childNodes[1].style.display = 'block'
27    btn.childNodes[1].innerHTML = result + '<span>%</span>';
28  } else { // 如果大于95%就显示回到顶部图标
29    btn.childNodes[1].style.display = 'none'
30    btn.childNodes[0].style.display = 'block'
31  }
32}
33/* 阅读进度 end */
34
35//----------------------------------------------------------------
36
37/* 导航栏显示标题 start */
38
39document.addEventListener('pjax:complete', tonav);
40document.addEventListener('DOMContentLoaded', tonav);
41//响应pjax
42function tonav() {
43  document.getElementById("name-container").setAttribute("style", "display:none");
44  var position = $(window).scrollTop();
45  $(window).scroll(function () {
46    var scroll = $(window).scrollTop();
47    if (scroll > position) {
48      document.getElementById("name-container").setAttribute("style", "");
49      document.getElementsByClassName("menus_items")[1].setAttribute("style", "display:none!important");
50    } else {
51      document.getElementsByClassName("menus_items")[1].setAttribute("style", "");
52      document.getElementById("name-container").setAttribute("style", "display:none");
53    }
54    position = scroll;
55  });
56  //修复没有弄右键菜单的童鞋无法回顶部的问题
57  document.getElementById("page-name").innerText = document.title.split(" | Adunas🍀")[0];
58}
59
60function scrollToTop() {
61  document.getElementsByClassName("menus_items")[1].setAttribute("style", "");
62  document.getElementById("name-container").setAttribute("style", "display:none");
63  btf.scrollToDest(0, 500);
64}
65
66/* 导航栏显示标题 end */
67
68//----------------------------------------------------------------
69
70/* 欢迎信息 start */
71//get请求
72$.ajax({
73  type: 'get',
74  url: 'https://apis.map.qq.com/ws/location/v1/ip',
75  data: {
76    key: 'VUMBZ-7KDCW-JMLRD-3SDV4-6DOM2-KFBI7',  // 这里要写你的KEY!!!
77    output: 'jsonp',
78  },
79  dataType: 'jsonp',
80  success: function (res) {
81    ipLoacation = res;
82  }
83})
84function getDistance(e1, n1, e2, n2) {
85  const R = 6371
86  const { sin, cos, asin, PI, hypot } = Math
87  let getPoint = (e, n) => {
88    e *= PI / 180
89    n *= PI / 180
90    return { x: cos(n) * cos(e), y: cos(n) * sin(e), z: sin(n) }
91  }
92
93  let a = getPoint(e1, n1)
94  let b = getPoint(e2, n2)
95  let c = hypot(a.x - b.x, a.y - b.y, a.z - b.z)
96  let r = asin(c / 2) * 2 * R
97  return Math.round(r);
98}
99
100function showWelcome() {
101
102  let dist = getDistance(113.34499552, 23.15537143, ipLoacation.result.location.lng, ipLoacation.result.location.lat); //这里换成自己的经纬度
103  let pos = ipLoacation.result.ad_info.nation;
104  let ip;
105  let posdesc;
106  //根据国家、省份、城市信息自定义欢迎语
107  switch (ipLoacation.result.ad_info.nation) {
108    case "日本":
109      posdesc = "よろしく,一起去看樱花吗";
110      break;
111    case "美国":
112      posdesc = "Let us live in peace!";
113      break;
114    case "英国":
115      posdesc = "想同你一起夜乘伦敦眼";
116      break;
117    case "俄罗斯":
118      posdesc = "干了这瓶伏特加!";
119      break;
120    case "法国":
121      posdesc = "C'est La Vie";
122      break;
123    case "德国":
124      posdesc = "Die Zeit verging im Fluge.";
125      break;
126    case "澳大利亚":
127      posdesc = "一起去大堡礁吧!";
128      break;
129    case "加拿大":
130      posdesc = "拾起一片枫叶赠予你";
131      break;
132    case "中国":
133      pos = ipLoacation.result.ad_info.province + " " + ipLoacation.result.ad_info.city + " " + ipLoacation.result.ad_info.district;
134      ip = ipLoacation.result.ip;
135      switch (ipLoacation.result.ad_info.province) {
136        case "北京市":
137          posdesc = "北——京——欢迎你~~~";
138          break;
139        case "天津市":
140          posdesc = "讲段相声吧。";
141          break;
142        case "河北省":
143          posdesc = "山势巍巍成壁垒,天下雄关。铁马金戈由此向,无限江山。";
144          break;
145        case "山西省":
146          posdesc = "展开坐具长三尺,已占山河五百余。";
147          break;
148        case "内蒙古自治区":
149          posdesc = "天苍苍,野茫茫,风吹草低见牛羊。";
150          break;
151        case "辽宁省":
152          posdesc = "我想吃烤鸡架!";
153          break;
154        case "吉林省":
155          posdesc = "状元阁就是东北烧烤之王。";
156          break;
157        case "黑龙江省":
158          posdesc = "很喜欢哈尔滨大剧院。";
159          break;
160        case "上海市":
161          posdesc = "众所周知,中国只有两个城市。";
162          break;
163        case "江苏省":
164          switch (ipLoacation.result.ad_info.city) {
165            case "南京市":
166              posdesc = "这是我挺想去的城市啦。";
167              break;
168            case "苏州市":
169              posdesc = "上有天堂,下有苏杭。";
170              break;
171            default:
172              posdesc = "散装是必须要散装的。";
173              break;
174          }
175          break;
176        case "浙江省":
177          posdesc = "东风渐绿西湖柳,雁已还人未南归ã€
177‚";
178          break;
179        case "河南省":
180          switch (ipLoacation.result.ad_info.city) {
181            case "郑州市":
182              posdesc = "豫州之域,天地之中。";
183              break;
184            case "南阳市":
185              posdesc = "臣本布衣,躬耕于南阳。此南阳非彼南阳!";
186              break;
187            case "驻马店市":
188              posdesc = "峰峰有奇石,石石挟仙气。嵖岈山的花很美哦!";
189              break;
190            case "开封市":
191              posdesc = "刚正不阿包青天。";
192              break;
193            case "洛阳市":
194              posdesc = "洛阳牡丹甲天下。";
195              break;
196            default:
197              posdesc = "可否带我品尝河南烩面啦?";
198              break;
199          }
200          break;
201        case "安徽省":
202          posdesc = "蚌埠住了,芜湖起飞。";
203          break;
204        case "福建省":
205          posdesc = "井邑白云间,岩城远带山。";
206          break;
207        case "江西省":
208          posdesc = "落霞与孤鹜齐飞,秋水共长天一色。";
209          break;
210        case "山东省":
211          posdesc = "遥望齐州九点烟,一泓海水杯中泻。";
212          break;
213        case "湖北省":
214          posdesc = "来碗热干面!";
215          break;
216        case "湖南省":
217          posdesc = "74751,长沙斯塔克。";
218          break;
219        case "广东省":
220          posdesc = "老板来两斤福建人。";
221          break;
222        case "广西壮族自治区":
223          posdesc = "桂林山水甲天下。";
224          break;
225        case "海南省":
226          posdesc = "朝观日出逐白浪,夕看云起收霞光。";
227          break;
228        case "四川省":
229          posdesc = "康康川妹子。";
230          break;
231        case "贵州省":
232          posdesc = "茅台,学生,再塞200。";
233          break;
234        case "云南省":
235          posdesc = "玉龙飞舞云缠绕,万仞冰川直耸天。";
236          break;
237        case "西藏自治区":
238          posdesc = "躺在茫茫草原上,仰望蓝天。";
239          break;
240        case "陕西省":
241          posdesc = "来份臊子面加馍。";
242          break;
243        case "甘肃省":
244          posdesc = "羌笛何须怨杨柳,春风不度玉门关。";
245          break;
246        case "青海省":
247          posdesc = "牛肉干和老酸奶都好好吃。";
248          break;
249        case "宁夏回族自治区":
250          posdesc = "大漠孤烟直,长河落日圆。";
251          break;
252        case "新疆维吾尔自治区":
253          posdesc = "驼铃古道丝绸路,胡马犹闻唐汉风。";
254          break;
255        case "台湾省":
256          posdesc = "我在这头,大陆在那头。";
257          break;
258        case "香港特别行政区":
259          posdesc = "永定贼有残留地鬼嚎,迎击光非岁玉。";
260          break;
261        case "澳门特别行政区":
262          posdesc = "性感荷官,在线发牌。";
263          break;
264        default:
265          posdesc = "带我去你的城市逛逛吧!";
266          break;
267      }
268      break;
269    default:
270      posdesc = "带我去你的国家逛逛吧。";
271      break;
272  }
273
274  //根据本地时间切换欢迎语
275  let timeChange;
276  let date = new Date();
277  if (date.getHours() >= 5 && date.getHours() < 11) timeChange = "<span>上午好</span>,一日之计在于晨!";
278  else if (date.getHours() >= 11 && date.getHours() < 13) timeChange = "<span>中午好</span>,该摸鱼吃午饭了。";
279  else if (date.getHours() >= 13 && date.getHours() < 15) timeChange = "<span>下午好</span>,懒懒地睡个午觉吧!";
280  else if (date.getHours() >= 15 && date.getHours() < 16) timeChange = "<span>三点几啦</span>,一起饮茶呀!";
281  else if (date.getHours() >= 16 && date.getHours() < 19) timeChange = "<span>夕阳无限好!</span>";
282  else if (date.getHours() >= 19 && date.getHours() < 24) timeChange = "<span>晚上好</span>,夜生活嗨起来!";
283  else timeChange = "夜深了,早点休息,少熬夜。";
284
285  try {
286    //自定义文本和需要放的位置
287    document.getElementById("welcome-info").innerHTML =
288      `<b><center>🎉 欢迎信息 🎉</center>&emsp;&emsp;欢迎来自 <span style="color:var(--theme-color)">${pos}</span> 的小伙伴,${timeChange}
288您现在距离站长约 <span style="color:var(--theme-color)">${dist}</span> 公里,当前的IP地址为: <span style="color:var(--theme-color)">${ip}</span>, ${posdesc}</b>`;
289  } catch (err) {
290    // console.log("Pjax无法获取#welcome-info元素🙄🙄🙄")
291    `<b><center>🎉 错误,无法获取地理信息 🎉</center></b>`;
292  }
293}
294window.onload = showWelcome;
295// 如果使用了pjax在加上下面这行代码
296document.addEventListener('pjax:complete', showWelcome);
297
298/* 欢迎信息 end */
299
300//----------------------------------------------------------------
301
302/* 微博热搜 start */
303document.addEventListener('pjax:complete', getWeibo);
304document.addEventListener('DOMContentLoaded', getWeibo);
305
306function getWeibo() {
307  fetch('').then(data => data.json()).then(data => {  // 这里要写上你的API!!!
308    let html = '<style>.weibo-new{background:#ff3852}.weibo-hot{background:#ff9406}.weibo-jyzy{background:#ffc000}.weibo-recommend{background:#00b7ee}.weibo-adrecommend{background:#febd22}.weibo-friend{background:#8fc21e}.weibo-boom{background:#bd0000}.weibo-topic{background:#ff6f49}.weibo-topic-ad{background:#4dadff}.weibo-boil{background:#f86400}#weibo-container{overflow-y:auto;-ms-overflow-style:none;scrollbar-width:none}#weibo-container::-webkit-scrollbar{display:none}.weibo-list-item{display:flex;flex-direction:row;justify-content:space-between;flex-wrap:nowrap}.weibo-title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-right:auto}.weibo-num{float:right}.weibo-hotness{display:inline-block;padding:0 6px;transform:scale(.8) translateX(-3px);color:#fff;border-radius:8px}</style>'
309    html += '<div class="weibo-list">'
310    let hotness = {
311      '爆': 'weibo-boom',
312      '热': 'weibo-hot',
313      '沸': 'weibo-boil',
314      '新': 'weibo-new',
315      '荐': 'weibo-recommend',
316      '音': 'weibo-jyzy',
317      'å½±': 'weibo-jyzy',
318      '剧': 'weibo-jyzy',
319      '综': 'weibo-jyzy'
320    }
321    for (let item of data) {
322      html += '<div class="weibo-list-item"><div class="weibo-hotness ' + hotness[(item.hot || '荐')] + '">' + (item.hot || '荐') + '</div>'
323        + '<span class="weibo-title"><a title="' + item.title + '"href="' + item.url + '" target="_blank" rel="external nofollow noreferrer" style="color:#a08ed5">' + item.title + '</a></span>'
324        + '<div class="weibo-num"><span>' + item.num + '</span></div></div>'
325    }
326    html += '</div>'
327    document.getElementById('weibo-container').innerHTML = html
328  }).catch(function (error) {
329    console.log(error);
330  });
331}
332
333/* 微博热搜 end */
334
335//----------------------------------------------------------------
336
337/* 禁用f12与按键防抖 start */
338// 防抖全局计时器
339let TT = null;    //time用来控制事件的触发
340// 防抖函数:fn->逻辑 time->防抖时间
341function debounce(fn, time) {
342  if (TT !== null) clearTimeout(TT);
343  TT = setTimeout(fn, time);
344}
345
346// 复制提醒
347document.addEventListener("copy", function () {
348  debounce(function () {
349    new Vue({
350      data: function () {
351        this.$notify({
352          title: "哎嘿!复制成功🍬",
353          message: "若要转载最好保留原文链接哦,给你一个大大的赞!",
354          position: 'top-left',
355          offset: 50,
356          showClose: true,
357          type: "success",
358          duration: 5000
359        });
360      }
361    })
362  }, 300);
363})
364
365
366// f12提醒但不禁用
367document.onkeydown = function (e) {
368  if (123 == e.keyCode || (e.ctrlKey && e.shiftKey && (74 === e.keyCode || 73 === e.keyCode || 67 === e.keyCode)) || (e.ctrlKey && 85 === e.keyCode)) {
369    debounce(function () {
370      new Vue({
371        data: function () {
372          this.$notify({
373            title: "你已被发现😜",
374            message: "小伙子,扒源记住要遵循GPL协议!",
375            position: 'top-left',
376            offset: 50,
377            showClose: true,
378            type: "warning",
379            duration: 5000
380          });
381        }
382      })
383    }, 300);
384  }
385};
386/* 禁用f12与按键防抖 end */
387
388//----------------------------------------------------------------
389
390/* 雪花特效 start */
391if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) {
392  // 移动端不显示
393} else {
394  // document.write('<canvas id="snow" style="position:fixed;top:0;left:0;width:100%;height:100%;z-index:-2;pointer-events:none"></canvas>');
395
396  window && (() => {
397    let e = {
398      flakeCount: 50, // 雪花数目
399      minDist: 150,   // 最小距离
400      color: "255, 255, 255", // 雪花颜色
401      size: 1.5,  // 雪花大小
402      speed: .5,  // 雪花速度
403      opacity: .7,    // 雪花透明度
404      stepsize: .5    // 步距
405    };
406    const t = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || function (e) {
407      window.setTimeout(e, 1e3 / 60)
408    }
409      ;
410    window.requestAnimationFrame = t;
411    const i = document.getElementById("snow"),
412      n = i.getContext("2d"),
413      o = e.flakeCount;
414    let a = -100,
415      d = -100,
416      s = [];
417    i.width = window.innerWidth,
418      i.height = window.innerHeight;
419    const h = () => {
420      n.clearRect(0, 0, i.width, i.height);
421      const r = e.minDist;
422      for (let t = 0; t < o; t++) {
423        let o = s[t];
424        const h = a,
425          w = d,
426          m = o.x,
427          c = o.y,
428          p = Math.sqrt((h - m) * (h - m) + (w - c) * (w - c));
429        if (p < r) {
430          const e = (h - m) / p,
431            t = (w - c) / p,
432            i = r / (p * p) / 2;
433          o.velX -= i * e,
434            o.velY -= i * t
435        } else
436          o.velX *= .98,
437            o.velY < o.speed && o.speed - o.velY > .01 && (o.velY += .01 * (o.speed - o.velY)),
438            o.velX += Math.cos(o.step += .05) * o.stepSize;
439        n.fillStyle = "rgba(" + e.color + ", " + o.opacity + ")",
440          o.y += o.velY,
441          o.x += o.velX,
442          (o.y >= i.height || o.y <= 0) && l(o),
443          (o.x >= i.width || o.x <= 0) && l(o),
444          n.beginPath(),
445          n.arc(o.x, o.y, o.size, 0, 2 * Math.PI),
446          n.fill()
447      }
448      t(h)
449    }
450      , l = e => {
451        e.x = Math.floor(Math.random() * i.width),
452          e.y = 0,
453          e.size = 3 * Math.random() + 2,
454          e.speed = 1 * Math.random() + .5,
455          e.velY = e.speed,
456          e.velX = 0,
457          e.opacity = .5 * Math.random() + .3
458      }
459      ;
460    document.addEventListener("mousemove", (e => {
461      a = e.clientX,
462        d = e.clientY
463    }
464    )),
465      window.addEventListener("resize", (() => {
466        i.width = window.innerWidth,
467          i.height = window.innerHeight
468      }
469      )),
470      (() => {
471        for (let t = 0; t < o; t++) {
472          const t = Math.floor(Math.random() * i.width)
473            , n = Math.floor(Math.random() * i.height)
474            , o = 3 * Math.random() + e.size
475            , a = 1 * Math.random() + e.speed
476            , d = .5 * Math.random() + e.opacity;
477          s.push({
478            speed: a,
479            velX: 0,
480            velY: a,
481            x: t,
482            y: n,
483            size: o,
484            stepSize: Math.random() / 30 * e.stepsize,
485            step: 0,
486            angle: 180,
487            opacity: d
488          })
489        }
490        h()
491      }
492      )()
493  }
494  )();
495}
496
497/* 雪花特效 end */
498
499//----------------------------------------------------------------
500
501/* 星空特效 start */
502function dark() {
503  window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
504  var n, e, i, h, t = .05,
505    s = document.getElementById("universe"),
506    o = !0,
507    a = "180,184,240",
508    r = "226,225,142",
509    d = "226,225,224",
510    c = [];
511
512  function f() {
513    n = window.innerWidth, e = window.innerHeight, i = .216 * n, s.setAttribute("width", n), s.setAttribute("height", e)
514  }
515  function u() {
516    h.clearRect(0, 0, n, e);
517    for (var t = c.length, i = 0; i < t; i++) {
518      var s = c[i];
519      s.move(), s.fadeIn(), s.fadeOut(), s.draw()
520    }
521  }
522  function y() {
523    this.reset = function () {
524      this.giant = m(3), this.comet = !this.giant && !o && m(10), this.x = l(0, n - 10), this.y = l(0, e), this.r = l(1.1, 2.6), this.dx = l(t, 6 * t) + (this.comet + 1 - 1) * t * l(50, 120) + 2 * t, this.dy 
524= -l(t, 6 * t) - (this.comet + 1 - 1) * t * l(50, 120), this.fadingOut = null, this.fadingIn = !0, this.opacity = 0, this.opacityTresh = l(.2, 1 - .4 * (this.comet + 1 - 1)), this.do = l(5e-4, .002) + .001 * (this.comet + 1 - 1)
525    }, this.fadeIn = function () {
526      this.fadingIn && (this.fadingIn = !(this.opacity > this.opacityTresh), this.opacity += this.do)
527    }, this.fadeOut = function () {
528      this.fadingOut && (this.fadingOut = !(this.opacity < 0), this.opacity -= this.do / 2, (this.x > n || this.y < 0) && (this.fadingOut = !1, this.reset()))
529    }, this.draw = function () {
530      if (h.beginPath(), this.giant) h.fillStyle = "rgba(" + a + "," + this.opacity + ")", h.arc(this.x, this.y, 2, 0, 2 * Math.PI, !1); else if (this.comet) {
531        h.fillStyle = "rgba(" + d + "," + this.opacity + ")", h.arc(this.x, this.y, 1.5, 0, 2 * Math.PI, !1); for (var t = 0; t < 30; t++)h.fillStyle = "rgba(" + d + "," + (this.opacity - this.opacity / 20 * t) + ")", h.rect(this.x - this.dx / 4 * t, this.y - this.dy / 4 * t - 2, 2, 2), h.fill()
532      } else h.fillStyle = "rgba(" + r + "," + this.opacity + ")", h.rect(this.x, this.y, this.r, this.r);
533      h.closePath(), h.fill()
534    }, this.move = function () {
535      this.x += this.dx, this.y += this.dy, !1 === this.fadingOut && this.reset(), (this.x > n - n / 4 || this.y < 0) && (this.fadingOut = !0)
536    }, setTimeout(function () {
537      o = !1
538    }, 50)
539  }
540  function m(t) {
541    return Math.floor(1e3 * Math.random()) + 1 < 10 * t
542  }
543  function l(t, i) {
544    return Math.random() * (i - t) + t
545  }
546  f(), window.addEventListener("resize", f, !1), function () {
547    h = s.getContext("2d");
548    for (var t = 0; t < i; t++) c[t] = new y, c[t].reset();
549    u()
550  }(), function t() {
551    document.getElementsByTagName('html')[0].getAttribute('data-theme') == 'dark' && u(), window.requestAnimationFrame(t)
552  }()
553};
554dark()
555/* 星空特效 end */
556
557//----------------------------------------------------------------
558
559/* 表情放大 start */
560document.addEventListener('pjax:complete', function () {
561  if (document.getElementById('post-comment')) owoBig();
562});
563document.addEventListener('DOMContentLoaded', function () {
564  if (document.getElementById('post-comment')) owoBig();
565});
566
567// 表情放大
568function owoBig() {
569  let flag = 1, // 设置节流阀
570    owo_time = '', // 设置计时器
571    m = 3; // 设置放大倍数
572  // 创建盒子
573  let div = document.createElement('div'),
574    body = document.querySelector('body');
575  // 设置ID
576  div.id = 'owo-big';
577  // 插入盒子
578  body.appendChild(div)
579
580  // 构造observer
581  let observer = new MutationObserver(mutations => {
582
583    for (let i = 0; i < mutations.length; i++) {
584      let dom = mutations[i].addedNodes,
585        owo_body = '';
586      if (dom.length == 2 && dom[1].className == 'OwO-body') owo_body = dom[1];
587      // 如果需要在评论内容中启用此功能请解除下面的注释
588      // else if (dom.length == 1 && dom[0].className == 'tk-comment') owo_body = dom[0];
589      else continue;
590
591      // 禁用右键(手机端长按会出现右键菜单,为了体验给禁用掉)
592      if (document.body.clientWidth <= 768) owo_body.addEventListener('contextmenu', e => e.preventDefault());
593      // 鼠标移入
594      owo_body.onmouseover = (e) => {
595        if (flag && e.target.tagName == 'IMG') {
596          flag = 0;
597          // 移入300毫秒后显示盒子
598          owo_time = setTimeout(() => {
599            let height = e.path[0].clientHeight * m, // 盒子高
600              width = e.path[0].clientWidth * m, // 盒子宽
601              left = (e.x - e.offsetX) - (width - e.path[0].clientWidth) / 2, // 盒子与屏幕左边距离
602              top = e.y - e.offsetY; // 盒子与屏幕顶部距离
603
604            if ((left + width) > body.clientWidth) left -= ((left + width) - body.clientWidth + 10); // 右边缘检测,防止超出屏幕
605            if (left < 0) left = 10; // 左边缘检测,防止超出屏幕
606            // 设置盒子样式
607            div.style.cssText = `display:flex; height:${height}px; width:${width}px; left:${left}px; top:${top}px;`;
608            // 在盒子中插入图片
609            div.innerHTML = `<img src="${e.target.src}">`
610          }, 300);
611        }
612      };
613      // 鼠标移出隐藏盒子
614      owo_body.onmouseout = () => { div.style.display = 'none', flag = 1, clearTimeout(owo_time); }
615    }
616
617  })
618  observer.observe(document.getElementById('post-comment'), { subtree: true, childList: true })
619}
620/* 表情放大 end */
621
622//----------------------------------------------------------------
623
624/* 随便逛逛 start */
625// 随便逛逛
626// 发现有时会和当前页面重复,加一个判断
627function randomPost() {
628  fetch('/baidusitemap.xml').then(res => res.text()).then(str => (new window.DOMParser()).parseFromString(str, "text/xml")).then(data => {
629    let ls = data.querySelectorAll('url loc');
630    while (true) {
631      let url = ls[Math.floor(Math.random() * ls.length)].innerHTML;
632      if (location.href == url) continue;
633      location.href = url;
634      return;
635    }
636  })
637}
638/* 随便逛逛 end */
639
640//----------------------------------------------------------------
641
642/* 小猫咪 start */
643if (document.body.clientWidth > 992) {
644  function getBasicInfo() {
645    /* 窗口高度 */
646    var ViewH = $(window).height();
647    /* document高度 */
648    var DocH = $("body")[0].scrollHeight;
649    /* 滚动的高度 */
650    var ScrollTop = $(window).scrollTop();
651    /* 可滚动的高度 */
652    var S_V = DocH - ViewH;
653    var Band_H = ScrollTop / (DocH - ViewH) * 100;
654    return {
655      ViewH: ViewH,
656      DocH: DocH,
657      ScrollTop: ScrollTop,
658      Band_H: Band_H,
659      S_V: S_V
660    }
661  };
662  function show(basicInfo) {
663    if (basicInfo.ScrollTop > 0.001) {
664      $(".neko").css('display', 'block');
665    } else {
666      $(".neko").css('display', 'none');
667    }
668  }
669  (function ($) {
670    $.fn.nekoScroll = function (option) {
671      var defaultSetting = {
672        top: '0',
673        scroWidth: 6 + 'px',
674        z_index: 9999,
675        zoom: 0.9,
676        borderRadius: 5 + 'px',
677        right: 55.6 + 'px',
678        nekoImg: "https://bu.dusays.com/2022/07/20/62d812db74be9.png",
679        hoverMsg: "春天啦~",
680        color: "var(--theme-color)",
681        during: 500,
682        blog_body: "body",
683      };
684      var setting = $.extend(defaultSetting, option);
685      var getThis = this.prop("className") !== "" ? "." + this.prop("className") : this.prop("id") !== "" ? "#" +
686        this.prop("id") : this.prop("nodeName");
687      if ($(".neko").length == 0) {
688        this.after("<div class=\"neko\" id=" + setting.nekoname + " data-msg=\"" + setting.hoverMsg 
688+ "\"></div>");
689      }
690      let basicInfo = getBasicInfo();
691      $(getThis)
692        .css({
693          'position': 'fixed',
694          'width': setting.scroWidth,
695          'top': setting.top,
696          'height': basicInfo.Band_H * setting.zoom * basicInfo.ViewH * 0.01 + 'px',
697          'z-index': setting.z_index,
698          'background-color': setting.bgcolor,
699          "border-radius": setting.borderRadius,
700          'right': setting.right,
701          'background-image': 'url(' + setting.scImg + ')',
702          'background-image': '-webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.1) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.1) 75%, transparent 75%, transparent)', 'border-radius': '2em',
703          'background-size': 'contain'
704        });
705      $("#" + setting.nekoname)
706        .css({
707          'position': 'fixed',
708          'top': basicInfo.Band_H * setting.zoom * basicInfo.ViewH * 0.01 - 50 + 'px',
709          'z-index': setting.z_index * 10,
710          'right': setting.right,
711          'background-image': 'url(' + setting.nekoImg + ')',
712        });
713      show(getBasicInfo());
714      $(window)
715        .scroll(function () {
716          let basicInfo = getBasicInfo();
717          show(basicInfo);
718          $(getThis)
719            .css({
720              'position': 'fixed',
721              'width': setting.scroWidth,
722              'top': setting.top,
723              'height': basicInfo.Band_H * setting.zoom * basicInfo.ViewH * 0.01 + 'px',
724              'z-index': setting.z_index,
725              'background-color': setting.bgcolor,
726              "border-radius": setting.borderRadius,
727              'right': setting.right,
728              'background-image': 'url(' + setting.scImg + ')',
729              'background-image': '-webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.1) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.1) 75%, transparent 75%, transparent)', 'border-radius': '2em',
730              'background-size': 'contain'
731            });
732          $("#" + setting.nekoname)
733            .css({
734              'position': 'fixed',
735              'top': basicInfo.Band_H * setting.zoom * basicInfo.ViewH * 0.01 - 50 + 'px',
736              'z-index': setting.z_index * 10,
737              'right': setting.right,
738              'background-image': 'url(' + setting.nekoImg + ')',
739            });
740          if (basicInfo.ScrollTop == basicInfo.S_V) {
741            $("#" + setting.nekoname)
742              .addClass("showMsg")
743          } else {
744            $("#" + setting.nekoname)
745              .removeClass("showMsg");
746            $("#" + setting.nekoname)
747              .attr("data-msg", setting.hoverMsg);
748          }
749        });
750      this.click(function (e) {
751        btf.scrollToDest(0, 500)
752      });
753      $("#" + setting.nekoname)
754        .click(function () {
755          btf.scrollToDest(0, 500)
756        });
757      return this;
758    }
759  })(jQuery);
760
761  $(document).ready(function () {
762    //部分自定义
763    $("#myscoll").nekoScroll({
764      bgcolor: 'rgb(0 0 0 / .5)', //背景颜色,没有绳子背景图片时有效
765      borderRadius: '2em',
766      zoom: 0.9
767    }
768    );
769    //自定义(去掉以下注释,并注释掉其他的查看效果)
770    /*
771    $("#myscoll").nekoScroll({
772        nekoname:'neko1', //nekoname,相当于id
773        nekoImg:'img/猫咪.png', //neko的背景图片
774        scImg:"img/绳1.png", //绳子的背景图片
775        bgcolor:'#1e90ff', //背景颜色,没有绳子背景图片时有效
776        zoom:0.9, //绳子长度的缩放值
777        hoverMsg:'你好~喵', //鼠标浮动到neko上方的对话框信息
778        right:'100px', //距离页面右边的距离
779        fontFamily:'楷体', //对话框字体
780        fontSize:'14px', //对话框字体的大小
781        color:'#1e90ff', //对话框字体颜色
782        scroWidth:'8px', //绳子的宽度
783        z_index:100, //不用解释了吧
784        during:1200, //从顶部到底部滑动的时长
785    });
786    */
787  })
788}
789
790/* 小猫咪 end */
791
792//----------------------------------------------------------------
793
794/* 右键菜单 start */
795function setMask() {
796  //设置遮罩
797  if (document.getElementsByClassName("rmMask")[0] != undefined)
798    return document.getElementsByClassName("rmMask")[0];
799  mask = document.createElement('div');
800  mask.className = "rmMask";
801  mask.style.width = window.innerWidth + 'px';
802  mask.style.height = window.innerHeight + 'px';
803  mask.style.background = '#fff';
804  mask.style.opacity = '.0';
805  mask.style.position = 'fixed';
806  mask.style.top = '0';
807  mask.style.left = '0';
808  mask.style.zIndex = 998;
809  document.body.appendChild(mask);
810  document.getElementById("rightMenu").style.zIndex = 19198;
811  return mask;
812}
813
814function insertAtCursor(myField, myValue) {
815
816  //IE 浏览器
817  if (document.selection) {
818    myField.focus();
819    sel = document.selection.createRange();
820    sel.text = myValue;
821    sel.select();
822  }
823
824  //FireFox、Chrome等
825  else if (myField.selectionStart || myField.selectionStart == '0') {
826    var startPos = myField.selectionStart;
827    var endPos = myField.selectionEnd;
828
829    // 保存滚动条
830    var restoreTop = myField.scrollTop;
831    myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length);
832
833    if (restoreTop > 0) {
834      myField.scrollTop = restoreTop;
835    }
836
837    myField.focus();
838    myField.selectionStart = startPos + myValue.length;
839    myField.selectionEnd = startPos + myValue.length;
840  } else {
841    myField.value += myValue;
842    myField.focus();
843  }
844}
845
846let rmf = {};
847rmf.showRightMenu = function (isTrue, x = 0, y = 0) {
848  let $rightMenu = $('#rightMenu');
849  $rightMenu.css('top', x + 'px').css('left', y + 'px');
850
851  if (isTrue) {
852    $rightMenu.show();
853  } else {
854    $rightMenu.hide();
855  }
856}
857
858rmf.copyWordsLink = function () {
859  let url = window.location.href
860  let txa = document.createElement("textarea");
861  txa.value = url;
862  document.body.appendChild(txa)
863  txa.select();
864  document.execCommand("Copy");
865  document.body.removeChild(txa);
866}
867rmf.switchReadMode = function () {
868  const $body = document.body
869  $body.classList.add('read-mode')
870  const newEle = document.createElement('button')
871  newEle.type = 'button'
872  newEle.className = 'fas fa-sign-out-alt exit-readmode'
873  $body.appendChild(newEle)
874
875  function clickFn() {
876    $body.classList.remove('read-mode')
877    newEle.remove()
878    newEle.removeEventListener('click', clickFn)
879  }
880
881  newEle.addEventListener('click', clickFn)
882}
883
884//复制选中文字
885rmf.copySelect = function () {
886  document.execCommand('Copy', false, null);
887}
888
889//回到顶部
890rmf.scrollToTop = function () {
891  document.getElementsByClassName("menus_items")[1].setAttribute("style", "");
892  document.getElementById("name-container").setAttribute("style", "display:none");
893  btf.scrollToDest(0, 500);
894}
895
896document.body.addEventListener('touchmove', function () {
897
898}, { passive: false });
899
900function popupMenu() {
901  window.oncontextmenu = function (event) {
902    // if (event.ctrlKey) return true;
903
904    // 当关掉自定义右键时候直接返回
905    if (mouseMode == "off") return true;
906
907    $('.rightMenu-group.hide').hide();
908    if (document.getSelection().toString()) {
909      $('#menu-text').show();
910    }
911    if (document.getElementById('post')) {
912      $('#menu-post').show();
913    } else {
914      if (document.getElementById('page')) {
915        $('#menu-post').show();
916      }
917    }
918    var el = window.document.body;
919    el = event.target;
920    var a = /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\*\+,;=.]+$/
921    if (a.test(window.getSelection().toString()) && el.tagName != "A") {
922      $('#menu-too').show()
923    }
924    if (el.tagName == 'A') {
925      $('#menu-to').show()
926      rmf.open = function () {
927        if (el.href.indexOf("http://") == -1 && el.href.indexOf("https://") == -1 || el.href.indexOf("yisous.xyz") != -1) {
928          pjax.loadUrl(el.href)
929        }
930        else {
931          location.href = el.href
932        }
933      }
934      rmf.openWithNewTab = function () {
935        window.open(el.href);
936        // window.location.reload();
937      }
938      rmf.copyLink = function () {
939        let url = el.href
940        let txa = document.createElement("textarea");
941        txa.value = url;
942        document.body.appendChild(txa)
943        txa.select();
944        document.execCommand("Copy");
945        document.body.removeChild(txa);
946      }
947    } else if (el.tagName == 'IMG') {
948      $('#menu-img').show()
949      rmf.openWithNewTab = function () {
950        window.open(el.src);
951        // window.location.reload();
952      }
953      rmf.click = function () {
954        el.click()
955      }
956      rmf.copyLink = function () {
957        let url = el.src
958        let txa = document.createElement("textarea");
959        txa.value = url;
960        document.body.appendChild(txa)
961        txa.select();
962        document.execCommand("Copy");
963        document.body.removeChild(txa);
964      }
965      rmf.saveAs = function () {
966        var a = document.createElement('a');
967        var url = el.src;
968        var filename = url.split("/")[-1];
969        a.href = url;
970        a.download = filename;
971        a.click();
972        window.URL.revokeObjectURL(url);
973      }
974    } else if (el.tagName == "TEXTAREA" || el.tagName == "INPUT") {
975      $('#menu-paste').show();
976      rmf.paste = function () {
977        navigator.permissions
978          .query({
979            name: 'clipboard-read'
980          })
981          .then(result => {
982            if (result.state == 'granted' || result.state == 'prompt') {
983              //读取剪贴板
984              navigator.clipboard.readText().then(text => {
985                console.log(text)
986                insertAtCursor(el, text)
987              })
988            } else {
989              Snackbar.show({
990                text: '请允许读取剪贴板!',
991                pos: 'top-center',
992                showAction: false,
993              })
994            }
995          })
996      }
997    }
998    let pageX = event.clientX + 10;
999    let pageY = event.clientY;
1000    let rmWidth = $('#rightMenu').width();
1001    let rmHeight = $('#rightMenu').height();
1002    if (pageX + rmWidth > window.innerWidth) {
1003      pageX -= rmWidth + 10;
1004    }
1005    if (pageY + rmHeight > window.innerHeight) {
1006      pageY -= pageY + rmHeight - window.innerHeight;
1007    }
1008    mask = setMask();
1009    // 滚动消失的代码和阅读进度有冲突,因此放到readPercent.js里面了
1010    $(".rightMenu-item").click(() => {
1011      $('.rmMask').attr('style', 'display: none');
1012    })
1013    $(window).resize(() => {
1014      rmf.showRightMenu(false);
1015      $('.rmMask').attr('style', 'display: none');
1016    })
1017    mask.onclick = () => {
1018      $('.rmMask').attr('style', 'display: none');
1019    }
1020    rmf.showRightMenu(true, pageY, pageX);
1021    $('.rmMask').attr('style', 'display: flex');
1022    return false;
1023  };
1024
1025  window.addEventListener('click', function () {
1026    rmf.showRightMenu(false);
1027  });
1028}
1029if (!(navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) {
1030  popupMenu()
1031}
1032const box = document.documentElement
1033
1034function addLongtabListener(target, callback) {
1035  let timer = 0 // 初始化timer
1036
1037  target.ontouchstart = () => {
1038    timer = 0 // 重置timer
1039    timer = setTimeout(() => {
1040      callback();
1041      timer = 0
1042    }, 380) // 超时器能成功执行,说明是长按
1043  }
1044
1045  target.ontouchmove = () => {
1046    clearTimeout(timer) // 如果来到这里,说明是滑动
1047    timer = 0
1048  }
1049
1050  target.ontouchend = () => { // 到这里如果timer有值,说明此触摸时间不足380ms,是点击
1051    if (timer) {
1052      clearTimeout(timer)
1053    }
1054  }
1055}
1056
1057addLongtabListener(box, popupMenu)
1058
1059// 全屏
1060rmf.fullScreen = function () {
1061  if (document.fullscreenElement) document.exitFullscreen();
1062  else document.documentElement.requestFullscreen();
1063}
1064
1065// 右键开关
1066if (localStorage.getItem("mouse") == undefined) {
1067  localStorage.setItem("mouse", "on");
1068}
1069var mouseMode = localStorage.getItem("mouse");
1070function changeMouseMode() {
1071  if (localStorage.getItem("mouse") == "on") {
1072    mouseMode = "off";
1073    localStorage.setItem("mouse", "off");
1074    debounce(function () {
1075      new Vue({
1076        data: function () {
1077          this.$notify({
1078            title: "切换右键模式成功🍔",
1079            message: "当前鼠标右键已恢复为系统默认!",
1080            position: 'top-left',
1081            offset: 50,
1082            showClose: true,
1083            type: "success",
1084            duration: 5000
1085          });
1086        }
1087      })
1088    }, 300);
1089  } else {
1090    mouseMode = "on";
1091    localStorage.setItem("mouse", "on");
1092    debounce(function () {
1093      new Vue({
1094        data: function () {
1095          this.$notify({
1096            title: "切换右键模式成功🍔",
1097            message: "当前鼠标右键已更换为网站指定样式!",
1098            position: 'top-left',
1099            offset: 50,
1100            showClose: true,
1101            type: "success",
1102            duration: 5000
1103          });
1104        }
1105      })
1106    }, 300);
1107  }
1108}
1109/* 右键菜单 end */
1110
1111//----------------------------------------------------------------
1112
1113/* 控制台输出字符画 start */
1114var now1 = new Date();
1115
1116function createtime1() {
1117  var grt = new Date("12/01/2023 00:00:00"); //此处修改你的建站时间或者网站上线时间
1118  now1.setTime(now1.getTime() + 250);
1119  var days = (now1 - grt) / 1000 / 60 / 60 / 24;
1120  var dnum = Math.floor(days);
1121
1122  var ascll = [
1123    `欢迎来到Adunas🍀の异世界!`,
1124    `We are together and never give up ! 🍭🍭🍭`,
1125    `
1126        
1127███████  ██████  ███    ███  █████  ██      ██   ██  █████  ██    ██ ████████ 
1128██      ██    ██ ████  ████ ██   ██ ██      ██   ██ ██   ██ ██    ██    ██    
1129█████   ██    ██ ██ ████ ██ ███████ ██      ███████ ███████ ██    ██    ██    
1130██      ██    ██ ██  ██  ██ ██   ██ ██      ██   ██ ██   ██ ██    ██    ██    
1131██       ██████  ██      ██ ██   ██ ███████ ██   ██ ██   ██  ██████     ██   
1132                                              
1133`,
1134    "小站已经苟活",
1135    dnum,
1136    "天啦!",
1137    "©2023 By Adunas",
1138  ];
1139
1140  setTimeout(
1141    console.log.bind(
1142      console,
1143      `\n%c${ascll[0]} %c ${ascll[1]} %c ${ascll[2]} %c${ascll[3]}%c ${ascll[4]}%c ${ascll[5]}\n\n%c ${ascll[6]}\n`,
1144      "color:#39c5bb",
1145      "",
1146      "color:#39c5bb",
1147      "color:#39c5bb",
1148      "",
1149      "color:#39c5bb",
1150      ""
1151    )
1152  );
1153}
1154
1155createtime1();
1156
1157function createtime2() {
1158  var ascll2 = [`NCC2-036`, `调用前置摄像头拍照成功,识别为「大聪明」`, `Photo captured: `, ` 🤪 `];
1159
1160  setTimeout(
1161    console.log.bind(
1162      console,
1163      `%c ${ascll2[0]} %c ${ascll2[1]} %c \n${ascll2[2]} %c\n${ascll2[3]}`,
1164      "color:white; background-color:#10bcc0",
1165      "",
1166      "",
1167      'background:url("https://unpkg.zhimg.com/anzhiyu-assets@latest/image/common/tinggge.gif") no-repeat;font-size:450%'
1168    )
1169  );
1170
1171  setTimeout(console.log.bind(console, "%c WELCOME %c 欢迎光临,大聪明", "color:white; background-color:#23c682", ""));
1172
1173  setTimeout(
1174    console.warn.bind(
1175      console,
1176      "%c ⚡ Powered by Adunas🍀 %c 你正在访问Adunas🍀の异世界",
1177      "color:white; background-color:#f0ad4e",
1178      ""
1179    )
1180  );
1181
1182  setTimeout(console.log.bind(console, "%c W23-12 %c 系统监测到你已打开控制台", "color:white; background-color:#4f90d9", ""));
1183  setTimeout(
1184    console.warn.bind(console, "%c S013-782 %c 你现在正处于监控中", "color:white; background-color:#d9534f", "")
1185  );
1186}
1187createtime2();
1188
1189// 重写console方法
1190console.log = function () { };
1191console.error = function () { };
1192console.warn = function () { };
1193
1194/* 控制台输出字符画 end */
1195
1196//----------------------------------------------------------------
1197
1198/* 夜间模式切换动画 start */
1199function switchNightMode() {
1200  document.querySelector('body').insertAdjacentHTML('beforeend', '<div class="Cuteen_DarkSky"><div class="Cuteen_DarkPlanet"><div id="sun"></div><div id="moon"></div></div></div>'),
1201    setTimeout(function () {
1202      document.querySelector('body').classList.contains('DarkMode') ? (document.querySelector('body').classList.remove('DarkMode'), localStorage.setItem('isDark', '0'), document.getElementById('modeicon').setAttribute('xlink:href', '#icon-moon')) : (document.querySelector('body').classList.add('DarkMode'), localStorage.setItem('isDark', '1'), document.getElementById('modeicon').setAttribute('xlink:href', '#icon-sun')),
1203        setTimeout(function () {
1204          document.getElementsByClassName('Cuteen_DarkSky')[0].style.transition = 'opacity 3s';
1205          document.getElementsByClassName('Cuteen_DarkSky')[0].style.opacity = '0';
1206          setTimeout(function () {
1207            document.getElementsByClassName('Cuteen_DarkSky')[0].remove();
1208          }, 1e3);
1209        }, 2e3)
1210    })
1211  const nowMode = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light'
1212  if (nowMode === 'light') {
1213    // 先设置太阳月亮透明度
1214    document.getElementById("sun").style.opacity = "1";
1215    document.getElementById("moon").style.opacity = "0";
1216    setTimeout(function () {
1217      document.getElementById("sun").style.opacity = "0";
1218      document.getElementById("moon").style.opacity = "1";
1219    }, 1000);
1220
1221    activateDarkMode()
1222    saveToLocal.set('theme', 'dark', 2)
1223    // GLOBAL_CONFIG.Snackbar !== undefined && btf.snackbarShow(GLOBAL_CONFIG.Snackbar.day_to_night)
1224    document.getElementById('modeicon').setAttribute('xlink:href', '#icon-sun')
1225    // 延时弹窗提醒
1226    setTimeout(() => {
1227      new Vue({
1228        data: function () {
1229          this.$notify({
1230            title: "关灯啦🌙",
1231            message: "当前已成功切换至夜间模式!",
1232            position: 'top-left',
1233            offset: 50,
1234            showClose: true,
1235            type: "success",
1236            duration: 5000
1237          });
1238        }
1239      })
1240    }, 2000)
1241  } else {
1242    // 先设置太阳月亮透明度
1243    document.getElementById("sun").style.opacity = "0";
1244    document.getElementById("moon").style.opacity = "1";
1245    setTimeout(function () {
1246      document.getElementById("sun").style.opacity = "1";
1247      document.getElementById("moon").style.opacity = "0";
1248    }, 1000);
1249
1250    activateLightMode()
1251    saveToLocal.set('theme', 'light', 2)
1252    document.querySelector('body').classList.add('DarkMode'), document.getElementById('modeicon').setAttribute('xlink:href', '#icon-moon')
1253    setTimeout(() => {
1254      new Vue({
1255        data: function () {
1256          this.$notify({
1257            title: "开灯啦🌞",
1258            message: "当前已成功切换至白天模式!",
1259            position: 'top-left',
1260            offset: 50,
1261            showClose: true,
1262            type: "success",
1263            duration: 5000
1264          });
1265        }
1266      })
1267    }, 2000)
1268  }
1269  // handle some cases
1270  typeof utterancesTheme === 'function' && utterancesTheme()
1271  typeof FB === 'object' && window.loadFBComment()
1272  window.DISQUS && document.getElementById('disqus_thread').children.length && setTimeout(() => window.disqusReset(), 200)
1273}
1274
1275/* 夜间模式切换动画 end */
1276
1277//----------------------------------------------------------------
1278
1279/* 分享按钮 start */
1280// 分享本页
1281function share_() {
1282  let url = window.location.origin + window.location.pathname
1283  try {
1284    // 截取标题
1285    var title = document.title;
1286    var subTitle = title.endsWith("| Adunas🍀") ? title.substring(0, title.length - 14) : title;
1287    navigator.clipboard.writeText('Adunas🍀分享\n标题:' + subTitle + '\n链接:' + url + '\n欢迎来访!🍭🍭🍭');
1288    new Vue({
1289      data: function () {
1290        this.$notify({
1291          title: "成功复制分享信息🎉",
1292          message: "您现在可以通过粘贴直接跟小伙伴分享了!",
1293          position: 'top-left',
1294          offset: 50,
1295          showClose: true,
1296          type: "success",
1297          duration: 5000
1298        });
1299        // return { visible: false }
1300      }
1301    })
1302  } catch (err) {
1303    console.error('复制失败!', err);
1304  }
1305  // new ClipboardJS(".share", { text: function () { return '标题:' + document.title + '\n链接:' + url } });
1306  // btf.snackbarShow("本页链接已复制到剪切板,快去分享吧~")
1307}
1308
1309// 防抖
1310function share() {
1311  debounce(share_, 300);
1312}
1313
1314/* 分享按钮 end */
1315
1316//----------------------------------------------------------------
1317
1318/* 恶搞标题 start */
1319//动态标题
1320var OriginTitile = document.title;
1321var titleTime;
1322document.addEventListener('visibilitychange', function () {
1323  if (document.hidden) {
1324    //离开当前页面时标签显示内容
1325    document.title = '👀跑哪里去了~';
1326    clearTimeout(titleTime);
1327  } else {
1328    //返回当前页面时标签显示内容
1329    document.title = '🐖抓到你啦~';
1330    //两秒后变回正常标题
1331    titleTime = setTimeout(function () {
1332      document.title = OriginTitile;
1333    }, 2000);
1334  }
1335});
1336/* 恶搞标题 end */
1337
1338//----------------------------------------------------------------
1339
1340
1341/* 农历转换 start */
1342/**
1343
1344* @1900-2100区间内的公历、农历互转
1345
1346* @charset UTF-8
1347
1348* @Author  jiangjiazhi
1349
1350* @公历转农历:calendar.solar2lunar(1987,11,01); //[you can ignore params of prefix 0]
1351
1352* @农历转公历:calendar.lunar2solar(1987,09,10); //[you can ignore params of prefix 0]
1353
1354*/
1355
1356
1357
1358/**
1359
1360* 农历1900-2100的润大小信息表
1361
1362* @Array Of Property
1363
1364* @return Hex
1365
1366*/
1367
1368var lunarInfo = [0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2, // 1900-1909
1369
1370  0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977, // 1910-1919
1371
1372  0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, // 1920-1929
1373
1374  0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950, // 1930-1939
1375
1376  0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, // 1940-1949
1377
1378  0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5b0, 0x14573, 0x052b0, 0x0a9a8, 0x0e950, 0x06aa0, // 1950-1959
1379
1380  0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0, // 1960-1969
1381
1382  0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b6a0, 0x195a6, // 1970-1979
1383
1384  0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570, // 1980-1989
1385
1386  0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x05ac0, 0x0ab60, 0x096d5, 0x092e0, // 1990-1999
1387
1388  0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5, // 2000-2009
1389
1390  0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, // 2010-2019
1391
1392  0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530, // 2020-2029
1393
1394  0x05aa0, 0x076a3, 0x096d0, 0x04afb, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, // 2030-2039
1395
1396  0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0, // 2040-2049
1397
1398  0x14b63, 0x09370, 0x049f8, 0x04970, 0x064b0, 0x168a6, 0x0ea50, 0x06b20, 0x1a6c4, 0x0aae0, // 2050-2059
1399
1400  0x0a2e0, 0x0d2e3, 0x0c960, 0x0d557, 0x0d4a0, 0x0da50, 0x05d55, 0x056a0, 0x0a6d0, 0x055d4, // 2060-2069
1401
1402  0x052d0, 0x0a9b8, 0x0a950, 0x0b4a0, 0x0b6a6, 0x0ad50, 0x055a0, 0x0aba4, 0x0a5b0, 0x052b0, // 2070-2079
1403
1404  0x0b273, 0x06930, 0x07337, 0x06aa0, 0x0ad50, 0x14b55, 0x04b60, 0x0a570, 0x054e4, 0x0d160, // 2080-2089
1405
1406  0x0e968, 0x0d520, 0x0daa0, 0x16aa6, 0x056d0, 0x04ae0, 0x0a9d4, 0x0a2d0, 0x0d150, 0x0f252, // 2090-2099
1407
1408  0x0d520] // 2100
1409
1410
1411
1412var solarMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
1413
1414
1415
1416/**
1417
1418* 天干地支之天干速查表
1419
1420* @Array Of Property trans['甲','乙','丙','丁','戊','己','庚','辛','壬','癸']
1421
1422* @return Cn string
1423
1424*/
1425
1426var Gan = ['\u7532', '\u4e59', '\u4e19', '\u4e01', '\u620a', '\u5df1', '\u5e9a', '\u8f9b', '\u58ec', '\u7678']
1427
1428
1429
1430/**
1431
1432* 天干地支之地支速查表
1433
1434* @Array Of Property
1435
1436* @trans['子','丑','寅','卯','辰','巳','午','未','申','酉','戌','亥']
1437
1438* @return Cn string
1439
1440*/
1441
1442var Zhi = ['\u5b50', '\u4e11', '\u5bc5', '\u536f', '\u8fb0', '\u5df3', '\u5348', '\u672a', '\u7533', '\u9149', '\u620c', '\u4ea5']
1443
1444
1445
1446/**
1447
1448* 天干地支之地支速查表<=>生肖
1449
1450* @Array Of Property
1451
1452* @trans['鼠','牛','虎','兔','龙','蛇','马','羊','猴','鸡','狗','猪']
1453
1454* @return Cn string
1455
1456*/
1457
1458var Animals = ['\u9f20', '\u725b', '\u864e', '\u5154', '\u9f99', '\u86c7', '\u9a6c', '\u7f8a', '\u7334', '\u9e21', '\u72d7', '\u732a']
1459
1460
1461
1462/**
1463
1464* 24节气速查表
1465
1466* @Array Of Property
1467
1468* @trans['小寒','大寒','立春','雨水','惊蛰','春分','清明','谷雨','立夏','小满','芒种','夏至','小暑','大暑','立秋','处暑','白露','秋分','寒露','霜降','立冬','小雪','大雪','冬至']
1469
1470* @return Cn string
1471
1472*/
1473
1474var solarTerm = ['\u5c0f\u5bd2', '\u5927\u5bd2', '\u7acb\u6625', '\u96e8\u6c34', '\u60ca\u86f0', '\u6625\u5206', '\u6e05\u660e', '\u8c37\u96e8', '\u7acb\u590f', '\u5c0f\u6ee1', '\u8292\u79cd', '\u590f\u81f3', '\u5c0f\u6691', '\u5927\u6691', '\u7acb\u79cb', '\u5904\u6691', '\u767d\u9732', '\u79cb\u5206', '\u5bd2\u9732', '\u971c\u964d', '\u7acb\u51ac', '\u5c0f\u96ea', '\u5927\u96ea', '\u51ac\u81f3']
1475
1476
1477
1478/**
1479
1480* 1900-2100各年的24节气日期速查表
1481
1482* @Array Of Property
1483
1484* @return 0x string For splice
1485
1486*/
1487
1488var sTermInfo = ['9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f',
1489
1490  '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e',
1491
1492  '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa',
1493
1494  '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f',
1495
1496  'b027097bd097c36b0b6fc9274c91aa', '9778397bd19801ec9210c965cc920e', '97b6b97bd19801ec95f8c965cc920f',
1497
1498  '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd197c36c9210c9274c91aa',
1499
1500  '97b6b97bd19801ec95f8c965cc920e', '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2',
1501
1502  '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec95f8c965cc920e', '97bcf97c3598082c95f8e1cfcc920f',
1503
1504  '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e',
1505
1506  '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
1507
1508  '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722',
1509
1510  '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f',
1511
1512  '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e',
1513
1514  '97bcf97c359801ec95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
1515
1516  '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd097bd07f595b0b6fc920fb0722',
1517
1518  '9778397bd097c36b0b6fc9210c8dc2', '9778397bd19801ec9210c9274c920e', '97b6b97bd19801ec95f8c965cc920f',
1519
1520  '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e',
1521
1522  '97b6b97bd19801ec95f8c965cc920f', '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2',
1523
1524  '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bd07f1487f595b0b0bc920fb0722',
1525
1526  '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e',
1527
1528  '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
1529
1530  '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722',
1531
1532  '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f531b0b0bb0b6fb0722',
1533
1534  '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e',
1535
1536  '97bcf7f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
1537
1538  '97b6b97bd19801ec9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722',
1539
1540  '9778397bd097c36b0b6fc9210c91aa', '97b6b97bd197c36c9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722',
1541
1542  '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e',
1543
1544  '97b6b7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2',
1545
1546  '9778397bd097c36b0b70c9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722',
1547
1548  '7f0e397bd097c35b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721',
1549
1550  '7f0e27f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
1551
1552  '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722',
1553
1554  '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722',
1555
1556  '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721',
1557
1558  '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
1559
1560  '97b6b7f0e47f531b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722',
1561
1562  '9778397bd097c36b0b6fc9210c91aa', '97b6b7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722',
1563
1564  '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '977837f0e37f149b0723b0787b0721',
1565
1566  '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c35b0b6fc9210c8dc2',
1567
1568  '977837f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722',
1569
1570  '7f0e397bd097c35b0b6fc9210c8dc2', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721',
1571
1572  '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '977837f0e37f14998082b0787b06bd',
1573
1574  '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722',
1575
1576  '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722',
1577
1578  '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721',
1579
1580  '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd',
1581
1582  '7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722',
1583
1584  '977837f0e37f14998082b0723b06bd', '7f07e7f0e37f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722',
1585
1586  '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b0721',
1587
1588  '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f595b0b0bb0b6fb0722', '7f0e37f0e37f14898082b0723b02d5',
1589
1590  '7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f531b0b0bb0b6fb0722',
1591
1592  '7f0e37f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721',
1593
1594  '7f0e37f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd',
1595
1596  '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35',
1597
1598  '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722',
1599
1600  '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f149b0723b0787b0721',
1601
1602  '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0723b06bd',
1603
1604  '7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', '7f0e37f0e366aa89801eb072297c35',
1605
1606  '7ec967f0e37f14998082b0723b06bd', '7f07e7f0e37f14998083b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722',
1607
1608  '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14898082b0723b02d5', '7f07e7f0e37f14998082b0787b0721',
1609
1610  '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66aa89801e9808297c35', '665f67f0e37f14898082b0723b02d5',
1611
1612  '7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66a449801e9808297c35',
1613
1614  '665f67f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721',
1615
1616  '7f0e36665b66a449801e9808297c35', '665f67f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd',
1617
1618  '7f07e7f0e47f531b0723b0b6fb0721', '7f0e26665b66a449801e9808297c35', '665f67f0e37f1489801eb072297c35',
1619
1620  '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722']
1621
1622
1623
1624/**
1625
1626 * 数字转中文速查表
1627
1628* @Array Of Property
1629
1630* @trans ['日','一','二','三','四','五','六','七','八','九','十']
1631
1632* @return Cn string
1633
1634 */
1635
1636var nStr1 = ['\u65e5', '\u4e00', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341']
1637
1638
1639
1640/**
1641
1642* 日期转农历称呼速查表
1643
1644* @Array Of Property
1645
1646* @trans ['初','十','廿','卅']
1647
1648* @return Cn string
1649
1650*/
1651
1652var nStr2 = ['\u521d', '\u5341', '\u5eff', '\u5345']
1653
1654
1655
1656/**
1657
1658* 月份转农历称呼速查表
1659
1660* @Array Of Property
1661
1662* @trans ['正','一','二','三','四','五','六','七','八','九','十','冬','腊']
1663
1664* @return Cn string
1665
1666*/
1667
1668var nStr3 = ['\u6b63', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341', '\u51ac', '\u814a']
1669
1670
1671
1672/**
1673
1674* 返回农历y年一整年的总天数
1675
1676* @param lunar Year
1677
1678 * @return Number
1679
1680* @eg:var count = calendar.lYearDays(1987) ;//count=387
1681
1682*/
1683
1684function lYearDays(y) {
1685
1686  var i
1687
1688  var sum = 348
1689
1690  for (i = 0x8000; i > 0x8; i >>= 1) { sum += (lunarInfo[y - 1900] & i) ? 1 : 0 }
1691
1692  return (sum + leapDays(y))
1693
1694}
1695
1696
1697
1698/**
1699
1700* 返回农历y年闰月是哪个月;若y年没有闰月 则返回0
1701
1702* @param lunar Year
1703
1704* @return Number (0-12)
1705
1706 * @eg:var leapMonth = calendar.leapMonth(1987) ;//leapMonth=6
1707
1708*/
1709
1710function leapMonth(y) { // 闰字编码 \u95f0
1711
1712  return (lunarInfo[y - 1900] & 0xf)
1713
1714}
1715
1716
1717
1718/**
1719
1720* 返回农历y年闰月的天数 若该年没有闰月则返回0
1721
1722* @param lunar Year
1723
1724* @return Number (0、29、30)
1725
1726* @eg:var leapMonthDay = calendar.leapDays(1987) ;//leapMonthDay=29
1727
1728*/
1729
1730function leapDays(y) {
1731
1732  if (leapMonth(y)) {
1733
1734    return ((lunarInfo[y - 1900] & 0x10000) ? 30 : 29)
1735
1736  }
1737
1738  return (0)
1739
1740}
1741
1742
1743
1744/**
1745
1746* 返回农历y年m月(非闰月)的总天数,计算m为闰月时的天数请使用leapDays方法
1747
1748* @param lunar Year
1749
1750* @return Number (-1、29、30)
1751
1752 * @eg:var MonthDay = calendar.monthDays(1987,9) ;//MonthDay=29
1753
1754*/
1755
1756function monthDays(y, m) {
1757
1758  if (m > 12 || m < 1) { return -1 }// 月份参数从1至12,参数错误返回-1
1759
1760  return ((lunarInfo[y - 1900] & (0x10000 >> m)) ? 30 : 29)
1761
1762}
1763
1764
1765
1766/**
1767
1768* 返回公历(!)y年m月的天数
1769
1770* @param solar Year
1771
1772* @return Number (-1、28、29、30、31)
1773
1774* @eg:var solarMonthDay = calendar.leapDays(1987) ;//solarMonthDay=30
1775
1776*/
1777
1778function solarDays(y, m) {
1779
1780  if (m > 12 || m < 1) { return -1 } // 若参数错误 返回-1
1781
1782  var ms = m - 1
1783
1784  if (ms === 1) { // 2月份的闰平规律测算后确认返回28或29
1785
1786    return (((y % 4 === 0) && (y % 100 !== 0) || (y % 400 === 0)) ? 29 : 28)
1787
1788  } else {
1789
1790    return (solarMonth[ms])
1791
1792  }
1793
1794}
1795
1796
1797
1798/**
1799
1800* 农历年份转换为干支纪年
1801
1802* @param  lYear 农历年的年份数
1803
1804* @return Cn string
1805
1806*/
1807
1808function toGanZhiYear(lYear) {
1809
1810  var ganKey = (lYear - 3) % 10
1811
1812  var zhiKey = (lYear - 3) % 12
1813
1814  if (ganKey === 0) ganKey = 10 // 如果余数为0则为最后一个天干
1815
1816  if (zhiKey === 0) zhiKey = 12 // 如果余数为0则为最后一个地支
1817
1818  return Gan[ganKey - 1] + Zhi[zhiKey - 1]
1819
1820}
1821
1822
1823
1824/**
1825
1826* 公历月、日判断所属星座
1827
1828* @param  cMonth [description]
1829
1830* @param  cDay [description]
1831
1832* @return Cn string
1833
1834*/
1835
1836function toAstro(cMonth, cDay) {
1837
1838  var s = '\u9b54\u7faf\u6c34\u74f6\u53cc\u9c7c\u767d\u7f8a\u91d1\u725b\u53cc\u5b50\u5de8\u87f9\u72ee\u5b50\u5904\u5973\u5929\u79e4\u5929\u874e\u5c04\u624b\u9b54\u7faf'
1839
1840  var arr = [20, 19, 21, 21, 21, 22, 23, 23, 23, 23, 22, 22]
1841
1842  return s.substr(cMonth * 2 - (cDay < arr[cMonth - 1] ? 2 : 0), 2) + '\u5ea7' // 座
1843
1844}
1845
1846
1847
1848/**
1849
1850* 传入offset偏移量返回干支
1851
1852* @param offset 相对甲子的偏移量
1853
1854* @return Cn string
1855
1856*/
1857
1858function toGanZhi(offset) {
1859
1860  return Gan[offset % 10] + Zhi[offset % 12]
1861
1862}
1863
1864
1865
1866/**
1867
1868* 传入公历(!)y年获得该年第n个节气的公历日期
1869
1870* @param y公历年(1900-2100);n二十四节气中的第几个节气(1~24);从n=1(小寒)算起
1871
1872* @return day Number
1873
1874* @eg:var _24 = calendar.getTerm(1987,3) ;//_24=4;意即1987年2月4日立春
1875
1876*/
1877
1878function getTerm(y, n) {
1879
1880  if (y < 1900 || y > 2100) { return -1 }
1881
1882  if (n < 1 || n > 24) { return -1 }
1883
1884  var _table = sTermInfo[y - 1900]
1885
1886  var _info = [
1887
1888    parseInt('0x' + _table.substr(0, 5)).toString(),
1889
1890    parseInt('0x' + _table.substr(5, 5)).toString(),
1891
1892    parseInt('0x' + _table.substr(10, 5)).toString(),
1893
1894    parseInt('0x' + _table.substr(15, 5)).toString(),
1895
1896    parseInt('0x' + _table.substr(20, 5)).toString(),
1897
1898    parseInt('0x' + _table.substr(25, 5)).toString()
1899
1900  ]
1901
1902  var _calday = [
1903
1904    _info[0].substr(0, 1),
1905
1906    _info[0].substr(1, 2),
1907
1908    _info[0].substr(3, 1),
1909
1910    _info[0].substr(4, 2),
1911
1912
1913
1914    _info[1].substr(0, 1),
1915
1916    _info[1].substr(1, 2),
1917
1918    _info[1].substr(3, 1),
1919
1920    _info[1].substr(4, 2),
1921
1922
1923
1924    _info[2].substr(0, 1),
1925
1926    _info[2].substr(1, 2),
1927
1928    _info[2].substr(3, 1),
1929
1930    _info[2].substr(4, 2),
1931
1932
1933
1934    _info[3].substr(0, 1),
1935
1936    _info[3].substr(1, 2),
1937
1938    _info[3].substr(3, 1),
1939
1940    _info[3].substr(4, 2),
1941
1942
1943
1944    _info[4].substr(0, 1),
1945
1946    _info[4].substr(1, 2),
1947
1948    _info[4].substr(3, 1),
1949
1950    _info[4].substr(4, 2),
1951
1952
1953
1954    _info[5].substr(0, 1),
1955
1956    _info[5].substr(1, 2),
1957
1958    _info[5].substr(3, 1),
1959
1960    _info[5].substr(4, 2)
1961
1962  ]
1963
1964  return parseInt(_calday[n - 1])
1965
1966}
1967
1968
1969
1970/**
1971
1972* 传入农历数字月份返回汉语通俗表示法
1973
1974* @param lunar month
1975
1976* @return Cn string
1977
1978* @eg:var cnMonth = calendar.toChinaMonth(12) ;//cnMonth='腊月'
1979
1980*/
1981
1982function toChinaMonth(m) { // 月 => \u6708
1983
1984  if (m > 12 || m < 1) { return -1 } // 若参数错误 返回-1
1985
1986  var s = nStr3[m - 1]
1987
1988  s += '\u6708' // 加上月字
1989
1990  return s
1991
1992}
1993
1994
1995
1996/**
1997
1998* 传入农历日期数字返回汉字表示法
1999
2000* @param lunar day
2001
2002* @return Cn string
2003
2004* @eg:var cnDay = calendar.toChinaDay(21) ;//cnMonth='廿一'
2005
2006*/
2007
2008function toChinaDay(d) { // 日 => \u65e5
2009
2010  var s
2011
2012  switch (d) {
2013
2014    case 10:
2015
2016      s = '\u521d\u5341'
2017
2018      break
2019
2020    case 20:
2021
2022      s = '\u4e8c\u5341'
2023
2024      break
2025
2026    case 30:
2027
2028      s = '\u4e09\u5341'
2029
2030      break
2031
2032    default:
2033
2034      s = nStr2[Math.floor(d / 10)]
2035
2036      s += nStr1[d % 10]
2037
2038  }
2039
2040  return (s)
2041
2042}
2043
2044
2045
2046/**
2047
2048* 年份转生肖[!仅能大致转换] => 精确划分生肖分界线是“立春”
2049
2050* @param y year
2051
2052* @return Cn string
2053
2054* @eg:var animal = calendar.getAnimal(1987) ;//animal='兔'
2055
2056*/
2057
2058function getAnimal(y) {
2059
2060  return Animals[(y - 4) % 12]
2061
2062}
2063
2064
2065
2066/**
2067
2068* 传入阳历年月日获得详细的公历、农历object信息 <=>JSON
2069
2070* @param y  solar year
2071
2072* @param m  solar month
2073
2074* @param d  solar day
2075
2076* @return JSON object
2077
2078* @eg:console.log(calendar.solar2lunar(1987,11,01));
2079
2080*/
2081
2082function solar2lunar(y, m, d) { // 参数区间1900.1.31~2100.12.31
2083
2084  // 年份限定、上限
2085
2086  if (y < 1900 || y > 2100) {
2087
2088    return -1 // undefined转换为数字变为NaN
2089
2090  }
2091
2092  // 公历传参最下限
2093
2094  if (y === 1900 && m === 1 && d < 31) {
2095
2096    return -1
2097
2098  }
2099
2100  // 未传参  获得当天
2101
2102  var objDate = null
2103
2104  if (!y) {
2105
2106    objDate = new Date()
2107
2108  } else {
2109
2110    objDate = new Date(y, parseInt(m) - 1, d)
2111
2112  }
2113
2114  var i
2115
2116  var leap = 0
2117
2118  var temp = 0
2119
2120  // 修正ymd参数
2121
2122  y = objDate.getFullYear()
2123
2124  m = objDate.getMonth() + 1
2125
2126  d = objDate.getDate()
2127
2128  var offset = (Date.UTC(objDate.getFullYear(), objDate.getMonth(), objDate.getDate()) - Date.UTC(1900, 0, 31)) / 86400000
2129
2130  for (i = 1900; i < 2101 && offset > 0; i++) {
2131
2132    temp = lYearDays(i)
2133
2134    offset -= temp
2135
2136  }
2137
2138  if (offset < 0) {
2139
2140    offset += temp; i--
2141
2142  }
2143
2144
2145
2146  // 是否今天
2147
2148  var isTodayObj = new Date()
2149
2150  var isToday = false
2151
2152  if (isTodayObj.getFullYear() === y && isTodayObj.getMonth() + 1 === m && isTodayObj.getDate() === d) {
2153
2154    isToday = true
2155
2156  }
2157
2158  // 星期几
2159
2160  var nWeek = objDate.getDay()
2161
2162  var cWeek = nStr1[nWeek]
2163
2164  // 数字表示周几顺应天朝周一开始的惯例
2165
2166  if (nWeek === 0) {
2167
2168    nWeek = 7
2169
2170  }
2171
2172  // 农历年
2173
2174  var year = i
2175
2176  leap = leapMonth(i) // 闰哪个月
2177
2178  var isLeap = false
2179
2180
2181
2182  // 效验闰月
2183
2184  for (i = 1; i < 13 && offset > 0; i++) {
2185
2186    // 闰月
2187
2188    if (leap > 0 && i === (leap + 1) && isLeap === false) {
2189
2190      --i
2191
2192      isLeap = true; temp = leapDays(year) // 计算农历闰月天数
2193
2194    } else {
2195
2196      temp = monthDays(year, i)// 计算农历普通月天数
2197
2198    }
2199
2200    // 解除闰月
2201
2202    if (isLeap === true && i === (leap + 1)) { isLeap = false }
2203
2204    offset -= temp
2205
2206  }
2207
2208  // 闰月导致数组下标重叠取反
2209
2210  if (offset === 0 && leap > 0 && i === leap + 1) {
2211
2212    if (isLeap) {
2213
2214      isLeap = false
2215
2216    } else {
2217
2218      isLeap = true; --i
2219
2220    }
2221
2222  }
2223
2224  if (offset < 0) {
2225
2226    offset += temp; --i
2227
2228  }
2229
2230  // 农历月
2231
2232  var month = i
2233
2234  // 农历日
2235
2236  var day = offset + 1
2237
2238  // 天干地支处理
2239
2240  var sm = m - 1
2241
2242  var gzY = toGanZhiYear(year)
2243
2244
2245
2246  // 当月的两个节气
2247
2248  // bugfix-2017-7-24 11:03:38 use lunar Year Param `y` Not `year`
2249
2250  var firstNode = getTerm(y, (m * 2 - 1)) // 返回当月「节」为几日开始
2251
2252  var secondNode = getTerm(y, (m * 2)) // 返回当月「节」为几日开始
2253
2254
2255
2256  // 依据12节气修正干支月
2257
2258  var gzM = toGanZhi((y - 1900) * 12 + m + 11)
2259
2260  if (d >= firstNode) {
2261
2262    gzM = toGanZhi((y - 1900) * 12 + m + 12)
2263
2264  }
2265
2266  // 传入的日期的节气与否
2267
2268  var isTerm = false
2269
2270  var Term = null
2271
2272  if (firstNode === d) {
2273
2274    isTerm = true
2275
2276    Term = solarTerm[m * 2 - 2]
2277
2278  }
2279
2280  if (secondNode === d) {
2281
2282    isTerm = true
2283
2284    Term = solarTerm[m * 2 - 1]
2285
2286  }
2287
2288  // 日柱 当月一日与 1900/1/1 相差天数
2289
2290  var dayCyclical = Date.UTC(y, sm, 1, 0, 0, 0, 0) / 86400000 + 25567 + 10
2291
2292  var gzD = toGanZhi(dayCyclical + d - 1)
2293
2294  // 该日期所属的星座
2295
2296  var astro = toAstro(m, d)
2297
2298  return { 'lYear': year, 'lMonth': month, 'lDay': day, 'Animal': getAnimal(year), 'IMonthCn': (isLeap ? '\u95f0' : '') + toChinaMonth(month), 'IDayCn': toChinaDay(day), 'cYear': y, 'cMonth': m, 'cDay': d, 'gzYear': gzY, 'gzMonth': gzM, 'gzDay': gzD, 'isToday': isToday, 'isLeap': isLeap, 'nWeek': nWeek, 'ncWeek': '\u661f\u671f' + cWeek, 'isTerm': isTerm, 'Term': Term, 'astro': astro }
2299
2300}
2301
2302
2303
2304
2305
2306var calendarFormatter = {
2307
2308  // 传入阳历年月日获得详细的公历、农历object信息 <=>JSON
2309
2310  solar2lunar: function (y, m, d) { // 参数区间1900.1.31~2100.12.31
2311
2312    return solar2lunar(y, m, d)
2313
2314  },
2315
2316  /**
2317
2318  * 传入农历年月日以及传入的月份是否闰月获得详细的公历、农历object信息 <=>JSON
2319
2320  * @param y  lunar year
2321
2322  * @param m  lunar month
2323
2324  * @param d  lunar day
2325
2326  * @param isLeapMonth  lunar month is leap or not.[如果是农历闰月第四个参数赋值true即可]
2327
2328  * @return JSON object
2329
2330  * @eg:console.log(calendar.lunar2solar(1987,9,10));
2331
2332  */
2333
2334  lunar2solar: function (y, m, d, isLeapMonth) { // 参数区间1900.1.31~2100.12.1
2335
2336    isLeapMonth = !!isLeapMonth
2337
2338    if (isLeapMonth && (leapMonth !== m)) { return -1 }// 传参要求计算该闰月公历 但该年得出的闰月与传参的月份并不同
2339
2340    if (y === 2100 && m === 12 && d > 1 || y === 1900 && m === 1 && d < 31) { return -1 } // 超出了最大极限值
2341
2342    var day = monthDays(y, m)
2343
2344    var _day = day
2345
2346    // bugFix 2016-9-25
2347
2348    // if month is leap, _day use leapDays method
2349
2350    if (isLeapMonth) {
2351
2352      _day = leapDays(y, m)
2353
2354    }
2355
2356    if (y < 1900 || y > 2100 || d > _day) { return -1 }// 参数合法性效验
2357
2358
2359
2360    // 计算农历的时间差
2361
2362    var offset = 0
2363
2364    for (var i = 1900; i < y; i++) {
2365
2366      offset += lYearDays(i)
2367
2368    }
2369
2370    var leap = 0
2371
2372    var isAdd = false
2373
2374    for (i = 1; i < m; i++) {
2375
2376      leap = leapMonth(y)
2377
2378      if (!isAdd) { // 处理闰月
2379
2380        if (leap <= i && leap > 0) {
2381
2382          offset += leapDays(y); isAdd = true
2383
2384        }
2385
2386      }
2387
2388      offset += monthDays(y, i)
2389
2390    }
2391
2392    // 转换闰月农历 需补充该年闰月的前一个月的时差
2393
2394    if (isLeapMonth) { offset += day }
2395
2396    // 1900年农历正月一日的公历时间为1900年1月30日0时0分0秒(该时间也是本农历的最开始起始点)
2397
2398    var stmap = Date.UTC(1900, 1, 30, 0, 0, 0)
2399
2400    var calObj = new Date((offset + d - 31) * 86400000 + stmap)
2401
2402    var cY = calObj.getUTCFullYear()
2403
2404    var cM = calObj.getUTCMonth() + 1
2405
2406    var cD = calObj.getUTCDate()
2407
2408    return solar2lunar(cY, cM, cD)
2409
2410  }
2411
2412}
2413
2414/* 农历转换 end */
2415
2416//----------------------------------------------------------------
2417
2418/* 节日弹窗 start */
2419var d = new Date();
2420m = d.getMonth() + 1;
2421dd = d.getDate();
2422y = d.getFullYear();
2423
2424// 公祭日
2425if (m == 9 && dd == 18) {
2426  document.getElementsByTagName("html")[0].setAttribute("style", "filter: grayscale(60%);");
2427  if (sessionStorage.getItem("isPopupWindow") != "1") {
2428    Swal.fire("今天是九一八事变" + (y - 1931).toString() + "周年纪念日\n🪔勿忘国耻,振兴中华🪔");
2429    sessionStorage.setItem("isPopupWindow", "1");
2430  }
2431}
2432if (m == 7 && dd == 7) {
2433  document.getElementsByTagName("html")[0].setAttribute("style", "filter: grayscale(60%);");
2434  if (sessionStorage.getItem("isPopupWindow") != "1") {
2435    Swal.fire("今天是卢沟桥事变" + (y - 1937).toString() + "周年纪念日\n🪔勿忘国耻,振兴中华🪔");
2436    sessionStorage.setItem("isPopupWindow", "1");
2437  }
2438}
2439if (m == 12 && dd == 13) {
2440  document.getElementsByTagName("html")[0].setAttribute("style", "filter: grayscale(60%);");
2441  if (sessionStorage.getItem("isPopupWindow") != "1") {
2442    Swal.fire("今天是南京大屠杀" + (y - 1937).toString() + "周年纪念日\n🪔勿忘国耻,振兴中华🪔");
2443    sessionStorage.setItem("isPopupWindow", "1");
2444  }
2445}
2446if (m == 8 && dd == 14) {
2447  document.getElementsByTagName("html")[0].setAttribute("style", "filter: grayscale(60%);");
2448  if (sessionStorage.getItem("isPopupWindow") != "1") {
2449    Swal.fire("今天是世界慰安妇纪念日\n🪔勿忘国耻,振兴中华🪔");
2450    sessionStorage.setItem("isPopupWindow", "1");
2451  }
2452}
2453
2454
2455// 节假日
2456if (m == 10 && dd <= 3) {//国庆节
2457  if (sessionStorage.getItem("isPopupWindow") != "1") {
2458    Swal.fire("祝祖国" + (y - 1949).toString() + "岁生日快乐!");
2459    sessionStorage.setItem("isPopupWindow", "1");
2460  }
2461}
2462if (m == 8 && dd == 15) {//搞来玩的,小日子投降
2463  if (sessionStorage.getItem("isPopupWindow") != "1") {
2464    Swal.fire("小日子已经投降" + (y - 1945).toString() + "年了😃");
2465    sessionStorage.setItem("isPopupWindow", "1");
2466  }
2467}
2468if (m == 1 && dd == 1) {//元旦节
2469  if (sessionStorage.getItem("isPopupWindow") != "1") {
2470    Swal.fire(y.toString() + "年元旦快乐!🎉");
2471    sessionStorage.setItem("isPopupWindow", "1");
2472  }
2473}
2474if (m == 3 && dd == 8) {//妇女节
2475  if (sessionStorage.getItem("isPopupWindow") != "1") {
2476    Swal.fire("各位女神们,妇女节快乐!👩");
2477    sessionStorage.setItem("isPopupWindow", "1");
2478  }
2479}
2480// l = ["非常抱歉,因为不可控原因,博客将于明天停止运营!", "好消息,日本没了!", "美国垮了,原因竟然是川普!", "微软垮了!", "你的电脑已经过载,建议立即关机!", "你知道吗?站长很喜欢你哦!", "一分钟有61秒哦", "你喜欢的人跟别人跑了!"]
2481l = ["好消息,日本没了!", "美国垮了,原因竟然是美联储加息崩溃了!", "微软垮了!","非常抱歉,因为不可控原因,博客将于明天停止运营!", "你的设备已经中毒,请立即关机,
2481快!", "你的设备已经被监控,请立刻删除不良内容,否则我将公之于众!", "你已经被监视,现在有危险!请立刻站起来!","你知道吗?我已经喜欢你很久了!", "你知道吗?我真的很喜欢你!","一分钟有61秒哦","你知道吗?上次不是拒绝你,而是喜欢得害怕,如果你再说一次,我就答应你!","好消息!你中了一百万,快分我一半!", "你喜欢的人已经跟别人跑了!", "你喜欢的人,明天就要结婚啦!"]
2482if (m == 4 && dd == 1) {//愚人节,随机谎话
2483  if (sessionStorage.getItem("isPopupWindow") != "1") {
2484    Swal.fire(l[Math.floor(Math.random() * l.length)]);
2485    sessionStorage.setItem("isPopupWindow", "1");
2486  }
2487}
2488if (m == 5 && dd == 1) {//劳动节
2489  if (sessionStorage.getItem("isPopupWindow") != "1") {
2490    Swal.fire("劳动节快乐\n为各行各业辛勤工作的人们致敬!");
2491    sessionStorage.setItem("isPopupWindow", "1");
2492  }
2493}
2494if (m == 5 && dd == 4) {//青年节
2495  if (sessionStorage.getItem("isPopupWindow") != "1") {
2496    Swal.fire("青年节快乐\n青春不是回忆逝去,而是把握现在!");
2497    sessionStorage.setItem("isPopupWindow", "1");
2498  }
2499}
2500if (m == 5 && dd == 20) {//520
2501  if (sessionStorage.getItem("isPopupWindow") != "1") {
2502    Swal.fire("今年是520情人节\n快和你喜欢的人一起过吧!💑");
2503    sessionStorage.setItem("isPopupWindow", "1");
2504  }
2505}
2506if (m == 7 && dd == 1) {//建党节
2507  if (sessionStorage.getItem("isPopupWindow") != "1") {
2508    Swal.fire("祝中国共产党" + (y - 1921).toString() + "岁生日快乐!");
2509    sessionStorage.setItem("isPopupWindow", "1");
2510  }
2511}
2512if (m == 9 && dd == 10) {//教师节
2513  if (sessionStorage.getItem("isPopupWindow") != "1") {
2514    Swal.fire("各位老师们教师节快乐!👩‍🏫");
2515    sessionStorage.setItem("isPopupWindow", "1");
2516  }
2517}
2518if (m == 12 && dd == 25) {//圣诞节
2519  if (sessionStorage.getItem("isPopupWindow") != "1") {
2520    Swal.fire("圣诞节快乐!🎄");
2521    sessionStorage.setItem("isPopupWindow", "1");
2522  }
2523}
2524if (m == 8 && dd == 11) {//站长生日
2525  if (sessionStorage.getItem("isPopupWindow") != "1") {
2526    Swal.fire("祝站长" + (y - 1998).toString() + "岁生日快乐!🥝");
2527    sessionStorage.setItem("isPopupWindow", "1");
2528  }
2529}
2530if (m == 6 && dd == 30) {//小猫咪生日
2531  if (sessionStorage.getItem("isPopupWindow") != "1") {
2532    Swal.fire("祝小猫咪" + (y - 1999).toString() + "岁生日快乐!🐱");
2533    sessionStorage.setItem("isPopupWindow", "1");
2534  }
2535}
2536
2537//传统节日部分
2538
2539if ((y == 2023 && m == 4 && dd == 5) || (y == 2024 && m == 4 && dd == 4) || (y == 2025 && m == 4 && dd == 4)) {//清明节
2540  if (sessionStorage.getItem("isPopupWindow") != "1") {
2541    Swal.fire("清明时节雨纷纷,一束鲜花祭故人💐");
2542    sessionStorage.setItem("isPopupWindow", "1");
2543  }
2544}
2545if ((y == 2023 && m == 12 && dd == 22) || (y == 2024 && m == 12 && dd == 21) || (y == 2025 && m == 12 && dd == 21)) {//冬至
2546  if (sessionStorage.getItem("isPopupWindow") != "1") {
2547    Swal.fire("冬至快乐\n快吃上一碗热热的汤圆和饺子吧🧆");
2548    sessionStorage.setItem("isPopupWindow", "1");
2549  }
2550}
2551
2552var lunar = calendarFormatter.solar2lunar();
2553
2554//农历采用汉字计算,防止出现闰月导致问题
2555
2556if ((lunar["IMonthCn"] == "正月" && lunar["IDayCn"] == "初六") || (lunar["IMonthCn"] == "正月" && lunar["IDayCn"] == "初五") || (lunar["IMonthCn"] == "正月" && lunar["IDayCn"] == "初四") || (lunar["IMonthCn"] == "正月" && lunar["IDayCn"] == "初三") || (lunar["IMonthCn"] == "正月" && lunar["IDayCn"] == "初二") || (lunar["IMonthCn"] == "正月" && lunar["IDayCn"] == "初一") || (lunar["IMonthCn"] == "腊月" && lunar["IDayCn"] == "三十") || (lunar["IMonthCn"] == "腊月" && lunar["IDayCn"] == "廿九")) {
2557  //春节,本来只有大年三十到初六,但是有时候除夕是大年二十九,所以也加上了
2558  if (sessionStorage.getItem("isPopupWindow") != "1") {
2559    Swal.fire(y.toString() + "年新年快乐\n🎊祝你心想事成,诸事顺利🎊");
2560    sessionStorage.setItem("isPopupWindow", "1");
2561  }
2562}
2563if ((lunar["IMonthCn"] == "正月" && lunar["IDayCn"] == "十五")) {
2564  //元宵节
2565  if (sessionStorage.getItem("isPopupWindow") != "1") {
2566    Swal.fire("元宵节快乐\n送你一个大大的灯笼🧅");
2567    sessionStorage.setItem("isPopupWindow", "1");
2568  }
2569}
2570if ((lunar["IMonthCn"] == "五月" && lunar["IDayCn"] == "初五")) {
2571  //端午节
2572  if (sessionStorage.getItem("isPopupWindow") != "1") {
2573    Swal.fire("端午节快乐\n请你吃一条粽子🍙");
2574    sessionStorage.setItem("isPopupWindow", "1");
2575  }
2576}
2577if ((lunar["IMonthCn"] == "七月" && lunar["IDayCn"] == "初七")) {
2578  //七夕节
2579  if (sessionStorage.getItem("isPopupWindow") != "1") {
2580    Swal.fire("七夕节快乐\n黄昏后,柳梢头,牛郎织女来碰头");
2581    sessionStorage.setItem("isPopupWindow", "1");
2582  }
2583}
2584if ((lunar["IMonthCn"] == "八月" && lunar["IDayCn"] == "十五")) {
2585  //中秋节
2586  if (sessionStorage.getItem("isPopupWindow") != "1") {
2587    Swal.fire("中秋节快乐\n请你吃一块月饼🍪");
2588    sessionStorage.setItem("isPopupWindow", "1");
2589  }
2590}
2591if ((lunar["IMonthCn"] == "九月" && lunar["IDayCn"] == "初九")) {
2592  //重阳节
2593  if (sessionStorage.getItem("isPopupWindow") != "1") {
2594    Swal.fire("重阳节快乐\n独在异乡为异客,每逢佳节倍思亲");
2595    sessionStorage.setItem("isPopupWindow", "1");
2596  }
2597}
2598
2599// 切换主题提醒
2600// if (y == 2022 && m == 12 && (dd >= 18 && dd <= 20)) {
2601//     if (sessionStorage.getItem("isPopupWindow") != "1") {
2602//         Swal.fire("网站换成冬日限定主题啦⛄");
2603//         sessionStorage.setItem("isPopupWindow", "1");
2604//     }
2605// }
2606
2607
2608/* 节日弹窗 end */
2609
2610//----------------------------------------------------------------
2611
2612/* 听话鼠标 start */
2613var CURSOR;
2614
2615Math.lerp = (a, b, n) => (1 - n) * a + n * b;
2616
2617const getStyle2 = (el, attr) => {
2618  try {
2619    return window.getComputedStyle
2620      ? window.getComputedStyle(el)[attr]
2621      : el.currentStyle[attr];
2622  } catch (e) { }
2623  return "";
2624};
2625
2626// 为了屏蔽异步加载导致无法读取颜色值,这里统一用哈希表预处理
2627const map = new Map();
2628map.set('red', "rgb(241, 71, 71)");
2629map.set('orange', "rgb(241, 162, 71)");
2630map.set('yellow', "rgb(241, 238, 71)")
2631map.set('purple', "rgb(179, 71, 241)");
2632map.set('blue', "rgb(102, 204, 255)");
2633map.set('gray', "rgb(226, 226, 226)");
2634map.set('green', "rgb(57, 197, 187)");
2635map.set('whitegray', "rgb(241, 241, 241)");
2636map.set('pink', "rgb(237, 112, 155)");
2637map.set('black', "rgb(0, 0, 0)");
2638map.set('darkblue', "rgb(97, 100, 159)");
2639map.set('heoblue', "rgb(66, 90, 239)");
2640
2641class Cursor {
2642  constructor() {
2643    this.pos = { curr: null, prev: null };
2644    this.pt = [];
2645    this.create();
2646    this.init();
2647    this.render();
2648  }
2649
2650  move(left, top) {
2651    this.cursor.style["left"] = `${left}px`;
2652    this.cursor.style["top"] = `${top}px`;
2653  }
2654
2655  create() {
2656    if (!this.cursor) {
2657      this.cursor = document.createElement("div");
2658      this.cursor.id = "cursor";
2659      this.cursor.classList.add("hidden");
2660      document.body.append(this.cursor);
2661    }
2662    var el = document.getElementsByTagName('*');
2663    for (let i = 0; i < el.length; i++)
2664      if (getStyle2(el[i], "cursor") == "pointer")
2665        this.pt.push(el[i].outerHTML);
2666    var colorVal = map.get(localStorage.getItem("themeColor"));
2667    document.body.appendChild((this.scr = document.createElement("style")));
2668    this.scr.innerHTML = `* {cursor: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' width='8px' height='8px'><circle cx='4' cy='4' r='4' opacity='1.0' fill='` + colorVal + `'/></svg>") 4 4, auto}`;
2669  }
2670
2671  refresh() {
2672    this.scr.remove();
2673    this.cursor.classList.remove("hover");
2674    this.cursor.classList.remove("active");
2675    this.pos = { curr: null, prev: null };
2676    this.pt = [];
2677
2678    this.create();
2679    this.init();
2680    this.render();
2681  }
2682
2683  init() {
2684    document.onmouseover = e => this.pt.includes(e.target.outerHTML) && this.cursor.classList.add("hover");
2685    document.onmouseout = e => this.pt.includes(e.target.outerHTML) && this.cursor.classList.remove("hover");
2686    document.onmousemove = e => { (this.pos.curr == null) && this.move(e.clientX - 8, e.clientY - 8); this.pos.curr = { x: e.clientX - 8, y: e.clientY - 8 }; this.cursor.classList.remove("hidden"); };
2687    document.onmouseenter = e => this.cursor.classList.remove("hidden");
2688    document.onmouseleave = e => this.cursor.classList.add("hidden");
2689    document.onmousedown = e => this.cursor.classList.add("active");
2690    document.onmouseup = e => this.cursor.classList.remove("active");
2691  }
2692
2693  render() {
2694    if (this.pos.prev) {
2695      // 跟踪速度调节
2696      this.pos.prev.x = Math.lerp(this.pos.prev.x, this.pos.curr.x, 0.15);
2697      this.pos.prev.y = Math.lerp(this.pos.prev.y, this.pos.curr.y, 0.15);
2698      this.move(this.pos.prev.x, this.pos.prev.y);
2699    } else {
2700      this.pos.prev = this.pos.curr;
2701    }
2702    requestAnimationFrame(() => this.render());
2703  }
2704}
2705
2706(() => {
2707  CURSOR = new Cursor();
2708  // 需要重新获取列表时,使用 CURSOR.refresh()
2709})();
2710
2711/* 听话鼠标 end */
2712
2713//----------------------------------------------------------------
2714
2715/* 新年倒计时 start */
2716// let newYearTimer = null;
2717// var newYear = () => {
2718//   clearTimeout(newYearTimer);
2719//   if (!document.querySelector('#newYear')) return;
2720//   // 新年时间戳 and 星期对象
2721//   let newYear = new Date('2023-01-22 00:00:00').getTime() / 1000,
2722//     week = { 0: '周日', 1: '周一', 2: '周二', 3: '周三', 4
2722: '周四', 5: '周五', 6: '周六' }
2723
2724//   time();
2725
2726//   // 补零函数
2727//   function nol(h) { return h > 9 ? h : '0' + h; };
2728
2729//   function time() {
2730//     // 现在 时间对象
2731//     let now = new Date();
2732
2733//     // 右下角 今天
2734//     document.querySelector('#newYear .today').innerHTML = now.getFullYear() + '-' + (now.getMonth() + 1) + '-' + now.getDate() + ' ' + week[now.getDay()]
2735
2736//     // 现在与新年相差秒数
2737//     let second = newYear - Math.round(now.getTime() / 1000);
2738
2739//     // 小于0则表示已经过年
2740//     if (second < 0) {
2741//       document.querySelector('#newYear .title').innerHTML = 'Happy New Year!';
2742//       document.querySelector('#newYear .newYear-time').innerHTML = '<span class="happyNewYear">新年快乐</p>';
2743//     } else {
2744//       // 大于0则还未过年
2745//       document.querySelector('#newYear .title').innerHTML = '距离2023年春节:'
2746
2747//       // 大于一天则直接渲染天数
2748//       if (second > 86400) {
2749//         document.querySelector('#newYear .newYear-time').innerHTML = `<span class="day">${Math.ceil(second / 86400)}<span class="unit">天</span></span>`
2750//       } else {
2751//         // 小于一天则使用时分秒计时。
2752//         let h = nol(parseInt(second / 3600));
2753//         second %= 3600;
2754//         let m = nol(parseInt(second / 60));
2755//         second %= 60;
2756//         let s = nol(second);
2757//         document.querySelector('#newYear .newYear-time').innerHTML = `<span class="time">${h}:${m}:${s}</span></span>`;
2758//         // 计时
2759//         newYearTimer = setTimeout(time, 1000);
2760//       }
2761//     }
2762//   }
2763
2764//   // 元宝飘落
2765//   jQuery(document).ready(function ($) {
2766//     $('#newYear').wpSuperSnow({
2767//       flakes: ['https://tuchuang.voooe.cn/images/2023/01/02/yb1.webp', 'https://tuchuang.voooe.cn/images/2023/01/02/yb2.webp', 'https://tuchuang.voooe.cn/images/2023/01/02/yb3.webp'],
2768//       totalFlakes: '100',
2769//       zIndex: '999999',
2770//       maxSize: '30',
2771//       maxDuration: '20',
2772//       useFlakeTrans: false
2773//     });
2774//   });
2775// }
2776// // Pjax适配:若没有开启Pjax这里直接是newYear()即可
2777// // 开了Pjax的用以下两句
2778// document.addEventListener('pjax:complete', newYear);
2779// document.addEventListener('DOMContentLoaded', newYear);
2780
2781/* 新年倒计时 end */
2782
2783//----------------------------------------------------------------
2784
2785/* 页脚计时器 start */
2786var now = new Date();
2787function createtime() {
2788  // 当前时间
2789  now.setTime(now.getTime() + 1000);
2790  var start = new Date("12/01/2023 00:00:00"); // 旅行者1号开始计算的时间
2791  var dis = Math.trunc(23400000000 + ((now - start) / 1000) * 17); // 距离=秒数*速度 记住转换毫秒
2792  var unit = (dis / 149600000).toFixed(6);  // 天文单位
2793  // 网站诞生时间
2794  var grt = new Date("12/01/2023 00:00:00");
2795  var days = (now - grt) / 1e3 / 60 / 60 / 24,
2796    dnum = Math.floor(days),
2797    hours = (now - grt) / 1e3 / 60 / 60 - 24 * dnum,
2798    hnum = Math.floor(hours);
2799  1 == String(hnum).length && (hnum = "0" + hnum);
2800  var minutes = (now - grt) / 1e3 / 60 - 1440 * dnum - 60 * hnum,
2801    mnum = Math.floor(minutes);
2802  1 == String(mnum).length && (mnum = "0" + mnum);
2803  var seconds = (now - grt) / 1e3 - 86400 * dnum - 3600 * hnum - 60 * mnum,
2804    snum = Math.round(seconds);
2805  1 == String(snum).length && (snum = "0" + snum);
2806  // let currentTimeHtml = "";
2807  // (currentTimeHtml =
2808  //   hnum < 18 && hnum >= 9
2809  //     ? `<img class='boardsign' src='https://lskypro.acozycotage.net/Fomalhaut/badge/F小屋-科研摸鱼中.svg' title='上班时间认真干活啦~'><br> <div style="font-size:13px;font-weight:bold">本站居然运行了 ${dnum} 天 ${hnum} 小时 ${mnum} 分 ${snum} 秒 <i id="heartbeat" class='fas fa-heartbeat'></i> <br> 旅行者 1 号当前距离地球 ${dis} 千米,约为 ${unit} 个天文单位 🚀</div>`
2810  //     : `<img class='boardsign' src='https://lskypro.acozycotage.net/Fomalhaut/badge/F小屋-下班休息啦.svg' title='下班时间开心玩耍啦~'><br> <div style="font-size:13px;font-weight:bold">本站居然运行了 ${dnum} 天 ${hnum} 小时 ${mnum} 分 ${snum}
2810 秒 <i id="heartbeat" class='fas fa-heartbeat'></i> <br> 旅行者 1 号当前距离地球 ${dis} 千米,约为 ${unit} 个天文单位 🚀</div>`),
2811  //   document.getElementById("workboard") &&
2812  //   (document.getElementById("workboard").innerHTML = currentTimeHtml);
2813
2814  let currentTimeHtml = "";
2815  (currentTimeHtml =
2816    hnum < 18 && hnum >= 9
2817      ? `<div style="font-size:13px;font-weight:bold">本站居然运行了 ${dnum} 天 ${hnum} 小时 ${mnum} 分 ${snum} 秒 <i id="heartbeat" class='fas fa-heartbeat'></i> <br> 旅行者 1 号当前距离地球 ${dis} 千米,约为 ${unit} 个天文单位 🚀</div>`
2818      : `<div style="font-size:13px;font-weight:bold">本站居然运行了 ${dnum} 天 ${hnum} 小时 ${mnum} 分 ${snum} 秒 <i id="heartbeat" class='fas fa-heartbeat'></i> <br> 旅行者 1 号当前距离地球 ${dis} 千米,约为 ${unit} 个天文单位 🚀</div>`),
2819    document.getElementById("workboard") &&
2820    (document.getElementById("workboard").innerHTML = currentTimeHtml);
2821}
2822// 设置重复执行函数,周期1000ms
2823setInterval(() => {
2824  createtime();
2825}, 1000);
2826
2827/*页脚计时器 end */
2828
2829//----------------------------------------------------------------
2830
2831
2832/* fps检测 start */
2833if (window.localStorage.getItem("fpson") == undefined || window.localStorage.getItem("fpson") == "1") {
2834  var rAF = function () {
2835    return (
2836      window.requestAnimationFrame ||
2837      window.webkitRequestAnimationFrame ||
2838      function (callback) {
2839        window.setTimeout(callback, 1000 / 60);
2840      }
2841    );
2842  }();
2843  var frame = 0;
2844  var allFrameCount = 0;
2845  var lastTime = Date.now();
2846  var lastFameTime = Date.now();
2847  var loop = function () {
2848    var now = Date.now();
2849    var fs = (now - lastFameTime);
2850    var fps = Math.round(1000 / fs);
2851
2852    lastFameTime = now;
2853    // 不置 0,在动画的开头及结尾记录此值的差值算出 FPS
2854    allFrameCount++;
2855    frame++;
2856
2857    if (now > 1000 + lastTime) {
2858      var fps = Math.round((frame * 1000) / (now - lastTime));
2859      if (fps <= 5) {
2860        var kd = `<span style="color:#bd0000">卡成ppt🤢</span>`
2861      } else if (fps <= 15) {
2862        var kd = `<span style="color:red">电竞级帧率😖</span>`
2863      } else if (fps <= 25) {
2864        var kd = `<span style="color:orange">有点难受😨</span>`
2865      } else if (fps < 35) {
2866        var kd = `<span style="color:#9338e6">不太流畅🙄</span>`
2867      } else if (fps <= 45) {
2868        var kd = `<span style="color:#08b7e4">还不错哦😊</span>`
2869      } else {
2870        var kd = `<span style="color:#39c5bb">十分流畅o((>ω<))o</span>`
2871      }
2872      document.getElementById("fps").innerHTML = `FPS:${fps} ${kd}`;
2873      frame = 0;
2874      lastTime = now;
2875    };
2876
2877    rAF(loop);
2878  }
2879
2880  loop();
2881} else {
2882  document.getElementById("fps").style = "display:none!important"
2883}
2884/* fps检测 end */
2885
2886//----------------------------------------------------------------
2887
2888/* 美化模块 start */
2889
2890// 更新版本需要每个用户都恢复一次默认设置
2891if (localStorage.getItem("reset_4") == undefined) {
2892  localStorage.setItem("reset_4", "1");
2893  // 清空之前的标记值
2894  for (var i = 1; i <= 3; i++) {
2895    localStorage.removeItem("reset_" + i);
2896  }
2897  clearItem();
2898  setTimeout(function () {
2899    new Vue({
2900      data: function () {
2901        this.$notify({
2902          title: "提示🍒",
2903          message: " (。・∀・)ノ゙由于网站部分设置项更新,当前已为您重置所有设置,祝您愉快!",
2904          position: 'top-left',
2905          offset: 50,
2906          showClose: true,
2907          type: "success",
2908          duration: 8000
2909        });
2910      }
2911    })
2912  }, 1500);
2913}
2914
2915// 清除localStorage配置项
2916function clearItem() {
2917  localStorage.removeItem('blogbg');
2918  localStorage.removeItem('universe');
2919  localStorage.removeItem('blur');
2920  localStorage.removeItem('fpson');
2921  localStorage.removeItem('transNum');
2922  localStorage.removeItem('blurRad');
2923  localStorage.removeItem('font');
2924  localStorage.removeItem('themeColor');
2925  localStorage.removeItem('rs');
2926  localStorage.removeItem('mouse');
2927  localStorage.removeItem('light');
2928  localStorage.removeItem('snow');
2929}
2930
2931
2932// 设置字体
2933if (localStorage.getItem("font") == undefined) {
2934  localStorage.setItem("font", "LXGW");
2935}
2936setFont(localStorage.getItem("font"));
2937function setFont(n) {
2938  localStorage.setItem("font", n)
2939  if (n == "default") {
2940    document.documentElement.style.setProperty('--global-font', '-apple-system');
2941    document.body.style.fontFamily = "-apple-system, Consolas_1, BlinkMacSystemFont, 'Segoe UI' , 'Helvetica Neue' , Lato, Roboto, 'PingFang SC' , 'Microsoft JhengHei' , 'Microsoft YaHei' , sans-serif";
2942  }
2943  else {
2944    document.documentElement.style.setProperty('--global-font', n);
2945    document.body.style.fontFamily = "var(--global-font),-apple-system, IBM Plex Mono ,monosapce,'微软雅黑', sans-serif";
2946  }
2947  try { setFontBorder(); } catch (err) { };
2948}
2949
2950// 设置字体选择框边界
2951function setFontBorder() {
2952  var curFont = localStorage.getItem("font");
2953  var swfId = "swf_" + curFont;
2954  document.getElementById(swfId).style.border = "2px solid var(--theme-color)";
2955  Array.prototype.forEach.call(document.getElementsByClassName("swf"), function (ee) {
2956    if (ee.id != swfId) ee.style.border = "2px solid var(--border-color)";
2957  });
2958}
2959
2960
2961// 设置主题色
2962if (localStorage.getItem("themeColor") == undefined) {
2963  localStorage.setItem("themeColor", "green");
2964}
2965setColor(localStorage.getItem("themeColor"));
2966function setColor(c) {
2967  document.getElementById("themeColor").innerText = `:root{--theme-color:` + map.get(c) + ` !important}`;
2968  localStorage.setItem("themeColor", c);
2969  // 刷新鼠标颜色
2970  CURSOR.refresh();
2971  // 设置一个带有透明度的主题色,用于菜单栏的悬浮颜色
2972  var theme_color = map.get(c);
2973  var trans_theme_color = "rgba" + theme_color.substring(3, theme_color.length - 1) + ", 0.7)";
2974  var high_trans_color = "rgba" + theme_color.substring(3, theme_color.length - 1) + ", 0.5)";
2975  document.documentElement.style.setProperty("--text-bg-hover", trans_theme_color);
2976  document.documentElement.style.setProperty("--high-trans-color", high_trans_color);
2977}
2978
2979
2980// 星空背景开关
2981if (localStorage.getItem("universe") == undefined) {
2982  localStorage.setItem("universe", "block");
2983}
2984setUniverse2(localStorage.getItem("universe"));
2985function setUniverse2(c) {
2986  document.getElementById("universe").style.display = c;
2987  localStorage.setItem("universe", c);
2988}
2989function setUniverse() {
2990  if (document.getElementById("universeSet").checked) {
2991    setUniverse2("block");
2992  } else {
2993    setUniverse2("none");
2994  }
2995}
2996
2997// 雪花开关
2998if (localStorage.getItem("snow") == undefined) {
2999  // localStorage.setItem("snow", "none");
3000  localStorage.setItem("snow", "block");
3001}
3002document.getElementById("snow").style.display = localStorage.getItem("snow");
3003function setSnow() {
3004  if (document.getElementById("snowSet").checked) {
3005    document.getElementById("snow").style.display = "block";
3006    localStorage.setItem("snow", "block");
3007  } else {
3008    document.getElementById("snow").style.display = "none";
3009    localStorage.setItem("snow", "none");
3010  }
3011}
3012
3013
3014// 帧率监测开关
3015if (localStorage.getItem("fpson") == undefined) {
3016  localStorage.setItem("fpson", "0");
3017  // localStorage.setItem("fpson", "1");
3018}
3019function fpssw() {
3020  if (document.getElementById("fpson").checked) {
3021    localStorage.setItem("fpson", "1");
3022  } else {
3023    localStorage.setItem("fpson", "0");
3024  }
3025  setTimeout(reload, 600);
3026}
3027
3028// 刷新窗口
3029function reload() {
3030  window.location.reload();
3031}
3032
3033// 侧边栏开关
3034if (localStorage.getItem("rs") == undefined) {
3035  localStorage.setItem("rs", "block");
3036}
3037if (localStorage.getItem("rs") == "block") {
3038  document.getElementById("rightSide").innerText = `:root{--rightside-display: block}`;
3039} else {
3040  document.getElementById("rightSide").innerText = `:root{--rightside-display: none}`;
3041}
3042function toggleRightside() {
3043  // 先设置localStorage变量
3044  if (document.getElementById("rightSideSet").checked) {
3045    localStorage.setItem("rs", "block");
3046    document.getElementById("rightSide").innerText = `:root{--rightside-display: block}`;
3047  } else {
3048    localStorage.setItem("rs", "none");
3049    document.getElementById("rightSide").innerText = `:root{--rightside-display: none}`;
3050  }
3051}
3052
3053
3054// 透明度调节滑块
3055if (localStorage.getItem("transNum") == undefined) {
3056  localStorage.setItem("transNum", 95);
3057}
3058var curTransNum = localStorage.getItem("transNum");
3059var curTransMini = curTransNum * 0.95;
3060document.getElementById("transPercent").innerText = `:root{--trans-light: rgba(253, 253, 253, ${curTransNum}%) !important; --trans-dark: rgba(25, 25, 25, ${curTransNum}%) !important} `;
3061function setTrans() {
3062  var elem = document.getElementById("transSet");
3063  var newTransNum = elem.value;
3064  var target = document.querySelector('.transValue');
3065  target.innerHTML = "透明度 (0%-100%): " + newTransNum + "%";
3066  localStorage.setItem("transNum", newTransNum);
3067  curTransMini = newTransNum * 0.95;
3068  curTransNum = newTransNum;  // 更新当前透明度
3069  document.querySelector('#rang_trans').style.width = curTransMini + "%";
3070  document.getElementById("transPercent").innerText = `:root{--trans-light: rgba(253, 253, 253, ${newTransNum}%) !important; --trans-dark: rgba(25, 25, 25, ${newTransNum}%) !important} `;
3071};
3072
3073
3074// 模糊度调节滑块
3075if (localStorage.getItem("blurRad") == undefined) {
3076  localStorage.setItem("blurRad", 20);
3077}
3078var curBlur = localStorage.getItem("blurRad"); // 当前模糊半径
3079var miniBlur = curBlur * 0.95;
3080document.getElementById("blurNum").innerText = `:root{--blur-num: blur(${curBlur}px) saturate(120%) !important`;
3081function setBlurNum() {
3082  var elem = document.getElementById("blurSet");
3083  var newBlur = elem.value;
3084  var target = document.querySelector('.blurValue');
3085  target.innerHTML = "模糊半径 (开启模糊生效 0px-100px): " + newBlur + "px";
3086  localStorage.setItem("blurRad", newBlur);
3087  curBlur = newBlur;
3088  miniBlur = curBlur * 0.95;
3089  // var max = elem.getAttribute("max");
3090  document.querySelector('#rang_blur').style.width = miniBlur + "%";
3091  document.getElementById("blurNum").innerText = `:root{--blur-num: blur(${curBlur}px) saturate(120%) !important`;
3092};
3093
3094
3095// 模糊效果开关
3096if (localStorage.getItem("blur") == undefined) {
3097  localStorage.setItem("blur", 0);
3098}
3099if (localStorage.getItem("blur") == 0) {
3100  document.getElementById("settingStyle").innerText = `:root{--backdrop-filter: none}`;
3101} else {
3102  document.getElementById("settingStyle").innerText = `:root{--backdrop-filter: var(--blur-num)}`;
3103}
3104function setBlur() {
3105  if (document.getElementById("blur").checked) {
3106    localStorage.setItem("blur", 1);
3107    document.getElementById("settingStyle").innerText = `:root{--backdrop-filter: var(--blur-num)}`;
3108  } else {
3109    localStorage.setItem("blur", 0);
3110    document.getElementById("settingStyle").innerText = `:root{--backdrop-filter: none}`;
3111  }
3112}
3113
3114// 更换背景(原来Leonus的代码)
3115// 存数据
3116// name:命名 data:数据
3117// function saveData(name, data) {
3118//   localStorage.setItem(name, JSON.stringify({ time: Date.now(), data: data }));
3119// }
3120// 取数据
3121// name:命名 time:过期时长,单位分钟,如传入30,即加载数据时如果超出30分钟返回0,否则返回数据
3122// function loadData(name, time) {
3123//   let d = JSON.parse(localStorage.getItem(name));
3124//   // 过期或有错误返回 0 否则返回数据
3125//   if (d) {
3126//     let t = Date.now() - d.time;
3127//     if (t < time * 60 * 1000 && t > -1) return d.data;
3128//   }
3129//   return 0;
3130// }
3131// 上面两个函数如果你有其他需要存取数据的功能,ä¹
3131Ÿå¯ä»¥ç›´æŽ¥ä½¿ç”¨
3132// 读取背景
3133// try {
3134//   let data = loadData("blogbg", 1440);
3135//   if (data) changeBg(data, 1);
3136//   else localStorage.removeItem("blogbg");
3137// } catch (error) {
3138//   localStorage.removeItem("blogbg");
3139// }
3140// 切换背景函数
3141// 此处的flag是为了每次读取时都重新存储一次,导致过期时间不稳定
3142// 如果flag为0则存储,即设置背景. 为1则不存储,即每次加载自动读取背景.
3143// function changeBg(s, flag) {
3144//   let bg = document.getElementById("web_bg");
3145//   if (s.charAt(0) == "#") {
3146//     bg.style.backgroundColor = s;
3147//     bg.style.backgroundImage = "none";
3148//   } else {
3149//     bg.style.backgroundImage = s
3150//   };
3151//   if (!flag) {
3152//     saveData("blogbg", s);
3153//   }
3154// }
3155
3156// 切换自定义颜色
3157var defineColor = localStorage.getItem("blogbg") && localStorage.getItem("blogbg").charAt(0) == '#' ? localStorage.getItem("blogbg") : '#F4D88A';
3158function changeBgColor() {
3159  changeBg(document.querySelector("#define_colors").value);
3160}
3161
3162// 必应每日壁纸API
3163let bingDayBg = screen.width <= 768 ? "url(https://bing.img.run/m.php)" : "url(https://bing.img.run/1920x1080.php)";
3164// 必应历史壁纸API
3165let bingHistoryBg = screen.width <= 768 ? "url(https://bing.img.run/rand_m.php)" : "url(https://bing.img.run/rand.php)";
3166// EEE.DOG
3167let EEEDog = "url(https://api.yimian.xyz/img?type=moe&size=1920x1080)";
3168// 随机美图cdn.seovx.com
3169let seovx = "url(https://cdn.seovx.com/?mom=302)";
3170// picsum随机
3171let picsum = "url(https://picsum.photos/1920/1080.webp)";
3172// 小歪二次元
3173// let waiDongman = "url(https://api.ixiaowai.cn/api/api.php)";
3174//  小歪高清壁纸
3175let waiBizhi = "url(https://api.ixiaowai.cn/gqapi/gqapi.php)";
3176// 博天随机
3177let btstu = "url(http://api.btstu.cn/sjbz/?lx=suiji)";
3178// tuapi 动漫
3179// let tuapi = "url(https://tuapi.eees.cc/api.php?category=dongman)";
3180// unsplash随机 https://source.unsplash.com/random/1920x1080/daily (weekly)
3181let unsplash = "url(https://source.unsplash.com/random/1920x1080/)";
3182
3183
3184// 更换背景(自己的代码)
3185if (localStorage.getItem("blogbg") != undefined) {
3186  setBg(localStorage.getItem("blogbg"));
3187} else {
3188  document.getElementById("defineBg").innerText = `:root{
3189    --default-bg: url(https://picture.adunas.top/DaBieShanA.jpg);
3190    --darkmode-bg: url(https://picture.adunas.top/DongHuA.jpg);
3191    --mobileday-bg: url(https://picture.adunas.top/WHUSakuraA.jpg);
3192    --mobilenight-bg: url(https://picture.adunas.top/WHUSakuraB.jpg);
3193  }`;
3194}
3195// 切换背景主函数
3196function changeBg(s) {
3197  // 自定义颜色框
3198  defineColor = s.charAt(0) == "#" ? s : '#F4D88A';
3199  setBg(s);
3200  localStorage.setItem("blogbg", s);
3201}
3202// 设置背景属性
3203function setBg(s) {
3204  document.getElementById("defineBg").innerText = `:root{
3205    --default-bg: ${s};
3206    --darkmode-bg: ${s};
3207    --mobileday-bg: ${s};
3208    --mobilenight-bg: ${s};
3209  }`;
3210}
3211
3212// 切换链接对应的背景(加入了链接检验与防抖)
3213function getPicture() {
3214  debounce(getPicture_, 300);
3215}
3216
3217function getPicture_() {
3218  checkImgExists(document.getElementById("pic-link").value).then(() => {
3219    // 有效的图片链接
3220    var link = "url(" + document.getElementById("pic-link").value + ")";
3221    changeBg(link);
3222    // 提示切换成功
3223    new Vue({
3224      data: function () {
3225        this.$notify({
3226          title: "可以啦🍨",
3227          message: "切换自定义背景成功!",
3228          position: 'top-left',
3229          offset: 50,
3230          showClose: true,
3231          type: "success",
3232          duration: 5000
3233        });
3234      }
3235    })
3236  }).catch(() => {
3237    // 无效的图片链接,提示无效
3238    new Vue({
3239      data: function () {
3240        this.$notify({
3241          title: "链接不对🤣",
3242          message: "请输入有效的图片链接!",
3243          position: 'top-left',
3244          offset: 50,
3245          showClose: true,
3246          type: "warning",
3247          duration: 5000
3248        });
3249      }
3250    })
3251  })
3252}
3253// 判断图片链接是否可用
3254function checkImgExists(imgurl) {
3255  return new Promise(function (resolve, reject) {
3256    var ImgObj = new Image();
3257    ImgObj.src = imgurl;
3258    ImgObj.onload = function (res) {
3259      resolve(res);
3260    }
3261    ImgObj.onerror = function (err) {
3262      reject(err);
3263    }
3264  })
3265}
3266
3267// 黑夜霓虹灯开关
3268if (localStorage.getItem("light") == undefined) {
3269  localStorage.setItem("light", "true");
3270}
3271// 这里要适配Pjax
3272document.addEventListener('pjax:complete', function () {
3273  changeLight(localStorage.getItem("light") == "true" ? true : false)
3274});
3275document.addEventListener('DOMContentLoaded', function () {
3276  changeLight(localStorage.getItem("light") == "true" ? true : false)
3277});
3278function setLight() {
3279  if (document.getElementById("lightSet").checked) {
3280    changeLight(true);
3281    localStorage.setItem("light", "true");
3282  } else {
3283    changeLight(false);
3284    localStorage.setItem("light", "false");
3285  }
3286}
3287// 更换霓虹灯状态
3288function changeLight(flag) {
3289  if (document.getElementById("site-name"))
3290    document.getElementById("site-name").style.animation = flag ? "light_15px 10s linear infinite" : "none";
3291  if (document.getElementById("site-title"))
3292    document.getElementById("site-title").style.animation = flag ? "light_15px 10s linear infinite" : "none";
3293  if (document.getElementById("site-subtitle"))
3294    document.getElementById("site-subtitle").style.animation = flag ? "light_10px 10s linear infinite" : "none";
3295  if (document.getElementById("post-info"))
3296    document.getElementById("post-info").style.animation = flag ? "light_5px 10s linear infinite" : "none";
3297  document.getElementById("menu_shadow").innerText = flag ? `:root{--menu-shadow: 0 0 1px var(--theme-color);}` : `:root{--menu-shadow: none;}`;
3298}
3299
3300
3301
3302// 解决开启Pjax的问题
3303// function whenDOMReady() {
3304//   try {
3305//     let data = loadData('blogbg', 1440)
3306//     if (data) changeBg_noWindow(data, 0)
3307//     else localStorage.removeItem('blogbg');
3308//   } catch (error) { localStorage.removeItem('blogbg'); }
3309// }
3310// whenDOMReady()
3311// document.addEventListener("pjax:success", whenDOMReady)
3312
3313// 无弹窗提醒更换背景
3314// function changeBg_noWindow(s, flag) {
3315//   let bg = document.getElementById("web_bg");
3316//   if (s.charAt(0) == "#") {
3317//     bg.style.backgroundColor = s;
3318//     bg.style.backgroundImage = "none";
3319//   } else bg.style.backgroundImage = s;
3320//   if (!flag) {
3321//     saveData("blogbg", s);
3322//   }
3323// }
3324
3325// 创建窗口
3326var winbox = "";
3327
3328function createWinbox() {
3329  let div = document.createElement("div");
3330  document.body.appendChild(div);
3331  winbox = WinBox({
3332    id: "meihuaBox",
3333    index: 99,
3334    title: "美化设置",
3335    x: "left",
3336    y: "center",
3337    minwidth: "300px",
3338    height: "60%",
3339    // "#76c8f1"
3340    background: 'var(--theme-color)',
3341    onmaximize: () => {
3342      div.innerHTML = `<style>body::-webkit-scrollbar {display: none;} div#meihuaBox {width: 100% !important;}</style>`;
3343    },
3344    onrestore: () => {
3345      div.innerHTML = "";
3346    },
3347  });
3348  winResize();
3349  window.addEventListener("resize", winResize);
3350
3351  // 每一类我放了一个演示,直接往下复制粘贴 a标签 就可以,需要注意的是 函数里面的链接 冒号前面需要添加反斜杠\进行转义
3352  winbox.body.innerHTML = `
3353<div class="settings" style="display: block;">
3354<div id="article-container" style="padding:12px;">
3355<br>
3356<center><p><button onclick="reset()" style="background:linear-gradient(to right, #fc354c, #0abfbc);display:block;width:40%;padding:15px 0;border-radius:30px;color:white;font-size:1.1em;"><i class="fa-solid fa-arrows-rotate"></i>&nbsp;恢复默认设置</button></p></center>
3357
3358<h2>一、显示偏好</h2>
3359
3360<div class="transValue" style="font-weight:bold;padding-left:10px">透明度 (0%-100%): ${curTransNum}%</div>
3361<div class="range">
3362  <input id="transSet" type="range" min="0" max="100" step="1" value=${curTransNum} oninput="setTrans()">
3363  <p class="rang_width" id="rang_trans" style="width:${curTransMini}%"></p>
3364</div>
3365
3366<div class="blurValue" style="font-weight:bold;padding-left:10px">模糊半径 (开启模糊生效 0px-100px): ${curBlur} px</div>
3367<div class="range">
3368  <input id="blurSet" type="range" min="0" max="100" step="1" value="${curBlur}" oninput="setBlurNum()">
3369  <p class="rang_width" id="rang_blur" style="width:${miniBlur}%"></p>
3370</div>
3371
3372
3373<div class="content" style="display:flex">
3374  <div class="content-text" style="font-weight:bold; padding-left:10px"> 星空特效 (夜间模式) </div><input type="checkbox" id="universeSet" onclick="setUniverse()">
3375  <div class="content-text" style="font-weight:bold; padding-left:20px"> 霓虹灯 (夜间模式) </div><input type="checkbox" id="lightSet" onclick="setLight()">
3376</div>
3377
3378<div class="content" style="display:flex">
3379  <div class="content-text" style="font-weight:bold; padding-left:10px"> 模糊效果 (消耗性能) </div><input type="checkbox" id="blur" onclick="setBlur()">
3380  <div class="content-text" style="font-weight:bold; padding-left:20px"> 侧边栏 (默认开) </div><input type="checkbox" id="rightSideSet" onclick="toggleRightside()">
3381</div>
3382
3383<div class="content" style="display:flex">
3384  <div class="content-text" style="font-weight:bold; padding-left:10px"> 帧率监测 (刷新生效) </div><input type="checkbox" id="fpson" onclick="fpssw()">
3385  <div class="content-text" style="font-weight:bold; padding-left:10px"> 雪花特效 (白天模式) </div><input type="checkbox" id="snowSet" onclick="setSnow()">
3386</div>
3387
3388
3389<h2>二、字体设置</h2>
3390<div class="note warning modern"><p>非商免字体未经授权只能个人使用。本站为完全非商业、非盈利性质的网站,平时用于个人学习交流,如有侵权请联系站长删除,谢谢!
3391—— 致版权方</p>
3392</div>
3393<p id="swfs">
3394<a class="swf" id="swf_TTQHB" href="javascript:;" rel="noopener external nofollow" style="font-family:'TTQHB'!important;color:black" onclick="setFont('TTQHB')">默认字体</a>
3395<a class="swf" id="swf_TSZQGBJ" href="javascript:;" rel="noopener external nofollow" style="font-family:'TSZQGBJ'!important;color:black" onclick="setFont('TSZQGBJ')">腾祥铚谦钢笔简</a>
3396<a class="swf" id="swf_PAYBJ" href="javascript:;" rel="noopener external nofollow" style="font-family:'PAYBJ'!important;color:black" onclick="setFont('PAYBJ')">佩安硬笔简</a>
3397<a class="swf" id="swf_default" href="javascript:;" rel="noopener external nofollow" style="font-family:-apple-system, IBM Plex Mono ,monosapce,'微软雅黑', sans-serif;!important;color:black" onclick="setFont('default')">Hexo默认字体</a>
3398</p>
3399
3400<h2>三、主题色设置</h2>
3401<div class="content" style="display:flex"><input type="radio" id="red" name="colors" value=" "
3402        onclick="setColor('red')"><input type="radio" id="orange" name="colors" value=" "
3403        onclick="setColor('orange')"><input type="radio" id="yellow" name="colors" value=" "
3404        onclick="setColor('yellow')"><input type="radio" id="green" name="colors" value=" "
3405        onclick="setColor('green')"><input type="radio" id="blue" name="colors" value=" "
3406        onclick="setColor('blue')"><input type="radio" id="heoblue" name="colors" value=" "
3407        onclick="setColor('heoblue')"><input type="radio" id="darkblue" name="colors" value=" "
3408        onclick="setColor('darkblue')"><input type="radio" id="purple" name="colors" value=" "
3409        onclick="setColor('purple')"><input type="radio" id="pink" name="colors" value=" "
3410        onclick="setColor('pink')" checked="checked"><input type="radio" id="black" name="colors" value=" "
3411        onclick="setColor('black')"><input type="radio" id="blackgray" name="colors" value=" "
3412        onclick="setColor('blackgray')"></div>
3413
3414<h2>四、背景设置</h2>
3415<center><button onclick="resetBg()" style="background:var(--theme-color);display:block;width:35%;padding:15px 0;border-radius:30px;color:white;"><i class="fa-solid fa-arrows-rotate"></i>&nbsp;恢复默认背景</button></center>
3416
3417<h3>1. 二次元</h3>
3418<details class="folding-tag" cyan><summary> 查看二次元背景 </summary>
3419              <div class='content'>
3420              <div class="bgbox">�<p><a href="javascript:;" rel="noopener external nofollow" style="background-image:url(https://lskypro.acozycotage.net/Fomalhaut/img/home_bg.webp)" class="imgbox" onclick="changeBg('url(https://lskypro.acozycotage.net/Fomalhaut/img/home_bg.webp)')"></a></p>�</div>
3421              </div>
3422            </details>
3423
3424
3425<h3>2. 风景</h3>
3426
3427<details class="folding-tag" cyan><summary> 查看风景背景 </summary>
3428              <div class='content'>
3429              <div class="bgbox">�<p><a href="javascript:;" rel="noopener external nofollow" style="background-image:url(https://lskypro.acozycotage.net/Fomalhaut/img/fj1.webp)" class="imgbox" onclick="changeBg('url(https://lskypro.acozycotage.net/Fomalhaut/img/fj1.webp)')"></a></p>�</div>
3430              </div>
3431            </details>
3432
3433<h3>3. 萌宠</h3>
3434
3435<details class="folding-tag" cyan><summary> 查看萌宠背景 </summary>
3436              <div class='content'>
3437              <div class="bgbox">�<p><a href="javascript:;" rel="noopener external nofollow" style="background-image:url(https://lskypro.acozycotage.net/Fomalhaut/img/mc1.webp)" class="imgbox" onclick="changeBg('url(https://lskypro.acozycotage.net/Fomalhaut/img/mc1.webp)')"></a></p>�</div>
3438              </div>
3439            </details>
3440
3441<h3>4. 渐变色</h3>
3442<details class="folding-tag" cyan><summary> 查看渐变色背景 </summary>
3443              <div class='content'>
3444              <div class="bgbox">�<p><a href="javascript:;" rel="noopener external nofollow" class="box" style="background: linear-gradient(to right, #544a7d, #ffd452)" onclick="changeBg('linear-gradient(to right, #544a7d, #ffd452)')"></a>�<a href="javascript:;" rel="noopener external nofollow" class="box" style="background: linear-gradient(to bottom, #7f7fd5, #86a8e7, #91eae4)" onclick="changeBg('linear-gradient(to bottom, #7f7fd5, #86a8e7, #91eae4)')"></a>�<a href="javascript:;" rel="noopener external nofollow" class="box" style="background: linear-gradient(to left, #654ea3, #eaafc8)" onclick="changeBg('linear-gradient(to left, #654ea3, #eaafc8)')"></a>�<a href="javascript:;" rel="noopener external nofollow" class="box" style="background: linear-gradient(to top, #feac5e, #c779d0, #4bc0c8)" onclick="changeBg('linear-gradient(to top, #feac5e, #c779d0, #4bc0c8)')"></a>�<a href="javascript:;" rel="noopener external nofollow" class="box" style="background: linear-gradient(to top, #d3959b, #bfe6ba)" onclick="changeBg('linear-gradient(to top, #d3959b, #bfe6ba)')"></a>�<a href="javascript:;" rel="noopener external nofollow" class="box" style="background: linear-gradient(to top, #8360c3, #2ebf91)" onclick="changeBg('linear-gradient(to top, #8360c3, #2ebf91)')"></a>�<a href="javascript:;" rel="noopener external nofollow" class="box" style="background: linear-gradient(to top, #108dc7, #ef8e38)" onclick="changeBg('linear-gradient(to top, #108dc7, #ef8e38)')"></a>�<a href="javascript:;" rel="noopener external nofollow" class="box" style="background: linear-gradient(to top, #355c7d, #6c5b7b, #c06c84)" onclick="changeBg('linear-gradient(to top, #355c7d, #6c5b7b, #c06c84)')"></a></p>�</div>
3445              </div>
3446            </details>
3447
3448
3449<h3>5. 纯色</h3>
3450<details class="folding-tag" cyan><summary> 查看纯色背景 </summary>
3451              <div class='content'>
3452              <div class="bgbox">�<p><a href="javascript:;" rel="noopener external nofollow" class="box" style="background: #ecb1b1" onclick="changeBg('#ecb1b1')"></a>�<a href="javascript:;" rel="noopener external nofollow" class="box" style="background: #d3ebac" onclick="changeBg('#d3ebac')"></a>�<a href="javascript:;" rel="noopener external nofollow" class="box" style="background: #ace9ce" onclick="changeBg('#ace9ce')"></a>�<a href="javascript:;" rel="noopener external nofollow" class="box" style="background: #c1ebea" onclick="changeBg('#c1ebea')"></a>�<a href="javascript:;" rel="noopener external nofollow" class="box" style="background: #dee7f1" onclick="changeBg('#dee7f1')"></a>�<a href="javascript:;" rel="noopener external nofollow" class="box" style="background: #e9e3f2" onclick="changeBg('#e9e3f2')"></a>�<a href="javascript:;" rel="noopener external nofollow" class="box" style="background: #f7eff5" onclick="changeBg('#f7eff5')"></a><br />�<input type="color" id="define_colors" href="javascript:;" rel="noopener external nofollow" class="box" autocomplete="on" value="${defineColor}
3452" oninput="changeBgColor()"></input></p>�</div>
3453              </div>
3454            </details>
3455
3456
3457
3458<h3>6. 适配手机</h3>
3459<details class="folding-tag" cyan><summary> 查看适配手机的背景 </summary>
3460              <div class='content'>
3461              <div class="bgbox">�<p><a href="javascript:;" rel="noopener external nofollow" style="background-image:url(https://lskypro.acozycotage.net/Fomalhaut/img/mb4.webp)" class="pimgbox" onclick="changeBg('url(https://lskypro.acozycotage.net/Fomalhaut/img/mb4.webp)')"></a></p>�</div>
3462              </div>
3463            </details>
3464
3465
3466<h3>7. 壁纸API</h3>
3467<details class="folding-tag" cyan><summary> 查看壁纸API系列背景 </summary>
3468              <div class='content'>
3469              <div class="bgbox">�<p><a id="bingDayBox" rel="noopener external nofollow" style="background-image: ${bingDayBg}" class="box apiBox" onclick="changeBg('${bingDayBg}')"></a>�<a id="bingHistoryBox" rel="noopener external nofollow" style="background-image: ${bingHistoryBg}" class="box apiBox" onclick="changeBg('${bingHistoryBg}')"></a>�<a id="EEEDogBox" rel="noopener external nofollow" style="background-image: ${EEEDog}" class="box apiBox" onclick="changeBg('${EEEDog}')"></a>�<a id="seovxBox" rel="noopener external nofollow" style="background-image: ${seovx}" class="box apiBox" onclick="changeBg('${seovx}')"></a>�<a id="picsumBox" rel="noopener external nofollow" style="background-image: ${picsum}" class="box apiBox" onclick="changeBg('${picsum}')"></a>�<a id="waiBizhiBox" rel="noopener external nofollow" style="background-image: ${waiBizhi}" class="box apiBox" onclick="changeBg('${waiBizhi}')"></a>�<a id="btstuBox" rel="noopener external nofollow" style="background-image: ${btstu}" class="box apiBox" onclick="changeBg('${btstu}')"></a>�<a id="unsplashBox" rel="noopener external nofollow" style="background-image: ${unsplash}" class="box apiBox" onclick="changeBg('${unsplash}')"></a></p>�</div>
3470              </div>
3471            </details>
3472
3473
3474<h3>8. 自定义背景</h3>
3475<details class="folding-tag" cyan><summary> 设置自定义背景 </summary>
3476              <div class='content'>
3477              <p>�<center>�<input type="text" id="pic-link" size="70%" maxlength="1000" placeholder="请输入有效的图片链接,如 https://source.fomal.cc/img/home_bg.webp">�</center>�</p>�<p>�<center>�<button type="button" onclick="getPicture()" style="background:var(--theme-color);width:35%;padding: 5px 0px 7px 0px;border-radius:30px;color:white;line-height:2;">�🌈切换背景🌈�</button>�</center>�</p>
3478              </div>
3479            </details>
3480
3481<br>
3482<center><div style="font-size:1.2em;color:var(--theme-color);font-weight:bold;">------ ( •̀ ω •́ )y 到底啦 ------</div></center>
3483<br>
3484
3485</div>
3486
3487</div>
3488
3489`;
3490
3491  // 打开小窗时候初始化
3492  $("#" + localStorage.getItem("themeColor")).attr("checked", true);
3493  if (localStorage.getItem("blur") == 1) {
3494    document.getElementById("blur").checked = true;
3495  } else {
3496    document.getElementById("blur").checked = false;
3497  }
3498  if (localStorage.getItem("universe") == "block") {
3499    document.getElementById("universeSet").checked = true;
3500  } else if (localStorage.getItem("universe") == "none") {
3501    document.getElementById("universeSet").checked = false;
3502  }
3503  if (localStorage.getItem("fpson") == "1") {
3504    document.getElementById("fpson").checked = true;
3505  } else {
3506    document.getElementById("fpson").checked = false;
3507  }
3508  if (localStorage.getItem("rs") == "block") {
3509    document.getElementById("rightSideSet").checked = true;
3510  } else if (localStorage.getItem("rs") == "none") {
3511    document.getElementById("rightSideSet").checked = false;
3512  }
3513  if (localStorage.getItem("light") == "true") {
3514    document.getElementById("lightSet").checked = true;
3515  } else {
3516    document.getElementById("lightSet").checked = false;
3517  }
3518  setFontBorder();
3519  if (localStorage.getItem("snow") == "block") {
3520    document.getElementById("snowSet").checked = true;
3521  } else if (localStorage.getItem("snow") == "none") {
3522    document.getElementById("snowSet").checked = false;
3523  }
3524}
3525
3526// 恢复默认背景
3527function resetBg() {
3528  localStorage.removeItem('blogbg');
3529  reload();
3530}
3531
3532// 恢复默认设置并刷新页面
3533function reset() {
3534  clearItem();
3535  reload();
3536}
3537
3538// 适应窗口大小
3539function winResize() {
3540  try {
3541    var offsetWid = document.documentElement.clientWidth;
3542    if (offsetWid <= 768) {
3543      winbox.resize(offsetWid * 0.95 + "px", "90%").move("center", "center");
3544    } else {
3545      winbox.resize(offsetWid * 0.6 + "px", "70%").move("center", "center");
3546    }
3547  } catch (err) {
3548    // console.log("Pjax毒瘤抽风运行winResize方法🙄🙄🙄");
3549  }
3550}
3551
3552// 切换状态,窗口已创建则控制窗口显示和隐藏,没窗口则创建窗口
3553function toggleWinbox() {
3554  if (document.querySelector("#meihuaBox")) {
3555    winbox.toggleClass("hide");
3556  } else {
3557    createWinbox();
3558  };
3559}
3560
3561/* 美化模块 end */

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.