From d197c0e95c11ab7e68287703c162a929cdb0e298 Mon Sep 17 00:00:00 2001 From: UPToZ Date: Tue, 16 Apr 2024 17:08:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=80=80=E5=87=BA=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E9=97=AE=E9=A2=98=20detailed=EF=BC=9A=201.=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E4=BA=86readme=E6=96=87=E4=BB=B6=E5=92=8C=E4=B8=BB?= =?UTF-8?q?=E9=A2=98=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=202.=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E4=BA=86=E9=80=80=E5=87=BA=E7=99=BB=E5=BD=95=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E9=80=80=E5=87=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 55 +- templates/assets/js/heo.js | 1292 +++++++++++----------- templates/assets/js/utils.js | 626 +++++------ templates/assets/zhheo/rightmenu.js | 665 +++++------ templates/modules/widgets/nav-right.html | 142 +-- theme.yaml | 4 +- 6 files changed, 1430 insertions(+), 1354 deletions(-) diff --git a/README.md b/README.md index 3485051..d3202cb 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,54 @@ -# halo-theme-hao +
+ + + +

Halo-Theme-Hao

-基于halo-theme-hao的1.4.9-beta2版本进行修改。 \ No newline at end of file +## 🔥 预览 + +| 站点名称 | 站点地址 | +|:----------:|:----------------------:| +| 小小笔记大大用处 | https://blog.uptoz.cn | + + +## 👋 简介 + +[Halo-Theme-Hao](https://gitea.uptoz.cn/UPToZ/halo-theme-hao) +是一款适用于 [Halo2.x](https://github.com/halo-dev/halo) 的博客主题。 + +移植自 [Hexo](https://hexo.io/zh-cn/index.html) 社区中 [张洪 Heo](https://blog.zhheo.com/) +对 [Hexo-Theme-hao](https://github.com/chengzhongxue/halo-theme-hao)主题1.4.9-beta2的魔改版本。 + + +## 🚨 注意事项(看我看我) + +1. **建站时间必填** +2. 如果安装主题后报错,请仔细查阅[主题说明](https://gitea.uptoz.cn/UPToZ/halo-theme-hao) + 与[更新说明](https://gitea.uptoz.cn/UPToZ/halo-theme-hao/releases)!!! +3. 如果还未解决,可以加群求助!!! +4. 如果群友也解决不了,再考虑提ISSUE!!! +5. `1.3.1`及以上版本需要`Halo`版本>=`2.8.0` +6. **若安装主题后出现500错误,请到主题设置页面,将每个设置项都保存一下!!!** +7. **`beta`版本主题必须使用`本地资源`,正式版本才会存在`在线资源`** + +### 🔌 插件依赖 + +> 所有插件均为可选,不安装则不会出现对应功能。 +> 部分插件可能已经预设在 Halo 内。 +> 部分插件主题尚未适配。 + +- 评论功能 [plugin-comment-widget](https://github.com/halo-sigs/plugin-comment-widget/releases) +- 搜索功能 [plugin-search-widget](https://github.com/halo-sigs/plugin-search-widget/releases) +- 友链页面 [plugin-links](https://github.com/halo-sigs/plugin-links) +- 瞬间页面 [plugin-moments](https://github.com/halo-sigs/plugin-moments) +- 追番插件 [plugin-bilibili-bangumi](https://github.com/Roozenlz/plugin-bilibili-bangumi) +- 图库插件 [plugin-photos](https://github.com/halo-sigs/plugin-photos) +- katex插件 [plugin-katex](https://github.com/chengzhongxue/plugin-katex/releases/) +- 我的装备 [plugin-equipments](https://github.com/chengzhongxue/plugin-equipments) +- Markdown / HTML 内容块插件 [plugin-hybrid-edit-block](https://www.halo.run/store/apps/app-NgHnY) + +> 更多插件请参见:https://github.com/halo-sigs/awesome-halo + +## 📝 使用 + +[点我查看](https://www.yuque.com/liuzhihangs/halo-theme-hao) \ No newline at end of file diff --git a/templates/assets/js/heo.js b/templates/assets/js/heo.js index 48a7d40..2af937f 100644 --- a/templates/assets/js/heo.js +++ b/templates/assets/js/heo.js @@ -1,685 +1,701 @@ let heo_cookiesTime = null -// 第一次播放音乐 -,heo_musicFirst = false -// 音乐播放状态 -,heo_musicPlaying = false -,heo_keyboard = false -,heo_intype = false -,lastSayHello = "" -,refreshNum = 1; + // 第一次播放音乐 + , + heo_musicFirst = false + // 音乐播放状态 + , + heo_musicPlaying = false, + heo_keyboard = false, + heo_intype = false, + lastSayHello = "", + refreshNum = 1; // 私有函数 var heo = { - // 检测显示模式 - darkModeStatus: function () { - let theme = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light' - if (theme == 'light') { - $(".menu-darkmode-text").text("深色模式"); - } else { - $(".menu-darkmode-text").text("浅色模式"); - } - }, + // 检测显示模式 + darkModeStatus: function() { + let theme = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light' + if (theme == 'light') { + $(".menu-darkmode-text").text("深色模式"); + } else { + $(".menu-darkmode-text").text("浅色模式"); + } + }, - // 首页bb - initIndexEssay: function() { - if (document.querySelector("#bber-talk")) - $(".swiper-wrapper .swiper-slide").each(function () { - var text = $(this)[0].innerText; - if (text != 'undefined') { - $(this).text(btf.changeContent(text)); - } - }) - new Swiper(".swiper-container",{ - direction: "vertical", - loop: !0, - autoplay: { - delay: 3e3, - pauseOnMouseEnter: !0 - } - }) - }, + // 首页bb + initIndexEssay: function() { + if (document.querySelector("#bber-talk")) + $(".swiper-wrapper .swiper-slide").each(function() { + var text = $(this)[0].innerText; + if (text != 'undefined') { + $(this).text(btf.changeContent(text)); + } + }) + new Swiper(".swiper-container", { + direction: "vertical", + loop: !0, + autoplay: { + delay: 3e3, + pauseOnMouseEnter: !0 + } + }) + }, - // 只在首页显示 - onlyHome: function () { - var urlinfo = window.location.pathname; - urlinfo = decodeURIComponent(urlinfo); - if (urlinfo == '/') { - $('.only-home').attr('style', 'display: flex'); - } else { - $('.only-home').attr('style', 'display: none'); - } - }, + // 只在首页显示 + onlyHome: function() { + var urlinfo = window.location.pathname; + urlinfo = decodeURIComponent(urlinfo); + if (urlinfo == '/') { + $('.only-home').attr('style', 'display: flex'); + } else { + $('.only-home').attr('style', 'display: none'); + } + }, - //是否在首页 - is_Post: function () { - var url = window.location.href; //获取url - if (url.indexOf("/archives/") >= 0) { //判断url地址中是否包含code字符串 - return true; - } else { - return false; - } - }, + //是否在首页 + is_Post: function() { + var url = window.location.href; //获取url + if (url.indexOf("/archives/") >= 0) { //判断url地址中是否包含code字符串 + return true; + } else { + return false; + } + }, - //监测是否在页面开头 - addNavBackgroundInit: function() { - var e = 0 - , t = 0; - document.body && (e = document.body.scrollTop), - document.documentElement && (t = document.documentElement.scrollTop), - 0 != (e - t > 0 ? e : t) && (document.getElementById("page-header").classList.add("nav-fixed"), - document.getElementById("page-header").classList.add("nav-visible"), - $("#cookies-window").hide()) - }, + //监测是否在页面开头 + addNavBackgroundInit: function() { + var e = 0, + t = 0; + document.body && (e = document.body.scrollTop), + document.documentElement && (t = document.documentElement.scrollTop), + 0 != (e - t > 0 ? e : t) && (document.getElementById("page-header").classList.add("nav-fixed"), + document.getElementById("page-header").classList.add("nav-visible"), + $("#cookies-window").hide()) + }, - tagPageActive: function() { - var e = window.location.pathname; - if (/\/tags\/.*?/.test(e = decodeURIComponent(e))) { - var t = e.split("/")[2]; - if (document.querySelector("#tag-page-tags")) { - $("a").removeClass("select"); - var o = document.getElementById(t); - o && (o.classList.add("select"), - o.style.order = "-1") - } - } - }, + tagPageActive: function() { + var e = window.location.pathname; + if (/\/tags\/.*?/.test(e = decodeURIComponent(e))) { + var t = e.split("/")[2]; + if (document.querySelector("#tag-page-tags")) { + $("a").removeClass("select"); + var o = document.getElementById(t); + o && (o.classList.add("select"), + o.style.order = "-1") + } + } + }, - categoriesBarActive: function() { - document.querySelector("#category-bar") && $(".category-bar-item").removeClass("select"); - var e = window.location.pathname; - if ("/" == (e = decodeURIComponent(e))) - document.querySelector("#category-bar") && document.getElementById("category-bar-home").classList.add("select"); - else { - if (/\/categories\/.*?/.test(e)) { - var t = e.split("/")[2]; - if (document.querySelector("#category-bar")) { - var o = document.getElementById(t); - o && (o.classList.add("select"), - o.style.order = "-1") - } - } - } - }, + categoriesBarActive: function() { + document.querySelector("#category-bar") && $(".category-bar-item").removeClass("select"); + var e = window.location.pathname; + if ("/" == (e = decodeURIComponent(e))) + document.querySelector("#category-bar") && document.getElementById("category-bar-home").classList + .add("select"); + else { + if (/\/categories\/.*?/.test(e)) { + var t = e.split("/")[2]; + if (document.querySelector("#category-bar")) { + var o = document.getElementById(t); + o && (o.classList.add("select"), + o.style.order = "-1") + } + } + } + }, - // 页脚友链 - addFriendLinksInFooter: function () { - var footerRandomFriendsBtn = document.getElementById("footer-random-friends-btn"); - if(!footerRandomFriendsBtn) return; - footerRandomFriendsBtn.style.opacity = "0.2"; - footerRandomFriendsBtn.style.transitionDuration = "0.3s"; - footerRandomFriendsBtn.style.transform = "rotate(" + 360 * refreshNum++ + "deg)"; - function getLinks(){ - const fetchUrl = "/apis/api.plugin.halo.run/v1alpha1/plugins/PluginLinks/links?keyword=&sort=priority,asc" - fetch(fetchUrl) - .then(res => res.json()) - .then(json => { - saveToLocal.set('links-data', JSON.stringify(json.items), 10 / (60 * 24)) - renderer(json.items); - }) - } - function renderer(data){ - const linksUrl = GLOBAL_CONFIG.source.links.linksUrl - const num = GLOBAL_CONFIG.source.links.linksNum - var randomFriendLinks = getArrayItems(data, num); - var htmlText = ''; - for (let i = 0; i < randomFriendLinks.length; ++i) { - var item = randomFriendLinks[i] - htmlText += `${item.spec.displayName}`; - } - htmlText += `更多` - if(document.getElementById("friend-links-in-footer")){ - document.getElementById("friend-links-in-footer").innerHTML = htmlText; - } - } - function friendLinksInFooterInit(){ - const data = saveToLocal.get('links-data') - if (data) { - renderer(JSON.parse(data)) - } else { - getLinks() - } - setTimeout(()=>{ - footerRandomFriendsBtn.style.opacity = "1"; - }, 300) - } - friendLinksInFooterInit(); - }, + // 页脚友链 + addFriendLinksInFooter: function() { + var footerRandomFriendsBtn = document.getElementById("footer-random-friends-btn"); + if (!footerRandomFriendsBtn) return; + footerRandomFriendsBtn.style.opacity = "0.2"; + footerRandomFriendsBtn.style.transitionDuration = "0.3s"; + footerRandomFriendsBtn.style.transform = "rotate(" + 360 * refreshNum++ + "deg)"; - //禁止图片右键单击 - stopImgRightDrag: function () { - var img = $("img"); - img.on("dragstart", function () { - return false; - }); - }, + function getLinks() { + const fetchUrl = + "/apis/api.plugin.halo.run/v1alpha1/plugins/PluginLinks/links?keyword=&sort=priority,asc" + fetch(fetchUrl) + .then(res => res.json()) + .then(json => { + saveToLocal.set('links-data', JSON.stringify(json.items), 10 / (60 * 24)) + renderer(json.items); + }) + } - //置顶文章横向滚动 - topPostScroll: function () { - if (document.getElementById("recent-post-top")) { - let xscroll = document.getElementById("recent-post-top"); - xscroll.addEventListener("mousewheel", function (e) { - //计算鼠标滚轮滚动的距离 - let v = -e.wheelDelta / 2; - xscroll.scrollLeft += v; - //阻止浏览器默认方法 - if (document.body.clientWidth < 1300) { - e.preventDefault(); - } - }, false); - } - }, + function renderer(data) { + const linksUrl = GLOBAL_CONFIG.source.links.linksUrl + const num = GLOBAL_CONFIG.source.links.linksNum + var randomFriendLinks = getArrayItems(data, num); + var htmlText = ''; + for (let i = 0; i < randomFriendLinks.length; ++i) { + var item = randomFriendLinks[i] + htmlText += + `${item.spec.displayName}`; + } + htmlText += `更多` + if (document.getElementById("friend-links-in-footer")) { + document.getElementById("friend-links-in-footer").innerHTML = htmlText; + } + } - topCategoriesBarScroll: function () { - if (document.getElementById("category-bar-items")) { - let xscroll = document.getElementById("category-bar-items"); - xscroll.addEventListener("mousewheel", function (e) { - //计算鼠标滚轮滚动的距离 - let v = -e.wheelDelta / 2; - xscroll.scrollLeft += v; - //阻止浏览器默认方法 - e.preventDefault(); - }, false); - } - }, + function friendLinksInFooterInit() { + const data = saveToLocal.get('links-data') + if (data) { + renderer(JSON.parse(data)) + } else { + getLinks() + } + setTimeout(() => { + footerRandomFriendsBtn.style.opacity = "1"; + }, 300) + } + friendLinksInFooterInit(); + }, - //作者卡片问好 - sayhi: function () { - if (GLOBAL_CONFIG.profileStyle == 'default') { - if (document.querySelector('#author-info__sayhi')) { - document.getElementById("author-info__sayhi").innerHTML = getTimeState() + "!我是"; - } - }else{ - if (document.querySelector('#author-info__sayhi')) { - document.getElementById("author-info__sayhi").innerHTML = getTimeState(); - } - } + //禁止图片右键单击 + stopImgRightDrag: function() { + var img = $("img"); + img.on("dragstart", function() { + return false; + }); + }, - }, + //置顶文章横向滚动 + topPostScroll: function() { + if (document.getElementById("recent-post-top")) { + let xscroll = document.getElementById("recent-post-top"); + xscroll.addEventListener("mousewheel", function(e) { + //计算鼠标滚轮滚动的距离 + let v = -e.wheelDelta / 2; + xscroll.scrollLeft += v; + //阻止浏览器默认方法 + if (document.body.clientWidth < 1300) { + e.preventDefault(); + } + }, false); + } + }, - // 二维码 - qrcodeCreate: function () { - if (document.getElementById('qrcode')) { - document.getElementById("qrcode").innerHTML = ""; - var qrcode = new QRCode(document.getElementById("qrcode"), { - text: window.location.href, - width: 250, - height: 250, - colorDark: "#000", - colorLight: "#ffffff", - correctLevel: QRCode.CorrectLevel.H - }); - } - }, + topCategoriesBarScroll: function() { + if (document.getElementById("category-bar-items")) { + let xscroll = document.getElementById("category-bar-items"); + xscroll.addEventListener("mousewheel", function(e) { + //计算鼠标滚轮滚动的距离 + let v = -e.wheelDelta / 2; + xscroll.scrollLeft += v; + //阻止浏览器默认方法 + e.preventDefault(); + }, false); + } + }, - // 刷新即刻短文瀑布流 - reflashEssayWaterFall: function() { - document.querySelector("#waterfall") && setTimeout((function() { - waterfall("#waterfall"), - document.getElementById("waterfall") && document.getElementById("waterfall").classList.add("show") - } - ), 500) - }, + //作者卡片问好 + sayhi: function() { + if (GLOBAL_CONFIG.profileStyle == 'default') { + if (document.querySelector('#author-info__sayhi')) { + document.getElementById("author-info__sayhi").innerHTML = getTimeState() + "!我是"; + } + } else { + if (document.querySelector('#author-info__sayhi')) { + document.getElementById("author-info__sayhi").innerHTML = getTimeState(); + } + } - // 下载图片 - downloadImage: function (imgsrc, name) { //下载图片地址和图片名 - rm.hideRightMenu(); - if (rm.downloadimging == false) { - rm.downloadimging = true; - btf.snackbarShow('正在下载中,请稍后', false, 10000) - setTimeout(function () { - let image = new Image(); - // 解决跨域 Canvas 污染问题 - image.setAttribute("crossOrigin", "anonymous"); - image.onload = function () { - let canvas = document.createElement("canvas"); - canvas.width = image.width; - canvas.height = image.height; - let context = canvas.getContext("2d"); - context.drawImage(image, 0, 0, image.width, image.height); - let url = canvas.toDataURL("image/png"); //得到图片的base64编码数据 - let a = document.createElement("a"); // 生成一个a元素 - let event = new MouseEvent("click"); // 创建一个单击事件 - a.download = name || "photo"; // 设置图片名称 - a.href = url; // 将生成的URL设置为a.href属性 - a.dispatchEvent(event); // 触发a的单击事件 - }; - image.src = imgsrc; - btf.snackbarShow('图片已添加盲水印,请遵守版权协议'); - rm.downloadimging = false; - }, "10000"); - } else { - btf.snackbarShow('有正在进行中的下载,请稍后再试'); - } - }, + }, - //控制评论弹幕 - switchCommentBarrage: function () { - let commentBarrage = document.querySelector('.comment-barrage'); - if (commentBarrage) { - if ($(".comment-barrage").is(":visible")) { - $(".comment-barrage").hide(); - $(".menu-commentBarrage-text").text("显示热评"); - document.querySelector("#consoleCommentBarrage").classList.remove("on"); - localStorage.setItem('commentBarrageSwitch', 'false'); - btf.snackbarShow("✨ 已关闭评论弹幕", false, 2000) - } else if ($(".comment-barrage").is(":hidden")) { - $(".comment-barrage").show(); - $(".menu-commentBarrage-text").text("关闭热评"); - document.querySelector("#consoleCommentBarrage").classList.add("on"); - localStorage.removeItem('commentBarrageSwitch'); - btf.snackbarShow("✨ 已开启评论弹幕", false, 2000) - } - } - if(GLOBAL_CONFIG.rightMenuEnable){ - rm.hideRightMenu(); - } - }, + // 二维码 + qrcodeCreate: function() { + if (document.getElementById('qrcode')) { + document.getElementById("qrcode").innerHTML = ""; + var qrcode = new QRCode(document.getElementById("qrcode"), { + text: window.location.href, + width: 250, + height: 250, + colorDark: "#000", + colorLight: "#ffffff", + correctLevel: QRCode.CorrectLevel.H + }); + } + }, - //隐藏cookie窗口 - hidecookie: function() { - heo_cookiesTime = setTimeout((()=>{ - document.getElementById("cookies-window").classList.add("cw-hide"), - setTimeout((()=>{ - $("#cookies-window").hide() - } - ), 1e3) - } - ), 3e3) - }, + // 刷新即刻短文瀑布流 + reflashEssayWaterFall: function() { + document.querySelector("#waterfall") && setTimeout((function() { + waterfall("#waterfall"), + document.getElementById("waterfall") && document.getElementById("waterfall") + .classList.add("show") + }), 500) + }, - //隐藏今日推荐 - hideTodayCard: function () { - if (document.getElementById("todayCard")) { - document.getElementById("todayCard").classList.add('hide'); - } - }, + // 下载图片 + downloadImage: function(imgsrc, name) { //下载图片地址和图片名 + rm.hideRightMenu(); + if (rm.downloadimging == false) { + rm.downloadimging = true; + btf.snackbarShow('正在下载中,请稍后', false, 10000) + setTimeout(function() { + let image = new Image(); + // 解决跨域 Canvas 污染问题 + image.setAttribute("crossOrigin", "anonymous"); + image.onload = function() { + let canvas = document.createElement("canvas"); + canvas.width = image.width; + canvas.height = image.height; + let context = canvas.getContext("2d"); + context.drawImage(image, 0, 0, image.width, image.height); + let url = canvas.toDataURL("image/png"); //得到图片的base64编码数据 + let a = document.createElement("a"); // 生成一个a元素 + let event = new MouseEvent("click"); // 创建一个单击事件 + a.download = name || "photo"; // 设置图片名称 + a.href = url; // 将生成的URL设置为a.href属性 + a.dispatchEvent(event); // 触发a的单击事件 + }; + image.src = imgsrc; + btf.snackbarShow('图片已添加盲水印,请遵守版权协议'); + rm.downloadimging = false; + }, "10000"); + } else { + btf.snackbarShow('有正在进行中的下载,请稍后再试'); + } + }, - //更改主题色 - changeThemeColor: function (color) { - if (document.querySelector('meta[name="theme-color"]') !== null) { - document.querySelector('meta[name="theme-color"]').setAttribute('content', color) - } - }, + //控制评论弹幕 + switchCommentBarrage: function() { + let commentBarrage = document.querySelector('.comment-barrage'); + if (commentBarrage) { + if ($(".comment-barrage").is(":visible")) { + $(".comment-barrage").hide(); + $(".menu-commentBarrage-text").text("显示热评"); + document.querySelector("#consoleCommentBarrage").classList.remove("on"); + localStorage.setItem('commentBarrageSwitch', 'false'); + btf.snackbarShow("✨ 已关闭评论弹幕", false, 2000) + } else if ($(".comment-barrage").is(":hidden")) { + $(".comment-barrage").show(); + $(".menu-commentBarrage-text").text("关闭热评"); + document.querySelector("#consoleCommentBarrage").classList.add("on"); + localStorage.removeItem('commentBarrageSwitch'); + btf.snackbarShow("✨ 已开启评论弹幕", false, 2000) + } + } + if (GLOBAL_CONFIG.rightMenuEnable) { + rm.hideRightMenu(); + } + }, - //自适应主题色 - initThemeColor: function () { - if (heo.is_Post()) { - const currentTop = window.scrollY || document.documentElement.scrollTop - if (currentTop === 0) { - let themeColor = getComputedStyle(document.documentElement).getPropertyValue('--heo-main'); - heo.changeThemeColor(themeColor); - } else { - let themeColor = getComputedStyle(document.documentElement).getPropertyValue('--heo-background'); - heo.changeThemeColor(themeColor); - } - } else { - let themeColor = getComputedStyle(document.documentElement).getPropertyValue('--heo-background'); - heo.changeThemeColor(themeColor); - } - }, + //隐藏cookie窗口 + hidecookie: function() { + heo_cookiesTime = setTimeout((() => { + document.getElementById("cookies-window").classList.add("cw-hide"), + setTimeout((() => { + $("#cookies-window").hide() + }), 1e3) + }), 3e3) + }, - //跳转到指定位置 - jumpTo: function (dom) { - $(document).ready(function () { - $("html,body").animate({ - scrollTop: $(dom).eq(i).offset().top - }, 500 /*scroll实现定位滚动*/); /*让整个页面可以滚动*/ - }); - }, + //隐藏今日推荐 + hideTodayCard: function() { + if (document.getElementById("todayCard")) { + document.getElementById("todayCard").classList.add('hide'); + } + }, - //显示加载动画 - showLoading: function () { - document.querySelector("#loading-box").classList.remove("loaded"); - let cardColor = getComputedStyle(document.documentElement).getPropertyValue('--heo-card-bg'); - heo.changeThemeColor(cardColor); - }, + //更改主题色 + changeThemeColor: function(color) { + if (document.querySelector('meta[name="theme-color"]') !== null) { + document.querySelector('meta[name="theme-color"]').setAttribute('content', color) + } + }, - //隐藏加载动画 - hideLoading: function () { - document.querySelector("#loading-box").classList.add("loaded"); - }, + //自适应主题色 + initThemeColor: function() { + if (heo.is_Post()) { + const currentTop = window.scrollY || document.documentElement.scrollTop + if (currentTop === 0) { + let themeColor = getComputedStyle(document.documentElement).getPropertyValue('--heo-main'); + heo.changeThemeColor(themeColor); + } else { + let themeColor = getComputedStyle(document.documentElement).getPropertyValue( + '--heo-background'); + heo.changeThemeColor(themeColor); + } + } else { + let themeColor = getComputedStyle(document.documentElement).getPropertyValue('--heo-background'); + heo.changeThemeColor(themeColor); + } + }, - //切换音乐播放状态 - musicToggle: function (changePaly = true) { - const navMusicEl = document.getElementById("nav-music"); - if (!heo_musicFirst) { - heo.musicBindEvent(); - heo_musicFirst = true; - } - let msgPlay = '播放音乐'; - let msgPause = '暂停音乐'; - if (heo_musicPlaying) { - navMusicEl.classList.remove("playing"); - if(GLOBAL_CONFIG.rightMenuEnable){ - document.getElementById("menu-music-toggle").innerHTML = msgPlay; - } - document.getElementById("nav-music-hoverTips").innerHTML = "音乐已暂停"; - document.querySelector("#consoleMusic").classList.remove("on"); - heo_musicPlaying = false; - navMusicEl.classList.remove("stretch"); - } else { - navMusicEl.classList.add("playing"); - if(GLOBAL_CONFIG.rightMenuEnable){ - document.getElementById("menu-music-toggle").innerHTML = msgPause; - } - document.querySelector("#consoleMusic").classList.add("on"); - heo_musicPlaying = true; - navMusicEl.classList.add("stretch"); - } - if (changePaly) document.querySelector("#nav-music meting-js").aplayer.toggle(); - if(GLOBAL_CONFIG.rightMenuEnable){ - rm.hideRightMenu(); - } - }, + //跳转到指定位置 + jumpTo: function(dom) { + $(document).ready(function() { + $("html,body").animate({ + scrollTop: $(dom).eq(i).offset().top + }, 500 /*scroll实现定位滚动*/ ); /*让整个页面可以滚动*/ + }); + }, - // 音乐绑定事件 - musicBindEvent: function () { - document.querySelector("#nav-music .aplayer-music").addEventListener("click", function () { - heo.musicTelescopic(); - }); - document.querySelector("#nav-music .aplayer-button").addEventListener("click", function () { - heo.musicToggle(false); - }); - }, + //显示加载动画 + showLoading: function() { + document.querySelector("#loading-box").classList.remove("loaded"); + let cardColor = getComputedStyle(document.documentElement).getPropertyValue('--heo-card-bg'); + heo.changeThemeColor(cardColor); + }, - // 音乐伸缩 - musicTelescopic: function () { - const navMusicEl = document.getElementById("nav-music"); - if (navMusicEl.classList.contains("stretch")) { - navMusicEl.classList.remove("stretch"); - } else { - navMusicEl.classList.add("stretch"); - } - }, + //隐藏加载动画 + hideLoading: function() { + document.querySelector("#loading-box").classList.add("loaded"); + }, - //音乐上一曲 - musicSkipBack: function () { - document.querySelector("meting-js").aplayer.skipBack(), - rm.hideRightMenu() - }, + //切换音乐播放状态 + musicToggle: function(changePaly = true) { + const navMusicEl = document.getElementById("nav-music"); + if (!heo_musicFirst) { + heo.musicBindEvent(); + heo_musicFirst = true; + } + let msgPlay = '播放音乐'; + let msgPause = '暂停音乐'; + if (heo_musicPlaying) { + navMusicEl.classList.remove("playing"); + if (GLOBAL_CONFIG.rightMenuEnable) { + document.getElementById("menu-music-toggle").innerHTML = msgPlay; + } + document.getElementById("nav-music-hoverTips").innerHTML = "音乐已暂停"; + document.querySelector("#consoleMusic").classList.remove("on"); + heo_musicPlaying = false; + navMusicEl.classList.remove("stretch"); + } else { + navMusicEl.classList.add("playing"); + if (GLOBAL_CONFIG.rightMenuEnable) { + document.getElementById("menu-music-toggle").innerHTML = msgPause; + } + document.querySelector("#consoleMusic").classList.add("on"); + heo_musicPlaying = true; + navMusicEl.classList.add("stretch"); + } + if (changePaly) document.querySelector("#nav-music meting-js").aplayer.toggle(); + if (GLOBAL_CONFIG.rightMenuEnable) { + rm.hideRightMenu(); + } + }, - //音乐下一曲 - musicSkipForward: function () { - document.querySelector("meting-js").aplayer.skipForward(), - rm.hideRightMenu() - }, + // 音乐绑定事件 + musicBindEvent: function() { + document.querySelector("#nav-music .aplayer-music").addEventListener("click", function() { + heo.musicTelescopic(); + }); + document.querySelector("#nav-music .aplayer-button").addEventListener("click", function() { + heo.musicToggle(false); + }); + }, - //获取音乐中的名称 - musicGetName: function () { - for (var e = $(".aplayer-title"), t = [], o = e.length - 1; o >= 0; o--) - t[o] = e[o].innerText; - return t[0] - }, + // 音乐伸缩 + musicTelescopic: function() { + const navMusicEl = document.getElementById("nav-music"); + if (navMusicEl.classList.contains("stretch")) { + navMusicEl.classList.remove("stretch"); + } else { + navMusicEl.classList.add("stretch"); + } + }, + + //音乐上一曲 + musicSkipBack: function() { + document.querySelector("meting-js").aplayer.skipBack(), + rm.hideRightMenu() + }, + + //音乐下一曲 + musicSkipForward: function() { + document.querySelector("meting-js").aplayer.skipForward(), + rm.hideRightMenu() + }, + + //获取音乐中的名称 + musicGetName: function() { + for (var e = $(".aplayer-title"), t = [], o = e.length - 1; o >= 0; o--) + t[o] = e[o].innerText; + return t[0] + }, - // 显示打赏中控台 - rewardShowConsole: function () { - $('.console-card-group-reward').attr('style', 'display: flex'); - $('.console-card-group').attr('style', 'display: none'); - document.querySelector("#console").classList.add("show"); - heo.initConsoleState() + // 显示打赏中控台 + rewardShowConsole: function() { + $('.console-card-group-reward').attr('style', 'display: flex'); + $('.console-card-group').attr('style', 'display: none'); + document.querySelector("#console").classList.add("show"); + heo.initConsoleState() + }, - }, + //显示中控台 + showConsole: function() { + $('.console-card-group-reward').attr('style', 'display: none'); + $('.console-card-group').attr('style', 'display: flex'); + document.querySelector("#console").classList.add("show"); + }, - //显示中控台 - showConsole: function () { - $('.console-card-group-reward').attr('style', 'display: none'); - $('.console-card-group').attr('style', 'display: flex'); - document.querySelector("#console").classList.add("show"); + //隐藏中控台 + hideConsole: function() { + document.querySelector("#console").classList.remove("show"); + }, + + //快捷键功能开关 + keyboardToggle: function() { + if (heo_keyboard) { + heo_keyboard = false; + document.querySelector("#consoleKeyboard").classList.remove("on"); + localStorage.setItem('keyboardToggle', 'false'); + } else { + heo_keyboard = true; + document.querySelector("#consoleKeyboard").classList.add("on"); + localStorage.setItem('keyboardToggle', 'true'); + } + }, + + //滚动到指定id + scrollTo: function(e) { + const t = document.getElementById(e); + if (t) { + const e = t.getBoundingClientRect().top + window.pageYOffset - 80, + o = window.pageYOffset, + n = e - o; + let a = null; + window.requestAnimationFrame((function e(t) { + a || (a = t); + const l = t - a, + i = (c = Math.min(l / 0, 1)) < .5 ? 2 * c * c : (4 - 2 * c) * c - 1; + var c; + window.scrollTo(0, o + n * i), + l < 600 && window.requestAnimationFrame(e) + })) + } + }, + + //隐藏侧边栏 + hideAsideBtn: () => { // Hide aside + const $htmlDom = document.documentElement.classList + $htmlDom.contains('hide-aside') ? + saveToLocal.set('aside-status', 'show', 2) : + saveToLocal.set('aside-status', 'hide', 2) + $htmlDom.toggle('hide-aside') + $htmlDom.contains("hide-aside") ? document.querySelector("#consoleHideAside").classList.add("on") : + document.querySelector("#consoleHideAside").classList.remove("on") + }, + toPage: function() { + var e = document.querySelectorAll(".page-number"), + t = parseInt(e[e.length - 1].innerHTML), + o = document.getElementById("toPageText"), + n = parseInt(o.value); + if (!isNaN(n) && n > 0 && "0" !== ("" + n)[0] && n <= t) { + var url = window.location.href; + + var photosIndexOf = url.indexOf("?group") >= 0 ? url.indexOf("?group") : -1; + if (photosIndexOf >= 0) { //图库页面 + var new_url = url.substr(0, photosIndexOf); + var group = url.substr(photosIndexOf) + var a, l = new_url.replace(/\/page\/\d$/, ""); + a = 1 === n ? l : l + (l.endsWith("/") ? "" : "/") + "page/" + n, + document.getElementById("toPageButton").href = a + group + } else { + var a, l = url.replace(/\/page\/\d$/, ""); + a = 1 === n ? l : l + (l.endsWith("/") ? "" : "/") + "page/" + n, + document.getElementById("toPageButton").href = a + } + //首页有第一屏就跳转指定位置 + scrollToPost(); + + } + }, + changeSayHelloText: function() { + const greetings = GLOBAL_CONFIG.helloText.length == 0 ? ["🤖️ 数码科技爱好者", "🔍 分享与热心帮助", "🏠 智能家居小能手", + "🔨 设计开发一条龙", "🤝 专修交互与设计", "🏃 脚踏实地行动派", "🧱 团队小组发动机", "💢 壮汉人狠话不多" + ] : GLOBAL_CONFIG.helloText, + authorInfoSayHiElement = document.getElementById("author-info__sayhi"); + // 如果只有一个问候语,设置为默认值 + if (greetings.length === 1) { + authorInfoSayHiElement.textContent = greetings[0]; + return; + } + let randomGreeting = greetings[Math.floor(Math.random() * greetings.length)]; + for (; randomGreeting === lastSayHello;) + randomGreeting = greetings[Math.floor(Math.random() * greetings.length)]; + authorInfoSayHiElement.textContent = randomGreeting, + lastSayHello = randomGreeting + }, + + //匿名评论 + addRandomCommentInfo: function() { + // 从形容词数组中随机取一个值 + const randomAdjective = adjectives[Math.floor(Math.random() * adjectives.length)]; + + // 从蔬菜水果动物名字数组中随机取一个值 + const randomName = vegetablesAndFruits[Math.floor(Math.random() * vegetablesAndFruits.length)]; + + // 将两个值组合成一个字符串 + const name = `${randomAdjective}${randomName}`; + + function dr_js_autofill_commentinfos() { + var lauthor = [ + "#author", + "input[name='comname']", + "#inpName", + "input[name='author']", + "#ds-dialog-name", + "#name", + "input[name='nick']", + "#comment_author", + ], + lmail = [ + "#mail", + "#email", + "input[name='commail']", + "#inpEmail", + "input[name='email']", + "#ds-dialog-email", + "input[name='mail']", + "#comment_email", + ], + lurl = [ + "#url", + "input[name='comurl']", + "#inpHomePage", + "#ds-dialog-url", + "input[name='url']", + "input[name='website']", + "#website", + "input[name='link']", + "#comment_url", + ]; + for (var i = 0; i < lauthor.length; i++) { + var author = document.querySelector(lauthor[i]); + if (author != null) { + author.value = name; + author.dispatchEvent(new Event("input")); + author.dispatchEvent(new Event("change")); + break; + } + } + for (var j = 0; j < lmail.length; j++) { + var mail = document.querySelector(lmail[j]); + if (mail != null) { + mail.value = visitorMail; + mail.dispatchEvent(new Event("input")); + mail.dispatchEvent(new Event("change")); + break; + } + } + return !1; + } + dr_js_autofill_commentinfos(); + var input = document.getElementsByClassName(GLOBAL_CONFIG.source.comments.textarea)[0]; + input.focus(); + input.setSelectionRange(-1, -1); + }, + + //爱发电赞助 + addPowerLinksInPostRightSide: async function() { + const image = document.getElementById("power-star-image"), + star = document.getElementById("power-star"), + title = document.getElementById("power-star-title"), + desc = document.getElementById("power-star-desc"); + if (image && star && title && desc) + try { + const list = GLOBAL_CONFIG.source.power.list, + i = heo.getRandomInt(0, list.length), + power = list[i].realNode; + image.style.backgroundImage = `url(${power.avatar})`, + star.href = power.link, + title.innerText = power.name, + desc.innerText = power.descr + } catch (e) {} + }, + getRandomInt: function(e, t) { + return Math.floor(Math.random() * (t - e)) + e + }, + + //初始化console图标 + initConsoleState: function() { + document.documentElement.classList.contains("hide-aside") ? document.querySelector("#consoleHideAside") + .classList.add("on") : document.querySelector("#consoleHideAside").classList.remove("on") + }, - }, + // 音乐节目切换背景 + changeMusicBg: function(isChangeBg = true) { + if (window.location.pathname != "/music") { + return; + } + const anMusicBg = document.getElementById("an_music_bg"); - //隐藏中控台 - hideConsole: function () { - document.querySelector("#console").classList.remove("show"); - }, + if (isChangeBg) { + // player listswitch 会进入此处 + const musiccover = document.querySelector("#anMusic-page .aplayer-pic"); + anMusicBg.style.backgroundImage = musiccover.style.backgroundImage; + } else { + // 第一次进入,绑定事件,改背景 + let timer = setInterval(() => { + const musiccover = document.querySelector("#anMusic-page .aplayer-pic"); + // 确保player加载完成 + if (musiccover) { + clearInterval(timer); + anMusicBg.style.backgroundImage = musiccover.style.backgroundImage; + // 绑定事件 + heo.addEventListenerChangeMusicBg(); - //快捷键功能开关 - keyboardToggle: function () { - if (heo_keyboard) { - heo_keyboard = false; - document.querySelector("#consoleKeyboard").classList.remove("on"); - localStorage.setItem('keyboardToggle', 'false'); - } else { - heo_keyboard = true; - document.querySelector("#consoleKeyboard").classList.add("on"); - localStorage.setItem('keyboardToggle', 'true'); - } - }, + // 暂停nav的音乐 + if (GLOBAL_CONFIG.navMusicEnable) { + if ( + document.querySelector("#nav-music meting-js").aplayer && + !document.querySelector("#nav-music meting-js").aplayer.audio.paused + ) { + heo.musicToggle(); + } + } + } + }, 100); + } + }, + addEventListenerChangeMusicBg: function() { + const anMusicPage = document.getElementById("anMusic-page"); + const aplayerIconMenu = anMusicPage.querySelector(".aplayer-info .aplayer-time .aplayer-icon-menu"); - //滚动到指定id - scrollTo: function(e) { - const t = document.getElementById(e); - if (t) { - const e = t.getBoundingClientRect().top + window.pageYOffset - 80 - , o = window.pageYOffset - , n = e - o; - let a = null; - window.requestAnimationFrame((function e(t) { - a || (a = t); - const l = t - a - , i = (c = Math.min(l / 0, 1)) < .5 ? 2 * c * c : (4 - 2 * c) * c - 1; - var c; - window.scrollTo(0, o + n * i), - l < 600 && window.requestAnimationFrame(e) - } - )) - } - }, + anMusicPage.querySelector("meting-js").aplayer.on("loadeddata", function() { + heo.changeMusicBg(); + console.info("player loadeddata"); + }); - //隐藏侧边栏 - hideAsideBtn: () => { // Hide aside - const $htmlDom = document.documentElement.classList - $htmlDom.contains('hide-aside') - ? saveToLocal.set('aside-status', 'show', 2) - : saveToLocal.set('aside-status', 'hide', 2) - $htmlDom.toggle('hide-aside') - $htmlDom.contains("hide-aside") ? document.querySelector("#consoleHideAside").classList.add("on") : document.querySelector("#consoleHideAside").classList.remove("on") - }, - toPage: function() { - var e = document.querySelectorAll(".page-number") - , t = parseInt(e[e.length - 1].innerHTML) - , o = document.getElementById("toPageText") - , n = parseInt(o.value); - if (!isNaN(n) && n > 0 && "0" !== ("" + n)[0] && n <= t) { - var url = window.location.href; - - var photosIndexOf = url.indexOf("?group") >= 0 ? url.indexOf("?group") : -1; - if (photosIndexOf >= 0) {//图库页面 - var new_url = url.substr(0,photosIndexOf); - var group = url.substr(photosIndexOf) - var a, l = new_url.replace(/\/page\/\d$/, ""); - a = 1 === n ? l : l + (l.endsWith("/") ? "" : "/") + "page/" + n, - document.getElementById("toPageButton").href = a + group - }else{ - var a, l = url.replace(/\/page\/\d$/, ""); - a = 1 === n ? l : l + (l.endsWith("/") ? "" : "/") + "page/" + n, - document.getElementById("toPageButton").href = a - } - //首页有第一屏就跳转指定位置 - scrollToPost(); - - } - }, - changeSayHelloText: function() { - const greetings = GLOBAL_CONFIG.helloText.length == 0 ? ["🤖️ 数码科技爱好者", "🔍 分享与热心帮助", "🏠 智能家居小能手", "🔨 设计开发一条龙", "🤝 专修交互与设计", "🏃 脚踏实地行动派", "🧱 团队小组发动机", "💢 壮汉人狠话不多"] : GLOBAL_CONFIG.helloText - , authorInfoSayHiElement = document.getElementById("author-info__sayhi"); - // 如果只有一个问候语,设置为默认值 - if (greetings.length === 1) { - authorInfoSayHiElement.textContent = greetings[0]; - return; - } - let randomGreeting = greetings[Math.floor(Math.random() * greetings.length)]; - for (; randomGreeting === lastSayHello; ) - randomGreeting = greetings[Math.floor(Math.random() * greetings.length)]; - authorInfoSayHiElement.textContent = randomGreeting, - lastSayHello = randomGreeting - }, - - //匿名评论 - addRandomCommentInfo: function () { - // 从形容词数组中随机取一个值 - const randomAdjective = adjectives[Math.floor(Math.random() * adjectives.length)]; - - // 从蔬菜水果动物名字数组中随机取一个值 - const randomName = vegetablesAndFruits[Math.floor(Math.random() * vegetablesAndFruits.length)]; - - // 将两个值组合成一个字符串 - const name = `${randomAdjective}${randomName}`; - - function dr_js_autofill_commentinfos() { - var lauthor = [ - "#author", - "input[name='comname']", - "#inpName", - "input[name='author']", - "#ds-dialog-name", - "#name", - "input[name='nick']", - "#comment_author", - ], - lmail = [ - "#mail", - "#email", - "input[name='commail']", - "#inpEmail", - "input[name='email']", - "#ds-dialog-email", - "input[name='mail']", - "#comment_email", - ], - lurl = [ - "#url", - "input[name='comurl']", - "#inpHomePage", - "#ds-dialog-url", - "input[name='url']", - "input[name='website']", - "#website", - "input[name='link']", - "#comment_url", - ]; - for (var i = 0; i < lauthor.length; i++) { - var author = document.querySelector(lauthor[i]); - if (author != null) { - author.value = name; - author.dispatchEvent(new Event("input")); - author.dispatchEvent(new Event("change")); - break; - } - } - for (var j = 0; j < lmail.length; j++) { - var mail = document.querySelector(lmail[j]); - if (mail != null) { - mail.value = visitorMail; - mail.dispatchEvent(new Event("input")); - mail.dispatchEvent(new Event("change")); - break; - } - } - return !1; - } - dr_js_autofill_commentinfos(); - var input = document.getElementsByClassName(GLOBAL_CONFIG.source.comments.textarea)[0]; - input.focus(); - input.setSelectionRange(-1, -1); - }, - - //爱发电赞助 - addPowerLinksInPostRightSide: async function() { - const image = document.getElementById("power-star-image") - , star = document.getElementById("power-star") - , title = document.getElementById("power-star-title") - , desc = document.getElementById("power-star-desc"); - if (image && star && title && desc) - try { - const list = GLOBAL_CONFIG.source.power.list - , i = heo.getRandomInt(0, list.length) - , power = list[i].realNode; - image.style.backgroundImage = `url(${power.avatar})`, - star.href = power.link, - title.innerText = power.name, - desc.innerText = power.descr - } catch (e) {} - }, - getRandomInt: function(e, t) { - return Math.floor(Math.random() * (t - e)) + e - }, - - //初始化console图标 - initConsoleState: function() { - document.documentElement.classList.contains("hide-aside") ? document.querySelector("#consoleHideAside").classList.add("on") : document.querySelector("#consoleHideAside").classList.remove("on") - }, - - - // 音乐节目切换背景 - changeMusicBg: function (isChangeBg = true) { - if (window.location.pathname != "/music") { - return; - } - const anMusicBg = document.getElementById("an_music_bg"); - - if (isChangeBg) { - // player listswitch 会进入此处 - const musiccover = document.querySelector("#anMusic-page .aplayer-pic"); - anMusicBg.style.backgroundImage = musiccover.style.backgroundImage; - } else { - // 第一次进入,绑定事件,改背景 - let timer = setInterval(() => { - const musiccover = document.querySelector("#anMusic-page .aplayer-pic"); - // 确保player加载完成 - if (musiccover) { - clearInterval(timer); - anMusicBg.style.backgroundImage = musiccover.style.backgroundImage; - // 绑定事件 - heo.addEventListenerChangeMusicBg(); - - // 暂停nav的音乐 - if(GLOBAL_CONFIG.navMusicEnable){ - if ( - document.querySelector("#nav-music meting-js").aplayer && - !document.querySelector("#nav-music meting-js").aplayer.audio.paused - ) { - heo.musicToggle(); - } - } - } - }, 100); - } - }, - addEventListenerChangeMusicBg: function () { - const anMusicPage = document.getElementById("anMusic-page"); - const aplayerIconMenu = anMusicPage.querySelector(".aplayer-info .aplayer-time .aplayer-icon-menu"); - - anMusicPage.querySelector("meting-js").aplayer.on("loadeddata", function () { - heo.changeMusicBg(); - console.info("player loadeddata"); - }); - - aplayerIconMenu.addEventListener("click", function () { - $(".music-mask").css("display","block") - $(".music-mask").css("animation","0.5s ease 0s 1 normal none running to_show") - }); - $(".music-mask").click(function(){ - anMusicPage.querySelector(".aplayer-list").classList.remove("aplayer-list-hide"); - $(".music-mask").hide(); - }) - }, + aplayerIconMenu.addEventListener("click", function() { + $(".music-mask").css("display", "block") + $(".music-mask").css("animation", "0.5s ease 0s 1 normal none running to_show") + }); + $(".music-mask").click(function() { + anMusicPage.querySelector(".aplayer-list").classList.remove("aplayer-list-hide"); + $(".music-mask").hide(); + }) + }, }; -const adjectives = ["美丽的", "英俊的", "聪明的", "勇敢的", "可爱的", "慷慨的", "善良的", "可靠的", "开朗的", "成熟的", "稳重的", "真诚的", "幽默的", "豁达的", "有趣的", "活泼的", "优雅的", "敏捷的", "温柔的", "温暖的", "敬业的", "细心的", "耐心的", "深沉的", "朴素的", "含蓄的", "率直的", "开放的", "务实的", "坚强的", "自信的", "谦虚的", "文静的", "深刻的", "纯真的", "朝气蓬勃的", "慎重的", "大方的", "顽强的", "迷人的", "机智的", "善解人意的", "富有想象力的", "有魅力的", "独立的", "好奇的", "干净的", "宽容的", "尊重他人的", "体贴的", "守信的", "有耐性的", "有责任心的", "有担当的", "有远见的", "有智慧的", "有眼光的", "有冒险精神的", "有爱心的", "有同情心的", "喜欢思考的", "喜欢学习的", "具有批判性思维的", "善于表达的", "善于沟通的", "善于合作的", "善于领导的", "有激情的", "有幽默感的", "有思想的", "有个性的", "有正义感的", "有责任感的", "有创造力的", "有想象力的", "有艺术细胞的", "有团队精神的", "有协调能力的", "有决策能力的", "有组织能力的", "有学习能力的", "有执行能力的", "有分析能力的", "有逻辑思维的", "有创新能力的", "有专业素养的", "有商业头脑的"] - , vegetablesAndFruits = ["萝卜", "白菜", "芹菜", "生菜", "青椒", "辣椒", "茄子", "豆角", "黄瓜", "西红柿", "洋葱", "大蒜", "土豆", "南瓜", "豆腐", "韭菜", "花菜", "西兰花", "蘑菇", "金针菇", "苹果", "香蕉", "橙子", "柠檬", "猕猴桃", "草莓", "葡萄", "桃子", "杏子", "李子", "石榴", "西瓜", "哈密瓜", "蜜瓜", "樱桃", "蓝莓", "柿子", "橄榄", "柚子", "火龙果"]; +const adjectives = ["美丽的", "英俊的", "聪明的", "勇敢的", "可爱的", "慷慨的", "善良的", "可靠的", "开朗的", "成熟的", "稳重的", "真诚的", "幽默的", "豁达的", + "有趣的", "活泼的", "优雅的", "敏捷的", "温柔的", "温暖的", "敬业的", "细心的", "耐心的", "深沉的", "朴素的", "含蓄的", "率直的", "开放的", "务实的", "坚强的", + "自信的", "谦虚的", "文静的", "深刻的", "纯真的", "朝气蓬勃的", "慎重的", "大方的", "顽强的", "迷人的", "机智的", "善解人意的", "富有想象力的", "有魅力的", "独立的", + "好奇的", "干净的", "宽容的", "尊重他人的", "体贴的", "守信的", "有耐性的", "有责任心的", "有担当的", "有远见的", "有智慧的", "有眼光的", "有冒险精神的", "有爱心的", + "有同情心的", "喜欢思考的", "喜欢学习的", "具有批判性思维的", "善于表达的", "善于沟通的", "善于合作的", "善于领导的", "有激情的", "有幽默感的", "有思想的", "有个性的", + "有正义感的", "有责任感的", "有创造力的", "有想象力的", "有艺术细胞的", "有团队精神的", "有协调能力的", "有决策能力的", "有组织能力的", "有学习能力的", "有执行能力的", + "有分析能力的", "有逻辑思维的", "有创新能力的", "有专业素养的", "有商业头脑的" + ], + vegetablesAndFruits = ["萝卜", "白菜", "芹菜", "生菜", "青椒", "辣椒", "茄子", "豆角", "黄瓜", "西红柿", "洋葱", "大蒜", "土豆", "南瓜", "豆腐", + "韭菜", "花菜", "西兰花", "蘑菇", "金针菇", "苹果", "香蕉", "橙子", "柠檬", "猕猴桃", "草莓", "葡萄", "桃子", "杏子", "李子", "石榴", "西瓜", "哈密瓜", + "蜜瓜", "樱桃", "蓝莓", "柿子", "橄榄", "柚子", "火龙果" + ]; $(document).ready((function() { - initBlog() - } -)), -document.addEventListener("pjax:complete", (function() { - initBlog(); - // 解决 katex pjax问题 - if((GLOBAL_CONFIG.htmlType == 'post' || GLOBAL_CONFIG.htmlType == 'page') && typeof window.renderKaTex != 'undefined'){ - window.renderKaTex(); - } - } -)); \ No newline at end of file + initBlog() + })), + document.addEventListener("pjax:complete", (function() { + initBlog(); + // 解决 katex pjax问题 + if ((GLOBAL_CONFIG.htmlType == 'post' || GLOBAL_CONFIG.htmlType == 'page') && typeof window + .renderKaTex != 'undefined') { + window.renderKaTex(); + } + })); \ No newline at end of file diff --git a/templates/assets/js/utils.js b/templates/assets/js/utils.js index 104eb17..16ba94c 100644 --- a/templates/assets/js/utils.js +++ b/templates/assets/js/utils.js @@ -2,352 +2,358 @@ var btf = { - // 修改时间显示"最近" - diffDateExact: function (d, more = false) { - const dateNow = new Date(); - const datePost = new Date(d); - const dateDiff = dateNow.getTime() - datePost.getTime(); - const minute = 1000 * 60; - const hour = minute * 60; - const day = hour * 24; - const month = day * 30; + // 修改时间显示"最近" + diffDateExact: function(d, more = false) { + const dateNow = new Date(); + const datePost = new Date(d); + const dateDiff = dateNow.getTime() - datePost.getTime(); + const minute = 1000 * 60; + const hour = minute * 60; + const day = hour * 24; + const month = day * 30; - let result; - if (more) { - const monthCount = dateDiff / month; - const dayCount = dateDiff / day; - const hourCount = dateDiff / hour; - const minuteCount = dateDiff / minute; + let result; + if (more) { + const monthCount = dateDiff / month; + const dayCount = dateDiff / day; + const hourCount = dateDiff / hour; + const minuteCount = dateDiff / minute; - if (monthCount >= 1) { - result = datePost.toLocaleDateString().replace(/\//g, "-"); - } else if (dayCount >= 1) { - result = parseInt(dayCount) + " " + GLOBAL_CONFIG.date_suffix.day; - } else if (hourCount >= 1) { - result = parseInt(hourCount) + " " + GLOBAL_CONFIG.date_suffix.hour; - } else if (minuteCount >= 1) { - result = parseInt(minuteCount) + " " + GLOBAL_CONFIG.date_suffix.min; - } else { - result = GLOBAL_CONFIG.date_suffix.just; - } - } else { - result = parseInt(dateDiff / day); - } - return result; - }, + if (monthCount >= 1) { + result = datePost.toLocaleDateString().replace(/\//g, "-"); + } else if (dayCount >= 1) { + result = parseInt(dayCount) + " " + GLOBAL_CONFIG.date_suffix.day; + } else if (hourCount >= 1) { + result = parseInt(hourCount) + " " + GLOBAL_CONFIG.date_suffix.hour; + } else if (minuteCount >= 1) { + result = parseInt(minuteCount) + " " + GLOBAL_CONFIG.date_suffix.min; + } else { + result = GLOBAL_CONFIG.date_suffix.just; + } + } else { + result = parseInt(dateDiff / day); + } + return result; + }, - loadLightbox: ele => { + loadLightbox: ele => { - const jqLoadAndRun = () => { - const $fancyboxEle = GLOBAL_CONFIG.lightbox === 'fancybox' - ? ele - : [] - const fbLengthNoZero = $fancyboxEle.length > 0 + const jqLoadAndRun = () => { + const $fancyboxEle = GLOBAL_CONFIG.lightbox === 'fancybox' ? + ele : + [] + const fbLengthNoZero = $fancyboxEle.length > 0 - if (fbLengthNoZero) { - btf.isJqueryLoad(() => { - fbLengthNoZero && addFancybox($fancyboxEle) - }) - } - } + if (fbLengthNoZero) { + btf.isJqueryLoad(() => { + fbLengthNoZero && addFancybox($fancyboxEle) + }) + } + } - /** - * fancybox - */ - const addFancybox = function (ele) { - const runFancybox = (ele) => { - ele.each(function (i, o) { - const $this = $(o) - const lazyloadSrc = $this.attr('data-lazy-src') || $this.attr('src') - const dataCaption = $this.attr('alt') || '' - $this.wrap(``) - }) + /** + * fancybox + */ + const addFancybox = function(ele) { + const runFancybox = (ele) => { + ele.each(function(i, o) { + const $this = $(o) + const lazyloadSrc = $this.attr('data-lazy-src') || $this.attr('src') + const dataCaption = $this.attr('alt') || '' + $this.wrap( + `` + ) + }) - $().fancybox({ - selector: '[data-fancybox]', - loop: true, - transitionEffect: 'slide', - protect: true, - buttons: ['slideShow', 'fullScreen', 'thumbs', 'close'], - hash: false - }) - } + $().fancybox({ + selector: '[data-fancybox]', + loop: true, + transitionEffect: 'slide', + protect: true, + buttons: ['slideShow', 'fullScreen', 'thumbs', 'close'], + hash: false + }) + } - if (typeof $.fancybox === 'undefined') { - // $('head').append(``) - $.getScript(`${GLOBAL_CONFIG.source.fancybox.js}`, function () { - runFancybox($(ele)) - }) - } else { - runFancybox($(ele)) - } - } + if (typeof $.fancybox === 'undefined') { + // $('head').append(``) + $.getScript(`${GLOBAL_CONFIG.source.fancybox.js}`, function() { + runFancybox($(ele)) + }) + } else { + runFancybox($(ele)) + } + } - jqLoadAndRun() + jqLoadAndRun() - }, - debounce: function (func, wait, immediate) { - let timeout - return function () { - const context = this - const args = arguments - const later = function () { - timeout = null - if (!immediate) func.apply(context, args) - } - const callNow = immediate && !timeout - clearTimeout(timeout) - timeout = setTimeout(later, wait) - if (callNow) func.apply(context, args) - } - }, + }, + debounce: function(func, wait, immediate) { + let timeout + return function() { + const context = this + const args = arguments + const later = function() { + timeout = null + if (!immediate) func.apply(context, args) + } + const callNow = immediate && !timeout + clearTimeout(timeout) + timeout = setTimeout(later, wait) + if (callNow) func.apply(context, args) + } + }, - throttle: function (func, wait, options) { - let timeout, context, args - let previous = 0 - if (!options) options = {} + throttle: function(func, wait, options) { + let timeout, context, args + let previous = 0 + if (!options) options = {} - const later = function () { - previous = options.leading === false ? 0 : new Date().getTime() - timeout = null - func.apply(context, args) - if (!timeout) context = args = null - } + const later = function() { + previous = options.leading === false ? 0 : new Date().getTime() + timeout = null + func.apply(context, args) + if (!timeout) context = args = null + } - const throttled = function () { - const now = new Date().getTime() - if (!previous && options.leading === false) previous = now - const remaining = wait - (now - previous) - context = this - args = arguments - if (remaining <= 0 || remaining > wait) { - if (timeout) { - clearTimeout(timeout) - timeout = null - } - previous = now - func.apply(context, args) - if (!timeout) context = args = null - } else if (!timeout && options.trailing !== false) { - timeout = setTimeout(later, remaining) - } - } + const throttled = function() { + const now = new Date().getTime() + if (!previous && options.leading === false) previous = now + const remaining = wait - (now - previous) + context = this + args = arguments + if (remaining <= 0 || remaining > wait) { + if (timeout) { + clearTimeout(timeout) + timeout = null + } + previous = now + func.apply(context, args) + if (!timeout) context = args = null + } else if (!timeout && options.trailing !== false) { + timeout = setTimeout(later, remaining) + } + } - return throttled - }, + return throttled + }, - sidebarPaddingR: () => { - const innerWidth = window.innerWidth - const clientWidth = document.body.clientWidth - const paddingRight = innerWidth - clientWidth - if (innerWidth !== clientWidth) { - document.body.style.paddingRight = paddingRight + 'px' - } - }, + sidebarPaddingR: () => { + const innerWidth = window.innerWidth + const clientWidth = document.body.clientWidth + const paddingRight = innerWidth - clientWidth + if (innerWidth !== clientWidth) { + document.body.style.paddingRight = paddingRight + 'px' + } + }, - snackbarShow: (text, showActionFunction = false, duration = 2000, actionText = false) => { - const { position, bgLight, bgDark } = GLOBAL_CONFIG.Snackbar; - const bg = document.documentElement.getAttribute("data-theme") === "light" ? bgLight : bgDark; - const root = document.querySelector(":root"); - root.style.setProperty("--heo-snackbar-time", duration + "ms"); + snackbarShow: (text, showActionFunction = false, duration = 2000, actionText = false) => { + const { + position, + bgLight, + bgDark + } = GLOBAL_CONFIG.Snackbar; + const bg = document.documentElement.getAttribute("data-theme") === "light" ? bgLight : bgDark; + const root = document.querySelector(":root"); + root.style.setProperty("--heo-snackbar-time", duration + "ms"); - Snackbar.show({ - text: text, - backgroundColor: bg, - onActionClick: showActionFunction, - actionText: actionText, - showAction: actionText, - duration: duration, - pos: position, - customClass: "snackbar-css", - }); - }, + Snackbar.show({ + text: text, + backgroundColor: bg, + onActionClick: showActionFunction, + actionText: actionText, + showAction: actionText, + duration: duration, + pos: position, + customClass: "snackbar-css", + }); + }, - initJustifiedGallerys: function (selector) { - selector.forEach((function(t) { - btf.isHidden(t) || fjGallery(t, { - itemSelector: ".fj-gallery-item", - rowHeight: 240, - gutter: 4, - onJustify: function() { - this.$container.style.opacity = "1" - } - }) - } - )) - document.querySelectorAll('#article-container .loadings')[0]?.classList.remove("loadings"); - }, + initJustifiedGallerys: function(selector) { + selector.forEach((function(t) { + btf.isHidden(t) || fjGallery(t, { + itemSelector: ".fj-gallery-item", + rowHeight: 240, + gutter: 4, + onJustify: function() { + this.$container.style.opacity = "1" + } + }) + })) + document.querySelectorAll('#article-container .loadings')[0]?.classList.remove("loadings"); + }, - diffDate: (d, more = false) => { - const dateNow = new Date() - const datePost = new Date(d) - const dateDiff = dateNow.getTime() - datePost.getTime() - const minute = 1000 * 60 - const hour = minute * 60 - const day = hour * 24 - const month = day * 30 + diffDate: (d, more = false) => { + const dateNow = new Date() + const datePost = new Date(d) + const dateDiff = dateNow.getTime() - datePost.getTime() + const minute = 1000 * 60 + const hour = minute * 60 + const day = hour * 24 + const month = day * 30 - let result - if (more) { - const monthCount = dateDiff / month - const dayCount = dateDiff / day - const hourCount = dateDiff / hour - const minuteCount = dateDiff / minute + let result + if (more) { + const monthCount = dateDiff / month + const dayCount = dateDiff / day + const hourCount = dateDiff / hour + const minuteCount = dateDiff / minute - if (monthCount > 12) { - // result = datePost.toLocaleDateString().replace(/\//g, '-') - result = datePost.toLocaleDateString() - } else if (dayCount >= 7) { - // } else if (monthCount >= 1) { - result = datePost.toLocaleDateString().substr(5) - // result = parseInt(monthCount) + ' ' + GLOBAL_CONFIG.date_suffix.month - } else if (dayCount >= 1) { - result = parseInt(dayCount) + '' + GLOBAL_CONFIG.date_suffix.day - } else if (hourCount >= 1) { - // result = '最近' - result = parseInt(hourCount) + ' ' + GLOBAL_CONFIG.date_suffix.hour - } else if (minuteCount >= 1) { - // result = '最近' - result = parseInt(minuteCount) + ' ' + GLOBAL_CONFIG.date_suffix.min - } else { - result = GLOBAL_CONFIG.date_suffix.just - } - } else { - result = parseInt(dateDiff / day) - } - return result - }, + if (monthCount > 12) { + // result = datePost.toLocaleDateString().replace(/\//g, '-') + result = datePost.toLocaleDateString() + } else if (dayCount >= 7) { + // } else if (monthCount >= 1) { + result = datePost.toLocaleDateString().substr(5) + // result = parseInt(monthCount) + ' ' + GLOBAL_CONFIG.date_suffix.month + } else if (dayCount >= 1) { + result = parseInt(dayCount) + '' + GLOBAL_CONFIG.date_suffix.day + } else if (hourCount >= 1) { + // result = '最近' + result = parseInt(hourCount) + ' ' + GLOBAL_CONFIG.date_suffix.hour + } else if (minuteCount >= 1) { + // result = '最近' + result = parseInt(minuteCount) + ' ' + GLOBAL_CONFIG.date_suffix.min + } else { + result = GLOBAL_CONFIG.date_suffix.just + } + } else { + result = parseInt(dateDiff / day) + } + return result + }, - loadComment: (dom, callback) => { - if ('IntersectionObserver' in window) { - const observerItem = new IntersectionObserver((entries) => { - if (entries[0].isIntersecting) { - callback() - observerItem.disconnect() - } - }, {threshold: [0]}) - observerItem.observe(dom) - } else { - callback() - } - }, + loadComment: (dom, callback) => { + if ('IntersectionObserver' in window) { + const observerItem = new IntersectionObserver((entries) => { + if (entries[0].isIntersecting) { + callback() + observerItem.disconnect() + } + }, { + threshold: [0] + }) + observerItem.observe(dom) + } else { + callback() + } + }, - scrollToDest: (e,t)=>{ - if (e < 0 || t < 0) - return; - const n = window.scrollY || window.screenTop; - if (e -= 70, - "CSS"in window && CSS.supports("scroll-behavior", "smooth")) - return void window.scrollTo({ - top: e, - behavior: "smooth" - }); - let o = null; - t = t || 500, - window.requestAnimationFrame((function i(s) { - if (o = o || s, - n < e) { - const r = s - o; - window.scrollTo(0, (e - n) * r / t + n), - r < t ? window.requestAnimationFrame(i) : window.scrollTo(0, e) - } else { - const r = s - o; - window.scrollTo(0, n - (n - e) * r / t), - r < t ? window.requestAnimationFrame(i) : window.scrollTo(0, e) - } - } - )) - }, + scrollToDest: (e, t) => { + if (e < 0 || t < 0) + return; + const n = window.scrollY || window.screenTop; + if (e -= 70, + "CSS" in window && CSS.supports("scroll-behavior", "smooth")) + return void window.scrollTo({ + top: e, + behavior: "smooth" + }); + let o = null; + t = t || 500, + window.requestAnimationFrame((function i(s) { + if (o = o || s, + n < e) { + const r = s - o; + window.scrollTo(0, (e - n) * r / t + n), + r < t ? window.requestAnimationFrame(i) : window.scrollTo(0, e) + } else { + const r = s - o; + window.scrollTo(0, n - (n - e) * r / t), + r < t ? window.requestAnimationFrame(i) : window.scrollTo(0, e) + } + })) + }, - fadeIn: (ele, time) => { - ele.style.cssText = `display:block;animation: to_show ${time}s` - }, + fadeIn: (ele, time) => { + ele.style.cssText = `display:block;animation: to_show ${time}s` + }, - fadeOut: (ele, time) => { - ele.addEventListener('animationend', function f() { - ele.style.cssText = "display: none; animation: '' " - ele.removeEventListener('animationend', f) - }) - ele.style.animation = `to_hide ${time}s` - }, + fadeOut: (ele, time) => { + ele.addEventListener('animationend', function f() { + ele.style.cssText = "display: none; animation: '' " + ele.removeEventListener('animationend', f) + }) + ele.style.animation = `to_hide ${time}s` + }, - getParents: (elem, selector) => { - for (; elem && elem !== document; elem = elem.parentNode) { - if (elem.matches(selector)) return elem - } - return null - }, + getParents: (elem, selector) => { + for (; elem && elem !== document; elem = elem.parentNode) { + if (elem.matches(selector)) return elem + } + return null + }, - siblings: (ele, selector) => { - return [...ele.parentNode.children].filter((child) => { - if (selector) { - return child !== ele && child.matches(selector) - } - return child !== ele - }) - }, + siblings: (ele, selector) => { + return [...ele.parentNode.children].filter((child) => { + if (selector) { + return child !== ele && child.matches(selector) + } + return child !== ele + }) + }, - /** - * - * @param {*} selector - * @param {*} eleType the type of create element - * @param {*} id id - * @param {*} cn class name - */ - wrap: function (selector, eleType, id = '', cn = '') { - const creatEle = document.createElement(eleType) - if (id) creatEle.id = id - if (cn) creatEle.className = cn - selector.parentNode.insertBefore(creatEle, selector) - creatEle.appendChild(selector) - }, + /** + * + * @param {*} selector + * @param {*} eleType the type of create element + * @param {*} id id + * @param {*} cn class name + */ + wrap: function(selector, eleType, id = '', cn = '') { + const creatEle = document.createElement(eleType) + if (id) creatEle.id = id + if (cn) creatEle.className = cn + selector.parentNode.insertBefore(creatEle, selector) + creatEle.appendChild(selector) + }, - unwrap: function (el) { - const elParentNode = el.parentNode - if (elParentNode !== document.body) { - elParentNode.parentNode.insertBefore(el, elParentNode) - elParentNode.parentNode.removeChild(elParentNode) - } - }, + unwrap: function(el) { + const elParentNode = el.parentNode + if (elParentNode !== document.body) { + elParentNode.parentNode.insertBefore(el, elParentNode) + elParentNode.parentNode.removeChild(elParentNode) + } + }, - isJqueryLoad: (fn) => { - if (typeof jQuery === 'undefined') { - getScript(GLOBAL_CONFIG.source.jQuery).then(fn) - } else { - fn() - } - }, + isJqueryLoad: (fn) => { + if (typeof jQuery === 'undefined') { + getScript(GLOBAL_CONFIG.source.jQuery).then(fn) + } else { + fn() + } + }, - isHidden: (ele) => ele.offsetHeight === 0 && ele.offsetWidth === 0, + isHidden: (ele) => ele.offsetHeight === 0 && ele.offsetWidth === 0, - getEleTop: (ele) => { - let actualTop = ele.offsetTop - let current = ele.offsetParent + getEleTop: (ele) => { + let actualTop = ele.offsetTop + let current = ele.offsetParent - while (current !== null) { - actualTop += current.offsetTop - current = current.offsetParent - } + while (current !== null) { + actualTop += current.offsetTop + current = current.offsetParent + } - return actualTop - }, - //过滤标签 - changeContent: (content,length = null)=>{ - if (content === '') return content + return actualTop + }, + //过滤标签 + changeContent: (content, length = null) => { + if (content === '') return content - content = content.replace(/]+>/ig, '[图片]') // replace image link - content = content.replace(/]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi, '[链接]') // replace url - content = content.replace(/
.*?<\/pre>/gi, '[代码]') // replace code
-        content = content.replace(/<[^>]+>/g, "") // remove html tag
+		content = content.replace(/]+>/ig, '[图片]') // replace image link
+		content = content.replace(/]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi, '[链接]') // replace url
+		content = content.replace(/
.*?<\/pre>/gi, '[代码]') // replace code
+		content = content.replace(/<[^>]+>/g, "") // remove html tag
 
