jekyll-rtd-theme 1.1.3 → 1.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +76 -30
  4. data/_includes/addons/analytics.liquid +6 -3
  5. data/_includes/addons/github.liquid +19 -4
  6. data/_includes/assets/sw.caches.js +43 -0
  7. data/_includes/class/_breadcrumbs.liquid +28 -0
  8. data/_includes/class/_footer.liquid +38 -0
  9. data/_includes/{toctree.liquid → class/_toctree.liquid} +6 -5
  10. data/_includes/{addons.liquid → class/rst-versions.liquid} +6 -8
  11. data/_includes/class/wy-nav-content.liquid +15 -0
  12. data/_includes/class/wy-nav-side.liquid +18 -0
  13. data/_includes/class/wy-nav-top.liquid +8 -0
  14. data/_includes/extend/list.liquid +2 -2
  15. data/_includes/extend/toctree.liquid +1 -11
  16. data/_includes/extra/footer.html +0 -0
  17. data/_includes/extra/head.html +0 -0
  18. data/_includes/node/links.liquid +24 -0
  19. data/_includes/node/metadata.liquid +21 -0
  20. data/_includes/node/script.extension.liquid +29 -0
  21. data/_includes/node/script.liquid +20 -0
  22. data/_includes/node/script.schema.liquid +27 -0
  23. data/_includes/node/title.liquid +1 -0
  24. data/_includes/reset/defaults.liquid +58 -55
  25. data/_includes/reset/i18n.liquid +1 -31
  26. data/_includes/{extend → reset}/tabs.liquid +0 -0
  27. data/_includes/reset/workdir.liquid +1 -15
  28. data/_includes/shortcodes/danger.liquid +6 -0
  29. data/_includes/shortcodes/mermaid.liquid +1 -0
  30. data/_includes/shortcodes/note.liquid +6 -0
  31. data/_includes/shortcodes/tip.liquid +6 -0
  32. data/_includes/shortcodes/warning.liquid +6 -0
  33. data/_layouts/default.liquid +24 -225
  34. data/_layouts/plugins/compress.liquid +13 -10
  35. data/_layouts/plugins/extension.liquid +32 -22
  36. data/_sass/highlight.scss +214 -0
  37. data/_sass/theme.scss +15 -0
  38. data/assets/404.liquid +1 -1
  39. data/assets/css/{theme.css → theme.min.css} +0 -0
  40. data/assets/js/theme.js +294 -1
  41. data/assets/js/theme.min.js +1 -0
  42. data/assets/robots.liquid +1 -1
  43. data/assets/search.liquid +0 -15
  44. data/assets/sitemap.liquid +1 -1
  45. data/assets/sw.caches.liquid +8 -0
  46. metadata +29 -52
  47. data/_includes/addons/i18n.liquid +0 -13
  48. data/_includes/addons/plugins.liquid +0 -6
  49. data/_includes/album.liquid +0 -7
  50. data/_includes/assets/common.js +0 -62
  51. data/_includes/assets/search.js +0 -76
  52. data/_includes/breadcrumbs.liquid +0 -43
  53. data/_includes/footer.liquid +0 -37
  54. data/_includes/i18n/en.liquid +0 -29
  55. data/_includes/i18n/es.liquid +0 -29
  56. data/_includes/i18n/fr.liquid +0 -29
  57. data/_includes/i18n/it.liquid +0 -29
  58. data/_includes/i18n/ja.liquid +0 -29
  59. data/_includes/i18n/ko.liquid +0 -29
  60. data/_includes/i18n/ru.liquid +0 -29
  61. data/_includes/i18n/sv.liquid +0 -29
  62. data/_includes/i18n/zh-cn.liquid +0 -29
  63. data/_includes/reset/languages.liquid +0 -110
  64. data/_sass/_album.scss +0 -19
  65. data/_sass/_embed.scss +0 -23
  66. data/_sass/fluid.scss +0 -7
  67. data/_sass/jekyll-rtd-theme.scss +0 -128
  68. data/assets/css/rougify/base16.css +0 -1
  69. data/assets/css/rougify/base16.dark.css +0 -1
  70. data/assets/css/rougify/base16.light.css +0 -1
  71. data/assets/css/rougify/base16.monokai.css +0 -1
  72. data/assets/css/rougify/base16.monokai.dark.css +0 -1
  73. data/assets/css/rougify/base16.monokai.light.css +0 -1
  74. data/assets/css/rougify/base16.solarized.css +0 -1
  75. data/assets/css/rougify/base16.solarized.dark.css +0 -1
  76. data/assets/css/rougify/base16.solarized.light.css +0 -1
  77. data/assets/css/rougify/bw.css +0 -1
  78. data/assets/css/rougify/colorful.css +0 -1
  79. data/assets/css/rougify/github.css +0 -1
  80. data/assets/css/rougify/gruvbox.css +0 -1
  81. data/assets/css/rougify/gruvbox.dark.css +0 -1
  82. data/assets/css/rougify/gruvbox.light.css +0 -1
  83. data/assets/css/rougify/igorpro.css +0 -1
  84. data/assets/css/rougify/magritte.css +0 -1
  85. data/assets/css/rougify/molokai.css +0 -1
  86. data/assets/css/rougify/monokai.css +0 -1
  87. data/assets/css/rougify/monokai.sublime.css +0 -1
  88. data/assets/css/rougify/pastie.css +0 -1
  89. data/assets/css/rougify/thankful_eyes.css +0 -1
  90. data/assets/css/rougify/tulip.css +0 -1
  91. data/assets/js/anchor.min.js +0 -9
  92. data/assets/js/html5shiv.min.js +0 -4
