|
395 | 395 | if (window.location.pathname == dst.pathname) {
|
396 | 396 | $('#search').addClass('hidden');
|
397 | 397 | $('#main').removeClass('hidden');
|
| 398 | + document.location.href = dst.href; |
398 | 399 | }
|
399 |
| - document.location.href = dst.href; |
400 | 400 | }).on('mouseover', function() {
|
401 | 401 | var $el = $(this);
|
402 | 402 | clearTimeout(hoverTimeout);
|
|
451 | 451 | shown = [];
|
452 | 452 |
|
453 | 453 | results.forEach(function(item) {
|
454 |
| - var name, type; |
| 454 | + var name, type, href, displayPath; |
455 | 455 |
|
456 | 456 | if (shown.indexOf(item) !== -1) {
|
457 | 457 | return;
|
|
461 | 461 | name = item.name;
|
462 | 462 | type = itemTypes[item.ty];
|
463 | 463 |
|
464 |
| - output += '<tr class="' + type + ' result"><td>'; |
465 |
| - |
466 | 464 | if (type === 'mod') {
|
467 |
| - output += item.path + |
468 |
| - '::<a href="' + rootPath + |
469 |
| - item.path.replace(/::/g, '/') + '/' + |
470 |
| - name + '/index.html" class="' + |
471 |
| - type + '">' + name + '</a>'; |
| 465 | + displayPath = item.path + '::'; |
| 466 | + href = rootPath + item.path.replace(/::/g, '/') + '/' + |
| 467 | + name + '/index.html'; |
472 | 468 | } else if (type === 'static' || type === 'reexport') {
|
473 |
| - output += item.path + |
474 |
| - '::<a href="' + rootPath + |
475 |
| - item.path.replace(/::/g, '/') + |
476 |
| - '/index.html" class="' + type + |
477 |
| - '">' + name + '</a>'; |
| 469 | + displayPath = item.path + '::'; |
| 470 | + href = rootPath + item.path.replace(/::/g, '/') + |
| 471 | + '/index.html'; |
478 | 472 | } else if (item.parent !== undefined) {
|
479 | 473 | var myparent = item.parent;
|
480 | 474 | var anchor = '#' + type + '.' + name;
|
481 |
| - output += item.path + '::' + myparent.name + |
482 |
| - '::<a href="' + rootPath + |
483 |
| - item.path.replace(/::/g, '/') + |
484 |
| - '/' + itemTypes[myparent.ty] + |
485 |
| - '.' + myparent.name + |
486 |
| - '.html' + anchor + |
487 |
| - '" class="' + type + |
488 |
| - '">' + name + '</a>'; |
| 475 | + displayPath = item.path + '::' + myparent.name + '::'; |
| 476 | + href = rootPath + item.path.replace(/::/g, '/') + |
| 477 | + '/' + itemTypes[myparent.ty] + |
| 478 | + '.' + myparent.name + |
| 479 | + '.html' + anchor; |
489 | 480 | } else {
|
490 |
| - output += item.path + |
491 |
| - '::<a href="' + rootPath + |
492 |
| - item.path.replace(/::/g, '/') + |
493 |
| - '/' + type + |
494 |
| - '.' + name + |
495 |
| - '.html" class="' + type + |
496 |
| - '">' + name + '</a>'; |
| 481 | + displayPath = item.path + '::'; |
| 482 | + href = rootPath + item.path.replace(/::/g, '/') + |
| 483 | + '/' + type + '.' + name + '.html'; |
497 | 484 | }
|
498 | 485 |
|
499 |
| - output += '</td><td><span class="desc">' + item.desc + |
500 |
| - '</span></td></tr>'; |
| 486 | + output += '<tr class="' + type + ' result"><td>' + |
| 487 | + '<a href="' + href + '">' + |
| 488 | + displayPath + '<span class="' + type + '">' + |
| 489 | + name + '</span></a></td><td>' + |
| 490 | + '<a href="' + href + '">' + |
| 491 | + '<span class="desc">' + item.desc + |
| 492 | + ' </span></a></td></tr>'; |
501 | 493 | });
|
502 | 494 | } else {
|
503 | 495 | output += 'No results :( <a href="https://duckduckgo.com/?q=' +
|
|
0 commit comments