garyhodgson (owner)

Revisions

gist: 24258 Download_button fork
public
Description:
Ubiquity command to add a task to RTM, using a bookmarklet
Public Clone URL: git://gist.github.com/24258.git
Embed All Files: show embed
ubiquity-rtm.js #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* 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);
  }
 
});