哔哔点啥首页轮播

首页轮播需要转存json文件,如果没有设置请参照下方木木的教程进行配置

介绍

首页轮播参照小冰老师叨叨点啥进行修改,使用bber的可以参照本教程,使用叨叨请移步以下链接

安装 hexo-bbds

1
yarn add hexo-bbds --save

安装完成以后修改 config.yml 文件,添加以下代码

1
2
3
4
5
6
7
8
9
10
11
daodao_swiper:
url: https://xxxx.tcb.qcloud.la/json/bber.json # 这里是你的转存的json地址
fliter: "['img','iframe', 'png', 'jpg']" # 将png jpg img等链接过滤
priority: 10
enable: true
enable_page: / # 仅在首页显示
layout:
type: id
name: recent-posts
index: 0
temple_html: '<div class="recent-post-item" style="height: auto;width: 100%"><div class="bbTimeList container" style="height: auto;width: 100%" id="bbTimeList"><i class="bber-gotobb fas fa-bullhorn" onclick="location=&#39;/life/&#39;" title="哔哔点啥"></i><div class="swiper-container" id="bbtalk"><div class="swiper-wrapper" id="bber-talk" onclick="location=&#39;/life/&#39;"></div></div><i class="bber-gotobb fas fa-arrow-circle-right" onclick="location=&quot;/life/&quot;" title="查看全文"></i></div></div>'

如果想要githubcalendar在首页轮播下方,请确保你的插件 hexo-githubcalendar的版本是 1.2.3 低于该版本请升级之后,修改priority的数值比daodao_swiper的小即可

历史上的今天

npm 部署历史上的今天插件

此处使用小冰老师的插件包,更多详细内容请移步小冰老师的插件包
1
2
3
4
5
npm i hexo-history-calendar --save

# 或者

yarn add hexo-history-calendar --save

新增根目录 _config history_calendar 配置项

1
2
3
4
5
6
7
8
9
history_calendar:
priority: 4 # 插件的叠放顺序,数字越大,叠放越靠前
enable: true # 启用插件
enable_page: all # 路由地址,all代表全局开启,/ 代表首页 此处逻辑由location.pathname 所判断
layout: # 挂载在何处
type: class # class 或 id
name: sticky_layout # class name 或 id name
index: 0 # 如果是id 此处省略,如果是 class 表示挂载哪个类标签下
temple_html: '<div class="card-widget card-history"><div class="card-content"><div class="item-headline"><i class="fas fa-clock fa-spin"></i><span>那年今日</span></div><div id="history-baidu" style="height: 100px;overflow: hidden"><div class="history_swiper-container" id="history-container" style="width: 100%;height: 100%"><div class="swiper-wrapper" id="history_container_wrapper" style="height:20px"></div></div></div></div>' # html 模板字段,包括挂载容器

那年今日模板

1
2
3
4
5
6
7
8
9
10
11
12
<div class="card-widget card-history"> <!-- 挂载容器 -->
<div class="card-content">
<div class="item-headline">
<i class="fas fa-clock fa-spin"></i>
<span>那年今日</span>
</div>
<div id="history-baidu" style="height: 100px;overflow: hidden"> <!-- 挂载器 -->
<div class="history_swiper-container" id="history-container" style="width: 100%;height: 100%">
<div class="swiper-wrapper" id="history_container_wrapper" style="height:20px"></div>
</div>
</div>
</div>

文章置顶

npm 部署文章置顶插件

1
2
3
4
5
npm i hexo-swiper-bar-plus --save

# 或者

yarn add hexo-swiper-bar-plus --save

新增根目录 _config swiper 配置项

1
2
3
4
5
6
7
8
9
10
swiper:
enable: true
priority: 2
enable_page: /
layout:
type: id
name: recent-posts
index: 0
temple_html: '<div class="recent-post-item" style="height: auto;width: 100%"><div class="blog-slider swiper-container-fade swiper-container-horizontal" id="swiper_container">${temple_html_item}</div></div>'
plus_style: ""

文章置顶模板

1
2
3
4
<div class="recent-post-item" style="height: auto;width: 100%"><!--文章容器 -->
<div class="blog-slider swiper-container-fade swiper-container-horizontal" id="swiper_container"><!-- swiper容器 -->
${temple_html_item}</div>
</div>

挂载方法

Front-matter 添加以下参数,index 数字越大越靠前显示,默认是拿描述和封面作为置顶的封面

1
2
3
swiper_index: 1
description: ***
cover: ***

github 活跃度

npm 部署插件

此处使用小冰老师的插件包,更多详细内容请移步小冰老师的插件包
1
2
3
4
5
npm i hexo-githubcalendar --save