@@ -5,14 +5,17 @@ layout: plugins/extension
5
5
  {%- if site.debug.compress == false -%}
6
6
  {{ content }}
7
7
  {%- else -%}
8
- {%- assign blocks = content | split: "<pre" -%}
9
- {%- for block in blocks -%}
10
- {%- assign child_blocks = block | split: "</pre>" -%}
11
- {%- if child_blocks.size == 1 -%}
12
- {{ block | split: " " | join: " " }}
13
- {%- else -%}
14
- {%- comment %} current nested pre not support {% endcomment -%}
15
- <pre{{ child_blocks.first }}</pre> {{ child_blocks.last | split: " " | join: " " -}}
16
- {%- endif -%}
17
- {%- endfor -%}
8
+ {%- if content contains "<pre" -%}
9
+ {%- assign content_blocks = content | split: "<pre" -%}
10
+ {%- for content_block in content_blocks -%}
11
+ {%- if content_block contains "</pre>" -%}
12
+ {%- assign pre_blocks = content_block | split: "</pre>" -%}
13
+ <pre{{ pre_blocks.first }}</pre> {{ pre_blocks.last | split: " " | join: " " -}}
14
+ {%- else -%}
15
+ {{- content_block | split: " " | join: " " -}}
16
+ {%- endif -%}
17
+ {%- endfor -%}
18
+ {%- else -%}
19
+ {{- content | split: " " | join: " " -}}
20
+ {%- endif -%}
18
21
  {%- endif -%}
@@ -1,24 +1,34 @@
1
- {%- assign blocks = content | split: "<pre" -%}
2
- {%- for block in blocks -%}
3
- {%- assign child_blocks = block | split: "</pre>" %}
4
- {%- if child_blocks.size == 1 -%}
5
- {{ block }}
6
- {%- else -%}
7
- {%- comment %} admonitions card {% endcomment -%}
8
- {%- assign admonitions = "note, tip, warning, danger" | split: ", " -%}
9
- {%- comment %} get pre code and type {% endcomment -%}
10
- {%- assign pre_blocks = child_blocks.first | replace_first: ">", "```<temp>```" | split: "```<temp>```" -%}
11
- {%- assign pre_type = pre_blocks.first | replace: '"', '' | replace: " class=language-", "" -%}
1
+ {%- include reset/i18n.liquid -%}
2
+
3
+ {%- assign shortcodes = "mermaid, warning, note, tip, danger" | split: ", " -%}
12
4
 
