De:Ubiquity 0.1.2 Programmier-Tutorial: Difference between revisions

Jump to navigation Jump to search
Line 713: Line 713:
* Sieh Dir auch einmal diese wesentlich [http://graynorton.com/ubiquity/freebase-nouns.html robustere Implementierung eines Freebase-abgeleiteten Substantiv-Typs] an.
* Sieh Dir auch einmal diese wesentlich [http://graynorton.com/ubiquity/freebase-nouns.html robustere Implementierung eines Freebase-abgeleiteten Substantiv-Typs] an.


== Running on page load and startup ==
== Codeausführung nach dem Laden einer Seite und beim Seitenstart ==


In order to run some code on page load, you simply have to prefix your function with <code>pageLoad_</code>. For example, if you want to say "Hi" every time a page is loaded, your code would look like this:
Wenn Du irgendwelchen Code nach dem Laden einer Seite ausführen willst, musst einfach nur das Präfix <code>pageLoad_</code> vor den Namen Deiner Funktion zu setzen. Wenn Du zum Beispiel jedesmal "Hallöchen!" sagen willst, nachdem eine Seite geladen wurde, dann müsste Dein Code in etwa wie folgt aussehen:


<pre>
<pre>
function pageLoad_hi(){
function pageLoad_halloechen(){
  displayMessage("hi");
  displayMessage("Hallöchen");
}
}
</pre>
</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.
Wenn Du diese Funktion abänderst und willst dann die Änderungen sehen, vergiss nicht, zuerst Ubiquity aufzurufen. Obwohl eine Funktion wie diese nicht unbedingt ein Ubiquity-Kommando sein muss ist es dennoch ein Refresh des gecachten Codes erforderlich, ebenso, wenn Du irgendwelchen Code ausführen willst, jedesmal wenn FireFox startet.  
 
Similarly, 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.
166

edits

Navigation menu