-Wiley InterScience fixes.

This commit is contained in:
Michael Berkowitz 2008-07-01 18:50:16 +00:00
parent 7d31e7ebcb
commit 36f9213ee2

View File

@ -18171,7 +18171,7 @@ REPLACE INTO translators VALUES ('232903bc-7307-4058-bb1a-27cfe3e4e655', '1.0.0b
Zotero.wait(); Zotero.wait();
}'); }');
REPLACE INTO translators VALUES ('fe728bc9-595a-4f03-98fc-766f1d8d0936', '1.0.0b4.r5', '', '2008-06-30 12:13:10', '1', '100', '4', 'Wiley InterScience', 'Sean Takats and Michael Berkowitz', 'https?:\/\/(?:www3\.|www\.)?interscience\.wiley\.com[^\/]*\/(?:search\/|(cgi-bin|journal)\/[0-9]+\/abstract|journal)', REPLACE INTO translators VALUES ('fe728bc9-595a-4f03-98fc-766f1d8d0936', '1.0.0b4.r5', '', '2008-07-01 14:49:26', '1', '100', '4', 'Wiley InterScience', 'Sean Takats and Michael Berkowitz', 'https?:\/\/(?:www3\.|www\.)?interscience\.wiley\.com[^\/]*\/(?:search\/|(cgi-bin|journal)\/[0-9]+\/abstract|journal)',
'function detectWeb(doc, url){ 'function detectWeb(doc, url){
var namespace = doc.documentElement.namespaceURI; var namespace = doc.documentElement.namespaceURI;
var nsResolver = namespace ? function(prefix) { var nsResolver = namespace ? function(prefix) {
@ -18182,10 +18182,10 @@ REPLACE INTO translators VALUES ('fe728bc9-595a-4f03-98fc-766f1d8d0936', '1.0.0b
if(doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) { if(doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) {
return "multiple"; return "multiple";
} }
if (url.match(/journal\/\d+\/(issue|home)/)) { if (url.match(/journal\/\d+\/(issue|home)$/)) {
return "multiple"; return "multiple";
} }
var m = url.match(/https?:\/\/[^\/]*\/(cgi-bin|journal)(\/(abstract|summary))?\/[0-9]+(\/abstract)?/); var m = url.match(/https?:\/\/[^\/]*\/(cgi-bin|journal)(\/(abstract|summary))?\/[0-9]+\/abstract/);
if (m){ if (m){
return "journalArticle"; return "journalArticle";
} }
@ -18195,7 +18195,8 @@ REPLACE INTO translators VALUES ('fe728bc9-595a-4f03-98fc-766f1d8d0936', '1.0.0b
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 host = ''http://'' + doc.location.host + "/";
Zotero.debug(host);
var m = url.match(/https?:\/\/[^\/]*\/(journal|cgi-bin\/summary)\/([0-9]+)\/(abstract)?/); var m = url.match(/https?:\/\/[^\/]*\/(journal|cgi-bin\/summary)\/([0-9]+)\/(abstract)?/);
var ids = new Array(); var ids = new Array();
if(detectWeb(doc, url) == "multiple") { //search if(detectWeb(doc, url) == "multiple") { //search
@ -18232,17 +18233,11 @@ REPLACE INTO translators VALUES ('fe728bc9-595a-4f03-98fc-766f1d8d0936', '1.0.0b
} else if (m){ //single article } else if (m){ //single article
ids.push(m[2]); ids.push(m[2]);
} }
var hostRe = new RegExp("^http(?:s)?://[^/]+"); for each (id in ids) {
var m = hostRe.exec(doc.location.href); var uri = host + ''tools/citex'';
var host = m[0]; var poststring = "clienttype=1&subtype=1&mode=1&version=1&id=" + id;
var uri = host+"/tools/citex";
var poststring = "";
for each(var id in ids) {
poststring = poststring + "&id=" + id;
}
poststring = "clienttype=1&subtype=1&mode=1&version=1" + poststring;
Zotero.Utilities.HTTP.doPost(uri, poststring, function(text) { Zotero.Utilities.HTTP.doPost(uri, poststring, function(text) {
uri = host+"/tools/CitEx"; uri = host+"tools/CitEx";
poststring = "mode=2&format=3&type=2&file=3&exportCitation.x=16&exportCitation.y=10&exportCitation=submit"; poststring = "mode=2&format=3&type=2&file=3&exportCitation.x=16&exportCitation.y=10&exportCitation=submit";
Zotero.Utilities.HTTP.doPost(uri, poststring, function(text) { Zotero.Utilities.HTTP.doPost(uri, poststring, function(text) {
var m = text.match(/%A\s(.*)/); //following lines fix Wiley''s incorrect %A tag (should be separate tags for each author) var m = text.match(/%A\s(.*)/); //following lines fix Wiley''s incorrect %A tag (should be separate tags for each author)
@ -18260,6 +18255,8 @@ REPLACE INTO translators VALUES ('fe728bc9-595a-4f03-98fc-766f1d8d0936', '1.0.0b
translator.setTranslator("881f60f2-0802-411a-9228-ce5f47b64c7d"); //EndNote/Refer/BibIX translator.setTranslator("881f60f2-0802-411a-9228-ce5f47b64c7d"); //EndNote/Refer/BibIX
translator.setString(text); translator.setString(text);
translator.setHandler("itemDone", function(obj, item) { translator.setHandler("itemDone", function(obj, item) {
var pdfurl = ''http://download.interscience.wiley.com/cgi-bin/fulltext?ID='' + id + ''&PLACEBO=IE.pdf&mode=pdf'';
item.attachments.push({url:pdfurl, title:"Wiley Interscience PDF", mimeType:"application/pdf"});
item.DOI = item.url.match(/\.org\/(.*)$/)[1]; item.DOI = item.url.match(/\.org\/(.*)$/)[1];
item.complete(); item.complete();
}); });
@ -18267,6 +18264,7 @@ REPLACE INTO translators VALUES ('fe728bc9-595a-4f03-98fc-766f1d8d0936', '1.0.0b
Zotero.done(); Zotero.done();
}); });
}); });
};
Zotero.wait(); Zotero.wait();
}'); }');