12/9/2008



Add a search history widget to your tumblr theme.

Before closing head tag (</head>):

<script src="http://castr.appspot.com/js/lib/core/prototype.js" type="text/javascript"></script>
<script src="http://castr.appspot.com/js/lib/core/scriptaculous.js" type="text/javascript"></script>
<script src="http://castr.appspot.com/js/lib/livepipe/livepipe.js" type="text/javascript"></script>
<script src="http://castr.appspot.com/js/lib/livepipe/cookie.js" type="text/javascript"></script>

Html and CSS code that created the search history widget:

<style type="text/css" media="screen">
#search,
#search-history {margin-bottom:1em;}
#search-item {padding-left:6px;}
.search-item-odd {background-color:#ffa23c;}
.search-item-even {background-color:#ff922c;}
</style>

<div id="search">
<form action="/search" method="get">
<input type="text" id="q" name="q" value="{SearchQuery}"/>
<input type="submit" value="Search"/>
</form>
</div>

<div id="search-history">
<h4>Search History</h4>
<script type="text/javascript" src="http://castr.appspot.com/js/helpers/search_history_helper.js"></script>
<script type="text/javascript" charset="utf-8">
historysize = 3;
saveSearch('{SearchQuery}', '{URLSafesearchQuery}', historysize);
drawHistory("search-history");
</script>
</div>
Comments (View)
blog comments powered by Disqus