1. fix algolia_search bug #1

2. add read mode
This commit is contained in:
hwy0127@gmail.com
2019-06-11 15:05:27 +08:00
parent ee434f7dc4
commit 66d4f279f9
13 changed files with 362 additions and 291 deletions

View File

@@ -1,82 +1,70 @@
--- # ---------------
# Theme color for customize # Theme color for customize
# Notice: color value must in double quotes like "#000" or may cause error! # Notice: color value must in double quotes like "#000" or may cause error!
# --------------- # ---------------
# theme_color: # theme_color:
# enable: true # enable: true
# main: "#7A7FF1" # main: "#49B1F5"
# paginator: "#7A7FF1" # paginator: "#00C4B6"
# button_hover: "#FF7242" # button_hover: "#FF7242"
# text_selection: "#69c46d" # text_selection: "#00C4B6"
# link_color: "#858585" # link_color: "#858585"
# hr_color: "#A4D8FA" # hr_color: "#A4D8FA"
# tag_start_color: "#A4D8FA"
# tag_end_color: "#1B9EF3"
# Main menu navigation # Main menu navigation
# format: xxx: /xxx/||icon
# ---------------
menu: menu:
Home: /||fa fa-home Home: /
Archives: /archives/||fa fa-archive Archives: /archives
Tags: /tags/||fa fa-tags Tags: /tags
Categories: /categories/||fa fa-folder-open Categories: /categories
Link: /link/||fa fa-link #XXX: /xxx
About: /about/||fa fa-heart
# #XXX: /xxx
# Favicon # Favicon
# use my-favicon.ico to avoid duplicate favicon of melody theme
# --------------- # ---------------
favicon: /img/favicon.png favicon: /melody-favicon.ico
# PWA # PWA
# See https://github.com/JLHwung/hexo-offline # See https://github.com/JLHwung/hexo-offline
# --------------- # ---------------
# pwa: pwa:
# enable: true enable: false
# manifest: /img/pwa/manifest.json manifest: /manifest.json
# theme_color: "#fff" # If you don't want to trouble, just ignore the following things
# apple_touch_icon: /img/pwa/apple-touch-icon.png # See https://realfavicongenerator.net/
# favicon_32_32: /img/pwa/32.png # theme_color: "#49B1F5"
# favicon_16_16: /img/pwa/16.png # apple_touch_icon: /apple-touch-icon.png
# mask_icon: /img/pwa/safari-pinned-tab.svg # favicon_32_32: /favicon-32x32.png
# shortcut_icon: /img/favicon.ico # favicon_16_16: /favicon-16x16.png
# mask_icon: /safari-pinned-tab.svg
# Highlight theme # Highlight theme
# --------------- # ---------------
highlight_theme: light highlight_theme: default
code_word_wrap: false # code_word_wrap: true or false
# Nav settings # Nav settings
# formal: # see the icon_name in fontawesome website.
# icon: link # And you need to add the `fa` or `fab` prefix by your self.
# --------------- # ---------------
social: #social:
fa fa-github: https://github.com/jerryc127 #icon_name fa: url
fa fa-rss: /atom.xml #icon_name fab: url
# Algolia search # Algolia search
# --------------- # ---------------
algolia_search: algolia_search:
enable: flase enable: false
hits: hits:
per_page: 6 per_page: 10
labels:
input_placeholder: Search for Posts
hits_empty: "We didn't find any results for the search: ${query}" # if there are no result
hits_stats: "${hits} results found in ${time} ms"
# Local search # Local search
# Please see doc for more details: https://molunerfinn.com/hexo-theme-melody-doc/#/third-party-support?id=local-search # Please see doc for more details: https://molunerfinn.com/hexo-theme-melody-doc/#/third-party-support?id=local-search
# --------------- # ---------------
local_search: local_search:
enable: true enable: false
labels:
input_placeholder: Search for Posts
hits_empty: "We didn't find any results for the search: ${query}" # if there are no result
# MathJax # MathJax
# Please see doc for more details: https://molunerfinn.com/hexo-theme-melody-doc/#/third-party-support?id=mathjax # Please see doc for more details: https://molunerfinn.com/hexo-theme-melody-doc/#/third-party-support?id=mathjax
@@ -94,73 +82,53 @@ katex:
hide_scrollbar: true hide_scrollbar: true
# Analysis # Analysis
# --------------- # ---------------
# baidu_analytics: baidu_analytics:
#Google Analytics
google_analytics: google_analytics:
# Tencent_analytics ID
tencent_analytics:
# stylesheets loaded in the <head> # stylesheets loaded in the <head>
# --------------- # ---------------
stylesheets: stylesheets:
- /css/index.css - /css/index.css
# scripts loaded in the end of the body # scripts loaded in the end of the body
# --------------- # ---------------
scripts: scripts:
- /js/utils.js - /js/utils.js
- /js/main.js - /js/fancybox.js
- /js/baidupush.js - /js/sidebar.js
- /js/copy.js
- /js/transition.js
- /js/scroll.js
- /js/head.js
# cdn for third-party library # cdn for third-party library
# --------------- # ---------------
cdn: cdn:
css: css:
fontawesome: https://cdn.jsdelivr.net/npm/font-awesome@latest/css/font-awesome.min.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 # fontawesomeV5: https://use.fontawesome.com/releases/v5.3.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: js:
anime: https://cdn.jsdelivr.net/npm/animejs@latest/anime.min.js
jquery: https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.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 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 velocity: https://cdn.jsdelivr.net/npm/velocity-animate@latest/velocity.min.js
lozy: https://cdn.jsdelivr.net/npm/lozad/dist/lozad.min.js velocity-ui: https://cdn.jsdelivr.net/npm/velocity-ui-pack@latest/velocity.ui.min.js
# Post info settings # Post info settings
# --------------- # ---------------
# avatar: /img/avatar.png avatar:
avatar: https://cdn.jsdelivr.net/gh/jerryc127/CDN@latest/Photo/avatar.png
# the banner image of index
# if the banner of another page not setting,it will show the top_img
top_img: https://i.loli.net/2019/05/22/5ce53eb6dc82757840.jpg
#the banner image of post
# if the post not set the post cover and post top image, it will show it
post_img: https://cdn.jsdelivr.net/gh/jerryc127/CDN@latest/Photo/post.png
# the default cover of the post
default_cover: https://cdn.jsdelivr.net/gh/jerryc127/CDN@latest/cover/default_bg.png
# the banner image of archive page
archive_img: https://cdn.jsdelivr.net/gh/jerryc127/CDN@latest/Photo/archive.jpg
# if the photo link cannot connect,it will show that
lodding_bg:
flink: /img/friend_404.gif
post_page: /img/404.jpg
top_img: true # false or url of img
post_meta: post_meta:
date_type: both # or updated 文章日期是创建日或者更新日 date_type: created # created or updated
categories: true # or false 是否显示分类 categories: true
tags: true # or false 是否显示标签 tags: true
# Please see doc for more details: https://molunerfinn.com/hexo-theme-melody-doc/#/additional-package-support?id=word-counting # Please see doc for more details: https://molunerfinn.com/hexo-theme-melody-doc/#/additional-package-support?id=word-counting
wordcount: wordcount:
@@ -168,11 +136,7 @@ wordcount:
toc: toc:
enable: true enable: true
number: true # number: true
# auto open the sidebar in 'post'
auto_open_sidebar:
enable: true
post_copyright: post_copyright:
enable: true enable: true
@@ -180,11 +144,16 @@ post_copyright:
license_url: https://creativecommons.org/licenses/by-nc-sa/4.0/ license_url: https://creativecommons.org/licenses/by-nc-sa/4.0/
# Please see doc for more details: https://molunerfinn.com/hexo-theme-melody-doc/#/theme-config?id=auto-excerpt # Please see doc for more details: https://molunerfinn.com/hexo-theme-melody-doc/#/theme-config?id=auto-excerpt
auto_excerpt: # auto_excerpt:
enable: true # enable: false
length: 150 # length: 150
# QR_code:
# - itemlist:
# img:
# text:
# adv: # adv:
# enable: false # enable: false
# info: # info:
@@ -193,21 +162,18 @@ auto_excerpt:
# --------------- # ---------------
addThis: addThis:
enable: false enable: false
pubid: #pubid:
sharejs: # sharejs:
enable: true # enable: false
sites: facebook,twitter,wechat,weibo,qq # disabled_sites:
addtoany:
enable: false
# Comments System # Comments System
# --------------- # ---------------
disqus: disqus:
enable: false enable: false
shortname: #shortname:
count: true #count:
# laibili: # laibili:
# enable: false # enable: false
@@ -227,31 +193,25 @@ disqus:
# repo: # repo:
# owner: # owner:
# admin: # admin:
#### Using this js for redirect to gitalk container after login
#### See https://github.com/gitalk/gitalk/issues/125
# js: https://cdn.jsdelivr.net/gh/upupming/gitalk@36368e5dffd049e956cdbbd751ff96c28d8255cf/dist/gitalk.min.js
# valine comment system. https://valine.js.org # valine comment system. https://valine.js.org
valine: # valine:
enable: false # if you want use valine,please set this value is ture # enable: false # if you want use valine,please set this value is ture
appId: # leancloud application app id # appId: # leancloud application app id
appKey: # leancloud application app key # appKey: # leancloud application app key
notify: false # valine mail notify (true/false) https://github.com/xCss/Valine/wiki # notify: false # valine mail notify (true/false) https://github.com/xCss/Valine/wiki
verify: false # valine verify code (true/false) # verify: false # valine verify code (true/false)
pageSize: 10 # comment list page size # pageSize: 10 # comment list page size
avatar: monsterid # gravatar style https://valine.js.org/#/avatar # avatar: mm # gravatar style https://valine.js.org/#/avatar
lang: en # i18n: zh-cn/en # lang: zh-cn # i18n: zh-cn/en
placeholder: Please leave your footprints # valine comment input placeholder(like: Please leave your footprints ) # placeholder: Just go go # valine comment input placeholder(like: Please leave your footprints )
guest_info: nick,mail,link #valine comment header inf # guest_info: nick,mail,link #valine comment header inf
# Footer Settings # Footer Settings
# --------------- # ---------------
since: 2018 since: 2013
footer_custom_text: # footer_custom_text:
footer_copyright:
enable: true
ICP: ICP:
enable: false enable: false
@@ -259,117 +219,38 @@ ICP:
# busuanzi count for PV / UV in site # busuanzi count for PV / UV in site
busuanzi: busuanzi:
# count values only if the other configs are false
enable: true
# custom uv span for the whole site
site_uv: true site_uv: true
site_uv_header: <i class="fa fa-user"></i>
site_uv_footer:
# custom pv span for the whole site
site_pv: true site_pv: true
site_pv_header: <i class="fa fa-eye"></i>
site_pv_footer:
# custom pv span for one page only
page_pv: true page_pv: true
page_pv_header: <i class="fa fa-file-o"></i>
page_pv_footer:
# Sidebar Settings
# ---------------
#links_title: Links
#links:
#Name: url
# Follow Me Button # Follow Me Button
follow: # follow:
enable: true # enable: true
# url: ''
# text: ''
# Ads
# Google Webmaster tools verification setting # ---------------
# See: https://www.google.com/webmasters/ # Google Adsense
google_site_verification: google_adsense:
# Bing Webmaster tools verification setting
# 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:
# 360 Webmaster tools verification setting
# see http://zhanzhang.so.com/
qihu_site_verification:
Flink:
headline: 友情鏈接
info_headline: 我的Blog資料
name: Blog 名字: JerryC
address: Blog 地址: https://jerryc.me/
avatar: Blog 頭像: https://jerryc.me/img/avatar.png
info: Blog 簡介: 今日事,今日畢
comment: 如果需要交換友鏈,請留言
## friendlink
flinks:
[
{'name': '夢魘小棧',
'link': 'https://blog.ihoey.com',
'avatar': 'https://cdn.dode.top/avatar.png',
'descr': '心,若沒有棲息的地方,到哪裏都是流浪......'},
{'name': '冰峯博客',
'link':'https://www.ad-s.cn/',
'avatar': 'https://secure.gravatar.com/avatar/4074cd3e035c6e5796f6c263ef8ef0b8?s=56&d=wavatar&r=g',
'descr': '男人就應該保持冷靜,沸騰的水只會被蒸發掉。'}
]
## chinese traditional to Simplified
translate:
enable: true
runtimeshow:
enable: true
start_date: 6/7/2018 00:00:00
nightshift:
enable: true
activate_power_mode:
enable: false enable: false
js: //pagead2.googlesyndication.com/pagead/js/adsbygoogle.js
client: ca-pub-...........
enable_page_level_ads: true
announcement:
content: 感謝訪問本站,若喜歡請收藏 ^_^
reward:
enable: true
QR_code:
- itemlist:
img: /img/wechat.jpg
text: 微信
- itemlist:
img: /img/alipay.jpg
text: 支付寶
related_post:
enable: true
# canvas_ribbon
# See: https://github.com/hustcc/ribbon.js
canvas_ribbon:
enable: false
size: 150
alpha: 0.6
zIndex: -1
click_to_change: false
canvas_ribbon_piao:
enable: true
# 避免重复网址分散seo
canonical: true
# 禁止百度转码
disable_baidu_transformation: true
twitter_meta: true
Open_Graph_meta: true

