(function(compodoc) { var MAX_RESULTS = 15, MAX_DESCRIPTION_SIZE = 500, usePushState = (typeof history.pushState !== 'undefined'), // DOM Elements $body = $('body'), $searchResults, $searchInput, $searchList, $searchTitle, $searchResultsCount, $searchQuery, $mainContainer, $xsMenu; // Throttle search function throttle(fn, wait) { var timeout; return function() { var ctx = this, args = arguments; if (!timeout) { timeout = setTimeout(function() { timeout = undefined; fn.apply(ctx, args); }, wait); } }; } function displayResults(res) { var noResults = res.count == 0; var groups = {}; $searchResults.toggleClass('no-results', noResults); // Clear old results $searchList.empty(); // Display title for research $searchResultsCount.text(res.count); $searchQuery.text(res.query); // Group result by context res.results.forEach(function(res) { var context = res.title.split(' - ')[0]; if (typeof groups[context] === 'undefined') { groups[context] = { results: [res] } } else { groups[context].results.push(res) } }); var sortedGroups = Object.keys(groups).sort(); for (var i = 0; i < sortedGroups.length; i++) { var property = sortedGroups[i]; var $li = $('