1+ {{- if not (.Param "hideFooter") }}
2+ < footer class ="footer ">
3+ {{- if site.Copyright }}
4+ < span > {{ site.Copyright | markdownify }}</ span >
5+ {{- else }}
6+ < span > © {{ now.Year }} < a href ="{{ "" | absURL }}"> {{ site.Title }}</ a > </ span >
7+ {{- end -}}
8+ < span style ="display: inline-block; margin-left: 1em; ">
9+ < a href ="https://creativecommons.org/licenses/by-sa/4.0/ "> CC BY-SA</ a >
10+ </ span >
11+ < span style ="display: inline-block; margin-left: 1em; ">
12+ Powered by
13+ < a href ="https://gohugo.io/ " rel ="noopener noreferrer " target ="_blank "> Hugo</ a > &
14+ < a href ="https://github.com/reorx/hugo-PaperModX/ " rel ="noopener " target ="_blank "> PaperModX</ a >
15+ </ span >
16+ < span style ="display: inline-block; margin-left: 1em; ">
17+ Contact by
18+ < a href ="mailto:kzthisthat@gmail.com "> email</ a >
19+ </ span >
20+ </ footer >
21+ {{- end }}
22+
23+ {{- if (not site.Params.disableScrollToTop) }}
24+ < a href ="#top " aria-label ="go to top " title ="Go to Top (Alt + G) " class ="top-link " id ="top-link " accesskey ="g ">
25+ < svg xmlns ="http://www.w3.org/2000/svg " viewBox ="0 0 12 6 " fill ="currentColor ">
26+ < path d ="M12 6H0l6-6z " />
27+ </ svg >
28+ </ a >
29+ {{- end }}
30+
31+ {{- partial "extend_footer.html" . }}
32+
33+ < script >
34+ ( function ( ) {
35+ /* theme toggle */
36+ const disableThemeToggle = '{{ if site.Params.disableThemeToggle }}1{{ end }}' == '1' ;
37+ if ( disableThemeToggle ) {
38+ return ;
39+ }
40+
41+ let button = document . getElementById ( "theme-toggle" )
42+ // remove the listeners first to prevent adding duplicated listener when history goes back and forth
43+ button . removeEventListener ( 'click' , toggleThemeListener )
44+ // listen to toggle button
45+ button . addEventListener ( 'click' , toggleThemeListener )
46+ } ) ( ) ;
47+ </ script >
48+
49+ < script >
50+ ( function ( ) {
51+ let menu = document . getElementById ( 'menu' )
52+ if ( menu ) {
53+ menu . scrollLeft = localStorage . getItem ( "menu-scroll-position" ) ;
54+ menu . onscroll = function ( ) {
55+ localStorage . setItem ( "menu-scroll-position" , menu . scrollLeft ) ;
56+ }
57+ }
58+
59+ const disableSmoothScroll = '{{- if (.Param "DisableSmoothScroll") -}}1{{- end -}}' == '1' ;
60+ const enableInstantClick = '{{- if (.Param "EnableInstantClick") -}}1{{- end -}}' == '1' ;
61+ // instant click and smooth scroll are mutually exclusive
62+ if ( window . matchMedia ( '(prefers-reduced-motion: reduce)' ) . matches || disableSmoothScroll || enableInstantClick ) {
63+ return ;
64+ }
65+ // only run this code if smooth scroll should be enabled
66+ document . querySelectorAll ( 'a[href^="#"]' ) . forEach ( anchor => {
67+ anchor . addEventListener ( "click" , function ( e ) {
68+ e . preventDefault ( ) ;
69+ var id = this . getAttribute ( "href" ) . substr ( 1 ) ;
70+ document . querySelector ( `[id='${ decodeURIComponent ( id ) } ']` ) . scrollIntoView ( {
71+ behavior : "smooth"
72+ } ) ;
73+ if ( id === "top" ) {
74+ history . replaceState ( null , null , " " ) ;
75+ } else {
76+ history . pushState ( null , null , `#${ id } ` ) ;
77+ }
78+ } ) ;
79+ } ) ;
80+ } ) ( ) ;
81+ </ script >
82+
83+ {{- if (not site.Params.disableScrollToTop) }}
84+ < script >
85+ var mybutton = document . getElementById ( "top-link" ) ;
86+ window . onscroll = function ( ) {
87+ if ( document . body . scrollTop > 800 || document . documentElement . scrollTop > 800 ) {
88+ mybutton . style . visibility = "visible" ;
89+ mybutton . style . opacity = "1" ;
90+ } else {
91+ mybutton . style . visibility = "hidden" ;
92+ mybutton . style . opacity = "0" ;
93+ }
94+ } ;
95+ </ script >
96+ {{- end }}
97+
98+ {{- /* Base64Email */}}
99+ {{- if (.Param "MaskedEmail") }}
100+ < script >
101+ document . querySelectorAll ( '.masked-email' ) . forEach ( ( el ) => {
102+ el . innerText = atob ( el . innerText ) ;
103+ el . classList . remove ( 'masked-email' )
104+ } )
105+ </ script >
106+ {{- end -}}
107+
108+
109+ {{/* Clear ToC Scroll */}}
110+ < script >
111+ if ( window . scrollListeners ) {
112+ // console.log('disable toc scroll', scrollListeners)
113+ for ( const listener of scrollListeners ) {
114+ window . removeEventListener ( 'scroll' , listener )
115+ }
116+ }
117+ window . scrollListeners = [ ]
118+ </ script >
119+
120+ {{/* Load mediumZoom script */}}
121+ {{/* It has to be loaded here because of the data-no-instant attribute */}}
122+ {{- $imagezoom := resources.Get "js/medium-zoom.min.js" }}
123+ < script src ="{{ $imagezoom.RelPermalink }} " data-no-instant
124+ {{- if site.Params.assets.disableFingerprinting }}integrity ="{{ $imagezoom.Data.Integrity }} "{{- end }}
125+ > </ script >
126+
127+ {{- if .IsPage }}
128+ {{- partial "page_footer.html" . }}
129+ {{- end}}
130+
131+ {{- /* Search */}}
132+ {{- if (eq .Layout `search`) -}}
133+ < link crossorigin ="anonymous " rel ="preload " as ="fetch " href ="../index.json ">
134+ {{- $fastsearch := resources.Get "js/fastsearch.js" | js.Build (dict "params" (dict "fuseOpts" site.Params.fuseOpts)) }}
135+ {{- $fusejs := resources.Get "js/fuse.basic.min.js" }}
136+ {{- if not site.Params.assets.disableFingerprinting }}
137+ {{- $search := (slice $fusejs $fastsearch ) | resources.Concat "assets/js/search.js" | minify | fingerprint }}
138+ < script defer crossorigin ="anonymous " src ="{{ $search.RelPermalink }} " integrity ="{{ $search.Data.Integrity }} "> </ script >
139+ {{- else }}
140+ {{- $search := (slice $fusejs $fastsearch ) | resources.Concat "assets/js/search.js" | minify }}
141+ < script defer crossorigin ="anonymous " src ="{{ $search.RelPermalink }} "> </ script >
142+ {{- end }}
143+
144+ {{- else }}
145+
146+ {{- /* InstantClick.js */}}
147+ {{- if (.Param "EnableInstantClick") }}
148+ {{- $instantclick := resources.Get "js/instantclick.js" }}
149+ {{- if hugo.IsProduction }}
150+ {{- $instantclick = minify $instantclick }}
151+ {{- end }}
152+ < script src ="{{ $instantclick.RelPermalink }} " data-no-instant
153+ {{- if site.Params.assets.disableFingerprinting }}integrity ="{{ $instantclick.Data.Integrity }} "{{- end }}
154+ > </ script >
155+ < script data-no-instant >
156+ // http://instantclick.io/scripts
157+ // InstantClick.on('change', function(isInitialLoad) {
158+ // if (isInitialLoad) {
159+ // return;
160+ // }
161+ // });
162+ InstantClick . init ( ) ;
163+ </ script >
164+ {{- end }}
165+
166+ {{- end -}}
0 commit comments