rockbox/manual/gsearch.js
Dominik Riebeling e9e0cf5908 Manual: add search box to HTML output.
To allow easy searching the HTML (multi page) output add a search box that
queries Google. The Google search will get restricted to the location the
manual is stored. Google seems to happily accept a subfolder when specifying a
domain to search. For this to work the search box has to be created dynamically
with the help of a bit JavaScript.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30017 a1c6a512-1295-4272-9138-f99709370657
2011-06-19 15:43:41 +00:00

11 lines
408 B
JavaScript

function gsearch() {
var expr=/(.*)\/([^/]+)$/;
var loc = expr.exec(window.location)[1];
document.getElementById("gsearch").innerHTML = ''
+ '<form action="http://www.google.com/search">'
+ 'Search this manual '
+ '<input name="as_q" size="30">'
+ '<input value="Google it" type="submit">'
+ '<input type="hidden" name="as_sitesearch" value="' + loc + '">'
+ '</form>';
}