Apply PIE to nghttpx
[platform/upstream/nghttp2.git] / doc / _themes / sphinx_rtd_theme / static / js / theme.js
1 require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"sphinx-rtd-theme":[function(require,module,exports){
2 var jQuery = (typeof(window) != 'undefined') ? window.jQuery : require('jquery');
3
4 // Sphinx theme nav state
5 function ThemeNav () {
6
7     var nav = {
8         navBar: null,
9         win: null,
10         winScroll: false,
11         winResize: false,
12         linkScroll: false,
13         winPosition: 0,
14         winHeight: null,
15         docHeight: null,
16         isRunning: false
17     };
18
19     nav.enable = function () {
20         var self = this;
21
22         if (!self.isRunning) {
23             self.isRunning = true;
24             jQuery(function ($) {
25                 self.init($);
26
27                 self.reset();
28                 self.win.on('hashchange', self.reset);
29
30                 // Set scroll monitor
31                 self.win.on('scroll', function () {
32                     if (!self.linkScroll) {
33                         self.winScroll = true;
34                     }
35                 });
36                 setInterval(function () { if (self.winScroll) self.onScroll(); }, 25);
37
38                 // Set resize monitor
39                 self.win.on('resize', function () {
40                     self.winResize = true;
41                 });
42                 setInterval(function () { if (self.winResize) self.onResize(); }, 25);
43                 self.onResize();
44             });
45         };
46     };
47
48     nav.init = function ($) {
49         var doc = $(document),
50             self = this;
51
52         this.navBar = $('div.wy-side-scroll:first');
53         this.win = $(window);
54
55         // Set up javascript UX bits
56         $(document)
57             // Shift nav in mobile when clicking the menu.
58             .on('click', "[data-toggle='wy-nav-top']", function() {
59                 $("[data-toggle='wy-nav-shift']").toggleClass("shift");
60                 $("[data-toggle='rst-versions']").toggleClass("shift");
61             })
62
63             // Nav menu link click operations
64             .on('click', ".wy-menu-vertical .current ul li a", function() {
65                 var target = $(this);
66                 // Close menu when you click a link.
67                 $("[data-toggle='wy-nav-shift']").removeClass("shift");
68                 $("[data-toggle='rst-versions']").toggleClass("shift");
69                 // Handle dynamic display of l3 and l4 nav lists
70                 self.toggleCurrent(target);
71                 self.hashChange();
72             })
73             .on('click', "[data-toggle='rst-current-version']", function() {
74                 $("[data-toggle='rst-versions']").toggleClass("shift-up");
75             })
76
77         // Make tables responsive
78         $("table.docutils:not(.field-list)")
79             .wrap("<div class='wy-table-responsive'></div>");
80
81         // Add expand links to all parents of nested ul
82         $('.wy-menu-vertical ul').not('.simple').siblings('a').each(function () {
83             var link = $(this);
84                 expand = $('<span class="toctree-expand"></span>');
85             expand.on('click', function (ev) {
86                 self.toggleCurrent(link);
87                 ev.stopPropagation();
88                 return false;
89             });
90             link.prepend(expand);
91         });
92     };
93
94     nav.reset = function () {
95         // Get anchor from URL and open up nested nav
96         var anchor = encodeURI(window.location.hash);
97         if (anchor) {
98             try {
99                 var link = $('.wy-menu-vertical')
100                     .find('[href="' + anchor + '"]');
101                 $('.wy-menu-vertical li.toctree-l1 li.current')
102                     .removeClass('current');
103                 link.closest('li.toctree-l2').addClass('current');
104                 link.closest('li.toctree-l3').addClass('current');
105                 link.closest('li.toctree-l4').addClass('current');
106             }
107             catch (err) {
108                 console.log("Error expanding nav for anchor", err);
109             }
110         }
111     };
112
113     nav.onScroll = function () {
114         this.winScroll = false;
115         var newWinPosition = this.win.scrollTop(),
116             winBottom = newWinPosition + this.winHeight,
117             navPosition = this.navBar.scrollTop(),
118             newNavPosition = navPosition + (newWinPosition - this.winPosition);
119         if (newWinPosition < 0 || winBottom > this.docHeight) {
120             return;
121         }
122         this.navBar.scrollTop(newNavPosition);
123         this.winPosition = newWinPosition;
124     };
125
126     nav.onResize = function () {
127         this.winResize = false;
128         this.winHeight = this.win.height();
129         this.docHeight = $(document).height();
130     };
131
132     nav.hashChange = function () {
133         this.linkScroll = true;
134         this.win.one('hashchange', function () {
135             this.linkScroll = false;
136         });
137     };
138
139     nav.toggleCurrent = function (elem) {
140         var parent_li = elem.closest('li');
141         parent_li.siblings('li.current').removeClass('current');
142         parent_li.siblings().find('li.current').removeClass('current');
143         parent_li.find('> ul li.current').removeClass('current');
144         parent_li.toggleClass('current');
145     }
146
147     return nav;
148 };
149
150 module.exports.ThemeNav = ThemeNav();
151
152 if (typeof(window) != 'undefined') {
153     window.SphinxRtdTheme = { StickyNav: module.exports.ThemeNav };
154 }
155
156 },{"jquery":"jquery"}]},{},["sphinx-rtd-theme"]);