commit 13f793e636a8b0fb76acd7967edf155e2c11e431
parent 23ad809a066dc3bd8e74fc67eb4eca6c0cc49455
Author: Avram Lyon <ajlyon@gmail.com>
Date: Mon, 30 May 2011 20:55:37 +0000
Trans: Fix for competing detection routines on Highwire 2.0 (http://forums.zotero.org/discussion/17845)
Diffstat:
1 file changed, 32 insertions(+), 15 deletions(-)
diff --git a/translators/Highwire 2.0.js b/translators/Highwire 2.0.js
@@ -1,14 +1,14 @@
{
- "translatorID":"8c1f42d5-02fa-437b-b2b2-73afc768eb07",
- "label":"Highwire 2.0",
- "creator":"Matt Burton",
- "target":"(content/([0-9]+/[0-9]+|current|firstcite|early)|search\\?submit=|search\\?fulltext=|cgi/collection/.+)",
- "minVersion":"1.0.0b4.r5",
- "maxVersion":"",
- "priority":100,
- "inRepository":"1",
- "translatorType":4,
- "lastUpdated":"2011-01-05 17:05:00"
+ "translatorID": "8c1f42d5-02fa-437b-b2b2-73afc768eb07",
+ "label": "Highwire 2.0",
+ "creator": "Matt Burton",
+ "target": "(content/([0-9]+/[0-9]+|current|firstcite|early)|search\\?submit=|search\\?fulltext=|cgi/collection/.+)",
+ "minVersion": "1.0.0b4.r5",
+ "maxVersion": "",
+ "priority": 100,
+ "inRepository": true,
+ "translatorType": 4,
+ "lastUpdated": "2011-05-23 21:37:09"
}
/*
@@ -32,8 +32,14 @@ function detectWeb(doc, url) {
if (prefix == 'x') return namespace; else return null;
} : null;
- // lets hope this installations don't tweak this...
- var highwiretest = doc.evaluate("//link[@href = '/shared/css/hw-global.css']", doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
+ var highwiretest = false;
+
+ highwiretest = url.match(/\.pdf+html\?frame=header/);
+
+ if (!highwiretest) {
+ // lets hope this installations don't tweak this...
+ highwiretest = doc.evaluate("//link[@href = '/shared/css/hw-global.css']", doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
+ }
if(highwiretest) {
@@ -47,8 +53,7 @@ function detectWeb(doc, url) {
url.match("content/firstcite")
) {
return "multiple";
- } else if (url.match("content/(early/)?[0-9]+")
- && (url.indexOf("frame") === -1 || url.indexOf("frame=sidebar") !== -1)) {
+ } else if (url.match("content/(early/)?[0-9]+")) {
return "journalArticle";
}
}
@@ -59,7 +64,19 @@ function doWeb(doc, url) {
var nsResolver = namespace ? function(prefix) {
if (prefix == 'x') return namespace; else return null;
} : null;
-
+
+ if (!url) url = doc.documentElement.location;
+ else if (url.match(/\?frame=header/)) {
+ // recall all this using new url
+ url = url.replace(/\?.*/,"?frame=sidebar");
+ Zotero.Utilities.processDocuments(url,
+ function(newdoc) {
+ doWeb(newdoc, url);
+ }, function() {Zotero.done()});
+ Zotero.wait();
+ return true;
+ }
+
var host = 'http://' + doc.location.host + "/";
var arts = new Array();