| 429 | // print the results |
| 430 | var resultCount = results.length; |
| 431 | function displayNextItem() { |
| 432 | // results left, load the summary and display it |
| 433 | if (results.length) { |
| 434 | var item = results.pop(); |
| 435 | var listItem = $('<li style="display:none"></li>'); |
| 436 | if (DOCUMENTATION_OPTIONS.FILE_SUFFIX == '') { |
| 437 | // dirhtml builder |
| 438 | var dirname = item[0] + '/'; |
| 439 | if (dirname.match(/\/index\/$/)) { |
| 440 | dirname = dirname.substring(0, dirname.length-6); |
| 441 | } else if (dirname == 'index/') { |
| 442 | dirname = ''; |
| 443 | } |
| 444 | listItem.append($('<a/>').attr('href', |
| 445 | DOCUMENTATION_OPTIONS.URL_ROOT + dirname + |
| 446 | highlightstring + item[2]).html(item[1])); |
| 447 | } else { |
| 448 | // normal html builders |
| 449 | listItem.append($('<a/>').attr('href', |
| 450 | item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX + |
| 451 | highlightstring + item[2]).html(item[1])); |
| 452 | } |
| 453 | if (item[3]) { |
| 454 | listItem.append($('<span> (' + item[3] + ')</span>')); |
| 455 | Search.output.append(listItem); |
| 456 | listItem.slideDown(5, function() { |
| 457 | displayNextItem(); |
| 458 | }); |
| 459 | } else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) { |
| 460 | $.get(DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' + |
| 461 | item[0] + '.txt', function(data) { |
| 462 | if (data != '') { |
| 463 | listItem.append($.makeSearchSummary(data, searchterms, hlterms)); |
| 464 | Search.output.append(listItem); |
| 465 | } |
| 466 | listItem.slideDown(5, function() { |
| 467 | displayNextItem(); |
| 468 | }); |
| 469 | }, "text"); |
| 470 | } else { |
| 471 | // no source available, just display title |
| 472 | Search.output.append(listItem); |
| 473 | listItem.slideDown(5, function() { |
| 474 | displayNextItem(); |
| 475 | }); |
| 476 | } |
| 477 | } |
| 478 | // search finished, update title and status message |
| 479 | else { |
| 480 | Search.stopPulse(); |
| 481 | Search.title.text(_('Search Results')); |
| 482 | if (!resultCount) |
| 483 | Search.status.text(_('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.')); |
| 484 | else |
| 485 | Search.status.text(_('Search finished, found %s page(s) matching the search query.').replace('%s', resultCount)); |
| 486 | Search.status.fadeIn(500); |
| 487 | } |
| 488 | } |