Skip to content

Commit 8edb12b

Browse files
committed
---
yaml --- r: 95029 b: refs/heads/dist-snap c: b93678e h: refs/heads/master i: 95027: 1989292 v: v3
1 parent 6ba02de commit 8edb12b

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: a925762c3b1c1f7b3a272b7294c0ec9b4eb4fb6d
9+
refs/heads/dist-snap: b93678eca55fc6fcd6bfeb8f97613ebc52bc31a7
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/librustdoc/html/layout.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ pub fn render<T: fmt::Default, S: fmt::Default>(
6666
</form>
6767
</nav>
6868
69-
<section class=\"content {ty}\">{content}</section>
69+
<section id='main' class=\"content {ty}\">{content}</section>
70+
<section id='search' class=\"content hidden\">{content}</section>
7071
7172
<section class=\"footer\"></section>
7273

branches/dist-snap/src/librustdoc/html/static/main.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,15 @@
3939
if (e.keyCode === 188 && $('#help').hasClass('hidden')) { // question mark
4040
e.preventDefault();
4141
$('#help').removeClass('hidden');
42-
} else if (e.keyCode === 27 && !$('#help').hasClass('hidden')) { // esc
43-
e.preventDefault();
44-
$('#help').addClass('hidden');
42+
} else if (e.keyCode === 27) { // esc
43+
if (!$('#help').hasClass('hidden')) {
44+
e.preventDefault();
45+
$('#help').addClass('hidden');
46+
} else if (!$('#search').hasClass('hidden')) {
47+
e.preventDefault();
48+
$('#search').addClass('hidden');
49+
$('#main').removeClass('hidden');
50+
}
4551
} else if (e.keyCode === 83) { // S
4652
e.preventDefault();
4753
$('.search-input').focus();
@@ -202,7 +208,13 @@
202208
var hoverTimeout, $results = $('.search-results .result');
203209

204210
$results.on('click', function () {
205-
document.location.href = $(this).find('a').prop('href');
211+
var dst = $(this).find('a')[0];
212+
console.log(window.location.pathname, dst.pathname);
213+
if (window.location.pathname == dst.pathname) {
214+
$('#search').addClass('hidden');
215+
$('#main').removeClass('hidden');
216+
}
217+
document.location.href = dst.href;
206218
}).on('mouseover', function () {
207219
var $el = $(this);
208220
clearTimeout(hoverTimeout);
@@ -277,7 +289,6 @@
277289
'/index.html" class="' + type +
278290
'">' + name + '</a>';
279291
} else if (item.parent !== undefined) {
280-
console.log(item);
281292
var myparent = allPaths[item.parent];
282293
var anchor = '#' + type + '.' + name;
283294
output += item.path + '::' + myparent.name +
@@ -308,7 +319,8 @@
308319
}
309320

310321
output += "</p>";
311-
$('.content').html(output);
322+
$('#main.content').addClass('hidden');
323+
$('#search.content').removeClass('hidden').html(output);
312324
$('.search-results .desc').width($('.content').width() - 40 -
313325
$('.content td:first-child').first().width());
314326
initSearchNav();

0 commit comments

Comments
 (0)