Javascript for Windows-IE Everything Search Button

created by timothyf
(thing) by timothyf (6 y) (print)   (I like it!) 1 C! Wed Mar 22 2000 at 19:23:47

If you like the idea of the Unix-Netscape Everything Search Button but are OS or browser challanged, here is the javascript that will work for Internet Explorer on Windows:

javascript:q=(document.frames.length?-1:document.selection.createRange().text);if(q<=0){void(q=prompt('Enter text to search E2.'+(q?'':'Gimme some text to search E2'),''))};if(q)location.href='http://everything2.com/?node='+escape(q)

You'll need to create a favorite and replace the location with the code above for it to work.

(thing) by General Wesc (10.2 hr) (print)   (I like it!) Tue Jun 27 2000 at 9:09:04
Please use this:
javascript:q=(document.frames.length?-1:document.selection.createRange().text);if(q<=0){void(q=prompt('Enter text to search E2.'+(q?'':'Gimme some text to search E2'),''))};if(q)location.href='http://everything2.com/?lastnode_id=94806&node='+escape(q)

It links whatever you search to The Node Linked to All Others! Join the cause!

(thing) by WildFyre (4.8 y) (print)   (I like it!) 1 C! Thu Jul 06 2000 at 3:59:30
And how about in the context menu?

Add to the registry something like this: the key HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\Everything Search Its default should be "c:\windows\e2search.htm" or something. Also, put there a binary value, with data 0x10.

Now, put a file at wherever you pointed that thing, with this in:

<script LANGUAGE="JavaScript">
var EverythingURL = "http://www.everything2.com/index.pl?";

 var Win = external.menuArguments;
 var activePage = sourceWin.document;
 var locus = sourceWin.location;
 var activeSelection = activePage.selection;
 var rngActive = activeSelection.createRange();
 var selectedText = new String(rngActive.text);
  EverythingURL = EverythingURL + "node="  + selectedText;
  if (Win.location.hostname=="www.everything2.com") {
   var foo=activePage.links(0).search.match(/&lastnode_id=\d*/);
   EverythingURL=EverythingURL+foo;
  } 
  Win.location=EverythingURL;
</script>

It even soft links.
Should do the trick.

This file should be hosted somewhere, then you'd just need to write the URL in the registry and you'd be all set.

Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.