View File

@@ -108,7 +108,6 @@
.webinfo_item .webinfo_item
.webinfo_article_name= _p('aside.card_webinfo.article_name') + " :" .webinfo_article_name= _p('aside.card_webinfo.article_name') + " :"
.webinfo_article_count= site.posts.length .webinfo_article_count= site.posts.length
if theme.runtimeshow.enable if theme.runtimeshow.enable
.webinfo_item .webinfo_item
.webinfo_runtime_name= _p('aside.card_webinfo.runtime_name') + " :" .webinfo_runtime_name= _p('aside.card_webinfo.runtime_name') + " :"

View File

@@ -1,17 +1,40 @@
if theme.disqus.enable
hr hr
#post-comment #post-comment
.comment_headling .comment_headling
i.fa.fa-comments.fa-fw(aria-hidden="true") i.fa.fa-comments.fa-fw(aria-hidden="true")
=" " =" "
span= _p('comment') span= _p('comment')
if theme.disqus.enable
include ./disqus.pug include ./disqus.pug
else if theme.laibili && theme.laibili.enable else if theme.laibili && theme.laibili.enable
hr
#post-comment
.comment_headling
i.fa.fa-comments.fa-fw(aria-hidden="true")
=" "
span= _p('comment')
include ./laibili.pug include ./laibili.pug
else if theme.gitment && theme.gitment.enable else if theme.gitment && theme.gitment.enable
hr
#post-comment
.comment_headling
i.fa.fa-comments.fa-fw(aria-hidden="true")
=" "
span= _p('comment')
include ./gitment.pug include ./gitment.pug
else if theme.gitalk && theme.gitalk.enable else if theme.gitalk && theme.gitalk.enable
hr
#post-comment
.comment_headling
i.fa.fa-comments.fa-fw(aria-hidden="true")
=" "
span= _p('comment')
include ./gitalk.pug include ./gitalk.pug
else if theme.valine && theme.valine.enable else if theme.valine && theme.valine.enable
hr
#post-comment
.comment_headling
i.fa.fa-comments.fa-fw(aria-hidden="true")
=" "
span= _p('comment')
include ./valine.pug include ./valine.pug

