Compare commits

..

43 Commits
3.8.0 ... 3.7.1

64 changed files with 453 additions and 523 deletions

View File

@@ -12,8 +12,6 @@
![hexo version](https://img.shields.io/badge/hexo-5.0+-0e83c) ![hexo version](https://img.shields.io/badge/hexo-5.0+-0e83c)
![license](https://img.shields.io/github/license/jerryc127/hexo-theme-butterfly?color=FF5531) ![license](https://img.shields.io/github/license/jerryc127/hexo-theme-butterfly?color=FF5531)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/theme-butterfly-readme.png)
Demo: 👍 [Butterfly](https://butterfly.js.org/) || 🤞 [MYW](https://immyw.com/) Demo: 👍 [Butterfly](https://butterfly.js.org/) || 🤞 [MYW](https://immyw.com/)
Docs: 📖 [Butterfly Docs](https://butterfly.js.org/posts/21cfbf15/) Docs: 📖 [Butterfly Docs](https://butterfly.js.org/posts/21cfbf15/)
@@ -82,9 +80,9 @@ npm i hexo-theme-butterfly
- [X] Comment (Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo) - [X] Comment (Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo)
- [x] Multiple Comment System Support - [x] Multiple Comment System Support
- [x] Online Chats (Chatra/Tidio/Daovoice/Gitter/Crisp) - [x] Online Chats (Chatra/Tidio/Daovoice/Gitter/Crisp)
- [x] Web analytics - [x] Web analytics (Baidu Analytics/Google Analytics/Tencent Analytics/CNZZ Analytics)
- [x] Google AdSense - [x] Google AdSense
- [x] Webmaster Verification - [x] Webmaster Verification (google/Bing/Baidu/360/Yandex)
- [x] Change website colour scheme - [x] Change website colour scheme
- [x] Typewriter Effect: activate_power_mode - [x] Typewriter Effect: activate_power_mode
- [x] Background effects (Canvas ribbon/canvas_ribbon_piao/canvas_nest) - [x] Background effects (Canvas ribbon/canvas_ribbon_piao/canvas_nest)
@@ -99,9 +97,6 @@ npm i hexo-theme-butterfly
## Screenshots ## Screenshots
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-1.jpg)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-2.jpg)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-3.jpg)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-4.jpg)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-1.png) ![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-1.png)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-2.png) ![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-2.png)

View File

@@ -12,8 +12,6 @@
![hexo version](https://img.shields.io/badge/hexo-5.0+-0e83c) ![hexo version](https://img.shields.io/badge/hexo-5.0+-0e83c)
![license](https://img.shields.io/github/license/jerryc127/hexo-theme-butterfly?color=FF5531) ![license](https://img.shields.io/github/license/jerryc127/hexo-theme-butterfly?color=FF5531)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/theme-butterfly-readme.png)
預覽: 👍 [Butterfly](https://butterfly.js.org/) || 🤞 [MYW](https://immyw.com/) 預覽: 👍 [Butterfly](https://butterfly.js.org/) || 🤞 [MYW](https://immyw.com/)
文檔: 📖 [Butterfly Docs](https://butterfly.js.org/posts/21cfbf15/) 文檔: 📖 [Butterfly Docs](https://butterfly.js.org/posts/21cfbf15/)
@@ -81,7 +79,7 @@ theme: butterfly
- [X] 多種評論系統Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo - [X] 多種評論系統Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo
- [x] 支持雙評論部署 - [x] 支持雙評論部署
- [x] 多種在線聊天Chatra/Tidio/Daovoice/Gitter/Crisp - [x] 多種在線聊天Chatra/Tidio/Daovoice/Gitter/Crisp
- [x] 多種分析系統 - [x] 多種分析系統(百度分析/谷歌分析/騰訊分析/CNZZ分析
- [x] 谷歌廣告/手動廣告位置 - [x] 谷歌廣告/手動廣告位置
- [x] 各種站長驗證Google/Bing/Baidu/360/Yandex - [x] 各種站長驗證Google/Bing/Baidu/360/Yandex
- [x] 修改網站配色 - [x] 修改網站配色
@@ -98,9 +96,6 @@ theme: butterfly
## 截圖 ## 截圖
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-1.jpg)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-2.jpg)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-3.jpg)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-4.jpg)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-1.png) ![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-1.png)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-2.png) ![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-2.png)

View File

@@ -4,7 +4,7 @@
# format: name: link || icon # format: name: link || icon
# sub-menu # sub-menu
# name || icon: # name || icon:
# name: link || icon # name || link || icon
menu: menu:
# Home: / || fas fa-home # Home: / || fas fa-home
@@ -274,7 +274,6 @@ comments:
# https://disqus.com/ # https://disqus.com/
disqus: disqus:
shortname: shortname:
apikey: # For newest comments widget
# Alternative Disqus - Render comments with Disqus API # Alternative Disqus - Render comments with Disqus API
# DisqusJS 評論系統,可以實現在網路審查地區載入 Disqus 評論列表,兼容原版 # DisqusJS 評論系統,可以實現在網路審查地區載入 Disqus 評論列表,兼容原版
@@ -332,7 +331,7 @@ valine:
waline: waline:
serverURL: # Waline server address url serverURL: # Waline server address url
avatar: monsterid # gravatar style https://zh-tw.gravatar.com/site/implement/images/#default-image avatar: monsterid # gravatar style https://zh-tw.gravatar.com/site/implement/images/#default-image
avatarCDN: # Gravatar CDN baseURL emojiCDN: # emoji CDN
bg: # waline background bg: # waline background
visitor: false visitor: false
option: option:
@@ -460,11 +459,25 @@ google_adsense:
# Verification (站長驗證) # Verification (站長驗證)
# -------------------------------------- # --------------------------------------
site_verification: # Google Webmaster tools verification setting
# - name: google_site_verification # See: https://www.google.com/webmasters/
# content: xxxxxx google_site_verification:
# - name: baidu_site_verification
# content: xxxxxxx # Bing Webmaster tools verification setting
# See: https://www.bing.com/webmaster/
bing_site_verification:
# Baidu Webmaster tools verification setting
# See: https://ziyuan.baidu.com/site/
baidu_site_verification:
# 360 Webmaster tools verification setting
# see http://zhanzhang.so.com/
qihu_site_verification:
# Yandex Webmaster tools verification setting
# see https://webmaster.yandex.com/
yandex_site_verification:
# Beautify/Effect (美化/效果) # Beautify/Effect (美化/效果)
# -------------------------------------- # --------------------------------------
@@ -695,6 +708,17 @@ newest_comments:
limit: 6 limit: 6
storage: 10 # unit: mins, save data to localStorage storage: 10 # unit: mins, save data to localStorage
avatar: true avatar: true
# You can only choose one, or neither
valine: false
github_issues:
enable: false
repo:
disqus:
enable: false
forum:
api_key:
twikoo: false
waline: false
# Bottom right button (右下角按鈕) # Bottom right button (右下角按鈕)
# -------------------------------------- # --------------------------------------
@@ -746,7 +770,7 @@ fancybox: true
# -------------------------------------- # --------------------------------------
# mermaid # mermaid
# see https://github.com/mermaid-js/mermaid # see https://github.com/knsv/mermaid
mermaid: mermaid:
enable: false enable: false
# built-in themes: default/forest/dark/neutral # built-in themes: default/forest/dark/neutral
@@ -804,12 +828,10 @@ pangu:
field: site # site/post field: site # site/post
# Lazyload (圖片懶加載) # Lazyload (圖片懶加載)
# https://github.com/verlok/vanilla-lazyload # https://github.com/verlok/lazyload
lazyload: lazyload:
enable: false enable: false
field: site # site/post post: /img/loading.gif
placeholder:
blur: false
# PWA # PWA
# See https://github.com/JLHwung/hexo-offline # See https://github.com/JLHwung/hexo-offline

28
layout/404.pug Normal file
View File

