- fix scrape bug

- fix problem with scientificcommons search results
This commit is contained in:
Simon Kornblith 2007-03-16 02:43:18 +00:00
parent 7b0d3c89ee
commit bf44c0fe91
2 changed files with 9 additions and 8 deletions

View File

@ -149,7 +149,7 @@ var Zotero_Browser = new function() {
// make sure annotation action is toggled // make sure annotation action is toggled
var tab = _getTabObject(Zotero_Browser.tabbrowser.selectedBrowser); var tab = _getTabObject(Zotero_Browser.tabbrowser.selectedBrowser);
if(tab.page.annotations.clearAction) tab.page.annotations.clearAction(); if(tab.page && tab.page.annotations && tab.page.annotations.clearAction) tab.page.annotations.clearAction();
if(!toggleTool) return; if(!toggleTool) return;

View File

@ -1,4 +1,4 @@
-- 177 -- 178
-- ***** BEGIN LICENSE BLOCK ***** -- ***** BEGIN LICENSE BLOCK *****
-- --
@ -22,7 +22,7 @@
-- Set the following timestamp to the most recent scraper update date -- Set the following timestamp to the most recent scraper update date
REPLACE INTO version VALUES ('repository', STRFTIME('%s', '2007-03-15 22:10:00')); REPLACE INTO version VALUES ('repository', STRFTIME('%s', '2007-03-16 02:40:00'));
REPLACE INTO translators VALUES ('96b9f483-c44d-5784-cdad-ce21b984fe01', '1.0.0b3.r1', '', '2006-12-15 03:40:00', 1, 100, 4, 'Amazon.com', 'Sean Takats', '^https?://(?:www\.)?amazon', REPLACE INTO translators VALUES ('96b9f483-c44d-5784-cdad-ce21b984fe01', '1.0.0b3.r1', '', '2006-12-15 03:40:00', 1, 100, 4, 'Amazon.com', 'Sean Takats', '^https?://(?:www\.)?amazon',
'function detectWeb(doc, url) { 'function detectWeb(doc, url) {
@ -4550,7 +4550,7 @@ function doWeb(doc, url) {
Zotero.wait(); Zotero.wait();
}'); }');
REPLACE INTO translators VALUES ('19643c25-a4b2-480d-91b7-4e0b761fb6ad', '1.0.0b3.r1', '', '2007-03-15 22:10:00', '1', '100', '4', 'ScientificCommons', 'Sean Takats', '^http://(?:en|de|www)\.scientificcommons\.org', REPLACE INTO translators VALUES ('19643c25-a4b2-480d-91b7-4e0b761fb6ad', '1.0.0b3.r1', '', '2007-03-16 02:40:00', '1', '100', '4', 'ScientificCommons', 'Sean Takats', '^http://(?:en|de|www)\.scientificcommons\.org',
'function detectWeb(doc, url) { 'function detectWeb(doc, url) {
var articleRe = /^http:\/\/(?:www|en|de)\.scientificcommons\.org\/([0-9]+)/; var articleRe = /^http:\/\/(?:www|en|de)\.scientificcommons\.org\/([0-9]+)/;
var m = articleRe.exec(url); var m = articleRe.exec(url);
@ -4558,14 +4558,15 @@ REPLACE INTO translators VALUES ('19643c25-a4b2-480d-91b7-4e0b761fb6ad', '1.0.0b
if(m) { if(m) {
return "journalArticle"; return "journalArticle";
} else { } else {
var frontRe = /^http:\/\/(?:www|en|de)\.scientificcommons\.org\/$/;
if(frontRe.test(url)) return "multiple";
var namespace = doc.documentElement.namespaceURI; var namespace = doc.documentElement.namespaceURI;
var nsResolver = namespace ? function(prefix) { var nsResolver = namespace ? function(prefix) {
if (prefix == ''x'') return namespace; else return null; if (prefix == ''x'') return namespace; else return null;
} : null; } : null;
var listElt = doc.evaluate(''//div[@class="content_element"]'', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); var listElt = doc.evaluate(''//div[@id="content_search_details"]'', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
if (listElt) { if (listElt) return "multiple";
return "multiple";
}
} }
return false; return false;
}', }',