View File

@@ -1,4 +1,8 @@
section#rightside.rightside section#rightside.rightside
if theme.readmode.enable && is_post()
i#readmode.fa.fa-book
i#font_plus.fa.fa-plus
i#font_minus.fa.fa-minus
if page.comments !== false && !is_home() && !is_archive() if page.comments !== false && !is_home() && !is_archive()
i#to_comment.fa.fa-comments-o i#to_comment.fa.fa-comments-o
if theme.translate && theme.translate.enable if theme.translate && theme.translate.enable

View File

@@ -220,6 +220,22 @@ table
opacity: 0 opacity: 0
transition: all .2s transition: all .2s
#readmode,#font_plus,#font_minus
width: 30px
height: 30px
background-color: #49b1f5
color: #e3e8ee
text-align: center
line-height: 29px
font-size: 16px
display: block
margin-bottom: 2px
cursor: pointer
text-decoration: none
#font_minus,#font_plus
display: none
.translate_chn_to_cht .translate_chn_to_cht
width: 30px width: 30px
height: 30px height: 30px
@@ -340,6 +356,5 @@ table
.tright .tright
text-align: right text-align: right
.is_visible
display: block !important

View File

@@ -0,0 +1,113 @@
.read-mode
background: $pale-yellow
padding: 0 !important
#sidebar,
#toggle-sidebar
display: none
#top-container
background-image: none !important
height: 14rem
background-color: $pale-yellow
a
color: #4c4948
&:before
opacity: 0
#site-name,
.site-page
text-shadow: none
color: #4c4948
#post-info
text-align: center
padding: 0
color: #4c4948
#post-title,
#post-meta
text-shadow: none
#page-header
&.fixed
background: none
box-shadow: none
&.open-sidebar
.site-page
display: inline-block
opacity: 1
.toggle-menu
.menu-icon-first,
.menu-icon-second,
.menu-icon-third
background-color: #4c4948
.layout_post
box-shadow: none
background: $pale-yellow
&:hover
box-shadow: none
.article-container
pre,
.highlight
background: darken($pale-yellow,5);
.highlight
&:after
background: darken($pale-yellow,10);
table
&:after
background: darken($pale-yellow,10);
blockquote
border-left: 0.2rem solid #d6dbdf
background-color: rgba(102,128,153,.05)
#rightside
#to_comment,#nightshift
display: none
canvas
display: none !important
footer,
#post-comment,
hr,
.relatedPosts,
#pagination,
.post-reward,
.tag_share,
.post-copyright
display: none
&::-webkit-scrollbar-thumb
background: darken($pale-yellow,15)
*::-webkit-scrollbar-thumb
background: darken($pale-yellow,15)

