I put together a Project Gutenberg/Public Domain book (pg) search for
possible inclusion with DQSD. It might not be too clean, I'm sorta new
to javascript, but I tried ; ). Enjoy.
usage: pg <book title> [/author] [{/reader | /dmoz}]
/author makes it use <book author> instead of title. Can be used with
/reader.
/reader searches through the PG books with pgreader.org
/dmoz searches through the PG books with the open directory project
listing and is usually the most reliable but may be outdated.
As I commented in the source there's another potentially useful PG
search which appears to hold all formats (PDF, HTML, .pbd, .lit, and
plaintext) of (possibly) all texts which is at
http://ns2.tecriture.com/cgi-bin/ebi_search.cgi?action=search but the
search form there seems to rely on a broken line of javascript which I'm
not familiar with and the search fails in all the browsers I have tried
(Moz, IE6, Opera, links).
Also, Wish I could've gotten some background before posting so I'd know
that I'm doing this right but the archive for this list seems to be
having trouble.
Thad Kerosky
<search function="pg">
<name>Project Gutenberg</name>
<description>
Search the Project Gutenberg Public Domain online book collection.<br/>
<div class="helpboxDescLabels">Usage:</div>
<table class="helpboxDescTable">
<tr><td>pg <<i>book title</i>> [/author] [{/reader | /dmoz}]</td></tr>
</table>
<div class="helpboxDescLabels">Switches:</div>
<table class="helpboxDescTable">
<tr><td>/author</td><td> - </td><td>Search for an Author instead of a Title</td></tr>
<tr><td>/reader</td><td> - </td><td>Search for Public Domain books on the more friendly but less complete <a href="http://www.pgreader.org">pgreader.org</a>.<br />
HTML formatted version of some books are also offered here.</td></tr>
<tr><td>/dmoz</td><td> - </td><td>Search through the Project Gutenberg book titles and authors on the Open Directory Project. The author switch is ignored. It seems to be faster and more accurate than the official search sometimes.</td></tr>
</table>
<div class="helpboxDescLabels">Examples:</div>
<table class="helpboxDescTable">
<tr><td>pg Alice In Wonderland</td></tr>
<tr><td>pg Dostoevsky /author</td></tr>
<tr><td>pg Sun Tzu /author /reader</td></tr>
<tr><td>pg Man in the Iron Mask /reader</td></tr>
<tr><td>pg Time Machine /dmoz</td></tr>
</table>
</description>
<category>Other</category>
<link>http://www.gutenberg.net/</link>
<contributor>Thad Kerosky</contributor>
<form name="pgsearch" method="get" action="http://promo.net/cgi-promo/pg/t9.cgi">
<input type="hidden" name="ftpsite"
value="ftp://ibiblio.org/pub/docs/books/gutenberg/" />
<input type="hidden" name="title" value=""/>
<input type="hidden" name="author" value=""/>
</form>
<form name="readersearch" method="get" action="http://www.pgreader.com/apps/proc_query.asp">
<input type="hidden" name="title_txt" value=""/>
<input type="hidden" name="author_txt" value=""/>
</form>
<form name="dmozsearch" method="get" action="http://search.dmoz.org/cgi-bin/search">
<input type="hidden" name="cat" value="Arts/Literature/Electronic_Text_Archives/Project_Gutenberg"/>
<input type="hidden" name="search" value=""/>
<input type="hidden" name="all" value="no"/>
</form>
<script><![CDATA[
function pg(q)
{
var searchID = 0;
var AuthorQuery = false;
if( nullArgs("pg",q) )
return false;
else
{
var args = parseArgs(q, "reader, dmoz, author");
if( args.switches.length > 0 )
for( var j=0; j<args.switches.length; j++ )
switch( args.switches[j].name )
{
case "reader":
searchID = 1;
break;
case 'dmoz':
document.dmozsearch.search.value = args.q;
searchID = 2;
break;
case "author":
AuthorQuery = true;
break;
}
}
if (!AuthorQuery) {
document.pgsearch.title.value = args.q;
document.readersearch.title_txt.value = args.q;
}
else
{
document.pgsearch.author.value = args.q;
document.readersearch.author_txt.value = args.q;
}
switch (searchID) {
case 1:
submitForm(readersearch);
break;
case 2:
submitForm(dmozsearch);
break;
default:
submitForm(pgsearch);
break;
}
//for some reason if I don't clear these they show in the next query of a different type.
//document.pgsearch.author.value = "";
//document.readersearch.author_txt.value = "";
//document.pgsearch.title.value = "";
//document.readersearch.title_txt.value = "";
}
]]></script>
</search>