-        if (length!=null){
-            if (content.length > length) {
-                content = content.substring(0, length) + '...'
-            }
-        }
+		if (length != null) {
+			if (content.length > length) {
+				content = content.substring(0, length) + '...'
+			}
+		}
 
-        return content
-    }
+		return content
+	}
 
-}
+}
\ No newline at end of file
diff --git a/templates/assets/zhheo/rightmenu.js b/templates/assets/zhheo/rightmenu.js
index f4f16ad..1eabbb4 100644
--- a/templates/assets/zhheo/rightmenu.js
+++ b/templates/assets/zhheo/rightmenu.js
@@ -3,26 +3,26 @@ let rm = {};
 
 //禁止图片拖拽
 rm.stopdragimg = $("img");
-rm.stopdragimg.on("dragstart", function () {
-    return false;
+rm.stopdragimg.on("dragstart", function() {
+	return false;
 });
 
 // 显示菜单
-rm.showRightMenu = function (isTrue, x = 0, y = 0) {
-    let $rightMenu = $('#rightMenu');
-    $rightMenu.css('top', x + 'px').css('left', y + 'px');
-    if (isTrue) {
-        $rightMenu.show();
-        stopMaskScroll()
-    } else {
-        $rightMenu.hide();
-    }
+rm.showRightMenu = function(isTrue, x = 0, y = 0) {
+	let $rightMenu = $('#rightMenu');
+	$rightMenu.css('top', x + 'px').css('left', y + 'px');
+	if (isTrue) {
+		$rightMenu.show();
+		stopMaskScroll()
+	} else {
+		$rightMenu.hide();
+	}
 }
 
 // 隐藏菜单
-rm.hideRightMenu = function () {
-    rm.showRightMenu(false);
-    $('#rightmenu-mask').attr('style', 'display: none');
+rm.hideRightMenu = function() {
+	rm.showRightMenu(false);
+	$('#rightmenu-mask').attr('style', 'display: none');
 }
 
 // 尺寸
@@ -30,9 +30,9 @@ let rmWidth = $('#rightMenu').width();
 let rmHeight = $('#rightMenu').height();
 
 // 重新定义尺寸
-rm.reloadrmSize = function () {
-    rmWidth = $('#rightMenu').width();
-    rmHeight = $('#rightMenu').height();
+rm.reloadrmSize = function() {
+	rmWidth = $('#rightMenu').width();
+	rmHeight = $('#rightMenu').height();
 }
 
 // 获取点击的href
@@ -41,225 +41,227 @@ let domImgSrc = '';
 let globalEvent = null;
 
 // 监听右键初始化
-window.oncontextmenu = function (event) {
-    if (document.body.clientWidth > 768) {
-        let pageX = event.clientX + 10;	//加10是为了防止显示时鼠标遮在菜单上
-        let pageY = event.clientY;
-        // console.log(event);
+window.oncontextmenu = function(event) {
+	if (document.body.clientWidth > 768) {
+		let pageX = event.clientX + 10; //加10是为了防止显示时鼠标遮在菜单上
+		let pageY = event.clientY;
+		// console.log(event);
 
-        //其他额外菜单
-        let $rightMenuOther = $('.rightMenuOther');
-        let $rightMenuPlugin = $('.rightMenuPlugin');
-        let $rightMenuCopyText = $('#menu-copytext');
-        let $rightMenuPasteText = $('#menu-pastetext');
-        let $rightMenuCommentText = $('#menu-commenttext');
-        let $rightMenuNewWindow = $('#menu-newwindow');
-        let $rightMenuNewWindowImg = $('#menu-newwindowimg');
-        let $rightMenuCopyLink = $('#menu-copylink');
-        let $rightMenuCopyImg = $('#menu-copyimg');
-        let $rightMenuDownloadImg = $('#menu-downloadimg');
-        let $rightMenuSearch = $('#menu-search');
-        let $rightMenuSearchBaidu = $('#menu-searchBaidu');
-        let $rightMenuMusicToggle = $('#menu-music-toggle');
-        let $rightMenuMusicBack = $('#menu-music-back');
-        let $rightMenuMusicForward = $('#menu-music-forward');
-        let $rightMenuMusicPlaylist = $('#menu-music-playlist');
-        let $rightMenuMusicCopyMusicName = $('#menu-music-copyMusicName');
-        let href = event.target.href;
-        let imgsrc = event.target.currentSrc;
+		//其他额外菜单
+		let $rightMenuOther = $('.rightMenuOther');
+		let $rightMenuPlugin = $('.rightMenuPlugin');
+		let $rightMenuCopyText = $('#menu-copytext');
+		let $rightMenuPasteText = $('#menu-pastetext');
+		let $rightMenuCommentText = $('#menu-commenttext');
+		let $rightMenuNewWindow = $('#menu-newwindow');
+		let $rightMenuNewWindowImg = $('#menu-newwindowimg');
+		let $rightMenuCopyLink = $('#menu-copylink');
+		let $rightMenuCopyImg = $('#menu-copyimg');
+		let $rightMenuDownloadImg = $('#menu-downloadimg');
+		let $rightMenuSearch = $('#menu-search');
+		let $rightMenuSearchBaidu = $('#menu-searchBaidu');
+		let $rightMenuMusicToggle = $('#menu-music-toggle');
+		let $rightMenuMusicBack = $('#menu-music-back');
+		let $rightMenuMusicForward = $('#menu-music-forward');
+		let $rightMenuMusicPlaylist = $('#menu-music-playlist');
+		let $rightMenuMusicCopyMusicName = $('#menu-music-copyMusicName');
+		let href = event.target.href;
+		let imgsrc = event.target.currentSrc;
 
-        // 判断模式 扩展模式为有事件
-        let pluginMode = false;
-        $rightMenuOther.show();
-        globalEvent = event;
+		// 判断模式 扩展模式为有事件
+		let pluginMode = false;
+		$rightMenuOther.show();
+		globalEvent = event;
 
-        // 检查是否需要复制 是否有选中文本
-        if (selectTextNow && window.getSelection()) {
-            pluginMode = true;
-            $rightMenuCopyText.show();
-            $rightMenuCommentText.show();
-            $rightMenuSearch.show();
-            $rightMenuSearchBaidu.show();
-        } else {
-            $rightMenuCopyText.hide();
-            $rightMenuCommentText.hide();
-            $rightMenuSearchBaidu.hide();
-            $rightMenuSearch.hide();
-        }
+		// 检查是否需要复制 是否有选中文本
+		if (selectTextNow && window.getSelection()) {
+			pluginMode = true;
+			$rightMenuCopyText.show();
+			$rightMenuCommentText.show();
+			$rightMenuSearch.show();
+			$rightMenuSearchBaidu.show();
+		} else {
+			$rightMenuCopyText.hide();
+			$rightMenuCommentText.hide();
+			$rightMenuSearchBaidu.hide();
+			$rightMenuSearch.hide();
+		}
 
-        //检查是否右键点击了链接a标签
-        if (href) {
-            pluginMode = true;
-            $rightMenuNewWindow.show();
-            $rightMenuCopyLink.show();
-            domhref = href;
-        } else {
-            $rightMenuNewWindow.hide();
-            $rightMenuCopyLink.hide();
-        }
+		//检查是否右键点击了链接a标签
+		if (href) {
+			pluginMode = true;
+			$rightMenuNewWindow.show();
+			$rightMenuCopyLink.show();
+			domhref = href;
+		} else {
+			$rightMenuNewWindow.hide();
+			$rightMenuCopyLink.hide();
+		}
 
-        //检查是否需要复制图片
-        if (imgsrc) {
-            pluginMode = true;
-            $rightMenuCopyImg.show();
-            $rightMenuDownloadImg.show();
-            $rightMenuNewWindowImg.show();
-            domImgSrc = imgsrc;
-        } else {
-            $rightMenuCopyImg.hide();
-            $rightMenuDownloadImg.hide();
-            $rightMenuNewWindowImg.hide();
-        }
+		//检查是否需要复制图片
+		if (imgsrc) {
+			pluginMode = true;
+			$rightMenuCopyImg.show();
+			$rightMenuDownloadImg.show();
+			$rightMenuNewWindowImg.show();
+			domImgSrc = imgsrc;
+		} else {
+			$rightMenuCopyImg.hide();
+			$rightMenuDownloadImg.hide();
+			$rightMenuNewWindowImg.hide();
+		}
 
-        // 判断是否为输入框
-        if (event.target.tagName.toLowerCase() === 'input' || event.target.tagName.toLowerCase() === 'textarea') {
-            console.log('这是一个输入框')
-            pluginMode = true;
-            $rightMenuPasteText.show();
-        } else {
-            $rightMenuPasteText.hide();
-        }
+		// 判断是否为输入框
+		if (event.target.tagName.toLowerCase() === 'input' || event.target.tagName.toLowerCase() === 'textarea') {
+			console.log('这是一个输入框')
+			pluginMode = true;
+			$rightMenuPasteText.show();
+		} else {
+			$rightMenuPasteText.hide();
+		}
 
-        //判断是否是音乐
-        const navMusicEl = document.querySelector("#nav-music");
-        if (navMusicEl && navMusicEl.contains(event.target)) {
-            pluginMode = true;
-            $rightMenuMusicToggle.show();
-            $rightMenuMusicBack.show();
-            $rightMenuMusicForward.show();
-            $rightMenuMusicPlaylist.show();
-            $rightMenuMusicCopyMusicName.show();
-        } else {
-            $rightMenuMusicToggle.hide();
-            $rightMenuMusicBack.hide();
-            $rightMenuMusicForward.hide();
-            $rightMenuMusicPlaylist.hide();
-            $rightMenuMusicCopyMusicName.hide()
-        }
+		//判断是否是音乐
+		const navMusicEl = document.querySelector("#nav-music");
+		if (navMusicEl && navMusicEl.contains(event.target)) {
+			pluginMode = true;
+			$rightMenuMusicToggle.show();
+			$rightMenuMusicBack.show();
+			$rightMenuMusicForward.show();
+			$rightMenuMusicPlaylist.show();
+			$rightMenuMusicCopyMusicName.show();
+		} else {
+			$rightMenuMusicToggle.hide();
+			$rightMenuMusicBack.hide();
+			$rightMenuMusicForward.hide();
+			$rightMenuMusicPlaylist.hide();
+			$rightMenuMusicCopyMusicName.hide()
+		}
 
-        // 如果不是扩展模式则隐藏扩展模块
-        if (pluginMode) {
-            $rightMenuOther.hide();
-            $rightMenuPlugin.show();
-        } else {
-            $rightMenuPlugin.hide()
-        }
+		// 如果不是扩展模式则隐藏扩展模块
+		if (pluginMode) {
+			$rightMenuOther.hide();
+			$rightMenuPlugin.show();
+		} else {
+			$rightMenuPlugin.hide()
+		}
 
-        rm.reloadrmSize()
+		rm.reloadrmSize()
 
-        // 鼠标默认显示在鼠标右下方,当鼠标靠右或考下时,将菜单显示在鼠标左方\上方
-        if (pageX + rmWidth > window.innerWidth) {
-            pageX -= rmWidth + 10;
-        }
-        if (pageY + rmHeight > window.innerHeight) {
-            pageY -= pageY + rmHeight - window.innerHeight;
-        }
+		// 鼠标默认显示在鼠标右下方,当鼠标靠右或考下时,将菜单显示在鼠标左方\上方
+		if (pageX + rmWidth > window.innerWidth) {
+			pageX -= rmWidth + 10;
+		}
+		if (pageY + rmHeight > window.innerHeight) {
+			pageY -= pageY + rmHeight - window.innerHeight;
+		}
 
-        rm.showRightMenu(true, pageY, pageX);
-        $('#rightmenu-mask').attr('style', 'display: flex');
-        return false;
-    }
+		rm.showRightMenu(true, pageY, pageX);
+		$('#rightmenu-mask').attr('style', 'display: flex');
+		return false;
+	}
 };
 
 // 下载图片状态
 rm.downloadimging = false;
 
 // 复制图片到剪贴板
-rm.writeClipImg = function (imgsrc) {
-    console.log('按下复制');
-    rm.hideRightMenu();
-    btf.snackbarShow('正在下载中,请稍后', false, 10000)
-    if (rm.downloadimging == false) {
-        rm.downloadimging = true;
-        setTimeout(function () {
-            copyImage(imgsrc);
-            btf.snackbarShow('复制成功!图片已添加盲水印,请遵守版权协议');
-            rm.downloadimging = false;
-        }, "10000")
-    }
+rm.writeClipImg = function(imgsrc) {
+	console.log('按下复制');
+	rm.hideRightMenu();
+	btf.snackbarShow('正在下载中,请稍后', false, 10000)
+	if (rm.downloadimging == false) {
+		rm.downloadimging = true;
+		setTimeout(function() {
+			copyImage(imgsrc);
+			btf.snackbarShow('复制成功!图片已添加盲水印,请遵守版权协议');
+			rm.downloadimging = false;
+		}, "10000")
+	}
 }
 
 function imageToBlob(imageURL) {
-    const img = new Image;
-    const c = document.createElement("canvas");
-    const ctx = c.getContext("2d");
-    img.crossOrigin = "";
-    img.src = imageURL;
-    return new Promise(resolve => {
-        img.onload = function () {
-            c.width = this.naturalWidth;
-            c.height = this.naturalHeight;
-            ctx.drawImage(this, 0, 0);
-            c.toBlob((blob) => {
-                // here the image is a blob
-                resolve(blob)
-            }, "image/png", 0.75);
-        };
-    })
+	const img = new Image;
+	const c = document.createElement("canvas");
+	const ctx = c.getContext("2d");
+	img.crossOrigin = "";
+	img.src = imageURL;
+	return new Promise(resolve => {
+		img.onload = function() {
+			c.width = this.naturalWidth;
+			c.height = this.naturalHeight;
+			ctx.drawImage(this, 0, 0);
+			c.toBlob((blob) => {
+				// here the image is a blob
+				resolve(blob)
+			}, "image/png", 0.75);
+		};
+	})
 }
 
 async function copyImage(imageURL) {
-    const blob = await imageToBlob(imageURL)
-    const item = new ClipboardItem({"image/png": blob});
-    navigator.clipboard.write([item]);
+	const blob = await imageToBlob(imageURL)
+	const item = new ClipboardItem({
+		"image/png": blob
+	});
+	navigator.clipboard.write([item]);
 }
 
-rm.switchDarkMode = function () {
-    navFn.switchDarkMode();
-    rm.hideRightMenu();
+rm.switchDarkMode = function() {
+	navFn.switchDarkMode();
+	rm.hideRightMenu();
 
-    //halo.darkComment();
+	//halo.darkComment();
 }
 
-rm.copyUrl = function (id) {
-    $("body").after("");
-    var text = id;
-    var input = document.getElementById("copyVal");
-    input.value = text;
-    input.select();
-    input.setSelectionRange(0, input.value.length);
-    document.execCommand("copy");
-    $("#copyVal").remove();
+rm.copyUrl = function(id) {
+	$("body").after("");
+	var text = id;
+	var input = document.getElementById("copyVal");
+	input.value = text;
+	input.select();
+	input.setSelectionRange(0, input.value.length);
+	document.execCommand("copy");
+	$("#copyVal").remove();
 }
 
 function stopMaskScroll() {
-    if (document.getElementById("rightmenu-mask")) {
-        let xscroll = document.getElementById("rightmenu-mask");
-        xscroll.addEventListener("mousewheel", function (e) {
-            //阻止浏览器默认方法
-            rm.hideRightMenu();
-            // e.preventDefault();
-        }, false);
-    }
-    if (document.getElementById("rightMenu")) {
-        let xscroll = document.getElementById("rightMenu");
-        xscroll.addEventListener("mousewheel", function (e) {
-            //阻止浏览器默认方法
-            rm.hideRightMenu();
-            // e.preventDefault();
-        }, false);
-    }
+	if (document.getElementById("rightmenu-mask")) {
+		let xscroll = document.getElementById("rightmenu-mask");
+		xscroll.addEventListener("mousewheel", function(e) {
+			//阻止浏览器默认方法
+			rm.hideRightMenu();
+			// e.preventDefault();
+		}, false);
+	}
+	if (document.getElementById("rightMenu")) {
+		let xscroll = document.getElementById("rightMenu");
+		xscroll.addEventListener("mousewheel", function(e) {
+			//阻止浏览器默认方法
+			rm.hideRightMenu();
+			// e.preventDefault();
+		}, false);
+	}
 }
 
-rm.rightmenuCopyText = function (txt) {
-    if (navigator.clipboard) {
-        navigator.clipboard.writeText(txt);
-    }
-    rm.hideRightMenu();
+rm.rightmenuCopyText = function(txt) {
+	if (navigator.clipboard) {
+		navigator.clipboard.writeText(txt);
+	}
+	rm.hideRightMenu();
 }
 
-rm.copyPageUrl = function () {
-    var url = window.location.href;
-    rm.copyUrl(url);
-    btf.snackbarShow('复制本页链接地址成功', false, 2000);
-    rm.hideRightMenu();
+rm.copyPageUrl = function() {
+	var url = window.location.href;
+	rm.copyUrl(url);
+	btf.snackbarShow('复制本页链接地址成功', false, 2000);
+	rm.hideRightMenu();
 }
 
-rm.sharePage = function () {
-    var content = window.location.href;
-    rm.copyUrl(url);
-    btf.snackbarShow('复制本页链接地址成功', false, 2000);
-    rm.hideRightMenu();
+rm.sharePage = function() {
+	var content = window.location.href;
+	rm.copyUrl(url);
+	btf.snackbarShow('复制本页链接地址成功', false, 2000);
+	rm.hideRightMenu();
 }
 
 // 复制当前选中文本
@@ -267,160 +269,161 @@ var selectTextNow = '';
 document.onmouseup = document.ondbclick = selceText;
 
 function selceText() {
-    var txt;
-    if (document.selection) {
-        txt = document.selection.createRange().text;
-    } else {
-        txt = window.getSelection() + '';
-    }
-    if (txt) {
-        selectTextNow = txt;
-        // console.log(selectTextNow);
-    } else {
-        selectTextNow = '';
-    }
+	var txt;
+	if (document.selection) {
+		txt = document.selection.createRange().text;
+	} else {
+		txt = window.getSelection() + '';
+	}
+	if (txt) {
+		selectTextNow = txt;
+		// console.log(selectTextNow);
+	} else {
+		selectTextNow = '';
+	}
 }
 
 // 读取剪切板
-rm.readClipboard = function () {
-    if (navigator.clipboard) {
-        navigator.clipboard.readText().then(clipText => rm.insertAtCaret(globalEvent.target, clipText));
-    }
+rm.readClipboard = function() {
+	if (navigator.clipboard) {
+		navigator.clipboard.readText().then(clipText => rm.insertAtCaret(globalEvent.target, clipText));
+	}
 }
 
 // 粘贴文本到焦点
-rm.insertAtCaret = function (elemt, value) {
-    const startPos = elemt.selectionStart,
-        endPos = elemt.selectionEnd;
-    if (document.selection) {
-        elemt.focus();
-        var sel = document.selection.createRange();
-        sel.text = value;
-        elemt.focus();
-    } else {
-        if (startPos || startPos == '0') {
-            var scrollTop = elemt.scrollTop;
-            elemt.value = elemt.value.substring(0, startPos) + value + elemt.value.substring(endPos, elemt.value.length);
-            elemt.focus();
-            elemt.selectionStart = startPos + value.length;
-            elemt.selectionEnd = startPos + value.length;
-            elemt.scrollTop = scrollTop;
-        } else {
-            elemt.value += value;
-            elemt.focus();
-        }
-    }
+rm.insertAtCaret = function(elemt, value) {
+	const startPos = elemt.selectionStart,
+		endPos = elemt.selectionEnd;
+	if (document.selection) {
+		elemt.focus();
+		var sel = document.selection.createRange();
+		sel.text = value;
+		elemt.focus();
+	} else {
+		if (startPos || startPos == '0') {
+			var scrollTop = elemt.scrollTop;
+			elemt.value = elemt.value.substring(0, startPos) + value + elemt.value.substring(endPos, elemt.value
+				.length);
+			elemt.focus();
+			elemt.selectionStart = startPos + value.length;
+			elemt.selectionEnd = startPos + value.length;
+			elemt.scrollTop = scrollTop;
+		} else {
+			elemt.value += value;
+			elemt.focus();
+		}
+	}
 }
 
 //粘贴文本
-rm.pasteText = function () {
-    const result = rm.readClipboard() || '';
-    rm.hideRightMenu();
+rm.pasteText = function() {
+	const result = rm.readClipboard() || '';
+	rm.hideRightMenu();
 }
 
 //引用到评论
-rm.rightMenuCommentText = function (txt) {
-    rm.hideRightMenu();
-    var input = document.getElementsByClassName(GLOBAL_CONFIG.source.comments.textarea)[0];
-    let evt = document.createEvent('HTMLEvents');
-    evt.initEvent('input', true, true);
-    let inputValue = replaceAll(txt, '\n', '\n> ')
-    input.value = '> ' + inputValue + '\n\n';
-    input.dispatchEvent(evt);
-    var domTop = document.querySelector("#post-comment").offsetTop;
-    window.scrollTo(0, domTop - 80);
-    input.focus();
-    input.setSelectionRange(-1, -1);
-    if (document.getElementById("comment-tips")) {
-        document.getElementById("comment-tips").classList.add("show");
-    }
+rm.rightMenuCommentText = function(txt) {
+	rm.hideRightMenu();
+	var input = document.getElementsByClassName(GLOBAL_CONFIG.source.comments.textarea)[0];
+	let evt = document.createEvent('HTMLEvents');
+	evt.initEvent('input', true, true);
+	let inputValue = replaceAll(txt, '\n', '\n> ')
+	input.value = '> ' + inputValue + '\n\n';
+	input.dispatchEvent(evt);
+	var domTop = document.querySelector("#post-comment").offsetTop;
+	window.scrollTo(0, domTop - 80);
+	input.focus();
+	input.setSelectionRange(-1, -1);
+	if (document.getElementById("comment-tips")) {
+		document.getElementById("comment-tips").classList.add("show");
+	}
 }
 
 //替换所有内容
 function replaceAll(string, search, replace) {
-    return string.split(search).join(replace);
+	return string.split(search).join(replace);
 }
 
 // 百度搜索
-rm.searchBaidu = function () {
-    btf.snackbarShow('即将跳转到百度搜索', false, 2000);
-    setTimeout(function () {
-        window.open('https://www.baidu.com/s?wd=' + selectTextNow);
-    }, "2000");
-    rm.hideRightMenu();
+rm.searchBaidu = function() {
+	btf.snackbarShow('即将跳转到百度搜索', false, 2000);
+	setTimeout(function() {
+		window.open('https://www.baidu.com/s?wd=' + selectTextNow);
+	}, "2000");
+	rm.hideRightMenu();
 }
 
 //分享链接
-rm.copyLink = function () {
-    rm.rightmenuCopyText(domhref);
-    btf.snackbarShow('已复制链接地址');
+rm.copyLink = function() {
+	rm.rightmenuCopyText(domhref);
+	btf.snackbarShow('已复制链接地址');
 }
 
 function addRightMenuClickEvent() {
-    // 添加点击事件
-    $('#menu-backward').on('click', function () {
-        window.history.back();
-        rm.hideRightMenu();
-    });
-    $('#menu-forward').on('click', function () {
-        window.history.forward();
-        rm.hideRightMenu();
-    });
-    $('#menu-refresh').on('click', function () {
-        window.location.reload();
-    });
-    $('#menu-top').on('click', function () {
-        btf.scrollToDest(0, 500);
-        rm.hideRightMenu();
-    });
-    $('.menu-link').on('click', rm.hideRightMenu);
-    $('#menu-darkmode').on('click', rm.switchDarkMode);
-    $('#menu-home').on('click', function () {
-        window.location.href = window.location.origin;
-    });
-    $('#menu-randomPost').on('click', function () {
-        toRandomPost()
-    });
-    $('#menu-commentBarrage').on('click', heo.switchCommentBarrage);
-    $('#rightmenu-mask').on('click', rm.hideRightMenu);
-    $('#rightmenu-mask').contextmenu(function () {
-        rm.hideRightMenu();
-        return false;
-    });
-    $('#menu-translate').on('click', function () {
-        rm.hideRightMenu();
-    });
-    $('#menu-copy').on('click', rm.copyPageUrl);
-    $('#menu-pastetext').on('click', rm.pasteText);
-    $('#menu-copytext').on('click', function () {
-        rm.rightmenuCopyText(selectTextNow);
-        btf.snackbarShow('复制成功,复制和转载请标注本文地址');
-    });
-    $('#menu-commenttext').on('click', function () {
-        rm.rightMenuCommentText(selectTextNow);
-    });
-    $('#menu-newwindow').on('click', function () {
-        window.open(domhref);
-        rm.hideRightMenu();
-    });
-    $('#menu-copylink').on('click', rm.copyLink);
-    $('#menu-downloadimg').on('click', function () {
-        heo.downloadImage(domImgSrc, 'hao');
-    });
-    $('#menu-newwindowimg').on('click', function () {
-        window.open(domImgSrc, "_blank");
-        rm.hideRightMenu();
-    });
-    $('#menu-copyimg').on('click', function () {
-        rm.writeClipImg(domImgSrc);
-    });
-    $('#menu-searchBaidu').on('click', rm.searchBaidu);
-    //音乐
-    $('#menu-music-toggle').on('click', heo.musicToggle);
-    $('#menu-music-back').on('click', heo.musicSkipBack);
-    $('#menu-music-forward').on('click', heo.musicSkipForward);
-    $('#menu-music-copyMusicName').on('click', function () {
-        rm.rightmenuCopyText(heo.musicGetName());
-        btf.snackbarShow('复制歌曲名称成功', false, 3000);
-    });
-}
+	// 添加点击事件
+	$('#menu-backward').on('click', function() {
+		window.history.back();
+		rm.hideRightMenu();
+	});
+	$('#menu-forward').on('click', function() {
+		window.history.forward();
+		rm.hideRightMenu();
+	});
+	$('#menu-refresh').on('click', function() {
+		window.location.reload();
+	});
+	$('#menu-top').on('click', function() {
+		btf.scrollToDest(0, 500);
+		rm.hideRightMenu();
+	});
+	$('.menu-link').on('click', rm.hideRightMenu);
+	$('#menu-darkmode').on('click', rm.switchDarkMode);
+	$('#menu-home').on('click', function() {
+		window.location.href = window.location.origin;
+	});
+	$('#menu-randomPost').on('click', function() {
+		toRandomPost()
+	});
+	$('#menu-commentBarrage').on('click', heo.switchCommentBarrage);
+	$('#rightmenu-mask').on('click', rm.hideRightMenu);
+	$('#rightmenu-mask').contextmenu(function() {
+		rm.hideRightMenu();
+		return false;
+	});
+	$('#menu-translate').on('click', function() {
+		rm.hideRightMenu();
+	});
+	$('#menu-copy').on('click', rm.copyPageUrl);
+	$('#menu-pastetext').on('click', rm.pasteText);
+	$('#menu-copytext').on('click', function() {
+		rm.rightmenuCopyText(selectTextNow);
+		btf.snackbarShow('复制成功,复制和转载请标注本文地址');
+	});
+	$('#menu-commenttext').on('click', function() {
+		rm.rightMenuCommentText(selectTextNow);
+	});
+	$('#menu-newwindow').on('click', function() {
+		window.open(domhref);
+		rm.hideRightMenu();
+	});
+	$('#menu-copylink').on('click', rm.copyLink);
+	$('#menu-downloadimg').on('click', function() {
+		heo.downloadImage(domImgSrc, 'hao');
+	});
+	$('#menu-newwindowimg').on('click', function() {
+		window.open(domImgSrc, "_blank");
+		rm.hideRightMenu();
+	});
+	$('#menu-copyimg').on('click', function() {
+		rm.writeClipImg(domImgSrc);
+	});
+	$('#menu-searchBaidu').on('click', rm.searchBaidu);
+	//音乐
+	$('#menu-music-toggle').on('click', heo.musicToggle);
+	$('#menu-music-back').on('click', heo.musicSkipBack);
+	$('#menu-music-forward').on('click', heo.musicSkipForward);
+	$('#menu-music-copyMusicName').on('click', function() {
+		rm.rightmenuCopyText(heo.musicGetName());
+		btf.snackbarShow('复制歌曲名称成功', false, 3000);
+	});
+}
\ No newline at end of file
diff --git a/templates/modules/widgets/nav-right.html b/templates/modules/widgets/nav-right.html
index 54b4b31..aea5c0a 100644
--- a/templates/modules/widgets/nav-right.html
+++ b/templates/modules/widgets/nav-right.html
@@ -1,81 +1,81 @@
 
 
+	
+ + + +
+
\ No newline at end of file diff --git a/theme.yaml b/theme.yaml index 541c91c..0fb942b 100644 --- a/theme.yaml +++ b/theme.yaml @@ -48,8 +48,8 @@ spec: description: Halo 2.x Theme base on Thymeleaf, Referring to Butterfly and Heo logo: /themes/theme-hao/assets/images/hao-logo.jpg website: https://blog.uptoz.cn - repo: https://githubfast.com/liuzhihang/halo-theme-hao + repo: https://gitea.uptoz.cn/UPToZ/halo-theme-hao settingName: "theme-hao-setting" configMapName: "theme-hao-configMap" - version: "1.4.9-CommemorativeEdition" + version: "1.0.1-ce" require: ">=2.10.0"