View File

@@ -6,6 +6,9 @@
background: #2d3035 !important background: #2d3035 !important
box-shadow: -0.25rem 0 0.25rem #2d3035 !important box-shadow: -0.25rem 0 0.25rem #2d3035 !important
&::-webkit-scrollbar-thumb
background: lighten(#2d3035,5)
if hexo-config("local_search") && hexo-config("local_search.enable") if hexo-config("local_search") && hexo-config("local_search.enable")
#local-search #local-search
background: #2d3035 background: #2d3035
@@ -96,6 +99,9 @@
&:after,.copy-notice &:after,.copy-notice
background: rgb(27, 38, 59) background: rgb(27, 38, 59)
&::-webkit-scrollbar-thumb
background: lighten(#1B2631,10)
.copy-notice .copy-notice
background: rgb(27, 38, 59) background: rgb(27, 38, 59)
@@ -119,7 +125,8 @@
.translate_chn_to_cht, .translate_chn_to_cht,
.nightshift, .nightshift,
#to_comment #to_comment,
#readmode
background-color: #2d3035 !important background-color: #2d3035 !important
img img
@@ -189,8 +196,8 @@
img img
filter: brightness(1) filter: brightness(1)
&::-webkit-scrollbar-thumb
background: lighten(#2d3035,5)
@media screen and (max-width: 768px) @media screen and (max-width: 768px)
.night-mode .night-mode

View File

@@ -6,6 +6,7 @@ $theme-text-selection-color = #00c4b6
$theme-meta-color = #858585 $theme-meta-color = #858585
$theme-link-color = #99a9bf $theme-link-color = #99a9bf
$theme-hr-color = #A4D8FA $theme-hr-color = #A4D8FA
$theme-read-mode-bg-color = #FAF9DE
if hexo-config("theme_color") && hexo-config("theme_color.enable") if hexo-config("theme_color") && hexo-config("theme_color.enable")
$theme-color = convert(hexo-config("theme_color.main")) || #49B1F5 $theme-color = convert(hexo-config("theme_color.main")) || #49B1F5
@@ -15,6 +16,7 @@ if hexo-config("theme_color") && hexo-config("theme_color.enable")
$theme-link-color = convert(hexo-config("theme_color.link_color")) || #99a9bf $theme-link-color = convert(hexo-config("theme_color.link_color")) || #99a9bf
$theme-meta-color = convert(hexo-config("theme_color.meta_color")) || #858585 $theme-meta-color = convert(hexo-config("theme_color.meta_color")) || #858585
$theme-hr-color = convert(hexo-config("theme_color.hr_color")) || #A4D8FA $theme-hr-color = convert(hexo-config("theme_color.hr_color")) || #A4D8FA
$theme-read-mode-bg-color = convert(hexo-config("theme_color.read-mode-bg_color")) || #FAF9DE
// Global Variables // Global Variables
$font-size = 14px $font-size = 14px
@@ -56,6 +58,7 @@ $dark-black = #000000
$pale-grey = #F7F7F7 $pale-grey = #F7F7F7
$light-grey = #EEEEEE $light-grey = #EEEEEE
$grey = $theme-meta-color $grey = $theme-meta-color
$pale-yellow = $theme-read-mode-bg-color
$white = #FFFFFF $white = #FFFFFF
$dark-white = #F9F9F9 $dark-white = #F9F9F9
$font-black = #4C4948 $font-black = #4C4948

Binary file not shown.

Before

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 361 B

View File

@@ -25,11 +25,9 @@ $(function () {
}, 200); }, 200);
} }
}) })
} } else
else
$("#toggle-sidebar").css("display", "none") $("#toggle-sidebar").css("display", "none")
} } else {
else {
$('#toggle-sidebar').css('opacity', '1') $('#toggle-sidebar').css('opacity', '1')
} }
@@ -83,8 +81,7 @@ $(function () {
//----------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------
// 首页fullpage添加 // 首页fullpage添加
// 添加class // 添加class
if (/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(navigator.userAgent)) { if (/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(navigator.userAgent)) {} else {
} else {
$('.full_page').css('background-attachment', 'fixed') $('.full_page').css('background-attachment', 'fixed')
} }
@@ -147,8 +144,7 @@ $(function () {
$.fancybox.open({ $.fancybox.open({
type: 'html', type: 'html',
src: src: '<div class="fc-content">' +
'<div class="fc-content">' +
'<h3>' + opts.title + '</h3>' + '<h3>' + opts.title + '</h3>' +
'<p>' + opts.message + '</p>' + '<p>' + opts.message + '</p>' +
'<p class="tright">' + '<p class="tright">' +
@@ -159,8 +155,7 @@ $(function () {
animationDuration: 350, animationDuration: 350,
animationEffect: 'material', animationEffect: 'material',
modal: true, modal: true,
baseTpl: baseTpl: '<div class="fancybox-container fc-container" role="dialog" tabindex="-1">' +
'<div class="fancybox-container fc-container" role="dialog" tabindex="-1">' +
'<div class="fancybox-bg"></div>' + '<div class="fancybox-bg"></div>' +
'<div class="fancybox-inner">' + '<div class="fancybox-inner">' +
'<div class="fancybox-stage"></div>' + '<div class="fancybox-stage"></div>' +
@@ -183,8 +178,7 @@ $(function () {
// alert('按 ' + (navigator.userAgent.toLowerCase().indexOf('mac') != -1 ? 'Command/Cmd' : 'CTRL') + ' + D 鍵將本頁加入書籤.'); // alert('按 ' + (navigator.userAgent.toLowerCase().indexOf('mac') != -1 ? 'Command/Cmd' : 'CTRL') + ' + D 鍵將本頁加入書籤.');
$.fancyConfirm({ $.fancyConfirm({
title: "添加書籤?", title: "添加書籤?",
message: message: '按 ' + (navigator.userAgent.toLowerCase().indexOf('mac') != -1 ? 'Command/Cmd' : 'CTRL') + ' + D 鍵將本頁加入書籤.',
'按 ' + (navigator.userAgent.toLowerCase().indexOf('mac') != -1 ? 'Command/Cmd' : 'CTRL') + ' + D 鍵將本頁加入書籤.',
okButton: "OK", okButton: "OK",
}); });
@@ -515,4 +509,33 @@ $(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');
}
else {
$('body').toggleClass('read-mode');
$('#font_plus,#font_minus').toggleClass('is_visible');
}
});
//閲讀模式下字體調整
$("#font_plus").click(function () {
var font_size_record = parseFloat($('body').css('font-size'))
$('body').css('font-size',font_size_record + 1)
}
);
$("#font_minus").click(function () {
var font_size_record = parseFloat($('body').css('font-size'))
$('body').css('font-size',font_size_record - 1)
}
);
}); });

View File

@@ -3,18 +3,21 @@ $(function() {
function switchReadMode() { function switchReadMode() {
var next_mode = $("body").hasClass("night-mode") ? "day" : "night"; var next_mode = $("body").hasClass("night-mode") ? "day" : "night";
Cookies.set("read-mode", next_mode, {expires: 7, path: '/'}); Cookies.set("night-mode", next_mode, {
expires: 7,
path: '/'
});
changeReadModel(); changeReadModel();
} }
function changeReadModel() { function changeReadModel() {
if (Cookies.get("read-mode") == "night") { if (Cookies.get("night-mode") == "night") {
$("body").addClass("night-mode"); $("body").addClass("night-mode");
$("#nightshift").removeClass("fa-moon-o").addClass("fa-sun-o"); $("#nightshift").removeClass("fa-moon-o").addClass("fa-sun-o");
} }
// 非夜間模式 // 非夜間模式
if (Cookies.get("read-mode") == "day") { if (Cookies.get("night-mode") == "day") {
$("body").removeClass("night-mode"); $("body").removeClass("night-mode");
$("#nightshift").removeClass("fa-sun-o").addClass("fa-moon-o"); $("#nightshift").removeClass("fa-sun-o").addClass("fa-moon-o");
} }