View Single Post
  #1  
Old 12-11-2006, 11:21 PM
StevieG StevieG is offline
Senior Member
 
Join Date: Jan 2003
Location: b-more
Posts: 3,558
Default Bookmarklet to make search easier

Cross posted on "About the Forums"

Searching the 2+2 archives requires you to do the calendar math to get the range started at July 15, 2005 relative to now.

I was thinking about doing something to address this for myself when I remembered KOTLP 's post with a bookmarklet that resizes images on a 2+2 page.

A bookmarklet is a bookmark that links to javascript instead of a Web site, letting you do some programming trick through a bookmark.

So I wrote one for the archive search that populates the date fields for you, starting with a range of the last 180 days of the old server.

Here's what you do.

Take this mess of code, and copy it to a simple text editor like notepad:

<font class="small">Code:</font><hr /><pre>
javascriptfunction() {archDate=new Date(2005,06,15);today=new Date();
var interval=parseInt(prompt("What six month interval?
(1 starts back from " + archDate + ")", "1")); if (isNaN(interval)) {interval=1; };
older=Math.ceil((today.getTime()-archDate.getTime())
/(1000*60*60*24)) + (180 * (interval-1)); document.forms[0]["newertype"].value="d";
document.forms[0]["oldertype"].value="d";
document.forms[0]["olderval"].value=older;
document.forms[0]["newerval"].value=older+180;})()
</pre><hr />

Change it so that it is all one line, and copy the text of the code.

Now make a bookmark, and for the location properties, paste in the code. Give it a name or title like "Set archive search date range" and you're all set.

It will prompt you for what interval you want, with 1 as the default. If you enter 3, for instance, you'll be searching from around July 20, 2004 to January 20, 2004.
Reply With Quote