- fixes issues with the ISI Web of Knowledge translator. in the process of testing, I realized that, when searching the Web of Knowledge for common words (e.g., "quark"), the Web of Knowledge does not return a meaningful set of results. neither the "Web of Science" links, nor the export feature (through Zotero or the web interface) work at all. perhaps this is something to contact ISI about?

- fixes miscellaneous issues with frames (not relevant to b3)
This commit is contained in:
Simon Kornblith 2007-01-10 00:17:52 +00:00
parent c33cc7d0c9
commit 9d39f73947
2 changed files with 34 additions and 16 deletions

View File

@ -232,7 +232,9 @@ var Zotero_Browser = new function() {
* An event handler called when a new document is loaded. Creates a new document * An event handler called when a new document is loaded. Creates a new document
* object, and updates the status of the capture icon * object, and updates the status of the capture icon
*/ */
function contentLoad(event) { function contentLoad(event) {
Zotero.debug("contentLoad event");
var isHTML = event.originalTarget instanceof HTMLDocument; var isHTML = event.originalTarget instanceof HTMLDocument;
if(isHTML) { if(isHTML) {
@ -293,6 +295,8 @@ var Zotero_Browser = new function() {
* called to unregister Zotero icon, etc. * called to unregister Zotero icon, etc.
*/ */
function contentHide(event) { function contentHide(event) {
Zotero.debug("contentHide event");
if(event.originalTarget instanceof HTMLDocument && !event.originalTarget.defaultView.frameElement) { if(event.originalTarget instanceof HTMLDocument && !event.originalTarget.defaultView.frameElement) {
var doc = event.originalTarget; var doc = event.originalTarget;
@ -544,11 +548,13 @@ Zotero_Browser.Tab.prototype.detectTranslators = function(rootDoc, doc) {
} }
// get translators // get translators
this.page.translate = new Zotero.Translate("web"); var translate = new Zotero.Translate("web");
this.page.translate.setDocument(doc); translate.setDocument(doc);
this.page.translators = this.page.translate.getTranslators(); var translators = translate.getTranslators();
// add document // add document
if(this.page.translators && this.page.translators.length) { if(translators && translators.length) {
this.page.translate = translate;
this.page.translators = translators;
this.page.document = doc; this.page.document = doc;
} }
} }
@ -588,10 +594,13 @@ Zotero_Browser.Tab.prototype.translate = function(saveLocation) {
var me = this; var me = this;
// use first translator available // use first translator available
this.page.translate.setTranslator(this.page.translators[0]); if(!this.page.hasBeenTranslated) {
this.page.translate.setHandler("select", me._selectItems); this.page.translate.setTranslator(this.page.translators[0]);
this.page.translate.setHandler("itemDone", function(obj, item) { Zotero_Browser.itemDone(obj, item, saveLocation) }); this.page.translate.setHandler("select", me._selectItems);
this.page.translate.setHandler("done", function(obj, item) { Zotero_Browser.finishScraping(obj, item, saveLocation) }); this.page.translate.setHandler("itemDone", function(obj, item) { Zotero_Browser.itemDone(obj, item, saveLocation) });
this.page.translate.setHandler("done", function(obj, item) { Zotero_Browser.finishScraping(obj, item, saveLocation) });
this.page.hasBeenTranslated = true;
}
this.page.translate.translate(); this.page.translate.translate();
} }
} }
@ -638,6 +647,8 @@ Zotero_Browser.Tab.prototype.getCaptureIcon = function() {
// Handles the display of a div showing progress in scraping // Handles the display of a div showing progress in scraping
Zotero_Browser.Progress = new function() { Zotero_Browser.Progress = new function() {
var _progressWindow;
var _windowLoaded = false; var _windowLoaded = false;
var _windowLoading = false; var _windowLoading = false;
// keep track of all of these things in case they're called before we're // keep track of all of these things in case they're called before we're

View File

@ -1,4 +1,4 @@
-- 162 -- 163
-- ***** BEGIN LICENSE BLOCK ***** -- ***** BEGIN LICENSE BLOCK *****
-- --
@ -5502,17 +5502,16 @@ REPLACE INTO translators VALUES ('21ad38-3830-4836-aed7-7b5c2dbfa740', '1.0.0b3.
var lines = text.split("\n"); var lines = text.split("\n");
var fieldRe = /^[A-Z0-9]{2}(?: |$)/; var fieldRe = /^[A-Z0-9]{2}(?: |$)/;
var field, content, item; var field, content, item, authors;
for each(var line in lines) { for each(var line in lines) {
if(fieldRe.test(line)) { if(fieldRe.test(line)) {
if(item && field && content) { if(item && field && content) {
if(field == "AF") { if(field == "AF") {
// returns need to be processed separately when dealing with authors // returns need to be processed separately when dealing with authors
var authors = content.split("\n"); authors = content;
for each(var author in authors) { } else if(field == "AU" && !authors) {
item.creators.push(Zotero.Utilities.cleanAuthor(author, "author", true)); authors = content;
}
} else { } else {
content = content.replace(/\n/g, " "); content = content.replace(/\n/g, " ");
if(field == "TI") { if(field == "TI") {
@ -5572,8 +5571,15 @@ REPLACE INTO translators VALUES ('21ad38-3830-4836-aed7-7b5c2dbfa740', '1.0.0b3.
} }
field = content = undefined; field = content = undefined;
} else if(field == "ER") { } else if(field == "ER") {
if(authors) {
authors = authors.split("\n");
for each(var author in authors) {
item.creators.push(Zotero.Utilities.cleanAuthor(author, "author", true));
}
}
item.complete(); item.complete();
item = field = content = undefined; item = field = content = authors = undefined;
} }
} else { } else {
content += "\n"+Zotero.Utilities.cleanString(line); content += "\n"+Zotero.Utilities.cleanString(line);
@ -5637,6 +5643,7 @@ function doWeb(doc, url) {
var tableRows = doc.evaluate(''//tr[td/span/input[@name="marked_list_candidates"]]'', doc, nsResolver, XPathResult.ANY_TYPE, null); var tableRows = doc.evaluate(''//tr[td/span/input[@name="marked_list_candidates"]]'', doc, nsResolver, XPathResult.ANY_TYPE, null);
while(tableRow = tableRows.iterateNext()) { while(tableRow = tableRows.iterateNext()) {
var id = tableRow.getElementsByTagName("input")[0].value; var id = tableRow.getElementsByTagName("input")[0].value;
Zotero.debug(id);
items[id] = tableRow.getElementsByTagName("b")[0].textContent; items[id] = tableRow.getElementsByTagName("b")[0].textContent;