1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
// Create an object which implements nsIWebProgressListener
const STATE_START = Components.interfaces.nsIWebProgressListener.STATE_START;
const STATE_STOP = Components.interfaces.nsIWebProgressListener.STATE_STOP;
myExt_urlBarListener = {
QueryInterface: function(aIID)
{
if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
aIID.equals(Components.interfaces.nsISupports))
return this;
throw Components.results.NS_NOINTERFACE;
},
onStateChange: function(aBrowser, aWebProgress, aRequest, aStateFlags, aStatus)
{
// If you use myListener for more than one tab/window, use
// aWebProgress.DOMWindow to obtain the tab/window which triggers the state change
if(aStateFlags & STATE_START)
{
// This fires when the load event is initiated
}
if(aStateFlags & STATE_STOP)
{
// This fires when the load finishes
var document = browser.contentDocument;
// j'affiche par exmple le titre
alert("titre "+document.title);
}
}
};
Zotero.GenerationFichierDonnees = {
// fonction principale qui est appelee quand l'utilisateur appuie sur la bouton "Generation fichiers de donnees" dans zotero
init: function()
{
gBrowser.addTabsProgressListener(myExt_urlBarListener);
var tablien = new Array("www.google.fr",);
for (i=0; i<tablien.length; i++)
{
gBrowser.addTab("zotero://attachment/"+itemIDHighLight[i]["itemID"]+"/");
}
},
};
window.addEventListener("load", function() {Zotero.GenerationFichierDonnees.init()}, false);
window.addEventListener("unload", function() {Zotero.GenerationFichierDonnees.uninit()}, false); |
Partager