/* @licstart The following is the entire license notice for the JavaScript code in this file. Copyright (C) 1997-2017 by Dimitri van Heesch This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. @licend The above is the entire license notice for the JavaScript code in this file */ function SearchBox(name, resultsPath, inFrame, label) { this.searchLabel = label; this.DOMSearchField = function() { return document.getElementById("MSearchField"); } this.DOMSearchBox = function() { return document.getElementById("MSearchBox"); } this.OnSearchFieldFocus = function(isActive) { if (isActive) { this.DOMSearchBox().className = 'MSearchBoxActive'; var searchField = this.DOMSearchField(); if (searchField.value == this.searchLabel) { searchField.value = ''; } } else { this.DOMSearchBox().className = 'MSearchBoxInactive'; this.DOMSearchField().value = this.searchLabel; } } } function trim(s) { return s?s.replace(/^\s\s*/, '').replace(/\s\s*$/, ''):''; } function getURLParameter(name) { return decodeURIComponent((new RegExp('[?|&]'+name+ '='+'([^&;]+?)(&|#|;|$)').exec(location.search) ||[,""])[1].replace(/\+/g, '%20'))||null; } var entityMap = { "&": "&", "<": "<", ">": ">", '"': '"', "'": ''', "/": '/' }; function escapeHtml(s) { return String(s).replace(/[&<>"'\/]/g, function (s) { return entityMap[s]; }); } function searchFor(query,page,count) { $.getJSON(serverUrl+"?cb=?", { n:count, p:page, q:query }, function(data) { var results = $('#searchresults'); $('#MSearchField').val(query); if (data.hits>0) { if (data.hits==1) { results.html('
'+searchResultsText[1]+'
'); } else { results.html(''+searchResultsText[2].replace(/\$num/,data.hits)+'
'); } var r=''+(data.first+i+1)+'. | '+ ''+escapeHtml(item.type)+' '+ ''+escapeHtml(item.name)+''; if (item.type=="source") { var l=item.url.match(/[1-9][0-9]*$/); if (l) r+=' at line '+parseInt(l[0]); } r+=' | '; for (var i=0;i'+item.fragments[i]+' |
'+searchResultsText[0]+'
'); } }); } /* @license-end */