Skip to content

Instantly share code, notes, and snippets.

@jpouellet
Created October 30, 2014 08:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpouellet/17f10488161124fd13e8 to your computer and use it in GitHub Desktop.
Save jpouellet/17f10488161124fd13e8 to your computer and use it in GitHub Desktop.
Allows POSIX documentation to be searched as a "Search Engine" in Chromium / Google Chrome.
<!DOCTYPE html>
<html>
<head>
<title>POSIX search wrapper</title>
<meta name="description" content="because Chrome search engines can't use POST requests" />
<script type="text/javascript">
window.addEventListener('load', function() {
document.getElementsByTagName('span')[0].textContent = window.location + '#%s';
var query = window.location.hash.substr(1);
if (query.length > 0) {
document.getElementsByTagName('input')[0].value = query;
document.getElementsByTagName('form')[0].submit();
} else
document.getElementsByTagName('body')[0].style.display = 'block';
}, false);
</script>
<style type="text/css">
body {
display: none;
}
p {
-webkit-user-select: none;
user-select: none;
}
span {
font-family: monospace;
-webkit-user-select: all;
user-select: all;
}
</style>
</head>
<body>
<form action="http://pubs.opengroup.org/cgi/kman4.cgi" method="POST">
<label>Search <a href="https://en.wikipedia.org/wiki/POSIX">POSIX</a>: <input type="text" name="value" /></label>
</form>
<p>To add as search engine, use <span></span>.</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment