Changes

Jump to: navigation, search

Labs/Ubiquity/Ubiquity 0.5 Author Tutorial

401 bytes added, 23:51, 29 August 2009
Mentioned ubiquityLoad_.
* A much more robust implementation of Freebase-derived noun types can be found [http://graynorton.com/ubiquity/freebase-nouns.html here].
== Running on page load, Ubiquity load and startup ==
Commands aren't the only thing you can put in a command feed. You can also include functions you want to be run automatically at page-load time and at Firefox startup time.
<pre>
function pageLoad_hi(){ displayMessage("hi");
}
</pre>
If you modify the function and want to see the changes, remember to first invoke Ubiquity. Although your function like above, might not be a Ubiquity command, this is necessary to refresh the cached code.
Similarly, functions prefixed by <code>ubiquityLoad_</code> are called whenever Ubiquity is initialized for a main window of Firefox. This is useful when you want to interact with the Ubiquity interface itself, or want to run some code whenver a new window is opened. <pre>function ubiquityLoad_googleAsDefaultEntry(gUbiquity, mainWindow) { gUbiquity.textBox.value = "google";}</pre> And if you want to run some code everytime Firefox starts up, you just have to prefix the function with <code>startup_</code> .
The awesome thing about these functions is the ability to develop whole Firefox extensions (that require minimal UI) as Ubiquity plugins in lesser lines of code. You don't need to worry about chrome.manifest or install.rdf. Another added benefit is that you never have to restart your Firefox during development unless of course, you are running code on Firefox startup.
73
edits

Navigation menu