前言

根据BF添加输入页数跳转进行了修改,同时部分扒源自Eurkon,css按需修改即可。

修改pagination.pug

位置如下:Blog\themes\butterfly\layout\includes\pagination.pug

1
2
3
4
5
6
7
8
9
10
11
12
13
14
else
nav#pagination
.pagination
if is_home()
- options.format = 'page/%d/#content-inner'
!=paginator(options)
+ if is_home()
+ input#textnumer(oninput="value=value.replace(/[^0-9]/g,'')" maxlength="3" onkeyup='this.value=this.value.replace(/[^u4e00-u9fa5w]/g,"")')
+ a#textbtn(onclick='textbtn()') 跳转
+ if is_home()
+ .js-css
+ script.
+ function textbtn(){var e=document.querySelectorAll(".page-number"),t=e[e.length-1].innerHTML,n=Number(t),a=document.getElementById("textnumer"),o=Number(a.value);if(""!=o&&!isNaN(o)&&o%1==0)if(1==o)document.getElementById("textbtn").href="/";else if(o>n){var d="/page/"+n+"/";document.getElementById("textbtn").href=d}else d="/page/"+a.value+"/",document.getElementById("textbtn").href=d}
+ style.

引入css文件

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
/* 翻页 */
#pagination {
flex: auto;
width: 100%;
width: 100%;

}

#pagination .page-number.current {
color: var(--white);
background: var(--light-text);
}

#pagination .pagination #textbtn:hover,
#pagination a.page-number:hover,
#pagination a.extend:hover {
color: var(--second);
background: var(--main);
-webkit-box-shadow: var(--main-shadow);
-moz-box-shadow: var(--main-shadow);
-ms-box-shadow: var(--main-shadow);
-o-box-shadow: var(--main-shadow);
box-shadow: var(--main-shadow);
border-color: var(--main);
}

.pagination input {
border-radius: var(--border-radius);
border: var(--card-border);
outline-style: none;
text-align:center;
color: var(--text-highlight-color);
-webkit-transition: all .3s ease-in-out;
-moz-transition: all .3s ease-in-out;
-ms-transition: all .3s ease-in-out;
-o-transition: all .3s ease-in-out;
transition: all .3s ease-in-out;
}

#pagination a.extend.prev {
width: 4.5rem;
float: left;
padding: 0 .8rem 0 .2rem;
border-top-left-radius: 1rem;
border-bottom-left-radius: 1rem;
}

#pagination a.extend.next {
width: 4.5rem;
float: right;
padding: 0 .2rem 0 .8rem;
border-top-right-radius: 1rem;
border-bottom-right-radius: 1rem;
}

#pagination a.extend.prev .pagination-prev {
opacity: 0;
display: inline;
color: var(--second);
margin-right: -2em;
-webkit-transition: all .3s ease-in-out;
-moz-transition: all .3s ease-in-out;
-ms-transition: all .3s ease-in-out;
-o-transition: all .3s ease-in-out;
transition: all .3s ease-in-out;
}

#pagination a.extend.prev:hover .pagination-prev {
opacity: 1;
margin-right: 0;
}

#pagination a.extend.next .pagination-next {
opacity: 0;
display: inline;
color: var(--second);
margin-left: -2em;
-webkit-transition: all .3s ease-in-out;
-moz-transition: all .3s ease-in-out;
-ms-transition: all .3s ease-in-out;
-o-transition: all .3s ease-in-out;
transition: all .3s ease-in-out;
}

#pagination a.extend.next:hover .pagination-next {
opacity: 1;
margin-left: 0;
}


/* 上下一篇文章 */
#pagination.pagination-post {
border-radius: var(--border-radius);
-webkit-transition: all .6s ease-in-out;
-moz-transition: all .6s ease-in-out;
-ms-transition: all .6s ease-in-out;
-o-transition: all .6s ease-in-out;
transition: all .6s ease-in-out;
}


#pagination .prev-post .prev_info,
#pagination .next-post .next_info {
font-size: 1.1rem;
-webkit-transition: all .6s ease-in-out;
-moz-transition: all .6s ease-in-out;
-ms-transition: all .6s ease-in-out;
-o-transition: all .6s ease-in-out;
transition: all .6s ease-in-out;
}

#pagination .prev-post {
border-right: var(--card-border);
}

#pagination .next-post {
border-left: var(--card-border);
}

#pagination .prev-post:hover img,
#pagination .next-post:hover img {
opacity: .1 !important;
}

#pagination .prev-post:hover a,
#pagination .next-post:hover a {
background: var(--main);
color: var(--second);
-webkit-box-shadow: var(--main-shadow);
-moz-box-shadow: var(--main-shadow);
-ms-box-shadow: var(--main-shadow);
-o-box-shadow: var(--main-shadow);
box-shadow: var(--main-shadow);
}