|
39 | 39 | if (e.keyCode === 188 && $('#help').hasClass('hidden')) { // question mark
|
40 | 40 | e.preventDefault();
|
41 | 41 | $('#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 | + } |
45 | 51 | } else if (e.keyCode === 83) { // S
|
46 | 52 | e.preventDefault();
|
47 | 53 | $('.search-input').focus();
|
|
202 | 208 | var hoverTimeout, $results = $('.search-results .result');
|
203 | 209 |
|
204 | 210 | $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; |
206 | 218 | }).on('mouseover', function () {
|
207 | 219 | var $el = $(this);
|
208 | 220 | clearTimeout(hoverTimeout);
|
|
277 | 289 | '/index.html" class="' + type +
|
278 | 290 | '">' + name + '</a>';
|
279 | 291 | } else if (item.parent !== undefined) {
|
280 |
| - console.log(item); |
281 | 292 | var myparent = allPaths[item.parent];
|
282 | 293 | var anchor = '#' + type + '.' + name;
|
283 | 294 | output += item.path + '::' + myparent.name +
|
|
308 | 319 | }
|
309 | 320 |
|
310 | 321 | output += "</p>";
|
311 |
| - $('.content').html(output); |
| 322 | + $('#main.content').addClass('hidden'); |
| 323 | + $('#search.content').removeClass('hidden').html(output); |
312 | 324 | $('.search-results .desc').width($('.content').width() - 40 -
|
313 | 325 | $('.content td:first-child').first().width());
|
314 | 326 | initSearchNav();
|
|
0 commit comments