Skip to content

Commit 10b8b13

Browse files
jaquesgroblerGaelVaroquaux
authored andcommitted
small bug fix and colour tweak
1 parent 271f06d commit 10b8b13

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

doc/index.rst

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,34 +109,49 @@
109109
}
110110
shuffle ($('#banner a.external'));
111111

112+
function preload_images() {
113+
var img = new Image();
114+
img.src="_static/plusBox.png";
115+
img.src="_static/minBox.png";
116+
img.src="_static/plusBoxHighlight.png";
117+
img.src="_static/plusBoxHighlight.png";
118+
img.src="_static/noneBox.png";
119+
}
120+
preload_images();
121+
112122
//Function to make the index toctree collapsible
113123
$(function () {
114124
$('.toctree-l2')
115125
.click(function(event){
116126
if (this == event.target) {
117-
$(this).css('list-style-image',
127+
if ($(this).children('ul').length > 0) {
128+
$(this).css('list-style-image',
118129
(!$(this).children('ul').is(':hidden')) ? 'url(http://github.com/_static/plusBox.png)' : 'url(http://github.com/_static/minBox.png)');
119-
$(this).children('ul').toggle();
130+
$(this).children('ul').slideToggle(200);
120131
}
121132
return true; //Makes links clickable
122-
})
123-
.mousedown(function(event){ return false; }) //Firefox highlighting fix
124-
.css({cursor:'pointer', 'list-style-image':'url(http://github.com/_static/plusBox.png)'})
125-
.children('ul').hide();
133+
}
134+
})
135+
.mousedown(function(event){ return false; }) //Firefox highlighting fix
136+
.css({cursor:'pointer', 'list-style-image':'url(http://github.com/_static/plusBox.png)'})
137+
.children('ul').hide();
126138
$('ul li ul li:not(:has(ul))').css({cursor:'default', 'list-style-image':'url(http://github.com/_static/noneBox.png)'});
127139
$('.toctree-l3').css({cursor:'default', 'list-style-image':'url(http://github.com/_static/noneBox.png)'});
128-
var sidebarbutton = $('#sidebarbutton');
129-
sidebarbutton.css({
130-
'display': 'none'
131-
});
140+
var sidebarbutton = $('#sidebarbutton');
141+
sidebarbutton.css({
142+
'display': 'none'
143+
});
132144

133145
$('.toctree-l2').hover(
134146
function () {
135-
$(this).css('background-color', '#D0D0D0').children('ul').css('background-color', '#F0F0F0');
136147
if ($(this).children('ul').length > 0) {
148+
$(this).css('background-color', '#D0D0D0').children('ul').css('background-color', '#F0F0F0');
137149
$(this).css('list-style-image',
138150
(!$(this).children('ul').is(':hidden')) ? 'url(http://github.com/_static/minBoxHighlight.png)' : 'url(http://github.com/_static/plusBoxHighlight.png)');
139151
}
152+
else {
153+
$(this).css('background-color', '#F9F9F9');
154+
}
140155
},
141156
function () {
142157
$(this).css('background-color', 'white').children('ul').css('background-color', 'white');

0 commit comments

Comments
 (0)