mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-16 20:30:53 +08:00
Merge branch 'dev' into master
This commit is contained in:
@@ -88,6 +88,7 @@
|
|||||||
script.
|
script.
|
||||||
var GLOBAL_CONFIG = {
|
var GLOBAL_CONFIG = {
|
||||||
root: '!{config.root}',
|
root: '!{config.root}',
|
||||||
|
hexoversion: '!{get_hexo_version()}',
|
||||||
algolia: !{algolia},
|
algolia: !{algolia},
|
||||||
localSearch: !{localSearch},
|
localSearch: !{localSearch},
|
||||||
translate: !{translate},
|
translate: !{translate},
|
||||||
|
|||||||
14
layout/includes/third-party/pjax.pug
vendored
14
layout/includes/third-party/pjax.pug
vendored
@@ -1,8 +1,6 @@
|
|||||||
script(src=url_for(theme.CDN.pjax))
|
script(src=url_for(theme.CDN.pjax))
|
||||||
script.
|
script.
|
||||||
var pjax = new Pjax({
|
let pjaxSelectors = [
|
||||||
elements: 'a:not([target="_blank"])',
|
|
||||||
selectors: [
|
|
||||||
'title',
|
'title',
|
||||||
'meta[name=description]',
|
'meta[name=description]',
|
||||||
'#config_change',
|
'#config_change',
|
||||||
@@ -10,7 +8,15 @@ script.
|
|||||||
'#rightside-config-hide',
|
'#rightside-config-hide',
|
||||||
'#rightside-config-show',
|
'#rightside-config-show',
|
||||||
'.js-pjax'
|
'.js-pjax'
|
||||||
],
|
]
|
||||||
|
|
||||||
|
if (!{theme.Open_Graph_meta && theme.comments.use && theme.comments.use.includes('Livere')}) {
|
||||||
|
pjaxSelectors.unshift('meta[property="og:image"]', 'meta[property="og:title"]', 'meta[property="og:url"]')
|
||||||
|
}
|
||||||
|
|
||||||
|
const pjax = new Pjax({
|
||||||
|
elements: 'a:not([target="_blank"])',
|
||||||
|
selectors: pjaxSelectors,
|
||||||
cacheBust: false,
|
cacheBust: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hexo-theme-butterfly",
|
"name": "hexo-theme-butterfly",
|
||||||
"version": "3.0.0",
|
"version": "3.0.1",
|
||||||
"description": "A Simple and Card UI Design theme for Hexo",
|
"description": "A Simple and Card UI Design theme for Hexo",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -61,3 +61,7 @@ hexo.extend.helper.register('urlNoIndex', function () {
|
|||||||
hexo.extend.helper.register('md5', function (path) {
|
hexo.extend.helper.register('md5', function (path) {
|
||||||
return crypto.createHash('md5').update(decodeURI(this.url_for(path))).digest('hex')
|
return crypto.createHash('md5').update(decodeURI(this.url_for(path))).digest('hex')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
hexo.extend.helper.register('get_hexo_version', function () {
|
||||||
|
return hexo.version
|
||||||
|
})
|
||||||
@@ -465,6 +465,7 @@ const tocFn = function () {
|
|||||||
// DOM Hierarchy:
|
// DOM Hierarchy:
|
||||||
// ol.toc > (li.toc-item, ...)
|
// ol.toc > (li.toc-item, ...)
|
||||||
// li.toc-item > (a.toc-link, ol.toc-2child > (li.toc-item, ...))
|
// li.toc-item > (a.toc-link, ol.toc-2child > (li.toc-item, ...))
|
||||||
|
const versionBiggerFive = GLOBAL_CONFIG.hexoversion.split('.')[0] >= 5
|
||||||
const findHeadPosition = function (top) {
|
const findHeadPosition = function (top) {
|
||||||
// assume that we are not in the post page if no TOC link be found,
|
// assume that we are not in the post page if no TOC link be found,
|
||||||
// thus no need to update the status
|
// thus no need to update the status
|
||||||
@@ -477,7 +478,8 @@ const tocFn = function () {
|
|||||||
list.each(function () {
|
list.each(function () {
|
||||||
const head = $(this)
|
const head = $(this)
|
||||||
if (top > head.offset().top - 25) {
|
if (top > head.offset().top - 25) {
|
||||||
currentId = '#' + encodeURI($(this).attr('id'))
|
if (versionBiggerFive) currentId = '#' + encodeURI($(this).attr('id'))
|
||||||
|
else currentId = '#' + $(this).attr('id')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user