🐛 適配hexo 5.0.0 修復toc點擊不會跳轉的bugs

🐛 適配hexo 5.0.0 修復toc點擊不會跳轉的bugs
🍻 文件整理
🍻 UI微調
This commit is contained in:
Jerry
2020-08-01 01:50:01 +08:00
Unverified
parent ddb728d8f4
commit 507453671a
56 changed files with 385 additions and 204 deletions
+2 -2
View File
@@ -245,11 +245,11 @@ if hexo-config('avatar.effect') == true
#mobile-sidebar-menus
&.open
transform: translate3d(-100%, 0px, 0px)
transform: translate3d(-100%, 0, 0)
for i in 1 2 3 4
> :nth-child({i})
animation: sidebarItem (i / 5)s
animation: sidebarItem (i / 5) s
@keyframes scroll-down-effect
0%
+1 -1
View File
@@ -3,7 +3,7 @@ figure.highlight
table
&::-webkit-scrollbar-thumb
background: $highlight-scrollbar
pre .deletion
color: $highlight-deletion
+3 -4
View File
@@ -25,7 +25,7 @@ if $highlight_theme == 'default'
}
$highlight-scrollbar = darken($highlight-background, 6)
if $highlight_theme == 'darker' || $highlight_theme == 'mac'
if $highlight_theme == 'darker' || ($highlight_theme == 'mac')
$highlight-background = #212121
$highlight-current-line = #282a2e
$highlight-selection = #61616150
@@ -40,7 +40,7 @@ if $highlight_theme == 'darker' || $highlight_theme == 'mac'
$highlight-purple = #C792EA
$highlight-deletion = #BF42BF
$highlight-addition = #105EDE
$highlight-mac-border = rgba(0,0,0,.4)
$highlight-mac-border = rgba(0, 0, 0, .4)
$highlight-gutter = {
color: alpha($highlight-foreground, .5),
bg-color: $highlight-background
@@ -101,7 +101,7 @@ if $highlight_theme == 'ocean'
}
$highlight-scrollbar = darken($highlight-background, 5)
if $highlight_theme == 'light' || $highlight_theme == 'mac light'
if $highlight_theme == 'light' || ($highlight_theme == 'mac light')
$highlight-background = #F6F8FA
$highlight-current-line = #00346e
$highlight-selection = #80CBC440
@@ -127,7 +127,6 @@ if $highlight_theme == 'light' || $highlight_theme == 'mac light'
}
$highlight-scrollbar = darken($highlight-background, 8)
if $highlight_theme == false
$highlight-background = #F6F8FA
$highlight-foreground = #90A4AE
+2
View File
@@ -19,6 +19,8 @@
border-radius: 8px
background: $comments-switch-bg
else
vertical-align: middle
> span
display: none
+1 -2
View File
@@ -69,8 +69,7 @@ beautify()
padding-left: .6rem
@media screen and (max-width: $sm)
padding-left: 0.2rem
padding-left: .2rem
li
&:not(.tab)
+1 -1
View File
@@ -49,5 +49,5 @@
.relatedPosts_title
@extend .limit-more-line
-webkit-line-clamp: 2
color: var(--white)
-webkit-line-clamp: 2
+1 -1
View File
@@ -26,9 +26,9 @@
left: auto
z-index: 103
width: $mobile-sidebar-width
box-shadow: none
opacity: 1
transition: all .4s
box-shadow: none
.toc-child
display: block !important
+9 -12
View File
@@ -182,7 +182,7 @@ const sidebarFn = () => {
closeMobileSidebar('toc')
} else {
e.preventDefault()
scrollToDest($(this).attr('href'))
scrollToDest(decodeURI($(this).attr('href')))
}
})
}
@@ -464,7 +464,7 @@ const tocFn = function () {
// find head position & add active class
// DOM Hierarchy:
// ol.toc > (li.toc-item, ...)
// li.toc-item > (a.toc-link, ol.toc-child > (li.toc-item, ...))
// li.toc-item > (a.toc-link, ol.toc-2child > (li.toc-item, ...))
const findHeadPosition = function (top) {
// assume that we are not in the post page if no TOC link be found,
// thus no need to update the status
@@ -477,7 +477,7 @@ const tocFn = function () {
list.each(function () {
const head = $(this)
if (top > head.offset().top - 25) {
currentId = '#' + $(this).attr('id')
currentId = '#' + encodeURI($(this).attr('id'))
}
})
@@ -602,10 +602,10 @@ const clickFnOfSubMenu = function () {
/**
* 複製時加上版權信息
*/
const addCopyright = function () {
const addCopyright = () => {
const copyright = GLOBAL_CONFIG.copyright
document.body.oncopy = function (event) {
event.preventDefault()
document.body.oncopy = (e) => {
e.preventDefault()
let textFont; const copyFont = window.getSelection(0).toString()
if (copyFont.length > copyright.limitCount) {
textFont = copyFont + '\n' + '\n' + '\n' +
@@ -616,10 +616,9 @@ const addCopyright = function () {
} else {
textFont = copyFont
}
if (event.clipboardData) {
return event.clipboardData.setData('text', textFont)
if (e.clipboardData) {
return e.clipboardData.setData('text', textFont)
} else {
// 兼容IE
return window.clipboardData.setData('text', textFont)
}
}
@@ -628,7 +627,7 @@ const addCopyright = function () {
/**
* 網頁運行時間
*/
const addRuntime = function () {
const addRuntime = () => {
const $runtimeCount = $('#webinfo-runtime-count')
if ($runtimeCount.length) {
const publishDate = $runtimeCount.attr('publish_date')
@@ -649,7 +648,6 @@ const addTableWrap = function () {
/**
* 百度推送
*/
const pushToBaidu = () => {
const bp = document.createElement('script')
const curProtocol = window.location.protocol.split(':')[0]
@@ -666,7 +664,6 @@ const pushToBaidu = () => {
/**
* tag-hide
*/
const clickFnOfTagHide = function () {
const $hideInline = $('.hide-button')
if ($hideInline.length) {