13
- {%- if admonitions contains pre_type -%}
14
- <div class="admonition {{ pre_type }}">
15
- {%- comment %} title will be translated via ui {% endcomment -%}
16
- <p class="admonition-title" ui="{{ pre_type }}"><span class="progress"></span></p>{{ pre_blocks.last | markdownify | strip_newlines -}}
17
- </div>{{ child_blocks.last -}}
18
- {%- elsif pre_type == "mermaid" -%}
19
- <div class="mermaid">{{ pre_blocks.last }}</div>{{ child_blocks.last }}
20
- {%- else -%}
21
- <pre{{ child_blocks.first }}</pre> {{ child_blocks.last -}}
22
- {%- endif -%}
5
+ {%- if site.debug.extension == false -%}
6
+ {{ content }}
7
+ {%- else -%}
8
+ {%- if content contains "<pre" -%}
9
+ {%- assign content_blocks = content | split: "<pre" -%}
10
+ {%- for content_block in content_blocks -%}
11
+ {%- if content_block contains "</pre>" -%}
12
+ {%- assign pre_blocks = content_block | split: "</pre>" -%}
13
+ {%- if content_block contains ' class="language-' -%}
14
+ {%- comment %} shortcodes: <pre class="language-**"> {% endcomment -%}
15
+ {%- assign custom = content_block | replace_first: ' class="language-', "" | replace_first: '">', "<temp/>" | split: "<temp/>" -%}
16
+ {%- assign lang = custom.first -%}
17
+ {%- assign codes = custom.last | split: "</pre>" | first -%}
18
+ {%- assign others = custom.last | split: "</pre>" | last -%}
19
+ {%- if shortcodes contains lang -%}
20
+ {%- include shortcodes/{{ lang }}.liquid -%} {{- others -}}
21
+ {%- else -%}
22
+ <pre{{ pre_blocks.first }}</pre> {{ pre_blocks.last }}
23
+ {%- endif -%}
24
+ {%- else -%}
25
+ <pre{{ pre_blocks.first }}</pre> {{ pre_blocks.last -}}
26
+ {%- endif -%}
27
+ {%- else -%}
28
+ {{- content_block -}}
29
+ {%- endif -%}
30
+ {%- endfor -%}
31
+ {%- else -%}
32
+ {{- content -}}
23
33
  {%- endif -%}
