mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-10 21:17:07 +08:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
91bb944931 | ||
|
|
bade41acd7 | ||
|
|
da8ffda39b | ||
|
|
3bf033c9e4 | ||
|
|
bb8e98c68a | ||
|
|
6cdd19e07f | ||
|
|
49a9995a3d | ||
|
|
6c59f72ca2 | ||
|
|
f07405706b | ||
|
|
0a1d8b0eba | ||
|
|
dfdd3289bb |
@@ -15,7 +15,7 @@ git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes
|
||||
如果想要安裝比較新的dev分支,可以
|
||||
|
||||
```
|
||||
git clone -b div https://github.com/jerryc127/hexo-theme-butterfly.git themes/Butterfly
|
||||
git clone -b dev https://github.com/jerryc127/hexo-theme-butterfly.git themes/Butterfly
|
||||
```
|
||||
|
||||
## 应用主题
|
||||
@@ -29,8 +29,7 @@ theme: Butterfly
|
||||
|
||||
## 文档
|
||||
|
||||
可查看[这里](https://jerryc.me/posts/21cfbf15)
|
||||
|
||||
可查看或[这里](https://docs.jerryc.me/)或[这里](https://jerryc.me/posts/21cfbf15)
|
||||
|
||||
|
||||
## 截图
|
||||
|
||||
61
_config.yml
61
_config.yml
@@ -121,14 +121,11 @@ cdn:
|
||||
css:
|
||||
fontawesome: https://cdn.jsdelivr.net/npm/font-awesome@latest/css/font-awesome.min.css
|
||||
# fontawesomeV5: https://use.fontawesome.com/releases/v5.8.1/css/all.css
|
||||
googlefont: https://fonts.googleapis.com/css?family=Titillium+Web
|
||||
fancybox: https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css
|
||||
js:
|
||||
jquery: https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js
|
||||
fancybox: https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js
|
||||
js-cookies: https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js
|
||||
lozy: https://cdn.jsdelivr.net/npm/lozad/dist/lozad.min.js
|
||||
|
||||
|
||||
# Post info settings
|
||||
# ---------------
|
||||
@@ -241,7 +238,7 @@ valine:
|
||||
verify: false # valine verify code (true/false)
|
||||
pageSize: 10 # comment list page size
|
||||
avatar: monsterid # gravatar style https://valine.js.org/#/avatar
|
||||
lang: en # i18n: zh-cn/en/tw
|
||||
lang: en # i18n: zh-cn/en
|
||||
placeholder: Please leave your footprints # valine comment input placeholder(like: Please leave your footprints )
|
||||
guest_info: nick,mail,link #valine comment header inf
|
||||
|
||||
@@ -276,10 +273,6 @@ google_site_verification:
|
||||
# See: https://www.bing.com/webmaster/
|
||||
bing_site_verification:
|
||||
|
||||
# Yandex Webmaster tools verification setting
|
||||
# See: https://webmaster.yandex.ru/
|
||||
#yandex_site_verification:
|
||||
|
||||
# Baidu Webmaster tools verification setting
|
||||
# See: https://ziyuan.baidu.com/site/
|
||||
baidu_site_verification:
|
||||
@@ -333,7 +326,7 @@ related_post:
|
||||
# canvas_ribbon
|
||||
# See: https://github.com/hustcc/ribbon.js
|
||||
canvas_ribbon:
|
||||
enable: false
|
||||
enable: true
|
||||
size: 150
|
||||
alpha: 0.6
|
||||
zIndex: -1
|
||||
@@ -341,7 +334,7 @@ canvas_ribbon:
|
||||
|
||||
|
||||
canvas_ribbon_piao:
|
||||
enable: true
|
||||
enable: false
|
||||
|
||||
|
||||
# 避免重複網址分散seo
|
||||
@@ -357,11 +350,18 @@ Open_Graph_meta: true
|
||||
readmode:
|
||||
enable: true
|
||||
|
||||
#全局字體
|
||||
font:
|
||||
enable: false
|
||||
font-family: Lato, Helvetica Neue For Number, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, PingFang SC, Hiragino Sans GB,"Microsoft JhengHei", "MicrMicrosoft YaHei", Helvetica Neue, Helvetica, Arial, sans-serif
|
||||
code-font: consolas, Menlo, "PingFang SC", "Microsoft JhengHei","Microsoft YaHei", monospace, Helvetica Neue For Number
|
||||
|
||||
#網站名字字體
|
||||
#左上角網站名字 主頁居中網站名字
|
||||
blog_title_font:
|
||||
#字體鏈接
|
||||
font_link: https://fonts.googleapis.com/css?family=Titillium+Web
|
||||
font-family: Titillium Web, PingFang SC, Hiragino Sans GB, "Microsoft JhengHei", "Microsoft YaHei", Helvetica Neue, Helvetica, Arial, sans-serif
|
||||
|
||||
#水平分隔綫
|
||||
hr:
|
||||
@@ -374,10 +374,11 @@ hr:
|
||||
subtitle:
|
||||
enable: true
|
||||
sub1: 今日事,今日畢
|
||||
sub2: Never put off till tomorrow what you can do today
|
||||
sub2: Never put off till tomorrow what you can do today #如果有符號 ' ,記得前面加上 \
|
||||
|
||||
#側邊欄顯示設置
|
||||
aside:
|
||||
position: right # left or right
|
||||
card_author: true
|
||||
card_announcement: true
|
||||
card_recent_post: true
|
||||
@@ -391,13 +392,13 @@ aside:
|
||||
translate:
|
||||
enable: true
|
||||
# 默認按鈕顯示文字
|
||||
default: 簡
|
||||
default: 繁
|
||||
#网站默认语言,1: 繁體中文, 2: 简体中文
|
||||
defaultEncoding: 1
|
||||
defaultEncoding: 2
|
||||
#延迟时间,若不在前, 要设定延迟翻译时间, 如100表示100ms,默认为0
|
||||
translateDelay: 0
|
||||
#博客网址
|
||||
cookieDomain: "https://jerryc.me/"
|
||||
cookieDomain: "https://xxx/"
|
||||
#當文字是簡體時,按鈕顯示的文字
|
||||
msgToTraditionalChinese: "繁"
|
||||
#當文字是繁體時,按鈕顯示的文字
|
||||
@@ -410,4 +411,34 @@ fireworks:
|
||||
|
||||
#百度推送
|
||||
baidu_push:
|
||||
enable: false
|
||||
enable: false
|
||||
|
||||
#https://instant.page/
|
||||
#prefetch預加載
|
||||
instantpage:
|
||||
enable: true
|
||||
|
||||
note:
|
||||
# Note tag style values:
|
||||
# - simple bs-callout old alert style. Default.
|
||||
# - modern bs-callout new (v2-v3) alert style.
|
||||
# - flat flat callout style with background, like on Mozilla or StackOverflow.
|
||||
# - disabled disable all CSS styles import of note tag.
|
||||
style: simple
|
||||
icons: true
|
||||
border_radius: 3
|
||||
# Offset lighter of background in % for modern and flat styles (modern: -12 | 12; flat: -18 | 6).
|
||||
# Offset also applied to label tag variables. This option can work with disabled note tag.
|
||||
light_bg_offset: 0
|
||||
|
||||
|
||||
#圖片懶加載
|
||||
lazyload:
|
||||
enable: true
|
||||
script: https://cdn.jsdelivr.net/npm/lozad/dist/lozad.min.js
|
||||
|
||||
# 美化post頁顯示
|
||||
post_beautify:
|
||||
enable: false
|
||||
title-prefix-icon: '\f0c1'
|
||||
title-prefix-icon-color: "#F47466"
|
||||
@@ -19,7 +19,7 @@ page:
|
||||
|
||||
sticky: Sticky
|
||||
no_title: No title
|
||||
read_more: Read more
|
||||
archives: Archives
|
||||
|
||||
post:
|
||||
created: Created
|
||||
@@ -50,7 +50,6 @@ pagination:
|
||||
next: Next Post
|
||||
|
||||
comment: Comment
|
||||
relatedPosts_headline: Recommend
|
||||
|
||||
aside:
|
||||
articles: Articles
|
||||
|
||||
@@ -19,7 +19,7 @@ page:
|
||||
|
||||
sticky: Sticky
|
||||
no_title: No title
|
||||
read_more: Read more
|
||||
archives: Archives
|
||||
|
||||
post:
|
||||
created: Created
|
||||
@@ -50,7 +50,6 @@ pagination:
|
||||
next: Next Post
|
||||
|
||||
comment: Comment
|
||||
relatedPosts_headline: Recommend
|
||||
|
||||
aside:
|
||||
articles: Articles
|
||||
|
||||
@@ -19,7 +19,7 @@ page:
|
||||
|
||||
sticky: 置顶
|
||||
no_title: 无题
|
||||
read_more: 阅读更多
|
||||
archives: 时间轴
|
||||
|
||||
post:
|
||||
created: 发表于
|
||||
@@ -51,7 +51,6 @@ pagination:
|
||||
next: 下一篇
|
||||
|
||||
comment: 评论
|
||||
relatedPosts_headline: 相关推荐
|
||||
|
||||
aside:
|
||||
articles: 文章
|
||||
|
||||
@@ -20,15 +20,11 @@ page:
|
||||
sticky: 置頂
|
||||
no_title: 無題
|
||||
archives: 時間軸
|
||||
read_more: 閲讀更多
|
||||
created_date: 發表於
|
||||
update_date: 更新於
|
||||
|
||||
post:
|
||||
created: 發表於
|
||||
updated: 更新於
|
||||
wordcount: 字數總計
|
||||
commentcount: 評論數
|
||||
min2read: "閲讀時長: %s 分鐘"
|
||||
page_pv: 閲讀量
|
||||
copyright:
|
||||
@@ -56,7 +52,6 @@ pagination:
|
||||
next: 下一篇
|
||||
|
||||
comment: 評論
|
||||
relatedPosts_headline: 相關推薦
|
||||
|
||||
aside:
|
||||
articles: 文章
|
||||
|
||||
@@ -8,4 +8,4 @@ block content
|
||||
+articleSort(page.posts)
|
||||
include includes/pagination.pug
|
||||
#aside_content.aside_content
|
||||
include includes/aside.pug
|
||||
include includes/aside.pug
|
||||
|
||||
@@ -6,7 +6,10 @@
|
||||
each item in i.link_list
|
||||
li.md-links-item
|
||||
a(href=item.link title=item.name target="_blank")
|
||||
img.lozad(data-src=item.avatar alt=item.name onerror=`onerror=null;src='${theme.lodding_bg.flink}'` height="72px")
|
||||
if theme.lazyload.enable
|
||||
img.lozad(data-src=item.avatar onerror=`onerror=null;src='${theme.lodding_bg.flink}'` height="72px")
|
||||
else
|
||||
img(src=item.avatar onerror=`onerror=null;src='${theme.lodding_bg.flink}'` height="72px")
|
||||
div(class="md-links-title")= item.name
|
||||
<br/>
|
||||
div(class="md-links-des")=item.descr
|
||||
|
||||
@@ -57,7 +57,7 @@ if is_home()
|
||||
e[i].style.height = n + "px";
|
||||
$("#site-info").each(function () {
|
||||
var x = $(this).height();
|
||||
$(this).css({"padding-top": (n-x)/2 , "padding-bottom":(n-x)/2 })
|
||||
$(this).css("top", (n-x)/2)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -87,5 +87,12 @@ if is_home()
|
||||
|
||||
if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv
|
||||
script(async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js")
|
||||
|
||||
script(src="https://cdn.jsdelivr.net/npm/instant.page@1.2.2/instantpage.min.js" type="module")
|
||||
|
||||
if theme.instantpage.enable
|
||||
script(src="https://cdn.jsdelivr.net/npm/instant.page@1.2.2/instantpage.min.js" type="module")
|
||||
|
||||
if theme.lazyload.enable
|
||||
script(src=url_for(theme.lazyload.script))
|
||||
script.
|
||||
const observer = lozad(); // lazy loads elements with default selector as '.lozad'
|
||||
observer.observe();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
if theme.disqus.enable
|
||||
if theme.disqus && theme.disqus.enable
|
||||
#disqus_thread
|
||||
script.
|
||||
var unused = null;
|
||||
|
||||
@@ -1,40 +1,35 @@
|
||||
if theme.disqus.enable
|
||||
if theme.disqus && theme.disqus.enable
|
||||
hr
|
||||
#post-comment
|
||||
.comment_headling
|
||||
i.fa.fa-comments.fa-fw(aria-hidden="true")
|
||||
=" "
|
||||
span= _p('comment')
|
||||
span= ' ' + _p('comment')
|
||||
include ./disqus.pug
|
||||
else if theme.laibili && theme.laibili.enable
|
||||
hr
|
||||
#post-comment
|
||||
.comment_headling
|
||||
i.fa.fa-comments.fa-fw(aria-hidden="true")
|
||||
=" "
|
||||
span= _p('comment')
|
||||
span= ' ' + _p('comment')
|
||||
include ./laibili.pug
|
||||
else if theme.gitment && theme.gitment.enable
|
||||
hr
|
||||
#post-comment
|
||||
.comment_headling
|
||||
i.fa.fa-comments.fa-fw(aria-hidden="true")
|
||||
=" "
|
||||
span= _p('comment')
|
||||
span= ' ' + _p('comment')
|
||||
include ./gitment.pug
|
||||
else if theme.gitalk && theme.gitalk.enable
|
||||
hr
|
||||
#post-comment
|
||||
.comment_headling
|
||||
i.fa.fa-comments.fa-fw(aria-hidden="true")
|
||||
=" "
|
||||
span= _p('comment')
|
||||
span= ' ' + _p('comment')
|
||||
include ./gitalk.pug
|
||||
else if theme.valine && theme.valine.enable
|
||||
hr
|
||||
#post-comment
|
||||
.comment_headling
|
||||
i.fa.fa-comments.fa-fw(aria-hidden="true")
|
||||
=" "
|
||||
span= _p('comment')
|
||||
span= ' ' + _p('comment')
|
||||
include ./valine.pug
|
||||
@@ -2,58 +2,15 @@ if theme.valine && theme.valine.enable
|
||||
#vcomment.vcomment
|
||||
script(src='https://cdn.jsdelivr.net/npm/valine/dist/Valine.min.js')
|
||||
script.
|
||||
var notify = '#{ theme.valine.notify }' == true ? true : false;
|
||||
var verify = '#{ theme.valine.verify }' == true ? true : false;
|
||||
var notify = #{ theme.valine.notify } == true ? true : false;
|
||||
var verify = #{ theme.valine.verify } == true ? true : false;
|
||||
var GUEST_INFO = ['nick','mail','link'];
|
||||
var guest_info = '#{ theme.valine.guest_info }'.split(',').filter(function(item){
|
||||
return GUEST_INFO.indexOf(item) > -1
|
||||
});
|
||||
guest_info = guest_info.length == 0 ? GUEST_INFO :guest_info;
|
||||
|
||||
var localeName = 'tw',
|
||||
localeMode = {
|
||||
head: {
|
||||
nick: '暱稱(必填)',
|
||||
mail: '郵箱(必填,可以收到回復提醒)',
|
||||
link: '網址(選填)',
|
||||
},
|
||||
tips: {
|
||||
comments: '評論',
|
||||
sofa: '快來做第一個評論的人吧~',
|
||||
busy: '還在提交中,請稍候...',
|
||||
again: '這麼簡單也能錯,也是沒誰了.'
|
||||
},
|
||||
ctrl: {
|
||||
reply: '回覆',
|
||||
ok: '好的',
|
||||
sure: '確認',
|
||||
cancel: '取消',
|
||||
confirm: '確認',
|
||||
continue: '繼續',
|
||||
more: '查看更多...',
|
||||
try: '再試試?',
|
||||
preview: '預覽',
|
||||
emoji: '表情'
|
||||
},
|
||||
error: {
|
||||
99: '初始化失敗,請檢查init中的`el`元素.',
|
||||
100: '初始化失敗,請檢查你的AppId和AppKey.',
|
||||
401: '未經授權的操作,請檢查你的AppId和AppKey.',
|
||||
403: '訪問被api域名白名單拒絕,請檢查你的安全域名設置.',
|
||||
},
|
||||
timeago: {
|
||||
seconds: '秒前',
|
||||
minutes: '分鐘前',
|
||||
hours: '小時前',
|
||||
days: '天前',
|
||||
now: '剛剛'
|
||||
}
|
||||
};
|
||||
|
||||
window.valine = new Valine();
|
||||
valine.installLocale(localeName,localeMode);
|
||||
|
||||
valine.init({
|
||||
window.valine = new Valine({
|
||||
el:'#vcomment',
|
||||
notify:notify,
|
||||
verify:verify,
|
||||
|
||||
@@ -110,6 +110,9 @@ if theme.qihu_site_verification
|
||||
- var preload_img = page.top_img || theme.top_img || config.top_img
|
||||
|
||||
if (is_archive() && preload_archive_img)
|
||||
link(rel="preload" href=url_for(preload_img) as="image" )
|
||||
link(rel="preload" href=url_for(preload_archive_img) as="image" )
|
||||
else if (!is_post() && preload_img)
|
||||
link(rel="preload" href=url_for(preload_img) as="image" )
|
||||
|
||||
if theme.blog_title_font.font_link
|
||||
link(rel='stylesheet', href=url_for(theme.blog_title_font.font_link))
|
||||
@@ -6,11 +6,34 @@
|
||||
.menu-icon-first
|
||||
.menu-icon-second
|
||||
.menu-icon-third
|
||||
|
||||
|
||||
.menu_mask
|
||||
|
||||
span.pull-right.menus
|
||||
.mobile_author_icon
|
||||
img.lozad(data-src=theme.avatar || url_for('/img/avatar.png') onerror=`onerror=null;src='${theme.lodding_bg.flink}'`)
|
||||
.mobile_author-info__description= config.description
|
||||
img.lozad(src=theme.avatar || url_for('/img/avatar.png') onerror=`onerror=null;src='${theme.lodding_bg.flink}'`)
|
||||
.mobile_post_data
|
||||
if site.posts.length
|
||||
.mobile_data_item.text-center
|
||||
.mobile_data_link
|
||||
a(href=url_for(config.archive_dir) + '/')
|
||||
.headline= _p('aside.articles')
|
||||
.length_num= site.posts.length
|
||||
|
||||
if site.tags.length
|
||||
.mobile_data_item.text-center
|
||||
.mobile_data_link
|
||||
a(href=url_for(config.tag_dir) + '/' )
|
||||
.headline= _p('aside.tags')
|
||||
.length_num= site.tags.length
|
||||
|
||||
if site.categories.length
|
||||
.mobile_data_item.text-center
|
||||
.mobile_data_link
|
||||
a(href=url_for(config.category_dir) + '/')
|
||||
.headline= _p('aside.categories')
|
||||
.length_num= site.categories.length
|
||||
|
||||
hr
|
||||
.menus_item
|
||||
each value, label in theme.menu
|
||||
|
||||
@@ -7,12 +7,15 @@
|
||||
- if (is_year()) pageTitle += ': ' + page.year
|
||||
- var pageTitle_saved //- 暫時存儲pageTitle
|
||||
- var pageTitle_no_include_blog_name //- 存儲pageTitle, 不帶 " | ",meta用
|
||||
- var home_subtitle_true //有subtitle
|
||||
//- home時顯示config.title (JerryC),其他顯示 pageTitle。meta用
|
||||
- is_home() ? pageTitle_no_include_blog_name = config.title : pageTitle_no_include_blog_name = pageTitle
|
||||
//- 暫時存儲pageTitle
|
||||
- pageTitle ? pageTitle_saved = pageTitle + ' | ' + config.title : pageTitle_saved = config.title
|
||||
//- 是否有 config.subtitle 是各自显示
|
||||
- config.subtitle ? home_subtitle_true = ' - ' + config.subtitle : home_subtitle_true = ''
|
||||
//- home時pageTitle顯示 JerryC - subtitle,其他顯示 pageTitle | JerryC
|
||||
- is_home() ? pageTitle = config.title + ' - ' + config.subtitle : pageTitle = pageTitle_saved
|
||||
- is_home() ? pageTitle = config.title + home_subtitle_true : pageTitle = pageTitle_saved
|
||||
|
||||
- var pageDescription = page.description || page.title || config.description || ''
|
||||
- var pageKeywords = (config.keywords || []).join(',')
|
||||
@@ -63,14 +66,12 @@ html(lang=config.language)
|
||||
div!= body
|
||||
else
|
||||
block content
|
||||
//- - var top_img = page.top_img || theme.post_meta.top_img || theme.top_img || config.top_img || true
|
||||
//- - var bg_img = top_img !== true ? `background-image: url(${top_img})` : ''
|
||||
//- - var footer_bg_class= bg_img ? 'footer-bg' : ''
|
||||
//- footer(style=bg_img class=footer_bg_class)
|
||||
footer
|
||||
include ./footer.pug
|
||||
i.fa.fa-arrow-up#go-up(aria-hidden="true")
|
||||
include ./rightside.pug
|
||||
if (is_post())
|
||||
include ./post-bottom.pug
|
||||
each item in theme.cdn.js
|
||||
if item !== undefined
|
||||
script(src=url_for(item))
|
||||
|
||||
@@ -14,43 +14,49 @@ else
|
||||
if(page.prev)
|
||||
if(page.next)
|
||||
.prev-post.pull-left
|
||||
- var pagination_cover = page.prev.cover || theme.default_cover
|
||||
- var pagination_cover = page.prev.cover || random_cover()
|
||||
a(href=url_for(page.prev.path))
|
||||
img.prev_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` )
|
||||
if theme.lazyload.enable
|
||||
img.prev_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` )
|
||||
else
|
||||
img.prev_cover(src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` )
|
||||
|
||||
.label=_p('pagination.prev')
|
||||
.prev_info
|
||||
//- i.fa.fa-chevron-left
|
||||
span=page.prev.title
|
||||
else
|
||||
.prev-post.pull-full
|
||||
- var pagination_cover = page.prev.cover || theme.default_cover
|
||||
- var pagination_cover = page.prev.cover || random_cover()
|
||||
a(href=url_for(page.prev.path))
|
||||
img.prev_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
|
||||
if theme.lazyload.enable
|
||||
img.prev_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
|
||||
else
|
||||
img.prev_cover(src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
|
||||
.label=_p('pagination.prev')
|
||||
.prev_info
|
||||
//- i.fa.fa-chevron-left
|
||||
span=page.prev.title
|
||||
|
||||
|
||||
|
||||
if(page.next)
|
||||
if(page.prev)
|
||||
.next-post.pull-right
|
||||
- var pagination_cover = page.next.cover || theme.default_cover
|
||||
- var pagination_cover = page.next.cover || random_cover()
|
||||
a(href=url_for(page.next.path))
|
||||
img.next_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
|
||||
if theme.lazyload.enable
|
||||
img.next_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
|
||||
else
|
||||
img.next_cover(src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
|
||||
.label=_p('pagination.next')
|
||||
.next_info
|
||||
span=page.next.title
|
||||
//- i.fa.fa-chevron-right
|
||||
else
|
||||
.next-post.pull-full
|
||||
- var pagination_cover = page.next.cover || theme.default_cover
|
||||
- var pagination_cover = page.next.cover || random_cover()
|
||||
a(href=url_for(page.next.path))
|
||||
img.next_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
|
||||
if theme.lazyload.enable
|
||||
img.next_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
|
||||
else
|
||||
img.next_cover(src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
|
||||
.label=_p('pagination.next')
|
||||
.next_info
|
||||
span=page.next.title
|
||||
//- i.fa.fa-chevron-right
|
||||
|
||||
span=page.next.title
|
||||
|
||||
|
||||
8
layout/includes/post-bottom.pug
Normal file
8
layout/includes/post-bottom.pug
Normal file
@@ -0,0 +1,8 @@
|
||||
#post_bottom
|
||||
#post_bottom_items
|
||||
a#mobile_to_comment(href="#post-comment")
|
||||
i.mobile_scroll_to_comment.fa.fa-comments
|
||||
i#mobile_toc.fa.fa-list
|
||||
#toc_mobile
|
||||
.toc_mobile_headline= _p('sidebar.catalog')
|
||||
!=toc(page.content,{"class":"toc_mobile_items"})
|
||||
@@ -3,25 +3,36 @@ each article , index in page.posts.data
|
||||
- var link = article.link || article.path
|
||||
if index%2 == 0
|
||||
.post_cover.is_left
|
||||
a(href=url_for(link))
|
||||
a(href=url_for(link) title=article.title || _p('no_title'))
|
||||
- var post_cover = article.cover
|
||||
- var default_post_cover = theme.default_cover
|
||||
- var default_post_cover = random_cover()
|
||||
if (post_cover)
|
||||
img.post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title'))
|
||||
if theme.lazyload.enable
|
||||
img.post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
|
||||
else
|
||||
img.post_bg(src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
|
||||
else
|
||||
img.post_bg.lozad(data-src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title'))
|
||||
if theme.lazyload.enable
|
||||
img.post_bg.lozad(data-src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
|
||||
else
|
||||
img.post_bg(src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
|
||||
else
|
||||
.post_cover.is_right
|
||||
a(href=url_for(link))
|
||||
a(href=url_for(link) title=article.title || _p('no_title'))
|
||||
- var post_cover = article.cover
|
||||
- var default_post_cover = theme.default_cover
|
||||
- var default_post_cover = random_cover()
|
||||
if (post_cover)
|
||||
img.post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title'))
|
||||
if theme.lazyload.enable
|
||||
img.post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
|
||||
else
|
||||
img.post_bg(src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
|
||||
else
|
||||
img.post_bg.lozad(data-src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title'))
|
||||
|
||||
if theme.lazyload.enable
|
||||
img.post_bg.lozad(data-src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
|
||||
else
|
||||
img.post_bg(src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
|
||||
.recent-post-info
|
||||
a.article-title(href=url_for(link) title=article.title || _p('no_title'))= article.title || _p('no_title')
|
||||
a.article-title(href=url_for(link) title= article.title || _p('no_title'))= article.title || _p('no_title')
|
||||
if (article.top)
|
||||
span.article-meta
|
||||
i.fa.fa-thumb-tack.article-meta__icon.sticky
|
||||
@@ -51,8 +62,6 @@ each article , index in page.posts.data
|
||||
- let expert = content.substring(0, theme.auto_excerpt.length)
|
||||
- content.length > theme.auto_excerpt.length ? expert += ' ...' : ''
|
||||
.content!= expert
|
||||
.more_setting
|
||||
a.more.more--border.more--primary.more--animated(href=url_for(link) + '#more' style="margin-top: 14px")= _p('read_more')
|
||||
else
|
||||
.content!= article.description
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
.relatedPosts
|
||||
.relatedPosts_headline
|
||||
i.fa.fa-thumbs-up(aria-hidden="true")
|
||||
span=' ' + _p('relatedPosts_headline')
|
||||
.relatedPosts_list!= related_posts(page,site.posts)
|
||||
.clear_both
|
||||
@@ -6,60 +6,6 @@
|
||||
ul.reward-all
|
||||
each item in theme.reward.QR_code
|
||||
li.reward-item
|
||||
img.lozad.post-qr-code__img(data-src=(item.itemlist||item).img)
|
||||
img.lozad.post-qr-code__img(src=(item.itemlist||item).img)
|
||||
.post-qr-code__desc=(item.itemlist||item).text
|
||||
|
||||
|
||||
|
||||
//- donate-share样式1
|
||||
//- .post-reward-share
|
||||
//- .post-reward
|
||||
//- a.reward-buttom
|
||||
//- i.fa.fa-qrcode
|
||||
//- = ' ' + _p('donate')
|
||||
//- .reward-main
|
||||
//- ul.reward-all
|
||||
//- each item in theme.QR_code
|
||||
//- li.reward-item
|
||||
//- img.lozad.post-qr-code__img(data-src=(item.itemlist||item).img)
|
||||
//- .post-qr-code__desc=(item.itemlist||item).text
|
||||
|
||||
//- .post-share
|
||||
//- include share/index.pug
|
||||
//- a.share-buttom
|
||||
//- i.fa.fa-share-alt
|
||||
//- = ' ' + _p('share')
|
||||
|
||||
//- donate-share样式1
|
||||
//- #social
|
||||
//- .social-main
|
||||
//- span.social-donate
|
||||
//- a#social-donate
|
||||
//- i.fa.fa-qrcode
|
||||
//- = _p('donate')
|
||||
|
||||
|
||||
//- .circle
|
||||
//- .circle-empty
|
||||
//- span
|
||||
//- span.circle_item
|
||||
//- a(style="cursor:pointer")
|
||||
|
||||
//- .social-sharebutton
|
||||
//- span.share-s
|
||||
//- a(href="javascript:void(0)" id="share-s" title=_p('share'))
|
||||
//- i.fa.fa-share-alt
|
||||
//- = _p('share')
|
||||
//- include share/index.pug
|
||||
|
||||
|
||||
//- if (theme.QR_code)
|
||||
//- if (theme.QR_code.length > 0)
|
||||
//- .post-qr-code
|
||||
//- each item in theme.QR_code
|
||||
//- .post-qr-code-item
|
||||
//- img.lozad.post-qr-code__img(data-src=(item.itemlist||item).img)
|
||||
//- .post-qr-code__desc=(item.itemlist||item).text
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
section#rightside.rightside
|
||||
if is_post()
|
||||
a#to_comment(href="#post-comment")
|
||||
i.scroll_to_comment.fa.fa-comments
|
||||
if theme.readmode.enable && is_post()
|
||||
i#readmode.fa.fa-book(title=_p('rightside.readmode_title'))
|
||||
i#font_plus.fa.fa-plus(title=_p('rightside.font_plus_title'))
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
.card-content
|
||||
.post_data
|
||||
.data-item.text-center
|
||||
img.lozad(data-src=theme.avatar || url_for('/img/avatar.png') onerror=`onerror=null;src='${theme.lodding_bg.flink}'`)
|
||||
img.lozad(src=theme.avatar || url_for('/img/avatar.png') onerror=`onerror=null;src='${theme.lodding_bg.flink}'`)
|
||||
p.author-info__name.text-center= config.author
|
||||
p.author-info__description.text-center= config.description
|
||||
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
.card_widget.card-categories
|
||||
.card-content
|
||||
.item_headline
|
||||
i.fa.fa-folder-open(aria-hidden="true")
|
||||
span= _p('aside.card_categories')
|
||||
ul.aside_category_item
|
||||
mixin displayCategories(parent = undefined)
|
||||
- site.categories.find({ parent }).sort("name").each(function(category) {
|
||||
- var childCount = site.categories.find({ parent: category._id }).count();
|
||||
li.aside_category_list
|
||||
a.aside_category_list_link(href=url_for(category.path))
|
||||
span.aside_category_list_name= category.name
|
||||
span.aside_category_list_length= category.length
|
||||
|
||||
if childCount > 0
|
||||
ul.aside_category_item.child
|
||||
+displayCategories(category._id)
|
||||
- })
|
||||
if site.categories.length
|
||||
.card_widget.card-categories
|
||||
.card-content
|
||||
.item_headline
|
||||
i.fa.fa-folder-open(aria-hidden="true")
|
||||
span= _p('aside.card_categories')
|
||||
ul.aside_category_item
|
||||
mixin displayCategories(parent = undefined)
|
||||
- site.categories.find({ parent }).sort("name").each(function(category) {
|
||||
- var childCount = site.categories.find({ parent: category._id }).count();
|
||||
li.aside_category_list
|
||||
a.aside_category_list_link(href=url_for(category.path))
|
||||
span.aside_category_list_name= category.name
|
||||
span.aside_category_list_length= category.length
|
||||
|
||||
if childCount > 0
|
||||
ul.aside_category_item.child
|
||||
+displayCategories(category._id)
|
||||
- })
|
||||
|
||||
+displayCategories()
|
||||
+displayCategories()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -9,12 +9,18 @@
|
||||
- var link = article.link || article.path
|
||||
a(href=url_for(link))
|
||||
- var post_cover = article.cover
|
||||
- var default_post_cover = theme.default_cover
|
||||
- var default_post_cover = random_cover()
|
||||
.aside_post_cover
|
||||
if (post_cover)
|
||||
img.aside_post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title'))
|
||||
if theme.lazyload.enable
|
||||
img.aside_post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title'))
|
||||
else
|
||||
img.aside_post_bg(src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title'))
|
||||
else
|
||||
img.aside_post_bg.lozad(data-src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title'))
|
||||
if theme.lazyload.enable
|
||||
img.aside_post_bg.lozad(data-src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title'))
|
||||
else
|
||||
img.aside_post_bg(src=`${default_post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title'))
|
||||
div#aside_title
|
||||
.aside_post_title(href=url_for(link) title=article.title || _p('no_title'))= article.title || _p('no_title')
|
||||
if (theme.post_meta.date_type)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
.card_widget.card-tags
|
||||
.card-content
|
||||
.item_headline
|
||||
i.fa.fa-tags(aria-hidden="true")
|
||||
span= _p('aside.card_tags')
|
||||
.card-tag-cloud!= tagcloud({min_font: 16, max_font: 24, amount: 200, color: true, start_color: '#999', end_color: '#000'})
|
||||
if site.tags.length
|
||||
.card_widget.card-tags
|
||||
.card-content
|
||||
.item_headline
|
||||
i.fa.fa-tags(aria-hidden="true")
|
||||
span= _p('aside.card_tags')
|
||||
.card-tag-cloud!= tagcloud({min_font: 16, max_font: 24, amount: 200, color: true, start_color: '#999', end_color: '#000'})
|
||||
|
||||
@@ -5,4 +5,4 @@ block content
|
||||
include includes/recent-posts.pug
|
||||
include includes/pagination.pug
|
||||
#aside_content.aside_content
|
||||
include includes/aside.pug
|
||||
include includes/aside.pug
|
||||
@@ -6,7 +6,7 @@ block content
|
||||
.tag-cloud__title= _p('page.tag')
|
||||
| -
|
||||
span.tag-cloud__amount= site.tags.length
|
||||
.tag-cloud-tags!= tagcloud({min_font: 20, max_font: 43, amount: 200, color: true, start_color: '#A4D8FA', end_color: '#0790E8'})
|
||||
.tag-cloud-tags!= tags(site.tags)
|
||||
if page.comments !== false
|
||||
include includes/comments/index.pug
|
||||
#aside_content.aside_content
|
||||
|
||||
@@ -45,7 +45,7 @@ block top_img
|
||||
block content
|
||||
article#post(class="")
|
||||
#post-content.article-container!= page.content
|
||||
if (theme.post_copyright && theme.post_copyright.enable)
|
||||
if (theme.post_copyright && theme.post_copyright.enable && page.copyright != false)
|
||||
.post-copyright
|
||||
.post-copyright__author
|
||||
span.post-copyright-meta= _p('post.copyright.author') + ": "
|
||||
@@ -71,6 +71,6 @@ block content
|
||||
include includes/pagination.pug
|
||||
|
||||
if theme.related_post && theme.related_post.enable
|
||||
include includes/related-posts.pug
|
||||
!= related_posts(page,site.posts)
|
||||
if page.comments !== false
|
||||
include includes/comments/index.pug
|
||||
6
package.json
Normal file
6
package.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "hexo-theme-butterfly",
|
||||
"version": "1.1.0",
|
||||
"description": "A Hexo Theme: Butterfly"
|
||||
|
||||
}
|
||||
15
scripts/note.js
Normal file
15
scripts/note.js
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* note.js
|
||||
* transplant from hexo-theme-next
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
function postNote(args, content) {
|
||||
return `<div class="note ${args.join(' ')}">
|
||||
${hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('')}
|
||||
</div>`;
|
||||
}
|
||||
|
||||
hexo.extend.tag.register('note', postNote, {ends: true});
|
||||
hexo.extend.tag.register('subnote', postNote, {ends: true});
|
||||
20
scripts/post-lazyload.js
Normal file
20
scripts/post-lazyload.js
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
let cheerio;
|
||||
hexo.extend.filter.register('after_post_render', data => {
|
||||
var theme = hexo.theme.config;
|
||||
if (!theme.lazyload.enable) return;
|
||||
|
||||
if (!cheerio) cheerio = require('cheerio');
|
||||
|
||||
const $ = cheerio.load(data.content, {decodeEntities: false});
|
||||
const images = $('img');
|
||||
if (!images.length) return;
|
||||
|
||||
images.each((i, o) => {
|
||||
let src = $(o).attr('src');
|
||||
$(o).attr('data-src', src).removeAttr('src');
|
||||
$(o).addClass('lozad');
|
||||
});
|
||||
|
||||
data.content = $.html();
|
||||
}, 100);
|
||||
13
scripts/random_cover.js
Normal file
13
scripts/random_cover.js
Normal file
@@ -0,0 +1,13 @@
|
||||
hexo.extend.helper.register('random_cover', function () {
|
||||
var cover;
|
||||
var num;
|
||||
if (!Array.isArray(hexo.theme.config.default_cover)) {
|
||||
cover = hexo.theme.config.default_cover
|
||||
return cover
|
||||
} else {
|
||||
num = Math.floor(Math.random() * (hexo.theme.config.default_cover.length));
|
||||
cover = hexo.theme.config.default_cover[num];
|
||||
return cover
|
||||
}
|
||||
|
||||
})
|
||||
@@ -1,38 +1,61 @@
|
||||
hexo.extend.helper.register('related_posts', function(currentPost, allPosts){
|
||||
hexo.extend.helper.register('related_posts', function (currentPost, allPosts) {
|
||||
var relatedPosts = [];
|
||||
currentPost.tags.forEach(function (tag) {
|
||||
allPosts.forEach(function (post) {
|
||||
if (isTagRelated(tag.name, post.tags)) {
|
||||
var relatedPost = {
|
||||
title: post.title,
|
||||
path: post.path,
|
||||
cover: post.cover,
|
||||
weight: 1
|
||||
};
|
||||
var index = findItem(relatedPosts, 'path', post.path);
|
||||
if (index != -1) {
|
||||
relatedPosts[index].weight += 1;
|
||||
} else{
|
||||
if (currentPost.path != post.path) {
|
||||
relatedPosts.push(relatedPost);
|
||||
};
|
||||
};
|
||||
if (isTagRelated(tag.name, post.tags)) {
|
||||
var relatedPost = {
|
||||
title: post.title,
|
||||
path: post.path,
|
||||
cover: post.cover,
|
||||
weight: 1
|
||||
};
|
||||
var index = findItem(relatedPosts, 'path', post.path);
|
||||
if (index != -1) {
|
||||
relatedPosts[index].weight += 1;
|
||||
} else {
|
||||
if (currentPost.path != post.path) {
|
||||
relatedPosts.push(relatedPost);
|
||||
};
|
||||
});
|
||||
};
|
||||
};
|
||||
});
|
||||
});
|
||||
if (relatedPosts.length == 0) {return ''};
|
||||
if (relatedPosts.length == 0) { return '' };
|
||||
var result = "";
|
||||
var limit_num = hexo.theme.config.related_post.limit || 6
|
||||
var lang = hexo.theme.config.rootConfig.language;
|
||||
var headline_lang;
|
||||
if (lang === 'zh-CN') {
|
||||
headline_lang = '相关推荐';
|
||||
} else if ( lang === 'zh-TW') {
|
||||
headline_lang = '相關推薦';
|
||||
} else {
|
||||
headline_lang = 'Recommend';
|
||||
}
|
||||
|
||||
relatedPosts = relatedPosts.sort(compare('weight'));
|
||||
var lazy_src = hexo.theme.config.lazyload.enable ? lazy_src = 'data-src' : lazy_src = 'src'
|
||||
var lazy_class = hexo.theme.config.lazyload.enable ? lazy_class = 'lozad' : lazy_class = ''
|
||||
|
||||
if (relatedPosts.length > 0) {
|
||||
result += '<div class="relatedPosts">'
|
||||
result += '<div class="relatedPosts_headline"><i class="fa fa-fw fa-thumbs-up" aria-hidden="true"></i><span>' + ' ' + headline_lang + '</span></div>'
|
||||
result += '<div class="relatedPosts_list">'
|
||||
|
||||
for (var i = 0; i < Math.min(relatedPosts.length, limit_num); i++) {
|
||||
|
||||
var cover = relatedPosts[i].cover|| hexo.theme.config.default_cover|| data.butterfly.default_cover
|
||||
result += '<div class="relatedPosts_item"><a href="/' + relatedPosts[i].path + '" title="' + relatedPosts[i].title +'">';
|
||||
result += '<img class="relatedPosts_cover lozad" data-src="' + cover + '">';
|
||||
var cover = relatedPosts[i].cover || random_cover()
|
||||
|
||||
result += '<div class="relatedPosts_item"><a href="' + hexo.theme.config.rootConfig.root + relatedPosts[i].path + '" title="' + relatedPosts[i].title + '">';
|
||||
result += '<img class="relatedPosts_cover '+ lazy_class + '"' + lazy_src + '="' + cover + '">';
|
||||
result += '<div class="relatedPosts_title">' + relatedPosts[i].title + '</div>';
|
||||
result += '</a></div>'
|
||||
}; // console.log(relatedPosts);
|
||||
result += '</a></div>'
|
||||
};
|
||||
|
||||
result += '</div><div class="clear_both"></div></div>'
|
||||
return result;
|
||||
|
||||
}
|
||||
});
|
||||
hexo.extend.helper.register('echo', function(path){
|
||||
return path;
|
||||
@@ -62,3 +85,15 @@ function compare (attr) {
|
||||
}
|
||||
}
|
||||
|
||||
function random_cover() {
|
||||
var post_cover;
|
||||
var num;
|
||||
if (!Array.isArray(hexo.theme.config.default_cover)) {
|
||||
post_cover = hexo.theme.config.default_cover
|
||||
return post_cover
|
||||
} else {
|
||||
num = Math.floor(Math.random() * (hexo.theme.config.default_cover.length));
|
||||
post_cover = hexo.theme.config.default_cover[num];
|
||||
return post_cover
|
||||
}
|
||||
}
|
||||
|
||||
16
scripts/tags.js
Normal file
16
scripts/tags.js
Normal file
@@ -0,0 +1,16 @@
|
||||
hexo.extend.helper.register('tags', function (site_tags) {
|
||||
var result = "";
|
||||
site_tags.sort('path').each(function (tags) {
|
||||
var fontSize = Math.floor(Math.random() * 15 + 15) + "px"; //15 ~ 30
|
||||
var color =
|
||||
"rgb(" +
|
||||
Math.floor(Math.random() * 201) +
|
||||
", " +
|
||||
Math.floor(Math.random() * 201) +
|
||||
", " +
|
||||
Math.floor(Math.random() * 201) +
|
||||
")"; // 0,0,0 -> 200,200,200
|
||||
result += '<a href="' + hexo.theme.config.rootConfig.root + tags.path + '" style="font-size:' + fontSize + ';color:' + color + '">' + tags.name + '</a>'
|
||||
})
|
||||
return result;
|
||||
})
|
||||
@@ -62,7 +62,6 @@ h6
|
||||
position: fixed
|
||||
right: $go-up-right
|
||||
bottom: $go-up-bottom
|
||||
z-index: 100
|
||||
font-size: $sidebar-icon-size
|
||||
opacity: 0
|
||||
cursor: pointer
|
||||
@@ -161,6 +160,10 @@ table
|
||||
color: #fff
|
||||
border-color: #fff
|
||||
|
||||
&:hover
|
||||
background-color: darken($light-blue, 40)
|
||||
|
||||
|
||||
textarea
|
||||
font-size: 0.7rem
|
||||
background: url(/img/comment_bg.png) 100% 100% no-repeat
|
||||
@@ -182,11 +185,8 @@ table
|
||||
.vnum
|
||||
font-size: 1.1rem
|
||||
|
||||
.vnick
|
||||
font-size: 100%
|
||||
|
||||
.vsys
|
||||
font-size: 70%
|
||||
font-size: 80%
|
||||
|
||||
.vtime
|
||||
font-size: .65rem
|
||||
@@ -195,31 +195,36 @@ table
|
||||
font-size: 100%
|
||||
|
||||
.vat
|
||||
font-size: .7125rem;
|
||||
color: $cyan;
|
||||
border: 1px solid $cyan;
|
||||
padding: 0 .8rem;
|
||||
border-radius: 5px;
|
||||
font-size: .7125rem
|
||||
color: $cyan
|
||||
border: 1px solid $cyan
|
||||
padding: 0 .8rem
|
||||
border-radius: 5px
|
||||
|
||||
&:hover
|
||||
background-color: alpha($cyan,0.5)
|
||||
|
||||
code, pre
|
||||
font-size: 98%
|
||||
font-family: $code-font
|
||||
|
||||
#site-title, #site-sub-title,
|
||||
#site-name,
|
||||
#aside_content .author-info__name,
|
||||
#aside_content .author-info__description
|
||||
font-family: 'Titillium Web',Lato,PingFang SC, Hiragino Sans GB, "Microsoft JhengHei", "Microsoft YaHei", Helvetica Neue, Helvetica, Arial, sans-serif
|
||||
font-family: $site-name-font
|
||||
|
||||
|
||||
|
||||
#rightside
|
||||
right: -38px
|
||||
z-index: 100
|
||||
position: fixed
|
||||
bottom: 50px
|
||||
padding-bottom: 32px
|
||||
bottom: 60px
|
||||
opacity: 0
|
||||
transition: all .2s
|
||||
|
||||
#readmode,#font_plus,#font_minus
|
||||
|
||||
#readmode,#font_plus,#font_minus,#to_comment
|
||||
width: 30px
|
||||
height: 30px
|
||||
background-color: $light-blue
|
||||
@@ -231,6 +236,9 @@ table
|
||||
margin-bottom: 2px
|
||||
cursor: pointer
|
||||
text-decoration: none
|
||||
|
||||
#to_comment
|
||||
display: none
|
||||
|
||||
#font_minus,#font_plus
|
||||
display: none
|
||||
@@ -347,7 +355,15 @@ table
|
||||
.is_visible
|
||||
display: block !important
|
||||
|
||||
.is_invisible
|
||||
display: none !important
|
||||
|
||||
.fireworks
|
||||
position: fixed
|
||||
z-index: -1
|
||||
pointer-events: none
|
||||
pointer-events: none
|
||||
|
||||
|
||||
// 去掉加載黑框
|
||||
img[src=""],img:not([src])
|
||||
opacity: 0
|
||||
|
||||
@@ -2,19 +2,19 @@
|
||||
@require "theme"
|
||||
@require "diff"
|
||||
|
||||
languages = "js" "javascript" "python" "ruby" "xml" "html" "css" "perl" "sql" "coffeescript" "java" "scala" "kotlin" "c" "c\+\+" "go" "less" "sass" "scss" "stylus" "styl" "typescript" "ts" "bash" "yml" "yaml" "gradle" "groovy" "ejs" "swig" "markdown"
|
||||
// languages = "js" "javascript" "python" "ruby" "xml" "html" "css" "perl" "sql" "coffeescript" "java" "scala" "kotlin" "c" "c\+\+" "go" "less" "sass" "scss" "stylus" "styl" "typescript" "ts" "bash" "yml" "yaml" "gradle" "groovy" "ejs" "swig" "markdown"
|
||||
wordWrap = !hexo-config("rootConfig.highlight.line_number") && hexo-config("code_word_wrap")
|
||||
|
||||
loopForLanguages()
|
||||
for lang in languages
|
||||
.article-container
|
||||
figure.highlight
|
||||
&{"." + lang}
|
||||
table
|
||||
&:before
|
||||
content: lang
|
||||
// loopForLanguages()
|
||||
// for lang in languages
|
||||
// .article-container
|
||||
// figure.highlight
|
||||
// &{"." + lang}
|
||||
// table
|
||||
// &:before
|
||||
// content: lang
|
||||
|
||||
loopForLanguages()
|
||||
// loopForLanguages()
|
||||
|
||||
// Placeholder: $code-block
|
||||
$code-block
|
||||
@@ -110,7 +110,7 @@ blockquote
|
||||
padding: 0 0.7rem
|
||||
width: 5rem
|
||||
color: $highlight-foreground
|
||||
content: "Code"
|
||||
content: attr(data-content)
|
||||
font-weight: bold
|
||||
font-size: 0.8rem
|
||||
line-height: 1.4rem
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
transition: all .3s
|
||||
background: #fff
|
||||
margin-top: 20px
|
||||
margin-left: 15px
|
||||
overflow: hidden
|
||||
|
||||
&:hover
|
||||
@@ -55,7 +54,7 @@
|
||||
.headline
|
||||
display: block
|
||||
font-size: 0.7rem
|
||||
letter-spacing: 1px
|
||||
// letter-spacing: 1px
|
||||
margin-bottom: -21px
|
||||
text-transform: uppercase
|
||||
color:#4c4948
|
||||
@@ -303,6 +302,14 @@
|
||||
width: 100% !important
|
||||
|
||||
.card_widget
|
||||
margin-left: 0 !important
|
||||
margin-left: 0
|
||||
margin-right: 0
|
||||
|
||||
|
||||
@media screen and (min-width: 900px)
|
||||
#aside_content
|
||||
.card_widget
|
||||
if hexo-config("aside.position") == "right"
|
||||
margin-left: 15px
|
||||
else
|
||||
margin-right: 15px
|
||||
|
||||
@@ -2,11 +2,8 @@ footer
|
||||
margin-top: 1rem
|
||||
background: $light-blue
|
||||
background-attachment: local
|
||||
|
||||
&.footer-bg
|
||||
background-position: bottom
|
||||
background-size: cover
|
||||
|
||||
background-position: bottom
|
||||
background-size: cover
|
||||
|
||||
#footer
|
||||
padding: 1.2rem 1rem 1rem
|
||||
|
||||
@@ -31,11 +31,9 @@
|
||||
color: $white
|
||||
|
||||
#site-info
|
||||
// position: absolute
|
||||
position: absolute
|
||||
width: 100%
|
||||
// top: 43%
|
||||
padding-top: 43%
|
||||
padding-bottom: 43%
|
||||
top: 43%
|
||||
|
||||
#site-title,
|
||||
#site-sub-title
|
||||
@@ -105,11 +103,23 @@
|
||||
-webkit-transform: rotate(-45deg) translate(4px, -4px)
|
||||
transform: rotate(-45deg) translate(4px, -4px)
|
||||
|
||||
.menu_mask
|
||||
position: fixed
|
||||
top: 0
|
||||
bottom: 0
|
||||
width: 100%
|
||||
height: 110vh
|
||||
left: 0
|
||||
right: 0
|
||||
background: alpha($black,0.7)
|
||||
display: none
|
||||
|
||||
.menus
|
||||
.mobile_author_icon
|
||||
display: none
|
||||
padding: 3rem 1.5rem 0
|
||||
padding: 1.3rem 1.5rem 0
|
||||
text-align: center
|
||||
|
||||
|
||||
img
|
||||
height: 120px
|
||||
@@ -117,27 +127,35 @@
|
||||
display: inline-block
|
||||
vertical-align: top
|
||||
border-radius: 70px
|
||||
-webkit-transition: all .3s
|
||||
-moz-transition: all .3s
|
||||
-o-transition: all .3s
|
||||
-ms-transition: all .3s
|
||||
transition: all .3s
|
||||
|
||||
.mobile_post_data
|
||||
display: flex
|
||||
justify-content: center
|
||||
padding: .6rem .5rem 0
|
||||
display: none
|
||||
|
||||
.mobile_data_item
|
||||
flex: 1
|
||||
|
||||
.mobile_data_link
|
||||
a
|
||||
text-decoration: none
|
||||
|
||||
.length_num
|
||||
font-size: .9rem
|
||||
color: #000
|
||||
|
||||
.headline
|
||||
display: block
|
||||
font-size: 0.7rem
|
||||
// letter-spacing: .5px
|
||||
text-transform: uppercase
|
||||
color:#4c4948
|
||||
|
||||
hr
|
||||
margin: 1rem auto
|
||||
display: none
|
||||
|
||||
&.menu_open
|
||||
display: block
|
||||
animation: menu_open .3s
|
||||
|
||||
&.menu_close
|
||||
animation: menu_close .3s
|
||||
display: block
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
a
|
||||
color: $light-grey
|
||||
@@ -215,7 +233,6 @@
|
||||
font-size: 1.2rem
|
||||
|
||||
@media screen and (max-width: $sm)
|
||||
|
||||
#page-header
|
||||
padding: 10px 0.8rem
|
||||
|
||||
@@ -225,41 +242,49 @@
|
||||
.menus
|
||||
position: fixed
|
||||
top: 0
|
||||
right: 0
|
||||
width: 100%
|
||||
right: -250px
|
||||
width: 250px
|
||||
height 101vh
|
||||
background: $white
|
||||
cursor: pointer
|
||||
box-shadow: 0 0 4px rgba(0, 0, 0, 0.27)
|
||||
z-index: -1
|
||||
overflow: auto
|
||||
z-index: 1
|
||||
overflow-y: scroll
|
||||
display: none
|
||||
|
||||
.mobile_post_data
|
||||
display: flex
|
||||
|
||||
a
|
||||
display: inline-block !important
|
||||
opacity: 1 !important
|
||||
// margin-left: 0
|
||||
// padding-top: 0.3rem
|
||||
// padding-bottom: 0.3rem
|
||||
// padding-left: 0.6rem
|
||||
margin: 0
|
||||
padding: .5rem 1rem
|
||||
color: $font-black
|
||||
text-shadow: none
|
||||
font-size: 0.8rem
|
||||
z-index: 0
|
||||
.menus_item
|
||||
a
|
||||
display: block !important
|
||||
opacity: 1 !important
|
||||
margin: 0
|
||||
padding: .3rem 1.5rem
|
||||
color: $font-black
|
||||
text-shadow: none
|
||||
font-size: 0.8rem
|
||||
z-index: 0
|
||||
text-overflow: ellipsis
|
||||
overflow: hidden
|
||||
white-space: nowrap
|
||||
|
||||
i
|
||||
width: 30%
|
||||
text-align: left
|
||||
|
||||
span
|
||||
width 70%
|
||||
|
||||
&:hover
|
||||
color: $light-blue
|
||||
|
||||
&:hover
|
||||
color: $light-blue
|
||||
|
||||
.mobile_author_icon
|
||||
display: block
|
||||
|
||||
.menus_item
|
||||
padding: 0 .5rem
|
||||
margin-bottom: 4rem
|
||||
text-align: center
|
||||
margin-bottom: 5rem
|
||||
|
||||
hr
|
||||
display: block
|
||||
@@ -272,5 +297,5 @@
|
||||
|
||||
&.fixed.open-sidebar
|
||||
.search
|
||||
display: inline-block;
|
||||
opacity: 1;
|
||||
display: inline-block
|
||||
opacity: 1
|
||||
@@ -39,7 +39,7 @@ if hexo-config("nightshift") && hexo-config("nightshift.enable")
|
||||
|
||||
// 評論
|
||||
#vcomment
|
||||
*
|
||||
p,a,textarea,.vemoji-btn,.vpreview-btn,input,path,.vcount,.vnum,.vtime,.vsys,.vsys,.vnick
|
||||
color: #99a9bf !important
|
||||
|
||||
.vsys
|
||||
@@ -48,6 +48,26 @@ if hexo-config("nightshift") && hexo-config("nightshift.enable")
|
||||
.vbtn
|
||||
background: rgb(45, 48, 53) !important
|
||||
color: #99a9bf !important
|
||||
border: 1px solid #99a9bf
|
||||
|
||||
.vwrap
|
||||
border: 1px solid #99a9bf
|
||||
|
||||
input
|
||||
border-bottom: 1px dashed #616a6b
|
||||
|
||||
.vh
|
||||
border-bottom: 1px dashed #616a6b
|
||||
|
||||
pre
|
||||
background-color: #2d3035
|
||||
border: 1px solid #99a9bf
|
||||
|
||||
.vcontent.expand:before
|
||||
background: linear-gradient(180deg,hsla(0, 0%, 0%, 0),hsl(218, 8%, 19%))
|
||||
|
||||
.vcontent.expand:after
|
||||
background: hsla(204, 5%, 22%, 1)
|
||||
|
||||
.recent-post-item .article-title
|
||||
color: #99a9bf
|
||||
@@ -108,7 +128,6 @@ if hexo-config("nightshift") && hexo-config("nightshift.enable")
|
||||
background: rgb(27, 38, 59)
|
||||
|
||||
.post-cards,.md-links-item
|
||||
// background: #2d3035
|
||||
a
|
||||
color: #99a9bf
|
||||
|
||||
@@ -127,7 +146,8 @@ if hexo-config("nightshift") && hexo-config("nightshift.enable")
|
||||
|
||||
.translate_chn_to_cht,
|
||||
.nightshift,
|
||||
#readmode
|
||||
#readmode,
|
||||
#to_comment
|
||||
background-color: #2d3035 !important
|
||||
|
||||
img
|
||||
@@ -200,9 +220,20 @@ if hexo-config("nightshift") && hexo-config("nightshift.enable")
|
||||
&::-webkit-scrollbar-thumb
|
||||
background: lighten(#2d3035,5)
|
||||
|
||||
.more
|
||||
background-color: #616a6b
|
||||
|
||||
|
||||
#post_bottom
|
||||
background: #2d3035
|
||||
box-shadow: 0 -5px 6px -5px rgba(133,133,133,0)
|
||||
|
||||
i
|
||||
color: #99a9bf !important
|
||||
|
||||
#toc_mobile
|
||||
background: #2d3035
|
||||
|
||||
a
|
||||
color: #99a9bf !important
|
||||
|
||||
@media screen and (max-width: 768px)
|
||||
.night-mode
|
||||
color: #99a9bf
|
||||
@@ -211,6 +242,12 @@ if hexo-config("nightshift") && hexo-config("nightshift.enable")
|
||||
#page-header
|
||||
.menus
|
||||
background: #2d3035
|
||||
|
||||
.headline
|
||||
color: #99a9bf !important
|
||||
|
||||
.length_num
|
||||
color: darken(#99a9bf,10) !important
|
||||
a
|
||||
color: #99a9bf !important
|
||||
.menu-icon-first,
|
||||
|
||||
256
source/css/_layout/note.styl
Normal file
256
source/css/_layout/note.styl
Normal file
@@ -0,0 +1,256 @@
|
||||
.note
|
||||
$note-icons = hexo-config('note.icons')
|
||||
$note-style = hexo-config('note.style')
|
||||
margin: 10px 0
|
||||
padding: 15px
|
||||
position: relative
|
||||
|
||||
if ($note-style == 'simple')
|
||||
border: 1px solid $light-grey
|
||||
border-left-width: 5px
|
||||
|
||||
|
||||
if ($note-style == 'modern')
|
||||
background-color: $whitesmoke
|
||||
border: 1px solid transparent
|
||||
|
||||
|
||||
if ($note-style == 'flat')
|
||||
background-color: lighten($light-grey, 65%)
|
||||
border: initial
|
||||
border-left: 5px solid $light-grey
|
||||
|
||||
|
||||
if (hexo-config('note.border_radius') is a 'unit')
|
||||
border-radius: unit(hexo-config('note.border_radius'), px)
|
||||
|
||||
|
||||
h2, h3, h4, h5, h6
|
||||
if ($note-icons)
|
||||
margin-top: 3px
|
||||
else
|
||||
margin-top: 0
|
||||
|
||||
|
||||
border-bottom: initial
|
||||
margin-bottom: 0
|
||||
padding-top: 0 !important
|
||||
|
||||
|
||||
p, ul, ol, table, pre, blockquote, img
|
||||
&:first-child
|
||||
margin-top: 0
|
||||
|
||||
&:last-child
|
||||
margin-bottom: 0
|
||||
|
||||
|
||||
if ($note-icons)
|
||||
&:not(.no-icon)
|
||||
padding-left: 45px
|
||||
|
||||
&::before
|
||||
font-family: 'FontAwesome'
|
||||
font-size: larger
|
||||
left: 15px
|
||||
position: absolute
|
||||
top: 13px
|
||||
|
||||
&.default
|
||||
if ($note-style == 'flat')
|
||||
background-color: $note-default-bg
|
||||
|
||||
|
||||
if ($note-style == 'modern')
|
||||
background-color: $note-modern-default-bg
|
||||
border-color: $note-modern-default-border
|
||||
color: $note-modern-default-text
|
||||
|
||||
a, span.exturl
|
||||
&:not(.btn)
|
||||
border-bottom: 1px solid $note-modern-default-text
|
||||
color: $note-modern-default-text
|
||||
|
||||
&:hover
|
||||
border-bottom: 1px solid $note-modern-default-hover
|
||||
color: $note-modern-default-hover
|
||||
|
||||
if ($note-style != 'modern')
|
||||
border-left-color: $note-default-border
|
||||
|
||||
h2, h3, h4, h5, h6
|
||||
color: $note-default-text
|
||||
|
||||
if ($note-icons)
|
||||
&:not(.no-icon)
|
||||
&::before
|
||||
content: $note-default-icon
|
||||
|
||||
if ($note-style != 'modern')
|
||||
color: $note-default-text
|
||||
|
||||
&.primary
|
||||
if ($note-style == 'flat')
|
||||
background-color: $note-primary-bg
|
||||
|
||||
|
||||
if ($note-style == 'modern')
|
||||
background-color: $note-modern-primary-bg
|
||||
border-color: $note-modern-primary-border
|
||||
color: $note-modern-primary-text
|
||||
|
||||
a, span.exturl
|
||||
&:not(.btn)
|
||||
border-bottom: 1px solid $note-modern-primary-text
|
||||
color: $note-modern-primary-text
|
||||
|
||||
&:hover
|
||||
border-bottom: 1px solid $note-modern-primary-hover
|
||||
color: $note-modern-primary-hover
|
||||
|
||||
if ($note-style != 'modern')
|
||||
border-left-color: $note-primary-border
|
||||
|
||||
h2, h3, h4, h5, h6
|
||||
color: $note-primary-text
|
||||
|
||||
if ($note-icons)
|
||||
&:not(.no-icon)
|
||||
&::before
|
||||
content: $note-primary-icon
|
||||
|
||||
if ($note-style != 'modern')
|
||||
color: $note-primary-text
|
||||
|
||||
&.info
|
||||
if ($note-style == 'flat')
|
||||
background-color: $note-info-bg
|
||||
|
||||
|
||||
if ($note-style == 'modern')
|
||||
background-color: $note-modern-info-bg
|
||||
border-color: $note-modern-info-border
|
||||
color: $note-modern-info-text
|
||||
|
||||
a, span.exturl
|
||||
&:not(.btn)
|
||||
border-bottom: 1px solid $note-modern-info-text
|
||||
color: $note-modern-info-text
|
||||
|
||||
&:hover
|
||||
border-bottom: 1px solid $note-modern-info-hover
|
||||
color: $note-modern-info-hover
|
||||
|
||||
if ($note-style != 'modern')
|
||||
border-left-color: $note-info-border
|
||||
|
||||
h2, h3, h4, h5, h6
|
||||
color: $note-info-text
|
||||
|
||||
if ($note-icons)
|
||||
&:not(.no-icon)
|
||||
&::before
|
||||
content: $note-info-icon
|
||||
|
||||
if ($note-style != 'modern')
|
||||
color: $note-info-text
|
||||
|
||||
&.success
|
||||
if ($note-style == 'flat')
|
||||
background-color: $note-success-bg
|
||||
|
||||
|
||||
if ($note-style == 'modern')
|
||||
background-color: $note-modern-success-bg
|
||||
border-color: $note-modern-success-border
|
||||
color: $note-modern-success-text
|
||||
|
||||
a, span.exturl
|
||||
&:not(.btn)
|
||||
border-bottom: 1px solid $note-modern-success-text
|
||||
color: $note-modern-success-text
|
||||
|
||||
&:hover
|
||||
border-bottom: 1px solid $note-modern-success-hover
|
||||
color: $note-modern-success-hover
|
||||
|
||||
if ($note-style != 'modern')
|
||||
border-left-color: $note-success-border
|
||||
|
||||
h2, h3, h4, h5, h6
|
||||
color: $note-success-text
|
||||
|
||||
if ($note-icons)
|
||||
&:not(.no-icon)
|
||||
&::before
|
||||
content: $note-success-icon
|
||||
|
||||
if ($note-style != 'modern')
|
||||
color: $note-success-text
|
||||
|
||||
&.warning
|
||||
if ($note-style == 'flat')
|
||||
background-color: $note-warning-bg
|
||||
|
||||
|
||||
if ($note-style == 'modern')
|
||||
background-color: $note-modern-warning-bg
|
||||
border-color: $note-modern-warning-border
|
||||
color: $note-modern-warning-text
|
||||
|
||||
a, span.exturl
|
||||
&:not(.btn)
|
||||
border-bottom: 1px solid $note-modern-warning-text
|
||||
color: $note-modern-warning-text
|
||||
|
||||
&:hover
|
||||
border-bottom: 1px solid $note-modern-warning-hover
|
||||
color: $note-modern-warning-hover
|
||||
|
||||
if ($note-style != 'modern')
|
||||
border-left-color: $note-warning-border
|
||||
|
||||
h2, h3, h4, h5, h6
|
||||
color: $note-warning-text
|
||||
|
||||
if ($note-icons)
|
||||
&:not(.no-icon)
|
||||
&::before
|
||||
content: $note-warning-icon
|
||||
|
||||
if ($note-style != 'modern')
|
||||
color: $note-warning-text
|
||||
|
||||
&.danger
|
||||
if ($note-style == 'flat')
|
||||
background-color: $note-danger-bg
|
||||
|
||||
|
||||
if ($note-style == 'modern')
|
||||
background-color: $note-modern-danger-bg
|
||||
border-color: $note-modern-danger-border
|
||||
color: $note-modern-danger-text
|
||||
|
||||
a, span.exturl
|
||||
&:not(.btn)
|
||||
border-bottom: 1px solid $note-modern-danger-text
|
||||
color: $note-modern-danger-text
|
||||
|
||||
&:hover
|
||||
border-bottom: 1px solid $note-modern-danger-hover
|
||||
color: $note-modern-danger-hover
|
||||
|
||||
|
||||
if ($note-style != 'modern')
|
||||
border-left-color: $note-danger-border
|
||||
|
||||
h2, h3, h4, h5, h6
|
||||
color: $note-danger-text
|
||||
|
||||
if ($note-icons)
|
||||
&:not(.no-icon)
|
||||
&::before
|
||||
content: $note-danger-icon
|
||||
|
||||
if ($note-style != 'modern')
|
||||
color: $note-danger-text
|
||||
@@ -104,24 +104,6 @@ galleryItemStyle(w, h)
|
||||
|
||||
time
|
||||
color: $grey
|
||||
|
||||
.more_setting
|
||||
display: none
|
||||
|
||||
.more
|
||||
display: inline-block
|
||||
padding: 0 1rem
|
||||
height: h = 1.6rem
|
||||
// background: $light-blue
|
||||
// color: $white
|
||||
text-align: center
|
||||
text-decoration: none
|
||||
line-height: h
|
||||
cursor: pointer
|
||||
// transition: all 0.2s ease-in-out
|
||||
|
||||
// &:hover
|
||||
// background: $ruby
|
||||
|
||||
.article-title
|
||||
margin-bottom: 0.3rem
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
img.prev_cover, img.next_cover
|
||||
position: absolute
|
||||
padding: 0
|
||||
z-index: 50
|
||||
top: 0
|
||||
left: 0
|
||||
width: 100%
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
if hexo-config("post_beautify.enable")
|
||||
headStyle(fontsize)
|
||||
padding-left: unit(fontsize + 0.3, "rem")
|
||||
|
||||
code
|
||||
font-size: unit(fontsize, "rem")
|
||||
|
||||
&:before
|
||||
top: calc(50% - unit(fontsize / 2 - 0.05, "rem"))
|
||||
font-size: unit(fontsize, "rem")
|
||||
|
||||
&:hover
|
||||
padding-left: unit(fontsize + 0.2, "rem")
|
||||
|
||||
|
||||
#post-title
|
||||
font-size: 1.4rem
|
||||
|
||||
@@ -100,22 +115,130 @@
|
||||
#post-content
|
||||
margin-bottom: 1rem
|
||||
|
||||
ol,
|
||||
ul
|
||||
margin-top: 0.4rem
|
||||
counter-reset: li
|
||||
if hexo-config("post_beautify.enable")
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6
|
||||
cursor: pointer
|
||||
transition: all 0.2s ease-out
|
||||
|
||||
p
|
||||
margin: 0
|
||||
&:before
|
||||
position: absolute
|
||||
top: calc(50% - 0.35rem)
|
||||
left: 0
|
||||
color: $title-prefix-icon-color
|
||||
content: $title-prefix-icon
|
||||
font: normal normal normal 14px / 1 FontAwesome
|
||||
font-size: 0.8rem
|
||||
transition: all 0.2s ease-out
|
||||
|
||||
&:hover
|
||||
padding-left: 1.1rem
|
||||
|
||||
&:before
|
||||
color: $light-blue
|
||||
|
||||
h1
|
||||
headStyle(1)
|
||||
|
||||
h2
|
||||
headStyle(0.9)
|
||||
|
||||
h3
|
||||
headStyle(0.8)
|
||||
|
||||
h4
|
||||
headStyle(0.7)
|
||||
|
||||
h5
|
||||
headStyle(0.6)
|
||||
|
||||
h6
|
||||
headStyle(0.6)
|
||||
|
||||
ol,
|
||||
ul
|
||||
padding-left: 0.5rem
|
||||
margin-top: 0.4rem
|
||||
padding: 0 0 0 0.8rem
|
||||
list-style: none
|
||||
counter-reset: li
|
||||
|
||||
li
|
||||
position: relative
|
||||
margin: 0.3rem 0
|
||||
padding-left: 0.3rem
|
||||
p
|
||||
margin: 0
|
||||
|
||||
ol,
|
||||
ul
|
||||
padding-left: 0.5rem
|
||||
|
||||
li
|
||||
position: relative
|
||||
margin: 0.2rem 0
|
||||
padding: 0.1rem 0.5rem 0.1rem 1.5rem
|
||||
|
||||
&:hover
|
||||
&:before
|
||||
transform: rotate(360deg)
|
||||
|
||||
&:before
|
||||
position: absolute
|
||||
top: 0
|
||||
left: 0
|
||||
background: $light-blue
|
||||
color: $white
|
||||
cursor: pointer
|
||||
transition: all 0.3s ease-out
|
||||
|
||||
ol
|
||||
> li
|
||||
&:before
|
||||
margin-top: 0.2rem
|
||||
width: w = 1.2rem
|
||||
height: h = w
|
||||
border-radius: 0.5 * w
|
||||
content: counter(li)
|
||||
counter-increment: li
|
||||
text-align: center
|
||||
font-size: 0.6rem
|
||||
line-height: h
|
||||
|
||||
ul
|
||||
> li
|
||||
&:hover
|
||||
&:before
|
||||
border-color: $ruby
|
||||
|
||||
&:before
|
||||
$w = 0.3rem
|
||||
top: 10px
|
||||
margin-left: 0.45rem
|
||||
width: w = $w
|
||||
height: h = w
|
||||
border: 0.5 * w solid $light-blue
|
||||
border-radius: w
|
||||
background: $white
|
||||
content: ""
|
||||
line-height: h
|
||||
|
||||
else
|
||||
ol,
|
||||
ul
|
||||
margin-top: 0.4rem
|
||||
counter-reset: li
|
||||
|
||||
p
|
||||
margin: 0
|
||||
|
||||
ol,
|
||||
ul
|
||||
padding-left: 0.5rem
|
||||
|
||||
li
|
||||
position: relative
|
||||
margin: 0.3rem 0
|
||||
padding-left: 0.3rem
|
||||
|
||||
a
|
||||
color: $a-link-color
|
||||
@@ -249,7 +372,7 @@ img
|
||||
|
||||
|
||||
|
||||
@media screen and (max-width: 900px)
|
||||
@media screen and (max-width: 1024px)
|
||||
.layout
|
||||
margin: 0 15px
|
||||
width: auto
|
||||
|
||||
57
source/css/_layout/post_bottom.styl
Normal file
57
source/css/_layout/post_bottom.styl
Normal file
@@ -0,0 +1,57 @@
|
||||
#post_bottom
|
||||
position: fixed
|
||||
bottom: -50px
|
||||
background: alpha($white, 0.8)
|
||||
width: 100%
|
||||
border: none
|
||||
box-shadow: 0 -5px 6px -5px alpha($grey, 0.6)
|
||||
display: none
|
||||
transition: all .2s
|
||||
cursor: pointer
|
||||
|
||||
&.toc_mobile_show
|
||||
bottom: 0
|
||||
|
||||
#mobile_to_comment,#mobile_toc
|
||||
width: 50%
|
||||
text-align: center
|
||||
font-size: 18px
|
||||
padding: 7px 0
|
||||
display: inline-block
|
||||
color: $light-black
|
||||
|
||||
a
|
||||
text-decoration: none
|
||||
color: $light-black
|
||||
|
||||
#toc_mobile
|
||||
box-shadow: 0 0 4px alpha($grey, 0.6)
|
||||
background: $white
|
||||
width: 50%
|
||||
height: 70%
|
||||
position: fixed
|
||||
bottom: 65px
|
||||
right: 10px
|
||||
overflow: scroll
|
||||
padding: 15px 10px
|
||||
font-size: 15px
|
||||
border-radius: 10px
|
||||
display: none
|
||||
|
||||
ol,li
|
||||
list-style: none
|
||||
padding: 0 0 0 5px
|
||||
margin: 0
|
||||
|
||||
a
|
||||
&:hover
|
||||
color: $light-blue
|
||||
|
||||
.toc_mobile_headline
|
||||
text-align: center
|
||||
font-size: 18px
|
||||
font-weight: bold
|
||||
|
||||
@media screen and (max-width:768px)
|
||||
#post_bottom
|
||||
display: block
|
||||
@@ -1,12 +1,10 @@
|
||||
#recent-posts
|
||||
width: 75%
|
||||
|
||||
.recent-post-item
|
||||
padding: 0
|
||||
box-shadow: 0 4px 8px 6px rgba(7,17,27,0.06)
|
||||
border-radius: 8px
|
||||
-webkit-transition: all 0.3s
|
||||
-moz-transition: all 0.3s
|
||||
-o-transition: all 0.3s
|
||||
-ms-transition: all 0.3s
|
||||
transition: all 0.3s
|
||||
background: #fff
|
||||
margin-top: 20px
|
||||
@@ -34,9 +32,6 @@
|
||||
height: 280px
|
||||
overflow: hidden
|
||||
|
||||
|
||||
|
||||
|
||||
img.post_bg
|
||||
border: 0
|
||||
transition: all .6s
|
||||
@@ -76,53 +71,6 @@ a.article-meta__categories
|
||||
overflow: hidden
|
||||
height: 90px
|
||||
|
||||
.more {
|
||||
position: relative
|
||||
letter-spacing: 1.2px
|
||||
text-transform: uppercase
|
||||
overflow: hidden
|
||||
z-index: 1
|
||||
background-color: $light-blue
|
||||
|
||||
&:focus {
|
||||
outline: none
|
||||
}
|
||||
}
|
||||
|
||||
.more--primary {
|
||||
color: $white
|
||||
}
|
||||
|
||||
.more--animated {
|
||||
transition-property: color
|
||||
transition-duration: 0.5s
|
||||
|
||||
&:before {
|
||||
content: ""
|
||||
position: absolute
|
||||
top: 0
|
||||
left: 0
|
||||
right: 0
|
||||
bottom: 0
|
||||
background: $ruby
|
||||
transform: scaleX(0)
|
||||
transform-origin: 0 50%
|
||||
transition-property: transform
|
||||
transition-duration: 0.5s
|
||||
transition-timing-function: ease-out
|
||||
z-index: -1
|
||||
}
|
||||
|
||||
&:hover {
|
||||
color: white
|
||||
|
||||
&:before {
|
||||
transform: scaleX(1)
|
||||
transition-timing-function: cubic-bezier(0.45, 1.64, 0.47, 0.66)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.layout_page
|
||||
display: flex
|
||||
margin: 0 auto
|
||||
@@ -130,8 +78,6 @@ a.article-meta__categories
|
||||
align-items: flex-start
|
||||
padding: 0 15px
|
||||
|
||||
#recent-posts
|
||||
width: 75%
|
||||
|
||||
#page,.category-content,.flink
|
||||
padding: 40px 44px 44px
|
||||
@@ -155,12 +101,18 @@ a.article-meta__categories
|
||||
#site-title
|
||||
font-family: PingFang SC, Hiragino Sans GB, "Microsoft JhengHei", "Microsoft YaHei", Helvetica Neue, Helvetica, Arial, sans-serif
|
||||
|
||||
@media screen and (max-width: 900px)
|
||||
#page,.category-content,#archive,.tag-cloud,.flink,#tag,#category
|
||||
width: 100% !important
|
||||
@media screen and (min-width: 900px)
|
||||
if hexo-config("aside.position") == "left"
|
||||
#recent-posts
|
||||
order: 2
|
||||
|
||||
// .recent-post-info
|
||||
// padding: 40px 30px 20px
|
||||
#page,.category-content,#archive,.tag-cloud,.flink,#tag,#category
|
||||
order: 2
|
||||
|
||||
|
||||
@media screen and (max-width: 900px)
|
||||
#page,.category-content,#archive,.tag-cloud,.flink,#tag,#category
|
||||
width: 100% !important
|
||||
|
||||
|
||||
@media screen and (max-width:768px)
|
||||
@@ -209,15 +161,7 @@ a.article-meta__categories
|
||||
|
||||
#aside_content
|
||||
display: none !important
|
||||
// .card_widget
|
||||
// box-shadow: none
|
||||
// border-radius: 0
|
||||
// border-top: 1px dashed #a4d8fa
|
||||
|
||||
// &:hover
|
||||
// box-shadow: none
|
||||
|
||||
|
||||
.category-lists
|
||||
padding: 0
|
||||
|
||||
@@ -230,9 +174,6 @@ a.article-meta__categories
|
||||
#recent-posts #pagination
|
||||
margin-bottom: 0
|
||||
|
||||
.more_setting
|
||||
display: block !important
|
||||
|
||||
#nav #site-social-icons
|
||||
display: block
|
||||
|
||||
@@ -282,14 +223,9 @@ footer
|
||||
@keyframes pulse{
|
||||
|
||||
0%,to{
|
||||
// -ms-filter:"alpha(opacity=40)"
|
||||
// filter:alpha(opacity=40)
|
||||
opacity:.4
|
||||
top:0}
|
||||
50%{
|
||||
// -ms-filter:none
|
||||
// -webkit-filter:none
|
||||
// filter:none
|
||||
opacity:1
|
||||
top:-16px}
|
||||
}
|
||||
@@ -351,25 +287,3 @@ footer
|
||||
50%{transform:scale(1)}
|
||||
80%{transform:scale(.98)}
|
||||
100%{transform:scale(1)}}
|
||||
|
||||
|
||||
|
||||
@keyframes menu_open{
|
||||
0% {
|
||||
transform: scale(0)
|
||||
}
|
||||
100% {
|
||||
transform: scale(1)
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes menu_close{
|
||||
0% {
|
||||
transform: scale(1)
|
||||
display: block
|
||||
}
|
||||
100% {
|
||||
transform: scale(0)
|
||||
display: none
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,9 +9,12 @@ $theme-hr-color = #A4D8FA
|
||||
$theme-read-mode-bg-color = #FAF9DE
|
||||
$font-family= Lato, Helvetica Neue For Number, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, PingFang SC, Hiragino Sans GB, "Microsoft YaHei", Helvetica Neue, Helvetica, Arial, sans-serif
|
||||
$code-font = consolas, Menlo, "PingFang SC", "Microsoft YaHei", monospace, Helvetica Neue For Number
|
||||
$site-name-font = "Titillium Web", Lato,PingFang SC, Hiragino Sans GB, "Microsoft JhengHei", "Microsoft YaHei", Helvetica Neue, Helvetica, Arial, sans-serif
|
||||
//hr icon
|
||||
$hr-icon = '\f0c4'
|
||||
$hr-icon-top = -10px
|
||||
$title-prefix-icon = '\f0c1'
|
||||
$title-prefix-icon-color = #F47466
|
||||
|
||||
if hexo-config("theme_color") && hexo-config("theme_color.enable")
|
||||
$theme-color = convert(hexo-config("theme_color.main")) || #49B1F5
|
||||
@@ -27,10 +30,18 @@ if hexo-config("font") && hexo-config("font.enable")
|
||||
$font-family = convert(hexo-config("font.font-family")) || 'Lato, Helvetica Neue For Number, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, PingFang SC, Hiragino Sans GB, "Microsoft YaHei", Helvetica Neue, Helvetica, Arial, sans-serif'
|
||||
$code-font = convert(hexo-config("font.code-font")) || 'consolas, Menlo, "PingFang SC", "Microsoft YaHei", monospace, Helvetica Neue For Number'
|
||||
|
||||
if hexo-config("blog_title_font.font-family")
|
||||
$site-name-font = convert(hexo-config("blog_title_font.font-family")) || '"Titillium Web",Lato,PingFang SC, Hiragino Sans GB, "Microsoft JhengHei", "Microsoft YaHei", Helvetica Neue, Helvetica, Arial, sans-serif'
|
||||
|
||||
|
||||
if hexo-config("hr") && hexo-config("hr.enable")
|
||||
$hr-icon = hexo-config("hr.icon") || '\f0c4'
|
||||
$hr-icon-top = convert(hexo-config("hr.icon-top")) || -10px
|
||||
|
||||
if hexo-config("post_beautify.enable")
|
||||
$title-prefix-icon = hexo-config("post_beautify.title-prefix-icon") || '\f0c1'
|
||||
$title-prefix-icon-color= convert(hexo-config("post_beautify.title-prefix-icon-color")) || #F47466
|
||||
|
||||
|
||||
// Global Variables
|
||||
$font-size = 14px
|
||||
@@ -38,6 +49,7 @@ $font-color = #1F2D3D
|
||||
$rem = 20px
|
||||
$font-family = $font-family
|
||||
$code-font = $code-font
|
||||
$site-name-font = $site-name-font
|
||||
$text-line-height = 2
|
||||
$sm = 768px
|
||||
$bg = 1024px
|
||||
@@ -74,6 +86,7 @@ $light-grey = #EEEEEE
|
||||
$grey = $theme-meta-color
|
||||
$pale-yellow = $theme-read-mode-bg-color
|
||||
$white = #FFFFFF
|
||||
$whitesmoke = #f5f5f5;
|
||||
$dark-white = #F9F9F9
|
||||
$font-black = #4C4948
|
||||
$selection = $theme-text-selection-color
|
||||
@@ -98,4 +111,73 @@ $img-border-padding = 4px
|
||||
$sidebar-width = 300px
|
||||
$sidebar-background = #f6f8fa
|
||||
|
||||
// Note colors
|
||||
// --------------------------------------------------
|
||||
hexo-config('note.light_bg_offset') is a 'unit' ? ($lbg = unit(hexo-config('note.light_bg_offset'),"%")) : ($lbg = 0);
|
||||
|
||||
// Default
|
||||
$note-default-border = #777;
|
||||
$note-default-bg = lighten(spin($note-default-border, 0), 94% + $lbg);
|
||||
$note-default-text = $note-default-border;
|
||||
$note-default-icon = "\f0a9";
|
||||
|
||||
$note-modern-default-border = #e1e1e1;
|
||||
$note-modern-default-bg = lighten(spin($note-modern-default-border, 10), 60% + ($lbg * 4));
|
||||
$note-modern-default-text = #666;
|
||||
$note-modern-default-hover = darken(spin($note-modern-default-text, -10), 32%);
|
||||
|
||||
// Primary
|
||||
$note-primary-border = #6f42c1;
|
||||
$note-primary-bg = lighten(spin($note-primary-border, 10), 92% + $lbg);
|
||||
$note-primary-text = $note-primary-border;
|
||||
$note-primary-icon = "\f055";
|
||||
|
||||
$note-modern-primary-border = #e1c2ff;
|
||||
$note-modern-primary-bg = lighten(spin($note-modern-primary-border, 10), 40% + ($lbg * 4));
|
||||
$note-modern-primary-text = #6f42c1;
|
||||
$note-modern-primary-hover = darken(spin($note-modern-primary-text, -10), 22%);
|
||||
|
||||
// Info
|
||||
$note-info-border = #428bca;
|
||||
$note-info-bg = lighten(spin($note-info-border, -10), 91% + $lbg);
|
||||
$note-info-text = $note-info-border;
|
||||
$note-info-icon = "\f05a";
|
||||
|
||||
$note-modern-info-border = #b3e5ef;
|
||||
$note-modern-info-bg = lighten(spin($note-modern-info-border, 10), 50% + ($lbg * 4));
|
||||
$note-modern-info-text = #31708f;
|
||||
$note-modern-info-hover = darken(spin($note-modern-info-text, -10), 32%);
|
||||
|
||||
// Success
|
||||
$note-success-border = #5cb85c;
|
||||
$note-success-bg = lighten(spin($note-success-border, 10), 90% + $lbg);
|
||||
$note-success-text = $note-success-border;
|
||||
$note-success-icon = "\f058";
|
||||
|
||||
$note-modern-success-border = #d0e6be;
|
||||
$note-modern-success-bg = lighten(spin($note-modern-success-border, 10), 40% + ($lbg * 4));
|
||||
$note-modern-success-text = #3c763d;
|
||||
$note-modern-success-hover = darken(spin($note-modern-success-text, -10), 27%);
|
||||
|
||||
// Warning
|
||||
$note-warning-border = #f0ad4e;
|
||||
$note-warning-bg = lighten(spin($note-warning-border, 10), 88% + $lbg);
|
||||
$note-warning-text = $note-warning-border;
|
||||
$note-warning-icon = "\f06a";
|
||||
|
||||
$note-modern-warning-border = #fae4cd;
|
||||
$note-modern-warning-bg = lighten(spin($note-modern-warning-border, 10), 43% + ($lbg * 4));
|
||||
$note-modern-warning-text = #8a6d3b;
|
||||
$note-modern-warning-hover = darken(spin($note-modern-warning-text, -10), 18%);
|
||||
|
||||
// Danger
|
||||
$note-danger-border = #d9534f;
|
||||
$note-danger-bg = lighten(spin($note-danger-border, -10), 92% + $lbg);
|
||||
$note-danger-text = $note-danger-border;
|
||||
$note-danger-icon = "\f056";
|
||||
|
||||
$note-modern-danger-border = #ebcdd2;
|
||||
$note-modern-danger-bg = lighten(spin($note-modern-danger-border, 10), 35% + ($lbg * 4));
|
||||
$note-modern-danger-text = #a94442;
|
||||
$note-modern-danger-hover = darken(spin($note-modern-danger-text, -10), 22%);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
$(function () {
|
||||
if ($('#sidebar').hasClass('auto_open') ) {
|
||||
if ($('#sidebar').hasClass('auto_open')) {
|
||||
if ($(".sidebar-toc__content").children().length > 0) {
|
||||
$(".layout_post").animate({}, function () {
|
||||
{
|
||||
@@ -81,8 +81,9 @@ $(function () {
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
// 首页fullpage添加
|
||||
// 添加class
|
||||
if (/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(navigator.userAgent)) {} else {
|
||||
$('.full_page').css('background-attachment', 'fixed')
|
||||
if (/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(navigator.userAgent)) { } else {
|
||||
$('.full_page').css('background-attachment', 'fixed');
|
||||
$('#to_comment').css("display", "block")
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
@@ -94,37 +95,6 @@ $(function () {
|
||||
});
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// tags 隨機大小 顔色
|
||||
var list = document.querySelectorAll(".tag-cloud .tag-cloud-tags a");
|
||||
|
||||
if ($(window).width() > 768) {
|
||||
Array.prototype.forEach.call(list, (item, index) => {
|
||||
item.style.fontSize = Math.floor(Math.random() * 20 + 15) + "px"; //15 ~ 35
|
||||
item.style.color =
|
||||
"rgb(" +
|
||||
Math.floor(Math.random() * 201) +
|
||||
", " +
|
||||
Math.floor(Math.random() * 201) +
|
||||
", " +
|
||||
Math.floor(Math.random() * 201) +
|
||||
")"; // 0,0,0 -> 200,200,200
|
||||
});
|
||||
} else {
|
||||
Array.prototype.forEach.call(list, (item, index) => {
|
||||
item.style.fontSize = Math.floor(Math.random() * 13 + 15) + "px"; //15 ~ 28
|
||||
item.style.color =
|
||||
"rgb(" +
|
||||
Math.floor(Math.random() * 201) +
|
||||
", " +
|
||||
Math.floor(Math.random() * 201) +
|
||||
", " +
|
||||
Math.floor(Math.random() * 201) +
|
||||
")"; // 0,0,0 -> 200,200,200
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// bookmark
|
||||
$.fancyConfirm = function (opts) {
|
||||
@@ -242,25 +212,28 @@ $(function () {
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
//fancybox
|
||||
var imgList = $(".recent-post-info img");
|
||||
var imgList = $(".recent-post-info img").not('.no-fancybox');
|
||||
if (imgList.length === 0) {
|
||||
imgList = $("#post-content img");
|
||||
}
|
||||
for (var i = 0; i < imgList.length; i++) {
|
||||
var $a = $(
|
||||
'<a href="' +
|
||||
imgList[i].src +
|
||||
'" data-fancybox="group" data-caption="' +
|
||||
imgList[i].alt +
|
||||
'" class="fancybox"></a>'
|
||||
);
|
||||
var alt = imgList[i].alt;
|
||||
var $wrap = $(imgList[i]).wrap($a);
|
||||
if (alt) {
|
||||
$wrap.after('<div class="img-alt">' + alt + "</div>");
|
||||
}
|
||||
imgList = $("#post-content img").not('.no-fancybox');
|
||||
}
|
||||
|
||||
for (var i = 0; i < imgList.length; i++) {
|
||||
var lazyload_src = imgList[i].src ? imgList[i].src : imgList.eq(i).attr("data-src")
|
||||
|
||||
var $a = $(
|
||||
'<a href="' +
|
||||
lazyload_src +
|
||||
'" data-fancybox="group" data-caption="' +
|
||||
imgList[i].alt +
|
||||
'" class="fancybox"></a>'
|
||||
)
|
||||
|
||||
var alt = imgList[i].alt
|
||||
var $wrap = $(imgList[i]).wrap($a)
|
||||
if (alt) {
|
||||
$wrap.after('<div class="img-alt">' + alt + '</div>')
|
||||
}
|
||||
}
|
||||
$().fancybox({
|
||||
selector: "[data-fancybox]",
|
||||
loop: true,
|
||||
@@ -292,91 +265,44 @@ $(function () {
|
||||
|
||||
});
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
//lazy懶加載
|
||||
//把img的src删除,添加data-src,用于lozad.js
|
||||
var $img = $("#post img");
|
||||
$img.addClass("lozad");
|
||||
$img.each(function () {
|
||||
var src_link = $(this).attr("src");
|
||||
$(this).attr("data-src", src_link);
|
||||
$(this).removeAttr("src");
|
||||
})
|
||||
|
||||
const observer = lozad(); // lazy loads elements with default selector as '.lozad'
|
||||
observer.observe();
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
/** head点击*/
|
||||
$('.toggle-menu').on('click', function () {
|
||||
|
||||
if ($(".toggle-menu").hasClass("open")) {
|
||||
$(".toggle-menu").removeClass("open").addClass("close");
|
||||
$("#page-header #site-name,#page-header .search").css({'color':'#3b3a3a','text-shadow': 'none'})
|
||||
$(".toggle-menu *").css({ 'background-color': '#3b3a3a', 'text-shadow': 'none' });
|
||||
$('body').addClass("is_hidden");
|
||||
$('.menus').addClass("menu_open");
|
||||
} else {
|
||||
$(".toggle-menu").removeClass("close").addClass("open");
|
||||
$("#page-header #site-name,#page-header .search").css({ 'color': '', 'text-shadow': '' });
|
||||
$(".toggle-menu *").css({ 'background-color': '', 'text-shadow': '' });
|
||||
$('body').removeClass("is_hidden");
|
||||
$('.menus').removeClass("menu_open").addClass('menu_close');
|
||||
setTimeout(function () {
|
||||
$('.menus').removeClass("menu_close")
|
||||
|
||||
}, 300)
|
||||
$('.menus').animate({
|
||||
right: 0
|
||||
}, 300 )
|
||||
$('.menu_mask,.menus').css("display","block")
|
||||
}
|
||||
})
|
||||
|
||||
const fixScroll = (scrollEl) => {
|
||||
let startY
|
||||
scrollEl.addEventListener('touchstart', function (event) {
|
||||
// 如果多於1根手指點擊屏幕,則不處理
|
||||
if (event.targetTouches.length > 1) {
|
||||
return
|
||||
}
|
||||
// 儲存手指的初始位置
|
||||
startY = event.targetTouches[0].clientY
|
||||
}, false)
|
||||
scrollEl.addEventListener('touchmove', function (event) {
|
||||
if (event.targetTouches.length > 1) {
|
||||
return
|
||||
}
|
||||
// 判斷手指滑動方向, y大於0時向下滑動, 小於0時向上滑動
|
||||
const y = event.targetTouches[0].clientY - startY
|
||||
// 如果到頂時繼續向下拉
|
||||
if (scrollEl.scrollTop <= 0 && y > 0) {
|
||||
// 重置滾動距離為最小值
|
||||
scrollEl.scrollTop = 0
|
||||
// 阻止滾動
|
||||
event.preventDefault()
|
||||
}
|
||||
// 如果到底時繼續上滑
|
||||
const maxScrollTop = scrollEl.scrollHeight - scrollEl.clientHeight
|
||||
if (maxScrollTop - scrollEl.scrollTop <= 0 && y < 0) {
|
||||
scrollEl.scrollTop = maxScrollTop
|
||||
event.preventDefault()
|
||||
}
|
||||
}, {
|
||||
passive: false
|
||||
})
|
||||
}
|
||||
const scrollEl = document.querySelector(".menus");
|
||||
fixScroll(scrollEl)
|
||||
|
||||
$('.menu_mask ').on('click touchstart', function () {
|
||||
$(".toggle-menu").removeClass("close").addClass("open");
|
||||
$('body').removeClass("is_hidden");
|
||||
$('.menus').animate({
|
||||
right: -250
|
||||
}, 300,function () {
|
||||
{$('.menus').css({ 'display': ''})
|
||||
}
|
||||
})
|
||||
$('.menu_mask').css("display","")
|
||||
})
|
||||
|
||||
$(window).on('resize', function (e) {
|
||||
if (!$('.toggle-menu').is(':visible')) {
|
||||
if ($(".toggle-menu").hasClass("close")) {
|
||||
$(".toggle-menu").removeClass("close").addClass("open");
|
||||
$("#page-header #site-name,#page-header .search").css({ 'color': '', 'text-shadow': '' });
|
||||
$(".toggle-menu *").css({ 'background-color': '', 'text-shadow': '' });
|
||||
$('body').removeClass("is_hidden");
|
||||
$('.menus').removeClass("menu_open");
|
||||
}
|
||||
$(".toggle-menu").removeClass("close").addClass("open");
|
||||
$('body').removeClass("is_hidden");
|
||||
$('.menus').animate({
|
||||
right: -250
|
||||
}, 300)
|
||||
$('.menu_mask').css("display","")
|
||||
}
|
||||
}
|
||||
})
|
||||
} )
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
/** scroll 滚动 toc*/
|
||||
@@ -394,13 +320,19 @@ $(function () {
|
||||
}
|
||||
var isUp = scrollDirection(currentTop)
|
||||
|
||||
if($(".toggle-menu").hasClass("open")){
|
||||
if ($(".toggle-menu").hasClass("open")) {
|
||||
if (currentTop > 56) {
|
||||
|
||||
if (isUp) {
|
||||
$('#page-header').hasClass('visible') ? $('#page-header').removeClass('visible') : console.log()
|
||||
$('#post_bottom').removeClass('toc_mobile_show')
|
||||
$('#toc_mobile').hasClass('is_visible') ? $('#toc_mobile').removeClass('is_visible') : console.log()
|
||||
|
||||
} else {
|
||||
$('#page-header').hasClass('visible') ? console.log() : $('#page-header').addClass('visible')
|
||||
$('#post_bottom').addClass('toc_mobile_show')
|
||||
$('#toc_mobile').hasClass('is_visible') ? $('#toc_mobile').removeClass('is_visible') : console.log()
|
||||
|
||||
}
|
||||
$('#page-header').addClass('fixed')
|
||||
if ($('#go-up').css('opacity') === '0') {
|
||||
@@ -426,6 +358,8 @@ $(function () {
|
||||
} else {
|
||||
if (currentTop === 0) {
|
||||
$('#page-header').removeClass('fixed').removeClass('visible')
|
||||
$('#post_bottom').removeClass('toc_mobile_show')
|
||||
|
||||
}
|
||||
|
||||
$('#go-up').animate({}, function () {
|
||||
@@ -441,8 +375,19 @@ $(function () {
|
||||
'transform': 'translateX(0)'
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ( $(window).width() <= 768 && $('#post_bottom').hasClass('toc_mobile_show') ){
|
||||
$('#rightside').css('bottom', '110px')
|
||||
$('#go-up').css('bottom', '70px')
|
||||
|
||||
} else {
|
||||
$('#rightside').css('bottom', '60px')
|
||||
$('#go-up').css('bottom', '20px')
|
||||
}
|
||||
|
||||
}, 50, 100))
|
||||
|
||||
// go up smooth scroll
|
||||
@@ -451,9 +396,9 @@ $(function () {
|
||||
})
|
||||
|
||||
// head scroll
|
||||
$('#post-content').find('h1,h2,h3,h4,h5,h6').on('click', function (e) {
|
||||
scrollToHead('#' + $(this).attr('id'))
|
||||
})
|
||||
// $('#post-content').find('h1,h2,h3,h4,h5,h6').on('click', function (e) {
|
||||
// scrollToHead('#' + $(this).attr('id'))
|
||||
// })
|
||||
|
||||
// head scroll
|
||||
$('.toc-link').on('click', function (e) {
|
||||
@@ -546,6 +491,17 @@ $(function () {
|
||||
// Hide their respective list of subsections
|
||||
.find('.toc-child').hide()
|
||||
}
|
||||
|
||||
if ($('.toc-link').hasClass('active')) {
|
||||
var active_position = $(".active").offset().top;
|
||||
var sidebar_scrolltop = $("#sidebar").scrollTop();
|
||||
if (active_position > (top + $(window).height() - 50)) {
|
||||
$("#sidebar").scrollTop(sidebar_scrolltop + 100);
|
||||
} else if (active_position < top + 50) {
|
||||
$("#sidebar").scrollTop(sidebar_scrolltop - 100);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//代碼框雙擊全屏
|
||||
@@ -560,14 +516,17 @@ $(function () {
|
||||
//閲讀模式
|
||||
$("#readmode").click(function () {
|
||||
|
||||
|
||||
if (Cookies.get("night-mode") == "night") {
|
||||
$('body').toggleClass('night-mode');
|
||||
$('body').toggleClass('read-mode');
|
||||
$('#font_plus,#font_minus').toggleClass('is_visible');
|
||||
$('#font_plus,#font_minus,#to_comment').toggleClass('is_visible');
|
||||
$('#to_comment').toggleClass('is_invisible');
|
||||
|
||||
} else {
|
||||
$('body').toggleClass('read-mode');
|
||||
$('#font_plus,#font_minus').toggleClass('is_visible');
|
||||
$('#font_plus,#font_minus,#to_comment').toggleClass('is_visible');
|
||||
$('#to_comment').toggleClass('is_invisible');
|
||||
}
|
||||
|
||||
});
|
||||
@@ -576,11 +535,42 @@ $(function () {
|
||||
//閲讀模式下字體調整
|
||||
$("#font_plus").click(function () {
|
||||
var font_size_record = parseFloat($('body').css('font-size'))
|
||||
var code_size_record = parseFloat($('pre').css('font-size'))
|
||||
var code_size_record = parseFloat($('code').css('font-size'))
|
||||
$('body').css('font-size', font_size_record + 1)
|
||||
$('pre').css('font-size', font_size_record + 1)
|
||||
$('code').css('font-size', font_size_record + 1)
|
||||
});
|
||||
|
||||
$("#font_minus").click(function () {
|
||||
var font_size_record = parseFloat($('body').css('font-size'))
|
||||
var code_size_record = parseFloat($('pre').css('font-size'))
|
||||
var code_size_record = parseFloat($('code').css('font-size'))
|
||||
$('body').css('font-size', font_size_record - 1)
|
||||
$('pre').css('font-size', font_size_record - 1)
|
||||
$('code').css('font-size', font_size_record - 1)
|
||||
});
|
||||
|
||||
|
||||
$('#mobile_toc').on('click', function () {
|
||||
$("#toc_mobile").toggleClass('is_visible')
|
||||
})
|
||||
|
||||
//代碼框語言識別
|
||||
$('figure').each(function () {
|
||||
var lang_name_index;
|
||||
var lang_name;
|
||||
lang_name_index = lang_name = $(this).attr('class').split(' ')[1];
|
||||
if (lang_name_index == 'js')
|
||||
lang_name = 'javascript'
|
||||
if (lang_name_index == 'md')
|
||||
lang_name = 'markdown'
|
||||
if (lang_name_index == 'plain')
|
||||
lang_name = 'code'
|
||||
if (lang_name_index == 'py')
|
||||
lang_name = 'python'
|
||||
|
||||
$('figure.' + lang_name_index + ' table').attr('data-content', lang_name);
|
||||
})
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user