73
edits
(→Insert Email: the Contact noun type: args -> arguments | text -> html) |
(→TinyURL: Network Calls and jQuery (and the URL noun type): arguments -> args) |
||
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"}], | ||
execute: function(args) { | |||
execute: function( | |||
var baseUrl = "http://tinyurl.com/api-create.php"; | var baseUrl = "http://tinyurl.com/api-create.php"; | ||
var params = {url: | 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 = |
edits