Labs/Ubiquity/Ubiquity Source Tip Author Tutorial: Difference between revisions

Line 433: Line 433:
To try this out, Ubiq "insert email for " and then the first few letters of someone you email often.
To try this out, Ubiq "insert email for " and then the first few letters of someone you email often.


This one command sums up what I love about Ubiquity. In 8 lines of code, I can fundamentally enhance the browser's functionality. Doing the same thing using a normal Firefox extension methodology takes pages and pages of code—and the interface would take more thought still. Doing the same thing using a bookmarklet would require a server-side component (to get around cross-site Ajax request ban) as well as forcing the user to give up their email password.
=== Shorter Argument Declarations ===
 
Notice that we used a shortcut for declaring the arguments.  In the long form, we would have had to say:
 
<pre>
  arguments: [{role: "modifier",
              nountype: noun_type_contact,
              label: "contact"}]
</pre>
 
but if we don't care about specifying a label for the argument, we can get away with using a single object for "arguments", with the roles as the property names, and the nountypes as the property values:
 
<pre>
  arguments: {modifier: noun_type_contact}
</pre>
 
If we had several arguments, and none of them needed labels, we could say:
 
<pre>
  arguments: {object: noun_arb_text, modifier: noun_type_contact}
</pre>
 
and so on.
 
Aza writes:
 
<pre>
This one command sums up what I love about Ubiquity. In 8 lines of code, I can  
fundamentally enhance the browser's functionality. Doing the same thing using  
a normal Firefox extension methodology takes pages and pages of code&mdash;and the interface would take more thought still. Doing the same thing using a bookmarklet would require a server-side component (to get around cross-site Ajax request ban) as well as forcing the user to give up their email password.


Ubiquity increases the surface area of innovation for the browser many-fold, by making anyone who can write simple Javascript into an agent for bettering the browser and the open Web.
Ubiquity increases the surface area of innovation for the browser many-fold, by making anyone who can write simple Javascript into an agent for bettering the browser and the open Web.
</pre>


== TinyURL: Network Calls and jQuery ==
== TinyURL: Network Calls and jQuery ==
1,007

edits