# 或者

yarn add hexo-githubcalendar --save

新增根目录 _config githubcalendar 配置项

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
githubcalendar:
enable: true
enable_page: /
user: milkdue # github 用户名
layout:
type: id
name: recent-posts
index: 0
githubcalendar_html: '<div class="recent-post-item" style="width:100%;height:auto;padding:10px;"><div id="github_loading" style="width:10%;height:100%;margin:0 auto;display: block"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50" xml:space="preserve"><path fill="#d0d0d0" d="M25.251,6.461c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615V6.461z" transform="rotate(275.098 25 25)"><animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"></animateTransform></path></svg></div><div id="github_container"></div></div>' # 模板页面
pc_minheight: 280px # 电脑端插件的最小高度,减少加载带来的视觉偏移
mobile_minheight: 0px # 手机端插件的最小高度,减少加载带来的视觉偏移
color: "['#ebedf0', '#fdcdec', '#fc9bd9', '#fa6ac5', '#f838b2', '#f5089f', '#c4067e', '#92055e', '#540336', '#48022f', '#30021f']" # 活跃度主题色,具体见下方
api: https://python-github-calendar-api.vercel.app/api # 如果是gitee使用下方api,也可自建api,如何自建请移步小冰原帖
# api: https://python-gitee-calendar-api.vercel.app/api
calendar_js: https://cdn.jsdelivr.net/gh/Zfour/hexo-github-calendar@1.21/hexo_githubcalendar.js # 将 github calendar 挂载入容器中的脚本
plus_style: "" # 提供自定义的style

github 活跃度模板

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<div class="recent-post-item" style="width:100%;height:auto;padding:10px;">
<!--这个是画框,顾名思义就是借用文章样式给加个框-->

<!--这个是loading的样式,可自行调整-->
<div
id="github_loading"
style="width:10%;height:100%;margin:0 auto;display: block"
>
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 50 50"
style="enable-background:new 0 0 50 50"
xml:space="preserve"
>
<path
fill="#d0d0d0"
d="M25.251,6.461c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615V6.461z"
transform="rotate(275.098 25 25)"
>
<animateTransform
attributeType="xml"
attributeName="transform"
type="rotate"
from="0 25 25"
to="360 25 25"
dur="0.6s"
repeatCount="indefinite"
></animateTransform>
</path>
</svg>
</div>

<!--这个是github_containner容器,也就是纸-->
<div id="github_container"></div>
</div>

主题色

1
2
3
4
5
# 以下色调选择喜欢的一行保留即可
color: "['#e4dfd7', '#f9f4dc', '#f7e8aa', '#f7e8aa', '#f8df72', '#fcd217', '#fcc515', '#f28e16', '#fb8b05', '#d85916', '#f43e06']" #橘黄色调
# color: "['#ebedf0', '#fdcdec', '#fc9bd9', '#fa6ac5', '#f838b2', '#f5089f', '#c4067e', '#92055e', '#540336', '#48022f', '#30021f']" #浅紫色调
# color: "['#ebedf0', '#f0fff4', '#dcffe4', '#bef5cb', '#85e89d', '#34d058', '#28a745', '#22863a', '#176f2c', '#165c26', '#144620']" #翠绿色调
# color: "['#ebedf0', '#f1f8ff', '#dbedff', '#c8e1ff', '#79b8ff', '#2188ff', '#0366d6', '#005cc5', '#044289', '#032f62', '#05264c']" #天青色调

旋转的小人

1
2
3
4
5
6
# 在主题配置文件搜索 card_announcement

card_announcement:
enable: true
content: 欢迎来到可以清心的小站...
twopeople: '<div class="twopeople"><div class="container"style="height:200px;"><canvas class="illo"width="800"height="800"style="max-width: 200px; max-height: 200px; touch-action: none; width: 640px; height: 640px;"></canvas></div><script src="https://cdn.jsdelivr.net/combine/npm/hexo-beautiful-page@latest/lib/onepeople.min.js,npm/hexo-beautiful-page@latest/lib/zdog.min.js,npm/hexo-beautiful-page@latest/lib/twopeople.min.js"></script><style>.twopeople{margin:0;align-items:center;justify-content:center;text-align:center}.illo{display:block;margin:0 auto;cursor:url("https://cdn.jsdelivr.net/gh/milkdue/cursors@latest/ori/move.cur"), auto !important;}</style></div>'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!-- 模板 -->
<div class="twopeople">
<div class="container"style="height:200px;">
<canvas class="illo"width="800"height="800"style="max-width: 200px; max-height: 200px; touch-action: none; width: 640px; height: 640px;"></canvas>
</div>
<script src="https://cdn.jsdelivr.net/combine/npm/hexo-beautiful-page@latest/lib/onepeople.min.js,npm/hexo-beautiful-page@latest/lib/zdog.min.js,npm/hexo-beautiful-page@latest/lib/twopeople.min.js"></script>
<style>
.twopeople{
margin:0;
align-items:center;
justify-content:center;
text-align:center
}
.illo{
display:block;
margin:0 auto;
cursor:url("https://cdn.jsdelivr.net/gh/milkdue/cursors@latest/ori/move.cur"), auto !important;
}
</style>
</div>