@@ -0,0 +1,28 @@
- var top_img = theme.error_404.background || theme.default_top_img
- var bg_img = `background-image: url('${url_for(top_img)}')`
doctype html
html(lang=config.language data-theme=theme.display_mode)
head
include includes/head.pug
body
if theme.preloader
!=partial('includes/loading/loading', {}, {cache: true})
if theme.fireworks && theme.fireworks.enable
canvas.fireworks
if theme.background
#web_bg
#error-wrap
.error-content
.error-img(style=bg_img)
.error-info
h1.error_title= '404'
.error_subtitle= theme.error_404.subtitle
a.button--animated(href=config.root)
i.fas.fa-rocket
= _p('error404.back_button')
include includes/additional-js.pug

View File

@@ -1,17 +0,0 @@
- var top_img = theme.error_404.background || theme.default_top_img
- var bg_img = `background-image: url('${url_for(top_img)}')`
#body-wrap.error404
div(style='display: none')
include ./header/index.pug
#error-wrap
.error-content
.error-img(style=bg_img)
.error-info
h1.error_title= '404'
.error_subtitle= theme.error_404.subtitle
a.button--animated(href=config.root)
i.fas.fa-rocket
= _p('error404.back_button')

View File

@@ -1,5 +1,5 @@
- var pageTitle - var pageTitle
- if (is_archive()) pageTitle = fragment_cache('findArchivesTitle', function(){return findArchivesTitle(theme.menu);}) - if (is_archive()) pageTitle = _p('page.archives')
- else if (is_tag()) pageTitle = _p('page.tag') + ': ' + page.tag - else if (is_tag()) pageTitle = _p('page.tag') + ': ' + page.tag
- else if (is_category()) pageTitle = _p('page.category') + ': ' + page.category - else if (is_category()) pageTitle = _p('page.category') + ': ' + page.category
- else if (is_month()) pageTitle += ': ' + page.month + '/' + page.year - else if (is_month()) pageTitle += ': ' + page.month + '/' + page.year

View File

