mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-16 20:30:53 +08:00
🏷️ 更新2.3.0
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
# hexo-theme-butterfly
|
||||
|
||||
<<<<<<< HEAD
|
||||
<a href="https://github.com/jerryc127/hexo-theme-butterfly/releases"><img alt="Version" src="https://img.shields.io/badge/release-2.2.5-blue"/></a>
|
||||
=======
|
||||
<a href="https://github.com/jerryc127/hexo-theme-butterfly/releases"><img alt="Version" src="https://img.shields.io/badge/release-2.3.0-blue"/></a>
|
||||
>>>>>>> dev
|
||||
<a href="https://jerryc.me"><img alt="Author" src="https://img.shields.io/badge/author-JerryC-blur"/></a>
|
||||
<a href="https://hexo.io"><img alt="Hexo" src="https://img.shields.io/badge/hexo-4.0+-0e83c"/></a>
|
||||
<a href="https://nodejs.org/"><img alt="node.js" src="https://img.shields.io/badge/node.js-8.0+-blur"/></a>
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
# hexo-theme-butterfly
|
||||
|
||||
<<<<<<< HEAD
|
||||
<a href="https://github.com/jerryc127/hexo-theme-butterfly/releases"><img alt="Version" src="https://img.shields.io/badge/release-2.2.5-blue"/></a>
|
||||
=======
|
||||
<a href="https://github.com/jerryc127/hexo-theme-butterfly/releases"><img alt="Version" src="https://img.shields.io/badge/release-2.3.0-blue"/></a>
|
||||
>>>>>>> dev
|
||||
<a href="https://jerryc.me"><img alt="Author" src="https://img.shields.io/badge/author-JerryC-blur"/></a>
|
||||
<a href="https://hexo.io"><img alt="Hexo" src="https://img.shields.io/badge/hexo-4.0+-0e83c"/></a>
|
||||
<a href="https://nodejs.org/"><img alt="node.js" src="https://img.shields.io/badge/node.js-8.0+-blur"/></a>
|
||||
|
||||
@@ -67,11 +67,7 @@ aside:
|
||||
card_webinfo:
|
||||
headline: 網站資訊
|
||||
article_name: 文章數目
|
||||
<<<<<<< HEAD
|
||||
runtime_name: 已運行時間
|
||||
=======
|
||||
runtime_name: 已執行時間
|
||||
>>>>>>> dev
|
||||
site_wordcount: 本站總字數
|
||||
site_uv_name: 本站訪客數
|
||||
site_pv_name: 本站總訪問量
|
||||
@@ -84,13 +80,8 @@ bookmark:
|
||||
|
||||
rightside:
|
||||
readmode_title: 閱讀模式
|
||||
<<<<<<< HEAD
|
||||
font_plus_title: 放大字體
|
||||
font_minus_title: 縮小字體
|
||||
=======
|
||||
font_plus_title: 放大字型
|
||||
font_minus_title: 縮小字型
|
||||
>>>>>>> dev
|
||||
translate_title: 簡繁轉換
|
||||
night_mode_title: 夜間模式
|
||||
back_to_top: 回到頂部
|
||||
|
||||
@@ -20,11 +20,5 @@ html(lang=config.language data-theme=theme.display_mode)
|
||||
h1#error_title= '404'
|
||||
#error_subtitle= theme.error_404.subtitle
|
||||
include includes/rightside.pug
|
||||
<<<<<<< HEAD
|
||||
include includes/search/index.pug
|
||||
each item in theme.CDN_USE.js
|
||||
script(src=url_for(item))
|
||||
=======
|
||||
!=partial('includes/search/index', {}, {cache:theme.fragment_cache})
|
||||
>>>>>>> dev
|
||||
include includes/additional-js.pug
|
||||
|
||||
@@ -66,13 +66,9 @@ if theme.mermaid.enable
|
||||
include ./math/mermaid.pug
|
||||
|
||||
if is_home()
|
||||
<<<<<<< HEAD
|
||||
include ./head/subtitle.pug
|
||||
=======
|
||||
include ./head/subtitle.pug
|
||||
|
||||
!=fragment_cache('injectBottom', function(){return injectHtml(theme.inject.bottom)})
|
||||
|
||||
if theme.preloader
|
||||
!=partial('includes/loading/loading-js', {}, {cache:theme.fragment_cache})
|
||||
>>>>>>> dev
|
||||
|
||||
@@ -10,16 +10,10 @@
|
||||
- var isSubtitle = config.subtitle ? ' - ' + config.subtitle : ''
|
||||
- var tabTitle = is_home() || !pageTitle ? config.title + isSubtitle : pageTitle + ' | ' + config.title
|
||||
|
||||
<<<<<<< HEAD
|
||||
- var pageDescription = page.description || page.title || config.description
|
||||
- var pageKeywords
|
||||
- if (page.tags && page.tags.data) pageKeywords = page.tags.data.map(function(tag) {return tag.name;}).join(',')
|
||||
=======
|
||||
- var pageDescription = page_description()
|
||||
- var pageKeywords
|
||||
- if (page.keywords) pageKeywords = Array.isArray(page.keywords) ? (page.keywords).join(',') : ([]).join(',') || page.keywords
|
||||
- else if (page.tags && page.tags.length) pageKeywords = page.tags.data.map(function(tag) {return tag.name;}).join(',')
|
||||
>>>>>>> dev
|
||||
- else pageKeywords = Array.isArray(config.keywords) ? (config.keywords).join(','): ([]).join(',') || config.keywords
|
||||
- var pageAuthor = config.email ? config.author + ',' + config.email : config.author
|
||||
- var pageCopyright = config.copyright || config.author
|
||||
@@ -106,8 +100,5 @@ if theme.blog_title_font.font_link
|
||||
|
||||
include ./head/config_site.pug
|
||||
include ./head/noscript.pug
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
!=fragment_cache('injectHead', function(){return injectHtml(theme.inject.head)})
|
||||
>>>>>>> dev
|
||||
|
||||
@@ -7,103 +7,117 @@ if theme.subtitle.enable
|
||||
|
||||
if source == '1'
|
||||
script.
|
||||
var subtitleEffect = !{subtitleEffect}
|
||||
fetch('https://api.ooopn.com/ciba/api.php',)
|
||||
.then(function (res){
|
||||
return res.json();
|
||||
var subtitleType = function () {
|
||||
var subtitleEffect = !{ subtitleEffect }
|
||||
fetch('https://api.btstu.cn/yan/api.php?charset=utf-8&encode=json',)
|
||||
.then(function (res) {
|
||||
return res.json()
|
||||
})
|
||||
.then(function (data) {
|
||||
if (subtitleEffect){
|
||||
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
|
||||
var both = sub.unshift(data['ciba-en'],data.ciba)
|
||||
var typed = new Typed("#subtitle", {
|
||||
if (subtitleEffect) {
|
||||
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(',')
|
||||
var both = sub.unshift(data.text)
|
||||
var typed = new Typed('#subtitle', {
|
||||
strings: sub,
|
||||
startDelay: 300,
|
||||
typeSpeed: 150,
|
||||
loop: !{theme.subtitle.loop},
|
||||
backSpeed: 50
|
||||
});
|
||||
}else{
|
||||
document.getElementById("subtitle").innerHTML = data['ciba-en']
|
||||
backSpeed: 50,
|
||||
})
|
||||
} else {
|
||||
document.getElementById('subtitle').innerHTML = data.text
|
||||
}
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.error(err);
|
||||
console.error(err)
|
||||
})
|
||||
}
|
||||
window.addEventListener('load', subtitleType)
|
||||
|
||||
else if source == '2'
|
||||
script.
|
||||
var subtitleEffect = !{subtitleEffect}
|
||||
var subtitleType = function () {
|
||||
var subtitleEffect = !{ subtitleEffect }
|
||||
fetch('https://v1.hitokoto.cn')
|
||||
.then(function (res){
|
||||
return res.json();
|
||||
.then(function (res) {
|
||||
return res.json()
|
||||
})
|
||||
.then(function (data) {
|
||||
if (subtitleEffect){
|
||||
if (subtitleEffect) {
|
||||
var from = '出自 ' + data.from
|
||||
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
|
||||
var both = sub.unshift(data.hitokoto,from)
|
||||
var typed = new Typed("#subtitle", {
|
||||
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(',')
|
||||
var both = sub.unshift(data.hitokoto, from)
|
||||
var typed = new Typed('#subtitle', {
|
||||
strings: sub,
|
||||
startDelay: 300,
|
||||
typeSpeed: 150,
|
||||
loop: !{theme.subtitle.loop},
|
||||
backSpeed: 50
|
||||
});
|
||||
}else{
|
||||
document.getElementById("subtitle").innerHTML = data.hitokoto
|
||||
backSpeed: 50,
|
||||
})
|
||||
} else {
|
||||
document.getElementById('subtitle').innerHTML = data.hitokoto
|
||||
}
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.error(err);
|
||||
console.error(err)
|
||||
})
|
||||
}
|
||||
window.addEventListener('load', subtitleType)
|
||||
|
||||
else if source == "3"
|
||||
script(type="text/javascript" src="http://yijuzhan.com/api/word.php?m=js")
|
||||
else if source == '3'
|
||||
script.
|
||||
var subtitleEffect = !{subtitleEffect}
|
||||
var con = str[0];
|
||||
if (subtitleEffect){
|
||||
var from = "出自 " + str[1];
|
||||
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
|
||||
var both = sub.unshift(con,from)
|
||||
var typed = new Typed("#subtitle", {
|
||||
var subtitleType = function () {
|
||||
loadScript('http://yijuzhan.com/api/word.php?m=js', function () {
|
||||
var subtitleEffect = !{ subtitleEffect }
|
||||
var con = str[0]
|
||||
if (subtitleEffect) {
|
||||
var from = '出自 ' + str[1]
|
||||
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(',')
|
||||
var both = sub.unshift(con, from)
|
||||
var typed = new Typed('#subtitle', {
|
||||
strings: sub,
|
||||
startDelay: 300,
|
||||
typeSpeed: 150,
|
||||
loop: !{theme.subtitle.loop},
|
||||
backSpeed: 50
|
||||
});
|
||||
}else{
|
||||
document.getElementById("subtitle").innerHTML = con
|
||||
backSpeed: 50,
|
||||
})
|
||||
} else {
|
||||
document.getElementById('subtitle').innerHTML = con
|
||||
}
|
||||
})
|
||||
}
|
||||
window.addEventListener('load', subtitleType)
|
||||
|
||||
else if source == '4'
|
||||
script(type="text/javascript" src="https://sdk.jinrishici.com/v2/browser/jinrishici.js" charset="utf-8")
|
||||
script.
|
||||
var subtitleEffect = !{subtitleEffect}
|
||||
jinrishici.load(function(result) {
|
||||
if (subtitleEffect){
|
||||
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
|
||||
var content = result.data.content;
|
||||
var subtitleType = function () {
|
||||
loadScript('https://sdk.jinrishici.com/v2/browser/jinrishici.js',function () {
|
||||
var subtitleEffect = !{ subtitleEffect }
|
||||
jinrishici.load(function (result) {
|
||||
if (subtitleEffect) {
|
||||
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(',')
|
||||
var content = result.data.content
|
||||
var both = sub.unshift(content)
|
||||
var typed = new Typed("#subtitle", {
|
||||
var typed = new Typed('#subtitle', {
|
||||
strings: sub,
|
||||
startDelay: 300,
|
||||
typeSpeed: 150,
|
||||
loop: !{theme.subtitle.loop},
|
||||
backSpeed: 50
|
||||
});
|
||||
}else{
|
||||
document.getElementById("subtitle").innerHTML = result.data.content
|
||||
backSpeed: 50,
|
||||
})
|
||||
} else {
|
||||
document.getElementById('subtitle').innerHTML = result.data.content
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
window.addEventListener('load', subtitleType)
|
||||
|
||||
else
|
||||
- var subtitle = theme.subtitle.sub[0]
|
||||
script.
|
||||
var subtitleEffect = !{subtitleEffect}
|
||||
if (subtitleEffect){
|
||||
if (subtitleEffect) {
|
||||
var typed = new Typed("#subtitle", {
|
||||
strings: '!{theme.subtitle.sub}'.split(","),
|
||||
startDelay: 300,
|
||||
@@ -111,6 +125,6 @@ if theme.subtitle.enable
|
||||
loop: !{theme.subtitle.loop},
|
||||
backSpeed: 50
|
||||
})
|
||||
}else{
|
||||
document.getElementById("subtitle").innerHTML = '!{subtitle}'
|
||||
} else {
|
||||
document.getElementById("subtitle").innerHTML = '!{theme.subtitle.sub[0]}'
|
||||
}
|
||||
|
||||
@@ -8,16 +8,6 @@
|
||||
a.site-page.social-icon.search
|
||||
i.fa.fa-search.fa-fw
|
||||
span=' '+_p('search')
|
||||
<<<<<<< HEAD
|
||||
.menus_items
|
||||
include ./menu_item.pug
|
||||
|
||||
span.toggle-menu.close
|
||||
a.site-page
|
||||
i.fa.fa-bars.fa-fw(aria-hidden="true")
|
||||
|
||||
|
||||
=======
|
||||
!=fragment_cache('menus', function(){return partial('includes/header/menu_item')})
|
||||
|
||||
span.toggle-menu.close
|
||||
@@ -25,4 +15,3 @@
|
||||
i.fa.fa-bars.fa-fw(aria-hidden="true")
|
||||
|
||||
|
||||
>>>>>>> dev
|
||||
|
||||
@@ -33,11 +33,7 @@ if theme.douban
|
||||
span#subtitle
|
||||
if(theme.social)
|
||||
#site_social_icons
|
||||
<<<<<<< HEAD
|
||||
!=partial('includes/header/social', {}, {cache:theme.fragment_cache})
|
||||
=======
|
||||
!=fragment_cache('social', function(){return partial('includes/header/social')})
|
||||
>>>>>>> dev
|
||||
#scroll_down
|
||||
i.fa.fa-angle-down.scroll-down-effects
|
||||
else if is_post()
|
||||
|
||||
@@ -69,22 +69,14 @@
|
||||
span.disqus-comment-count.comment-count
|
||||
a(href=full_url_for(page.path) + '#disqus_thread')
|
||||
else if (theme.valine && theme.valine.enable && theme.valine.count && page.comments !== false)
|
||||
<<<<<<< HEAD
|
||||
if (theme.busuanzi && theme.busuanzi.page_pv)
|
||||
=======
|
||||
if (postWordcount || theme.busuanzi.page_pv)
|
||||
>>>>>>> dev
|
||||
span.post-meta__separator |
|
||||
i.post-meta__icon(class=commentCount aria-hidden="true")
|
||||
span= _p('post.comments') + ':'
|
||||
a(href=url_for(page.path) + '#post-comment' itemprop="discussionUrl")
|
||||
span.valine-comment-count.comment-count(data-xid=url_for(page.path) itemprop="commentCount")
|
||||
else if (theme.gitalk && theme.gitalk.enable && theme.gitalk.count && page.comments !== false)
|
||||
<<<<<<< HEAD
|
||||
if (theme.busuanzi && theme.busuanzi.page_pv)
|
||||
=======
|
||||
if (postWordcount || theme.busuanzi.page_pv)
|
||||
>>>>>>> dev
|
||||
span.post-meta__separator |
|
||||
i.post-meta__icon(class=commentCount aria-hidden="true")
|
||||
span= _p('post.comments') + ':'
|
||||
|
||||
@@ -41,17 +41,5 @@ html(lang=config.language data-theme=theme.display_mode)
|
||||
!=partial('includes/footer', {}, {cache:theme.fragment_cache})
|
||||
|
||||
include ./rightside.pug
|
||||
|
||||
!=partial('includes/search/index', {}, {cache:theme.fragment_cache})
|
||||
<<<<<<< HEAD
|
||||
|
||||
each item in theme.CDN_USE.js
|
||||
script(src=url_for(item))
|
||||
|
||||
include ./additional-js.pug
|
||||
|
||||
|
||||
|
||||
=======
|
||||
include ./additional-js.pug
|
||||
>>>>>>> dev
|
||||
|
||||
@@ -62,16 +62,7 @@ mixin postUI(posts)
|
||||
.content!= expert
|
||||
else
|
||||
.content!= article.description
|
||||
<<<<<<< HEAD:layout/includes/mixins/UI.pug
|
||||
|
||||
if theme.ad && theme.ad.index
|
||||
if (index + 1) % 3 == 0
|
||||
.recent-post-item.ad_height!=theme.ad.index
|
||||
|
||||
- })
|
||||
=======
|
||||
|
||||
if theme.ad && theme.ad.index
|
||||
if (index + 1) % 3 == 0
|
||||
.recent-post-item.ad_height!=theme.ad.index
|
||||
>>>>>>> dev:layout/includes/mixins/post-ui.pug
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
each article , index in page.posts.data
|
||||
.recent-post-item
|
||||
- var link = article.link || article.path
|
||||
- var title = article.title || _p('no_title')
|
||||
- var leftOrRight = index%2 == 0 ? 'left_radius' : 'right_radius'
|
||||
- var post_cover = article.cover
|
||||
- var no_cover = article.cover === false || !theme.cover.index_enable ? 'no-cover' : ''
|
||||
if post_cover && theme.cover.index_enable
|
||||
.post_cover(class=leftOrRight)
|
||||
a(href=url_for(link) title=title)
|
||||
if theme.lazyload.enable
|
||||
img.post_bg.lazyload(data-src=`${post_cover}` onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` alt=title)
|
||||
else
|
||||
img.post_bg(src=`${post_cover}` onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` alt=title)
|
||||
.recent-post-info(class=no_cover)
|
||||
a.article-title(href=url_for(link) title=title)= title
|
||||
.article-meta-wrap
|
||||
if (article.top)
|
||||
span.article-meta
|
||||
i.fa.fa-thumb-tack.article-meta__icon.sticky
|
||||
span.sticky= _p('sticky')
|
||||
span.article-meta__separator |
|
||||
if (theme.post_meta.page.date_type)
|
||||
if (theme.post_meta.page.date_type === 'both')
|
||||
time.post-meta__date
|
||||
span.post-meta__date-created(title=_p('post.created') + ' ' + full_date(article.date))
|
||||
i.fa.fa-calendar(aria-hidden="true")
|
||||
=date(article.date, config.date_format)
|
||||
span.article-meta__separator |
|
||||
span.post-meta__date-updated(title=_p('post.updated') + ' ' + full_date(article.updated))
|
||||
i.fa.fa-history(aria-hidden="true")
|
||||
=date(article.updated, config.date_format)
|
||||
else
|
||||
- var data_type_updated = theme.post_meta.page.date_type === 'updated'
|
||||
- var date_type = data_type_updated ? 'updated' : 'date'
|
||||
- var date_icon = data_type_updated ? 'fa-history' :'fa-calendar'
|
||||
- var date_title = data_type_updated ? _p('post.updated') : _p('post.created')
|
||||
time.post-meta__date(title=date_title + ' ' + full_date(article[date_type]))
|
||||
i.fa(class=date_icon aria-hidden="true")
|
||||
=date(article[date_type], config.date_format)
|
||||
if (theme.post_meta.page.categories && article.categories.data.length > 0)
|
||||
span.article-meta
|
||||
span.article-meta__separator |
|
||||
each item, index in article.categories.data
|
||||
i.fa.fa-inbox.article-meta__icon(aria-hidden="true")
|
||||
a(href=url_for(item.path)).article-meta__categories #[=item.name]
|
||||
if (index < article.categories.data.length - 1)
|
||||
i.fa.fa-angle-right(aria-hidden="true")
|
||||
if (theme.post_meta.page.tags && article.tags.data.length > 0)
|
||||
span.article-meta.tags
|
||||
span.article-meta__separator |
|
||||
each item, index in article.tags.data
|
||||
i.fa.fa-tag.article-meta__icon(aria-hidden="true")
|
||||
a(href=url_for(item.path)).article-meta__tags #[=item.name]
|
||||
if (index < article.tags.data.length - 1)
|
||||
span.article-meta__link -
|
||||
if theme.auto_excerpt && theme.auto_excerpt.enable
|
||||
- const content = strip_html(article.content)
|
||||
- let expert = content.substring(0, theme.auto_excerpt.length)
|
||||
- content.length > theme.auto_excerpt.length ? expert += ' ...' : ''
|
||||
.content!= expert
|
||||
else
|
||||
.content!= article.description
|
||||
|
||||
if theme.ad && theme.ad.index
|
||||
if (index + 1) % 3 == 0
|
||||
.recent-post-item.ad_height!=theme.ad.index
|
||||
@@ -31,8 +31,4 @@
|
||||
|
||||
if(theme.social)
|
||||
.card-info-social-icons.is-center
|
||||
<<<<<<< HEAD
|
||||
include ../header/social.pug
|
||||
=======
|
||||
!=fragment_cache('social', function(){return partial('includes/header/social')})
|
||||
>>>>>>> dev
|
||||
|
||||
@@ -9,11 +9,7 @@ if theme.aside.enable
|
||||
!=partial('includes/widget/card_recent_post', {}, {cache:theme.fragment_cache})
|
||||
if theme.ad && theme.ad.aside
|
||||
!=partial('includes/widget/card_ad', {}, {cache:theme.fragment_cache})
|
||||
<<<<<<< HEAD
|
||||
if theme.aside.card_categories
|
||||
=======
|
||||
if theme.aside.card_categories.enable
|
||||
>>>>>>> dev
|
||||
!=partial('includes/widget/card_categories', {}, {cache:theme.fragment_cache})
|
||||
if theme.aside.card_tags.enable
|
||||
!=partial('includes/widget/card_tags', {}, {cache:theme.fragment_cache})
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
{
|
||||
"name": "hexo-theme-butterfly",
|
||||
<<<<<<< HEAD
|
||||
"version": "2.2.5",
|
||||
"description": "A Hexo Theme: Butterfly"
|
||||
=======
|
||||
"version": "2.3.0",
|
||||
"private": true,
|
||||
"engines": {
|
||||
@@ -19,5 +15,4 @@
|
||||
"repository": "https://github.com/jerryc127/hexo-theme-butterfly.git",
|
||||
"author": "Jerry <wong@jerryc.me>",
|
||||
"license": "MIT"
|
||||
>>>>>>> dev
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const url_for = require('hexo-util').url_for.bind(hexo);
|
||||
|
||||
function lazyProcess(htmlContent) {
|
||||
var bg = url_for(hexo.theme.config.lodding_bg.post);
|
||||
return htmlContent.replace(/<img(.*?)src="(.*?)"(.*?)>/gi, (str, p1, p2, p3) => {
|
||||
if (/data-src/gi.test(str)) {
|
||||
return str;
|
||||
}
|
||||
if (/class="(.*?)"/gi.test(str)){
|
||||
str = str.replace(/class="(.*?)"/gi, (classStr, p1) => {
|
||||
return classStr.replace(p1, `${p1} lazyload`);
|
||||
})
|
||||
str = str.replace(p2, `${bg}`)
|
||||
return str.replace('>', ` data-src="${p2}">`);
|
||||
}
|
||||
str = str.replace(p2, `${bg}`)
|
||||
return str.replace(p3, ` class="lazyload" data-src="${p2}" ${p3}`);
|
||||
});
|
||||
}
|
||||
|
||||
var processPost = function(data) {
|
||||
if (!hexo.theme.config.lazyload.enable) return;
|
||||
data.content = lazyProcess.call(this, data.content);
|
||||
return data;
|
||||
};
|
||||
|
||||
hexo.extend.filter.register('after_post_render', processPost);
|
||||
@@ -1,103 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
hexo.extend.helper.register("list_archives", function(options = {}) {
|
||||
const { config } = this;
|
||||
const archiveDir = config.archive_dir;
|
||||
const { timezone } = config;
|
||||
const lang = this.page.lang || this.page.language || config.language;
|
||||
let { format } = options;
|
||||
const type = options.type || "monthly";
|
||||
const { style = "list", transform, separator = ", " } = options;
|
||||
const showCount = Object.prototype.hasOwnProperty.call(options, "show_count")
|
||||
? options.show_count
|
||||
: true;
|
||||
const order = options.order || -1;
|
||||
const limit = 8;
|
||||
let result = "";
|
||||
|
||||
var more_button;
|
||||
if (lang === "zh-CN") {
|
||||
more_button = "查看更多";
|
||||
} else if (lang === "zh-TW") {
|
||||
more_button = "查看更多";
|
||||
} else {
|
||||
more_button = "More";
|
||||
}
|
||||
|
||||
if (!format) {
|
||||
format = type === "monthly" ? "MMMM YYYY" : "YYYY";
|
||||
}
|
||||
|
||||
const posts = this.site.posts.sort("date", order);
|
||||
if (!posts.length) return result;
|
||||
|
||||
const data = [];
|
||||
let length = 0;
|
||||
|
||||
posts.forEach(post => {
|
||||
// Clone the date object to avoid pollution
|
||||
let date = post.date.clone();
|
||||
|
||||
if (timezone) date = date.tz(timezone);
|
||||
if (lang) date = date.locale(lang);
|
||||
|
||||
const year = date.year();
|
||||
const month = date.month() + 1;
|
||||
const name = date.format(format);
|
||||
const lastData = data[length - 1];
|
||||
|
||||
if (!lastData || lastData.name !== name) {
|
||||
length = data.push({
|
||||
name,
|
||||
year,
|
||||
month,
|
||||
count: 1
|
||||
});
|
||||
} else {
|
||||
lastData.count++;
|
||||
}
|
||||
});
|
||||
|
||||
const link = item => {
|
||||
let url = `${archiveDir}/${item.year}/`;
|
||||
|
||||
if (type === "monthly") {
|
||||
if (item.month < 10) url += "0";
|
||||
url += `${item.month}/`;
|
||||
}
|
||||
|
||||
return this.url_for(url);
|
||||
};
|
||||
|
||||
result += `<ul class="archive-list">`;
|
||||
|
||||
for (let i = 0, len = data.length; i < Math.min(len, limit); i++) {
|
||||
const item = data[i];
|
||||
|
||||
result += `<li class="archive-list-item">`;
|
||||
|
||||
result += `<a class="archive-list-link" href="${link(item)}">`;
|
||||
result += `<span class="archive-list-date">`;
|
||||
result += transform ? transform(item.name) : item.name;
|
||||
result += `</span>`;
|
||||
|
||||
if (showCount) {
|
||||
result += `<span class="archive-list-count">${item.count}</span>`;
|
||||
}
|
||||
result += "</a>";
|
||||
result += "</li>";
|
||||
}
|
||||
|
||||
if (data.length > limit) {
|
||||
result += `<li class="archive-list-item is-center">`;
|
||||
result +=
|
||||
`<a class="archive-list-link-more" href="` +
|
||||
"/" +
|
||||
`${archiveDir}" >`;
|
||||
result += more_button;
|
||||
result += "</a>";
|
||||
result += "</li>";
|
||||
}
|
||||
result += "</ul>";
|
||||
return result;
|
||||
});
|
||||
@@ -192,13 +192,10 @@ img:not([src])
|
||||
|
||||
.img-alt
|
||||
margin: -.5rem 0 .5rem
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
color: $font-black
|
||||
|
||||
&:hover
|
||||
text-decoration: none !important
|
||||
>>>>>>> dev
|
||||
|
||||
// hexo tag video
|
||||
.video-container
|
||||
@@ -222,11 +219,7 @@ img:not([src])
|
||||
font-size: 20px
|
||||
|
||||
.post-ad
|
||||
<<<<<<< HEAD
|
||||
margin: 2rem 0 !important
|
||||
=======
|
||||
margin: 2rem 0
|
||||
>>>>>>> dev
|
||||
|
||||
.ad_height
|
||||
display: block !important
|
||||
@@ -239,11 +232,6 @@ img:not([src])
|
||||
#nav
|
||||
animation: nav-effect 1s
|
||||
|
||||
<<<<<<< HEAD
|
||||
// #page-header
|
||||
// animation: header-effect 1s
|
||||
=======
|
||||
>>>>>>> dev
|
||||
#site_title,
|
||||
#site_subtitle
|
||||
animation: titlescale 1s
|
||||
@@ -284,14 +272,10 @@ if hexo-config('avatar.effect') == true
|
||||
animation: tocsidebarRtoL .4s
|
||||
|
||||
.sidebar-toc__progress
|
||||
<<<<<<< HEAD
|
||||
animation: tocsidebarRtoL .7s
|
||||
=======
|
||||
animation: tocsidebarRtoL .6s
|
||||
>>>>>>> dev
|
||||
|
||||
.sidebar-toc__content
|
||||
animation: tocsidebarRtoL .9s
|
||||
animation: tocsidebarRtoL .7s
|
||||
|
||||
@keyframes scroll-down-effect
|
||||
0%
|
||||
@@ -315,21 +299,6 @@ if hexo-config('avatar.effect') == true
|
||||
opacity: 1
|
||||
transform: translateY(0)
|
||||
|
||||
<<<<<<< HEAD
|
||||
@keyframes header-effect
|
||||
0%
|
||||
opacity: 0
|
||||
|
||||
60%
|
||||
opacity: 0
|
||||
transform: translateY(-30px)
|
||||
|
||||
100%
|
||||
opacity: 1
|
||||
transform: translateY(0)
|
||||
|
||||
=======
|
||||
>>>>>>> dev
|
||||
@keyframes headerNoOpacity
|
||||
0%
|
||||
transform: translateY(-50px)
|
||||
|
||||
@@ -246,24 +246,15 @@
|
||||
content: ''
|
||||
|
||||
li
|
||||
<<<<<<< HEAD
|
||||
padding: 1px 10px
|
||||
list-style: none
|
||||
text-align: center
|
||||
=======
|
||||
list-style: none
|
||||
>>>>>>> dev
|
||||
|
||||
&:hover
|
||||
background: $theme-color
|
||||
|
||||
a
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
display: inline-block
|
||||
padding: .3rem .7rem
|
||||
width: 100%
|
||||
>>>>>>> dev
|
||||
color: $font-black
|
||||
text-shadow: none
|
||||
|
||||
@@ -321,13 +312,9 @@
|
||||
|
||||
.post-meta-pv-cv
|
||||
.post-meta__separator:first-child
|
||||
<<<<<<< HEAD
|
||||
display: none
|
||||
=======
|
||||
display: none
|
||||
|
||||
if !hexo-config('busuanzi.page_pv')
|
||||
.post-meta-commentcount
|
||||
.post-meta__separator
|
||||
display: none
|
||||
>>>>>>> dev
|
||||
|
||||
@@ -263,7 +263,6 @@ $(function () {
|
||||
/**
|
||||
* 代碼收縮
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
const $highlightTools = $('.highlight-tools')
|
||||
if (isHighlightShrink === 'true') {
|
||||
$highlightTools.append('<i class="fa fa-angle-down code-expand code-closed" aria-hidden="true"></i>')
|
||||
@@ -271,23 +270,6 @@ $(function () {
|
||||
$highlightTools.append('<i class="fa fa-angle-down code-expand" aria-hidden="true"></i>')
|
||||
}
|
||||
|
||||
$(document).on('click', '.highlight-tools >.code-expand', function () {
|
||||
var $table = $(this).parent().next()
|
||||
if ($(this).hasClass('code-closed')) {
|
||||
$table.css('display', 'block')
|
||||
$(this).removeClass('code-closed')
|
||||
} else {
|
||||
$table.css('display', 'none')
|
||||
$(this).addClass('code-closed')
|
||||
=======
|
||||
const $highlightTools = $('.highlight-tools')
|
||||
if (isHighlightShrink === 'true') {
|
||||
$highlightTools.append('<i class="fa fa-angle-down code-expand code-closed" aria-hidden="true"></i>')
|
||||
} else if (isHighlightShrink === 'false') {
|
||||
$highlightTools.append('<i class="fa fa-angle-down code-expand" aria-hidden="true"></i>')
|
||||
>>>>>>> dev
|
||||
}
|
||||
|
||||
$(document).on('click', '.highlight-tools >.code-expand', function () {
|
||||
var $table = $(this).parent().next()
|
||||
if ($(this).hasClass('code-closed')) {
|
||||
@@ -790,21 +772,5 @@ $(function () {
|
||||
}
|
||||
}
|
||||
})
|
||||
<<<<<<< HEAD
|
||||
})
|
||||
|
||||
function addPhotoFigcaption () {
|
||||
var images = $('#article-container img')
|
||||
images.each(function (i, o) {
|
||||
var $this = $(o)
|
||||
if ($this.attr('alt')) {
|
||||
var t = $('<div class="img-alt is-center">' + $this.attr('alt') + '</div>')
|
||||
$this.after(t)
|
||||
}
|
||||
})
|
||||
}
|
||||
if (GLOBAL_CONFIG.isPhotoFigcaption) addPhotoFigcaption()
|
||||
=======
|
||||
}
|
||||
>>>>>>> dev
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user