MCPcopy
hub / github.com/mongodb/node-mongodb-native / displayNextItem

Function displayNextItem

docs/_static/searchtools.js:409–468  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

407 // print the results
408 var resultCount = results.length;
409 function displayNextItem() {
410 // results left, load the summary and display it
411 if (results.length) {
412 var item = results.pop();
413 var listItem = $('<li style="display:none"></li>');
414 if (DOCUMENTATION_OPTIONS.FILE_SUFFIX === '') {
415 // dirhtml builder
416 var dirname = item[0] + '/';
417 if (dirname.match(/\/index\/$/)) {
418 dirname = dirname.substring(0, dirname.length-6);
419 } else if (dirname == 'index/') {
420 dirname = '';
421 }
422 listItem.append($('<a/>').attr('href',
423 DOCUMENTATION_OPTIONS.URL_ROOT + dirname +
424 highlightstring + item[2]).html(item[1]));
425 } else {
426 // normal html builders
427 listItem.append($('<a/>').attr('href',
428 item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX +
429 highlightstring + item[2]).html(item[1]));
430 }
431 if (item[3]) {
432 listItem.append($('<span> (' + item[3] + ')</span>'));
433 Search.output.append(listItem);
434 listItem.slideDown(5, function() {
435 displayNextItem();
436 });
437 } else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {
438 $.ajax({url: DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' + item[0] + '.txt',
439 dataType: "text",
440 complete: function(jqxhr, textstatus) {
441 var data = jqxhr.responseText;
442 if (data !== '') {
443 listItem.append(Search.makeSearchSummary(data, searchterms, hlterms));
444 }
445 Search.output.append(listItem);
446 listItem.slideDown(5, function() {
447 displayNextItem();
448 });
449 }});
450 } else {
451 // no source available, just display title
452 Search.output.append(listItem);
453 listItem.slideDown(5, function() {
454 displayNextItem();
455 });
456 }
457 }
458 // search finished, update title and status message
459 else {
460 Search.stopPulse();
461 Search.title.text(_('Search Results'));
462 if (!resultCount)
463 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.'));
464 else
465 Search.status.text(_('Search finished, found %s page(s) matching the search query.').replace('%s', resultCount));
466 Search.status.fadeIn(500);

Callers 1

searchtools.jsFile · 0.70

Calls 5

popMethod · 0.80
matchMethod · 0.80
appendMethod · 0.80
_Function · 0.70
$Function · 0.50

Tested by

no test coverage detected