Go To

Description

Detects wether input is a web page or a search phrase. If you type “o uzbl wiki” google will be queried on uzbl wiki, if you type “o uzbl.org” uzbl.org will be opened as a web page

Perl

#!/usr/bin/perl

my ($config,$pid,$xid,$fifo,$socket,$url,$title,@cmd) = @ARGV;
if($fifo eq "") { die "No fifo"; };

#If there are no dots in the first word or more than one word is suppllied expect a phrase for google. Else go to the uri specified.
if (index(@cmd[0], '.') == -1 || scalar @cmd > 1)
{
        # Replace this with your search engine
	qx(echo "uri http://www.google.de/search?q=@cmd" >> $fifo);
}
else
{
	qx(echo "uri @cmd" >> $fifo);
}

Installation

Copy the above script to a directory of your choice and bind it for example with:

@bind o _ = spawn @scripts_dir/goto.pl %s

Javascript

The above version did not work very well for me, so I created a JS version that does:

var o = '%s';
if(o.indexOf('.') > 0){
    if(o.indexOf(':') < 0) o = 'http://' + o
    window.location = o;
} else window.location = 'http://www.google.com/search?q=' + o + '&btnI=I\'m+Feeling+Lucky'

Installation

Copy the above script to a directory of your choice and bind it for example with:

@bind o _ = script @scripts_dir/goto.js '%s'
 
go-to.txt · Last modified: 2009/11/27 19:28 by mason.larobina
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki