Bookmark/quick search combo

By Henrik N Last update Apr 1, 2007 — Installed 645 times.

Archived Comments (locked)

in
Subscribe to Archived Comments 7 posts, 4 voices



Jesse Andrews Admin

The following is an archive of comments made before threaded discussions was implemented (November 16th, 2008)

 
jnv Scriptwright

Thanks, when indexOf search in the whole URL, then this solution works. I don't see the %s position as so big limitation.
I slightly edited also the other parts of code, just in case somebody will be interested see this.

 
Henrik N Script's Author

Syntax:

If %s is omitted, I can't think of a good solution.

You could change if (search.indexOf("%s") != -1) to if (search.indexOf("="+delimiter) != -1) , but this has the caveat that your %s has to come immediately between a = and the #http bit.

 
jnv Scriptwright

I would really like to use this script but unfortunately it is not working for me, possibly because of Firefox 3 and different keywords behavior (when there is no search string, %s in URL is omitted and not inserted, like in Fx2).
Any chance for fixing this script?

 
Henrik N Script's Author

alien_scum: That's an interesting solution. I tried adjusting the code for this, but I won't in fact include it in this script, since it complicates things for little gain. Still, here's the code:

var delimiter = "#http";
var launch_pad = /^about:cache#/;

var url = location.href.replace(launch_pad, '');

var parts = url.split(delimiter);
var search = parts[0];
var bookmark = "http" + parts.slice(1).join(delimiter);

if (search.indexOf("%s") != -1) {
	location.replace(bookmark);
} else if (url != location.href) {  // Using launch pad
	location.replace(search);
} else {
	location.hash = location.hash.split(delimiter)[0];
}

 
alien_scum Scriptwright

Sweet script, if you change it to about:cache#QUICKSEARCH_URL#BOOKMARK_URL then it will only open the right page. about:blank or a data url would be better but alas greasemonkey doesn't run on those.

 
Henrik N Script's Author

I would like for this script not to have to display the quick search page before redirecting to the bookmark page, but I don't see how. If you do, let me know.

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel