ForumsQuestionsMozilla Ubiquity
Mozilla Ubiquity
Author | Message |
---|---|
Michael |
I would love to see you provide some scripts fro Mozilla Ubiquity. It is a perfect fit for toodledo!
-- Michael |
kenbeyond |
Yeah,terrific idea!
|
kleerkoat |
yeah, that is pretty freaking cool.
|
jiri.fencl |
just installed it, it would be awesome to be able to add tasks via ubiquity interface!
|
Andy Geers |
Here's a really quick hacked together script that lets you add tasks. You'll need to substitute your userId into the "myuserid" variable, and an MD5 hash of your password into the "hashed_password" variable (use a tool like http://www.adamek.biz/md5-generator.php to create that). You also need to paste in an implementation of MD5 from here: http://www.semnanweb.com/jquery-plugin/download/jquery.md5.js.txt
--- var baseUrl = "http://www.toodledo.com/api.php"; var token = null; var api_key = null; var hashed_password = "MYPASSWORDMD5ED"; var myuserid = 'MYUSERID'; var getToken = function(callback) { var params = {method: 'getToken', userid: myuserid}; jQuery.get( baseUrl, params, function( response ) { token = jQuery(response).find("token").text(); api_key = jQuery.md5( hashed_password + token + myuserid ); callback(api_key); }) } CmdUtils.CreateCommand({ name: "add-task", takes: {"task description": noun_arb_text}, preview: "Adds a task to Toodledo.", execute: function( description ) { var addTask = function(api_key) { var params = { method: 'addTask', key: api_key, title: description.text } jQuery.get( baseUrl, params, function( response ) { var error = jQuery(response).find("error").text(); if (error && error.length) { displayMessage("An error occurred: " + error); } else { displayMessage("Task added!"); } }) } if (api_key == null) { getToken(addTask); } else { addTask(api_key); } } }) |
You cannot reply yet
U Back to topic home
R Post a reply
To participate in these forums, you must be signed in.