Register event listener for ZoteroItemUpdated

This commit is contained in:
Simon Kornblith 2011-07-10 22:21:13 +00:00
parent 0b36cc47b9
commit bf698c65c6

View file

@ -288,11 +288,7 @@ var Zotero_Browser = new function() {
Zotero_Browser.updateStatus(); Zotero_Browser.updateStatus();
}, false); }, false);
// this is for pageshow, for updating the status of the book icon // this is for pageshow, for updating the status of the book icon
this.appcontent.addEventListener("pageshow", this.appcontent.addEventListener("pageshow", contentLoad, true);
function(e) {
//Zotero.debug("pageshow");
Zotero_Browser.contentLoad(e);
}, true);
// this is for turning off the book icon when a user navigates away from a page // this is for turning off the book icon when a user navigates away from a page
this.appcontent.addEventListener("pagehide", this.appcontent.addEventListener("pagehide",
function(e) { function(e) {
@ -374,9 +370,11 @@ var Zotero_Browser = new function() {
// Figure out what browser this contentDocument is associated with // Figure out what browser this contentDocument is associated with
var browser; var browser;
for(var i=0; i<this.tabbrowser.browsers.length; i++) { var browsers = Zotero_Browser.tabbrowser.browsers;
if(rootDoc == this.tabbrowser.browsers[i].contentDocument) { var nBrowsers = Zotero_Browser.tabbrowser.browsers.length;
browser = this.tabbrowser.browsers[i]; for(var i=0; i<nBrowsers; i++) {
if(rootDoc == browsers[i].contentDocument) {
browser = browsers[i]
break; break;
} }
} }
@ -392,7 +390,7 @@ var Zotero_Browser = new function() {
window.alert(Zotero.getString("annotations.oneWindowWarning")); window.alert(Zotero.getString("annotations.oneWindowWarning"));
} else if(!tab.page.annotations) { } else if(!tab.page.annotations) {
// enable annotation // enable annotation
tab.page.annotations = new Zotero.Annotations(this, browser, annotationID); tab.page.annotations = new Zotero.Annotations(Zotero_Browser, browser, annotationID);
var saveAnnotations = function() { var saveAnnotations = function() {
tab.page.annotations.save(); tab.page.annotations.save();
tab.page.annotations = undefined; tab.page.annotations = undefined;
@ -406,6 +404,9 @@ var Zotero_Browser = new function() {
// detect translators // detect translators
tab.detectTranslators(rootDoc, doc); tab.detectTranslators(rootDoc, doc);
// register metadata updated event
doc.addEventListener("ZoteroItemUpdated", contentLoad, false);
} }
/* /*