aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/html/js/theme.js
diff options
context:
space:
mode:
authornodiscc <nodiscc@gmail.com>2017-01-26 18:52:54 +0100
committernodiscc <nodiscc@gmail.com>2017-06-18 00:19:49 +0200
commit53ed6d7d1e678d7486337ce67a2f17b30bac21ac (patch)
treef8bef0164a70bd03d2b9781951c01bdd018f1842 /doc/html/js/theme.js
parentd5d22a6d07917865c44148ad76f43c65a929a890 (diff)
downloadShaarli-53ed6d7d1e678d7486337ce67a2f17b30bac21ac.tar.gz
Shaarli-53ed6d7d1e678d7486337ce67a2f17b30bac21ac.tar.zst
Shaarli-53ed6d7d1e678d7486337ce67a2f17b30bac21ac.zip
Generate HTML documentation using MkDocs (WIP)
MkDocs is a static site generator geared towards building project documentation. Documentation source files are written in Markdown, and configured with a single YAML file. * http://www.mkdocs.org/ * http://www.mkdocs.org/user-guide/configuration/ Ref. #312 * remove pandoc-generated HTML documentation * move markdown doc to doc/md/, * mkdocs.yml: * generate HTML doc in doc/html * add pages TOC/ordering * use index.md as index page * Makefile: remove execute permissions from generated files * Makefile: rewrite htmlpages GFM to markdown conversion using sed: awk expression aslo matched '][' which causes invalid output on complex links with images or code blocks * Add mkdocs.yml to .gitattributes, exclude this file from release archives * Makefile: rename: htmldoc -> doc_html target * run make doc: pull latest markdown documentation from wiki * run make htmlpages: update html documentation
Diffstat (limited to 'doc/html/js/theme.js')
-rw-r--r--doc/html/js/theme.js82
1 files changed, 82 insertions, 0 deletions
diff --git a/doc/html/js/theme.js b/doc/html/js/theme.js
new file mode 100644
index 00000000..99b146ec
--- /dev/null
+++ b/doc/html/js/theme.js
@@ -0,0 +1,82 @@
1$( document ).ready(function() {
2 // Shift nav in mobile when clicking the menu.
3 $(document).on('click', "[data-toggle='wy-nav-top']", function() {
4 $("[data-toggle='wy-nav-shift']").toggleClass("shift");
5 $("[data-toggle='rst-versions']").toggleClass("shift");
6 });
7
8 // Close menu when you click a link.
9 $(document).on('click', ".wy-menu-vertical .current ul li a", function() {
10 $("[data-toggle='wy-nav-shift']").removeClass("shift");
11 $("[data-toggle='rst-versions']").toggleClass("shift");
12 });
13
14 $(document).on('click', "[data-toggle='rst-current-version']", function() {
15 $("[data-toggle='rst-versions']").toggleClass("shift-up");
16 });
17
18 // Make tables responsive
19 $("table.docutils:not(.field-list)").wrap("<div class='wy-table-responsive'></div>");
20
21 hljs.initHighlightingOnLoad();
22
23 $('table').addClass('docutils');
24});
25
26window.SphinxRtdTheme = (function (jquery) {
27 var stickyNav = (function () {
28 var navBar,
29 win,
30 stickyNavCssClass = 'stickynav',
31 applyStickNav = function () {
32 if (navBar.height() <= win.height()) {
33 navBar.addClass(stickyNavCssClass);
34 } else {
35 navBar.removeClass(stickyNavCssClass);
36 }
37 },
38 enable = function () {
39 applyStickNav();
40 win.on('resize', applyStickNav);
41 },
42 init = function () {
43 navBar = jquery('nav.wy-nav-side:first');
44 win = jquery(window);
45 };
46 jquery(init);
47 return {
48 enable : enable
49 };
50 }());
51 return {
52 StickyNav : stickyNav
53 };
54}($));
55
56// The code below is a copy of @seanmadsen code posted Jan 10, 2017 on issue 803.
57// https://github.com/mkdocs/mkdocs/issues/803
58// This just incorporates the auto scroll into the theme itself without
59// the need for additional custom.js file.
60//
61$(function() {
62 $.fn.isFullyWithinViewport = function(){
63 var viewport = {};
64 viewport.top = $(window).scrollTop();
65 viewport.bottom = viewport.top + $(window).height();
66 var bounds = {};
67 bounds.top = this.offset().top;
68 bounds.bottom = bounds.top + this.outerHeight();
69 return ( ! (
70 (bounds.top <= viewport.top) ||
71 (bounds.bottom >= viewport.bottom)
72 ) );
73 };
74 if( $('li.toctree-l1.current').length && !$('li.toctree-l1.current').isFullyWithinViewport() ) {
75 $('.wy-nav-side')
76 .scrollTop(
77 $('li.toctree-l1.current').offset().top -
78 $('.wy-nav-side').offset().top -
79 60
80 );
81 }
82});