Alexis Bauchu - On est pas des machines

Coders are also human beings

jeudi, janvier 8 2009

Reminder: makeBookmarkletCommand

This is just a reminder: how to make a command out of a bookmarklet. For example, a command that embed a Flickr photo (the example is taken from Aza Raskin's blog).

CmdUtils.makeBookmarkletCommand({
name: "Embed Flickr Photo",
url: "javascript:(function(){if(window.page_p)window.open('http://www.elsewhere.org/mbedr/?p='+window.page_p.id);%20else%20alert('No%20Flickr%20photo%20found.');})()"
});

Replace the url by your bookmarklet code.

mercredi, décembre 31 2008

Ubiquity: makeSearchCommand template

This is just a reminder of the search command template. It allows you to create in no time what must be the most used feature of Ubiquity at the moment.

Use the command-editor command, and type the following code in the editor:

CmdUtils.makeSearchCommand({
  name: "your-function-name",
  url: "http://url-to-my-search-engine/?q={QUERY}",
  icon: "http://url-to-my-search-engine/favicon.ico",
  description: "Searches 'my-search-engine' for your words."
});

And just replace your-function-name and url-to-my-search-engine by your own new values. You may have to adapt the query url though.

An example, which searches cplusplus.com:

CmdUtils.makeSearchCommand({
  name: "c++",
  url: "http://www.cplusplus.com/query/search.cgi?q={QUERY}",
  icon: "http://www.cplusplus.com/favicon.ico",
  description: "Searches cplusplus.com for your words."
});