- 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:
parent
c33cc7d0c9
commit
9d39f73947
|
@ -232,7 +232,9 @@ var Zotero_Browser = new function() {
|
|||
* An event handler called when a new document is loaded. Creates a new document
|
||||
* 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;
|
||||
|
||||
if(isHTML) {
|
||||
|
@ -293,6 +295,8 @@ var Zotero_Browser = new function() {
|
|||
* called to unregister Zotero icon, etc.
|
||||
*/
|
||||
function contentHide(event) {
|
||||
Zotero.debug("contentHide event");
|
||||
|
||||
if(event.originalTarget instanceof HTMLDocument && !event.originalTarget.defaultView.frameElement) {
|
||||
var doc = event.originalTarget;
|
||||
|
||||
|
@ -544,11 +548,13 @@ Zotero_Browser.Tab.prototype.detectTranslators = function(rootDoc, doc) {
|
|||
}
|
||||
|
||||
// get translators
|
||||
this.page.translate = new Zotero.Translate("web");
|
||||
this.page.translate.setDocument(doc);
|
||||
this.page.translators = this.page.translate.getTranslators();
|
||||
var translate = new Zotero.Translate("web");
|
||||
translate.setDocument(doc);
|
||||
var translators = translate.getTranslators();
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
@ -588,10 +594,13 @@ Zotero_Browser.Tab.prototype.translate = function(saveLocation) {
|
|||
var me = this;
|
||||
|
||||
// use first translator available
|
||||
this.page.translate.setTranslator(this.page.translators[0]);
|
||||
this.page.translate.setHandler("select", me._selectItems);
|
||||
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) });
|
||||
if(!this.page.hasBeenTranslated) {
|
||||
this.page.translate.setTranslator(this.page.translators[0]);
|
||||
this.page.translate.setHandler("select", me._selectItems);
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -638,6 +647,8 @@ Zotero_Browser.Tab.prototype.getCaptureIcon = function() {
|
|||
|
||||
// Handles the display of a div showing progress in scraping
|
||||
Zotero_Browser.Progress = new function() {
|
||||
var _progressWindow;
|
||||
|
||||
var _windowLoaded = false;
|
||||
var _windowLoading = false;
|
||||
// keep track of all of these things in case they're called before we're
|
||||
|
|
21
scrapers.sql
21
scrapers.sql
|
@ -1,4 +1,4 @@
|
|||
-- 162
|
||||
-- 163
|
||||
|
||||
-- ***** 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 fieldRe = /^[A-Z0-9]{2}(?: |$)/;
|
||||
var field, content, item;
|
||||
var field, content, item, authors;
|
||||
|
||||
for each(var line in lines) {
|
||||
if(fieldRe.test(line)) {
|
||||
if(item && field && content) {
|
||||
if(field == "AF") {
|
||||
// returns need to be processed separately when dealing with authors
|
||||
var authors = content.split("\n");
|
||||
for each(var author in authors) {
|
||||
item.creators.push(Zotero.Utilities.cleanAuthor(author, "author", true));
|
||||
}
|
||||
authors = content;
|
||||
} else if(field == "AU" && !authors) {
|
||||
authors = content;
|
||||
} else {
|
||||
content = content.replace(/\n/g, " ");
|
||||
if(field == "TI") {
|
||||
|
@ -5572,8 +5571,15 @@ REPLACE INTO translators VALUES ('21ad38-3830-4836-aed7-7b5c2dbfa740', '1.0.0b3.
|
|||
}
|
||||
field = content = undefined;
|
||||
} 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 = field = content = undefined;
|
||||
item = field = content = authors = undefined;
|
||||
}
|
||||
} else {
|
||||
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);
|
||||
while(tableRow = tableRows.iterateNext()) {
|
||||
var id = tableRow.getElementsByTagName("input")[0].value;
|
||||
Zotero.debug(id);
|
||||
|
||||
items[id] = tableRow.getElementsByTagName("b")[0].textContent;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user