@@ -6,16 +6,14 @@
var pageToc = page.toc === true || page.toc === false ? page.toc : theme.toc.enable var pageToc = page.toc === true || page.toc === false ? page.toc : theme.toc.enable
var showToc = is_post() && theme.aside.enable && pageToc && (toc(page.content) !== '' || page.encrypt == true ) var showToc = is_post() && theme.aside.enable && pageToc && (toc(page.content) !== '' || page.encrypt == true )
let titleVal = pageTitle.replace(/'/ig,"\\'")
- -
script#config-diff. script#config-diff
var GLOBAL_CONFIG_SITE = { .
title: '!{titleVal}', var GLOBAL_CONFIG_SITE = {
isPost: !{is_post()}, isPost: !{is_post()},
isHome: !{is_home()}, isHome: !{is_home()},
isHighlightShrink: !{isHighlightShrink}, isHighlightShrink: !{isHighlightShrink},
isToc: !{showToc}, isToc: !{showToc},
postUpdate: '!{full_date(page.updated)}' postUpdate: '!{full_date(page.updated)}'
} }

View File

@@ -1,3 +1,14 @@
if theme.site_verification if theme.google_site_verification
each item in theme.site_verification meta(name="google-site-verification" content=theme.google_site_verification)
meta(name=item.name content=item.content)
if theme.bing_site_verification
meta(name="msvalidate.01" content=theme.bing_site_verification)
if theme.baidu_site_verification
meta(name="baidu-site-verification" content=theme.baidu_site_verification)
if theme.qihu_site_verification
meta(name="360-site-verification" content=theme.qihu_site_verification)
if theme.yandex_site_verification
meta(name="yandex-verification" content=theme.yandex_site_verification)

View File

@@ -19,7 +19,7 @@ if !theme.disable_top_img && page.top_img !== false
if top_img !== false if top_img !== false
- var imgSource = top_img && top_img.indexOf('/') !== -1 ? `background-image: url('${url_for(top_img)}')` : `background: ${top_img}` - var imgSource = top_img && top_img.indexOf('/') !== -1 ? `background-image: url('${url_for(top_img)}')` : `background: ${top_img}`
- var bg_img = top_img ? imgSource : '' - var bg_img = top_img ? imgSource : ''
- var site_title = is_archive() ? fragment_cache('findArchivesTitle', function(){return findArchivesTitle(theme.menu);}) : page.title || page.tag || page.category || config.title - var site_title = is_archive() ? _p('page.archives') : page.title || page.tag || page.category || config.title
- var isHomeClass = is_home() ? 'full_page' : 'not-home-page' - var isHomeClass = is_home() ? 'full_page' : 'not-home-page'
- is_post() ? isHomeClass = 'post-bg' : isHomeClass - is_post() ? isHomeClass = 'post-bg' : isHomeClass
else else

View File

@@ -15,32 +15,28 @@ html(lang=config.language data-theme=theme.display_mode class=htmlClassHideAside
!=partial('includes/sidebar', {}, {cache: true}) !=partial('includes/sidebar', {}, {cache: true})
if page.type !== '404' #body-wrap(class=pageType)
#body-wrap(class=pageType) include ./header/index.pug
include ./header/index.pug
main#content-inner.layout(class=hideAside) main#content-inner.layout(class=hideAside)
if body if body
div!= body div!= body
else
block content
if theme.aside.enable && page.aside !== false
include widget/index.pug
- var footerBg = theme.footer_bg
if (footerBg)
if (footerBg === true)
- var footer_bg = bg_img
else
- var footer_bg = theme.footer_bg.indexOf('/') !== -1 ? `background-image: url('${url_for(footerBg)}')` : `background: ${footerBg}`
else else
- var footer_bg = '' block content
if theme.aside.enable && page.aside !== false
include widget/index.pug
footer#footer(style=footer_bg) - var footerBg = theme.footer_bg
!=partial('includes/footer', {}, {cache: true}) if (footerBg)
if (footerBg === true)
- var footer_bg = bg_img
else
- var footer_bg = theme.footer_bg.indexOf('/') !== -1 ? `background-image: url('${url_for(footerBg)}')` : `background: ${footerBg}`
else
- var footer_bg = ''
else footer#footer(style=footer_bg)
include ./404.pug !=partial('includes/footer', {}, {cache: true})
include ./rightside.pug include ./rightside.pug
!=partial('includes/third-party/search/index', {}, {cache: true}) !=partial('includes/third-party/search/index', {}, {cache: true})

View File

@@ -11,7 +11,10 @@ mixin articleSort(posts)
.article-sort-item(class=no_cover) .article-sort-item(class=no_cover)
if article.cover && theme.cover.archives_enable if article.cover && theme.cover.archives_enable
a.article-sort-item-img(href=url_for(article.path) title=title) a.article-sort-item-img(href=url_for(article.path) title=title)
img(src=url_for(article.cover) alt=title onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'`) if theme.lazyload.enable
img(data-lazy-src=url_for(article.cover) alt=title onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'`)
else
img(src=url_for(article.cover) alt=title onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'`)
.article-sort-item-info .article-sort-item-info
.article-sort-item-time .article-sort-item-time
i.far.fa-calendar-alt i.far.fa-calendar-alt

View File

@@ -9,7 +9,10 @@ mixin postUI(posts)
if post_cover && theme.cover.index_enable if post_cover && theme.cover.index_enable
.post_cover(class=leftOrRight) .post_cover(class=leftOrRight)
a(href=url_for(link) title=title) a(href=url_for(link) title=title)
img.post_bg(src=url_for(post_cover) onerror=`this.onerror=null;this.src='`+ url_for(theme.error_img.post_page) + `'` alt=title) if theme.lazyload.enable
img.post_bg(data-lazy-src=url_for(post_cover) onerror=`this.onerror=null;this.src='`+ url_for(theme.error_img.post_page) + `'` alt=title)
else
img.post_bg(src=url_for(post_cover) onerror=`this.onerror=null;this.src='`+ url_for(theme.error_img.post_page) + `'` alt=title)
.recent-post-info(class=no_cover) .recent-post-info(class=no_cover)
a.article-title(href=url_for(link) title=title)= title a.article-title(href=url_for(link) title=title)= title
.article-meta-wrap .article-meta-wrap

View File

@@ -13,9 +13,11 @@
each item in i.link_list each item in i.link_list
.flink-list-item .flink-list-item
a(href=url_for(item.link) title=item.name target="_blank") a(href=url_for(item.link) title=item.name target="_blank")
.flink-item-icon if theme.lazyload.enable
img(data-lazy-src=url_for(item.avatar) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt=item.name )
else
img(src=url_for(item.avatar) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt=item.name ) img(src=url_for(item.avatar) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt=item.name )
.flink-item-name= item.name span.flink-item-name= item.name
.flink-item-desc(title=item.descr)= item.descr span.flink-item-desc(title=item.descr)= item.descr
!= page.content != page.content

View File

@@ -15,7 +15,10 @@ if is_post()
.prev-post(class=hasPageNext) .prev-post(class=hasPageNext)
- var pagination_cover = prev.cover === false ? prev.randomcover : prev.cover - var pagination_cover = prev.cover === false ? prev.randomcover : prev.cover
a(href=url_for(prev.path)) a(href=url_for(prev.path))
img.prev-cover(src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` alt='cover of previous post') if theme.lazyload.enable
img.prev-cover(data-lazy-src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` alt='cover of previous post')
else
img.prev-cover(src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` alt='cover of previous post')
.pagination-info .pagination-info
.label=_p('pagination.prev') .label=_p('pagination.prev')
.prev_info=prev.title .prev_info=prev.title
@@ -25,7 +28,10 @@ if is_post()
- var pagination_cover = next.cover == false ? next.randomcover : next.cover - var pagination_cover = next.cover == false ? next.randomcover : next.cover
.next-post(class=hasPagePrev) .next-post(class=hasPagePrev)
a(href=url_for(next.path)) a(href=url_for(next.path))
img.next-cover(src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` alt='cover of next post') if theme.lazyload.enable
img.next-cover(data-lazy-src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` alt='cover of next post')
else
img.next-cover(src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` alt='cover of next post')
.pagination-info .pagination-info
.label=_p('pagination.next') .label=_p('pagination.next')
.next_info=next.title .next_info=next.title

View File

@@ -8,6 +8,9 @@
- var clickTo = item.link ? item.link : item.img - var clickTo = item.link ? item.link : item.img
li.reward-item li.reward-item
a(href=url_for(clickTo) target='_blank') a(href=url_for(clickTo) target='_blank')
img.post-qr-code-img(src=url_for(item.img) alt=item.text) if theme.lazyload.enable
img.post-qr-code-img(data-lazy-src=url_for(item.img) alt=item.text)
else
img.post-qr-code-img(src=url_for(item.img) alt=item.text)
.post-qr-code-desc=item.text .post-qr-code-desc=item.text

View File

@@ -1,8 +1,11 @@
#sidebar #sidebar
#menu-mask #menu-mask
#sidebar-menus #sidebar-menus
.avatar-img.is-center .author-avatar
img(src=url_for(theme.avatar.img) onerror=`onerror=null;src='${theme.error_img.flink}'` alt="avatar") if theme.lazyload.enable
img.avatar-img(data-lazy-src=url_for(theme.avatar.img) onerror=`onerror=null;src='${theme.error_img.flink}'` alt="avatar")
else
img.avatar-img(src=url_for(theme.avatar.img) onerror=`onerror=null;src='${theme.error_img.flink}'` alt="avatar")
.site-data .site-data
if site.posts.length if site.posts.length
.data-item.is-center .data-item.is-center

View File

@@ -3,9 +3,10 @@ script.
function loadWaline () { function loadWaline () {
function initWaline () { function initWaline () {
let initData = { let initData = {
el: null, el: '#waline-wrap',
serverURL: '!{theme.waline.serverURL}', serverURL: '!{theme.waline.serverURL}',
} }
const waline = new Waline(initData) const waline = new Waline(initData)
} }

View File

@@ -57,4 +57,3 @@ if is_post() && !theme.comments.lazyload && theme.comments.count && theme.commen
} else { } else {
DISQUSWIDGETS.getCount({reset: true}); DISQUSWIDGETS.getCount({reset: true});
} }

View File

@@ -7,7 +7,7 @@ script.
if (typeof FB === 'object') FB.XFBML.parse() if (typeof FB === 'object') FB.XFBML.parse()
else { else {
let ele = document.createElement('script') let ele = document.createElement('script')
ele.setAttribute('src','https://connect.facebook.net/!{theme.facebook_comments.lang}/sdk.js#xfbml=1&version=v10.0') ele.setAttribute('src','https://connect.facebook.net/!{theme.facebook_comments.lang}/sdk.js#xfbml=1&version=v9.0')
ele.setAttribute('async', 'true') ele.setAttribute('async', 'true')
ele.setAttribute('defer', 'true') ele.setAttribute('defer', 'true')
ele.setAttribute('crossorigin', 'anonymous') ele.setAttribute('crossorigin', 'anonymous')

View File

@@ -1,3 +1,7 @@
- let emojiMaps = '""'
if site.data.waline
- emojiMaps = JSON.stringify(site.data.waline)
script. script.
function loadWaline () { function loadWaline () {
function initWaline () { function initWaline () {
@@ -6,8 +10,9 @@ script.
serverURL: '!{theme.waline.serverURL}', serverURL: '!{theme.waline.serverURL}',
avatar: '#{theme.waline.avatar}', avatar: '#{theme.waline.avatar}',
path: location.pathname, path: location.pathname,
visitor: #{theme.waline.visitor}, emojiCDN: '#{theme.waline.emojiCDN}',
dark: 'html[data-theme="dark"]' emojiMaps: !{emojiMaps},
visitor: #{theme.waline.visitor}
}, !{JSON.stringify(theme.waline.option)})) }, !{JSON.stringify(theme.waline.option)}))
} }

View File

@@ -4,7 +4,7 @@ link(rel="stylesheet" type="text/css" href=theme.CDN.katex_copytex_css)
script. script.
(() => { (() => {
document.querySelectorAll('#article-container span.katex-display').forEach(item => { document.querySelectorAll('#article-container span.katex-display').forEach(item => {
btf.wrap(item, 'div', { class: 'katex-wrap'}) btf.wrap(item, 'div', '', 'katex-wrap')
}) })
})() })()

View File

@@ -1,14 +1,21 @@
//- Mathjax 3 //- Mathjax 3
//- http://docs.mathjax.org/en/latest/upgrading/v2.html#changes-in-the-mathjax-api
//- https://github.com/mathjax/MathJax/issues/2209
//- http://docs.mathjax.org/en/latest/options/input/tex.html#the-configuration-block
//- http://docs.mathjax.org/en/latest/web/typeset.html#resetting-automatic-equation-numbering
script. script.
if (!window.MathJax) { if (!window.MathJax) {
window.MathJax = { window.MathJax = {
loader: {
source: {
'[tex]/amsCd': '[tex]/amscd'
}
},
tex: { tex: {
inlineMath: [ ['$','$'], ["\\(","\\)"]], inlineMath: [ ['$','$'], ["\\(","\\)"]],
tags: 'ams' tags: 'ams'
}, },
chtml: {
scale: 1.2
},
options: { options: {
renderActions: { renderActions: {
findScript: [10, doc => { findScript: [10, doc => {
@@ -21,7 +28,15 @@ script.
math.end = {node: text, delim: '', n: 0} math.end = {node: text, delim: '', n: 0}
doc.math.push(math) doc.math.push(math)
} }
}, ''] }, ''],
addClass: [200,() => {
document.querySelectorAll('mjx-container:not([display=\'true\']').forEach( node => {
const target = node.parentNode
if (!target.classList.contains('has-jax')) {
target.classList.add('mathjax-overflow')
}
})
}, '', false]
} }
} }
} }

View File

@@ -15,7 +15,7 @@ script.
} }
const getComment = () => { const getComment = () => {
fetch('https://disqus.com/api/3.0/forums/listPosts.json?forum=!{forum}&related=thread&limit=!{theme.newest_comments.limit}&api_key=!{apiKey}') fetch('https://disqus.com/api/3.0/forums/listPosts.json?forum=!{theme.newest_comments.disqus.forum}&related=thread&limit=!{theme.newest_comments.limit}&api_key=!{theme.newest_comments.disqus.api_key}')
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
const disqusArray = data.response.map(item => { const disqusArray = data.response.map(item => {

View File

@@ -38,7 +38,7 @@ script.
} }
const getComment = () => { const getComment = () => {
fetch('https://api.github.com/repos/!{userRepo}/issues/comments?sort=updated&direction=desc&per_page=!{theme.newest_comments.limit}&page=1',{ fetch('https://api.github.com/repos/!{theme.newest_comments.github_issues.repo}/issues/comments?sort=updated&direction=desc&per_page=!{theme.newest_comments.limit}&page=1',{
"headers": { "headers": {
Accept: 'application/vnd.github.v3.html+json' Accept: 'application/vnd.github.v3.html+json'
} }
@@ -102,8 +102,4 @@ script.
newestCommentInit() newestCommentInit()
document.addEventListener('pjax:complete', newestCommentInit) document.addEventListener('pjax:complete', newestCommentInit)
}) })

View File

@@ -1,26 +1,12 @@
- let { use } = theme.comments - let config = theme.newest_comments
if use if config.valine
- let forum,apiKey,userRepo include ./valine.pug
case use[0] else if config.waline
when 'Valine' include ./waline.pug
include ./valine.pug else if config.github_issues.enable
when 'Waline' include ./github-issues.pug
include ./waline.pug else if config.disqus.enable
when 'Twikoo' include ./disqus-comment.pug
include ./twikoo-comment.pug else if config.twikoo
when 'Disqus' include ./twikoo-comment.pug
- forum = theme.disqus.shortname
- apiKey = theme.disqus.apikey
include ./disqus-comment.pug
when 'Disqusjs'
- forum = theme.disqusjs.shortname
- apiKey = theme.disqusjs.apikey
include ./disqus-comment.pug
when 'Gitalk'
- let { repo,owner } = theme.gitalk
- userRepo = owner + '/' + repo
include ./github-issues.pug
when 'Utterances'
- userRepo = theme.utterances.repo
include ./github-issues.pug

View File

@@ -1,4 +1,4 @@
- let { avatar,avatarCDN } = theme.waline - let default_avatar = theme.waline.avatar
script. script.
window.addEventListener('load', () => { window.addEventListener('load', () => {
@@ -16,10 +16,10 @@ script.
return content return content
} }
const getIcon = (ava,mail) => { const getIcon = (avatar,mail) => {
if (ava) return ava if (avatar) return avatar
let defaultIcon = '!{ avatar ? `?d=${avatar}` : ''}' let defaultIcon = '!{ default_avatar ? `?d=${default_avatar}` : ''}'
let iconUrl = "!{avatarCDN ? avatarCDN : 'https://gravatar.loli.net/avatar/'}" + mail + defaultIcon let iconUrl = `https://gravatar.loli.net/avatar/${mail + defaultIcon}`
return iconUrl return iconUrl
} }
@@ -53,10 +53,11 @@ script.
const getComment = () => { const getComment = () => {
const loadWaline = () => { const loadWaline = () => {
Waline.Widget.RecentComments({ Waline.Widget.RecentComments({
el: '#card-newest-comments .aside-list',
serverURL: '!{theme.waline.serverURL}', serverURL: '!{theme.waline.serverURL}',
count: !{theme.newest_comments.limit} count: !{theme.newest_comments.limit}
}).then(res => { }).then(comments => {
const walineArray = res.comments.map(e => { const walineArray = comments.map(function (e) {
return { return {
'content': changeContent(e.comment), 'content': changeContent(e.comment),
'avatar': getIcon(e.QQAvatar,e.mail), 'avatar': getIcon(e.QQAvatar,e.mail),

View File

@@ -26,30 +26,6 @@ script.
scrollRestoration: false scrollRestoration: false
}) })
document.addEventListener('pjax:send', function () {
// removeEventListener scroll
window.removeEventListener('scroll', window.tocScrollFn)
window.removeEventListener('scroll', scrollCollect)
typeof preloader === 'object' && preloader.initLoading()
if (window.aplayers) {
for (let i = 0; i < window.aplayers.length; i++) {
if (!window.aplayers[i].options.fixed) {
window.aplayers[i].destroy()
}
}
}
typeof typed === 'object' && typed.destroy()
//reset readmode
const $bodyClassList = document.body.classList
$bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode')
})
document.addEventListener('pjax:complete', function () { document.addEventListener('pjax:complete', function () {
window.refreshFn() window.refreshFn()
@@ -85,6 +61,26 @@ script.
typeof preloader === 'object' && preloader.endLoading() typeof preloader === 'object' && preloader.endLoading()
}) })
document.addEventListener('pjax:send', function () {
typeof preloader === 'object' && preloader.initLoading()
if (window.aplayers) {
for (let i = 0; i < window.aplayers.length; i++) {
if (!window.aplayers[i].options.fixed) {
window.aplayers[i].destroy()
}
}
}
typeof typed === 'object' && typed.destroy()
//reset readmode
const $bodyClassList = document.body.classList
$bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode')
})
document.addEventListener('pjax:error', (e) => { document.addEventListener('pjax:error', (e) => {
if (e.request.status === 404) { if (e.request.status === 404) {
pjax.loadUrl('/404.html') pjax.loadUrl('/404.html')

View File

@@ -1,8 +1,10 @@
if theme.aside.card_author.enable if theme.aside.card_author.enable
.card-widget.card-info .card-widget.card-info
.is-center .card-info-avatar.is-center
.avatar-img if theme.lazyload.enable
img(src=url_for(theme.avatar.img) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt="avatar") img.avatar-img(data-lazy-src=url_for(theme.avatar.img) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt="avatar")
else
img.avatar-img(src=url_for(theme.avatar.img) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt="avatar")
.author-info__name= config.author .author-info__name= config.author
.author-info__description!= theme.aside.card_author.description || config.description .author-info__description!= theme.aside.card_author.description || config.description

View File

@@ -1,7 +1,7 @@
if theme.newest_comments.enable if theme.newest_comments.enable
.card-widget#card-newest-comments .card-widget#card-newest-comments
.item-headline .item-headline
i.fas.fa-comment-dots i.fas.fa-bolt
span= _p('aside.card_newest_comments.headline') span= _p('aside.card_newest_comments.headline')
.aside-list .aside-list
span= _p('aside.card_newest_comments.loading_text') span= _p('aside.card_newest_comments.loading_text')

View File

@@ -14,7 +14,10 @@ if theme.aside.card_recent_post.enable
.aside-list-item(class=no_cover) .aside-list-item(class=no_cover)
if post_cover && theme.cover.aside_enable if post_cover && theme.cover.aside_enable
a.thumbnail(href=url_for(link) title=title) a.thumbnail(href=url_for(link) title=title)
img(src=url_for(post_cover) onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'` alt=title) if theme.lazyload.enable
img(data-lazy-src=url_for(post_cover) onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'` alt=title)
else
img(src=url_for(post_cover) onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'` alt=title)
.content .content
a.title(href=url_for(link) title=title)= title a.title(href=url_for(link) title=title)= title
if theme.aside.card_recent_post.sort === 'updated' if theme.aside.card_recent_post.sort === 'updated'

View File

@@ -1,5 +1,5 @@
if site.data.widget && site.data.widget.bottom if site.data.widget
each item in site.data.widget.bottom each item in site.data.widget
.card-widget(class=item.class_name id=item.id_name style=item.order ? `order: ${item.order}` : '') .card-widget(class=item.class_name id=item.id_name style=item.order ? `order: ${item.order}` : '')
.item-headline .item-headline
i(class=item.icon) i(class=item.icon)

View File

@@ -1,8 +0,0 @@
if site.data.widget && site.data.widget.top
each item in site.data.widget.top
.card-widget(class=item.class_name id=item.id_name)
.item-headline
i(class=item.icon)
span=item.name
.item-content
!=item.html

View File

@@ -7,7 +7,6 @@
else else
!=partial('includes/widget/card_author', {}, {cache: true}) !=partial('includes/widget/card_author', {}, {cache: true})
!=partial('includes/widget/card_announcement', {}, {cache: true}) !=partial('includes/widget/card_announcement', {}, {cache: true})
!=partial('includes/widget/card_top_self', {}, {cache: true})
.sticky_layout .sticky_layout
if showToc if showToc
include ./card_post_toc.pug include ./card_post_toc.pug
@@ -17,8 +16,6 @@
//- page //- page
!=partial('includes/widget/card_author', {}, {cache: true}) !=partial('includes/widget/card_author', {}, {cache: true})
!=partial('includes/widget/card_announcement', {}, {cache: true}) !=partial('includes/widget/card_announcement', {}, {cache: true})
!=partial('includes/widget/card_top_self', {}, {cache: true})
.sticky_layout .sticky_layout
!=partial('includes/widget/card_recent_post', {}, {cache: true}) !=partial('includes/widget/card_recent_post', {}, {cache: true})
!=partial('includes/widget/card_ad', {}, {cache: true}) !=partial('includes/widget/card_ad', {}, {cache: true})
@@ -27,4 +24,4 @@
!=partial('includes/widget/card_tags', {}, {cache: true}) !=partial('includes/widget/card_tags', {}, {cache: true})
!=partial('includes/widget/card_archives', {}, {cache: true}) !=partial('includes/widget/card_archives', {}, {cache: true})
!=partial('includes/widget/card_webinfo', {}, {cache: true}) !=partial('includes/widget/card_webinfo', {}, {cache: true})
!=partial('includes/widget/card_bottom_self', {}, {cache: true}) !=partial('includes/widget/card_self', {}, {cache: true})

View File

@@ -1,6 +1,6 @@
{ {
"name": "hexo-theme-butterfly", "name": "hexo-theme-butterfly",
"version": "3.8.0", "version": "3.7.1",
"description": "A Simple and Card UI Design theme for Hexo", "description": "A Simple and Card UI Design theme for Hexo",
"main": "package.json", "main": "package.json",
"scripts": { "scripts": {
@@ -27,6 +27,6 @@
"hexo-renderer-pug": "^1.0.0" "hexo-renderer-pug": "^1.0.0"
}, },
"homepage": "https://butterfly.js.org/", "homepage": "https://butterfly.js.org/",
"author": "Jerry <i@immyw.com>", "author": "Jerry <btf@immyw.com>",
"license": "Apache-2.0" "license": "Apache-2.0"
} }

View File

@@ -9,10 +9,7 @@ hexo.extend.generator.register('404', function (locals) {
if (!hexo.theme.config.error_404.enable) return if (!hexo.theme.config.error_404.enable) return
return { return {
path: '404.html', path: '404.html',
layout: ['page'], data: locals.posts,
data: { layout: ['404']
type: '404',
top_img: false
}
} }
}) })

View File

@@ -2,7 +2,7 @@ const logger = require('hexo-log')()
hexo.extend.filter.register('before_generate', () => { hexo.extend.filter.register('before_generate', () => {
// Get first two digits of the Hexo version number // Get first two digits of the Hexo version number
const hexoVer = hexo.version.replace(/(^.*\..*)\..*/, '$1') var hexoVer = hexo.version.replace(/(^.*\..*)\..*/, '$1')
if (hexoVer < 5) { if (hexoVer < 5) {
logger.error('Please update Hexo to V5.0.0 or higher!') logger.error('Please update Hexo to V5.0.0 or higher!')

View File

@@ -8,22 +8,9 @@
const urlFor = require('hexo-util').url_for.bind(hexo) const urlFor = require('hexo-util').url_for.bind(hexo)
function lazyload (htmlContent) {
const bg = hexo.theme.config.lazyload.placeholder ? urlFor(hexo.theme.config.lazyload.placeholder) : 'data:image/gif;base64,R0lGODdhAQABAPAAAMPDwwAAACwAAAAAAQABAAACAkQBADs='
return htmlContent.replace(/(<img.*? src=)/ig, `$1 "${bg}" data-lazy-src=`)
}
hexo.extend.filter.register('after_render:html', function (data) {
const config = hexo.theme.config.lazyload
if (!config.enable) return
if (config.field !== 'site') return
return lazyload.call(this, data)
})
hexo.extend.filter.register('after_post_render', data => { hexo.extend.filter.register('after_post_render', data => {
const config = hexo.theme.config.lazyload if (!hexo.theme.config.lazyload.enable) return
if (!config.enable) return const bg = hexo.theme.config.lazyload.post ? urlFor(hexo.theme.config.lazyload.post) : 'data:image/gif;base64,R0lGODdhAQABAPAAAMPDwwAAACwAAAAAAQABAAACAkQBADs='
if (config.field !== 'post') return data.content = data.content.replace(/(<img.*? src=)/ig, `$1 "${bg}" data-lazy-src=`)
data.content = lazyload.call(this, data.content)
return data return data
}) })

View File

@@ -6,7 +6,7 @@
'use strict' 'use strict'
hexo.extend.helper.register('inject_head_js', function () { hexo.extend.helper.register('inject_head_js', function () {
const { darkmode, aside, change_font_size, index_img, disable_top_img, pjax} = this.theme const { darkmode, aside, change_font_size } = this.theme
const localStore = ` const localStore = `
win.saveToLocal = { win.saveToLocal = {
@@ -141,21 +141,5 @@ hexo.extend.helper.register('inject_head_js', function () {
` `
} }
let detectApple = '' return `<script>(win=>{${localStore + getScript + darkmodeJs + asideStatus + changFontAside}})(window)</script>`
if (!disable_top_img || index_img !== false) {
detectApple = `
const detectApple = () => {
if (GLOBAL_CONFIG_SITE.isHome && /iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
document.documentElement.classList.add('apple')
}
}
detectApple()
`
if (pjax.enable) {
detectApple += 'document.addEventListener(\'pjax:complete\', detectApple)'
}
}
return `<script>(win=>{${localStore + getScript + darkmodeJs + asideStatus + changFontAside + detectApple}})(window)</script>`
}) })

View File

@@ -70,22 +70,3 @@ hexo.extend.helper.register('injectHtml', function (data) {
} }
return result return result
}) })
hexo.extend.helper.register('findArchivesTitle', function (menu) {
const defaultTitle = this._p('page.archives')
if (!menu) return defaultTitle
const loop = (m) => {
for (const key in m) {
if (typeof m[key] === 'object') {
loop(m[key])
}
if (/\/archives\//.test(m[key])) {
return key
}
}
}
return loop(menu) || defaultTitle
})

View File

@@ -41,6 +41,7 @@ hexo.extend.helper.register('related_posts', function (currentPost, allPosts) {
const limitNum = config.related_post.limit || 6 const limitNum = config.related_post.limit || 6
const dateType = config.related_post.date_type || 'created' const dateType = config.related_post.date_type || 'created'
const headlineLang = this._p('post.recommend') const headlineLang = this._p('post.recommend')
const lazySrc = config.lazyload.enable ? 'data-lazy-src' : 'src'
relatedPosts = relatedPosts.sort(compare('weight')) relatedPosts = relatedPosts.sort(compare('weight'))
@@ -66,7 +67,9 @@ hexo.extend.helper.register('related_posts', function (currentPost, allPosts) {
relatedPosts[i].title + relatedPosts[i].title +
'">' '">'
result += result +=
'<img class="cover" src="' + '<img class="cover" ' +
lazySrc +
'="' +
this.url_for(cover) + this.url_for(cover) +
'" alt="cover">' '" alt="cover">'
if (dateType === 'created') { if (dateType === 'created') {

View File

@@ -22,7 +22,7 @@ function btn (args) {
option = option.trim() option = option.trim()
return `<a class="btn-beautify button--animated ${option}" href="${urlFor(url)}" return `<a class="btn-beautify button--animated ${option}" href="${urlFor(url)}"
title="${text}">${icon.length ? `<i class="${icon}"></i>` : ''}${text.length ? `<span>${text}</span>` : ''}</a>` title="${text}">${icon.length > 0 ? `<i class="${icon} fa-fw"></i>` : ''}<span>${text}</span></a>`
} }
hexo.extend.tag.register('btn', btn, { ends: false }) hexo.extend.tag.register('btn', btn, { ends: false })

View File

@@ -1,16 +0,0 @@
/**
* Butterfly
* label
* {% label text color %}
*/
'use strict'
function addLabel (args, content) {
const text = args[0]
const className = args[1] || 'default'
return `<mark class="hl-label ${className}">${text}</mark> `
}
hexo.extend.tag.register('label', addLabel, { ends: false })

View File

@@ -19,7 +19,7 @@
--btn-hover-color: $button-hover-color --btn-hover-color: $button-hover-color
--btn-color: $button-color --btn-color: $button-color
--btn-bg: $button-bg --btn-bg: $button-bg
--text-bg-hover: rgba($text-bg-hover, .7) --text-bg-hover: $text-bg-hover
--light-grey: $light-grey --light-grey: $light-grey
--white: $white --white: $white
--text-highlight-color: $text-highlight-color --text-highlight-color: $text-highlight-color
@@ -206,15 +206,6 @@ img
&:not([src]) &:not([src])
opacity: 0 opacity: 0
// lazyload blur
if hexo-config('lazyload.enable') && hexo-config('lazyload.blur') && !hexo-config('lazyload.placeholder')
img
&[data-lazy-src]:not(.loaded)
filter: blur(10px) brightness(1)
&[data-lazy-src].error
filter: none
.img-alt .img-alt
margin: -.5rem 0 .5rem margin: -.5rem 0 .5rem
color: #858585 color: #858585

View File

@@ -110,7 +110,7 @@ blockquote
color: var(--hltools-color) color: var(--hltools-color)
font-size: $code-font-size font-size: $code-font-size
&.closed ~ * &.closed + table
display: none display: none
.expand .expand

View File

@@ -0,0 +1,82 @@
if hexo-config('error_404.enable')
#error-wrap
position: absolute
top: 50%
right: 0
left: 0
margin: 0 auto
padding: 0 1rem
max-width: 1000px
transform: translate(0, -50%)
.error-content
display: flex
flex-direction: row
justify-content: center
align-items: center
margin: 0 1rem
height: 18rem
border-radius: 8px
background: var(--card-bg)
box-shadow: var(--card-box-shadow)
transition: all .3s
&:hover
box-shadow: var(--card-hover-box-shadow)
+maxWidth768()
flex-direction: column
margin: 0
height: 25rem
.error-img
flex: 1
height: 100%
border-top-left-radius: 8px
border-bottom-left-radius: 8px
background-color: $theme-color
background-position: center
background-size: cover
+maxWidth768()
flex: 1
width: 100%
border-top-right-radius: 8px
border-bottom-left-radius: 0
.error-info
flex: 1
padding: .5rem
text-align: center
font-size: 14px
if $site-name-font
font-family: $site-name-font
+maxWidth768()
flex: 1.1
width: 100%
.error_title
margin-top: -4rem
font-size: 9em
+maxWidth768()
margin-top: -3rem
.error_subtitle
@extend .limit-more-line
margin-top: -3.5rem
word-break: break-word
font-size: 1.6em
-webkit-line-clamp: 2
a
display: inline-block
margin-top: .5rem
padding: .3rem 1.5rem
background: var(--btn-bg)
color: var(--btn-color)
i
padding-right: .3rem

View File

@@ -35,6 +35,15 @@
display: none display: none
.card-info .card-info
img
width: 110px
height: 110px
border-radius: 70px
transition: all .5s
&:hover
transform: rotate(360deg)
.author-info .author-info
&__name &__name
font-weight: 500 font-weight: 500
@@ -94,7 +103,7 @@
font-size: 1.2em font-size: 1.2em
span span
margin-left: .3rem margin-left: .5rem
.sticky_layout .sticky_layout
+minWidth900() +minWidth900()
@@ -322,21 +331,6 @@
&:hover &:hover
animation: more-btn-move 1s infinite animation: more-btn-move 1s infinite
.avatar-img
overflow: hidden
margin: 0 auto
width: 110px
height: 110px
border-radius: 70px
img
height: 100%
transition: all .5s
object-fit: cover
&:hover
transform: rotate(360deg)
@keyframes more-btn-move @keyframes more-btn-move
0%, 0%,
100% 100%

View File

@@ -9,7 +9,7 @@
// index // index
&.full_page &.full_page
min-height: $index_top_img_height height: $index_top_img_height
background-attachment: fixed background-attachment: fixed
#site-info #site-info
@@ -70,7 +70,7 @@
// page // page
&.not-home-page &.not-home-page
min-height: 20rem height: 20rem
+maxWidth768() +maxWidth768()
height: 14rem height: 14rem
@@ -86,7 +86,7 @@
// post // post
&.post-bg &.post-bg
min-height: 20rem height: 20rem
+maxWidth768() +maxWidth768()
height: 18rem height: 18rem
@@ -118,7 +118,7 @@
&.not-top-img &.not-top-img
margin-bottom: .5rem margin-bottom: .5rem
min-height: 60px height: 60px
background: 0 background: 0
#nav #nav
@@ -157,9 +157,12 @@
top: 70px top: 70px
transition: top .5s transition: top .5s
.apple // css hack
#page-header.full_page // all browser in ios and safari in all apple device
background-attachment: scroll !important _::-webkit-full-page-media,
_:future,
:root #page-header.full_page
background-attachment: scroll !important
#page #page
h1.page-title h1.page-title

View File

@@ -185,9 +185,6 @@ no-beautify()
else else
no-beautify() no-beautify()
> :last-child
margin-bottom: 0 !important
#post #post
.tag_share .tag_share
.post-meta .post-meta

View File

@@ -22,12 +22,22 @@
&.open &.open
transform: translate3d(-100%, 0, 0) transform: translate3d(-100%, 0, 0)
& > .avatar-img & > .author-avatar
margin: 1rem auto padding: 1.3rem 1.5rem 0
text-align: center
img
width: 110px
height: 110px
border-radius: 70px
transition: all .5s
&:hover
transform: rotate(360deg)
.site-data .site-data
display: table display: table
padding: 0 .5rem padding: .6rem .5rem 0
width: 100% width: 100%
table-layout: fixed table-layout: fixed
@@ -55,21 +65,25 @@
@extend .limit-one-line @extend .limit-one-line
position: relative position: relative
display: block display: block
padding: .3rem 1.5rem .3rem 1.1rem padding: .3rem 1.5rem
color: var(--font-color) color: var(--font-color)
font-size: 1.15em font-size: 1.15em
cursor: pointer
&:hover
background: var(--text-bg-hover)
i:first-child i:first-child
width: 15% width: 25%
text-align: left text-align: left
span
width: 75%
&:hover
color: $light-blue
.expand .expand
position: absolute position: absolute
top: .78em top: .78em
right: .9rem right: .4rem
transition: transform .3s transition: transform .3s
&.hide &.hide

View File

@@ -1,4 +1,5 @@
#vcomment #vcomment,
#waline
font-size: 1.1em font-size: 1.1em
.vbtn .vbtn
@@ -20,18 +21,6 @@
&:after &:after
z-index: 22 z-index: 22
#waline-wrap
--waline-font-size: 1.1em
--waline-theme-color: $button-bg
--waline-active-color: $button-hover-color
--waline-avatar-size: 2.75rem
.vuser
transition: all .5s
&:hover
transform: rotate(360deg)
if hexo-config('valine.bg') if hexo-config('valine.bg')
#vcomment #vcomment
textarea textarea
@@ -90,13 +79,14 @@ if hexo-config('waline.bg')
display: none display: none
// mathjax // mathjax
mjx-container .mathjax-overflow
overflow-x: auto overflow-x: auto
overflow-y: hidden overflow-y: hidden
&:not([display]) mjx-container[jax='CHTML'][display='true']
display: inline-grid overflow-x: auto
max-width: 100% overflow-y: hidden
padding-bottom: .3rem
.aplayer .aplayer
color: $font-black color: $font-black

View File

@@ -91,20 +91,14 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
.hide-button, .hide-button,
.btn-beautify, .btn-beautify,
.mermaid, .mermaid,
.hl-label,
.post-outdate-notice, .post-outdate-notice,
.error-img, .error-img,
#article-container iframe, #article-container iframe,
img,
.gist, .gist,
.ads-wrap .ads-wrap
filter: brightness(.8) filter: brightness(.8)
img
if hexo-config('lazyload.enable') && hexo-config('lazyload.blur') && !hexo-config('lazyload.placeholder')
filter: blur(0) brightness(.8)
else
filter: brightness(.8)
#aside-content .aside-list > .aside-list-item:not(:last-child) #aside-content .aside-list > .aside-list-item:not(:last-child)
border-bottom: 1px dashed alpha(#FFFFFF, .1) border-bottom: 1px dashed alpha(#FFFFFF, .1)

View File

@@ -173,15 +173,24 @@ if hexo-config('readmode')
border: 1px solid var(--gray) !important border: 1px solid var(--gray) !important
.hide-button, .hide-button,
.btn-beautify, .btn-beautify
.hl-label
border: 1px solid var(--gray) !important
background: var(--readmode-light-color) !important background: var(--readmode-light-color) !important
color: var(--font-color) !important color: var(--font-color) !important
.btn-beautify
border: 1px solid var(--gray) !important
.button--animated:before .button--animated:before
background: var(--readmode-light-color) !important background: var(--readmode-light-color) !important
.hide-inline,
.hide-block
& >.hide-button
border: 1px solid var(--gray)
& > .button--animated:before
background: var(--readmode-light-color)
.note .note
border: 2px solid var(--gray) border: 2px solid var(--gray)
border-left-color: var(--gray) !important border-left-color: var(--gray) !important

View File

@@ -1,86 +0,0 @@
if hexo-config('error_404.enable')
.error404
#error-wrap
position: absolute
top: 50%
right: 0
left: 0
margin: 0 auto
padding: 0 1rem
max-width: 1000px
transform: translate(0, -50%)
.error-content
display: flex
flex-direction: row
justify-content: center
align-items: center
margin: 0 1rem
height: 18rem
border-radius: 8px
background: var(--card-bg)
box-shadow: var(--card-box-shadow)
transition: all .3s
&:hover
box-shadow: var(--card-hover-box-shadow)
+maxWidth768()
flex-direction: column
margin: 0
height: 25rem
.error-img
flex: 1
height: 100%
border-top-left-radius: 8px
border-bottom-left-radius: 8px
background-color: $theme-color
background-position: center
background-size: cover
+maxWidth768()
flex: 1
width: 100%
border-top-right-radius: 8px
border-bottom-left-radius: 0
.error-info
flex: 1
padding: .5rem
text-align: center
font-size: 14px
if $site-name-font
font-family: $site-name-font
+maxWidth768()
flex: 1.1
width: 100%
.error_title
margin-top: -4rem
font-size: 9em
+maxWidth768()
margin-top: -3rem
.error_subtitle
@extend .limit-more-line
margin-top: -3.5rem
word-break: break-word
font-size: 1.6em
-webkit-line-clamp: 2
a
display: inline-block
margin-top: .5rem
padding: .3rem 1.5rem
background: var(--btn-bg)
color: var(--btn-color)
i
padding-right: .3rem
& + #rightside
display: none

View File

@@ -1,15 +1,8 @@
#body-wrap
display: flex
flex-direction: column
height: 100vh
.layout .layout
display: flex display: flex
flex: 1 auto
margin: 0 auto margin: 0 auto
padding: 2rem 15px padding: 2rem 15px
max-width: 1200px max-width: 1200px
width: 100%
+maxWidth900() +maxWidth900()
flex-direction: column flex-direction: column

View File

@@ -50,24 +50,20 @@
color: var(--font-color) color: var(--font-color)
text-decoration: none text-decoration: none
.flink-item-icon img
float: left float: left
overflow: hidden
margin: 15px 10px margin: 15px 10px
width: 60px width: 60px
height: 60px height: 60px
border-radius: 35px border-radius: 35px
transition: all .3s
img
width: 100%
height: 100%
transition: all .3s
.img-alt .img-alt
display: none display: none
.flink-item-name .flink-item-name
@extend .limit-one-line @extend .limit-one-line
display: block
padding: 16px 10px 0 0 padding: 16px 10px 0 0
height: 40px height: 40px
font-weight: bold font-weight: bold
@@ -75,6 +71,7 @@
.flink-item-desc .flink-item-desc
@extend .limit-one-line @extend .limit-one-line
display: block
padding: 16px 10px 16px 0 padding: 16px 10px 16px 0
height: 50px height: 50px
font-size: .93em font-size: .93em

View File

@@ -1,5 +1,7 @@
#algolia-search #algolia-search
.search-dialog .search-dialog
animation: titlescale .5s
.ais-search-box .ais-search-box
margin: 0 auto margin: 0 auto
max-width: 100% max-width: 100%

View File

@@ -7,9 +7,7 @@
margin-left: -15rem margin-left: -15rem
padding: 1rem padding: 1rem
width: 30rem width: 30rem
border-radius: 8px
background: var(--search-bg) background: var(--search-bg)
animation: titlescale .5s
+maxWidth768() +maxWidth768()
top: 0 top: 0
@@ -17,7 +15,6 @@
margin: 0 margin: 0
width: 100% width: 100%
height: 100% height: 100%
border-radius: 0
hr hr
margin: 1rem auto margin: 1rem auto

View File

@@ -1,5 +1,7 @@
#local-search #local-search
.search-dialog .search-dialog
animation: titlescale .5s
.local-search-box .local-search-box
margin: 0 auto margin: 0 auto
max-width: 100% max-width: 100%

View File

@@ -11,9 +11,6 @@
color: $btn-color color: $btn-color
line-height: 2 line-height: 2
i + span
margin-left: .3rem
&:not(.block) + .btn-beautify:not(.block) &:not(.block) + .btn-beautify:not(.block)
margin: 0 .2rem 1rem margin: 0 .2rem 1rem

View File

@@ -1,11 +0,0 @@
.hl-label
padding: 2px 4px
border-radius: 3px
color: $btn-color
&.default
background-color: $btn-default-color
for $type in $tagsP-types
&.{$type}
background-color: lookup('$tagsP-' + $type + '-color')

View File

@@ -33,7 +33,7 @@ $font-color = #1F2D3D
$rem = 20px $rem = 20px
$text-line-height = 2 $text-line-height = 2
$web-bg = hexo-config('background') && unquote(hexo-config('background')) $web-bg = hexo-config('background') && unquote(hexo-config('background'))
$index_top_img_height = hexo-config('index_top_img_height') ? convert(hexo-config('index_top_img_height')) : 100% $index_top_img_height = hexo-config('index_top_img_height') ? convert(hexo-config('index_top_img_height')) : 100vh
$index_site_info_top = hexo-config('index_site_info_top') ? convert(hexo-config('index_site_info_top')) : 43% $index_site_info_top = hexo-config('index_site_info_top') ? convert(hexo-config('index_site_info_top')) : 43%
// Global color & SVG // Global color & SVG
$light-blue = $theme-color $light-blue = $theme-color

BIN
source/img/loading.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

@@ -194,7 +194,7 @@ document.addEventListener('DOMContentLoaded', function () {
$figureHighlight.forEach(function (item) { $figureHighlight.forEach(function (item) {
const langName = item.getAttribute('data-language') ? item.getAttribute('data-language') : 'Code' const langName = item.getAttribute('data-language') ? item.getAttribute('data-language') : 'Code'
const highlightLangEle = `<div class="code-lang">${langName}</div>` const highlightLangEle = `<div class="code-lang">${langName}</div>`
btf.wrap(item, 'figure', { class: 'highlight' }) btf.wrap(item, 'figure', '', 'highlight')
createEle(highlightLangEle, item) createEle(highlightLangEle, item)
}) })
} else { } else {
@@ -208,7 +208,7 @@ document.addEventListener('DOMContentLoaded', function () {
} else { } else {
if (isPrismjs) { if (isPrismjs) {
$figureHighlight.forEach(function (item) { $figureHighlight.forEach(function (item) {
btf.wrap(item, 'figure', { class: 'highlight' }) btf.wrap(item, 'figure', '', 'highlight')
createEle('', item) createEle('', item)
}) })
} else { } else {
@@ -332,55 +332,50 @@ document.addEventListener('DOMContentLoaded', function () {
return return
} }
let initTop = 0
let isChatShow = true
const $header = document.getElementById('page-header')
const isChatBtnHide = typeof chatBtnHide === 'function'
const isChatBtnShow = typeof chatBtnShow === 'function'
window.addEventListener('scroll', btf.throttle(function (e) {
const currentTop = window.scrollY || document.documentElement.scrollTop
const isDown = scrollDirection(currentTop)
if (currentTop > 56) {
if (isDown) {
if ($header.classList.contains('nav-visible')) $header.classList.remove('nav-visible')
if (isChatBtnShow && isChatShow === true) {
chatBtnHide()
isChatShow = false
}
} else {
if (!$header.classList.contains('nav-visible')) $header.classList.add('nav-visible')
if (isChatBtnHide && isChatShow === false) {
chatBtnShow()
isChatShow = true
}
}
$header.classList.add('nav-fixed')
if (window.getComputedStyle($rightside).getPropertyValue('opacity') === '0') {
$rightside.style.cssText = 'opacity: 1; transform: translateX(-38px)'
}
} else {
if (currentTop === 0) {
$header.classList.remove('nav-fixed', 'nav-visible')
}
$rightside.style.cssText = "opacity: ''; transform: ''"
}
if (document.body.scrollHeight <= innerHeight) {
$rightside.style.cssText = 'opacity: 1; transform: translateX(-38px)'
}
}, 200))
// find the scroll direction // find the scroll direction
function scrollDirection (currentTop) { function scrollDirection (currentTop) {
const result = currentTop > initTop // true is down & false is up const result = currentTop > initTop // true is down & false is up
initTop = currentTop initTop = currentTop
return result return result
} }
let initTop = 0
let isChatShow = true
const $header = document.getElementById('page-header')
const isChatBtnHide = typeof chatBtnHide === 'function'
const isChatBtnShow = typeof chatBtnShow === 'function'
window.scrollCollect = () => {
return btf.throttle(function (e) {
const currentTop = window.scrollY || document.documentElement.scrollTop
const isDown = scrollDirection(currentTop)
if (currentTop > 56) {
if (isDown) {
if ($header.classList.contains('nav-visible')) $header.classList.remove('nav-visible')
if (isChatBtnShow && isChatShow === true) {
chatBtnHide()
isChatShow = false
}
} else {
if (!$header.classList.contains('nav-visible')) $header.classList.add('nav-visible')
if (isChatBtnHide && isChatShow === false) {
chatBtnShow()
isChatShow = true
}
}
$header.classList.add('nav-fixed')
if (window.getComputedStyle($rightside).getPropertyValue('opacity') === '0') {
$rightside.style.cssText = 'opacity: 1; transform: translateX(-38px)'
}
} else {
if (currentTop === 0) {
$header.classList.remove('nav-fixed', 'nav-visible')
}
$rightside.style.cssText = "opacity: ''; transform: ''"
}
if (document.body.scrollHeight <= innerHeight) {
$rightside.style.cssText = 'opacity: 1; transform: translateX(-38px)'
}
}, 200)()
}
window.addEventListener('scroll', scrollCollect)
} }
/** /**
@@ -393,14 +388,11 @@ document.addEventListener('DOMContentLoaded', function () {
const $article = document.getElementById('article-container') const $article = document.getElementById('article-container')
// main of scroll // main of scroll
window.tocScrollFn = function () { window.addEventListener('scroll', btf.throttle(function (e) {
return btf.throttle(function () { const currentTop = window.scrollY || document.documentElement.scrollTop
const currentTop = window.scrollY || document.documentElement.scrollTop scrollPercent(currentTop)
scrollPercent(currentTop) findHeadPosition(currentTop)
findHeadPosition(currentTop) }, 100))
}, 100)()
}
window.addEventListener('scroll', tocScrollFn)
const scrollPercent = function (currentTop) { const scrollPercent = function (currentTop) {
const docHeight = $article.clientHeight const docHeight = $article.clientHeight
@@ -418,11 +410,7 @@ document.addEventListener('DOMContentLoaded', function () {
const updateAnchor = function (anchor) { const updateAnchor = function (anchor) {
if (window.history.replaceState && anchor !== window.location.hash) { if (window.history.replaceState && anchor !== window.location.hash) {
if (!anchor) anchor = location.pathname if (!anchor) anchor = location.pathname
const title = GLOBAL_CONFIG_SITE.title window.history.replaceState({}, '', anchor)
window.history.replaceState({
url: location.href,
title: title
}, title, anchor)
} }
} }
@@ -692,7 +680,7 @@ document.addEventListener('DOMContentLoaded', function () {
const $table = document.querySelectorAll('#article-container :not(.highlight) > table, #article-container > table') const $table = document.querySelectorAll('#article-container :not(.highlight) > table, #article-container > table')
if ($table.length) { if ($table.length) {
$table.forEach(item => { $table.forEach(item => {
btf.wrap(item, 'div', { class: 'table-wrap' }) btf.wrap(item, 'div', '', 'table-wrap')
}) })
} }
} }

View File

@@ -207,18 +207,18 @@ const btf = {
* *
* @param {*} selector * @param {*} selector
* @param {*} eleType the type of create element * @param {*} eleType the type of create element
* @param {*} options object key: value * @param {*} id id
* @param {*} cn class name
*/ */
wrap: (selector, eleType, options) => { wrap: function (selector, eleType, id = '', cn = '') {
const creatEle = document.createElement(eleType) const creatEle = document.createElement(eleType)
for (const [key, value] of Object.entries(options)) { if (id) creatEle.id = id
creatEle.setAttribute(key, value) if (cn) creatEle.className = cn
}
selector.parentNode.insertBefore(creatEle, selector) selector.parentNode.insertBefore(creatEle, selector)
creatEle.appendChild(selector) creatEle.appendChild(selector)
}, },
unwrap: el => { unwrap: function (el) {
const elParentNode = el.parentNode const elParentNode = el.parentNode
if (elParentNode !== document.body) { if (elParentNode !== document.body) {
elParentNode.parentNode.insertBefore(el, elParentNode) elParentNode.parentNode.insertBefore(el, elParentNode)
@@ -226,7 +226,7 @@ const btf = {
} }
}, },
isJqueryLoad: fn => { isJqueryLoad: (fn) => {
if (typeof jQuery === 'undefined') { if (typeof jQuery === 'undefined') {
getScript(GLOBAL_CONFIG.source.jQuery).then(fn) getScript(GLOBAL_CONFIG.source.jQuery).then(fn)
} else { } else {
@@ -234,9 +234,9 @@ const btf = {
} }
}, },
isHidden: ele => ele.offsetHeight === 0 && ele.offsetWidth === 0, isHidden: (ele) => ele.offsetHeight === 0 && ele.offsetWidth === 0,
getEleTop: ele => { getEleTop: (ele) => {
let actualTop = ele.offsetTop let actualTop = ele.offsetTop
let current = ele.offsetParent let current = ele.offsetParent