Skip to content

Commit faf891f

Browse files
committed
Updated documentation theme, etc.
1 parent 5b56881 commit faf891f

10 files changed

Lines changed: 2730 additions & 2 deletions

File tree

docs/_static/developers-logo.svg

Lines changed: 2243 additions & 0 deletions
Loading

docs/_static/header.jpg

18.4 KB
Loading

docs/_static/search.png

344 Bytes
Loading

docs/_static/sidebar.js

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
/*
2+
* sidebar.js
3+
* ~~~~~~~~~~
4+
*
5+
* This script makes the Sphinx sidebar collapsible and implements intelligent
6+
* scrolling.
7+
*
8+
* .sphinxsidebar contains .sphinxsidebarwrapper. This script adds in
9+
* .sphixsidebar, after .sphinxsidebarwrapper, the #sidebarbutton used to
10+
* collapse and expand the sidebar.
11+
*
12+
* When the sidebar is collapsed the .sphinxsidebarwrapper is hidden and the
13+
* width of the sidebar and the margin-left of the document are decreased.
14+
* When the sidebar is expanded the opposite happens. This script saves a
15+
* per-browser/per-session cookie used to remember the position of the sidebar
16+
* among the pages. Once the browser is closed the cookie is deleted and the
17+
* position reset to the default (expanded).
18+
*
19+
* :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
20+
* :license: BSD, see LICENSE for details.
21+
*
22+
*/
23+
24+
$(function() {
25+
$.expr[':'].onscreen = function(obj){
26+
obj = jQuery(obj);
27+
return obj.position().top < jQuery(window).height() && obj.position().top < jQuery(window).width();
28+
};
29+
30+
$.expr[':'].offscreen = function(obj){
31+
obj = jQuery(obj);
32+
return obj.position().top > jQuery(window).height() && obj.position().top > jQuery(window).width();
33+
};
34+
35+
// global elements used by the functions.
36+
// the 'sidebarbutton' element is defined as global after its
37+
// creation, in the add_sidebar_button function
38+
var jwindow = $(window);
39+
var jdocument = $(document);
40+
var bodywrapper = $('.bodywrapper');
41+
var sidebar = $('.sphinxsidebar');
42+
var sidebarwrapper = $('.sphinxsidebarwrapper');
43+
44+
// original margin-left of the bodywrapper and width of the sidebar
45+
// with the sidebar expanded
46+
var bw_margin_expanded = bodywrapper.css('margin-left');
47+
var ssb_width_expanded = sidebar.width();
48+
49+
// margin-left of the bodywrapper and width of the sidebar
50+
// with the sidebar collapsed
51+
var bw_margin_collapsed = '.8em';
52+
var ssb_width_collapsed = '.8em';
53+
54+
// colors used by the current theme
55+
var dark_color = '#AAAAAA';
56+
var light_color = '#CCCCCC';
57+
58+
function get_viewport_height() {
59+
if (window.innerHeight)
60+
return window.innerHeight;
61+
else
62+
return jwindow.height();
63+
}
64+
65+
function sidebar_is_collapsed() {
66+
return sidebarwrapper.is(':not(:visible)');
67+
}
68+
69+
function toggle_sidebar() {
70+
if (sidebar_is_collapsed())
71+
expand_sidebar();
72+
else
73+
collapse_sidebar();
74+
// adjust the scrolling of the sidebar
75+
scroll_sidebar();
76+
}
77+
78+
function collapse_sidebar() {
79+
sidebarwrapper.hide();
80+
sidebar.css('width', ssb_width_collapsed);
81+
bodywrapper.css('margin-left', bw_margin_collapsed);
82+
sidebarbutton.css({
83+
'margin-left': '0',
84+
'height': bodywrapper.height(),
85+
'border-radius': '5px'
86+
});
87+
sidebarbutton.find('span').text('»');
88+
sidebarbutton.attr('title', _('Expand sidebar'));
89+
document.cookie = 'sidebar=collapsed';
90+
}
91+
92+
function expand_sidebar() {
93+
bodywrapper.css('margin-left', bw_margin_expanded);
94+
sidebar.css('width', ssb_width_expanded);
95+
sidebarwrapper.show();
96+
sidebarbutton.css({
97+
'margin-left': ssb_width_expanded-12,
98+
'height': bodywrapper.height(),
99+
'border-radius': '0 5px 5px 0'
100+
});
101+
sidebarbutton.find('span').text('«');
102+
sidebarbutton.attr('title', _('Collapse sidebar'));
103+
//sidebarwrapper.css({'padding-top':
104+
// Math.max(window.pageYOffset - sidebarwrapper.offset().top, 10)});
105+
document.cookie = 'sidebar=expanded';
106+
}
107+
108+
function add_sidebar_button() {
109+
sidebarwrapper.css({
110+
'float': 'left',
111+
'margin-right': '0',
112+
'width': ssb_width_expanded - 28
113+
});
114+
// create the button
115+
sidebar.append(
116+
'<div id="sidebarbutton"><span>&laquo;</span></div>'
117+
);
118+
var sidebarbutton = $('#sidebarbutton');
119+
// find the height of the viewport to center the '<<' in the page
120+
var viewport_height = get_viewport_height();
121+
var sidebar_offset = sidebar.offset().top;
122+
var sidebar_height = Math.max(bodywrapper.height(), sidebar.height());
123+
sidebarbutton.find('span').css({
124+
'display': 'block',
125+
'position': 'fixed',
126+
'top': Math.min(viewport_height/2, sidebar_height/2 + sidebar_offset) - 10
127+
});
128+
129+
sidebarbutton.click(toggle_sidebar);
130+
sidebarbutton.attr('title', _('Collapse sidebar'));
131+
sidebarbutton.css({
132+
'border-radius': '0 5px 5px 0',
133+
'color': '#444444',
134+
'background-color': '#CCCCCC',
135+
'font-size': '1.2em',
136+
'cursor': 'pointer',
137+
'height': sidebar_height,
138+
'padding-top': '1px',
139+
'padding-left': '1px',
140+
'margin-left': ssb_width_expanded - 12
141+
});
142+
143+
sidebarbutton.hover(
144+
function () {
145+
$(this).css('background-color', dark_color);
146+
},
147+
function () {
148+
$(this).css('background-color', light_color);
149+
}
150+
);
151+
}
152+
153+
function set_position_from_cookie() {
154+
if (!document.cookie)
155+
return;
156+
var items = document.cookie.split(';');
157+
for(var k=0; k<items.length; k++) {
158+
var key_val = items[k].split('=');
159+
var key = key_val[0];
160+
if (key == 'sidebar') {
161+
var value = key_val[1];
162+
if ((value == 'collapsed') && (!sidebar_is_collapsed()))
163+
collapse_sidebar();
164+
else if ((value == 'expanded') && (sidebar_is_collapsed()))
165+
expand_sidebar();
166+
}
167+
}
168+
}
169+
170+
//add_sidebar_button();
171+
//var sidebarbutton = $('#sidebarbutton');
172+
//set_position_from_cookie();
173+
174+
var original_sidebar_offset = sidebar.position()['top'];
175+
176+
/* intelligent scrolling */
177+
function scroll_sidebar() {
178+
var sidebar_height = sidebarwrapper.height();
179+
var viewport_height = get_viewport_height();
180+
var offset = sidebar.position()['top'];
181+
var wintop = jwindow.scrollTop();
182+
var winbot = wintop + viewport_height;
183+
var curtop = sidebarwrapper.position()['top'];
184+
var curbot = curtop + sidebar_height;
185+
186+
// Is sidebar off the screen?
187+
var is_sliding = (sidebar.css('position') == 'fixed');
188+
189+
if (is_sliding) {
190+
// See if we should stop sliding...
191+
if (wintop < original_sidebar_offset) {
192+
sidebar.css('position', 'relative');
193+
}
194+
} else {
195+
// See if we should start sliding...
196+
if (wintop > offset) {
197+
sidebar.css({
198+
position: 'fixed',
199+
top: '0'
200+
});
201+
}
202+
}
203+
}
204+
jwindow.scroll(scroll_sidebar);
205+
});

docs/_static/sprite-flower.png

17.8 KB
Loading

docs/_static/sprite.png

7.05 KB
Loading

docs/_static/style.css

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)