mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-10 21:17:07 +08:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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)
|
||||
|
||||
|
||||
## 截图
|
||||
|
||||
@@ -276,10 +276,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:
|
||||
|
||||
@@ -19,6 +19,7 @@ page:
|
||||
|
||||
sticky: Sticky
|
||||
no_title: No title
|
||||
archives: Archives
|
||||
read_more: Read more
|
||||
|
||||
post:
|
||||
|
||||
@@ -19,6 +19,7 @@ page:
|
||||
|
||||
sticky: Sticky
|
||||
no_title: No title
|
||||
archives: Archives
|
||||
read_more: Read more
|
||||
|
||||
post:
|
||||
|
||||
@@ -19,6 +19,7 @@ page:
|
||||
|
||||
sticky: 置顶
|
||||
no_title: 无题
|
||||
archives: 时间轴
|
||||
read_more: 阅读更多
|
||||
|
||||
post:
|
||||
|
||||
@@ -21,14 +21,11 @@ sticky: 置頂
|
||||
no_title: 無題
|
||||
archives: 時間軸
|
||||
read_more: 閲讀更多
|
||||
created_date: 發表於
|
||||
update_date: 更新於
|
||||
|
||||
post:
|
||||
created: 發表於
|
||||
updated: 更新於
|
||||
wordcount: 字數總計
|
||||
commentcount: 評論數
|
||||
min2read: "閲讀時長: %s 分鐘"
|
||||
page_pv: 閲讀量
|
||||
copyright:
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -10,50 +10,7 @@ if theme.valine && theme.valine.enable
|
||||
});
|
||||
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,6 @@ 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" )
|
||||
|
||||
@@ -5,7 +5,7 @@ each article , index in page.posts.data
|
||||
.post_cover.is_left
|
||||
a(href=url_for(link))
|
||||
- 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'))
|
||||
else
|
||||
@@ -14,7 +14,7 @@ each article , index in page.posts.data
|
||||
.post_cover.is_right
|
||||
a(href=url_for(link))
|
||||
- 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'))
|
||||
else
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
- 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'))
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
})
|
||||
@@ -26,12 +26,12 @@ hexo.extend.helper.register('related_posts', function(currentPost, allPosts){
|
||||
relatedPosts = relatedPosts.sort(compare('weight'));
|
||||
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 +'">';
|
||||
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 lozad" data-src="' + cover + '">';
|
||||
result += '<div class="relatedPosts_title">' + relatedPosts[i].title + '</div>';
|
||||
result += '</a></div>'
|
||||
}; // console.log(relatedPosts);
|
||||
};
|
||||
return result;
|
||||
});
|
||||
hexo.extend.helper.register('echo', function(path){
|
||||
@@ -62,3 +62,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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -242,25 +242,25 @@ $(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");
|
||||
imgList = $("#post-content img").not('.no-fancybox');
|
||||
}
|
||||
|
||||
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);
|
||||
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>");
|
||||
$wrap.after('<div class="img-alt">' + alt + '</div>')
|
||||
}
|
||||
}
|
||||
|
||||
$().fancybox({
|
||||
selector: "[data-fancybox]",
|
||||
loop: true,
|
||||
|
||||
Reference in New Issue
Block a user