Two Plus Two Newer Archives

Two Plus Two Newer Archives (http://archives1.twoplustwo.com/index.php)
-   Software (http://archives1.twoplustwo.com/forumdisplay.php?f=47)
-   -   Bookmarklet to make search easier (http://archives1.twoplustwo.com/showthread.php?t=281078)

StevieG 12-11-2006 11:21 PM

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>
javascript:(function() {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.


All times are GMT -4. The time now is 10:54 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.