File tree Expand file tree Collapse file tree 4 files changed +32
-31
lines changed Expand file tree Collapse file tree 4 files changed +32
-31
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
{{ with .Site.Params.algolia_docsearch }}
2
2
<!-- scripts for algolia docsearch -->
3
3
{{ end }}
4
+ {{/* sidebar splitter */}}
5
+ <!--script src="https://unpkg.com/split.js/dist/split.min.js"></script-->
6
+ < script src ="/js/split-1.6.0.js " integrity ="sha384-0blL3GqHy6+9fw0cyY2Aoiwg4onHAtslAs4OkqZY7UQBrR65/K4gI+hxLdWDrjpz "> </ script >
7
+ < script >
8
+ let splitInstance = null ;
9
+
10
+ function enableSplitter ( mediaQuery ) {
11
+ if ( mediaQuery . matches ) {
12
+ if ( ! splitInstance ) {
13
+ splitInstance = Split ( [ "#sidebarnav" , "#maindoc" ] , {
14
+ sizes : [ 20 , 80 ] ,
15
+ minSize : 100 ,
16
+ } ) ;
17
+ }
18
+ } else {
19
+ if ( splitInstance ) {
20
+ splitInstance . destroy ( ) ;
21
+ splitInstance = null ;
22
+ }
23
+ }
24
+ }
25
+
26
+ const screenWidthMediaQuery = window . matchMedia ( "(min-width: 768px)" ) ;
27
+
28
+ const eleNav = document . getElementById ( "sidebarnav" ) ;
29
+ if ( eleNav !== null ) {
30
+ enableSplitter ( screenWidthMediaQuery ) ;
31
+ screenWidthMediaQuery . addListener ( enableSplitter ) ;
32
+ }
33
+ </ script >
34
+
4
35
{{/* copy-and-paste helper for codenew shortcode */}}
5
36
{{- if or (.HasShortcode "code_sample") (.HasShortcode "code") (.HasShortcode "codenew") -}}
6
37
{{- $toastrJs := resources.Get "js/toastr-2.1.4.min.js" | minify | fingerprint -}}
Original file line number Diff line number Diff line change 109
109
{{ with .Params.js }}{{ range (split . ",") }}< script src ="{{ (trim . " ") | relURL }}"> </ script > <!-- custom js added -->
110
110
{{ end }}{{ else }}<!-- no custom js detected --> {{ end }}
111
111
112
- <!--for the splitter-->
113
- <!--script src="https://unpkg.com/split.js/dist/split.min.js"></script-->
114
- < script src ="/js/split-1.6.0.js " integrity ="sha384-0blL3GqHy6+9fw0cyY2Aoiwg4onHAtslAs4OkqZY7UQBrR65/K4gI+hxLdWDrjpz "> </ script >
115
-
116
112
{{- $legacyScriptJs := resources.Get "js/legacy-script.js" -}}
117
113
< script src ="{{ $legacyScriptJs.RelPermalink }} "> </ script >
Original file line number Diff line number Diff line change 29
29
{{ $jsBase := resources.Get "js/base.js" }}
30
30
{{ $jsAnchor := resources.Get "js/anchor.js" }}
31
31
{{ $jsNav := resources.Get "js/nav.js" | resources.ExecuteAsTemplate "js/nav.js" .Site.Params }}
32
- {{ $jsSidebarTree := resources.Get "js/sidebar-tree.js" | resources.ExecuteAsTemplate "js/sidebar-tree.js" .Site.Params }}
33
32
{{ $jsSearch := resources.Get "js/search.js" | resources.ExecuteAsTemplate "js/search.js" .Site.Home }}
34
33
{{ if .Site.Params.offlineSearch }}
35
34
{{ $jsSearch = resources.Get "js/offline-search.js" }}
36
35
{{/* Revisit this if / when either of https://github.com/google/docsy/issues/2194 and https://github.com/google/docsy/pull/1512 are closed */}}
37
36
{{ else if .Site.Params.customSearch }}
38
37
{{ $jsSearch = resources.Get "js/custom-search.js" }}
39
38
{{ end }}
40
- {{ $js := (slice $jsBs $jsBase $jsAnchor $jsNav $jsSidebarTree $ jsSearch) | resources.Concat "js/main.js" -}}
39
+ {{ $js := (slice $jsBs $jsBase $jsAnchor $jsNav $jsSearch) | resources.Concat "js/main.js" -}}
41
40
{{ if hugo.IsProduction -}}
42
41
{{ $js := $js | minify | fingerprint -}}
43
42
< script src ="{{ $js.RelPermalink }} " integrity ="{{ $js.Data.Integrity }} " crossorigin ="anonymous "> </ script >
You can’t perform that action at this time.
0 commit comments