73
edits
(Removed an outdated note.) |
(Mentioned ubiquityLoad_.) |
||
| Line 884: | Line 884: | ||
* A much more robust implementation of Freebase-derived noun types can be found [http://graynorton.com/ubiquity/freebase-nouns.html here]. | * 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 and startup == | == 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. | 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. | ||
| Line 891: | Line 891: | ||
<pre> | <pre> | ||
function pageLoad_hi(){ | function pageLoad_hi() { | ||
displayMessage("hi"); | |||
} | } | ||
</pre> | </pre> | ||
| Line 898: | Line 898: | ||
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. | 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, if you want to run some code everytime Firefox starts up, you just have to prefix the function with <code>startup_</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. | 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. | ||
edits