Modified search.js

Alex Finch <[email protected]>
Newsgroups gmane.text.doxygen.general
Organization Lancaster University
Message-ID <[email protected]>
Further to my earlier post "Extending syntax of external searches." I have also modified the file templates/html/extsearch.js to 
modify the format of the output of the search . Again I am posting it here in the hope someone finds it useful.


In "function(data)" :


r+='<tr class="searchresult">'+
            '<td align="right">'+(data.first+i+1)+'.</td>'+
            '<td>  (<span style="font-style:italic;"> <a href="'+escapeHtml(prefix)+'">'+escapeHtml(item.tag)+'</a></span>) 
'+escapeHtml(item.type)+'&#160;'+
                 '<a href="'+escapeHtml(prefix+item.url)+
                 '">'+escapeHtml(item.name)+'</a>';

For each item I include a hyperlink to the top of the package from which the item was found.


and I added a "fail()" method to give a response when doxysearch.cgi returns an error, for example if the wildcard search exceeds 
its limit:

  } else {
       results.html('<p>'+searchResultsText[0]+'</p>');
     }
   })
   .fail(
           function(jqXHR, textStatus, errorThrown){
                   var results = $('#searchresults');
                   var response=jqXHR.responseText;
                   response = response.replace('(','');
                   response = response.replace(')','');
                   results.html('<h1> Your Search Failed</h1> ');
                   var error = JSON.parse(response);
                   results.append(escapeHtml(error.error));
       }
   );
}



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.