File tree Expand file tree Collapse file tree 7 files changed +35
-32
lines changed
_javascript/modules/components/toc Expand file tree Collapse file tree 7 files changed +35
-32
lines changed Original file line number Diff line number Diff line change @@ -212,8 +212,8 @@ exclude:
212
212
- tools
213
213
- README.md
214
214
- LICENSE
215
- - " *.config. js"
216
- - package*.json
215
+ - " *.js"
216
+ - " package*.json"
217
217
218
218
jekyll-archives :
219
219
enabled : [categories, tags]
Original file line number Diff line number Diff line change 99
99
100
100
<!-- Scripts -->
101
101
102
- {% unless site.theme_mode %}
103
- < script src ="{{ '/assets/js/dist/theme.min.js' | relative_url }} "> </ script >
104
- {% endunless %}
102
+ < script src ="{{ '/assets/js/dist/theme.min.js' | relative_url }} "> </ script >
105
103
106
104
{% include js-selector.html lang=lang %}
107
105
Original file line number Diff line number Diff line change 1
1
<!-- Display GoatCounter pageviews -->
2
2
< script >
3
- let pv = document . getElementById ( 'pageviews' ) ;
3
+ document . addEventListener ( 'DOMContentLoaded' , ( ) => {
4
+ const pv = document . getElementById ( 'pageviews' ) ;
4
5
5
- if ( pv !== null ) {
6
- const uri = location . pathname . replace ( / \/ $ / , '' ) ;
7
- const url = `https://{{ site.analytics.goatcounter.id }}.goatcounter.com/counter/${ encodeURIComponent ( uri ) } .json` ;
6
+ if ( pv !== null ) {
7
+ const uri = location . pathname . replace ( / \/ $ / , '' ) ;
8
+ const url = `https://{{ site.analytics.goatcounter.id }}.goatcounter.com/counter/${ encodeURIComponent ( uri ) } .json` ;
8
9
9
- fetch ( url )
10
- . then ( ( response ) => response . json ( ) )
11
- . then ( ( data ) => {
12
- const count = data . count . replace ( / \s / g, '' ) ;
13
- pv . innerText = new Intl . NumberFormat ( ) . format ( count ) ;
14
- } )
15
- . catch ( ( error ) => {
16
- pv . innerText = '1' ;
17
- } ) ;
18
- }
10
+ fetch ( url )
11
+ . then ( ( response ) => response . json ( ) )
12
+ . then ( ( data ) => {
13
+ const count = data . count . replace ( / \s / g, '' ) ;
14
+ pv . innerText = new Intl . NumberFormat ( ) . format ( count ) ;
15
+ } )
16
+ . catch ( ( error ) => {
17
+ pv . innerText = '1' ;
18
+ } ) ;
19
+ }
20
+ } ) ;
19
21
</ script >
Original file line number Diff line number Diff line change 2
2
3
3
{% if enable_toc %}
4
4
< div class ="toc-border-cover z-3 "> </ div >
5
- < section id ="toc-wrapper " class ="position-sticky ps-0 pe-4 ">
5
+ < section id ="toc-wrapper " class ="invisible position-sticky ps-0 pe-4 pb -4 ">
6
6
< h2 class ="panel-heading ps-3 pb-2 mb-0 "> {{- site.data.locales[include.lang].panel.toc -}}</ h2 >
7
7
< nav id ="toc "> </ nav >
8
8
</ section >
Original file line number Diff line number Diff line change @@ -15,8 +15,11 @@ export class TocDesktop {
15
15
}
16
16
17
17
static init ( ) {
18
- if ( document . getElementById ( 'toc-wrapper' ) ) {
18
+ const $tocWrapper = document . getElementById ( 'toc-wrapper' ) ;
19
+
20
+ if ( $tocWrapper ) {
19
21
tocbot . init ( this . options ) ;
22
+ $tocWrapper . classList . remove ( 'invisible' ) ;
20
23
}
21
24
}
22
25
}
Original file line number Diff line number Diff line change @@ -234,14 +234,11 @@ header {
234
234
@keyframes fade-up {
235
235
from {
236
236
opacity : 0 ;
237
- position : relative ;
238
- top : 2rem ;
237
+ margin-top : 4rem ;
239
238
}
240
239
241
240
to {
242
241
opacity : 1 ;
243
- position : relative ;
244
- top : 0 ;
245
242
}
246
243
}
247
244
@@ -263,7 +260,7 @@ header {
263
260
-webkit-animation : fade- up 0.8s ;
264
261
animation : fade- up 0.8s ;
265
262
overflow-y : auto ;
266
- max-height : calc ( 100vh - 2 rem ) ;
263
+ max-height : 100vh ;
267
264
scrollbar-width : none ;
268
265
margin-top : 2rem ;
269
266
@@ -336,7 +333,7 @@ header {
336
333
position : fixed ;
337
334
bottom : 0 ;
338
335
width : 15% ;
339
- height : 3 .25rem ;
336
+ height : 2 .25rem ;
340
337
margin-left : -1px ;
341
338
background : linear-gradient (transparent , var (--main-bg ) 70% );
342
339
}
Original file line number Diff line number Diff line change @@ -11,11 +11,11 @@ const DIST = 'assets/js/dist';
11
11
const banner = `/*!
12
12
* ${ pkg . name } v${ pkg . version } | © ${ pkg . since } ${ pkg . author } | ${ pkg . license } Licensed | ${ pkg . homepage }
13
13
*/` ;
14
-
15
14
const frontmatter = `---\npermalink: /:basename\n---\n` ;
16
-
17
15
const isProd = process . env . BUILD === 'production' ;
18
16
17
+ let hasWatched = false ;
18
+
19
19
function cleanup ( ) {
20
20
fs . rmSync ( DIST , { recursive : true , force : true } ) ;
21
21
console . log ( `> Directory "${ DIST } " has been cleaned.` ) ;
@@ -39,6 +39,11 @@ function build(
39
39
{ src = SRC_DEFAULT , jekyll = false , outputName = null } = { }
40
40
) {
41
41
const input = `${ src } /${ filename } .js` ;
42
+ const shouldWatch = hasWatched ? false : true ;
43
+
44
+ if ( ! hasWatched ) {
45
+ hasWatched = true ;
46
+ }
42
47
43
48
return {
44
49
input,
@@ -49,9 +54,7 @@ function build(
49
54
banner,
50
55
sourcemap : ! isProd && ! jekyll
51
56
} ,
52
- watch : {
53
- include : input
54
- } ,
57
+ ...( shouldWatch && { watch : { include : `${ SRC_DEFAULT } /**/*.js` } } ) ,
55
58
plugins : [
56
59
babel ( {
57
60
babelHelpers : 'bundled' ,
You can’t perform that action at this time.
0 commit comments