24
- {%- endfor -%}
34
+ {%- endif -%}
@@ -0,0 +1,214 @@
1
+ .highlight {
2
+ table {
3
+ td {
4
+ padding: 5px;
5
+ }
6
+
7
+ pre {
8
+ margin: 0;
9
+ }
10
+ }
11
+
12
+ .cm {
13
+ color: #999988;
14
+ font-style: italic;
15
+ }
16
+
17
+ .cp {
18
+ color: #999999;
19
+ font-weight: bold;
20
+ }
21
+
22
+ .c1 {
23
+ color: #999988;
24
+ font-style: italic;
25
+ }
26
+
27
+ .cs {
28
+ color: #999999;
29
+ font-weight: bold;
30
+ font-style: italic;
31
+ }
32
+
33
+ .c,
34
+ .ch,
35
+ .cd,
36
+ .cpf {
37
+ color: #999988;
38
+ font-style: italic;
39
+ }
40
+
41
+ .err {
42
+ color: #a61717;
43
+ background-color: #e3d2d2;
44
+ }
45
+
46
+ .gd {
47
+ color: #000000;
48
+ background-color: #ffdddd;
49
+ }
50
+
51
+ .ge {
52
+ color: #000000;
53
+ font-style: italic;
54
+ }
55
+
56
+ .gr {
57
+ color: #aa0000;
58
+ }
59
+
60
+ .gh {
61
+ color: #999999;
62
+ }
63
+
64
+ .gi {
65
+ color: #000000;
66
+ background-color: #ddffdd;
67
+ }
68
+
69
+ .go {
70
+ color: #888888;
71
+ }
72
+
73
+ .gp {
74
+ color: #555555;
75
+ }
76
+
77
+ .gs {
78
+ font-weight: bold;
79
+ }
80
+
81
+ .gu {
82
+ color: #aaaaaa;
83
+ }
84
+
85
+ .gt {
86
+ color: #aa0000;
87
+ }
88
+
89
+ .kc,
90
+ .kd,
91
+ .kn,
92
+ .kp,
93
+ .kr {
94
+ color: #000000;
95
+ font-weight: bold;
96
+ }
97
+
98
+ .kt {
99
+ color: #445588;
100
+ font-weight: bold;
101
+ }
102
+
103
+ .k,
104
+ .kv {
105
+ color: #000000;
106
+ font-weight: bold;
107
+ }
108
+
109
+ .mf,
110
+ .mh,
111
+ .il,
112
+ .mi,
113
+ .mo,
114
+ .m,
115
+ .mb,
116
+ .mx {
117
+ color: #009999;
118
+ }
119
+
120
+ .sb,
121
+ .sc,
122
+ .sd,
123
+ .s2,
124
+ .se,
125
+ .sh,
126
+ .si,
127
+ .sx {
128
+ color: #d14;
129
+ }
130
+
131
+ .sr {
132
+ color: #009926;
133
+ }
134
+
135
+ .s1 {
136
+ color: #d14;
137
+ }
138
+
139
+ .ss {
140
+ color: #990073;
141
+ }
142
+
143
+ .s,
144
+ .sa,
145
+ .dl {
146
+ color: #d14;
147
+ }
148
+
149
+ .na {
150
+ color: #008080;
151
+ }
152
+
153
+ .bp {
154
+ color: #999999;
155
+ }
156
+
157
+ .nb {
158
+ color: #0086b3;
159
+ }
160
+
161
+ .nc {
162
+ color: #445588;
163
+ font-weight: bold;
164
+ }
165
+
166
+ .no {
167
+ color: #008080;
168
+ }
169
+
170
+ .nd {
171
+ color: #3c5d5d;
172
+ font-weight: bold;
173
+ }
174
+
175
+ .ni {
176
+ color: #800080;
177
+ }
178
+
179
+ .ne,
180
+ .nf,
181
+ .fm,
182
+ .nl {
183
+ color: #990000;
184
+ font-weight: bold;
185
+ }
186
+
187
+ .nn {
188
+ color: #555555;
189
+ }
190
+
191
+ .nt {
192
+ color: #000080;
193
+ }
194
+
195
+ .vc,
196
+ .vg,
197
+ .vi,
198
+ .nv,
199
+ .vm {
200
+ color: #008080;
201
+ }
202
+
203
+ .ow,
204
+ .o {
205
+ color: #000000;
206
+ font-weight: bold;
207
+ }
208
+
209
+ .w {
210
+ color: #bbbbbb;
211
+ }
212
+
213
+ background-color: #f8f8f8;
214
+ }
@@ -0,0 +1,15 @@
1
+ @import "highlight";
2
+
3
+ .rst-content {
4
+ a code.literal {
5
+ color: #2980b9;
6
+ }
7
+
8
+ .highlighted-box {
9
+ border: 1px solid #f1c40f;
10
+ }
11
+ }
12
+
13
+ .overflow-x-auto {
14
+ overflow-x: auto;
15
+ }
@@ -5,5 +5,5 @@ permalink: /404.html
5
5
 
6
6
  {%- include reset/i18n.liquid -%}
7
7
 
