Skip to content

Instantly share code, notes, and snippets.

@eversonl
Created February 18, 2009 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eversonl/66386 to your computer and use it in GitHub Desktop.
Save eversonl/66386 to your computer and use it in GitHub Desktop.
search crazymenu.com for food type in any location
//crazymenu
var noun_arb_location = {
_name: "Location",
suggest: function( text, html ) {
return [ CmdUtils.makeSugg(text, html) ];
}
};
CmdUtils.CreateCommand({
name: "crazymenu",
icon: "http://www.crazymenu.com/favicon.ico",
homepage: "http://www.0-21.co.uk/index.php/200902173422/Blog/Lee-s-Blog/My-Ubiquity-commands.html",
author: { name: "Lee Everson", email: "lee@0-21.co.uk"},
license: "GPL",
description: "Searches crazymenu.com (Beta) for Business name, cuisine category, and/or keyword in a location of your choice",
help: "To search for all Business name and cuisines in your are put type as *",
releaseinfo: {2:"(18th Feb 2009) 1st release.",
1:"(17th Feb 2009) Initial idea." },
takes: {"type" : noun_arb_text},
modifiers: {"in" : noun_arb_location},
preview: function( pblock, searchText, mods ) {
pblock.innerHTML = "";
var msg = 'Search crazymenu for : ${search} in ${category}.';
var subs = {search: searchText.text, category: (mods.in.text||'')};
pblock.innerHTML = CmdUtils.renderTemplate( msg, subs );
},
execute: function( searchText, mods ) {
h='www.crazymenu.com';
p='/actions/SearchRestaurants.do?description='+encodeURIComponent(searchText.text) + '&location=' + mods.in.text + '&x=0&y=0';
cp='http://'+h+p;
Utils.openUrlInBrowser(cp,null);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment