Fixes Chicago translator to work with proxies, Ancestry.com to download from list view

This commit is contained in:
Elena Razlogova 2008-12-18 14:28:21 +00:00
parent dbb07937f0
commit 9a07d12cdb
2 changed files with 13 additions and 6 deletions

View file

@ -127,7 +127,7 @@ function scrape(doc) {
if(m) {
snapshotURL = "http://search.ancestry.com/cgi-bin/sse.dll?db="+db+"&indiv=1&pf=1&h="+m[1];
newItem.attachments.push({title:"Ancestry.com Snapshot", mimeType:"text/html", url:snapshotURL, snapshot:true});
cleanURL = "http://search.ancestry.com/cgi-bin/sse.dll?indiv=1&db="+db+"&h="+m[1];
cleanURL = "http://search.ancestry.com/cgi-bin/sse.dll?indiv=1&db="+db+"&fh=0&h="+m[1];
newItem.url = cleanURL;
}
@ -203,7 +203,7 @@ function doWeb(doc, url) {
//select items
var items = new Array();
var listElts = doc.evaluate('//div[@class="g_container"]/div[@class="g_panelWrap"]/div[@class="g_panelCore"]/div[@class="s_container"]/div[@class="p_rsltList"]/table/tbody/tr[@class="tblrowalt record"] | //div[@class="g_container"]/div[@class="g_panelWrap"]/div[@class="g_panelCore"]/div[@class="s_container"]/div[@class="p_rsltList"]/table/tbody/tr[@class="tblrow record"]',
var listElts = doc.evaluate('//tr[@class="tblrow record keySelect"] | //tr[@class="tblrow record"] | //tr[@class="tblrowalt record"]',
doc, nsResolver, XPathResult.ANY_TYPE, null);
var recid;
var link;
@ -215,7 +215,7 @@ function doWeb(doc, url) {
if(m) {
recid = m[1];
}
link = "http://search.ancestry.com/cgi-bin/sse.dll?indiv=1&db="+db+"&recid="+recid;
link = "http://search.ancestry.com/cgi-bin/sse.dll?indiv=1&db="+db+"&fh=0&h="+recid;
name = doc.evaluate('.//span[@class="srchHit"]', listElt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
items[link] = Zotero.Utilities.cleanString(name);
}

View file

@ -8,7 +8,7 @@
"maxVersion":"",
"priority":100,
"inRepository":true,
"lastUpdated":"2008-04-28 17:50:00"
"lastUpdated":"2008-12-18 09:26:31"
}
function detectWeb(doc, url) {
@ -25,6 +25,13 @@ function doWeb(doc, url) {
if (prefix == 'x') return namespace; else return null;
} : null;
var proxyURL ="";
var proxyRe = /http:\/\/([^\/]*)/;
var m = proxyRe.exec(doc.location.href);
if(m) {
proxyURL = m[1];
}
var post = "";
var fulltext = new Object();
@ -91,8 +98,8 @@ function doWeb(doc, url) {
translator.setString(text);
translator.setHandler("itemDone", function(obj, item) {
item.attachments = [
{url:item.url, title:"University of Chicago Journals Snapshot", mimeType:"text/html"},
{url:item.url.replace("/doi/abs", "/doi/pdf"), title:"University of Chicago Full Text PDF", mimeType:"application/pdf"}
{url:item.url.replace("www.journals.uchicago.edu", proxyURL), title:"University of Chicago Journals Snapshot", mimeType:"text/html"},
{url:item.url.replace("www.journals.uchicago.edu", proxyURL).replace("/doi/abs", "/doi/pdf"), title:"University of Chicago Full Text PDF", mimeType:"application/pdf"}
];
if (item.notes[0]['note']) item.DOI = Zotero.Utilities.trimInternal(item.notes[0]['note'].substr(4));
item.notes = new Array();