首页樱花

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
// 新建js文件在inject中的buttom中引入
var stop, staticx;
var img = new Image();
img.src = ".....png"

function Sakura(x, y, s, r, fn) {
this.x = x;
this.y = y;
this.s = s;
this.r = r;
this.fn = fn;
}
Sakura.prototype.draw = function (cxt) {
cxt.save();
var xc = 40 * this.s / 4;
cxt.translate(this.x, this.y);
cxt.rotate(this.r);
cxt.drawImage(img, 0, 0, 40 * this.s, 40 * this.s)
cxt.restore();
}
Sakura.prototype.update = function () {
this.x = this.fn.x(this.x, this.y);
this.y = this.fn.y(this.y, this.y);
this.r = this.fn.r(this.r);
if (this.x > window.innerWidth || this.x < 0 || this.y > window.innerHeight || this.y < 0) {
this.r = getRandom('fnr');
if (Math.random() > 0.4) {
this.x = getRandom('x');
this.y = 0;
this.s = getRandom('s');
this.r = getRandom('r');
} else {
this.x = window.innerWidth;
this.y = getRandom('y');
this.s = getRandom('s');
this.r = getRandom('r');
}
}
}
SakuraList = function () {
this.list = [];
}
SakuraList.prototype.push = function (sakura) {
this.list.push(sakura);
}
SakuraList.prototype.update = function () {
for (var i = 0, len = this.list.length; i < len; i++) {
this.list[i].update();
}
}
SakuraList.prototype.draw = function (cxt) {
for (var i = 0, len = this.list.length; i < len; i++) {
this.list[i].draw(cxt);
}
}
SakuraList.prototype.get = function (i) {
return this.list[i];
}
SakuraList.prototype.size = function () {
return this.list.length;
}

function getRandom(option) {
var ret, random;
switch (option) {
case 'x':
ret = Math.random() * window.innerWidth;
break;
case 'y':
ret = Math.random() * window.innerHeight;
break;
case 's':
ret = Math.random();
break;
case 'r':
ret = Math.random() * 6;
break;
case 'fnx':
random = -0.5 + Math.random() * 1;
ret = function (x, y) {
return x + 0.5 * random - 1.7;
};
break;
case 'fny':
random = 1.5 + Math.random() * 0.7
ret = function (x, y) {
return y + random;
};
break;
case 'fnr':
random = Math.random() * 0.03;
ret = function (r) {
return r + random;
};
break;
}
return ret;
}

function startSakura() {
requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || window.oRequestAnimationFrame;
var canvas = document.createElement('canvas'),
cxt;
staticx = true;
canvas.height = window.innerHeight;
canvas.width = window.innerWidth;
canvas.setAttribute('style', 'position: fixed;left: 0;top: 0;pointer-events: none;');
canvas.setAttribute('id', 'canvas_sakura');
document.getElementsByTagName('body')[0].appendChild(canvas);
cxt = canvas.getContext('2d');
var sakuraList = new SakuraList();
for (var i = 0; i < 50; i++) {
var sakura, randomX, randomY, randomS, randomR, randomFnx, randomFny;
randomX = getRandom('x');
randomY = getRandom('y');
randomR = getRandom('r');
randomS = getRandom('s');
randomFnx = getRandom('fnx');
randomFny = getRandom('fny');
randomFnR = getRandom('fnr');
sakura = new Sakura(randomX, randomY, randomS, randomR, {
x: randomFnx,
y: randomFny,
r: randomFnR
});
sakura.draw(cxt);
sakuraList.push(sakura);
}
stop = requestAnimationFrame(function () {
cxt.clearRect(0, 0, canvas.width, canvas.height);
sakuraList.update();
sakuraList.draw(cxt);
stop = requestAnimationFrame(arguments.callee);
})
}

img.onload = function () {
if(location.pathname === '/'){
startSakura();
}
}

picX 图床

一个简单的图床工具,进入点击使用教程~

Lorem Picsum

utool 插件图床(fileBed)

请安装utools后,插件中心中搜索图床,安装fileBed图床,按照相应配置文件进行配置