Scripts

In-page search a la Apple Safari

About
This script will add a toolbar to the webpage for seaching on the page it self.

To view a demo press Ctrl + Alt + f (or click here).

The following keyboard shortcuts are available

It is designed to work as the native search function in Apple's Safari browser. Additionally support for regular expressions have been added. To much surprise this script actually seems to be faster than Safari's own search feature.

Features
In Internet Explorer the script runs on top of JDC to allow for 99% standard compliant JavaScript. I originally wrote this to see how well JDC performs in a real life scenario. The script heavily modifies the DOM using both node methods and innerHTML and thus provide a good example of what JDC can do. I think it perfrms pretty decent but try it and judge for yourself.

If you look at the code you will see the follwoing methods and properties being used in IE

It does however contain code only for IE. This is due to IE specific behavoir of PRE tags and INPUT tags of type checkbox. These are special cases that JDC can not handle yet.

The script is tested in IE 6 + 7, Firefox 3, Opera 9.51 and Safari 3 on Windows XP - as the code is standard compliant it should work on Mac and Linux as well. You have the following options for customization

Besides the above you may tweak various style settings in the source. The comments should say when its safe to edit or not.

If you install it on your own site it is very possible that your existing CSS will interfere with the layout of the toolbar. This is easily fixable though and will be included in the next version. Until then you will have to sort it out manually.

Shortcomings

Download
Get the search script here. If you want support in IE you also need to download JDC. Turn of caching as it is not needed and select CSS corrections for opacity and cssFloat.

Copyright
The script is licensed as GPLv3 which means it is free to use. I kindly ask you to leave the JSLab logo and link back to my site in the top right corner of the toolbar. I wrote this for free for myself and others to enjoy but I would be happy for more traffic to my site. Donations are definitely also a possibility.

Enjoy the script.