diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ba10ce8e..6d22e005 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -33,7 +33,7 @@ $ git push * 定期使用项目仓库内容更新自己仓库内容。 ```bash -$ git remote add upstream https://github.com/DuoSco/Hexo-theme-solitude +$ git remote add upstream https://github.com/wleelw/Hexo-theme-solitude $ git fetch upstream $ git checkout dev $ git rebase upstream/dev diff --git a/README.md b/README.md index 394fd8d8..b04864f9 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ ![master version](https://img.shields.io/github/package-json/v/wleelw/hexo-theme-solitude/master?color=%231ab1ad&label=master) ![master version](https://img.shields.io/github/package-json/v/wleelw/hexo-theme-solitude/dev?label=dev) ![https://img.shields.io/npm/v/hexo-theme-solitude?color=%09%23bf00ff](https://img.shields.io/npm/v/hexo-theme-solitude?color=%09%23bf00ff) -![hexo version](https://img.shields.io/badge/hexo-5.3.0+-0e83c) +![hexo version](https://img.shields.io/badge/hexo-6.3.0+-0e83c) ![license](https://img.shields.io/github/license/wleelw/hexo-theme-solitude?color=FF5531) ![首页](https://github.com/wleelw/hexo-theme-solitude/assets/74389842/d008aba4-942d-4fdb-a611-d934c0bad9fe) diff --git a/README_EN.md b/README_EN.md index b2cd4215..2ef99508 100644 --- a/README_EN.md +++ b/README_EN.md @@ -8,7 +8,7 @@ ![master version](https://img.shields.io/github/package-json/v/wleelw/hexo-theme-solitude/master?color=%231ab1ad&label=master) ![master version](https://img.shields.io/github/package-json/v/wleelw/hexo-theme-solitude/dev?label=dev) ![https://img.shields.io/npm/v/hexo-theme-solitude?color=%09%23bf00ff](https://img.shields.io/npm/v/hexo-theme-solitude?color=%09%23bf00ff) -![hexo version](https://img.shields.io/badge/hexo-5.3.0+-0e83c) +![hexo version](https://img.shields.io/badge/hexo-6.3.0+-0e83c) ![license](https://img.shields.io/github/license/wleelw/hexo-theme-solitude?color=FF5531) ![首页](https://github.com/wleelw/hexo-theme-solitude/assets/74389842/d008aba4-942d-4fdb-a611-d934c0bad9fe) diff --git a/_config.yml b/_config.yml index 06e79bc5..34335bc3 100644 --- a/_config.yml +++ b/_config.yml @@ -62,7 +62,7 @@ nav: # icon: https://bu.dusays.com/2023/11/08/654af68b25bb8.jpg # # 点击的跳转链接 # # Click the jump link - # url: https://github.com/DuoSco/Hexo-Theme-solitude + # url: https://github.com/wleelw/Hexo-Theme-solitude # 导航栏内容 # Navigation bar content @@ -312,7 +312,7 @@ aside: # # 图标 # icon: scoicon sco-github-line # # 跳转链接 - # url: https://github.com/DuoSco/Hexo-Theme-slitude + # url: https://github.com/wleelw/Hexo-Theme-slitude # Bilibili: # icon: scoicon sco-bilibili-line # url: https://space.bilibili.com/1329819902 @@ -617,6 +617,7 @@ theme_color: # -------------------------------------- display_mode: type: auto # auto: 自动切换 / dark: 暗色模式 / light: 亮色模式 / auto: automatic switching / dark: dark mode / light: light mode + universe: true # 开启后暗色模式下会显示星空背景 / After opening, the dark mode will display the starry sky background # -------------------------------------- # Footer Settings @@ -729,6 +730,15 @@ fancybox: true # mediumZoom mediumZoom: false +# 简繁转换 +# Simplified and Traditional Chinese conversion +translate: + enable: false + # the language of website (1 - Traditional Chinese/ 2 - Simplified Chinese) + defaultEncoding: 2 + # Time delay + translateDelay: 0 + # Open Graph # https://ogp.me/ # https://developers.facebook.com/docs/sharing/webmasters/ @@ -911,7 +921,7 @@ CDN: option: scoicon_css: https://cdn.cbd.int/solitude-source/icon/scoicon.min.css waterfall: https://cdn.cbd.int/solitude-source/js/waterfall.min.js - view_image: https://cdn.cbd.int/solitude-source/js/view-image.min.js + universe_js: https://cdn.cbd.int/solitude-source/js/universe.min.js # algolia_search: # instantsearch: # pjax: diff --git a/languages/en-US.yml b/languages/en-US.yml index b13ac594..14ef889b 100755 --- a/languages/en-US.yml +++ b/languages/en-US.yml @@ -13,6 +13,10 @@ time: daybefore: Days ago runtime: days +chs: + chs_tw: Traditional Chinese + chs_cn: Simplified Chinese + page: tag: Tags category: Categories @@ -71,7 +75,7 @@ search: head: noscript: Please enable JavaScript to view the site - console: 'Program: Hexo | Theme: Hexo-Theme-Solitude | Author: WangZhuoSco、YiFeng | Github: https://github.com/DuoSco/Hexo-theme-solitude | Version: v1.4.2 😄' + console: 'Program: Hexo | Theme: Hexo-Theme-Solitude | Author: WangZhuoSco、YiFeng | Github: https://github.com/wleelw/Hexo-theme-solitude | Version: v1.4.3 😄' aside: postcount: 'Posts :' @@ -115,4 +119,29 @@ cookies: privacy: How this site protects your privacy music: - hit: Paused \ No newline at end of file + hit: Paused + +rightmenu: + copytext: Copy the selected + pastetext: Paste the text + commenttext: Quote to comment + newwindow: A new window opens + copylink: Copy the link address + copyimg: Copy this image + downloadimg: Download this image + search: Search on the site + music: + toggle: Play music + back: Switch to the previous track + forward: Switch to the next track + playlist: See all songs + copyMusicName: Reproduction Song Name + randomPost: Feel free to wander around + categories: Article classification + tags: Article tags + copyaddress: Copy the address + commentBarrage: Turn off trending reviews + dark: Dark + light: Light + chs_to_cht: Traditional + cht_to_chs: Simplified \ No newline at end of file diff --git a/languages/zh-CN.yml b/languages/zh-CN.yml index 7017feed..112b1e3d 100755 --- a/languages/zh-CN.yml +++ b/languages/zh-CN.yml @@ -1,3 +1,4 @@ +# Language: 简体中文 theme: dark: 已切换至深色模式 light: 已切换至浅色模式 @@ -13,6 +14,10 @@ time: daybefore: 天前 runtime: 天 +chs: + chs_tw: 繁體中文 + chs_cn: 简体中文 + page: tag: 标签 category: 分类 @@ -70,7 +75,7 @@ search: head: noscript: 开启JavaScript才能访问本站哦~ - console: '程序:Hexo | 主题:Hexo-Theme-Solitude | 作者:王卓Sco、亦封 | Github: https://github.com/DuoSco/Hexo-theme-solitude | 版本:v1.4.2 😄' + console: '程序:Hexo | 主题:Hexo-Theme-Solitude | 作者:王卓Sco、亦封 | Github: https://github.com/wleelw/Hexo-theme-solitude | 版本:v1.4.3 😄' aside: postcount: '文章总数 :' @@ -114,4 +119,29 @@ cookies: privacy: 本站如何保护你的隐私 music: - hit: 音乐已暂停 \ No newline at end of file + hit: 音乐已暂停 + +rightmenu: + copytext: 复制选中文本 + pastetext: 粘贴文本 + commenttext: 引用到评论 + newwindow: 新窗口打开 + copylink: 复制链接地址 + copyimg: 复制此图片 + downloadimg: 下载此图片 + search: 站内搜索 + music: + toggle: 播放音乐 + back: 切换到上一首 + forward: 切换到下一首 + playlist: 查看所有歌曲 + copyMusicName: 复制歌名 + randomPost: 随便逛逛 + categories: 文章分类 + tags: 文章标签 + copyaddress: 复制地址 + commentBarrage: 关闭热评 + dark: 深色模式 + light: 浅色模式 + chs_to_cht: 轉為繁體 + cht_to_chs: 转为简体 \ No newline at end of file diff --git a/languages/zh-TW.yml b/languages/zh-TW.yml new file mode 100755 index 00000000..07b4a16b --- /dev/null +++ b/languages/zh-TW.yml @@ -0,0 +1,147 @@ +# Language: 繁體中文 (台灣) +theme: + dark: 已切換至深色模式 + light: 已切換至淺色模式 + +copy: + success: 複製成功 + error: 複製失敗 + +time: + recent: 最近 + yesterday: 昨天 + berforeyesterday: 前天 + daybefore: 天前 + runtime: 天 + +chs: + chs_tw: 繁體中文 + chs_cn: 簡體中文 + +page: + tag: 標籤 + category: 分類 + tags: 全部標籤 + categories: 全部分類 + archives: 文章 + 404: 頁面沒有找到 + +nav: + site_name_title: 返回博客主頁 + backtop: 返回頂部 + travellings: 開往-友鏈接力 + search: 搜索 + randompost: 隨機一篇文章 + console: 中控台 + +home: + bannertext: 隨便逛逛 + categoryBar: + home: 首頁 + more: 更多 + recent-post: + sticky: 置頂 + new: 最新 + read: 未讀 + top-group: + recommend: 荐 + recommendmore: 更多推薦 + +post: + meta_reprint: 轉載或翻譯 + meta_original: 原創 + meta_cc: 該文章為${cc}文章,注意版權協議 + meta_posted: 發布於 + meta_updated: 最後更新於 + meta_wordcount: 文章字數 + meta_minread: 閱讀耗時 + meta_ip: 作者IP歸屬地為 + meta_pv: 文章熱度 + meta_comment: 評論數 + +award: + wechat: 微信 + alipay: 支付寶 + about: + tip: 致謝 + tip1: 贊助作者 + tip2: 感謝你賜予我前進的力量 + title: 贊助作者 + +search: + empty: 找不到你查詢的內容:${query} + hit: 找到 ${hits} 條結果,用時 ${time} 毫秒 + placeholder: 輸入關鍵詞快速查找 + +head: + noscript: 開啟JavaScript才能訪問本站哦~ + console: '程式:Hexo |主題:Hexo-Theme-Solitude |作者:王卓Sco、亦封 |Github位址: https://github.com/wleelw/Hexo-theme-solitude |版本:v1.4.3 😄' + +aside: + postcount: '文章數:' + pv: '瀏覽量:' + uv: '訪客數:' + runtime: '運行時間:' + updatetime: '最後更新:' + wordcount: '字數統計:' + toc: 文章目錄 + tagmore: 查看全部 + avatar: 头像 + sticker: 心情贴纸 + newpost: 最近发布 + +console: + comment_tip: 互動 + comment_title: 評論 + tag_tip: 標籤 + tag_title: 標籤 + switch_darkmode: 昼夜切換 + switch_hideAside: 边栏显示控制 + switch_keyboard: 鍵盤快捷鍵 + switch_music: 音樂開關 + archive_unit: 篇 + +sidebar: + title1: 功能 + title2: 標籤 + darkmode: 顯示模式 + +footer: + description: 來自${title}的文章 + learnmore: 了解更多 + randomlink: 友鏈 + rss: 訂閱 + theme: 主題 + +cookies: + title: 協議提醒助手 + tip: 查看本站為你的個人隱私做出的努力 + privacy: 本站如何保護你的隱私 + +music: + hit: 音樂已暫停 + +rightmenu: + copytext: 複製選中文本 + pastetext: 粘貼文本 + commenttext: 引用到評論 + newwindow: 新窗口打開 + copylink: 複製連結位址 + copyimg: 複製此圖片 + downloadimg: 下載此圖片 + search: 站內搜索 + music: + toggle: 播放音樂 + back: 切換到上一首 + forward: 切換到下一首 + playlist: 查看所有歌曲 + copyMusicName: 複製歌名 + randomPost: 随便逛逛 + categories: 文章分類 + tags: 文章標籤 + copyaddress: 複製位址 + commentBarrage: 關閉熱評 + dark: 深色模式 + light: 淺色模式 + chs_to_cht: 轉為繁體 + cht_to_chs: 转为简体 \ No newline at end of file diff --git a/layout/includes/footer.pug b/layout/includes/footer.pug index 6c6d4c67..ec844e80 100644 --- a/layout/includes/footer.pug +++ b/layout/includes/footer.pug @@ -51,7 +51,7 @@ div#footer-bar div.footer-bar-right if theme.footer.rss a.footer-bar-link(href=theme.footer.rss)= _p('footer.rss') - a.footer-bar-link(href="https://github.com/DuoSco/hexo-theme-solitude")= _p('footer.theme') + a.footer-bar-link(href="https://github.com/wleelw/hexo-theme-solitude")= _p('footer.theme') if theme.site && theme.site.icp a.footer-bar-link(href=theme.site.icp_url || "https://beian.miit.gov.cn/#/Integrated/index")= theme.site.icp a.footer-bar-link.cc(href=theme.footer.license) diff --git a/layout/includes/head/config.pug b/layout/includes/head/config.pug index 25f9c87d..e27087df 100644 --- a/layout/includes/head/config.pug +++ b/layout/includes/head/config.pug @@ -22,6 +22,14 @@ } } + let translate = 'undefined'; + if (theme.translate && theme.translate.enable) { + translate = JSON.stringify({ + defaultEncoding: theme.translate.defaultEncoding, + translateDelay: theme.translate.translateDelay, + }) + } + const commentInfoStart = theme.comment.randomInfoStart.map(item => `"${item}"`) || "" const commentInfoEnd = theme.comment.randomInfoEnd.map(item => `"${item}"`) || "" var sayhello2 = theme.aside.card.sayhello2.map(item => `"${item}"`) || [] @@ -64,6 +72,10 @@ script. empty: '!{_p('search.empty')}', hit: '!{_p('search.hit')}', placeholder: '!{_p('search.placeholder')}', + }, + chs: { + chs_to_cht: '!{_p('chs.chs_tw')}', + cht_to_chs: '!{_p('chs.chs_cn')}', } }, aside: { @@ -93,7 +105,7 @@ script. url: '!{theme.comment.waline.envId}', } }, - lightbox: '!{ theme.mediumZoom ? "mediumZoom" : (theme.fancybox ? "fancybox" : "null" )}', + lightbox: '!{ theme.mediumZoom ? "mediumZoom" : (theme.fancybox ? "fancybox" : "null")}', rightside: { enable: !{theme.rightside.enable} }, @@ -105,5 +117,6 @@ script. }, music: { enable: !{theme.music.enable}, - } + }, + translate: !{translate}, } \ No newline at end of file diff --git a/layout/includes/inject/body.pug b/layout/includes/inject/body.pug index e5236548..22294076 100644 --- a/layout/includes/inject/body.pug +++ b/layout/includes/inject/body.pug @@ -6,6 +6,18 @@ div if theme.album.enable script(src=url_for(theme.cdn.macy_js)) + if theme.rightside.enable + include ../widgets/rightside/index + script(src=url_for(theme.cdn.rightside_js)) + + if theme.display_mode.universe + script(src=url_for(theme.cdn.universe_js)) + script. + dark() + + if theme.translate.enable + script(src=url_for(theme.cdn.translate)) + mixin katex link(rel="stylesheet", href=url_for(theme.cdn.katex)) if theme.katex.copytex @@ -37,10 +49,6 @@ div if theme.says.home_mini script(src=url_for(theme.cdn.swiper_js)) - if theme.rightside.enable - include ../widgets/rightside/index - script(src=url_for(theme.cdn.rightside_js)) - // post-ai) if theme.post_ai.enable script(src=url_for(theme.cdn.sco_ai_js)) diff --git a/layout/includes/layout.pug b/layout/includes/layout.pug index 367bfa2d..539c4413 100644 --- a/layout/includes/layout.pug +++ b/layout/includes/layout.pug @@ -5,6 +5,10 @@ html(lang=config.language, data-theme="light") head include ./head.pug body#body(data-type=page.type) + // universe + if theme.display_mode.universe + canvas#universe + // loading if theme.loading.fullpage include ./loading.pug diff --git a/layout/includes/page/album.pug b/layout/includes/page/album.pug index 36dc17cf..f87e96cf 100644 --- a/layout/includes/page/album.pug +++ b/layout/includes/page/album.pug @@ -1,7 +1,7 @@ include ../widgets/page/banner - var gallery = site.data.gallery.gallery -- var album = gallery.find(item => item.album = page.album) +- var album = gallery.find(item => item.album === page.album) - var {limit} = theme.album if album @@ -11,12 +11,7 @@ if album script. function initGallery() { let macy = Macy({ container: '#sco-container', trueOrder: false, waitForImages: true, margin: 5, columns: !{limit}, breakAt: { 1200: 5, 940: 3, 520: 2, 400: 1 }}) - macy.runOnImageLoad(function () { - setTimeout(function () { - GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll(".sco-gallery-item img")); - macy.recalculate(true) - }, 500); - }, true) + macy.runOnImageLoad(function () { setTimeout(function () { GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll(".sco-gallery-item img")); macy.recalculate(true); }, 500); }, true) } (async function () { await fetch('!{url_for(album.json)}') @@ -24,14 +19,7 @@ if album .then(data => { let html = '' data = data.sort((a, b) => b.date - a.date) - data.forEach(item => { - html += ` - - ` - }) + data.forEach(item => { html += `` }) document.querySelector('#sco-container').innerHTML = html GLOBAL_CONFIG.lazyload.enable && utils.lazyloadImg(); initGallery() @@ -46,11 +34,6 @@ if album script. function initGallery(){ let macy = Macy({ container: '#sco-container', trueOrder: false, waitForImages: true, margin: 5, columns: !{limit}, breakAt: { 1200: 5, 940: 3, 520: 2, 400: 1 }}) - macy.runOnImageLoad(function () { - setTimeout(function () { - GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll(".sco-gallery-item img")); - macy.recalculate(true) - }, 500); - }, true) + macy.runOnImageLoad(function () { setTimeout(function () { GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll(".sco-gallery-item img")); macy.recalculate(true); }, 500); }, true) } document.addEventListener('DOMContentLoaded', initGallery); \ No newline at end of file diff --git a/layout/includes/page/music.pug b/layout/includes/page/music.pug index 360177b6..07434b75 100644 --- a/layout/includes/page/music.pug +++ b/layout/includes/page/music.pug @@ -13,7 +13,4 @@ if theme.music.enable volume: #{theme.music.volume}, mutex: #{theme.music.mutex} } - } - -else - include not_configured \ No newline at end of file + } \ No newline at end of file diff --git a/layout/includes/page/not_configured.pug b/layout/includes/page/not_configured.pug deleted file mode 100644 index afeedcc7..00000000 --- a/layout/includes/page/not_configured.pug +++ /dev/null @@ -1,18 +0,0 @@ -style. - .not-configured { - display: flex; - justify-content: center; - font-size: 18px; - font-weight: bold; - height: 80vh; - align-items: center - } - .not-configured strong { - padding: 0 4px; - border-bottom: 2px dotted var(--sco-lighttext) - } - -.not-configured - .title 请前往 - strong 主题配置文件 - | 进行配置 \ No newline at end of file diff --git a/layout/includes/page/says.pug b/layout/includes/page/says.pug index 9f50b162..de004a95 100644 --- a/layout/includes/page/says.pug +++ b/layout/includes/page/says.pug @@ -14,6 +14,4 @@ if theme.says.enable if theme.says.strip === -1 | - 已展开所有短文 - else - | - 只展示最近 #{theme.says.strip} 条短文 - -else - include ./not_configured.pug \ No newline at end of file + | - 只展示最近 #{theme.says.strip} 条短文 - \ No newline at end of file diff --git a/layout/includes/widgets/home/bb/json.pug b/layout/includes/widgets/home/bb/json.pug index f42368b4..5445b2fc 100644 --- a/layout/includes/widgets/home/bb/json.pug +++ b/layout/includes/widgets/home/bb/json.pug @@ -17,6 +17,7 @@ script. return `
${content}
`; }).join(''); - sco.initbbtalk(); + document.addEventListener('DOMContentLoaded', sco.initbbtalk) + document.addEventListener('pjax:complete', sco.initbbtalk) }).catch(err => console.log('bbtime |', err)); }(); \ No newline at end of file diff --git a/layout/includes/widgets/home/bb/local.pug b/layout/includes/widgets/home/bb/local.pug index 7d319063..4939dab5 100644 --- a/layout/includes/widgets/home/bb/local.pug +++ b/layout/includes/widgets/home/bb/local.pug @@ -12,6 +12,5 @@ each item, i in site.data.essay.essay_list.slice(0, 10) if item.link i.scoicon.sco-links script. - document.addEventListener('DOMContentLoaded', function () { - sco.initbbtalk() - }) \ No newline at end of file + document.addEventListener('DOMContentLoaded', sco.initbbtalk) + document.addEventListener('pjax:complete', sco.initbbtalk) \ No newline at end of file diff --git a/layout/includes/widgets/home/bb/memos.pug b/layout/includes/widgets/home/bb/memos.pug index 72885646..ade4a440 100644 --- a/layout/includes/widgets/home/bb/memos.pug +++ b/layout/includes/widgets/home/bb/memos.pug @@ -19,7 +19,8 @@ script. return `
${content+aplayer+video+imageBox+link}
` }).join(' ') - sco.initbbtalk() + document.addEventListener('DOMContentLoaded', sco.initbbtalk) + document.addEventListener('pjax:complete', sco.initbbtalk) }) .catch(error => console.error('bbtime | ', error)); }() \ No newline at end of file diff --git a/layout/includes/widgets/page/about/authorinfo.pug b/layout/includes/widgets/page/about/authorinfo.pug index 9e220f50..03fbd671 100644 --- a/layout/includes/widgets/page/about/authorinfo.pug +++ b/layout/includes/widgets/page/about/authorinfo.pug @@ -10,4 +10,4 @@ if authorinfo .author-tag-right each tag in authorinfo.rightTags span.author-tag= tag -.author-title= authorinfo.title \ No newline at end of file +.author-title= site.data.about.title \ No newline at end of file diff --git a/layout/includes/widgets/page/about/hobbies.pug b/layout/includes/widgets/page/about/hobbies.pug index 4719aa1e..1f2e2338 100644 --- a/layout/includes/widgets/page/about/hobbies.pug +++ b/layout/includes/widgets/page/about/hobbies.pug @@ -1,5 +1,5 @@ -- var game1 = game1 -- var game2 = game2 +- var game1 = site.data.about.game1 +- var game2 = site.data.about.game2 if game1 || game2 .author-content diff --git a/layout/includes/widgets/page/about/motto.pug b/layout/includes/widgets/page/about/motto.pug index b1771c65..829cab53 100644 --- a/layout/includes/widgets/page/about/motto.pug +++ b/layout/includes/widgets/page/about/motto.pug @@ -3,18 +3,20 @@ if motto || expertise .author-content - .author-content-item.maxim - .author-content-item-tips= motto.title - span.maxim-title - span= motto.prefix - span= motto.content - .author-content-item.buff - .card-content - .author-content-item-tips= expertise.title - span.buff-title - span - | #{expertise.prefix} - span.inline-word= expertise.specialist - span - | #{expertise.content} - span.inline-word= expertise.level \ No newline at end of file + if motto + .author-content-item.maxim + .author-content-item-tips= motto.title + span.maxim-title + span= motto.prefix + span= motto.content + if expertise + .author-content-item.buff + .card-content + .author-content-item-tips= expertise.title + span.buff-title + span + | #{expertise.prefix} + span.inline-word= expertise.specialist + span + | #{expertise.content} + span.inline-word= expertise.level \ No newline at end of file diff --git a/layout/includes/widgets/page/about/skillsinfo.pug b/layout/includes/widgets/page/about/skillsinfo.pug index ae636107..18adac1b 100644 --- a/layout/includes/widgets/page/about/skillsinfo.pug +++ b/layout/includes/widgets/page/about/skillsinfo.pug @@ -1,40 +1,42 @@ - var skills = site.data.about.skills - var careers = site.data.about.careers -if skills || caches +if skills || careers .author-content - .author-content-item.skills - .card-content - .author-content-item-tips= skills.title - span.author-content-item-title= skills.subtitle - .skills-style-group - .tags-group-all - .tags-group-wrapper - each i in [1,2] - - var pair = [] - each tag, index in skills.tags - - pair.push(tag) - if pair.length === 2 || index === skills.tags.length - 1 - .tags-group-icon-pair - each item in pair - .tags-group-icon(style=`background:${item.color}`) - img(src=item.icon, title=item.title) - - pair = [] - .skills-list - each tag in skills.tags - .skill-info - .skill-icon(style=`background:${tag.color}`) - img(src=tag.icon, title=tag.title) - .skill-name - span= tag.title - .etc ... - .author-content-item.careers - .card-content - .author-content-item-tips= careers.title - span.author-content-item-title= careers.subtitle - .careers-group - each item in careers.items - .careers-item - .circle(style=`background:${item.color}`) - .name= `${item.school}, ${item.major}` - img.author-content-img(src=careers.image, alt=careers.title) \ No newline at end of file + if skills + .author-content-item.skills + .card-content + .author-content-item-tips= skills.title + span.author-content-item-title= skills.subtitle + .skills-style-group + .tags-group-all + .tags-group-wrapper + each i in [1,2] + - var pair = [] + each tag, index in skills.tags + - pair.push(tag) + if pair.length === 2 || index === skills.tags.length - 1 + .tags-group-icon-pair + each item in pair + .tags-group-icon(style=`background:${item.color}`) + img(src=item.icon, title=item.title) + - pair = [] + .skills-list + each tag in skills.tags + .skill-info + .skill-icon(style=`background:${tag.color}`) + img(src=tag.icon, title=tag.title) + .skill-name + span= tag.title + .etc ... + if careers + .author-content-item.careers + .card-content + .author-content-item-tips= careers.title + span.author-content-item-title= careers.subtitle + .careers-group + each item in careers.items + .careers-item + .circle(style=`background:${item.color}`) + .name= `${item.school}, ${item.major}` + img.author-content-img(src=careers.image, alt=careers.title) \ No newline at end of file diff --git a/layout/includes/widgets/page/about/tenyear.pug b/layout/includes/widgets/page/about/tenyear.pug index 3a42d20d..8ee27d37 100644 --- a/layout/includes/widgets/page/about/tenyear.pug +++ b/layout/includes/widgets/page/about/tenyear.pug @@ -37,7 +37,7 @@ if tenyear progressElement.style.setProperty("--progress-percentage", progressPercentage); if(progress > 5){ percentageLabelElement.textContent = `${progress.toFixed(0)}%`; - percentageLabelElement.style.left = `calc(${progress}% - 28px)`; + percentageLabelElement.style.left = `calc(${progress}% - 35px)`; } } diff --git a/layout/includes/widgets/page/says/json.pug b/layout/includes/widgets/page/says/json.pug index 40afd33a..c480305e 100644 --- a/layout/includes/widgets/page/says/json.pug +++ b/layout/includes/widgets/page/says/json.pug @@ -26,9 +26,9 @@ case theme.says.style
- +
- ${item.link ? `链接` : ''} + ${item.link ? `链接` : ''}
${item.content ? `` : ''} @@ -59,7 +59,7 @@ case theme.says.style
#{config.author} - +
${item.content ? `` : ''} diff --git a/layout/includes/widgets/page/says/local.pug b/layout/includes/widgets/page/says/local.pug index 9b894a5f..0fee3374 100644 --- a/layout/includes/widgets/page/says/local.pug +++ b/layout/includes/widgets/page/says/local.pug @@ -36,7 +36,7 @@ each item in site.data.essay.essay_list.slice(0, theme.says.strip) i.scoicon.sco-calendar-todo-fill time.datetime(datetime=moment(item.date).format()) if item.link - a.bber-content-link(href=url_for(item.link) title="跳转到短文指引的链接") + a.bber-content-link(href=url_for(item.link) title="跳转到短文指引的链接" target="_blank") i.scoicon.sco-link-m-line | 链接 if item.content diff --git a/layout/includes/widgets/rightside/index.pug b/layout/includes/widgets/rightside/index.pug index f61ad0b5..ba215df2 100644 --- a/layout/includes/widgets/rightside/index.pug +++ b/layout/includes/widgets/rightside/index.pug @@ -11,66 +11,77 @@ div#rightMenu div.rightMenu-group.rightMenu-line.rightMenuPlugin div.rightMenu-item#menu-copytext i.scoicon.sco-copy-fill - span 复制选中文本 + span= _p('rightmenu.copytext') div.rightMenu-item#menu-pastetext i.scoicon.sco-clipboard-fill - span 粘贴文本 + span= _p('rightmenu.pastetext') if theme.comment.enable a.rightMenu-item#menu-commenttext i.scoicon.sco-chat-new-fill - span 引用到评论 + span= _p('rightmenu.commenttext') div.rightMenu-item#menu-newwindow i.scoicon.sco-window-fill - span 新窗口打开 + span= _p('rightmenu.newwindow') div.rightMenu-item#menu-copylink i.scoicon.sco-link-line - span 复制链接地址 + span= _p('rightmenu.copylink') div.rightMenu-item#menu-copyimg i.scoicon.sco-copy-fill - span 复制此图片 + span= _p('rightmenu.copyimg') div.rightMenu-item#menu-downloadimg i.scoicon.sco-download-cloud-fill - span 下载此图片 + span= _p('rightmenu.downloadimg') div.rightMenu-item#menu-search i.scoicon.sco-search-line - span 站内搜索 - div.rightMenu-item#menu-searchBaidu - i.scoicon.sco-baidu-fill - span 百度搜索 + span= _p('rightmenu.search') div.rightMenu-item#menu-music-toggle i.scoicon.sco-play-fill - span 播放音乐 + span= _p('rightmenu.music.toggle') div.rightMenu-item#menu-music-back i.scoicon.sco-skip-back-fill - span 切换到上一首 + span= _p('rightmenu.music.back') div.rightMenu-item#menu-music-forward i.scoicon.sco-skip-forward-fill - span 切换到下一首 + span= _p('rightmenu.music.forward') div.rightMenu-item#menu-music-playlist(onclick=`window.open('${theme.capsule.server === 'tencent' ? `https://y.qq.com/n/ryqq/playlist/${theme.capsule.id}` : `https://music.163.com/#/playlist?id=${theme.capsule.id}`}', '_blank');`) i.scoicon.sco-play-list-2-line - span 查看所有歌曲 + span= _p('rightmenu.music.playlist') div.rightMenu-item#menu-music-copyMusicName i.scoicon.sco-copy-fill - span 复制歌名 + span= _p('rightmenu.music.copyMusicName') div.rightMenu-group.rightMenu-line.rightMenuOther a.rightMenu-item.menu-Link#menu-randomPost i.scoicon.sco-signal-tower-fill - span 随便逛逛 + span= _p('rightmenu.randomPost') a.rightMenu-item.menu-link(href="/categories/") i.scoicon.sco-checkbox-multiple-blank-fill - span 博客分类 + span= _p('rightmenu.categories') a.rightMenu-item.menu-link(href="/tags/") i.scoicon.sco-price-tag-fill - span 文章标签 + span= _p('rightmenu.tags') div.rightMenu-group.rightMenu-line.rightMenuOther div.rightMenu-item#menu-copy i.scoicon.sco-external-link-fill - span 复制地址 + span= _p('rightmenu.copyaddress') if theme.comment.enable && theme.comment.commentBarrage div.rightMenu-item#menu-commentBarrage i.scoicon.sco-chat-fill - span.menu-commentBarrage-text 关闭热评 + span.menu-commentBarrage-text= _p('rightmenu.commentBarrage') div.rightMenu-item#menu-darkmode i.scoicon.sco-moon-clear-fill - span.menu-darkmode-text 深色模式 + case theme.display_mode.type + when 'auto' + when 'light' + span.menu-darkmode-text= _p('rightmenu.dark') + when 'dark' + span.menu-darkmode-text= _p('rightmenu.light') + if theme.translate.enable + div.rightMenu-item#menu-translate + case theme.translate.defaultEncoding + when 2 + i.scoicon.sco-panben-line + span= _p('rightmenu.chs_to_cht') + when 1 + i.scoicon.sco-jianben-line + span= _p('rightmenu.cht_to_chs') div#rightmenu-mask \ No newline at end of file diff --git a/package.json b/package.json index 253859dd..f44f309b 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-solitude", - "version": "1.4.2", + "version": "1.4.3", "description": "A beautiful, powerful, and efficient Hexo theme developed by the DuoSco team", "main": "package.json", "scripts": { diff --git a/plugins.yml b/plugins.yml index 94ca54a8..41c1e03d 100644 --- a/plugins.yml +++ b/plugins.yml @@ -90,11 +90,15 @@ snackbar: scoicon_css: name: solitude-source file: icon/scoicon.min.css - version: 1.0.3 + version: 1.0.5 waterfall: name: solitude-source file: js/waterfall.min.js - version: 1.0.3 + version: 1.0.5 +universe_js: + name: solitude-source + file: js/universe.min.js + version: 1.0.5 medium_zoom: name: medium-zoom file: dist/medium-zoom.min.js diff --git a/scripts/event/cdn.js b/scripts/event/cdn.js index 41025db6..06c48b62 100644 --- a/scripts/event/cdn.js +++ b/scripts/event/cdn.js @@ -54,6 +54,11 @@ hexo.extend.filter.register('before_generate', () => { file: 'js/music.js', version }, + translate:{ + name: 'hexo-theme-solitude', + file: 'js/tw_cn.js', + version + }, sco_ai_js: { name: 'hexo-theme-solitude', file: 'js/sco-ai.min.js', diff --git a/scripts/event/init.js b/scripts/event/init.js index 7bf24e2a..4894ad98 100644 --- a/scripts/event/init.js +++ b/scripts/event/init.js @@ -1,22 +1,21 @@ hexo.extend.filter.register('before_generate', () => { - // Get first two digits of the Hexo version number - const hexoVer = hexo.version.replace(/(^.*\..*)\..*/, '$1') - const nodeVer = process.version.replace(/^v/, ''); - const [majorVer] = nodeVer.split('.'); - const logger = hexo.log, config = hexo.config - - if (hexoVer < 5.3) { - logger.error('请把 Hexo 升级到 V5.3.0 或更高的版本!') - process.exit(-1) - } + const hexoVer = hexo.version.replace(/(^.*\..*)\..*/, '$1') + const nodeVer = process.version.replace(/^v/, ''); + const [majorVer] = nodeVer.split('.'); + const logger = hexo.log, config = hexo.config + + if (hexoVer < 6.3) { + logger.error('请把 Hexo 升级到 V6.3.0 或更高的版本!') + process.exit(-1) + } - if(config.prismjs.enable){ - logger.error('主题尚未支持 prismjs 请使用 highlightjs !') - process.exit(-1) + if (config.prismjs.enable) { + logger.error('主题尚未支持 prismjs 请使用 highlightjs !') + process.exit(-1) + } + if (Number(majorVer) < 14) { + logger.error('请将 Node.js 升级到 v14.0.0 或更高的版本!'); + process.exit(-1); + } } - if (Number(majorVer) < 14) { - logger.error('请将 Node.js 升级到 v14.0.0 或更高的版本!'); - process.exit(-1); - } - } - ) \ No newline at end of file +) \ No newline at end of file diff --git a/scripts/event/page.js b/scripts/event/page.js index 8de1d46b..b4ff82bd 100644 --- a/scripts/event/page.js +++ b/scripts/event/page.js @@ -1,4 +1,3 @@ -// generate 404 Page hexo.extend.generator.register('404', function (locals) { if(!this.theme.config.page.error)return return { @@ -10,8 +9,6 @@ hexo.extend.generator.register('404', function (locals) { } } }) - -// generate tags Page hexo.extend.generator.register('tags', function(locals) { if(!this.theme.config.page.tags)return return { @@ -23,8 +20,6 @@ hexo.extend.generator.register('tags', function(locals) { } }; }); - -// generate categories Page hexo.extend.generator.register('categories', function(locals) { if(!this.theme.config.page.categories)return return { diff --git a/scripts/filter/checkThemeConfig.js b/scripts/filter/checkThemeConfig.js index f788aa2c..1a7dc41c 100644 --- a/scripts/filter/checkThemeConfig.js +++ b/scripts/filter/checkThemeConfig.js @@ -1,12 +1,28 @@ 'use strict'; hexo.extend.filter.register('before_post_render', () => { - const logger = hexo.log; - const theme = hexo.theme.config; - if (theme.hometop.banner.enable && !theme.hometop.banner.icon) { - logger.error('\n 启用banner的情况下,必须提供 icon 图片!\n 请在主题配置文件中设置 hometop.banner.icon 选项。'); - logger.error('\n If banner is enabled, icon image must be supplied! \n Please set the hometop.banner.icon option in the theme configuration file.'); - process.exit(-1); + const data = hexo.locals.get('data'); + const logger = hexo.log; + const theme = hexo.theme.config; + if (theme.hometop.banner.enable && !theme.hometop.banner.icon) { + logger.error('\n 启用banner的情况下,必须提供 icon 图片!\n 请在主题配置文件中设置 hometop.banner.icon 选项。'); + logger.error('\n If banner is enabled, icon image must be supplied! \n Please set the hometop.banner.icon option in the theme configuration file.'); + process.exit(-1); + } + if (theme.says.enable && theme.says.mode === 'local' && !data.essay) { + logger.error('\n 启用说说的情况下,必须提供 essay 数据文件!\n 请新建 essay.yaml。'); + logger.error('\n If says is enabled, essay data must be supplied! \n Please create essay.yaml.'); + process.exit(-1); + } + if (theme.footer.randomlink && !data.links){ + logger.error('\n 启用随机链接的情况下,必须提供 links 数据!\n 请新建 links.yaml。'); + logger.error('\n If randomlink is enabled, links data must be supplied! \n Please create links.yaml.'); + process.exit(-1); + } + if (theme.lightbox && !theme.fancybox && !theme.mediumZoom){ + logger.error('\n 启用 lightbox 的情况下,必须提供 fancybox 或 mediumZoom 选项!\n 请在主题配置文件中设置 fancybox 或 mediumZoom 选项。'); + logger.error('\n If lightbox is enabled, fancybox or mediumZoom option must be supplied! \n Please set the fancybox or mediumZoom option in the theme configuration file.'); + process.exit(-1); + } } -} ); \ No newline at end of file diff --git a/scripts/helper/cdn.js b/scripts/helper/cdn.js deleted file mode 100644 index f82c1f47..00000000 --- a/scripts/helper/cdn.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -hexo.extend.helper.register('cdn_url_for', function(path) { - const {config, theme} = this - const cdnPrefix = theme.cdn.prefix; - const urlFor = hexo.extend.helper.get('url_for').bind(this); - if (cdnPrefix) { - return cdnPrefix + urlFor(path); - } else { - return urlFor(path); - } -}); \ No newline at end of file diff --git a/scripts/helper/related_post.js b/scripts/helper/related_post.js index 7bb9f11d..4c94e0e0 100644 --- a/scripts/helper/related_post.js +++ b/scripts/helper/related_post.js @@ -1,9 +1,3 @@ -/** - * Solitude - * Related Posts - * According the tag - */ - 'use strict' hexo.extend.helper.register('related_posts', function (currentPost, allPosts) { diff --git a/scripts/helper/stylus.js b/scripts/helper/stylus.js index 1f48cbb9..f2ca56cb 100644 --- a/scripts/helper/stylus.js +++ b/scripts/helper/stylus.js @@ -1,13 +1,12 @@ hexo.extend.filter.register('stylus:renderer', function (style) { const {config, theme} = this + const data = hexo.locals.get('data'); - // 侧边栏标签高亮 if (theme.config.aside.tags.highlight) { let array = theme.config.aside.tags.list.map(item => encodeURIComponent(item)); style.define('highlightTags', array); } - // 侧边栏加载样式控制 let aside = [ theme.config.aside.home.noSticky, theme.config.aside.home.Sticky, @@ -17,7 +16,13 @@ hexo.extend.filter.register('stylus:renderer', function (style) { theme.config.aside.page.noSticky ].join(',').split(','); let uniqueArr = [...new Set(aside)]; // 去重 - if (uniqueArr.length > 0) { // 是否为空 + if (uniqueArr.length > 0) { style.define('aside', uniqueArr); } + + if (data && data.about) { + style.define('about', Object.keys(data.about)); + } else { + style.define('about', []); + } }); \ No newline at end of file diff --git a/source/css/_layout/index.styl b/source/css/_layout/index.styl index d2650a75..df7e83b3 100644 --- a/source/css/_layout/index.styl +++ b/source/css/_layout/index.styl @@ -54,40 +54,41 @@ span.tags-punctuation::before line-height 32px // snackbar -.snackbar-container - background var(--sco-lighttext)!important - color var(--sco-card-bg)!important - border-radius 0!important +.snackbar-container + background var(--sco-lighttext) !important + color var(--sco-card-bg) !important + border-radius 0 !important display flex - justify-content center!important - max-width none!important - min-width 100%!important - margin 0!important - left 0!important - height 60px!important - transform none!important - -.snackbar-container p - color var(--sco-card-bg)!important - font-weight 700!important - text-align center!important - font-size .8rem!important - display flex!important - justify-content center!important - -.snackbar-container .action - color var(--sco-card-bg)!important - background var(--sco-lighttext)!important - padding 4px 6px!important + justify-content center !important + max-width none !important + min-width 100% !important + margin 0 !important + left 0 !important + height 60px !important + transform none !important + +.snackbar-container p + color var(--sco-card-bg) !important + font-weight 700 !important + text-align center !important + font-size .8rem !important + display flex !important + justify-content center !important + +.snackbar-container .action + color var(--sco-card-bg) !important + background var(--sco-lighttext) !important + padding 4px 6px !important font-weight 700 - border-radius 8px!important + border-radius 8px !important transition .3s - border var(--style-border)!important -.snackbar-container .action:hover - color var(--sco-lighttext)!important - background var(--sco-card-bg)!important + border var(--style-border) !important + +.snackbar-container .action:hover + color var(--sco-lighttext) !important + background var(--sco-card-bg) !important -.snackbar-container::after +.snackbar-container::after position absolute width 0 height 100% @@ -99,8 +100,27 @@ span.tags-punctuation::before animation snackbar-progress var(--sco-snackbar-time) linear forwards pointer-events none -@keyframes snackbar-progress - from +@keyframes snackbar-progress + from width 0 - to - width 100% \ No newline at end of file + to + width 100% + +// universe +if hexo-config('display_mode.universe') + #universe + display block + position fixed + margin 0 + padding 0 + border 0 + outline 0 + left 0 + top 0 + width 100% + height 100% + pointer-events none + z-index 1 + [data-theme=light] + #universe + display none \ No newline at end of file diff --git a/source/css/_page/about/index.styl b/source/css/_page/about/index.styl index a364158b..5aad6737 100644 --- a/source/css/_page/about/index.styl +++ b/source/css/_page/about/index.styl @@ -10,30 +10,40 @@ margin 1rem 0 line-height 1 -@import "tenyear" +if "tenyear" in about + @import "tenyear" -@import "author" +if "authorinfo" in about + @import "author" -@import "contentinfo" +if "contentinfo" in about + @import "contentinfo" -@import "skills" +if "skills" in about + @import "skills" -@import "oneself" +if "oneself" in about + @import "oneself" -@import "buff" +if "motto" in about + @import "buff" + @import "maxim" -@import "game" +if "game1" in about + @import "game" -@import "personalities" +if "personalities" in about + @import "personalities" + @import "myphoto" -@import "myphoto" +if "careers" in about + @import "careers" -@import "careers" +if "likes" in about + @import "like" -@import "like" +if "tj" in about + @import "statistic" -@import "maxim" - -@import "statistic" - -@import "reward" \ No newline at end of file +if "award" in about + @import "reward" \ No newline at end of file diff --git a/source/css/_page/gallery/index.styl b/source/css/_page/gallery/index.styl index f85836f2..68fc0e10 100644 --- a/source/css/_page/gallery/index.styl +++ b/source/css/_page/gallery/index.styl @@ -1,19 +1,24 @@ #gallery - width 100% + padding 16px 0 display flex flex-wrap wrap - justify-content start - padding 10px 0 + -webkit-box-pack start + justify-content flex-start + margin -8px + -webkit-box-align stretch + align-items stretch .gallery-item overflow hidden border var(--style-border-always) border-radius 12px position relative + float left display flex height 250px - width calc(100% / 3 - 10px) + width calc(100% / 3 - 16px) cursor pointer + margin 8px &:hover .cover @@ -65,7 +70,7 @@ text-wrap break-word #album - margin 22px auto 0 + margin 5px auto .locate display flex @@ -81,14 +86,12 @@ z-index 1 user-select none - #sco-container - margin-top 22px - .sco-gallery-item margin-bottom 24px overflow hidden border-radius 8px transition all .3s + border var(--style-border-always) .sco-gallery-image width 100% diff --git a/source/css/_widgets/_comment/twikoo.styl b/source/css/_widgets/_comment/twikoo.styl index ab722205..034f3703 100644 --- a/source/css/_widgets/_comment/twikoo.styl +++ b/source/css/_widgets/_comment/twikoo.styl @@ -151,7 +151,7 @@ top -132px .tk-row-actions-start - top -210px + top -170px .tk-comments-title position absolute diff --git a/source/js/rightside.js b/source/js/rightside.js index cab30181..fc556cd1 100644 --- a/source/js/rightside.js +++ b/source/js/rightside.js @@ -1,64 +1,36 @@ let rm = {}; - +const addEvent = (element, event, callback) => element.addEventListener(event, callback); rm.stopdragimg = Array.from(document.getElementsByTagName('img')); -rm.stopdragimg.forEach(function (img) { - img.addEventListener('dragstart', function () { - return false; - }); -}); - +rm.stopdragimg.forEach(img => addEvent(img, 'dragstart', () => false)); rm.showRightMenu = function (e, n = 0, t = 0) { let o = document.getElementById('rightMenu'); o.style.top = n + 'px'; o.style.left = t + 'px'; - - if (e) { - o.style.display = 'block'; - stopMaskScroll(); - } else { - o.style.display = 'none'; - } -}; - -rm.hideRightMenu = function () { - rm.showRightMenu(false); - document.getElementById('rightmenu-mask').style.display = 'none'; + o.style.display = e ? 'block' : 'none'; + e ? stopMaskScroll() : document.getElementById('rightmenu-mask').style.display = 'none'; }; - -document.querySelector("#rightMenu").style.display = "block" -rmWidth = document.querySelector("#rightMenu").offsetWidth; -rmHeight = document.querySelector("#rightMenu").offsetHeight; -document.querySelector("#rightMenu").style.display = 'none' - rm.reloadrmSize = function () { - document.querySelector("#rightMenu").style.display = "block" - rmWidth = document.querySelector("#rightMenu").offsetWidth; - rmHeight = document.querySelector("#rightMenu").offsetHeight; - document.querySelector("#rightMenu").style.display = 'none' -} - -let domhref = "", domImgSrc = "", globalEvent = null; - -function imageToBlob(e) { - const n = new Image - , t = document.createElement("canvas") - , o = t.getContext("2d"); - return n.crossOrigin = "", - n.src = e, - new Promise((e => { - n.onload = function () { - t.width = this.naturalWidth, - t.height = this.naturalHeight, - o.drawImage(this, 0, 0), - t.toBlob((n => { - e(n) - } - ), "image/png", .75) - } - } - )) + let menu = document.querySelector("#rightMenu"); + menu.style.display = "block"; + rmWidth = menu.offsetWidth; + rmHeight = menu.offsetHeight; + menu.style.display = 'none'; +} +async function imageToBlob(e) { + const n = new Image(); + const t = document.createElement("canvas"); + const o = t.getContext("2d"); + n.crossOrigin = ""; + n.src = e; + return new Promise((resolve => { + n.onload = function () { + t.width = this.naturalWidth; + t.height = this.naturalHeight; + o.drawImage(this, 0, 0); + t.toBlob((blob => resolve(blob)), "image/png", .75); + }; + })); } - async function copyImage(e) { try { const n = await imageToBlob(e); @@ -70,286 +42,31 @@ async function copyImage(e) { console.error('Failed to copy image: ', error); } } - function stopMaskScroll() { - if (document.getElementById("rightmenu-mask")) { - document.getElementById("rightmenu-mask").addEventListener("mousewheel", (function (e) { - rm.hideRightMenu() - } - ), !1) - } - if (document.getElementById("rightMenu")) { - document.getElementById("rightMenu").addEventListener("mousewheel", (function (e) { - rm.hideRightMenu() - } - ), !1) - } -} - -window.oncontextmenu = function (e) { - if (document.body.clientWidth > 768) { - let n = e.clientX + 10; - let t = e.clientY; - let o = document.getElementsByClassName('rightMenuOther'); - let i = document.getElementsByClassName('rightMenuPlugin'); - let c = document.getElementById('menu-copytext'); - let r = document.getElementById('menu-pastetext'); - let m = document.getElementById('menu-commenttext'); - let a = document.getElementById('menu-newwindow'); - let u = document.getElementById('menu-copylink'); - let l = document.getElementById('menu-copyimg'); - let h = document.getElementById('menu-downloadimg'); - let d = document.getElementById('menu-search'); - let s = document.getElementById('menu-searchBaidu'); - let g = document.getElementById('menu-music-toggle'); - let w = document.getElementById('menu-music-back'); - let f = document.getElementById('menu-music-forward'); - let p = document.getElementById('menu-music-playlist'); - let k = document.getElementById('menu-music-copyMusicName'); - let y = e.target.href; - let M = e.target.currentSrc; - let b = false; - - for (let j = 0; j < o.length; j++) { - o[j].style.display = 'block'; - } - globalEvent = e; - - if (selectTextNow && window.getSelection()) { - b = true; - c.style.display = 'block'; - m.style.display = 'block'; - d.style.display = 'block'; - s.style.display = 'block'; - } else { - c.style.display = 'none'; - m.style.display = 'none'; - s.style.display = 'none'; - d.style.display = 'none'; - } - - if (y) { - b = true; - a.style.display = 'block'; - u.style.display = 'block'; - domhref = y; - } else { - a.style.display = 'none'; - u.style.display = 'none'; - } - - if (M) { - b = true; - l.style.display = 'block'; - h.style.display = 'block'; - domImgSrc = M; - } else { - l.style.display = 'none'; - h.style.display = 'none'; - } - - if (e.target.tagName.toLowerCase() === 'input' || e.target.tagName.toLowerCase() === 'textarea') { - b = true; - r.style.display = 'block'; - } else { - r.style.display = 'none'; - } - - if (e.target.nodeName === 'METING-JS') { - b = true; - g.style.display = 'block'; - w.style.display = 'block'; - f.style.display = 'block'; - p.style.display = 'block'; - k.style.display = 'block'; - } else { - g.style.display = 'none'; - w.style.display = 'none'; - f.style.display = 'none'; - p.style.display = 'none'; - k.style.display = 'none'; - } - - if (b) { - for (let j = 0; j < o.length; j++) { - o[j].style.display = 'none'; - } - for (let j = 0; j < i.length; j++) { - i[j].style.display = 'block'; - } - } else { - for (let j = 0; j < i.length; j++) { - i[j].style.display = 'none'; - } - } - - rm.reloadrmSize(); - if (n + rmWidth > window.innerWidth) { - n -= rmWidth + 10; - } - - if (t + rmHeight > window.innerHeight) { - t -= t + rmHeight - window.innerHeight; - } - rm.showRightMenu(true, t, n); - document.getElementById('rightmenu-mask').style.display = 'flex'; - - return false; - } -}; -rm.downloadimging = !1 -rm.writeClipImg = function (e) { - const n = "localhost" === window.location.hostname || "127.0.0.1" === window.location.hostname ? 0 : 1e4; - rm.hideRightMenu(); - utils.snackbarShow("正在下载中,请稍后", !1, n); - if (0 == rm.downloadimging) { - rm.downloadimging = !0; + addEvent(document.getElementById("rightmenu-mask"), "mousewheel", rm.hideRightMenu); + addEvent(document.getElementById("rightMenu"), "mousewheel", rm.hideRightMenu); +} +rm.downloadimging = false; +rm.writeClipImg = async function (e) { + if (!rm.downloadimging) { + rm.downloadimging = true; + utils.snackbarShow("正在下载中,请稍后", false, 10000); + rm.hideRightMenu(); setTimeout(async function () { await copyImage(e); utils.snackbarShow("复制成功!图片已添加盲水印,请遵守版权协议"); - rm.downloadimging = !1; + rm.downloadimging = false; }, 1000); } -} - -rm.switchDarkMode = function () { - sco.switchDarkMode() - rm.hideRightMenu() -} - +}; rm.copyUrl = function (e) { - var n = e; - var t = document.createElement('input'); - t.id = 'copyVal'; + const t = document.createElement('input'); + t.value = e; document.body.appendChild(t); - t.value = n; t.select(); - t.setSelectionRange(0, t.value.length); document.execCommand('copy'); document.body.removeChild(t); -} - -rm.rightmenuCopyText = function (e) { - navigator.clipboard && navigator.clipboard.writeText(e), - utils.snackbarShow("复制文本成功", !1, 2e3), - rm.hideRightMenu() -} - -rm.copyPageUrl = function () { - var e = window.location.href; - rm.copyUrl(e), - utils.snackbarShow("复制本页链接地址成功", !1, 2e3), - rm.hideRightMenu() -} - -rm.sharePage = function () { - window; - rm.copyUrl(url), - utils.snackbarShow("复制本页链接地址成功", !1, 2e3), - rm.hideRightMenu() -} - -var selectTextNow = ""; - -function selceText() { - var e; - e = document.selection ? document.selection.createRange().text : window.getSelection() + "", - selectTextNow = e || "" -} - -function replaceAll(e, n, t) { - return e.split(n).join(t) -} - -function addRightMenuClickEvent() { - document.getElementById('menu-backward').addEventListener('click', function () { - window.history.back(); - rm.hideRightMenu(); - }); - - document.getElementById('menu-forward').addEventListener('click', function () { - window.history.forward(); - rm.hideRightMenu(); - }); - - document.getElementById('menu-refresh').addEventListener('click', function () { - window.location.reload(); - }); - - document.getElementById('menu-top').addEventListener('click', function () { - utils.scrollToDest(0, 500); - rm.hideRightMenu(); - }); - - Array.from(document.getElementsByClassName('menu-link')).forEach(function (element) { - element.addEventListener('click', rm.hideRightMenu); - }); - - var menuDarkmode = document.getElementById('menu-darkmode'); - menuDarkmode.onclick = null; - menuDarkmode.addEventListener('click', rm.switchDarkMode); - - document.getElementById('menu-randomPost').addEventListener('click', function () { - toRandomPost(); - }); - - if (GLOBAL_CONFIG.comment.commentBarrage) { - const menuCommentBarrage = document.getElementById('menu-commentBarrage'); - menuCommentBarrage.onclick = null; - menuCommentBarrage.addEventListener('click', sco.switchCommentBarrage); - } - - var rightmenuMask = document.getElementById('rightmenu-mask'); - rightmenuMask.addEventListener('click', rm.hideRightMenu); - rightmenuMask.addEventListener('contextmenu', function () { - rm.hideRightMenu(); - return false; - }); - - document.getElementById('menu-copy').addEventListener('click', rm.copyPageUrl); - document.getElementById('menu-pastetext').addEventListener('click', rm.pasteText); - - document.getElementById('menu-copytext').addEventListener('click', function () { - rm.rightmenuCopyText(selectTextNow); - utils.snackbarShow("复制成功,复制和转载请标注本文地址"); - }); - - document.getElementById('menu-commenttext').addEventListener('click', function () { - rm.rightMenuCommentText(selectTextNow); - }); - - document.getElementById('menu-newwindow').addEventListener('click', function () { - window.open(domhref); - rm.hideRightMenu(); - }); - - document.getElementById('menu-copylink').addEventListener('click', rm.copyLink); - - document.getElementById('menu-downloadimg').addEventListener('click', function () { - sco.downloadImage(domImgSrc); - }); - - document.getElementById('menu-copyimg').addEventListener('click', function () { - rm.writeClipImg(domImgSrc); - }); - - document.getElementById('menu-searchBaidu').addEventListener('click', rm.searchBaidu); - - document.getElementById('menu-music-toggle').addEventListener('click', sco.musicToggle); - document.getElementById('menu-music-back').addEventListener('click', sco.musicSkipBack); - document.getElementById('menu-music-forward').addEventListener('click', sco.musicSkipForward); - - document.getElementById('menu-music-copyMusicName').addEventListener('click', function () { - rm.rightmenuCopyText(sco.musicGetName()); - utils.snackbarShow("复制歌曲名称成功", false, 3000); - }); -} - -document.onmouseup = document.ondbclick = selceText -rm.readClipboard = function () { - navigator.clipboard && navigator.clipboard.readText().then((e => rm.insertAtCaret(globalEvent.target, e))) -} - +}; rm.insertAtCaret = function (e, n) { const t = e.selectionStart , o = e.selectionEnd; @@ -357,8 +74,8 @@ rm.insertAtCaret = function (e, n) { e.focus(), document.selection.createRange().text = n, e.focus(); - else if (t || "0" == t) { - var i = e.scrollTop; + else if (t || "0" === t) { + let i = e.scrollTop; e.value = e.value.substring(0, t) + n + e.value.substring(o, e.value.length), e.focus(), e.selectionStart = t + n.length, @@ -368,15 +85,9 @@ rm.insertAtCaret = function (e, n) { e.value += n, e.focus() } - -rm.pasteText = function () { - rm.readClipboard(); - rm.hideRightMenu() -} - rm.rightMenuCommentText = function (e) { rm.hideRightMenu(); - var n = document.getElementsByClassName("el-textarea__inner")[0]; + let n = document.getElementsByClassName("el-textarea__inner")[0]; let t = document.createEvent("HTMLEvents"); t.initEvent("input", !0, !0); let o = replaceAll(e, "\n", "\n> "); @@ -388,17 +99,123 @@ rm.rightMenuCommentText = function (e) { n.setSelectionRange(-1, -1), document.getElementById("comment-tips") && document.getElementById("comment-tips").classList.add("show") } - -rm.searchBaidu = function () { - utils.snackbarShow("即将跳转到百度搜索", !1, 2e3); - setTimeout((function () { - window.open("https://www.baidu.com/s?wd=" + selectTextNow) +rm.hideRightMenu = () => rm.showRightMenu(false) || (document.getElementById('rightmenu-mask').style.display = 'none') +document.querySelector("#rightMenu").style.display = "block" +rmWidth = document.querySelector("#rightMenu").offsetWidth; +rmHeight = document.querySelector("#rightMenu").offsetHeight; +document.querySelector("#rightMenu").style.display = 'none' +let domhref = "", domImgSrc = "", globalEvent = null; +rm.switchDarkMode = () => sco.switchDarkMode() || rm.hideRightMenu() +rm.rightmenuCopyText = (e) => navigator.clipboard && navigator.clipboard.writeText(e) || utils.snackbarShow("复制文本成功", !1, 2e3) || rm.hideRightMenu() +rm.copyPageUrl = () => rm.copyUrl(window.location.href) || utils.snackbarShow("复制本页链接地址成功", !1, 2e3) || rm.hideRightMenu() +rm.sharePage = () => rm.copyUrl(url) || utils.snackbarShow("复制本页链接地址成功", !1, 2e3) || rm.hideRightMenu() +var selectTextNow = ""; +let selceText = () => selectTextNow = document.selection ? document.selection.createRange().text : window.getSelection() + "" || "" +let replaceAll = (e, n, t) => e.split(n).join(t); +document.onmouseup = document.ondbclick = selceText +rm.readClipboard = () => navigator.clipboard && navigator.clipboard.readText().then((e => rm.insertAtCaret(globalEvent.target, e))) +rm.pasteText = () => rm.readClipboard() || rm.hideRightMenu() +rm.copyLink = () => rm.rightmenuCopyText(domhref) || utils.snackbarShow("已复制链接地址") +window.oncontextmenu = function (e) { + if (document.body.clientWidth <= 768) return; + let n = e.clientX + 10; + let t = e.clientY; + let menuItems = { + other: document.getElementsByClassName('rightMenuOther'), + plugin: document.getElementsByClassName('rightMenuPlugin'), + copytext: document.getElementById('menu-copytext'), + pastetext: document.getElementById('menu-pastetext'), + commenttext: document.getElementById('menu-commenttext'), + newwindow: document.getElementById('menu-newwindow'), + copylink: document.getElementById('menu-copylink'), + copyimg: document.getElementById('menu-copyimg'), + downloadimg: document.getElementById('menu-downloadimg'), + search: document.getElementById('menu-search'), + music: { + toggle: document.getElementById('menu-music-toggle'), + back: document.getElementById('menu-music-back'), + forward: document.getElementById('menu-music-forward'), + playlist: document.getElementById('menu-music-playlist'), + copyMusicName: document.getElementById('menu-music-copyMusicName'), } - ), 2000); - rm.hideRightMenu() -} - -rm.copyLink = function () { - rm.rightmenuCopyText(domhref) - utils.snackbarShow("已复制链接地址") + }; + let y = e.target.href; + let M = e.target.currentSrc; + let b = false; + Array.from(menuItems.other).forEach(item => item.style.display = 'block'); + globalEvent = e; + if (selectTextNow && window.getSelection()) { + b = true; + menuItems.copytext.style.display = 'block'; + menuItems.commenttext.style.display = 'block'; + menuItems.search.style.display = 'block'; + } else { + menuItems.copytext.style.display = 'none'; + menuItems.commenttext.style.display = 'none'; + menuItems.search.style.display = 'none'; + } + if (y) { + b = true; + menuItems.newwindow.style.display = 'block'; + menuItems.copylink.style.display = 'block'; + domhref = y; + } else { + menuItems.newwindow.style.display = 'none'; + menuItems.copylink.style.display = 'none'; + } + if (M) { + b = true; + menuItems.copyimg.style.display = 'block'; + menuItems.downloadimg.style.display = 'block'; + domImgSrc = M; + } else { + menuItems.copyimg.style.display = 'none'; + menuItems.downloadimg.style.display = 'none'; + } + let tagName = e.target.tagName.toLowerCase(); + if (tagName === 'input' || tagName === 'textarea') { + b = true; + menuItems.pastetext.style.display = 'block'; + } else { + menuItems.pastetext.style.display = 'none'; + } + if (e.target.nodeName === 'METING-JS') { + b = true; + Object.values(menuItems.music).forEach(item => item.style.display = 'block'); + } else { + Object.values(menuItems.music).forEach(item => item.style.display = 'none'); + } + Array.from(b ? menuItems.other : menuItems.plugin).forEach(item => item.style.display = 'none'); + Array.from(b ? menuItems.plugin : menuItems.other).forEach(item => item.style.display = 'block'); + rm.reloadrmSize(); + n + rmWidth > window.innerWidth && (n -= rmWidth + 10); + t + rmHeight > window.innerHeight && (t -= t + rmHeight - window.innerHeight) + rm.showRightMenu(true, t, n); + document.getElementById('rightmenu-mask').style.display = 'flex'; + return false; +}; +function addRightMenuClickEvent() { + const addEvent = (id, event, callback) => document.getElementById(id)?.addEventListener(event, callback) + addEvent('menu-backward', 'click', () => window.history.back() || rm.hideRightMenu()) + addEvent('menu-forward', 'click', () => window.history.forward() || rm.hideRightMenu()) + addEvent('menu-refresh', 'click', () => window.location.reload()); + addEvent('menu-top', 'click', () => utils.scrollToDest(0, 500) || rm.hideRightMenu()) + Array.from(document.getElementsByClassName('menu-link')).forEach(element => element.addEventListener('click', rm.hideRightMenu)) + addEvent('menu-darkmode', 'click', rm.switchDarkMode); + addEvent('menu-randomPost', 'click', () => toRandomPost() || rm.hideRightMenu()); + GLOBAL_CONFIG.comment.commentBarrage && addEvent('menu-commentBarrage', 'click', sco.switchCommentBarrage); + addEvent('rightmenu-mask', 'click', rm.hideRightMenu); + addEvent('rightmenu-mask', 'contextmenu', () => rm.hideRightMenu() || false) + addEvent('menu-copy', 'click', rm.copyPageUrl); + addEvent('menu-pastetext', 'click', rm.pasteText); + addEvent('menu-copytext', 'click', () => rm.rightmenuCopyText(selectTextNow) || utils.snackbarShow("复制成功,复制和转载请标注本文地址") || rm.hideRightMenu()) + GLOBAL_CONFIG.comment.enable && addEvent('menu-commenttext', 'click', () => rm.rightMenuCommentText(selectTextNow)) + addEvent('menu-newwindow', 'click', () => window.open(domhref) || rm.hideRightMenu()); + addEvent('menu-copylink', 'click', rm.copyLink); + addEvent('menu-downloadimg', 'click', () => sco.downloadImage(domImgSrc)); + addEvent('menu-copyimg', 'click', () => rm.writeClipImg(domImgSrc)); + addEvent('menu-music-toggle', 'click', sco.musicToggle); + addEvent('menu-music-back', 'click', sco.musicSkipBack); + addEvent('menu-music-forward', 'click', sco.musicSkipForward); + addEvent('menu-music-copyMusicName', 'click', () => rm.rightmenuCopyText(sco.musicGetName()) || utils.snackbarShow("复制歌曲名称成功", false, 3000)) } \ No newline at end of file diff --git a/source/js/tw_cn.js b/source/js/tw_cn.js new file mode 100644 index 00000000..a0564ec7 --- /dev/null +++ b/source/js/tw_cn.js @@ -0,0 +1,76 @@ +document.addEventListener('DOMContentLoaded', function () { + const {translate, lang} = GLOBAL_CONFIG; + const {defaultEncoding, translateDelay} = translate; + const snackbarData = lang.chs; + const msgToTraditionalChinese = '轉為繁體'; + const msgToSimplifiedChinese = '转为简体'; + const targetEncodingCookie = 'translate-chn-cht'; + const isSnackbar = true; + let currentEncoding = defaultEncoding; + let targetEncoding = Number(saveToLocal.get(targetEncodingCookie)) || defaultEncoding; + let translateButtonObject; + + const translateText = (txt) => { + if (!txt) return ''; + if (currentEncoding === 1 && targetEncoding === 2) return Simplized(txt); + if (currentEncoding === 2 && targetEncoding === 1) return Traditionalized(txt); + return txt; + } + + function JTPYStr() { + return '万与丑专业丛东丝丢两严丧个丬丰临为丽举么义乌乐乔习乡书买乱争于亏云亘亚产亩亲亵亸亿仅从仑仓仪们价众优伙会伛伞伟传伤伥伦伧伪伫体余佣佥侠侣侥侦侧侨侩侪侬俣俦俨俩俪俭债倾偬偻偾偿傥傧储傩儿兑兖党兰关兴兹养兽冁内冈册写军农冢冯冲决况冻净凄凉凌减凑凛几凤凫凭凯击凼凿刍划刘则刚创删别刬刭刽刿剀剂剐剑剥剧劝办务劢动励劲劳势勋勐勚匀匦匮区医华协单卖卢卤卧卫却卺厂厅历厉压厌厍厕厢厣厦厨厩厮县参叆叇双发变叙叠叶号叹叽吁后吓吕吗吣吨听启吴呒呓呕呖呗员呙呛呜咏咔咙咛咝咤咴咸哌响哑哒哓哔哕哗哙哜哝哟唛唝唠唡唢唣唤唿啧啬啭啮啰啴啸喷喽喾嗫呵嗳嘘嘤嘱噜噼嚣嚯团园囱围囵国图圆圣圹场坂坏块坚坛坜坝坞坟坠垄垅垆垒垦垧垩垫垭垯垱垲垴埘埙埚埝埯堑堕塆墙壮声壳壶壸处备复够头夸夹夺奁奂奋奖奥妆妇妈妩妪妫姗姜娄娅娆娇娈娱娲娴婳婴婵婶媪嫒嫔嫱嬷孙学孪宁宝实宠审宪宫宽宾寝对寻导寿将尔尘尧尴尸尽层屃屉届属屡屦屿岁岂岖岗岘岙岚岛岭岳岽岿峃峄峡峣峤峥峦崂崃崄崭嵘嵚嵛嵝嵴巅巩巯币帅师帏帐帘帜带帧帮帱帻帼幂幞干并广庄庆庐庑库应庙庞废庼廪开异弃张弥弪弯弹强归当录彟彦彻径徕御忆忏忧忾怀态怂怃怄怅怆怜总怼怿恋恳恶恸恹恺恻恼恽悦悫悬悭悯惊惧惨惩惫惬惭惮惯愍愠愤愦愿慑慭憷懑懒懔戆戋戏戗战戬户扎扑扦执扩扪扫扬扰抚抛抟抠抡抢护报担拟拢拣拥拦拧拨择挂挚挛挜挝挞挟挠挡挢挣挤挥挦捞损捡换捣据捻掳掴掷掸掺掼揸揽揿搀搁搂搅携摄摅摆摇摈摊撄撑撵撷撸撺擞攒敌敛数斋斓斗斩断无旧时旷旸昙昼昽显晋晒晓晔晕晖暂暧札术朴机杀杂权条来杨杩杰极构枞枢枣枥枧枨枪枫枭柜柠柽栀栅标栈栉栊栋栌栎栏树栖样栾桊桠桡桢档桤桥桦桧桨桩梦梼梾检棂椁椟椠椤椭楼榄榇榈榉槚槛槟槠横樯樱橥橱橹橼檐檩欢欤欧歼殁殇残殒殓殚殡殴毁毂毕毙毡毵氇气氢氩氲汇汉污汤汹沓沟没沣沤沥沦沧沨沩沪沵泞泪泶泷泸泺泻泼泽泾洁洒洼浃浅浆浇浈浉浊测浍济浏浐浑浒浓浔浕涂涌涛涝涞涟涠涡涢涣涤润涧涨涩淀渊渌渍渎渐渑渔渖渗温游湾湿溃溅溆溇滗滚滞滟滠满滢滤滥滦滨滩滪漤潆潇潋潍潜潴澜濑濒灏灭灯灵灾灿炀炉炖炜炝点炼炽烁烂烃烛烟烦烧烨烩烫烬热焕焖焘煅煳熘爱爷牍牦牵牺犊犟状犷犸犹狈狍狝狞独狭狮狯狰狱狲猃猎猕猡猪猫猬献獭玑玙玚玛玮环现玱玺珉珏珐珑珰珲琎琏琐琼瑶瑷璇璎瓒瓮瓯电画畅畲畴疖疗疟疠疡疬疮疯疱疴痈痉痒痖痨痪痫痴瘅瘆瘗瘘瘪瘫瘾瘿癞癣癫癯皑皱皲盏盐监盖盗盘眍眦眬着睁睐睑瞒瞩矫矶矾矿砀码砖砗砚砜砺砻砾础硁硅硕硖硗硙硚确硷碍碛碜碱碹磙礼祎祢祯祷祸禀禄禅离秃秆种积称秽秾稆税稣稳穑穷窃窍窑窜窝窥窦窭竖竞笃笋笔笕笺笼笾筑筚筛筜筝筹签简箓箦箧箨箩箪箫篑篓篮篱簖籁籴类籼粜粝粤粪粮糁糇紧絷纟纠纡红纣纤纥约级纨纩纪纫纬纭纮纯纰纱纲纳纴纵纶纷纸纹纺纻纼纽纾线绀绁绂练组绅细织终绉绊绋绌绍绎经绐绑绒结绔绕绖绗绘给绚绛络绝绞统绠绡绢绣绤绥绦继绨绩绪绫绬续绮绯绰绱绲绳维绵绶绷绸绹绺绻综绽绾绿缀缁缂缃缄缅缆缇缈缉缊缋缌缍缎缏缐缑缒缓缔缕编缗缘缙缚缛缜缝缞缟缠缡缢缣缤缥缦缧缨缩缪缫缬缭缮缯缰缱缲缳缴缵罂网罗罚罢罴羁羟羡翘翙翚耢耧耸耻聂聋职聍联聩聪肃肠肤肷肾肿胀胁胆胜胧胨胪胫胶脉脍脏脐脑脓脔脚脱脶脸腊腌腘腭腻腼腽腾膑臜舆舣舰舱舻艰艳艹艺节芈芗芜芦苁苇苈苋苌苍苎苏苘苹茎茏茑茔茕茧荆荐荙荚荛荜荞荟荠荡荣荤荥荦荧荨荩荪荫荬荭荮药莅莜莱莲莳莴莶获莸莹莺莼萚萝萤营萦萧萨葱蒇蒉蒋蒌蓝蓟蓠蓣蓥蓦蔷蔹蔺蔼蕲蕴薮藁藓虏虑虚虫虬虮虽虾虿蚀蚁蚂蚕蚝蚬蛊蛎蛏蛮蛰蛱蛲蛳蛴蜕蜗蜡蝇蝈蝉蝎蝼蝾螀螨蟏衅衔补衬衮袄袅袆袜袭袯装裆裈裢裣裤裥褛褴襁襕见观觃规觅视觇览觉觊觋觌觍觎觏觐觑觞触觯詟誉誊讠计订讣认讥讦讧讨让讪讫训议讯记讱讲讳讴讵讶讷许讹论讻讼讽设访诀证诂诃评诅识诇诈诉诊诋诌词诎诏诐译诒诓诔试诖诗诘诙诚诛诜话诞诟诠诡询诣诤该详诧诨诩诪诫诬语诮误诰诱诲诳说诵诶请诸诹诺读诼诽课诿谀谁谂调谄谅谆谇谈谊谋谌谍谎谏谐谑谒谓谔谕谖谗谘谙谚谛谜谝谞谟谠谡谢谣谤谥谦谧谨谩谪谫谬谭谮谯谰谱谲谳谴谵谶谷豮贝贞负贠贡财责贤败账货质贩贪贫贬购贮贯贰贱贲贳贴贵贶贷贸费贺贻贼贽贾贿赀赁赂赃资赅赆赇赈赉赊赋赌赍赎赏赐赑赒赓赔赕赖赗赘赙赚赛赜赝赞赟赠赡赢赣赪赵赶趋趱趸跃跄跖跞践跶跷跸跹跻踊踌踪踬踯蹑蹒蹰蹿躏躜躯车轧轨轩轪轫转轭轮软轰轱轲轳轴轵轶轷轸轹轺轻轼载轾轿辀辁辂较辄辅辆辇辈辉辊辋辌辍辎辏辐辑辒输辔辕辖辗辘辙辚辞辩辫边辽达迁过迈运还这进远违连迟迩迳迹适选逊递逦逻遗遥邓邝邬邮邹邺邻郁郄郏郐郑郓郦郧郸酝酦酱酽酾酿释里鉅鉴銮錾钆钇针钉钊钋钌钍钎钏钐钑钒钓钔钕钖钗钘钙钚钛钝钞钟钠钡钢钣钤钥钦钧钨钩钪钫钬钭钮钯钰钱钲钳钴钵钶钷钸钹钺钻钼钽钾钿铀铁铂铃铄铅铆铈铉铊铋铍铎铏铐铑铒铕铗铘铙铚铛铜铝铞铟铠铡铢铣铤铥铦铧铨铪铫铬铭铮铯铰铱铲铳铴铵银铷铸铹铺铻铼铽链铿销锁锂锃锄锅锆锇锈锉锊锋锌锍锎锏锐锑锒锓锔锕锖锗错锚锜锞锟锠锡锢锣锤锥锦锨锩锫锬锭键锯锰锱锲锳锴锵锶锷锸锹锺锻锼锽锾锿镀镁镂镃镆镇镈镉镊镌镍镎镏镐镑镒镕镖镗镙镚镛镜镝镞镟镠镡镢镣镤镥镦镧镨镩镪镫镬镭镮镯镰镱镲镳镴镶长门闩闪闫闬闭问闯闰闱闲闳间闵闶闷闸闹闺闻闼闽闾闿阀阁阂阃阄阅阆阇阈阉阊阋阌阍阎阏阐阑阒阓阔阕阖阗阘阙阚阛队阳阴阵阶际陆陇陈陉陕陧陨险随隐隶隽难雏雠雳雾霁霉霭靓静靥鞑鞒鞯鞴韦韧韨韩韪韫韬韵页顶顷顸项顺须顼顽顾顿颀颁颂颃预颅领颇颈颉颊颋颌颍颎颏颐频颒颓颔颕颖颗题颙颚颛颜额颞颟颠颡颢颣颤颥颦颧风飏飐飑飒飓飔飕飖飗飘飙飚飞飨餍饤饥饦饧饨饩饪饫饬饭饮饯饰饱饲饳饴饵饶饷饸饹饺饻饼饽饾饿馀馁馂馃馄馅馆馇馈馉馊馋馌馍馎馏馐馑馒馓馔馕马驭驮驯驰驱驲驳驴驵驶驷驸驹驺驻驼驽驾驿骀骁骂骃骄骅骆骇骈骉骊骋验骍骎骏骐骑骒骓骔骕骖骗骘骙骚骛骜骝骞骟骠骡骢骣骤骥骦骧髅髋髌鬓魇魉鱼鱽鱾鱿鲀鲁鲂鲄鲅鲆鲇鲈鲉鲊鲋鲌鲍鲎鲏鲐鲑鲒鲓鲔鲕鲖鲗鲘鲙鲚鲛鲜鲝鲞鲟鲠鲡鲢鲣鲤鲥鲦鲧鲨鲩鲪鲫鲬鲭鲮鲯鲰鲱鲲鲳鲴鲵鲶鲷鲸鲹鲺鲻鲼鲽鲾鲿鳀鳁鳂鳃鳄鳅鳆鳇鳈鳉鳊鳋鳌鳍鳎鳏鳐鳑鳒鳓鳔鳕鳖鳗鳘鳙鳛鳜鳝鳞鳟鳠鳡鳢鳣鸟鸠鸡鸢鸣鸤鸥鸦鸧鸨鸩鸪鸫鸬鸭鸮鸯鸰鸱鸲鸳鸴鸵鸶鸷鸸鸹鸺鸻鸼鸽鸾鸿鹀鹁鹂鹃鹄鹅鹆鹇鹈鹉鹊鹋鹌鹍鹎鹏鹐鹑鹒鹓鹔鹕鹖鹗鹘鹚鹛鹜鹝鹞鹟鹠鹡鹢鹣鹤鹥鹦鹧鹨鹩鹪鹫鹬鹭鹯鹰鹱鹲鹳鹴鹾麦麸黄黉黡黩黪黾龙历志制一台皋准复猛钟注范签' + } + + function FTPYStr() { + return '萬與醜專業叢東絲丟兩嚴喪個爿豐臨為麗舉麼義烏樂喬習鄉書買亂爭於虧雲亙亞產畝親褻嚲億僅從侖倉儀們價眾優夥會傴傘偉傳傷倀倫傖偽佇體餘傭僉俠侶僥偵側僑儈儕儂俁儔儼倆儷儉債傾傯僂僨償儻儐儲儺兒兌兗黨蘭關興茲養獸囅內岡冊寫軍農塚馮衝決況凍淨淒涼淩減湊凜幾鳳鳧憑凱擊氹鑿芻劃劉則剛創刪別剗剄劊劌剴劑剮劍剝劇勸辦務勱動勵勁勞勢勳猛勩勻匭匱區醫華協單賣盧鹵臥衛卻巹廠廳曆厲壓厭厙廁廂厴廈廚廄廝縣參靉靆雙發變敘疊葉號歎嘰籲後嚇呂嗎唚噸聽啟吳嘸囈嘔嚦唄員咼嗆嗚詠哢嚨嚀噝吒噅鹹呱響啞噠嘵嗶噦嘩噲嚌噥喲嘜嗊嘮啢嗩唕喚呼嘖嗇囀齧囉嘽嘯噴嘍嚳囁嗬噯噓嚶囑嚕劈囂謔團園囪圍圇國圖圓聖壙場阪壞塊堅壇壢壩塢墳墜壟壟壚壘墾坰堊墊埡墶壋塏堖塒塤堝墊垵塹墮壪牆壯聲殼壺壼處備複夠頭誇夾奪奩奐奮獎奧妝婦媽嫵嫗媯姍薑婁婭嬈嬌孌娛媧嫻嫿嬰嬋嬸媼嬡嬪嬙嬤孫學孿寧寶實寵審憲宮寬賓寢對尋導壽將爾塵堯尷屍盡層屭屜屆屬屢屨嶼歲豈嶇崗峴嶴嵐島嶺嶽崠巋嶨嶧峽嶢嶠崢巒嶗崍嶮嶄嶸嶔崳嶁脊巔鞏巰幣帥師幃帳簾幟帶幀幫幬幘幗冪襆幹並廣莊慶廬廡庫應廟龐廢廎廩開異棄張彌弳彎彈強歸當錄彠彥徹徑徠禦憶懺憂愾懷態慫憮慪悵愴憐總懟懌戀懇惡慟懨愷惻惱惲悅愨懸慳憫驚懼慘懲憊愜慚憚慣湣慍憤憒願懾憖怵懣懶懍戇戔戲戧戰戩戶紮撲扡執擴捫掃揚擾撫拋摶摳掄搶護報擔擬攏揀擁攔擰撥擇掛摯攣掗撾撻挾撓擋撟掙擠揮撏撈損撿換搗據撚擄摑擲撣摻摜摣攬撳攙擱摟攪攜攝攄擺搖擯攤攖撐攆擷擼攛擻攢敵斂數齋斕鬥斬斷無舊時曠暘曇晝曨顯晉曬曉曄暈暉暫曖劄術樸機殺雜權條來楊榪傑極構樅樞棗櫪梘棖槍楓梟櫃檸檉梔柵標棧櫛櫳棟櫨櫟欄樹棲樣欒棬椏橈楨檔榿橋樺檜槳樁夢檮棶檢欞槨櫝槧欏橢樓欖櫬櫚櫸檟檻檳櫧橫檣櫻櫫櫥櫓櫞簷檁歡歟歐殲歿殤殘殞殮殫殯毆毀轂畢斃氈毿氌氣氫氬氳彙漢汙湯洶遝溝沒灃漚瀝淪滄渢溈滬濔濘淚澩瀧瀘濼瀉潑澤涇潔灑窪浹淺漿澆湞溮濁測澮濟瀏滻渾滸濃潯濜塗湧濤澇淶漣潿渦溳渙滌潤澗漲澀澱淵淥漬瀆漸澠漁瀋滲溫遊灣濕潰濺漵漊潷滾滯灩灄滿瀅濾濫灤濱灘澦濫瀠瀟瀲濰潛瀦瀾瀨瀕灝滅燈靈災燦煬爐燉煒熗點煉熾爍爛烴燭煙煩燒燁燴燙燼熱煥燜燾煆糊溜愛爺牘犛牽犧犢強狀獷獁猶狽麅獮獰獨狹獅獪猙獄猻獫獵獼玀豬貓蝟獻獺璣璵瑒瑪瑋環現瑲璽瑉玨琺瓏璫琿璡璉瑣瓊瑤璦璿瓔瓚甕甌電畫暢佘疇癤療瘧癘瘍鬁瘡瘋皰屙癰痙癢瘂癆瘓癇癡癉瘮瘞瘺癟癱癮癭癩癬癲臒皚皺皸盞鹽監蓋盜盤瞘眥矓著睜睞瞼瞞矚矯磯礬礦碭碼磚硨硯碸礪礱礫礎硜矽碩硤磽磑礄確鹼礙磧磣堿镟滾禮禕禰禎禱禍稟祿禪離禿稈種積稱穢穠穭稅穌穩穡窮竊竅窯竄窩窺竇窶豎競篤筍筆筧箋籠籩築篳篩簹箏籌簽簡籙簀篋籜籮簞簫簣簍籃籬籪籟糴類秈糶糲粵糞糧糝餱緊縶糸糾紆紅紂纖紇約級紈纊紀紉緯紜紘純紕紗綱納紝縱綸紛紙紋紡紵紖紐紓線紺絏紱練組紳細織終縐絆紼絀紹繹經紿綁絨結絝繞絰絎繪給絢絳絡絕絞統綆綃絹繡綌綏絛繼綈績緒綾緓續綺緋綽緔緄繩維綿綬繃綢綯綹綣綜綻綰綠綴緇緙緗緘緬纜緹緲緝縕繢緦綞緞緶線緱縋緩締縷編緡緣縉縛縟縝縫縗縞纏縭縊縑繽縹縵縲纓縮繆繅纈繚繕繒韁繾繰繯繳纘罌網羅罰罷羆羈羥羨翹翽翬耮耬聳恥聶聾職聹聯聵聰肅腸膚膁腎腫脹脅膽勝朧腖臚脛膠脈膾髒臍腦膿臠腳脫腡臉臘醃膕齶膩靦膃騰臏臢輿艤艦艙艫艱豔艸藝節羋薌蕪蘆蓯葦藶莧萇蒼苧蘇檾蘋莖蘢蔦塋煢繭荊薦薘莢蕘蓽蕎薈薺蕩榮葷滎犖熒蕁藎蓀蔭蕒葒葤藥蒞蓧萊蓮蒔萵薟獲蕕瑩鶯蓴蘀蘿螢營縈蕭薩蔥蕆蕢蔣蔞藍薊蘺蕷鎣驀薔蘞藺藹蘄蘊藪槁蘚虜慮虛蟲虯蟣雖蝦蠆蝕蟻螞蠶蠔蜆蠱蠣蟶蠻蟄蛺蟯螄蠐蛻蝸蠟蠅蟈蟬蠍螻蠑螿蟎蠨釁銜補襯袞襖嫋褘襪襲襏裝襠褌褳襝褲襇褸襤繈襴見觀覎規覓視覘覽覺覬覡覿覥覦覯覲覷觴觸觶讋譽謄訁計訂訃認譏訐訌討讓訕訖訓議訊記訒講諱謳詎訝訥許訛論訩訟諷設訪訣證詁訶評詛識詗詐訴診詆謅詞詘詔詖譯詒誆誄試詿詩詰詼誠誅詵話誕詬詮詭詢詣諍該詳詫諢詡譸誡誣語誚誤誥誘誨誑說誦誒請諸諏諾讀諑誹課諉諛誰諗調諂諒諄誶談誼謀諶諜謊諫諧謔謁謂諤諭諼讒諮諳諺諦謎諞諝謨讜謖謝謠謗諡謙謐謹謾謫譾謬譚譖譙讕譜譎讞譴譫讖穀豶貝貞負貟貢財責賢敗賬貨質販貪貧貶購貯貫貳賤賁貰貼貴貺貸貿費賀貽賊贄賈賄貲賃賂贓資賅贐賕賑賚賒賦賭齎贖賞賜贔賙賡賠賧賴賵贅賻賺賽賾贗讚贇贈贍贏贛赬趙趕趨趲躉躍蹌蹠躒踐躂蹺蹕躚躋踴躊蹤躓躑躡蹣躕躥躪躦軀車軋軌軒軑軔轉軛輪軟轟軲軻轤軸軹軼軤軫轢軺輕軾載輊轎輈輇輅較輒輔輛輦輩輝輥輞輬輟輜輳輻輯轀輸轡轅轄輾轆轍轔辭辯辮邊遼達遷過邁運還這進遠違連遲邇逕跡適選遜遞邐邏遺遙鄧鄺鄔郵鄒鄴鄰鬱郤郟鄶鄭鄆酈鄖鄲醞醱醬釅釃釀釋裏钜鑒鑾鏨釓釔針釘釗釙釕釷釺釧釤鈒釩釣鍆釹鍚釵鈃鈣鈈鈦鈍鈔鍾鈉鋇鋼鈑鈐鑰欽鈞鎢鉤鈧鈁鈥鈄鈕鈀鈺錢鉦鉗鈷缽鈳鉕鈽鈸鉞鑽鉬鉭鉀鈿鈾鐵鉑鈴鑠鉛鉚鈰鉉鉈鉍鈹鐸鉶銬銠鉺銪鋏鋣鐃銍鐺銅鋁銱銦鎧鍘銖銑鋌銩銛鏵銓鉿銚鉻銘錚銫鉸銥鏟銃鐋銨銀銣鑄鐒鋪鋙錸鋱鏈鏗銷鎖鋰鋥鋤鍋鋯鋨鏽銼鋝鋒鋅鋶鐦鐧銳銻鋃鋟鋦錒錆鍺錯錨錡錁錕錩錫錮鑼錘錐錦鍁錈錇錟錠鍵鋸錳錙鍥鍈鍇鏘鍶鍔鍤鍬鍾鍛鎪鍠鍰鎄鍍鎂鏤鎡鏌鎮鎛鎘鑷鐫鎳鎿鎦鎬鎊鎰鎔鏢鏜鏍鏰鏞鏡鏑鏃鏇鏐鐔钁鐐鏷鑥鐓鑭鐠鑹鏹鐙鑊鐳鐶鐲鐮鐿鑔鑣鑞鑲長門閂閃閆閈閉問闖閏闈閑閎間閔閌悶閘鬧閨聞闥閩閭闓閥閣閡閫鬮閱閬闍閾閹閶鬩閿閽閻閼闡闌闃闠闊闋闔闐闒闕闞闤隊陽陰陣階際陸隴陳陘陝隉隕險隨隱隸雋難雛讎靂霧霽黴靄靚靜靨韃鞽韉韝韋韌韍韓韙韞韜韻頁頂頃頇項順須頊頑顧頓頎頒頌頏預顱領頗頸頡頰頲頜潁熲頦頤頻頮頹頷頴穎顆題顒顎顓顏額顳顢顛顙顥纇顫顬顰顴風颺颭颮颯颶颸颼颻飀飄飆飆飛饗饜飣饑飥餳飩餼飪飫飭飯飲餞飾飽飼飿飴餌饒餉餄餎餃餏餅餑餖餓餘餒餕餜餛餡館餷饋餶餿饞饁饃餺餾饈饉饅饊饌饢馬馭馱馴馳驅馹駁驢駔駛駟駙駒騶駐駝駑駕驛駘驍罵駰驕驊駱駭駢驫驪騁驗騂駸駿騏騎騍騅騌驌驂騙騭騤騷騖驁騮騫騸驃騾驄驏驟驥驦驤髏髖髕鬢魘魎魚魛魢魷魨魯魴魺鮁鮃鯰鱸鮋鮓鮒鮊鮑鱟鮍鮐鮭鮚鮳鮪鮞鮦鰂鮜鱠鱭鮫鮮鮺鯗鱘鯁鱺鰱鰹鯉鰣鰷鯀鯊鯇鮶鯽鯒鯖鯪鯕鯫鯡鯤鯧鯝鯢鯰鯛鯨鯵鯴鯔鱝鰈鰏鱨鯷鰮鰃鰓鱷鰍鰒鰉鰁鱂鯿鰠鼇鰭鰨鰥鰩鰟鰜鰳鰾鱈鱉鰻鰵鱅鰼鱖鱔鱗鱒鱯鱤鱧鱣鳥鳩雞鳶鳴鳲鷗鴉鶬鴇鴆鴣鶇鸕鴨鴞鴦鴒鴟鴝鴛鴬鴕鷥鷙鴯鴰鵂鴴鵃鴿鸞鴻鵐鵓鸝鵑鵠鵝鵒鷳鵜鵡鵲鶓鵪鶤鵯鵬鵮鶉鶊鵷鷫鶘鶡鶚鶻鶿鶥鶩鷊鷂鶲鶹鶺鷁鶼鶴鷖鸚鷓鷚鷯鷦鷲鷸鷺鸇鷹鸌鸏鸛鸘鹺麥麩黃黌黶黷黲黽龍歷誌製壹臺臯準復勐鐘註範籤' + } + + const translateBody = (fobj) => { + const objs = fobj ? fobj.childNodes : document.body.childNodes; + for (let obj of objs) { + if (obj.tagName === 'BR' || obj.tagName === 'HR' || obj === translateButtonObject) continue; + if (obj.title) obj.title = translateText(obj.title); + if (obj.alt) obj.alt = translateText(obj.alt); + if (obj.placeholder) obj.placeholder = translateText(obj.placeholder); + if (obj.tagName === 'INPUT' && obj.value && obj.type !== 'text' && obj.type !== 'hidden') obj.value = translateText(obj.value); + if (obj.nodeType === 3) obj.data = translateText(obj.data); + else translateBody(obj); + } + } + + const translatePage = () => { + const isTargetEncodingOne = targetEncoding === 1; + currentEncoding = isTargetEncodingOne ? 1 : 2; + targetEncoding = isTargetEncodingOne ? 2 : 1; + saveToLocal.set(targetEncodingCookie, targetEncoding, 2); + translateBody(); + if (isSnackbar) utils.snackbarShow(isTargetEncodingOne ? snackbarData.cht_to_chs : snackbarData.chs_to_cht); + translateButtonObject && ((translateButtonObject.innerHTML = isTargetEncodingOne ? msgToTraditionalChinese : msgToSimplifiedChinese) && rm.hideRightMenu()) + } + + const translateChar = (cc, source, target) => { + let str = ''; + for (let char of cc) { + const index = source.indexOf(char); + str += char.charCodeAt(0) > 10000 && index !== -1 ? target.charAt(index) : char; + } + return str; + } + + const Traditionalized = (cc) => translateChar(cc, JTPYStr(), FTPYStr()); + const Simplized = (cc) => translateChar(cc, FTPYStr(), JTPYStr()); + + const translateInitialization = () => { + translateButtonObject = document.getElementById('menu-translate'); + if (translateButtonObject) { + if (currentEncoding !== targetEncoding) { + setTimeout(translateBody, translateDelay); + translateButtonObject.innerHTML = targetEncoding === 1 ? msgToSimplifiedChinese : msgToTraditionalChinese; + } + translateButtonObject.addEventListener('click', translatePage, false); + } + } + + translateInitialization(); + document.addEventListener('pjax:complete', translateInitialization); +}); \ No newline at end of file