jekyll-rtd-theme 1.1.5 → 1.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0fe2af4a55863950ce67d80e629b1b91e87a7381598baf0a39e66d8d577e48b3
4
- data.tar.gz: d7735dedfcf430ab8cbb1d6f4708aa2ae036d4faff449cc8af18b9e4b5d3e4f2
3
+ metadata.gz: e623e1c2a34e05c520de194e2893323851d344c01638700815240352903369f2
4
+ data.tar.gz: e5a5b57710023f64e0767f9e347fbbfe9b39b192975ec4f33293863f9ec6783f
5
5
  SHA512:
6
- metadata.gz: cd1194ed2522bb51043228ca16f92cc44fb79eb4cb5e12806a6f655b2d04a264cc57efa0382ade4e08887dd6729e8ff0f3e23e9979a173b5abe20935f7662067
7
- data.tar.gz: ef92a03c1da2d455219a4f65f3a89d352ecbc4379fe3e24882f14381bb6e5c8d53687a60c0b90370476f63f2761ef6b80622f9fd805601c95409f181a967752a
6
+ metadata.gz: ceed9ba1e1c855a4a38dc5a6a8c78dcdf81922969fd09a450c83443c228f62cf56b2198d516b6452d12c3f1018f2e65e3dc636756f0f8c859e2346b6859eed24
7
+ data.tar.gz: 4fb3d3b40f6588d790326d43b187ddf61b275e96600543aaef84521eeb0cfc0063af8a714771cfbb289fa3396862c4bf4400a2efaf8b8d0c0f81e9036e917543
@@ -1,94 +1,171 @@
1
1
  $(document).ready(function() {
2
- function set(name, value) {
3
- return localStorage.setItem(name, value);
2
+ function initialize(name) {
3
+ let link = $(".wy-menu-vertical").find(`[href="${decodeURI(name)}"]`);
4
+ if (link.length > 0) {
5
+ $(".wy-menu-vertical .current").removeClass("current");
6
+ link.addClass("current");
7
+ link.closest("li.toctree-l1").parent().addClass("current");
8
+ link.closest("li.toctree-l1").addClass("current");
9
+ link.closest("li.toctree-l2").addClass("current");
10
+ link.closest("li.toctree-l3").addClass("current");
11
+ link.closest("li.toctree-l4").addClass("current");
12
+ link.closest("li.toctree-l5").addClass("current");
13
+ }
4
14
  }
5
15
 
6
- function get(name) {
7
- return localStorage.getItem(name) || false;
16
+ function toggleCurrent(link) {
17
+ let closest = link.closest("li");
18
+ closest.siblings("li.current").removeClass("current");
19
+ closest.siblings().find("li.current").removeClass("current");
20
+ closest.find("> ul li.current").removeClass("current");
21
+ closest.toggleClass("current");
8
22
  }
9
23
 
10
- /* anchors */
11
- anchors.add();
12
-
13
- /* generate content TOC (id from anchors) */
14
- $(".wy-menu-vertical li.current").append('<ul class="content-toc"></ul>').html(function() {
15
- let level = parseInt(this.dataset.level);
16
- let temp = 0;
17
- let stack = [$(this).find(".content-toc")];
24
+ function toc() {
25
+ $(".wy-menu-vertical li.current").append('<ul class="content-toc"></ul>').html(function() {
26
+ let level = parseInt(this.dataset.level);
27
+ let temp = 0;
28
+ let stack = [$(this).find(".content-toc")];
18
29
 
19
- $(".document").find("h2,h3,h4,h5,h6").each(function() {
20
- let anchor = $("<a/>").addClass("reference internal").text($(this).text()).attr("href", `#${this.id}`);
21
- let tagLevel = parseInt(this.tagName.slice(1)) - 1;
30
+ $(".document").find("h2,h3,h4,h5,h6").each(function() {
31
+ let anchor = $("<a/>").addClass("reference internal").text($(this).text()).attr("href", `#${this.id}`);
32
+ let tagLevel = parseInt(this.tagName.slice(1)) - 1;
22
33
 
23
- if (tagLevel > temp) {
24
- let parent = stack[0].children("li:last")[0];
25
- if (parent) {
26
- stack.unshift($("<ul/>").appendTo(parent));
34
+ if (tagLevel > temp) {
35
+ let parent = stack[0].children("li:last")[0];
36
+ if (parent) {
37
+ stack.unshift($("<ul/>").appendTo(parent));
38
+ }
39
+ } else {
40
+ stack.splice(0, Math.min(temp - tagLevel, Math.max(stack.length - 1, 0)));
27
41
  }
28
- } else {
29
- stack.splice(0, Math.min(temp - tagLevel, Math.max(stack.length - 1, 0)));
30
- }
31
- temp = tagLevel;
42
+ temp = tagLevel;
32
43
 
33
- $("<li/>").addClass(`toctree-l${level + tagLevel}`).append(anchor).appendTo(stack[0]);
44
+ $("<li/>").addClass(`toctree-l${level + tagLevel}`).append(anchor).appendTo(stack[0]);
45
+ });
46
+ if (!stack[0].html()) {
47
+ stack[0].remove();
48
+ }
34
49
  });
35
- /* if TOC is empty remove ul */
36
- if (!stack[0].html()) {
37
- stack[0].remove();
38
- }
39
- });
50
+ }
40
51
 
41
- /* display current file in TOC */
42
- let link = $(".wy-menu-vertical").find(`[href="${location.pathname}"]`);
43
- if (link.length > 0) {
44
- link.closest("li.toctree-l1").parent().addClass("current");
45
- link.closest("li.toctree-l1").addClass("current");
46
- link.closest("li.toctree-l2").addClass("current");
47
- link.closest("li.toctree-l3").addClass("current");
48
- link.closest("li.toctree-l4").addClass("current");
49
- link.closest("li.toctree-l5").addClass("current");
52
+ function set(name, value) {
53
+ return localStorage.setItem(name, value);
54
+ }
55
+
56
+ function get(name) {
57
+ return localStorage.getItem(name) || false;
50
58
  }
51
59
 
52
- /* restore sidebar scroll within 10 minutes */
53
- let scroll = get("scroll");
54
- let scrollTime = get("scrollTime");
55
- let scrollHost = get("scrollHost");
60
+ function restore() {
61
+ let scroll = get("scroll");
62
+ let scrollTime = get("scrollTime");
63
+ let scrollHost = get("scrollHost");
56
64
 
57
- if (scroll && scrollTime && scrollHost) {
58
- if (scrollHost == location.host && (Date.now() - scrollTime < 6e5)) {
59
- $(".wy-side-scroll").scrollTop(scroll);
65
+ if (scroll && scrollTime && scrollHost) {
66
+ if (scrollHost == location.host && (Date.now() - scrollTime < 6e5)) {
67
+ $(".wy-side-scroll").scrollTop(scroll);
68
+ }
60
69
  }
70
+ $(".wy-side-scroll").scroll(function() {
71
+ set("scroll", this.scrollTop);
72
+ set("scrollTime", Date.now());
73
+ set("scrollHost", location.host);
74
+ });
61
75
  }
62
- $(".wy-side-scroll").scroll(function() {
63
- set("scroll", this.scrollTop);
64
- set("scrollTime", Date.now());
65
- set("scrollHost", location.host);
66
- });
67
76
 
68
- /* native nav */
69
- SphinxRtdTheme.Navigation.enable(true);
77
+ function highlight() {
78
+ let text = new URL(location.href).searchParams.get("highlight");
79
+ let box = ".highlighted-box";
70
80
 
71
- /* search highlight */
72
- let highlight = new URL(location.href).searchParams.get("highlight");
73
- if (highlight) {
74
- $(".section").find("*").each(function() {
75
- try {
76
- if (this.outerHTML.match(new RegExp(highlight, "im"))) {
77
- $(this).addClass("highlighted-box");
81
+ if (text) {
82
+ $(".section").find("*").each(function() {
83
+ try {
84
+ if (this.outerHTML.match(new RegExp(text, "im"))) {
85
+ $(this).addClass("highlighted-box");
86
+ }
87
+ } catch (e) {
88
+ debug(e.message);
78
89
  }
79
- } catch (e) {
80
- debug(e.message);
81
- }
82
- });
83
- $(".section").find(".highlighted-box").each(function() {
84
- if (($(this).find(".highlighted-box").length > 0)) {
85
- $(this).removeClass("highlighted-box");
86
- }
87
- });
90
+ });
91
+ $(".section").find(box).each(function() {
92
+ if (($(this).find(box).length > 0)) {
93
+ $(this).removeClass(box);
94
+ }
95
+ });
96
+ }
88
97
  }
89
98
 
99
+ anchors.add();
100
+ toc();
101
+ initialize(location.pathname);
102
+ restore();
103
+ highlight();
104
+
105
+ /* nested ul */
106
+ $(".wy-menu-vertical ul").siblings("a").each(function() {
107
+ let link = $(this);
108
+ let expand = $('<span class="toctree-expand"></span>');
109
+
110
+ expand.on("click", function(e) {
111
+ e.stopPropagation();
112
+ toggleCurrent(link);
113
+ return false;
114
+ });
115
+ link.prepend(expand);
116
+ });
117
+
90
118
  /* admonition */
91
119
  $(".admonition-title").each(function() {
92
120
  $(this).html(ui.admonition[$(this).attr("ui")]);
93
121
  });
94
- });
122
+
123
+ /* bind */
124
+ $(document).on("click", '[data-toggle="wy-nav-top"]', function() {
125
+ $('[data-toggle="wy-nav-shift"]').toggleClass("shift");
126
+ $('[data-toggle="rst-versions"]').toggleClass("shift");
127
+ });
128
+ $(document).on("click", ".wy-menu-vertical .current ul li a", function() {
129
+ $('[data-toggle="wy-nav-shift"]').removeClass("shift");
130
+ $('[data-toggle="rst-versions"]').toggleClass("shift");
131
+ toggleCurrent($(this));
132
+
133
+ $("html,body").animate({
134
+ scrollTop: $(this.hash).offset().top
135
+ }, 500);
136
+ });
137
+ $(document).on("scroll", function() {
138
+ let start = $(this).scrollTop() + ($(window).height() * 0.382);
139
+ let items = [];
140
+
141
+ $(".document").find("h1,h2,h3,h4,h5,h6").each(function() {
142
+ items.push({
143
+ offset: $(this).offset().top,
144
+ id: this.id,
145
+ level: parseInt(this.tagName.slice(1))
146
+ });
147
+ });
148
+ for (let i = 0; i < items.length; i++) {
149
+ if (start > items[i].offset) {
150
+ if (i < items.length - 1) {
151
+ if (start < items[i + 1].offset) {
152
+ if (items[i].level == 1) {
153
+ initialize(location.pathname);
154
+ } else {
155
+ initialize("#" + items[i].id);
156
+ }
157
+ }
158
+ } else {
159
+ initialize("#" + items[i].id);
160
+ }
161
+ }
162
+ }
163
+ });
164
+ $(document).on("click", '[data-toggle="rst-current-version"]', function() {
165
+ $('[data-toggle="rst-versions"]').toggleClass("shift-up");
166
+ });
167
+ $(window).bind("resize", function() {
168
+ requestAnimationFrame(function() {});
169
+ });
170
+ $(window).bind("hashchange", (e) => initialize(location.hash || location.pathname));
171
+ });
@@ -1,5 +1,5 @@
1
1
  {%- assign description = content | strip_html | split: " " | join: " " | escape | truncate: 150 -%}
2
- {%- assign version = "1.1.5" -%}
2
+ {%- assign version = "1.1.6" -%}
3
3
  {%- assign addons = "github, i18n, plugins, analytics" | split: ", " -%}
4
4
 
5
5
  {%- assign schema_date = page.date | default: site.time | date_to_xmlschema -%}
@@ -62,7 +62,9 @@
62
62
  | replace: '<pre><code class="', '<pre class="notranslate '
63
63
  | replace: "</code></pre>", "</pre>"
64
64
  | replace: '<code class="language-plaintext highlighter-rouge">', '<code class="literal">'
65
- | replace: "<table>", '<table class="docutils align-default">' -%}
65
+ | replace: "<dl>", '<dl class="definition">'
66
+ | replace: "<table>", '<div class="wy-table-responsive"><table class="docutils align-default">'
67
+ | replace: "</table>", '</table></div>' -%}
66
68
 
67
69
  {% comment %} prev and next {% endcomment %}
68
70
  {%- assign workdir_files = site_files | where_exp: "item", "item.dir == page.dir" -%}
@@ -184,7 +184,6 @@ layout: plugins/compress
184
184
  {%- if site.addons %}{% include addons.liquid %}{% endif %}
185
185
  {% include extra/footer.html %}
186
186
  <!-- script -->
187
- <script src="{{ cdn }}/assets/js/theme.js"></script>
188
187
  <script src="{{ cdn }}/assets/js/anchor.min.js"></script>
189
188
 
190
189
  {% comment %} mermaid {% endcomment %}
@@ -80,9 +80,9 @@ footer {
80
80
 
81
81
  .rst-content {
82
82
  /* fixed the long list */
83
+ .mermaid,
83
84
  ol,
84
- ul,
85
- .mermaid {
85
+ ul {
86
86
  overflow-x: auto;
87
87
  }
88
88
  /* fixed link>code */
@@ -125,4 +125,4 @@ footer {
125
125
  .wy-breadcrumbs li.wy-breadcrumbs-aside {
126
126
  display: initial;
127
127
  }
128
- }
128
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-rtd-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - saowang
@@ -121,7 +121,6 @@ files:
121
121
  - assets/js/html5shiv.min.js
122
122
  - assets/js/jquery.min.js
123
123
  - assets/js/mermaid.min.js
124
- - assets/js/theme.js
125
124
  - assets/pages.liquid
126
125
  - assets/robots.liquid
127
126
  - assets/search.liquid
@@ -1 +0,0 @@
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){}]);