Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Ubiquity command to add a task to RTM, using a bookmarklet
/**
* Ubiquity command to add a task to RTM, using a bookmarklet
*/
CmdUtils.CreateCommand({
name: "rtm-bookmarklet",
author: {
name: "Gary Hodgson",
homepage : "http://www.garyhodgson.com/ubiquity/rtm-bookmarklet.html",
email : "contact@garyhodgson.com"
},
contributors: ["Kevin Kubasik", "Matteo"],
license: "MPL",
releaseinfo: {2:"(01 Sep 2008) Replaced openUrl with Utils.openUrlInBrowser",
1:"(28 Aug 2008) Initial Release." },
description: "Creates a new task in Remember The Milk. <span id='credit'>(Original by <a href='http://kubasik.net/blog/2008/08/27/remember-the-milk-plugin-for-mozilla-ubiquity/'>Kevin Kubasik</a>)</span>",
help: "Opens the RTM add task bookmarklet with the task and date fields optionally populated.",
takes: {task: noun_arb_text},
modifiers: {on: noun_arb_text},
icon: "http://www.rememberthemilk.com/favicon.ico",
preview: function( pblock , taskText, mods) {
var msg = 'Creates the following Task: ${task} on ${on}';
var subs = {task: taskText.text, on: mods.on.text};
pblock.innerHTML = CmdUtils.renderTemplate( msg, subs );
},
execute: function( taskText, mods ) {
h='www.rememberthemilk.com';
p='/services/ext/addtask.rtm';
cp='http://'+h+p+'?d='+encodeURIComponent(mods.on.text || '')+'&t='+encodeURIComponent(taskText.text);
Utils.openUrlInBrowser(cp,null);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment