Labs/Ubiquity/Ubiquity 0.5 Author Tutorial: Difference between revisions

(→‎Insert Email: the Contact noun type: args -> arguments | text -> html)
 
Line 560: Line 560:
CmdUtils.CreateCommand({
CmdUtils.CreateCommand({
   names: ["tinyurl"],
   names: ["tinyurl"],
  description: "Replaces the selected URL with a TinyUrl.",
   arguments: [{role: "object",
   arguments: [{role: "object",
               nountype: noun_type_url,
               nountype: noun_type_url,
               label: "url to shorten"}],
               label: "url to shorten"}],
  preview: "Replaces the selected URL with a TinyUrl.",
   execute: function(args) {
   execute: function( arguments ) {
     var baseUrl = "http://tinyurl.com/api-create.php";
     var baseUrl = "http://tinyurl.com/api-create.php";
     var params = {url: arguments.object.text};
     var params = {url: args.object.text};
     jQuery.get( baseUrl, params, function( tinyUrl ) {
     jQuery.get(baseUrl, params, function(tinyUrl) {
       CmdUtils.setSelection( tinyUrl );
       CmdUtils.setSelection(tinyUrl);
     })
     });
   }
   },
})
})
</pre>
</pre>
Line 577: Line 577:


jQuery is a powerful tool. With it, you can fairly effortlessly cherry-pick the data you need from RSS feeds, XML, and all sorts of other data formats. It also makes doing in-preview animations a breeze.
jQuery is a powerful tool. With it, you can fairly effortlessly cherry-pick the data you need from RSS feeds, XML, and all sorts of other data formats. It also makes doing in-preview animations a breeze.


= Twitter: Putting It All Together =
= Twitter: Putting It All Together =
73

edits