8
- <h2>{{ __404 }}</h2>
8
+ <h2>404</h2>
9
9
  <p>{{ __not_found }}</p>
File without changes
@@ -1 +1,294 @@
1
- !function(n){var e={};function t(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return n[i].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=n,t.c=e,t.d=function(n,e,i){t.o(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:i})},t.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},t.t=function(n,e){if(1&e&&(n=t(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var i=Object.create(null);if(t.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var o in n)t.d(i,o,function(e){return n[e]}.bind(null,o));return i},t.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,"a",e),e},t.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},t.p="",t(t.s=0)}([function(n,e,t){t(1),n.exports=t(3)},function(n,e,t){(function(){var e="undefined"!=typeof window?window.jQuery:t(2);n.exports.ThemeNav={navBar:null,win:null,winScroll:!1,winResize:!1,linkScroll:!1,winPosition:0,winHeight:null,docHeight:null,isRunning:!1,enable:function(n){var t=this;void 0===n&&(n=!0),t.isRunning||(t.isRunning=!0,e((function(e){t.init(e),t.reset(),t.win.on("hashchange",t.reset),n&&t.win.on("scroll",(function(){t.linkScroll||t.winScroll||(t.winScroll=!0,requestAnimationFrame((function(){t.onScroll()})))})),t.win.on("resize",(function(){t.winResize||(t.winResize=!0,requestAnimationFrame((function(){t.onResize()})))})),t.onResize()})))},enableSticky:function(){this.enable(!0)},init:function(n){n(document);var e=this;this.navBar=n("div.wy-side-scroll:first"),this.win=n(window),n(document).on("click","[data-toggle='wy-nav-top']",(function(){n("[data-toggle='wy-nav-shift']").toggleClass("shift"),n("[data-toggle='rst-versions']").toggleClass("shift")})).on("click",".wy-menu-vertical .current ul li a",(function(){var t=n(this);n("[data-toggle='wy-nav-shift']").removeClass("shift"),n("[data-toggle='rst-versions']").toggleClass("shift"),e.toggleCurrent(t),e.hashChange()})).on("click","[data-toggle='rst-current-version']",(function(){n("[data-toggle='rst-versions']").toggleClass("shift-up")})),n("table.docutils:not(.field-list,.footnote,.citation)").wrap("<div class='wy-table-responsive'></div>"),n("table.docutils.footnote").wrap("<div class='wy-table-responsive footnote'></div>"),n("table.docutils.citation").wrap("<div class='wy-table-responsive citation'></div>"),n(".wy-menu-vertical ul").not(".simple").siblings("a").each((function(){var t=n(this);expand=n('<span class="toctree-expand"></span>'),expand.on("click",(function(n){return e.toggleCurrent(t),n.stopPropagation(),!1})),t.prepend(expand)}))},reset:function(){var n=encodeURI(window.location.hash)||"#";try{var e=$(".wy-menu-vertical"),t=e.find('[href="'+n+'"]');if(0===t.length){var i=$('.document [id="'+n.substring(1)+'"]').closest("div.section");0===(t=e.find('[href="#'+i.attr("id")+'"]')).length&&(t=e.find('[href="#"]'))}t.length>0&&($(".wy-menu-vertical .current").removeClass("current"),t.addClass("current"),t.closest("li.toctree-l1").addClass("current"),t.closest("li.toctree-l1").parent().addClass("current"),t.closest("li.toctree-l1").addClass("current"),t.closest("li.toctree-l2").addClass("current"),t.closest("li.toctree-l3").addClass("current"),t.closest("li.toctree-l4").addClass("current"),t.closest("li.toctree-l5").addClass("current"),t[0].scrollIntoView())}catch(n){console.log("Error expanding nav for anchor",n)}},onScroll:function(){this.winScroll=!1;var n=this.win.scrollTop(),e=n+this.winHeight,t=this.navBar.scrollTop()+(n-this.winPosition);n<0||e>this.docHeight||(this.navBar.scrollTop(t),this.winPosition=n)},onResize:function(){this.winResize=!1,this.winHeight=this.win.height(),this.docHeight=$(document).height()},hashChange:function(){this.linkScroll=!0,this.win.one("hashchange",(function(){this.linkScroll=!1}))},toggleCurrent:function(n){var e=n.closest("li");e.siblings("li.current").removeClass("current"),e.siblings().find("li.current").removeClass("current"),e.find("> ul li.current").removeClass("current"),e.toggleClass("current")}},"undefined"!=typeof window&&(window.SphinxRtdTheme={Navigation:n.exports.ThemeNav,StickyNav:n.exports.ThemeNav}),function(){for(var n=0,e=["ms","moz","webkit","o"],t=0;t<e.length&&!window.requestAnimationFrame;++t)window.requestAnimationFrame=window[e[t]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[e[t]+"CancelAnimationFrame"]||window[e[t]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(e,t){var i=(new Date).getTime(),o=Math.max(0,16-(i-n)),r=window.setTimeout((function(){e(i+o)}),o);return n=i+o,r}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(n){clearTimeout(n)})}()}).call(window)},function(n,e){n.exports=jQuery},function(n,e,t){}]);
1
+ $(document).ready(function () {
2
+ if ("serviceWorker" in navigator) {
3
+ navigator.serviceWorker.register(`${ui.baseurl}/sw.caches.js`);
4
+ } else {
5
+ debug("Service Worker not supported!");
6
+ }
7
+
8
+ function debug() {
9
+ console.debug.apply(console, arguments);
10
+ }
11
+
12
+ function search(data) {
13
+ let text = new URL(location.href).searchParams.get("q");
14
+ let lang = new URL(location.href).searchParams.get("lang") || ui.lang;
15
+
16
+ $("input[name='q']").val(text);
17
+
18
+ let results = [];
19
+ let regexp = new RegExp();
20
+ try {
21
+ regexp = new RegExp(text, "im");
22
+ } catch (e) {
23
+ $(".search").empty();
24
+ $(".search-summary").html(ui.i18n.search_results_not_found);
25
+ $("#search-results h2").html(ui.i18n.search_results);
26
+ return debug(e.message);
27
+ }
28
+
29
+ function slice(content, min, max) {
30
+ return content
31
+ .slice(min, max)
32
+ .replace(
33
+ regexp,
34
+ (match) => `<span class="highlighted">${match}</span>`
35
+ );
36
+ }
37
+ for (page of data) {
38
+ let [title, content] = [null, null];
39
+ try {
40
+ if (page.title) {
41
+ title = page.title.match(regexp);
42
+ } else {
43
+ if (page.url == "/") {
44
+ page.title = ui.title;
45
+ } else {
46
+ page.title = page.url;
47
+ }
48
+ }
49
+ } catch (e) {
50
+ debug(e.message);
51
+ }
52
+ try {
53
+ if (page.content) {
54
+ page.content = $("<div/>").html(page.content).text();
55
+ content = page.content.match(regexp);
56
+ }
57
+ } catch (e) {
58
+ debug(e.message);
59
+ }
60
+ if (title || content) {
61
+ let result = [
62
+ `<a href="${ui.baseurl}${page.url}?highlight=${text}">${page.title}</a>`,
63
+ ];
64
+ if (content) {
65
+ let [min, max] = [content.index - 100, content.index + 100];
66
+ let [prefix, suffix] = ["...", "..."];
67
+
68
+ if (min < 0) {
69
+ prefix = "";
70
+ min = 0;
71
+ }
72
+ if (max > page.content.length) {
73
+ suffix = "";
74
+ max = page.content.length;
75
+ }
76
+ result.push(
77
+ `<p class="context">${prefix}${slice(
78
+ page.content,
79
+ min,
80
+ max
81
+ )}${suffix}</p>`
82
+ );
83
+ }
84
+ results.push(`<li>${result.join("")}</li>`);
85
+ }
86
+ }
87
+ if (results.length > 0 && text.length > 0) {
88
+ $(".search").html(results.join(""));
89
+ $(".search-summary").html(
90
+ ui.i18n.search_results_found.replace("#", results.length)
91
+ );
92
+ } else {
93
+ $(".search").empty();
94
+ $(".search-summary").html(ui.i18n.search_results_not_found);
95
+ }
96
+ $("#search-results h2").html(ui.i18n.search_results);
97
+ }
98
+
99
+ function initialize(name) {
100
+ let link = $(".wy-menu-vertical").find(`[href="${decodeURI(name)}"]`);
101
+ if (link.length > 0) {
102
+ $(".wy-menu-vertical .current").removeClass("current");
103
+ link.addClass("current");
104
+ link.closest("li.toctree-l1").parent().addClass("current");
105
+ link.closest("li.toctree-l1").addClass("current");
106
+ link.closest("li.toctree-l2").addClass("current");
107
+ link.closest("li.toctree-l3").addClass("current");
108
+ link.closest("li.toctree-l4").addClass("current");
109
+ link.closest("li.toctree-l5").addClass("current");
110
+ }
111
+ }
112
+
113
+ function toggleCurrent(link) {
114
+ let closest = link.closest("li");
115
+ closest.siblings("li.current").removeClass("current");
116
+ closest.siblings().find("li.current").removeClass("current");
117
+ closest.find("> ul li.current").removeClass("current");
118
+ closest.toggleClass("current");
119
+ }
120
+
121
+ function toc() {
122
+ $(".wy-menu-vertical li.current")
123
+ .append('<ul class="content-toc"></ul>')
124
+ .html(function () {
125
+ let level = parseInt(this.dataset.level);
126
+ let temp = 0;
127
+ let stack = [$(this).find(".content-toc")];
128
+
129
+ $(".document")
130
+ .find("h2,h3,h4,h5,h6")
131
+ .each(function () {
132
+ let anchor = $("<a/>")
133
+ .addClass("reference internal")
134
+ .text($(this).text())
135
+ .attr("href", `#${this.id}`);
136
+ let tagLevel = parseInt(this.tagName.slice(1)) - 1;
137
+
138
+ if (tagLevel > temp) {
139
+ let parent = stack[0].children("li:last")[0];
140
+ if (parent) {
141
+ stack.unshift($("<ul/>").appendTo(parent));
142
+ }
143
+ } else {
144
+ stack.splice(
145
+ 0,
146
+ Math.min(temp - tagLevel, Math.max(stack.length - 1, 0))
147
+ );
148
+ }
149
+ temp = tagLevel;
150
+
151
+ $("<li/>")
152
+ .addClass(`toctree-l${level + tagLevel}`)
153
+ .append(anchor)
154
+ .appendTo(stack[0]);
155
+ });
156
+ if (!stack[0].html()) {
157
+ stack[0].remove();
158
+ }
159
+ });
160
+ }
161
+
162
+ function set(name, value) {
163
+ return localStorage.setItem(name, value);
164
+ }
165
+
166
+ function get(name) {
167
+ return localStorage.getItem(name) || false;
168
+ }
169
+
170
+ function restore() {
171
+ let scroll = get("scroll");
172
+ let scrollTime = get("scrollTime");
173
+ let scrollHost = get("scrollHost");
174
+
175
+ if (scroll && scrollTime && scrollHost) {
176
+ if (scrollHost == location.host && Date.now() - scrollTime < 6e5) {
177
+ $(".wy-side-scroll").scrollTop(scroll);
178
+ }
179
+ }
180
+ $(".wy-side-scroll").scroll(function () {
181
+ set("scroll", this.scrollTop);
182
+ set("scrollTime", Date.now());
183
+ set("scrollHost", location.host);
184
+ });
185
+ }
186
+
187
+ function highlight() {
188
+ let text = new URL(location.href).searchParams.get("highlight");
189
+ let box = ".highlighted-box";
190
+
191
+ if (text) {
192
+ $(".section")
193
+ .find("*")
194
+ .each(function () {
195
+ try {
196
+ if (this.outerHTML.match(new RegExp(text, "im"))) {
197
+ $(this).addClass("highlighted-box");
198
+ }
199
+ } catch (e) {
200
+ debug(e.message);
201
+ }
202
+ });
203
+ $(".section")
204
+ .find(box)
205
+ .each(function () {
206
+ if ($(this).find(box).length > 0) {
207
+ $(this).removeClass(box);
208
+ }
209
+ });
210
+ }
211
+ }
212
+
213
+ let analytics = new URL(
214
+ `https://rundocs-analytics.glitch.me/collect?v=${ui.version}&lang=${ui.lang}`
215
+ );
216
+ analytics.searchParams.append("user_lang", navigator.language);
217
+ analytics.searchParams.append("host", location.host);
218
+ analytics.searchParams.append("platform", navigator.platform);
219
+ $.getJSON(analytics.toString(), (data) => $("#counter").html(data.count));
220
+
221
+ if (location.pathname == `${ui.baseurl}/search.html`) {
222
+ $.ajax(`${ui.baseurl}/pages.json`)
223
+ .done(search)
224
+ .fail((xhr, message) => debug(message));
225
+ }
226
+ toc();
227
+ initialize(location.pathname);
228
+ restore();
229
+ highlight();
230
+
231
+ /* nested ul */
232
+ $(".wy-menu-vertical ul")
233
+ .siblings("a")
234
+ .each(function () {
235
+ let link = $(this);
236
+ let expand = $('<span class="toctree-expand"></span>');
237
+
238
+ expand.on("click", function (e) {
239
+ e.stopPropagation();
240
+ toggleCurrent(link);
241
+ return false;
242
+ });
243
+ link.prepend(expand);
244
+ });
245
+
246
+ /* bind */
247
+ $(document).on("click", '[data-toggle="wy-nav-top"]', function () {
248
+ $('[data-toggle="wy-nav-shift"]').toggleClass("shift");
249
+ $('[data-toggle="rst-versions"]').toggleClass("shift");
250
+ });
251
+ $(document).on("click", ".wy-menu-vertical .current ul li a", function () {
252
+ $('[data-toggle="wy-nav-shift"]').removeClass("shift");
253
+ $('[data-toggle="rst-versions"]').toggleClass("shift");
254
+ toggleCurrent($(this));
255
+ });
256
+ $(document).on("scroll", function () {
257
+ let start = $(this).scrollTop() + 5;
258
+ let items = [];
259
+
260
+ $(".document")
261
+ .find("h1,h2,h3,h4,h5,h6")
262
+ .each(function () {
263
+ items.push({
264
+ offset: $(this).offset().top,
265
+ id: this.id,
266
+ level: parseInt(this.tagName.slice(1)),
267
+ });
268
+ });
269
+ for (let i = 0; i < items.length; i++) {
270
+ if (start > items[i].offset) {
271
+ if (i < items.length - 1) {
272
+ if (start < items[i + 1].offset) {
273
+ if (items[i].level == 1) {
274
+ initialize(location.pathname);
275
+ } else {
276
+ initialize("#" + items[i].id);
277
+ }
278
+ }
279
+ } else {
280
+ initialize("#" + items[i].id);
281
+ }
282
+ }
283
+ }
284
+ });
285
+ $(document).on("click", '[data-toggle="rst-current-version"]', function () {
286
+ $('[data-toggle="rst-versions"]').toggleClass("shift-up");
287
+ });
288
+ $(window).bind("resize", function () {
289
+ requestAnimationFrame(function () {});
290
+ });
291
+ $(window).bind("hashchange", () =>
292
+ initialize(location.hash || location.pathname)
293
+ );
294
+ });