summaryrefslogtreecommitdiff
path: root/doc/source/theme/sphinx_rtd_theme/static/js
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2015-02-07 20:54:20 +0100
committermathieui <mathieui@mathieui.net>2015-02-07 21:14:48 +0100
commit61f28d7ffeae0b6a8fd8ca0617e082e2196df622 (patch)
tree293bb9830aa215e415f34bb24c8846cb8d13b3b7 /doc/source/theme/sphinx_rtd_theme/static/js
parentcc91486f8a3619a61e803d990284b040797a1944 (diff)
downloadpoezio-61f28d7ffeae0b6a8fd8ca0617e082e2196df622.tar.gz
poezio-61f28d7ffeae0b6a8fd8ca0617e082e2196df622.tar.bz2
poezio-61f28d7ffeae0b6a8fd8ca0617e082e2196df622.tar.xz
poezio-61f28d7ffeae0b6a8fd8ca0617e082e2196df622.zip
Change the sphinx theme to one derived from readthedocs
(without stuff like the unicode codepoint agressions and external resources) This should be cleaner and look good on mobile devices too.
Diffstat (limited to 'doc/source/theme/sphinx_rtd_theme/static/js')
-rw-r--r--doc/source/theme/sphinx_rtd_theme/static/js/theme.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/doc/source/theme/sphinx_rtd_theme/static/js/theme.js b/doc/source/theme/sphinx_rtd_theme/static/js/theme.js
new file mode 100644
index 00000000..60520cc3
--- /dev/null
+++ b/doc/source/theme/sphinx_rtd_theme/static/js/theme.js
@@ -0,0 +1,47 @@
+$( document ).ready(function() {
+ // Shift nav in mobile when clicking the menu.
+ $(document).on('click', "[data-toggle='wy-nav-top']", function() {
+ $("[data-toggle='wy-nav-shift']").toggleClass("shift");
+ $("[data-toggle='rst-versions']").toggleClass("shift");
+ });
+ // Close menu when you click a link.
+ $(document).on('click', ".wy-menu-vertical .current ul li a", function() {
+ $("[data-toggle='wy-nav-shift']").removeClass("shift");
+ $("[data-toggle='rst-versions']").toggleClass("shift");
+ });
+ $(document).on('click', "[data-toggle='rst-current-version']", function() {
+ $("[data-toggle='rst-versions']").toggleClass("shift-up");
+ });
+ // Make tables responsive
+ $("table.docutils:not(.field-list)").wrap("<div class='wy-table-responsive'></div>");
+});
+
+window.SphinxRtdTheme = (function (jquery) {
+ var stickyNav = (function () {
+ var navBar,
+ win,
+ stickyNavCssClass = 'stickynav',
+ applyStickNav = function () {
+ if (navBar.height() <= win.height()) {
+ navBar.addClass(stickyNavCssClass);
+ } else {
+ navBar.removeClass(stickyNavCssClass);
+ }
+ },
+ enable = function () {
+ applyStickNav();
+ win.on('resize', applyStickNav);
+ },
+ init = function () {
+ navBar = jquery('nav.wy-nav-side:first');
+ win = jquery(window);
+ };
+ jquery(init);
+ return {
+ enable : enable
+ };
+ }());
+ return {
+ StickyNav : stickyNav
+ };
+}($));