Skip to content

Commit 8a6efc4

Browse files
committed
---
yaml --- r: 83523 b: refs/heads/try c: b93678e h: refs/heads/master i: 83521: 4303ebf 83519: 549ba0e v: v3
1 parent f14cfc9 commit 8a6efc4

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
@@ -2,7 +2,7 @@
22
refs/heads/master: 0e4d1fc8cae42e15e00f71d9f439b01bb25a86ae
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6c08cc2db4f98e9f07ae7d50338396c4123c2f0a
5-
refs/heads/try: a925762c3b1c1f7b3a272b7294c0ec9b4eb4fb6d
5+
refs/heads/try: b93678eca55fc6fcd6bfeb8f97613ebc52bc31a7
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/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/try/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)