Update SVN translators manually, for now

This commit is contained in:
Dan Stillman 2011-08-11 07:01:19 +00:00
parent b232106526
commit ab43605070
47 changed files with 6513 additions and 3251 deletions

View file

@ -1 +1 @@
2011-04-25 18:05:00
2011-08-03 01:05:00

View file

@ -275,6 +275,9 @@ function scrapeAttachments(doc, url) {
Zotero.debug("Text Page: " + textURL);
attachments.push({title:"ACM Full Text HTML", mimeType:"text/html", url:textURL});
}
// Break at a reasonable limit
if (attachments.length > 20) return attachments;
}
return attachments;

View file

@ -1,19 +1,20 @@
{
"translatorID":"1e1e35be-6264-45a0-ad2e-7212040eb984",
"translatorType":4,
"label":"APA PsycNET",
"creator":"Michael Berkowitz",
"target":"http://psycnet\\.apa\\.org/",
"minVersion":"1.0.0b4.r5",
"maxVersion":"",
"priority":100,
"inRepository":true,
"lastUpdated":"2009-01-08 08:19:07"
"translatorID": "1e1e35be-6264-45a0-ad2e-7212040eb984",
"label": "APA PsycNET",
"creator": "Michael Berkowitz",
"target": "^http://psycnet\\.apa\\.org/",
"minVersion": "2.1",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"lastUpdated": "2011-07-29 01:03:06"
}
function detectWeb(doc, url) {
if (url.match(/search\.searchResults/)) {
return "multiple";
return false;
//return "multiple";
} else if (url.match(/search\.displayRecord/)) {
return "journalArticle";
}
@ -24,12 +25,11 @@ function associateXPath(xpath, doc, ns) {
}
function doWeb(doc, url) {
var namespace = doc.documentElement.namespaceURI;
var nsResolver = namespace ? function(prefix) {
if (prefix == 'x') return namespace; else return null;
} : null;
var arts = new Array();
var namespace = doc.documentElement.namespaceURI;
var nsResolver = namespace ? function(prefix) {
if (prefix == 'x') return namespace; else return null;
} : null;
var arts = new Array();
if (detectWeb(doc, url) == "multiple") {
var items = new Object();
var titles = doc.evaluate('//div[@class="srhcTitle"]/a', doc, nsResolver, XPathResult.ANY_TYPE, null);
@ -41,22 +41,32 @@ function doWeb(doc, url) {
for (var i in items) {
arts.push(i);
}
Zotero.Utilities.processDocuments(arts, scrape, function() {Zotero.done();});
} else {
arts = [url];
scrape(doc);
}
Zotero.Utilities.processDocuments(arts, function(doc) {
Zotero.wait();
}
function scrape (doc) {
var namespace = null;
var newurl = doc.location.href;
if (doc.evaluate('//input[@name="id"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) {
var id = doc.evaluate('//input[@name="id"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().value;
var lstSelectedUIDs = doc.evaluate('//input[@name="lstUIDs"][@id="srhLstUIDs"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().value;
var get = 'http://psycnet.apa.org/index.cfm?fa=search.export&id=' + id + '&lstSelectedUIDs=' + lstSelectedUIDs + '&lstUIDs=&records=selected&displayFormat=&exportFormat=referenceSoftware&printDoc=0';
Zotero.Utilities.HTTP.doGet(get, function(text) {
if (doc.evaluate('//input[@name="id"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
var id = doc.evaluate('//input[@name="id"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext().value;
var lstSelectedUIDs = doc.evaluate('//input[@name="lstUIDs"][@id="srhLstUIDs"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext().value;
var get = 'http://psycnet.apa.org/index.cfm?fa=search.export'
var post = 'id=' + id + '&lstUIDs=' + lstSelectedUIDs + '&lstSelectedUIDs=&records=records&displayFormat=&exportFormat=referenceSoftware&printDoc=0';
// http://psycnet.apa.org/index.cfm?fa=search.exportFormat&singlerecord=1
// id=&lstSelectedUIDs=&lstUIDs=2004-16644-010&records=records&displayFormat=&exportFormat=referenceSoftware&printDoc=0
Zotero.Utilities.HTTP.doPost(get, post, function(text) {
// http://psycnet.apa.org/index.cfm?fa=search.export
var translator = Zotero.loadTranslator("import");
translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7");
translator.setString(text);
//Z.debug(text);
translator.setHandler("itemDone", function(obj, item) {
item.url = newurl;
item.attachments = [{url:newurl, title:"APA PsycNET Snapshot", mimeType:"text/html"}];
//item.url = newurl;
//item.attachments = [{url:newurl, title:"APA PsycNET Snapshot", mimeType:"text/html"}];
item.complete();
});
translator.translate();
@ -77,6 +87,59 @@ function doWeb(doc, url) {
item.abstractNote = associateXPath('//div[@id="rdRecord"]/div[@class="rdRecordSection"][2]', doc, nsResolver);
item.complete();
}
}, function() {Zotero.done();});
Zotero.wait();
}
}/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://psycnet.apa.org/index.cfm?fa=search.displayRecord&uid=2004-16644-010",
"items": [
{
"itemType": "journalArticle",
"creators": [
{
"lastName": "Hervey",
"firstName": "Aaron S.",
"creatorType": "author"
},
{
"lastName": "Epstein",
"firstName": "Jeffery N.",
"creatorType": "author"
},
{
"lastName": "Curry",
"firstName": "John F.",
"creatorType": "author"
}
],
"notes": [],
"tags": [
"attention-deficit/hyperactivity disorder",
"adults",
"behavioral inhibition",
"neuropsychological performance",
"developmental considerations",
"neuropsychological deficits",
"empirical methods"
],
"seeAlso": [],
"attachments": [],
"itemID": "2004-16644-010",
"title": "Neuropsychology of Adults With Attention-Deficit/Hyperactivity Disorder: A Meta-Analytic Review.",
"publicationTitle": "Neuropsychology",
"volume": "18",
"issue": "3",
"pages": "485-503",
"date": "2004",
"publisher": "US: American Psychological Association",
"ISBN": "1931-1559 (Electronic); 0894-4105 (Print)",
"ISSN": "1931-1559 (Electronic); 0894-4105 (Print)",
"abstractNote": "A comprehensive, empirically based review of the published studies addressing neuropsychological performance in adults diagnosed with attention-deficit/hyperactivity disorder (ADHD) was conducted to identify patterns of performance deficits. Findings from 33 published studies were submitted to a meta-analytic procedure producing sample-size-weighted mean effect sizes across test measures. Results suggest that neuropsychological deficits are expressed in adults with ADHD across multiple domains of functioning, with notable impairments in attention, behavioral inhibition, and memory, whereas normal performance is noted in simple reaction time. Theoretical and developmental considerations are discussed, including the role of behavioral inhibition and working memory impairment. Future directions for research based on these findings are highlighted, including further exploration of specific impairments and an emphasis on particular tests and testing conditions. (PsycINFO Database Record (c) 2010 APA, all rights reserved)",
"DOI": "10.1037/0894-4105.18.3.485",
"libraryCatalog": "APA PsycNET",
"shortTitle": "Neuropsychology of Adults With Attention-Deficit/Hyperactivity Disorder"
}
]
}
]
/** END TEST CASES **/

View file

@ -9,14 +9,14 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcs",
"lastUpdated": "2011-07-03 04:56:24"
"lastUpdated": "2011-07-19 00:16:21"
}
function detectWeb(doc, url) {
var suffixRe = new RegExp("https?://(?:www\.)?amazon\.([^/]+)/");
var suffixMatch = suffixRe.exec(url);
var suffix = suffixMatch[1];
var searchRe = new RegExp('^https?://(?:www\.)?amazon\.' + suffix + '/(gp/search/|exec/obidos/search-handle-url/|s/|[^/]+/lm/|gp/richpub/)');
var searchRe = new RegExp('^https?://(?:www\.)?amazon\.' + suffix + '/(gp/search/|exec/obidos/search-handle-url/|s/|s\\?|[^/]+/lm/|gp/richpub/)');
Zotero.debug(searchRe.test(doc.location.href));
if(searchRe.test(doc.location.href)) {
return "multiple";
@ -53,7 +53,7 @@ function doWeb(doc, url) {
var suffixMatch = suffixRe.exec(url);
suffix = suffixMatch[1];
var searchRe = new RegExp('^https?://(?:www\.)?amazon\.' + suffix + '/(gp/search/|exec/obidos/search-handle-url/|s/|[^/]+/lm/|gp/richpub/)');
var searchRe = new RegExp('^https?://(?:www\.)?amazon\.' + suffix + '/(gp/search/|exec/obidos/search-handle-url/|s/|s\\?|[^/]+/lm/|gp/richpub/)');
var m = searchRe.exec(doc.location.href);
var uris = new Array();
if (suffix == "co.jp"){
@ -86,22 +86,22 @@ function doWeb(doc, url) {
i++;
}
} while (elmt = elmts.iterateNext());
Zotero.selectItems(availableItems, function(items) {
if(!items) {
return true;
}
for(var i in items) {
var timestamp = encodeURIComponent(generateISODate());
var params = "AWSAccessKeyId=AKIAIPYIWJ24AGZJ64AA&ItemId=" + Zotero.Utilities.trim(asins[i]) + "&Operation=ItemLookup&ResponseGroup=ItemAttributes&Service=AWSECommerceService&Timestamp="+timestamp+"&Version=2006-06-28";
var signString = "GET\necs.amazonaws."+suffix+"\n/onca/xml\n"+params;
var signature = b64_hmac_sha256("054vk/Lt3LJMxch1srIHUbvI+2T/fZ6E5c0qwlbj", signString);
signature = encodeURIComponent(signature);
uris.push("http://ecs.amazonaws." + suffix + "/onca/xml?"+params+"&Signature="+signature+"%3D"); //wants the %3D for some reason
}
Zotero.Utilities.HTTP.doGet(uris, parseXML, function() {Zotero.done();}, null);
if(!items) {
return true;
}
for(var i in items) {
var timestamp = encodeURIComponent(generateISODate());
var params = "AWSAccessKeyId=AKIAIPYIWJ24AGZJ64AA&ItemId=" + Zotero.Utilities.trim(asins[i]) + "&Operation=ItemLookup&ResponseGroup=ItemAttributes&Service=AWSECommerceService&Timestamp="+timestamp+"&Version=2006-06-28";
var signString = "GET\necs.amazonaws."+suffix+"\n/onca/xml\n"+params;
var signature = b64_hmac_sha256("054vk/Lt3LJMxch1srIHUbvI+2T/fZ6E5c0qwlbj", signString);
signature = encodeURIComponent(signature);
uris.push("http://ecs.amazonaws." + suffix + "/onca/xml?"+params+"&Signature="+signature+"%3D"); //wants the %3D for some reason
}
Zotero.Utilities.HTTP.doGet(uris, parseXML, function() {Zotero.done();}, null);
});
} else {
@ -116,7 +116,7 @@ function doWeb(doc, url) {
var signature = b64_hmac_sha256("054vk/Lt3LJMxch1srIHUbvI+2T/fZ6E5c0qwlbj", signString);
signature = encodeURIComponent(signature);
uris.push("http://ecs.amazonaws." + suffix + "/onca/xml?"+params+"&Signature="+signature+"%3D"); //wants the %3D for some reason
Zotero.Utilities.HTTP.doGet(uris, parseXML, function() {Zotero.done();}, null);
Zotero.Utilities.HTTP.doGet(uris, parseXML, function() {Zotero.done();}, null);
}
Zotero.wait();
}
@ -130,9 +130,9 @@ function parseXML(text) {
var publisher = "";
if (!ZU.xpath(xml, "//Errors").length) {
var publisher = getXPathNodeTrimmed(xml, "Publisher");
var binding = getXPathNodeTrimmed(xml, "Binding");
var productGroup = getXPathNodeTrimmed(xml, "ProductGroup");
var publisher = getXPathNodeTrimmed(xml, "Publisher");
var binding = getXPathNodeTrimmed(xml, "Binding");
var productGroup = getXPathNodeTrimmed(xml, "ProductGroup");
if (productGroup=="Book") {
var newItem = new Zotero.Item("book");
@ -142,46 +142,46 @@ function parseXML(text) {
var newItem = new Zotero.Item("audioRecording");
newItem.label = publisher;
newItem.audioRecordingType = binding;
getCreatorNodes(xml, "Artist", newItem, "performer");
getCreatorNodes(xml, "Artist", newItem, "performer");
}
else if (productGroup == "DVD" | productGroup == "Video") {
var newItem = new Zotero.Item("videoRecording");
newItem.studio = publisher;
newItem.videoRecordingType = binding;
getCreatorNodes(xml, "Actor", newItem, "castMember");
getCreatorNodes(xml, "Director", newItem, "director");
getCreatorNodes(xml, "Actor", newItem, "castMember");
getCreatorNodes(xml, "Director", newItem, "director");
}
else{
var newItem = new Zotero.Item("book");
newItem.publisher = publisher;
}
newItem.runningTime = getXPathNodeTrimmed(xml, "RunningTime");
newItem.runningTime = getXPathNodeTrimmed(xml, "RunningTime");
// Retrieve authors and other creators
getCreatorNodes(xml, "Author", newItem, "author");
getCreatorNodes(xml, "Author", newItem, "author");
if (newItem.creators.length == 0){
getCreatorNodes(xml, "Creator", newItem, "author");
getCreatorNodes(xml, "Creator", newItem, "author");
}
newItem.date = getXPathNodeTrimmed(xml, "PublicationDate");
newItem.date = getXPathNodeTrimmed(xml, "PublicationDate");
if (!newItem.date){
newItem.date = getXPathNodeTrimmed(xml, "ReleaseDate");
}
newItem.edition = getXPathNodeTrimmed(xml, "Edition");
newItem.ISBN = getXPathNodeTrimmed(xml, "ISBN");
newItem.numPages = getXPathNodeTrimmed(xml, "NumberOfPages");
newItem.edition = getXPathNodeTrimmed(xml, "Edition");
newItem.ISBN = getXPathNodeTrimmed(xml, "ISBN");
newItem.numPages = getXPathNodeTrimmed(xml, "NumberOfPages");
var title = getXPathNodeTrimmed(xml, "Title");
if(title.lastIndexOf("(") != -1 && title.lastIndexOf(")") == title.length-1) {
title = title.substring(0, title.lastIndexOf("(")-1);
}
var ASIN = getXPathNodeTrimmed(xml, "ASIN");
var ASIN = getXPathNodeTrimmed(xml, "ASIN");
if (ASIN){
var url = "http://www.amazon." + suffix + "/dp/" + ASIN;
newItem.attachments.push({title:"Amazon.com Link", snapshot:false, mimeType:"text/html", url:url});
}
newItem.extra = getXPathNodeTrimmed(xml, "OriginalReleaseDate");
newItem.extra = getXPathNodeTrimmed(xml, "OriginalReleaseDate");
newItem.title = title;
newItem.complete();
@ -190,15 +190,15 @@ function parseXML(text) {
function getXPathNodeTrimmed(xml, name) {
var node = ZU.xpath(xml, "//"+name);
var val = "";
if(node.length){
var val = "";
if(node.length){
val = Zotero.Utilities.trimInternal(node[0].textContent);
}
return val;
return val;
}
function getCreatorNodes(xml, name, newItem, creatorType) {
var nodes = ZU.xpath(xml, "//"+name);
var nodes = ZU.xpath(xml, "//"+name);
for(var i=0; i<nodes.length; i++) {
newItem.creators.push(Zotero.Utilities.cleanAuthor(nodes[i].textContent, creatorType));
}
@ -247,7 +247,7 @@ function any_hmac_sha256(k, d, e)
function sha256_vm_test()
{
return hex_sha256("abc").toLowerCase() ==
"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad";
"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad";
}
/*
@ -269,8 +269,8 @@ function rstr_hmac_sha256(key, data)
var ipad = Array(16), opad = Array(16);
for(var i = 0; i < 16; i++)
{
ipad[i] = bkey[i] ^ 0x36363636;
opad[i] = bkey[i] ^ 0x5C5C5C5C;
ipad[i] = bkey[i] ^ 0x36363636;
opad[i] = bkey[i] ^ 0x5C5C5C5C;
}
var hash = binb_sha256(ipad.concat(rstr2binb(data)), 512 + data.length * 8);
@ -288,9 +288,9 @@ function rstr2hex(input)
var x;
for(var i = 0; i < input.length; i++)
{
x = input.charCodeAt(i);
output += hex_tab.charAt((x >>> 4) & 0x0F)
+ hex_tab.charAt( x & 0x0F);
x = input.charCodeAt(i);
output += hex_tab.charAt((x >>> 4) & 0x0F)
+ hex_tab.charAt( x & 0x0F);
}
return output;
}
@ -306,14 +306,14 @@ function rstr2b64(input)
var len = input.length;
for(var i = 0; i < len; i += 3)
{
var triplet = (input.charCodeAt(i) << 16)
| (i + 1 < len ? input.charCodeAt(i+1) << 8 : 0)
| (i + 2 < len ? input.charCodeAt(i+2) : 0);
for(var j = 0; j < 4; j++)
{
if(i * 8 + j * 6 > input.length * 8) output += b64pad;
else output += tab.charAt((triplet >>> 6*(3-j)) & 0x3F);
}
var triplet = (input.charCodeAt(i) << 16)
| (i + 1 < len ? input.charCodeAt(i+1) << 8 : 0)
| (i + 2 < len ? input.charCodeAt(i+2) : 0);
for(var j = 0; j < 4; j++)
{
if(i * 8 + j * 6 > input.length * 8) output += b64pad;
else output += tab.charAt((triplet >>> 6*(3-j)) & 0x3F);
}
}
return output;
}
@ -331,7 +331,7 @@ function rstr2any(input, encoding)
var dividend = Array(Math.ceil(input.length / 2));
for(i = 0; i < dividend.length; i++)
{
dividend[i] = (input.charCodeAt(i * 2) << 8) | input.charCodeAt(i * 2 + 1);
dividend[i] = (input.charCodeAt(i * 2) << 8) | input.charCodeAt(i * 2 + 1);
}
/*
@ -342,30 +342,30 @@ function rstr2any(input, encoding)
*/
while(dividend.length > 0)
{
quotient = Array();
x = 0;
for(i = 0; i < dividend.length; i++)
{
x = (x << 16) + dividend[i];
q = Math.floor(x / divisor);
x -= q * divisor;
if(quotient.length > 0 || q > 0)
quotient[quotient.length] = q;
}
remainders[remainders.length] = x;
dividend = quotient;
quotient = Array();
x = 0;
for(i = 0; i < dividend.length; i++)
{
x = (x << 16) + dividend[i];
q = Math.floor(x / divisor);
x -= q * divisor;
if(quotient.length > 0 || q > 0)
quotient[quotient.length] = q;
}
remainders[remainders.length] = x;
dividend = quotient;
}
/* Convert the remainders to the output string */
var output = "";
for(i = remainders.length - 1; i >= 0; i--)
output += encoding.charAt(remainders[i]);
output += encoding.charAt(remainders[i]);
/* Append leading zero equivalents */
var full_length = Math.ceil(input.length * 8 /
(Math.log(encoding.length) / Math.log(2)))
(Math.log(encoding.length) / Math.log(2)))
for(i = output.length; i < full_length; i++)
output = encoding[0] + output;
output = encoding[0] + output;
return output;
}
@ -382,30 +382,30 @@ function str2rstr_utf8(input)
while(++i < input.length)
{
/* Decode utf-16 surrogate pairs */
x = input.charCodeAt(i);
y = i + 1 < input.length ? input.charCodeAt(i + 1) : 0;
if(0xD800 <= x && x <= 0xDBFF && 0xDC00 <= y && y <= 0xDFFF)
{
x = 0x10000 + ((x & 0x03FF) << 10) + (y & 0x03FF);
i++;
}
/* Decode utf-16 surrogate pairs */
x = input.charCodeAt(i);
y = i + 1 < input.length ? input.charCodeAt(i + 1) : 0;
if(0xD800 <= x && x <= 0xDBFF && 0xDC00 <= y && y <= 0xDFFF)
{
x = 0x10000 + ((x & 0x03FF) << 10) + (y & 0x03FF);
i++;
}
/* Encode output as utf-8 */
if(x <= 0x7F)
output += String.fromCharCode(x);
else if(x <= 0x7FF)
output += String.fromCharCode(0xC0 | ((x >>> 6 ) & 0x1F),
0x80 | ( x & 0x3F));
else if(x <= 0xFFFF)
output += String.fromCharCode(0xE0 | ((x >>> 12) & 0x0F),
0x80 | ((x >>> 6 ) & 0x3F),
0x80 | ( x & 0x3F));
else if(x <= 0x1FFFFF)
output += String.fromCharCode(0xF0 | ((x >>> 18) & 0x07),
0x80 | ((x >>> 12) & 0x3F),
0x80 | ((x >>> 6 ) & 0x3F),
0x80 | ( x & 0x3F));
/* Encode output as utf-8 */
if(x <= 0x7F)
output += String.fromCharCode(x);
else if(x <= 0x7FF)
output += String.fromCharCode(0xC0 | ((x >>> 6 ) & 0x1F),
0x80 | ( x & 0x3F));
else if(x <= 0xFFFF)
output += String.fromCharCode(0xE0 | ((x >>> 12) & 0x0F),
0x80 | ((x >>> 6 ) & 0x3F),
0x80 | ( x & 0x3F));
else if(x <= 0x1FFFFF)
output += String.fromCharCode(0xF0 | ((x >>> 18) & 0x07),
0x80 | ((x >>> 12) & 0x3F),
0x80 | ((x >>> 6 ) & 0x3F),
0x80 | ( x & 0x3F));
}
return output;
}
@ -417,8 +417,8 @@ function str2rstr_utf16le(input)
{
var output = "";
for(var i = 0; i < input.length; i++)
output += String.fromCharCode( input.charCodeAt(i) & 0xFF,
(input.charCodeAt(i) >>> 8) & 0xFF);
output += String.fromCharCode( input.charCodeAt(i) & 0xFF,
(input.charCodeAt(i) >>> 8) & 0xFF);
return output;
}
@ -426,8 +426,8 @@ function str2rstr_utf16be(input)
{
var output = "";
for(var i = 0; i < input.length; i++)
output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xFF,
input.charCodeAt(i) & 0xFF);
output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xFF,
input.charCodeAt(i) & 0xFF);
return output;
}
@ -439,9 +439,9 @@ function rstr2binb(input)
{
var output = Array(input.length >> 2);
for(var i = 0; i < output.length; i++)
output[i] = 0;
output[i] = 0;
for(var i = 0; i < input.length * 8; i += 8)
output[i>>5] |= (input.charCodeAt(i / 8) & 0xFF) << (24 - i % 32);
output[i>>5] |= (input.charCodeAt(i / 8) & 0xFF) << (24 - i % 32);
return output;
}
@ -452,7 +452,7 @@ function binb2rstr(input)
{
var output = "";
for(var i = 0; i < input.length * 32; i += 8)
output += String.fromCharCode((input[i>>5] >>> (24 - i % 32)) & 0xFF);
output += String.fromCharCode((input[i>>5] >>> (24 - i % 32)) & 0xFF);
return output;
}
@ -490,7 +490,7 @@ var sha256_K = new Array
function binb_sha256(m, l)
{
var HASH = new Array(1779033703, -1150833019, 1013904242, -1521486534,
1359893119, -1694144372, 528734635, 1541459225);
1359893119, -1694144372, 528734635, 1541459225);
var W = new Array(64);
var a, b, c, d, e, f, g, h;
var i, j, T1, T2;
@ -501,42 +501,42 @@ function binb_sha256(m, l)
for(i = 0; i < m.length; i += 16)
{
a = HASH[0];
b = HASH[1];
c = HASH[2];
d = HASH[3];
e = HASH[4];
f = HASH[5];
g = HASH[6];
h = HASH[7];
a = HASH[0];
b = HASH[1];
c = HASH[2];
d = HASH[3];
e = HASH[4];
f = HASH[5];
g = HASH[6];
h = HASH[7];
for(j = 0; j < 64; j++)
{
if (j < 16) W[j] = m[j + i];
else W[j] = safe_add(safe_add(safe_add(sha256_Gamma1256(W[j - 2]), W[j - 7]),
sha256_Gamma0256(W[j - 15])), W[j - 16]);
for(j = 0; j < 64; j++)
{
if (j < 16) W[j] = m[j + i];
else W[j] = safe_add(safe_add(safe_add(sha256_Gamma1256(W[j - 2]), W[j - 7]),
sha256_Gamma0256(W[j - 15])), W[j - 16]);
T1 = safe_add(safe_add(safe_add(safe_add(h, sha256_Sigma1256(e)), sha256_Ch(e, f, g)),
sha256_K[j]), W[j]);
T2 = safe_add(sha256_Sigma0256(a), sha256_Maj(a, b, c));
h = g;
g = f;
f = e;
e = safe_add(d, T1);
d = c;
c = b;
b = a;
a = safe_add(T1, T2);
}
T1 = safe_add(safe_add(safe_add(safe_add(h, sha256_Sigma1256(e)), sha256_Ch(e, f, g)),
sha256_K[j]), W[j]);
T2 = safe_add(sha256_Sigma0256(a), sha256_Maj(a, b, c));
h = g;
g = f;
f = e;
e = safe_add(d, T1);
d = c;
c = b;
b = a;
a = safe_add(T1, T2);
}
HASH[0] = safe_add(a, HASH[0]);
HASH[1] = safe_add(b, HASH[1]);
HASH[2] = safe_add(c, HASH[2]);
HASH[3] = safe_add(d, HASH[3]);
HASH[4] = safe_add(e, HASH[4]);
HASH[5] = safe_add(f, HASH[5]);
HASH[6] = safe_add(g, HASH[6]);
HASH[7] = safe_add(h, HASH[7]);
HASH[0] = safe_add(a, HASH[0]);
HASH[1] = safe_add(b, HASH[1]);
HASH[2] = safe_add(c, HASH[2]);
HASH[3] = safe_add(d, HASH[3]);
HASH[4] = safe_add(e, HASH[4]);
HASH[5] = safe_add(f, HASH[5]);
HASH[6] = safe_add(g, HASH[6]);
HASH[7] = safe_add(h, HASH[7]);
}
return HASH;
}
@ -617,7 +617,7 @@ var testCases = [
],
"label": "Sire / London/Rhino",
"audioRecordingType": "Audio CD",
"date": "1991",
"date": "1991-11-05",
"extra": "1991-11-05",
"title": "Loveless",
"libraryCatalog": "Amazon.com"
@ -663,6 +663,11 @@ var testCases = [
"libraryCatalog": "Amazon.com"
}
]
},
{
"type": "web",
"url": "http://www.amazon.com/s?ie=UTF8&keywords=The%20Harvard%20Concise%20Dictionary%20of%20Music%20and%20Musicians&index=blended&Go=o",
"items": "multiple"
}
]
/** END TEST CASES **/
/** END TEST CASES **/

File diff suppressed because it is too large Load diff

View file

@ -7,10 +7,11 @@
"minVersion":"2.0",
"maxVersion":"",
"priority":50,
"browserSupport":"gcs",
"configOptions":{"getCollections":"true", "dataMode":"rdf/xml"},
"displayOptions":{"exportNotes":true, "exportFileData":false},
"inRepository":false,
"lastUpdated":"2011-02-22 00:39:57"
"lastUpdated":"2011-07-08 04:50:39"
}
var n = {
@ -233,11 +234,19 @@ var FIELDS = {
"assignee": [ITEM, n.z+"assignee"], // TODO
"priorityNumbers": [function(item) { // TODO
var priorityNumbers = item.priorityNumbers.split(/, ?| /g);
return [[ITEM, n.z+"priorityNumber", number, true] for each(number in priorityNumbers)];
var returnNumbers = [];
for each(var number in priorityNumbers) {
returnNumbers.push([ITEM, n.z+"priorityNumber", number, true]);
}
return returnNumbers;
}, function(nodes) {
var statements = Zotero.RDF.getStatementsMatching(nodes[ITEM], n.z+"priorityNumber", null);
if(!statements) return false;
return [statement[2] for each(statement in statements)].join(", ");
var predicates = [];
for each(var statement in statements) {
predicates.push(statement[2]);
}
return predicates.join(", ");
}],
"references": [ITEM, n.z+"references"],
"legalStatus": [ITEM, n.bibo+"status"],
@ -332,7 +341,9 @@ function getBlankNode(attachToNode, itemPredicate, blankNodePairs, create) {
if(!blankNode && create) {
blankNode = Zotero.RDF.newResource();
Zotero.RDF.addStatement(attachToNode, itemPredicate, blankNode, false);
[Zotero.RDF.addStatement(blankNode, pair[0], pair[1], false) for each(pair in blankNodePairs)];
for each(var pair in blankNodePairs) {
Zotero.RDF.addStatement(blankNode, pair[0], pair[1], false);
}
}
return blankNode;
@ -362,7 +373,11 @@ Type.prototype.getMatchScore = function(node) {
var nodes = {2:node};
// check item (+2 for each match, -1 for each nonmatch)
var score = 3*[true for each(pair in this[ITEM].pairs) if(Zotero.RDF.getStatementsMatching(node, pair[0], pair[1]))].length-this[ITEM].pairs.length;
var score = -this[ITEM].pairs.length;
for each(var pair in this[ITEM].pairs) {
if(Zotero.RDF.getStatementsMatching(node, pair[0], pair[1])) score += 3;
}
// check subcontainer
[score, nodes[SUBCONTAINER]] = this._scoreNodeRelationship(node, this[SUBCONTAINER], score);
// check container
@ -387,7 +402,11 @@ Type.prototype._scoreNodeRelationship = function(node, definition, score) {
var bestScore = -9999;
for each(var statement in statements) {
// +2 for each match, -1 for each nonmatch
var testScore = 3*[true for each(pair in definition.pairs) if(Zotero.RDF.getStatementsMatching(statement[2], pair[0], pair[1]))].length-definition.pairs.length;
var testScore = -definition.pairs.length;
for each(var pair in definition.pairs) {
if(Zotero.RDF.getStatementsMatching(statement[2], pair[0], pair[1])) score += 3;
}
if(testScore > bestScore) {
subNode = statement[2];
bestScore = testScore;
@ -414,17 +433,17 @@ Type.prototype.getItemSeriesNodes = function(nodes) {
// get ITEM_SERIES node
var score, subNode;
[score, subNode] = this._scoreNodeRelationship(nodes[ITEM], seriesDefinition, 0);
Zotero.debug("got itemSeries with score "+score);
//Zotero.debug("got itemSeries with score "+score);
if(score >= 1) nodes[ITEM_SERIES] = subNode;
// get SUBCONTAINER_SERIES node
[score, subNode] = this._scoreNodeRelationship(nodes[SUBCONTAINER], seriesDefinition, 0);
Zotero.debug("got subcontainerSeries with score "+score);
//Zotero.debug("got subcontainerSeries with score "+score);
if(score >= 1) nodes[CONTAINER_SERIES] = subNode;
// get CONTAINER_SERIES node
[score, subNode] = this._scoreNodeRelationship(nodes[CONTAINER], seriesDefinition, 0);
Zotero.debug("got containerSeries with score "+score);
//Zotero.debug("got containerSeries with score "+score);
if(score >= 1) nodes[CONTAINER_SERIES] = subNode;
}
@ -462,8 +481,9 @@ Type.prototype.addNodeRelations = function(nodes) {
}
// add type
[Zotero.RDF.addStatement(nodes[i], pair[0], pair[1], false)
for each(pair in this[i].pairs)];
for each(var pair in this[i].pairs) {
Zotero.RDF.addStatement(nodes[i], pair[0], pair[1], false)
}
// add relation to parent
for(var j = i-1; j>1; j--) {
@ -541,7 +561,7 @@ LiteralProperty = function(field) {
this.field = field;
this.mapping = FIELDS[field];
if(!this.mapping) {
Zotero.debug("WARNING: unrecognized field "+field+" in Bibliontology RDF; mapping to Zotero namespace");
//Zotero.debug("WARNING: unrecognized field "+field+" in Bibliontology RDF; mapping to Zotero namespace");
this.mapping = [ITEM, n.z+field];
}
}
@ -560,7 +580,12 @@ LiteralProperty.prototype.mapToItem = function(newItem, nodes) {
if(!node) return false;
var statements = getStatementsByDefinition(this.mapping[1], node);
if(!statements) return false;
newItem[this.field] = [stmt[2].toString() for each(stmt in statements)].join(", ");
var content = [];
for each(var stmt in statements) {
content.push(stmt[2].toString());
}
newItem[this.field] = content.join(",");
}
return true;
}
@ -571,8 +596,9 @@ LiteralProperty.prototype.mapToItem = function(newItem, nodes) {
LiteralProperty.prototype.mapFromItem = function(item, nodes) {
if(typeof this.mapping[0] == "function") { // function case: triples returned
// check function case
[Zotero.RDF.addStatement(nodes[triple[0]], triple[1], triple[2], triple[3])
for each(triple in this.mapping[0](item))];
for each(var triple in this.mapping[0](item)) {
Zotero.RDF.addStatement(nodes[triple[0]], triple[1], triple[2], triple[3])
}
} else if(typeof this.mapping[1] == "string") { // string case: simple predicate
Zotero.RDF.addStatement(nodes[this.mapping[0]],
this.mapping[1], item.uniqueFields[this.field], true);
@ -595,7 +621,7 @@ CreatorProperty = function(field) {
* Maps creator from an foaf:Agent
*/
CreatorProperty.prototype.mapToCreator = function(creatorNode, zoteroType) {
Zotero.debug("mapping "+Zotero.RDF.getResourceURI(creatorNode)+" to a creator");
//Zotero.debug("mapping "+Zotero.RDF.getResourceURI(creatorNode)+" to a creator");
var lastNameStmt = Zotero.RDF.getStatementsMatching(creatorNode, n.foaf+"surname", null);
if(lastNameStmt) { // look for a person with a last name
creator = {lastName:lastNameStmt[0][2].toString()};
@ -606,7 +632,7 @@ CreatorProperty.prototype.mapToCreator = function(creatorNode, zoteroType) {
if(nameStmt) { // an organization
creator = {lastName:nameStmt[0][2].toString(), fieldMode:1};
} else { // an unnamed entity; ignore it
Zotero.debug("Dropping unnamed creator "+creatorNode.toString());
//Zotero.debug("Dropping unnamed creator "+creatorNode.toString());
return false;
}
}
@ -661,7 +687,7 @@ CreatorProperty.prototype.mapFromCreator = function(item, creator, nodes) {
// treat other primary creators as dcterms:creators
var mapping = CREATORS["author"];
} else {
Zotero.debug("WARNING: unrecognized creator type "+this.field+" in Bibliontology RDF; mapping to Zotero namespace");
//Zotero.debug("WARNING: unrecognized creator type "+this.field+" in Bibliontology RDF; mapping to Zotero namespace");
var mapping = [ITEM, AUTHOR_LIST, n.z+this.field];
}
}
@ -829,7 +855,7 @@ function doImport() {
for each(var type in collapsedTypes[rdfType[2].uri]) {
[score, nodes] = type.getMatchScore(itemNode);
Zotero.debug("Type "+type.zoteroType+" has score "+score);
//Zotero.debug("Type "+type.zoteroType+" has score "+score);
// check if this is the best we can do
if(score > bestTypeScore) {
@ -842,11 +868,11 @@ function doImport() {
// skip if this doesn't fit any type very well
if(bestTypeScore < 1) {
Zotero.debug("No good type mapping; best type was "+bestType.zoteroType+" with score "+bestTypeScore);
//Zotero.debug("No good type mapping; best type was "+bestType.zoteroType+" with score "+bestTypeScore);
continue;
}
Zotero.debug("Got item of type "+bestType.zoteroType+" with score "+bestTypeScore);
//Zotero.debug("Got item of type "+bestType.zoteroType+" with score "+bestTypeScore);
nodes = bestNodes;
bestType.getItemSeriesNodes(nodes);
@ -863,7 +889,7 @@ function doImport() {
// only handle each property once
if(propertiesHandled[property]) continue;
propertiesHandled[property] = true;
Zotero.debug("handling "+property);
//Zotero.debug("handling "+property);
var propertyMappings = collapsedProperties[i][property];
if(propertyMappings) {
@ -941,13 +967,13 @@ function doImport() {
} else {
// creator not already processed, use default for this list type
if(j == AUTHOR_LIST) {
Zotero.debug("WARNING: creator in authorList lacks relationship to item in Bibliontology RDF; treating as primary creator");
//Zotero.debug("WARNING: creator in authorList lacks relationship to item in Bibliontology RDF; treating as primary creator");
var prop = new CreatorProperty("author");
} else if(j == EDITOR_LIST) {
Zotero.debug("WARNING: creator in editorList lacks relationship to item in Bibliontology RDF; treating as editor");
//Zotero.debug("WARNING: creator in editorList lacks relationship to item in Bibliontology RDF; treating as editor");
var prop = new CreatorProperty("editor");
} else {
Zotero.debug("WARNING: creator in contributorList lacks relationship to item in Bibliontology RDF; treating as contributor");
//Zotero.debug("WARNING: creator in contributorList lacks relationship to item in Bibliontology RDF; treating as contributor");
var prop = new CreatorProperty("contributor");
}
var creator = prop.mapToCreator(creatorNode, zoteroType);
@ -975,7 +1001,7 @@ var usedURIs = {};
function doExport() {
// add namespaces
[Zotero.RDF.addNamespace(i, n[i]) for(i in n)];
for(var i in n) Zotero.RDF.addNamespace(i, n[i]);
// compile references and create URIs
var item;
@ -999,7 +1025,7 @@ function doExport() {
var property = new LiteralProperty(field);
property.mapFromItem(item, nodes);
}
Zotero.debug("fields added");
//Zotero.debug("fields added");
// add creators
var creatorLists = [];
@ -1008,7 +1034,7 @@ function doExport() {
var property = new CreatorProperty(creator.creatorType);
property.mapFromCreator(item, creator, nodes);
}
Zotero.debug("creators added");
//Zotero.debug("creators added");
// add tags
for each(var tag in item.tags) {
@ -1028,6 +1054,6 @@ function doExport() {
}
type.addNodeRelations(nodes);
Zotero.debug("relations added");
//Zotero.debug("relations added");
}
}

View file

@ -1,14 +1,15 @@
{
"translatorID":"4e7119e0-02be-4848-86ef-79a64185aad8",
"translatorType":3,
"label":"Bookmarks",
"creator":"Avram Lyon",
"target":"html",
"minVersion":"2.1b6",
"maxVersion":"",
"priority":100,
"inRepository":true,
"lastUpdated":"2011-03-16 23:24:54"
"translatorID": "4e7119e0-02be-4848-86ef-79a64185aad8",
"label": "Bookmarks",
"creator": "Avram Lyon",
"target": "html",
"minVersion": "2.1b6",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 3,
"browserSupport": "gscn",
"lastUpdated": "2011-07-09 18:52:34"
}
/*
@ -72,34 +73,71 @@ function doImport() {
var hits;
var item = false;
var itemIncomplete = false;
var collection = false;
var re = /([A-Za-z_]+)="([^"]+)"/g;
while((line = Zotero.read()) !== false) {
if (line.indexOf("<DT>") !== -1) {
if (line.indexOf("<DT>") !== -1 && line.indexOf("<A") !== -1) {
if (itemIncomplete) item.complete();
itemIncomplete = true;
//Zotero.debug(line);
item = new Zotero.Item("webpage");
if (collection) collection.children.push(item);
item.title = line.match(/>([^<]*)<\/A>/)[1];
Zotero.debug(item.title);
//Zotero.debug(item.title);
while(hits = re.exec(line)) {
if (!hits) { Zotero.debug("RE no match in "+line);
if (!hits) {
Zotero.debug("RE no match in "+line);
continue;
}
switch (hits[1]) {
case "HREF": item.url = hits[2]; break;
case "HREF": item.url = hits[2];
break;
case "TAGS": item.tags = hits[2].split(','); break;
case "ICON": break;
case "ICON_URI": break;
case "ADD_DATE":
item.accessDate = convertDate(hits[2]);
break;
default: item.extra = item.extra ? item.extra + "; "+ [hits[1], hits[2]].join("=") :
[hits[1], hits[2]].join("=");
}
}
if (item.url.match(/^place:/)) {
item = false;
itemIncomplete = false;
}
} else if (line.indexOf("<DT>") !== -1 && line.indexOf("<H3") !== -1) {
if (collection) {
collection.complete();
}
collection = new Zotero.Collection();
collection.name = Zotero.Utilities.unescapeHTML(line.match(/<H3[^>]*>([^<]*)<\/H3>/i)[1]);
Zotero.debug("Starting collection: "+ collection.name);
collection.type = "collection";
collection.children = new Array();
} else if (line.substr(0,4) == "<DD>") {
if (itemIncomplete) item.abstractNote = item.abstractNote ? item.abstractNote + " " + line.substr(4) : line.substr(4);
else Zotero.debug("Discarding description line without item: " + line);
} else {
Zotero.debug("Discarding line: " + line);
//Zotero.debug("Discarding line: " + line);
}
}
if (item && itemIncomplete) item.complete();
if (collection) collection.complete();
}
function convertDate(timestamp){
var d = new Date(timestamp*1000);
function pad(n){return n<10 ? '0'+n : n};
return d.getUTCFullYear()+'-'
+ pad(d.getUTCMonth()+1)+'-'
+ pad(d.getUTCDate())+' '
+ pad(d.getUTCHours())+':'
+ pad(d.getUTCMinutes())+':'
+ pad(d.getUTCSeconds())+' UTC';
}
function doExport() {
var item;
@ -124,3 +162,8 @@ function doExport() {
}
Zotero.write(footer);
}
/** BEGIN TEST CASES **/
var testCases = []
/** END TEST CASES **/

View file

@ -7,7 +7,7 @@
"minVersion":"2.0",
"maxVersion":"",
"priority":100,
"configOptions":{"getCollections":"true", "dataMode":"line"},
"configOptions":{"dataMode":"line"},
"inRepository":false,
"lastUpdated":"2011-01-11 04:31:00"
}

View file

@ -1,14 +1,14 @@
{
"translatorID":"850f4c5f-71fb-4669-b7da-7fb7a95500ef",
"translatorType":4,
"label":"Cambridge Journals Online",
"creator":"Sean Takats and Michael Berkowitz",
"target":"https?://[^/]*journals.cambridge.org[^/]*//?action/(quickSearch|search|displayAbstract|displayFulltext|displayIssue)",
"minVersion":"1.0.0b3r1",
"maxVersion":"",
"priority":100,
"inRepository":true,
"lastUpdated":"2009-01-08 08:19:07"
"translatorID": "850f4c5f-71fb-4669-b7da-7fb7a95500ef",
"label": "Cambridge Journals Online",
"creator": "Sean Takats, Michael Berkowitz and Avram Lyon",
"target": "^https?://[^/]*journals.cambridge.org[^/]*//?action/(quickSearch|search|displayAbstract|displayFulltext|displayIssue)",
"minVersion": "2.1",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"lastUpdated": "2011-07-26 01:43:28"
}
function detectWeb(doc, url) {
@ -16,7 +16,7 @@ function detectWeb(doc, url) {
var nsResolver=namespace?function(prefix) {
return (prefix=="x")?namespace:null;
}:null;
var xpath = '//tr[td/input[@type="checkbox"][@name="toView"]]';
var xpath = '//div[@class="tableofcontents-row"][div/input[@type="checkbox"][@name="toView"]]';
if ((url.indexOf("/action/displayAbstract") != -1) || (url.indexOf("action/displayFulltext") != -1)){
return "journalArticle";
} else if (doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()){
@ -34,57 +34,150 @@ function doWeb(doc, url){
var datastring="format=RIS&emailId=&Download=Download&componentIds=";
var links = new Array();
if(detectWeb(doc, url) == "multiple"){
var xpath = '//tr[td/input[@type="checkbox"][@name="toView"]]';
var xpath = '//div[@class="tableofcontents-row"][div/input[@type="checkbox"][@name="toView"]]';
var tableRows = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null);
var tableRow;
var items=new Array();
while (tableRow = tableRows.iterateNext()){
var id = doc.evaluate('./td/input[@type="checkbox"][@name="toView"]/@value', tableRow, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
var title = doc.evaluate('./td/h3', tableRow, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
var id = doc.evaluate('./div/input[@type="checkbox"][@name="toView"]/@value', tableRow, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
var title = doc.evaluate('.//h3', tableRow, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
items['http://' + host + '/action/displayAbstract?aid=' + id.nodeValue] = Zotero.Utilities.capitalizeTitle(title.textContent);
}
items=Zotero.selectItems(items);
for (var i in items) {
links.push(i);
}
Zotero.selectItems(items, function(items) {
for (var i in items) {
links.push(i);
}
Zotero.Utilities.processDocuments(links, scrape,
function() {Zotero.done();});
});
} else {
links = [url];
scrape(doc);
}
Zotero.Utilities.processDocuments(links, function(doc) {
if (doc.evaluate('//p[@class="AbsType"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) {
var abs = doc.evaluate('//p[@class="AbsType"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
Zotero.wait();
}
function scrape (doc) {
var namespace=doc.documentElement.namespaceURI;
var nsResolver=namespace?function(prefix) {
return (prefix=="x")?namespace:null;
}:null;
var host = doc.location.host;
var urlstring="http://" + host + "/action/exportCitation";
var datastring="format=RIS&emailId=&Download=Download&componentIds=";
var locURL = doc.location.href;
var abs;
if (abs = doc.evaluate('//p[@class="section-title" and contains(text(),"Abstract")]/following-sibling::p[not(@class) and text() != ""]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) {
abs = abs.textContent;
}
if (doc.evaluate('//p[@class="KeyWords"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) {
var kws = doc.evaluate('//p[@class="KeyWords"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent.substr(11).split('; ');
}
var pdfpath='//div/ul/li/a[contains(text(), "PDF")]';
if (doc.evaluate(pdfpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) {
var pdflink =doc.evaluate(pdfpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().href;
var pdflink = doc.evaluate(pdfpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().href;
}
idRe = /aid=([0-9]+)/
var m = idRe.exec(doc.location.href);
var m = idRe.exec(locURL);
var id = m[1];
Zotero.Utilities.HTTP.doGet(urlstring + "?" + datastring+id, function(text) {
Zotero.Utilities.doGet(urlstring + "?" + datastring+id, function(text) {
text = text.replace(/(^|\n)?([A-Z\d]{2})\s+\-\s+(\n)?/g, "\n$2 - $3");
var translator = Zotero.loadTranslator("import");
// Use RIS importer
translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7");
translator.setString(text);
translator.setHandler("itemDone", function(obj, item) {
item.attachments = [{url:url, title:"Cambridge Journals Snapshot", mimeType:"text/html"}]
if (pdflink) item.attachments.push({url:pdflink, title:"Cambridge Journals PDF", mimeType:"application/pdf"});
item.url = url;
item.attachments = [{url:locURL,
title:"Cambridge Journals Snapshot",
mimeType:"text/html"}];
item.title = Zotero.Utilities.capitalizeTitle(item.title);
var authors = item.creators;
item.creators = new Array();
for each (var aut in authors) {
item.creators.push({firstName:aut.firstName, lastName:aut.lastName, creatorType:"author"});
// correct all-caps, if present
if (aut.firstName && aut.firstName.toUpperCase() == aut.firstName)
aut.firstName=Zotero.Utilities.capitalizeTitle(aut.firstName.toLowerCase(),true);
if (aut.lastName && aut.lastName.toUpperCase() == aut.lastName)
aut.lastName=Zotero.Utilities.capitalizeTitle(aut.lastName.toLowerCase(),true);
item.creators.push({firstName:aut.firstName,
lastName:aut.lastName,
creatorType:"author"});
}
if (kws) item.tags = kws;
if (item.tags.length === 1) item.tags = item.tags[0].split(",");
if (abs) item.abstractNote = Zotero.Utilities.trimInternal(abs);
item.complete();
if (pdflink) {
// Some PDFs aren't paywalled, so they don't need the 2nd request
item.attachments.push({
url: pdflink,
title: "Cambridge Journals PDF",
mimeType:"application/pdf"
});
Zotero.Utilities.doGet(pdflink, function(text) {
var domain = pdflink.match(/^https?:\/\/[^\/]+\//);
var realpdf = text.match(/<iframe src="\/(action\/displayFulltext[^"]+)"/);
if (realpdf && domain) {
// If we matched the IFRAME, the first attachment must be bad
for (var i in item.attachments) {
if (item.attachments[i].mimeType.indexOf("pdf") !== -1)
item.attachments[i].url = (domain[0]+realpdf[1]).replace(/&amp;/g,"&");
};
}
}, function () {
item.complete();
});
} else {
item.complete();
}
});
translator.translate();
});
}, function() {Zotero.done();});
Zotero.wait();
}
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://journals.cambridge.org/action/quickSearch?quickSearchType=search_combined&inputField1=tatar&fieldStartMonth=01&fieldStartYear=1800&fieldEndMonth=12&fieldEndYear=2011&searchType=ADVANCESEARCH&searchTypeFrom=quickSearch&fieldScjrnl=All&fieldSccats=All&selectField1=%23&jnlId=AMS&issId=02&volId=45&journalSearchType=all",
"items": "multiple"
},
{
"type": "web",
"url": "http://journals.cambridge.org/action/displayAbstract?fromPage=online&aid=8267699&fulltextType=RA&fileId=S0021875810001738",
"items": [
{
"itemType": "journalArticle",
"creators": [
{
"firstName": "Laurie A.",
"lastName": "Rodrigues",
"creatorType": "author"
}
],
"notes": [],
"tags": [
""
],
"seeAlso": [],
"attachments": [
{
"url": false,
"title": "Cambridge Journals Snapshot",
"mimeType": "text/html"
}
],
"date": "2011",
"title": "“SAMO© as an Escape Clause”: Jean-Michel Basquiat's Engagement with a Commodified American Africanism",
"publicationTitle": "Journal of American Studies",
"pages": "227-243",
"volume": "45",
"issue": "02",
"DOI": "10.1017/S0021875810001738",
"abstractNote": "Heir to the racist configuration of the American art exchange and the delimiting appraisals of blackness in the American mainstream media, Jean-Michel Basquiat appeared on the late 1970s New York City street art scene then he called himself “SAMO.” Not long thereafter, Basquiat grew into one of the most influential artists of an international movement that began around 1980, marked by a return to figurative painting. Given its rough, seemingly untrained and extreme, conceptual nature, Basquiat's high-art oeuvre might not look so sophisticated to the uninformed viewer. However, Basquiat's work reveals a powerful poetic and visual gift, “heady enough to confound academics and hip enough to capture the attention span of the hip hop nation,” as Greg Tate has remarked. As noted by Richard Marshall, Basquiat's aesthetic strength actually comes from his striving “to achieve a balance between the visual and intellectual attributes” of his artwork. Like Marshall, Tate, and others, I will connect with Basquiat's unique, self-reflexively experimental visual practices of signifying and examine anew Basquiat's active contribution to his self-alienation, as Hebdige has called it. Basquiat's aesthetic makes of his paintings economies of accumulation, building a productive play of contingency from the mainstream's constructions of race. This aesthetic move speaks to a need for escape from the perceived epistemic necessities of blackness. Through these economies of accumulation we see, as Tate has pointed out, Basquiat's “intellectual obsession” with issues such as ancestry/modernity, personhood/property and originality/origins of knowledge, driven by his tireless need to problematize mainstream media's discourses surrounding race in other words, a commodified American Africanism.",
"libraryCatalog": "Cambridge Journals Online",
"shortTitle": "“SAMO© as an Escape Clause”"
}
]
}
]
/** END TEST CASES **/

View file

@ -1,20 +1,20 @@
{
"translatorID": "d0b1914a-11f1-4dd7-8557-b32fe8a3dd47",
"label": "EBSCOhost",
"creator": "Simon Kornblith and Michael Berkowitz",
"creator": "Simon Kornblith, Michael Berkowitz, Josh Geller",
"target": "^https?://[^/]+/(?:eds|bsi|ehost)/(?:results|detail|folder)",
"minVersion": "1.0.0b3.r1",
"minVersion": "2.1",
"maxVersion": "",
"priority": 100,
"inRepository": "1",
"inRepository": true,
"translatorType": 4,
"lastUpdated": "2011-03-24 23:30:00"
"lastUpdated": "2011-08-03 01:00:36"
}
function detectWeb(doc, url) {
var namespace = doc.documentElement.namespaceURI;
var nsResolver = namespace ? function(prefix) {
if (prefix == 'x') return namespace; else return null;
if (prefix == 'x') { return namespace; } else { return null; }
} : null;
// The Scientific American Archive breaks this translator, disabling
try {
@ -28,82 +28,31 @@ function detectWeb(doc, url) {
// See if this is a search results or folder results page
var searchResult = doc.evaluate('//ul[@class="result-list" or @class="folder-list"]/li/div[@class="result-list-record" or @class="folder-item"]', doc, nsResolver,
XPathResult.ANY_TYPE, null).iterateNext();
XPathResult.ANY_TYPE, null).iterateNext();
if(searchResult) {
return "multiple";
}
/*
var xpath = '//div[@class="citation-wrapping-div"]/dl[@class="citation-fields"]/dt[starts-with(text(), "Persistent link to this record")'
+' or starts-with(text(), "Vínculo persistente a este informe")'
+' or starts-with(text(), "Lien permanent à cette donnée")'
+' or starts-with(text(), "Permanenter Link zu diesem Datensatz")'
+' or starts-with(text(), "Link permanente al record")'
+' or starts-with(text(), "Link permanente para este registro")'
+' or starts-with(text(), "本記錄固定連結")'
+' or starts-with(text(), "此记录的永久链接")'
+' or starts-with(text(), "このレコードへのパーシスタント リンク")'
+' or starts-with(text(), "레코드 링크 URL")'
+' or starts-with(text(), "Постоянная ссылка на эту запись")'
+' or starts-with(text(), "Bu kayda sürekli bağlantı")'
+' or starts-with(text(), "Μόνιμος σύνδεσμος σε αυτό το αρχείο")]';
*/
var xpath = '//input[@id="ctl00_ctl00_Column2_Column2_topDeliveryControl_deliveryButtonControl_lnkExport"]';
var xpath = '//a[@class="permalink-link"]';
var persistentLink = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null);
if(persistentLink) {
return "journalArticle";
}
}
var customViewStateMatch = /<input type="hidden" name="__CUSTOMVIEWSTATE" id="__CUSTOMVIEWSTATE" value="([^"]+)" \/>/
var host;
function fullEscape(text) {
return escape(text).replace(/\//g, "%2F").replace(/\+/g, "%2B");
}
function generateDeliverString(nsResolver, doc){
var hiddenInputs = doc.evaluate('//input[@type="hidden" and not(contains(@name, "folderHas")) and not(@name ="ajax")]', doc, nsResolver, XPathResult.ANY_TYPE, null);
var hiddenInput;
var deliverString ="";
while(hiddenInput = hiddenInputs.iterateNext()) {
if (hiddenInput.name !== "__EVENTTARGET" && hiddenInput.name !== "") {
deliverString = deliverString+hiddenInput.name.replace(/\$/g, "%24")+"="+encodeURIComponent(hiddenInput.value) + "&";
}
}
var otherHiddenInputs = doc.evaluate('//input[@type="hidden" and contains(@name, "folderHas")]', doc, nsResolver, XPathResult.ANY_TYPE, null);
while(hiddenInput = otherHiddenInputs.iterateNext()) {
deliverString = deliverString+hiddenInput.name.replace(/\$/g, "%24")+"="+escape(hiddenInput.value).replace(/\//g, "%2F").replace(/%20/g, "+") + "&";
}
deliverString = "__EVENTTARGET=ctl00%24ctl00%24Column2%24Column2%24topDeliveryControl%24deliveryButtonControl%24lnkExport&" + deliverString;
return deliverString;
}
/*
* given the text of the delivery page, downloads an item
*/
function downloadFunction(text) {
var postMatch = false;
var form = text.match(/<form[^>]*(?:id|name)="aspnetForm"[^>]*/);
if (form) postMatch = form[0].match(/action="([^"]+)"/);
else postMatch = customViewStateMatch.exec(text);
if (!postMatch) {
Zotero.debug("Failed to find download URI in delivery page.");
return false;
}
var deliveryURL = postMatch[1].replace(/&amp;/g,"&");
var viewstateMatch = customViewStateMatch.exec(text);
var downloadString = "__EVENTTARGET=&__EVENTARGUMENT=&__CUSTOMVIEWSTATE="+fullEscape(viewstateMatch[1])+"&__VIEWSTATE=&ctl00%24ctl00%24MainContentArea%24MainContentArea%24ctl00%24btnSubmit=Save&ctl00%24ctl00%24MainContentArea%24MainContentArea%24ctl00%24BibFormat=1&ajax=enabled";
function downloadFunction(text, url) {
var pdf = false;
var queryString = {};
url.replace(
new RegExp("([^?=&]+)(=([^&]*))?", "g"),
function($0, $1, $2, $3) { queryString[$1] = $3; }
);
pdf = "/ehost/pdfviewer/pdfviewer?sid="+queryString["sid"]+"&vid="+queryString["vid"];
Zotero.Utilities.HTTP.doPost(host+"/ehost/"+deliveryURL,
downloadString, function(text) { // get marked records as RIS
Zotero.debug(text);
// load translator for RIS
if (text.match(/^AB\s\s\-/m)) text = text.replace(/^AB\s\s\-/m, "N2 -");
if (!text.match(/^TY\s\s-/m)) text = text+"\nTY - JOUR\n";
if (!text.match(/^TY\s\s-/m)) { text = text+"\nTY - JOUR\n"; }
// load translator for RIS
var translator = Zotero.loadTranslator("import");
translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7");
@ -113,7 +62,7 @@ function downloadFunction(text) {
item.DOI = text.match(/^L3\s+\-\s*(.*)/m)[1];
}
if (text.match(/^M3\s+-\s*(.*)/m)) {
if (item.DOI == text.match(/^M3\s+\-\s*(.*)/m)[1]) item.DOI = "";
if (item.DOI == text.match(/^M3\s+\-\s*(.*)/m)[1]) { item.DOI = ""; }
}
if (text.match(/^DO\s+-\s*(.*)/m)) {
item.DOI = text.match(/^DO\s+-\s*(.*)/m)[1];
@ -121,68 +70,202 @@ function downloadFunction(text) {
if (text.match(/^T1\s+-/m)) {
item.title = text.match(/^T1\s+-\s*(.*)/m)[1];
}
//item.itemType = "journalArticle";
item.url = false;
// If we have a double year, eliminate one
var year = item.date.match(/\d{4}/);
if (year && item.date.replace(year[0],"").indexOf(year[0]) !== -1) {
item.date = item.date.replace(year[0],"");
}
// RIS translator tries to download the link in "UR" this leads to unhappyness
item.attachments = [];
item.complete();
// But keep the stable link as a link attachment
if(item.url) {
item.attachments.push({url: item.url,
title: "EBSCO Record",
mimeType: "text/html",
snapshot: false});
item.url = "";
}
item.notes = [];
Zotero.Utilities.doGet(pdf, function (text) {
//Z.debug(text);
var realpdf = text.match(/<embed id="pdfEmbed"[^>]*>/);
if(realpdf) {
realpdf = text.match(/<embed[^>]*src="([^"]+)"/);
if (realpdf) {
realpdf = realpdf[1];
item.attachments.push({url:realpdf.replace(/&amp;/g, "&"),
title: "EBSCO Full Text",
mimeType:"application/pdf"});
}
}
}, function () { item.complete(); });
});
translator.translate();
Zotero.done();
});
}
var host;
function doWeb(doc, url) {
var namespace = doc.documentElement.namespaceURI;
var nsResolver = namespace ? function(prefix) {
if (prefix == 'x') return namespace; else return null;
if (prefix == 'x') { return namespace; } else { return null; }
} : null;
var hostRe = new RegExp("^(https?://[^/]+)/");
var hostMatch = hostRe.exec(url);
host = hostMatch[1];
var searchResult = doc.evaluate('//ul[@class="result-list" or @class="folder-list"]/li/div[@class="result-list-record" or @class="folder-item"]', doc, nsResolver,
XPathResult.ANY_TYPE, null).iterateNext();
var searchResult = doc.evaluate('//ul[@class="result-list" or @class="folder-list"]/li/div[@class="result-list-record" or @class="folder-item"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
if(searchResult) {
/* Get title links and text */
var titlex = '//a[@class = "title-link color-p4"]';
var titles = doc.evaluate(titlex, doc, nsResolver, XPathResult.ANY_TYPE, null);
var items = new Object();
var title;
/* Get folder data for AN, DB, and tag */
var folderx = '//span[@class = "item add-to-folder"]/input/@value';
var folderData = doc.evaluate(folderx, doc, nsResolver, XPathResult.ANY_TYPE, null);
var items = {};
var folderInfos = {};
var title, folderInfo;
/* load up urls, title text and records keys (DB, AN, tag) */
while (title = titles.iterateNext()) {
items[title.href] = title.textContent;
folderInfo = folderData.iterateNext();
folderInfos[title.href] = folderInfo.textContent;
}
var items = Zotero.selectItems(items);
if(!items) {
return true;
}
Zotero.selectItems(items, function (items) {
if(!items) {
return true;
}
var uris = new Array();
for(var i in items) {
uris.push(i);
}
Zotero.Utilities.processDocuments(uris, function(newDoc){
var postURL = newDoc.evaluate('//form[@id="aspnetForm"]/@action', newDoc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
postURL = host+"/ehost/"+postURL.nodeValue;
var deliverString = generateDeliverString(nsResolver, newDoc);
Zotero.Utilities.HTTP.doPost(postURL, deliverString, downloadFunction);
/* Get each citation page and pass in record key (db, tag, an) since data does not exist in an easily digestable way on this page */
var urls = [];
var infos = [];
var i;
for(i in items) {
urls.push(i);
infos.push(folderInfos[i]);
}
var run = function(urls, infos) {
var url, info;
if (urls.length == 0 || folderInfos.length == 0) {
Zotero.done();
return true;
}
url = urls.shift();
info = infos.shift();
Zotero.Utilities.processDocuments(url,
function (newDoc) { doDelivery(doc, nsResolver, info); },
function () {run(urls, infos);
});
};
run(urls, infos);
Zotero.wait();
});
} else {
//This is a hack, generateDeliveryString is acting up for single pages, but it works on the plink url
// The URL-encoding can cause issues too-- we decode it
var link = [decodeURI(doc.evaluate("//input[@id ='pLink']/@value", doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().nodeValue)];
Zotero.Utilities.processDocuments(link, function(newDoc){
var postURL = newDoc.evaluate('//form[@id="aspnetForm"]/@action', newDoc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
postURL = host+"/ehost/"+postURL.nodeValue;
var deliverString = generateDeliverString(nsResolver, newDoc);
Zotero.Utilities.HTTP.doPost(postURL, deliverString, downloadFunction);
});
/* Individual record. Record key exists in attribute for add to folder link in DOM */
doDelivery(doc, nsResolver, null);
}
Zotero.wait();
}
function doDelivery(doc, nsResolver, folderData) {
if(folderData === null) {
/* Get the db, AN, and tag from ep.clientData instead */
var script;
var scripts = doc.evaluate('//script[@type="text/javascript"]', doc, nsResolver, XPathResult.ANY_TYPE, null);
while (script = scripts.iterateNext().textContent) {
if (script.indexOf("var ep") > -1) { break; }
script = "";
}
}
if (script === "") { return; }
/* We now have the script containing ep.clientData */
/* The JSON is technically invalid, since it doesn't quote the
attribute names-- we pull out the valid bit inside it. */
var clientData = script.match(/var ep\s*=\s*({[^;]*});/);
if (!clientData) { return false; }
clientData = clientData[1].match(/"currentRecord"\s*:\s*({[^}]*})/);
/* If this starts throwing exceptions, we should probably start try-elsing it */
clientData = JSON.parse(clientData[1]);
var postURL = doc.evaluate('//form[@id="aspnetForm"]/@action', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
var queryString = {};
postURL.replace(
new RegExp("([^?=&]+)(=([^&]*))?", "g"),
function($0, $1, $2, $3) { queryString[$1] = $3; }
);
/* ExportFormat = 1 for RIS file */
postURL = host+"/ehost/delivery/ExportPanelSave/"+clientData.Db+"_"+clientData.Term+"_"+clientData.Tag+"?sid="+queryString["sid"]+"&vid="+queryString["vid"]+"&bdata="+queryString["bdata"]+"&theExportFormat=1";
Zotero.Utilities.HTTP.doGet(postURL, function (text) { downloadFunction(text, postURL); });
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://search.ebscohost.com/login.aspx?direct=true&db=a9h&AN=4370815&lang=cs&site=ehost-live",
"items": [
{
"itemType": "journalArticle",
"creators": [
{
"lastName": "Warren",
"firstName": "Karen J.",
"creatorType": "author"
}
],
"notes": [],
"tags": [
"RECONCILIATION",
"WAR -- Moral & ethical aspects",
"SOCIAL sciences -- Philosophy",
"STERBA, James",
"JUSTICE for Here & Now (Book)"
],
"seeAlso": [],
"attachments": [
{
"url": false,
"title": "EBSCO Record",
"mimeType": "text/html",
"snapshot": false
},
{
"url": false,
"title": "EBSCO Full Text",
"mimeType": "application/pdf"
}
],
"title": "Peacemaking and Philosophy: A Critique of Justice for Hero and Now.",
"publicationTitle": "Journal of Social Philosophy",
"date": "Winter 1999",
"volume": "30",
"issue": "3",
"pages": "411-423",
"publisher": "Wiley-Blackwell",
"ISBN": "00472786",
"ISSN": "00472786",
"abstractNote": "This article presents a critical analysis of James Sterba's book, Justice for Here and Now. In the book, Sterba undertakes two distinct but interconnected objects--one primarily methodological and the other primarily ethical. The methodological project is to establish the necessity and desirability of adopting a peacemaking model of doing philosophy, that is, one that is committed to fair-mindedness, openness and self-criticalness in seeking to determine which philosophical views are most justified. Sterba contrasts the peacemaking model with a war-making model of doing philosophy. The ethical project involves establishing two related claims: rationality is required for morality, and it is possible and desirable to reconcile the practical perspectives of alternative positions on justice; welfare liberalism, libertarianism, socialism, feminism, multiculturalism, anthropocentric and nonanthropocentric environmental ethics, and pacifism and just war theory. There is an important and intimate connection between the methodological and ethical projects. In fact, at various places throughout the book Sterba suggests that the relationship is one of logical entailment: not only does appeal to a peacemaking model of doing philosophy establish the two main claims of the ethical project; by showing the rational grounds for reconciling alternative philosophical positions on justice, one establishes that a peacemaking model of philosophy ought to be adopted.",
"libraryCatalog": "EBSCOhost",
"shortTitle": "Peacemaking and Philosophy"
}
]
}
]
/** END TEST CASES **/

View file

@ -1,15 +1,15 @@
{
"translatorID":"951c027d-74ac-47d4-a107-9c3069ab7b48",
"translatorType":4,
"label":"Embedded RDF",
"creator":"Simon Kornblith",
"target":null,
"minVersion":"1.0.0b3.r1",
"maxVersion":"",
"priority":400,
"inRepository":true,
"detectXPath":"//meta[substring(@name, 1, 3)='dc.'] | //link[substring(@rel, 1, 7)='schema.']",
"lastUpdated":"2011-01-11 04:31:00"
"translatorID": "951c027d-74ac-47d4-a107-9c3069ab7b48",
"label": "Embedded RDF",
"creator": "Simon Kornblith",
"target": "",
"minVersion": "2.1",
"maxVersion": "",
"priority": 400,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcs",
"lastUpdated": "2011-07-04 00:32:05"
}
var _prefix;
@ -69,28 +69,66 @@ function doWeb(doc, url) {
newItem.repository = false;
newItem.complete();
});
var rdf = translator.getTranslatorObject();
var metaTags = doc.getElementsByTagName("meta");
var foundTitle = false; // We can use the page title if necessary
for(var i=0; i<metaTags.length; i++) {
var tag = metaTags[i].getAttribute("name");
var value = metaTags[i].getAttribute("content");
if(tag && value && tag.substr(0, prefix.length).toLowerCase() == prefix) {
if(tag == "dc.title") {
foundTitle = true;
translator.getTranslatorObject(function(rdf) {
var metaTags = doc.getElementsByTagName("meta");
var foundTitle = false; // We can use the page title if necessary
for(var i=0; i<metaTags.length; i++) {
var tag = metaTags[i].getAttribute("name");
var value = metaTags[i].getAttribute("content");
if(tag && value && tag.substr(0, prefix.length).toLowerCase() == prefix) {
if(tag == "dc.title") {
foundTitle = true;
}
rdf.Zotero.RDF.addStatement(url, _dc + tag.substr(3).toLowerCase(), value, true);
} else if(tag && value && (tag == "author" || tag == "author-personal")) {
rdf.Zotero.RDF.addStatement(url, _dc + "creator", value, true);
} else if(tag && value && tag == "author-corporate") {
rdf.Zotero.RDF.addStatement(url, _dc + "creator", value, true);
}
rdf.Zotero.RDF.addStatement(url, _dc + tag.substr(3).toLowerCase(), value, true);
} else if(tag && value && (tag == "author" || tag == "author-personal")) {
rdf.Zotero.RDF.addStatement(url, _dc + "creator", value, true);
} else if(tag && value && tag == "author-corporate") {
rdf.Zotero.RDF.addStatement(url, _dc + "creator", value, true);
}
if (!foundTitle) {
rdf.Zotero.RDF.addStatement(url, _dc + "title", doc.title, true);
}
rdf.defaultUnknownType = "webpage";
rdf.doImport();
});
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://dublincore.org/documents/usageguide/",
"items": [
{
"itemType": "webpage",
"creators": [
{
"lastName": "Diane Hillmann",
"creatorType": "author"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"attachments": [
{
"document": false
}
],
"itemID": "http://dublincore.org/documents/usageguide/",
"title": "Using Dublin Core",
"publisher": "Dublin Core Metadata Initiative",
"institution": "Dublin Core Metadata Initiative",
"company": "Dublin Core Metadata Initiative",
"label": "Dublin Core Metadata Initiative",
"distributor": "Dublin Core Metadata Initiative",
"extra": "This document is intended as an entry point for users of Dublin Core. For non-specialists, it will assist them in creating simple descriptive records for information resources (for example, electronic documents). Specialists may find the document a useful point of reference to the documentation of Dublin Core, as it changes and grows.",
"url": "http://dublincore.org/documents/usageguide/"
}
]
}
if (!foundTitle) {
rdf.Zotero.RDF.addStatement(url, _dc + "title", doc.title, true);
}
rdf.defaultUnknownType = "webpage";
rdf.doImport();
}
]
/** END TEST CASES **/

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,58 @@
{
"translatorID": "58641ca2-d324-445b-a618-4e7c4631726f",
"label": "Google Blogs",
"creator": "Avram Lyon",
"target": "^https?://www\\.google\\.[^/]+/.*[#&]tbm=blg",
"minVersion": "2.1.8",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"lastUpdated": "2011-07-30 03:19:03"
}
function detectWeb(doc, url) {
return "multiple";
}
function doWeb(doc, url) {
if (ZU === undefined) {
var ZU = {};
ZU.xpath = function (node, xpath, ns) {
var nodes = [];
var i;
var result = doc.evaluate(xpath, node, ns, XPathResult.ANY_TYPE, null);
while (i = result.iterateNext()) nodes.push(i);
if (nodes.length > 0) return nodes;
return null;
}
}
var list = ZU.xpath(doc, '//div[@id="search"]//ol[@id="rso"]/li/div[@class="vsc"]');
var i, node;
var items = [];
var names = {};
for (i in list) {
items[i] = new Zotero.Item("blogPost");
link = ZU.xpath(list[i], './span/h3/a')[0];
names[i] = link.textContent;
items[i].title = link.textContent;
items[i].url = link.href;
items[i].attachments.push({url:link.href,
title:"Blog Snapshot",
mimeType:"text/html"});
items[i].blogTitle = ZU.xpath(list[i], './/cite/a')[0].textContent;
node = ZU.xpath(list[i], './/div[@class="f kb"]')[0].textContent.match(/^(.*) by (.*)$/);
if (node) {
items[i].date = node[1];
items[i].creators.push(Zotero.Utilities.cleanAuthor(node[2], "author"));
}
}
Zotero.selectItems(names, function(names) {
var j;
for (j in names) {
items[j].complete();
}
});
}

View file

@ -1,14 +1,14 @@
{
"translatorID":"d71e9b6d-2baa-44ed-acb4-13fe2fe592c0",
"translatorType":4,
"label":"Google Patents",
"creator":"Adam Crymble",
"target":"http://www\\.google.*/patents",
"minVersion":"1.0.0b4.r5",
"maxVersion":"",
"priority":100,
"inRepository":true,
"lastUpdated":"2010-07-09 07:46:31"
"translatorID": "d71e9b6d-2baa-44ed-acb4-13fe2fe592c0",
"label": "Google Patents",
"creator": "Adam Crymble",
"target": "^http://www\\.google.*/patents",
"minVersion": "2.1",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"lastUpdated": "2011-07-16 14:00:40"
}
function detectWeb(doc, url) {
@ -22,7 +22,6 @@ function detectWeb(doc, url) {
} else if(doc.location.href.match(/[?&]id=/)) {
return "patent";
}
}
//Google Patents Translator. Code by Adam Crymble
@ -69,8 +68,8 @@ function scrape(doc, url) {
*/
//associate headings with contents.
//extra field\
//newItem.extra = '';
//extra field
newItem.extra = '';
for (fieldTitle in dataTags) {
Zotero.debug(fieldTitle);
@ -96,28 +95,27 @@ function scrape(doc, url) {
newItem.creators.push(Zotero.Utilities.cleanAuthor(dataTags["Inventor"], "inventor"));
}
if (fieldTitle == "U.S. Classification" ) {
newItem.extra += "U.S. Classification: " + dataTags["U.S. Classification"]+"\n";
if (fieldTitle == "Current U.S. Classification" ) {
newItem.extra += "U.S. Classification: " + dataTags["Current U.S. Classification"]+"\n";
} else if (fieldTitle == "International Classification" ) {
newItem.extra += "International Classification: " + dataTags["International Classification"]+"\n";
} else if (fieldTitle == "Filing date" ) {
newItem.extra += "Filing Date: " + dataTags["Filing date"]+"\n";
} else if (fieldTitle == "Publication number" ) {
newItem.extra += "Publication number: " +dataTags["Publication number"]+"\n";
}
}
associateData (newItem, dataTags, "Patent number", "patentNumber");
associateData (newItem, dataTags, "Issue date", "date");
associateData (newItem, dataTags, "Filing date", "filingDate");
associateData (newItem, dataTags, "Assignees", "assignee");
associateData (newItem, dataTags, "Assignee", "assignee");
associateData (newItem, dataTags, "Abstract", "abstractNote");
associateData (newItem, dataTags, "Application number", "applicationNumber");
newItem.title = doc.evaluate('//h1[@class="title"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent;
newItem.url = doc.location.href;
var pdf = doc.evaluate('//div[@class="g-button-basic"]/span/span/a[contains(@href,"/download/)]', doc, null, XPathResult.ANY_TYPE, null).iterateNext();
if (pdf) newItem.attachments.push({url:pdf.href, title:"Google Patents PDF", mimeType:"application/pdf"});
newItem.title = doc.evaluate('//h1[@class="gb-volume-title"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent;
newItem.url = doc.location.href.replace(/(^[^\?]*\?id=[a-zA-Z0-9]+).*/,"$1");
newItem.complete();
}
@ -125,17 +123,55 @@ function scrape(doc, url) {
function doWeb(doc, url) {
var host = 'http://' + doc.location.host + "/";
var articles = new Array();
if (detectWeb(doc, url) == "multiple") {
var items = Zotero.Utilities.getItemArray(doc, doc, /\/patents\/about\?id=/);
items = Zotero.selectItems(items);
if(!items) return true;
for (var i in items) {
articles.push(i);
}
var items = Zotero.Utilities.getItemArray(doc, doc, /\/patents(?:\/about)?\?id=/);
Zotero.selectItems(items, function (items) {
var articles = new Array();
for (var i in items) {
articles.push(i);
}
Zotero.Utilities.processDocuments(articles, scrape, function() {Zotero.done();});
Zotero.wait();
});
} else {
articles.push(url);
scrape(doc);
}
Zotero.wait();
Zotero.Utilities.processDocuments(articles, scrape, function() {Zotero.done();});
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://www.google.com/patents/about?id=j5NSAAAAEBAJ",
"items": [
{
"itemType": "patent",
"creators": [
{
"firstName": "T.",
"lastName": "SHOOK",
"creatorType": "inventor"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"attachments": [],
"extra": "U.S. Classification: 215/273",
"patentNumber": "1065211",
"date": "Jun 17, 1913",
"filingDate": "Aug 3, 1912",
"title": "BOTTLE-STOPPER",
"url": "http://www.google.com/patents/about?id=j5NSAAAAEBAJ",
"libraryCatalog": "Google Patents"
}
]
},
{
"type": "web",
"url": "http://www.google.com/search?tbm=pts&tbo=1&hl=en&q=book&btnG=Search+Patents",
"items": "multiple"
}
]
/** END TEST CASES **/

View file

@ -1,15 +1,15 @@
{
"translatorID": "57a00950-f0d1-4b41-b6ba-44ff0fc30289",
"label": "Google Scholar",
"creator": "Simon Kornblith, Frank Bennett",
"target": "^https?://scholar\\.google\\.(?:com|com?\\.[a-z]{2}|[a-z]{2}|co\\.[a-z]{2})/scholar(?:_case)*",
"minVersion": "2.1.9",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcs",
"lastUpdated": "2011-07-02 13:33:19"
"translatorID": "57a00950-f0d1-4b41-b6ba-44ff0fc30289",
"label": "Google Scholar",
"creator": "Simon Kornblith, Frank Bennett",
"target": "^https?://scholar\\.google\\.(?:com|com?\\.[a-z]{2}|[a-z]{2}|co\\.[a-z]{2})/scholar(?:_case)*",
"minVersion": "2.1.9",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcs",
"lastUpdated": "2011-07-04 13:18:22"
}
/*
@ -181,6 +181,9 @@ function processFactories(factories) {
// Has BibTeX data with title, pass it through to the BibTeX translator
attachments = factory.getAttachments("Page");
bibtexTranslator.setString(res);
bibtexTranslator.setHandler("done", function() {
processFactories(factories);
});
bibtexTranslator.translate();
} else {
// If BibTeX is empty, this is some kind of case, if anything.

View file

@ -3,13 +3,12 @@
"label": "Highwire 2.0",
"creator": "Matt Burton",
"target": "(content/([0-9]+/[0-9]+|current|firstcite|early)|search\\?submit=|search\\?fulltext=|cgi/collection/.+)",
"minVersion": "2,1",
"minVersion": "2.1",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcs",
"lastUpdated": "2011-07-03 03:57:24"
"lastUpdated": "2011-07-29 01:21:09"
}
/*
@ -24,17 +23,22 @@
4. M L Giger et al., Pulmonary nodules: computer-aided detection in digital chest images., Radiographics 10, no. 1 (January 1990): 41-51.
http://radiographics.rsna.org/content/10/1/41.abstract
5. Mitch Leslie, "CLIP catches enzymes in the act," The Journal of Cell Biology 191, no. 1 (October 4, 2010): 2.
http://jcb.rupress.org/content/191/1/2.2.short
http://jcb.rupress.org/content/191/1/2.2.short
*/
function detectWeb(doc, url) {
var namespace = doc.documentElement.namespaceURI;
var nsResolver = namespace ? function(prefix) {
if (prefix == 'x') return namespace; else return null;
} : null;
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, null, XPathResult.ANY_TYPE, null).iterateNext();
highwiretest = doc.evaluate("//link[@href = '/shared/css/hw-global.css']", doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
}
if(highwiretest) {
@ -55,8 +59,12 @@ function detectWeb(doc, url) {
}
}
var host;
function doWeb(doc, url) {
var namespace = doc.documentElement.namespaceURI;
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
@ -69,8 +77,9 @@ function doWeb(doc, url) {
return true;
}
host = 'http://' + doc.location.host + "/";
var host = 'http://' + doc.location.host + "/";
var arts = new Array();
if (detectWeb(doc, url) == "multiple") {
var items = new Object();
if (doc.title.match("Table of Contents")
@ -87,47 +96,40 @@ function doWeb(doc, url) {
var titlex = './/span[contains(@class,"cit-title")]';
}
var linkx = './/a[1]';
var searchres = doc.evaluate(searchx, doc, null, XPathResult.ANY_TYPE, null);
var searchres = doc.evaluate(searchx, doc, nsResolver, XPathResult.ANY_TYPE, null);
var next_res;
while (next_res = searchres.iterateNext()) {
var title = doc.evaluate(titlex, next_res, null, XPathResult.ANY_TYPE, null).iterateNext().textContent;
var link = doc.evaluate(linkx, next_res, null, XPathResult.ANY_TYPE, null).iterateNext().href;
var title = doc.evaluate(titlex, next_res, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
var link = doc.evaluate(linkx, next_res, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().href;
items[link] = title;
}
Zotero.selectItems(items, function(items) {
if(!items) return;
var arts = [];
for (var i in items) {
arts.push(i);
}
processArticles(arts);
});
items = Zotero.selectItems(items);
for (var i in items) {
arts.push(i);
}
} else {
processArticles([url]);
arts = [url];
}
Zotero.wait();
}
function processArticles(arts) {
if(arts.length == 0) {
var newurls = new Array();
for each (var i in arts) {
newurls.push(i);
}
if(arts.length == 0) {
Zotero.debug('no items');
return false;
}
var newurls = arts.slice();
Zotero.Utilities.HTTP.doGet(arts, function(text) {
var id, match, newurl, pdfurl, get;
/* Here, we have to use three phrasings because they all occur, depending on
the journal.
TODO We should rewrite this to not use regex! */
TODO We should rewrite this to not use regex! */
match = text.match(/=([^=]+)\">\s*Download (C|c)itation/);
if (!match || match.length < 1) {
match = text.match(/=([^=]+)\">\s*Download to citation manager/);
if (!match || match.length < 1) {
// Journal of Cell Biology
match = text.match(/=([^=]+)\">\s*Add to Citation Manager/);
}
match = text.match(/=([^=]+)\">\s*Add to Citation Manager/);
}
}
id = match[1];
newurl = newurls.shift();
@ -161,21 +163,25 @@ function processArticles(arts) {
translator.translate();
});
});
Zotero.wait();
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://jcb.rupress.org/content/191/1/2.2.short",
"url": "http://rer.sagepub.com/content/52/2/201.abstract",
"items": [
{
"itemType": "journalArticle",
"creators": [
{
"lastName": "Leslie",
"firstName": "Mitch",
"lastName": "Hofstein",
"firstName": "Avi",
"creatorType": "author"
},
{
"lastName": "Lunetta",
"firstName": "Vincent N.",
"creatorType": "author"
}
],
@ -194,283 +200,109 @@ var testCases = [
"mimeType": "application/pdf"
}
],
"title": "CLIP catches enzymes in the act ",
"date": "October 04 , 2010",
"publicationTitle": "The Journal of Cell Biology ",
"pages": "2 ",
"volume": "191 ",
"issue": "1 ",
"url": "http://jcb.rupress.org/content/191/1/2.2.short ",
"DOI": "10.1083/jcb.1911iti2 ",
"title": "The Role of the Laboratory in Science Teaching: Neglected Aspects of Research",
"date": "Summer 1982",
"publicationTitle": "Review of Educational Research",
"pages": "201 -217",
"volume": "52",
"issue": "2",
"url": "http://rer.sagepub.com/content/52/2/201.abstract",
"abstractNote": "The laboratory has been given a central and distinctive role in science education, and science educators have suggested that there are rich benefits in learning from using laboratory activities. At this time, however, some educators have begun to question seriously the effectiveness and the role of laboratory work, and the case for laboratory teaching is not as self-evident as it once seemed. This paper provides perspectives on these issues through a review of the history, goals, and research findings regarding the laboratory as a medium of instruction in introductory science teaching. The analysis of research culminates with suggestions for researchers who are working to clarify the role of the laboratory in science education.",
"DOI": "10.3102/00346543052002201",
"libraryCatalog": "Highwire 2.0",
"shortTitle": "The Role of the Laboratory in Science Teaching"
}
]
},
{
"type": "web",
"url": "http://sag.sagepub.com/content/early/2010/04/23/1046878110366277.abstract",
"items": [
{
"itemType": "journalArticle",
"creators": [
{
"lastName": "Owens",
"firstName": "Trevor",
"creatorType": "author"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"attachments": [
{
"url": false,
"title": "Snapshot",
"mimeType": "text/html"
},
{
"url": false,
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"title": "Modding the History of Science: Values at Play in Modder Discussions of Sid Meiers CIVILIZATION",
"date": "May 27 , 2010",
"publicationTitle": "Simulation & Gaming",
"url": "http://sag.sagepub.com/content/early/2010/04/23/1046878110366277.abstract",
"abstractNote": "Sid Meiers CIVILIZATION has been promoted as an educational tool, used as a platform for building educational simulations, and maligned as promoting Eurocentrism, bioimperialism, and racial superiority. This article explores the complex issues involved in interpreting a game through analysis of the ways modders (gamers who modify the game) have approached the history of science, technology, and knowledge embodied in the game. Through text analysis of modder discussion, this article explores the assumed values and tone of the communitys discourse. The study offers initial findings that CIVILIZATION modders value a variety of positive discursive practices for developing historical models. Community members value a form of historical authenticity, they prize subtlety and nuance in models for science in the game, and they communicate through civil consensus building. Game theorists, players, and scholars, as well as those interested in modeling the history, sociology, and philosophy of science, will be interested to see the ways in which CIVILIZATION III cultivates an audience of modders who spend their time reimagining how science and technology could work in the game.",
"DOI": "10.1177/1046878110366277",
"libraryCatalog": "Highwire 2.0",
"shortTitle": "Modding the History of Science"
}
]
},
{
"type": "web",
"url": "http://scx.sagepub.com/content/30/2/277.abstract",
"items": [
{
"itemType": "journalArticle",
"creators": [
{
"lastName": "Mulder",
"firstName": "Henk A. J.",
"creatorType": "author"
},
{
"lastName": "Longnecker",
"firstName": "Nancy",
"creatorType": "author"
},
{
"lastName": "Davis",
"firstName": "Lloyd S.",
"creatorType": "author"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"attachments": [
{
"url": false,
"title": "Snapshot",
"mimeType": "text/html"
},
{
"url": false,
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"title": "The State of Science Communication Programs at Universities Around the World",
"date": "December 01 , 2008",
"publicationTitle": "Science Communication",
"pages": "277 -287",
"volume": "30",
"issue": "2",
"url": "http://scx.sagepub.com/content/30/2/277.abstract",
"abstractNote": "Building on discussions at two workshops held at the recent 10th International Conference on the Public Communication of Science and Technology during June 2008 in Malmö, Sweden, this article proposes specific steps toward achieving a common understanding of the essential elements for academic programs in science communication. About 40 academics, science communication professionals, and students from at least 16 countries participated in this process.",
"DOI": "10.1177/1075547008324878",
"libraryCatalog": "Highwire 2.0"
}
]
},
{
"type": "web",
"url": "http://radiographics.rsna.org/content/10/1/41.abstract",
"items": [
{
"itemType": "journalArticle",
"creators": [
{
"lastName": "Giger",
"firstName": "M L",
"creatorType": "author"
},
{
"lastName": "Doi",
"firstName": "K",
"creatorType": "author"
},
{
"lastName": "MacMahon",
"firstName": "H",
"creatorType": "author"
},
{
"lastName": "Metz",
"firstName": "C E",
"creatorType": "author"
},
{
"lastName": "Yin",
"firstName": "F F",
"creatorType": "author"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"attachments": [
{
"url": false,
"title": "Snapshot",
"mimeType": "text/html"
},
{
"url": false,
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"title": "Pulmonary nodules: computer-aided detection in digital chest images. ",
"date": "January 01 , 1990",
"publicationTitle": "Radiographics ",
"pages": "41 -51 ",
"volume": "10 ",
"issue": "1 ",
"url": "http://radiographics.rsna.org/content/10/1/41.abstract ",
"abstractNote": "Currently, radiologists fail to detect pulmonary nodules in up to 30% of cases with actually positive findings. Diagnoses may be missed due to camouflaging effects of anatomic background, subjective and varying decision criteria, or distractions in clinical situations. We developed a computerized method to detect locations of lung nodules in digital chest images. The method is based on a difference-image approach and feature-extraction techniques, including growth, slope, and profile tests. Computer results were used to alert 12 radiologists to possible nodule locations in 60 clinical cases. Preliminary results suggest that computer aid can improve the detection performance of radiologists. ",
"libraryCatalog": "Highwire 2.0",
"shortTitle": "Pulmonary nodules"
}
]
},
{
"type": "web",
"url": "http://bjaesthetics.oxfordjournals.org/content/50/2/121.abstract",
"items": [
{
"itemType": "journalArticle",
"creators": [
{
"lastName": "Maes",
"firstName": "Hans",
"creatorType": "author"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"attachments": [
{
"url": false,
"title": "Snapshot",
"mimeType": "text/html"
},
{
"url": false,
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"title": "Intention, Interpretation, and Contemporary Visual Art ",
"date": "April 01 , 2010",
"publicationTitle": "The British Journal of Aesthetics ",
"pages": "121 -138 ",
"volume": "50 ",
"issue": "2 ",
"url": "http://bjaesthetics.oxfordjournals.org/content/50/2/121.abstract ",
"abstractNote": "The role of the artist's intention in the interpretation of art has been the topic of a lively and ongoing discussion in analytic aesthetics. First, I sketch the current state of this debate, focusing especially on two competing views: actual and hypothetical intentionalism. Secondly, I discuss the search for a suitable test case, that is, a work of art that is interpreted differently by actual and hypothetical intentionalists, with only one of these interpretations being plausible. Many examples from many different art forms have been considered in this respect, but none of these test cases has proved convincing. Thirdly, I introduce two new test cases taken from contemporary visual art. I explain why these examples are better suited as test cases and how they lend support to the actual intentionalist position. ",
"DOI": "10.1093/aesthj/ayp051 ",
"libraryCatalog": "Highwire 2.0"
}
]
},
{
"type": "web",
"url": "http://joeg.oxfordjournals.org/content/10/3/331.abstract",
"items": [
{
"itemType": "journalArticle",
"creators": [
{
"lastName": "Clark",
"firstName": "Gordon L.",
"creatorType": "author"
},
{
"lastName": "Durán-Fernández",
"firstName": "Roberto",
"creatorType": "author"
},
{
"lastName": "Strauss",
"firstName": "Kendra",
"creatorType": "author"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"attachments": [
{
"url": false,
"title": "Snapshot",
"mimeType": "text/html"
},
{
"url": false,
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"title": "Being in the market: the UK house-price bubble and the intended structure of individual pension investment portfolios ",
"date": "May 01 , 2010",
"publicationTitle": "Journal of Economic Geography ",
"pages": "331 -359 ",
"volume": "10 ",
"issue": "3 ",
"url": "http://joeg.oxfordjournals.org/content/10/3/331.abstract ",
"abstractNote": "It is widely observed that being in the market gives financial traders access to knowledge and information not available to remote traders. A truism of the geography of finance, it is also a perspective that can shed light on the interaction between market location, global financial movements and personal welfare. In this article, we develop an explanation of the premium attached to being in the market, drawing upon previous contributions on the relevance of tacit knowledge and the insights provided by behavioural finance with respect to timespace myopia. To illustrate our model of four types of behaviour, mixing together various combinations of time and space conceptions of market performance, we analyse the intended retirement investment portfolios of nearly 2400 participants in a defined contribution pension plan sponsored by a London-based investment bank. Having demonstrated the empirical significance of the UK house-price bubble, respondents retirement investment portfolios are analysed focusing upon the relative significance of property in relation to a range of other investment instruments. It is shown that, amongst similarly located respondents, there was a range of investment strategies dependent, in part, upon respondents age, household status, job classification and income. These results allow us to distinguish between different types of behaviour even amongst well-placed respondents, providing evidence of the co-existence of sophisticated, naive and opportunistic investors against the base-case of timespace myopic behaviour. Implications are drawn for conceptualising a rapprochement between the insights of the behavioural revolution for economic geography (and in particular, the geography of finance) relevant for public policy. ",
"DOI": "10.1093/jeg/lbp034 ",
"libraryCatalog": "Highwire 2.0",
"shortTitle": "Being in the market"
}
]
},
{
"type": "web",
"url": "http://joeg.oxfordjournals.org/content/6/5/571",
"items": [
{
"itemType": "journalArticle",
"creators": [
{
"lastName": "Agrawal",
"firstName": "Ajay",
"creatorType": "author"
},
{
"lastName": "Cockburn",
"firstName": "Iain",
"creatorType": "author"
},
{
"lastName": "McHale",
"firstName": "John",
"creatorType": "author"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"attachments": [
{
"url": false,
"title": "Snapshot",
"mimeType": "text/html"
},
{
"url": false,
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"title": "Gone but not forgotten: knowledge flows, labor mobility, and enduring social relationships ",
"date": "November 2006 ",
"publicationTitle": "Journal of Economic Geography ",
"pages": "571 -591 ",
"volume": "6 ",
"issue": "5 ",
"url": "http://joeg.oxfordjournals.org/content/6/5/571.abstract ",
"abstractNote": "We examine the role of social relationships in facilitating knowledge flows by estimating the flow premium captured by a mobile inventor's previous location. Once an inventor has moved, they are gone—but are they forgotten? We find that knowledge flows to an inventor's prior location are approximately 50% greater than if they had never lived there, suggesting that social relationships, not just physical proximity, are important for determining flow patterns. Furthermore, we find that a large portion of this social effect is mediated by institutional links; however, this is not the result of corporate knowledge management systems but rather of personal relationships formed through co-location within an institutional context that endure over time, space, and organizational boundaries. Moreover, we find the effect is nearly twice as large for knowledge flows across as compared to within fields, suggesting that co-location may substitute for communities of practice in determining flow patterns. ",
"DOI": "10.1093/jeg/lbl016 ",
"libraryCatalog": "Highwire 2.0",
"shortTitle": "Gone but not forgotten"
}
]
},
{
"type": "web",
"url": "http://www.sciencemag.org/content/332/6034/1149.11.full?rss=1",
"items": [
{
"itemType": "journalArticle",
"creators": [
{
"lastName": "Balmford",
"firstName": "Andrew",
"creatorType": "author"
},
{
"lastName": "Kroshko",
"firstName": "Jeanette",
"creatorType": "author"
},
{
"lastName": "Leader-Williams",
"firstName": "Nigel",
"creatorType": "author"
},
{
"lastName": "Mason",
"firstName": "Georgia",
"creatorType": "author"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"attachments": [
{
"url": false,
"title": "Snapshot",
"mimeType": "text/html"
},
{
"url": false,
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"title": "Zoos and Captive Breeding ",
"date": "June 03 , 2011",
"publicationTitle": "Science ",
"pages": "1149 -1150 ",
"volume": "332 ",
"issue": "6034 ",
"url": "http://www.sciencemag.org/content/332/6034/1149.11.short ",
"DOI": "10.1126/science.332.6034.1149-k ",
"libraryCatalog": "Highwire 2.0"
}
]
},
{
"type": "web",
"url": "http://www.journalofvision.org/search?fulltext=tooth&submit=yes&x=0&y=0",
"items": "multiple"
}
]
/** END TEST CASES **/
/** END TEST CASES **/

68
translators/IGN.js Normal file
View file

@ -0,0 +1,68 @@
{
"translatorID":"d210c5a1-73e1-41ad-a3c9-331d5a3ead48",
"label":"IGN",
"creator":"odie5533",
"target":"^http://[^/]*\\.ign\\.com/",
"minVersion":"1.0",
"maxVersion":"",
"priority":100,
"inRepository":"1",
"translatorType":4,
"lastUpdated":"2010-08-12 16:16:53"
}
/*
IGN Translator - Parses IGN articles and creates Zotero-based metadata
Copyright (C) 2010-2011 odie5533
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function detectWeb(doc, url) {
if (url.match(/articles/)) {
return "webpage";
}
}
function scrape(doc, url) {
var newItem = new Zotero.Item("webpage");
newItem.publicationTitle = "IGN";
newItem.url = doc.location.href;
newItem.title = doc.title.replace(/ - [^-]+ at IGN/, "");
// pages
var pages = doc.evaluate('//div[@class="ui-page-list clear"]/ul/li[last()-1]', doc, null, XPathResult.ANY_TYPE, null);
if (p = pages.iterateNext())
newItem.pages = p.textContent;
// date
var dates = doc.evaluate('//h2[@class="publish-date"]/text()', doc, null, XPathResult.ANY_TYPE, null);
newItem.date = dates.iterateNext().textContent.replace(/^\s+|\s+$/g,'');
//authors
var byline = doc.evaluate('//div[@class="hdr-sub byline"]/a/text()', doc, null, XPathResult.ANY_TYPE, null);
var authors = byline.iterateNext().textContent.split(" and ");
for each(var a in authors) {
newItem.creators.push(Zotero.Utilities.cleanAuthor(a, "author"));
}
// attach html
newItem.attachments.push({title:"IGN Article Snapshot", document:doc});
newItem.complete();
}
function doWeb(doc, url) {
scrape(doc, url);
}

File diff suppressed because one or more lines are too long

View file

@ -1,45 +1,69 @@
{
"translatorID":"9346ddef-126b-47ec-afef-8809ed1972ab",
"translatorType":4,
"label":"Institute of Physics",
"creator":"Michael Berkowitz",
"target":"^http://www.iop.org/EJ/(toc|abstract|search|article)",
"minVersion":"1.0.0b4.r5",
"maxVersion":"",
"priority":99,
"inRepository":true,
"lastUpdated":"2008-04-28 17:50:00"
"translatorID": "9346ddef-126b-47ec-afef-8809ed1972ab",
"label": "Institute of Physics",
"creator": "Michael Berkowitz and Avram Lyon",
"target": "^http://iopscience\\.iop\\.org/[0-9-]+/.+",
"minVersion": "2.1",
"maxVersion": "",
"priority": 99,
"inRepository": true,
"translatorType": 4,
"lastUpdated": "2011-07-30 12:25:40"
}
function detectWeb(doc, url) {
if ((doc.location.href.indexOf("toc") == -1) && (doc.location.href.indexOf("search") == -1)) {
if (url.indexOf("search") == -1) {
return "journalArticle";
} else {
return "multiple";
}
}
function parseRIS(getURL, pdfURL) {
var newGet = getURL.replace(/EJ\/[^/]+/, "EJ/sview").replace(/\?.*$/, '') + "?format=refmgr&submit=1";
Zotero.Utilities.HTTP.doGet(newGet, function(text){
// load translator for RIS
var translator = Zotero.loadTranslator ("import");
translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7");
translator.setString(text);
translator.setHandler("itemDone", function(obj, item) {
item.url = getURL;
item.attachments = [
{url:item.url, title:"IOP Snapshot", mimeType:"text/html"}
];
if (pdfURL != null) {
item.attachments.push({url:pdfURL, title:"IOP Full Text PDF", mimeType:"application/pdf"});
}
item.complete();
function fetchDOIs(DOIs) {
var DOI = DOIs.shift();
if (!DOI) {
Zotero.done();
return true;
}
var articleID = DOI.slice(DOI.indexOf('/')+1);
var pdfURL = "http://iopscience.iop.org/"+articleID+"/pdf/"+articleID.replace("/","_","g")+".pdf";
var doitranslate = Zotero.loadTranslator("search");
doitranslate.setTranslator("11645bd1-0420-45c1-badb-53fb41eeb753");
var item = {"itemType":"journalArticle", "DOI":DOI};
doitranslate.setSearch(item);
doitranslate.setHandler("itemDone", function(obj, item) {
item.url = "http://iopscience.iop.org/"+articleID;
item.attachments.push({url:pdfURL, title:"IOP Full Text PDF", mimeType:"application/pdf"});
item.libraryCatalog = "Intitute of Physics";
item.complete();
fetchDOIs(DOIs);
});
translator.translate();
Zotero.done();
}, function() {});
Zotero.wait();
var fallback = function() {
Zotero.debug("Error saving using DOI and CrossRef; trying RIS");
// If there is something wrong with the item
var postVars = "exportFormat=iopexport_ris&exportType=abs&articleId="+articleID;
Zotero.Utilities.HTTP.doPost("http://iopscience.iop.org/export", postVars, function(text){
// load translator for RIS
var ristranslator = Zotero.loadTranslator ("import");
ristranslator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7");
ristranslator.setString(text);
ristranslator.setHandler("itemDone", function(obj, item) {
item.url = "http://iopscience.iop.org/"+articleID;
item.libraryCatalog = "Intitute of Physics";
item.attachments.push({url:pdfURL, title:"IOP Full Text PDF", mimeType:"application/pdf"});
item.complete();
fetchDOIs(DOIs);
});
ristranslator.translate();
}, function() {});
}
doitranslate.setHandler("error", fallback);
try { doitranslate.translate() } catch (e) {
Zotero.debug("Caught exception");
fallback();
};
}
function doWeb(doc, url) {
@ -51,26 +75,88 @@ function doWeb(doc, url) {
var arts = new Array();
if (detectWeb(doc, url) == "multiple") {
var items = new Object();
var results = doc.evaluate('//td[*//td[*//a[contains(text(), "Abstract")]]]', doc, nsResolver, XPathResult.ANY_TYPE, null);
var results = doc.evaluate('//div[@class="searchResCol1"]', doc, nsResolver, XPathResult.ANY_TYPE, null);
var result;
while (result = results.iterateNext()) {
var title = doc.evaluate('.//strong', result, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
var link = doc.evaluate('.//a[contains(text(), "Abstract")]', result, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().href;
var pdflink = doc.evaluate('.//a[contains(text(), "PDF")]', result, nsResolver, XPathResult.ANY_TYPE, null).iterateNext() ? doc.evaluate('.//a[contains(text(), "PDF")]', result, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().href : null;
var links = new Array(link, pdflink);
items[links] = title;
}
items = Zotero.selectItems(items);
for (var i in items) {
arts.push(i);
var title = doc.evaluate('.//h4/a', result, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
var doi = doc.evaluate('.//span[@class="doi"]/strong/a', result, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
items[doi] = title.trim();
}
Zotero.selectItems(items, function(items) {
if(!items) return true;
for (var i in items) {
arts.push(i);
}
fetchDOIs(arts);
Zotero.wait();
});
} else {
var pdfurl = doc.evaluate('//a[contains(text(), "PDF")]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().href;
var links = url + ',' + pdfurl;
arts = [links];
var doi = doc.evaluate('//meta[@name="citation_doi"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().content;
fetchDOIs([doi]);
Zotero.wait();
}
for each (var linkset in arts) {
var urls = linkset.split(',');
parseRIS(urls[0], urls[1]);
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://iopscience.iop.org/0022-3727/34/10/311",
"items": [
{
"itemType": "journalArticle",
"creators": [
{
"creatorType": "author",
"firstName": "J",
"lastName": "Batina"
},
{
"creatorType": "author",
"firstName": "F",
"lastName": "Noël"
},
{
"creatorType": "author",
"firstName": "S",
"lastName": "Lachaud"
},
{
"creatorType": "author",
"firstName": "R",
"lastName": "Peyrous"
},
{
"creatorType": "author",
"firstName": "J F",
"lastName": "Loiseau"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"attachments": [
{
"url": false,
"title": "IOP Full Text PDF",
"mimeType": "application/pdf"
}
],
"publicationTitle": "Journal of Physics D: Applied Physics",
"volume": "34",
"ISSN": "0022-3727, 1361-6463",
"date": "2001-05-21",
"pages": "1510-1524",
"DOI": "10.1088/0022-3727/34/10/311",
"url": "http://iopscience.iop.org/0022-3727/34/10/311",
"title": "Hydrodynamical simulation of the electric wind in a cylindrical vessel with positive point-to-plane device",
"libraryCatalog": "CrossRef"
}
]
},
{
"type": "web",
"url": "http://iopscience.iop.org/search?searchType=fullText&fieldedquery=fun&f=titleabs&time=all&submit=Search&navsubmit=Search",
"items": "multiple"
}
}
]
/** END TEST CASES **/

View file

@ -0,0 +1,220 @@
{
"translatorID": "5d506fe3-dbde-4424-90e8-d219c63faf72",
"label": "Library Catalog (BiblioCommons)",
"creator": "Avram Lyon",
"target": "^https?://[^.]+\\.bibliocommons\\.com\\/",
"minVersion": "2.1",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcs",
"lastUpdated": "2011-07-19 20:37:25"
}
/*
BiblioCommons Translator
Copyright (C) 2011 Avram Lyon, ajlyon@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function detectWeb(doc, url) {
if (url.match(/\/item\/(?:show|catalogue_info)/))
return "book";
if (url.match(/\/search\?t=/))
return "multiple";
return false;
}
function doWeb(doc, url) {
var n = doc.documentElement.namespaceURI;
var ns = n ? function(prefix) {
if (prefix == 'x') return n; else return null;
} : null;
// Load MARC
var translator = Z.loadTranslator("import");
translator.setTranslator("a6ee60df-1ddc-4aae-bb25-45e0537be973");
var domain = url.match(/https?:\/\/([^.\/]+)/)[1];
if (url.match(/\/item\/show/)) {
Zotero.Utilities.doGet(url.replace(/\/item\/show/,"/item/catalogue_info"),
function (text) {
translator.getTranslatorObject(function (obj) {
processor({
translator: obj,
text: text,
domain: domain
});
})
}, function() {Zotero.done()});
} else if (url.match(/\/item\/catalogue_info/)) {
translator.getTranslatorObject(function (obj) {
processor({
translator: obj,
text: doc.documentElement.innerHTML,
domain: domain
});
})
} else if (url.match(/\/search\?t=/)) {
var results = doc.evaluate('//div[@id="bibList"]/div/div//span[@class="title"]/a[1]', doc, ns, XPathResult.ANY_TYPE, null);
var items = new Array();
var result;
while(result = results.iterateNext()) {
var title = result.textContent;
var url = result.href.replace(/\/show\//,"/catalogue_info/");
items[url] = title;
}
Zotero.selectItems(items, function (items) {
var urls = [];
var i;
for (i in items) urls.push(i);
Zotero.Utilities.doGet(urls, function (text) {
translator.getTranslatorObject(function (obj) {
processor({
translator: obj,
text: text,
domain: domain
});
})
}, function() {Zotero.done()});
});
Zotero.wait();
}
}
function processor (obj) {
// Gets {translator: , text: }
// Here, we split up the table and insert little placeholders between record bits
var marced = obj.text.replace(/\s+/g," ")
.replace(/^.*<div id="marc_details">(?:\s*<[^>"]+>\s*)*/,"")
.replace(/<tr +class="(?:odd|even)">\s*/g,"")
.replace(/<td +class="marcTag"><strong>(\d+)<\/strong><\/td>\s*/g,"$1\x1F")
// We may be breaking the indicator here
.replace(/<td\s+class="marcIndicator">\s*(\d*)\s*<\/td>\s*/g,"$1\x1F")
.replace(/<td +class="marcTagData">(.*?)<\/td>\s*<\/tr>\s*/g,"$1\x1E")
.replace(/\x1F(?:[^\x1F]*)$/,"\x1F")
// We have some extra 0's at the start of the leader
.replace(/^000/,"");
//Z.debug(marced);
// We've used the record delimiter to delimit fields
var fields = marced.split("\x1E");
// The preprocess function gets the translator object, if available
// This is pretty vital for fancy translators like MARC
var marc = obj["translator"];
// Make a record, only one.
var record = new marc.record();
// The first piece is the MARC leader
record.leader = fields.shift();
for each (var field in fields) {
// Skip blanks
if (field.replace(/\x1F|\s/g,"") == "") continue;
// We're using the subfield delimiter to separate the field code,
// indicator, and the content.
var pieces = field.split("\x1F");
record.addField(pieces[0].trim(),
pieces[1].trim(),
// Now we insert the subfield delimiter
pieces[2].replace(/\$([a-z]|$)/g,"\x1F$1").trim());
}
// returns {translator: , text: false, items: [Zotero.Item[]]}
var item = new Zotero.Item();
record.translate(item);
item.libraryCatalog = obj.domain + " Library Catalog";
item.complete();
return true;
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://bostonpl.bibliocommons.com/item/catalogue_info/2993906042_test",
"items": [
{
"itemType": "book",
"creators": [
{
"firstName": "William",
"lastName": "Sleator",
"creatorType": "author"
}
],
"notes": [],
"tags": [
"Education",
"Immigrants",
"Conspiracies",
"Political corruption",
"Educational tests and measurements"
],
"seeAlso": [],
"attachments": [],
"ISBN": "0810993562",
"title": "Test",
"place": "New York",
"publisher": "Amulet Books",
"date": "2008",
"numPages": "298",
"callNumber": "SLEATOR W",
"libraryCatalog": "bostonpl Library Catalog"
}
]
},
{
"type": "web",
"url": "http://nypl.bibliocommons.com/search?t=smart&search_category=keyword&q=tatar&commit=Search&searchOpt=catalogue",
"items": "multiple"
},
{
"type": "web",
"url": "http://bostonpl.bibliocommons.com/item/show/3679347042_adam_smith",
"items": [
{
"itemType": "book",
"creators": [
{
"firstName": "James R",
"lastName": "Otteson",
"creatorType": "author"
}
],
"notes": [],
"tags": [
"Smith, Adam",
"Classical school of economics",
"Free enterprise"
],
"seeAlso": [],
"attachments": [],
"ISBN": "9780826429834",
"title": "Adam Smith",
"place": "New York",
"publisher": "Continuum",
"date": "2011",
"numPages": "179",
"series": "Major conservative and libertarian thinkers",
"seriesNumber": "v. 16",
"callNumber": "HB103.S6",
"libraryCatalog": "bostonpl Library Catalog"
}
]
}
]
/** END TEST CASES **/

View file

@ -1,14 +1,14 @@
{
"translatorID":"774d7dc2-3474-2684-392c-f787789ec63d",
"translatorType":4,
"label":"Library Catalog (Dynix)",
"creator":"Simon Kornblith and Sylvain Machefert",
"target":"ipac\\.jsp\\?.*(?:uri=(?:link|full)=[0-9]|menu=search|term=)",
"minVersion":"1.0.0b3.r1",
"maxVersion":"",
"priority":100,
"inRepository":true,
"lastUpdated":"2011-06-04 22:44:38"
"translatorID": "774d7dc2-3474-2684-392c-f787789ec63d",
"label": "Library Catalog (Dynix)",
"creator": "Simon Kornblith and Sylvain Machefert",
"target": "ipac\\.jsp\\?.*(?:uri=(?:link|full)=[0-9]|menu=search|term=)",
"minVersion": "2.1",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"lastUpdated": "2011-07-24 19:43:47"
}
function detectWeb(doc, url) {
@ -40,7 +40,10 @@ function doWeb(doc, url) {
var uris = new Array();
if(detectWeb(doc,uri) == "book") {
uris.push(uri+'&fullmarc=true');
if (uri.indexOf("#") !== -1)
uris.push(uri.replace(/#/,'&fullmarc=true#'));
else
uris.push(uri+'&fullmarc=true');
} else {
var items = Zotero.Utilities.getItemArray(doc, doc, "ipac\.jsp\?.*uri=(?:full|link)=[0-9]|^javascript:buildNewList\\('.*uri%3Dfull%3D[0-9]", "Show details");
items = Zotero.selectItems(items);
@ -64,9 +67,15 @@ function doWeb(doc, url) {
var translator = Zotero.loadTranslator("import");
translator.setTranslator("a6ee60df-1ddc-4aae-bb25-45e0537be973");
var marc = translator.getTranslatorObject();
Zotero.Utilities.processDocuments(uris, function(newDoc) {
translator.getTranslatorObject(function (marc) {
Zotero.Utilities.processDocuments(uris, function (newDoc) {
scrape(newDoc, marc);
}, function() { Zotero.done() }, null);
});
Zotero.wait();
}
function scrape(newDoc, marc) {
var uri = newDoc.location.href;
var namespace = newDoc.documentElement.namespaceURI;
@ -127,7 +136,7 @@ function doWeb(doc, url) {
var newItem = new Zotero.Item();
record.translate(newItem);
var domain = url.match(/https?:\/\/([^/]+)/);
var domain = uri.match(/https?:\/\/([^/]+)/);
newItem.repository = domain[1]+" Library Catalog";
// 20091210 : We try to get a permalink on the record
@ -150,7 +159,79 @@ function doWeb(doc, url) {
}
newItem.complete();
}, function() { Zotero.done() }, null);
Zotero.wait();
}
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://siris-libraries.si.edu/ipac20/ipac.jsp?&profile=all&source=~!silibraries&uri=full=3100001~!820431~!0#focus",
"items": [
{
"itemType": "book",
"creators": [
{
"lastName": "Pennsylvania Academy of the Fine Arts",
"fieldMode": true
},
{
"firstName": "Thomas",
"lastName": "Eakins",
"creatorType": "contributor"
},
{
"firstName": "Susan Macdowell",
"lastName": "Eakins",
"creatorType": "contributor"
},
{
"firstName": "Benjamin",
"lastName": "Eakins",
"creatorType": "contributor"
},
{
"firstName": "Charles",
"lastName": "Bregler",
"creatorType": "contributor"
},
{
"firstName": "Kathleen A",
"lastName": "Foster",
"creatorType": "contributor"
}
],
"notes": [],
"tags": [
"Eakins, Thomas",
"Eakins, Susan Macdowell",
"Eakins, Benjamin",
"Bregler, Charles",
"Bregler, Charles",
"Library",
"McDowell family",
"Manuscripts",
"Private collections",
"Pennsylvania Philadelphia"
],
"seeAlso": [],
"attachments": [
{
"url": false,
"title": "Original record",
"mimeType": "text/html",
"snapshot": false
}
],
"ISBN": "0812282248",
"title": "Charles Bregler's Thomas Eakins collection",
"place": "Philadelphia, PA",
"publisher": "University of Pennsylvania Press",
"date": "1989",
"numPages": "37",
"callNumber": "mfc 000652",
"libraryCatalog": "siris-libraries.si.edu Library Catalog"
}
]
}
]
/** END TEST CASES **/

View file

@ -1,14 +1,14 @@
{
"translatorID":"4fd6b89b-2316-2dc4-fd87-61a97dd941e8",
"label":"Library Catalog (InnoPAC)",
"creator":"Simon Kornblith and Michael Berkowitz",
"target":"(search~|\\/search\\?|(a|X|t|Y|w)\\?|\\?(searchtype|searchscope)|frameset&FF|record=b[0-9]+(~S[0-9])?|/search/q\\?)",
"minVersion":"1.0.0b3.r1",
"maxVersion":"",
"priority":200,
"inRepository":true,
"translatorType":4,
"lastUpdated":"2010-09-28 06:55:00"
"translatorID": "4fd6b89b-2316-2dc4-fd87-61a97dd941e8",
"label": "Library Catalog (InnoPAC)",
"creator": "Simon Kornblith and Michael Berkowitz",
"target": "(search~|\\/search\\?|(a|X|t|Y|w)\\?|\\?(searchtype|searchscope)|frameset&FF|record=b[0-9]+(~S[0-9])?|/search/q\\?)",
"minVersion": "1.0.0b3.r1",
"maxVersion": "",
"priority": 200,
"inRepository": true,
"translatorType": 4,
"lastUpdated": "2011-07-22 17:52:39"
}
function detectWeb(doc, url) {
@ -56,7 +56,7 @@ function detectWeb(doc, url) {
}
}
// Next, look for the MARC button
xpath = '//a[img[@src="/screens/marc_display.gif" or @src="/screens/marcdisp.gif" or starts-with(@alt, "MARC ") or @src="/screens/regdisp.gif" or @alt="REGULAR RECORD DISPLAY"]]';
xpath = '//a[img[@src="/screens/marc_display.gif" or @src="/screens/ico_marc.gif" or @src="/screens/marcdisp.gif" or starts-with(@alt, "MARC ") or @src="/screens/regdisp.gif" or @alt="REGULAR RECORD DISPLAY"]] | //a[span/img[@src="/screens/marc_display.gif" or @src="/screens/ico_marc.gif" or @src="/screens/marcdisp.gif" or starts-with(@alt, "MARC ") or @src="/screens/regdisp.gif" or @alt="REGULAR RECORD DISPLAY"]]';
elmt = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
if(elmt) {
return "book";
@ -172,8 +172,8 @@ function doWeb(doc, url) {
if (m) {
newUri = uri.replace(/frameset/, "marc");
} else {
var xpath = '//a[img[@src="/screens/marc_display.gif" or @src="/screens/marcdisp.gif" or starts-with(@alt, "MARC ") or @src="/screens/regdisp.gif" or @alt="REGULAR RECORD DISPLAY"]]';
newUri = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().href.replace(/frameset/, "marc");;
var xpath = '//a[img[@src="/screens/marc_display.gif" or @src="/screens/ico_marc.gif" or @src="/screens/marcdisp.gif" or starts-with(@alt, "MARC ") or @src="/screens/regdisp.gif" or @alt="REGULAR RECORD DISPLAY"]] | //a[span/img[@src="/screens/marc_display.gif" or @src="/screens/ico_marc.gif" or @src="/screens/marcdisp.gif" or starts-with(@alt, "MARC ") or @src="/screens/regdisp.gif" or @alt="REGULAR RECORD DISPLAY"]]';
newUri = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().href.replace(/frameset/, "marc");
}
pageByPage(marc, [newUri]);
} else { // Search results page
@ -186,7 +186,7 @@ function doWeb(doc, url) {
var firstURL = false;
var tableRows = doc.evaluate('//table[@class="browseScreen"]//tr[@class="browseEntry" or @class="briefCitRow" or td/input[@type="checkbox"] or td[contains(@class,"briefCitRow")]]',
doc, nsResolver, XPathResult.ANY_TYPE, null);
doc, nsResolver, XPathResult.ANY_TYPE, null);
// Go through table rows
var i = 0;
while(tableRow = tableRows.iterateNext()) {
@ -228,3 +228,50 @@ function doWeb(doc, url) {
Zotero.wait();
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://books.luther.edu/record=b2115431~S9",
"items": [
{
"itemType": "book",
"creators": [
{
"firstName": "G. W",
"lastName": "Kimura",
"creatorType": "contributor"
},
{
"lastName": "ebrary, Inc",
"fieldMode": true
}
],
"notes": [],
"tags": [
"Alaska",
"History",
"Alaska",
"Anniversaries, etc",
"Alaska",
"Social conditions",
"Alaska",
"Economic conditions",
"Electronic books"
],
"seeAlso": [],
"attachments": [],
"title": "Alaska at 50 the past, present, and next fifty years of statehood",
"place": "Fairbanks",
"publisher": "University of Alaska Press",
"date": "2009",
"numPages": "285",
"callNumber": "F904 .A477 2009eb",
"libraryCatalog": "books.luther.edu Library Catalog"
}
]
}
]
/** END TEST CASES **/

View file

@ -1,14 +1,14 @@
{
"translatorID":"add7c71c-21f3-ee14-d188-caf9da12728b",
"translatorType":4,
"label":"Library Catalog (SIRSI)",
"creator":"Sean Takats & Hicham El Kasmi(Dutch Language fields)",
"target":"/uhtbin/cgisirsi",
"minVersion":"1.0.0b3.r1",
"maxVersion":"",
"priority":100,
"inRepository":true,
"lastUpdated":"2011-01-11 04:31:00"
"translatorID": "add7c71c-21f3-ee14-d188-caf9da12728b",
"label": "Library Catalog (SIRSI)",
"creator": "Sean Takats, Hicham El Kasmi",
"target": "/uhtbin/(?:cgisirsi|quick_keyword)",
"minVersion": "2.1",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"lastUpdated": "2011-07-25 13:01:08"
}
function detectWeb(doc, url) {
@ -29,7 +29,7 @@ function detectWeb(doc, url) {
return "book";
}
var elmts = doc.evaluate('/html/body/form//text()', doc, nsResolver,
XPathResult.ANY_TYPE, null);
XPathResult.ANY_TYPE, null);
while(elmt = elmts.iterateNext()) {
if(Zotero.Utilities.superCleanString(elmt.nodeValue) == "Viewing record") {
Zotero.debug("SIRSI detectWeb: Viewing record");
@ -47,7 +47,6 @@ function detectWeb(doc, url) {
Zotero.debug("SIRSI detectWeb: hitlist");
return "multiple";
}
// var xpath = '//input[@type="checkbox"]'
}
function scrape(doc) {
@ -102,9 +101,9 @@ function scrape(doc) {
var pubParts = value.split(" : ");
newItem.place = pubParts[0];
if (pubParts[1].match(/\d+/)) {
newItem.date = pubParts[1].match(/\d+/)[0];
newItem.publisher = pubParts[1].match(/(.*),/)[1];
}
newItem.date = pubParts[1].match(/\d+/)[0];
newItem.publisher = pubParts[1].match(/(.*),/)[1];
}
} else if(field == "personal author" || field == "autor personal" || field == "auteur") {
if(authors.indexOf(value) == -1) {
value = value.replace(/(\(|\)|\d+|\-)/g, "");
@ -166,10 +165,18 @@ function scrape(doc) {
if(newItem.extra) {
newItem.extra = newItem.extra.substr(0, newItem.extra.length-1);
}
var callNumber = doc.evaluate('//tr/td[1][@class="holdingslist"]/text()', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
if(callNumber && callNumber.nodeValue) {
newItem.callNumber = callNumber.nodeValue;
newItem.callNumber = callNumber.nodeValue.trim();
}
// UVA has the call number separately, in the next field
// http://virgo.lib.virginia.edu
callNumber = doc.evaluate('//tr/td[2][@class="holdingslist"]/text()', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
// The regex here is looking for something like an LOC call number
if(callNumber && callNumber.nodeValue.trim().match(/^[A-Z]{1,2}[0-9]+/)) {
newItem.callNumber += " " + callNumber.nodeValue.trim();
}
var domain = doc.location.href.match(/https?:\/\/([^/]+)/);
@ -201,7 +208,7 @@ function doWeb(doc, url){
sirsiNew = false;
} else {
var elmts = doc.evaluate('/html/body/form//text()', doc, nsResolver,
XPathResult.ANY_TYPE, null);
XPathResult.ANY_TYPE, null);
while(elmt = elmts.iterateNext()) {
if(Zotero.Utilities.superCleanString(elmt.nodeValue) == "Viewing record") {
Zotero.debug("SIRSI doWeb: Viewing record");

View file

@ -9,7 +9,7 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcs",
"lastUpdated": "2011-07-01 02:14:28"
"lastUpdated": "2011-07-04 13:09:56"
}
function detectWeb(doc, url) {
@ -184,78 +184,77 @@ function doWeb(doc, url) {
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://catalog.loc.gov/cgi-bin/Pwebrecon.cgi?DB=local&Search_Arg=zotero&Search_Code=GKEY^*&CNT=100&hist=1&type=quick",
"items": [
{
"itemType": "book",
"creators": [
{
"firstName": "Jason",
"lastName": "Puckett",
"creatorType": "author"
}
],
"notes": [],
"tags": [
"Zotero",
"Bibliographical citations",
"Computer programs",
"Citation of electronic information resources",
"Computer programs"
],
"seeAlso": [],
"attachments": [],
"ISBN": "9780838985892",
"title": "Zotero: A Guide for Librarians, Researchers, and Educators",
"place": "Chicago",
"publisher": "Association of College and Research Libraries",
"date": "2011",
"callNumber": "PN171.F56 P83 2011",
"libraryCatalog": "Library of Congress Catalog",
"shortTitle": "Zotero"
},
{
"itemType": "book",
"creators": [
{
"lastName": "IAMSLIC Conference",
"fieldMode": true
},
{
"firstName": "Dorothy",
"lastName": "Barr",
"creatorType": "contributor"
},
{
"lastName": "International Association of Aquatic and Marine Science Libraries and Information Centers",
"fieldMode": true
}
],
"notes": [],
"tags": [
"Marine science libraries",
"Marine sciences",
"Information services",
"Aquatic science libraries",
"Aquatic sciences",
"Information services",
"Fishery libraries",
"Fisheries",
"Information services"
],
"seeAlso": [],
"attachments": [],
"title": "Netting Knowledge: Two Hemispheres/One World: Proceedings of the 36th IAMSLIC Annual Conference",
"place": "Fort Pierce, Fla",
"publisher": "IAMSLIC",
"date": "2011",
"callNumber": "Z675.M35 I2 2010",
"libraryCatalog": "Library of Congress Catalog",
"shortTitle": "Netting Knowledge"
}
]
}
{
"type": "web",
"url": "http://catalog.loc.gov/cgi-bin/Pwebrecon.cgi?DB=local&Search_Arg=zotero&Search_Code=GKEY^*&CNT=100&hist=1&type=quick",
"items": "multiple"
},
{
"type": "web",
"url": "https://i-share.carli.illinois.edu/nby/cgi-bin/Pwebrecon.cgi?DB=local&v1=1&BBRecID=790862",
"items": [
{
"itemType": "book",
"creators": [
{
"firstName": "Francisco",
"lastName": "Xarque",
"creatorType": "author"
}
],
"notes": [],
"tags": [
"Masseta, Simon",
"Cuellar y Mosquera, Gabriel de",
"Missions",
"Paraguay"
],
"seeAlso": [],
"attachments": [],
"title": "Insignes missioneros de la Compañia de Jesus en la prouincia del Paraguay: estado presente de sus missiones en Tucuman, Paraguay, y Rio de la Plata, que comprehende su distrito",
"place": "En Pamplona",
"publisher": "Por Juan Micòn, Impressor",
"date": "1687",
"numPages": "24",
"callNumber": "F2681 .X3",
"libraryCatalog": "i-share.carli.illinois.edu Library Catalog",
"shortTitle": "Insignes missioneros de la Compañia de Jesus en la prouincia del Paraguay"
}
]
},
{
"type": "web",
"url": "http://catalog.loc.gov/cgi-bin/Pwebrecon.cgi?v1=1&ti=1,1&Search%5FArg=zotero&Search%5FCode=GKEY%5E%2A&CNT=100&type=quick&PID=UiW_ZKCUShsRhZ5pIpsx_-5hND3W&SEQ=20110704130645&SID=1",
"items": [
{
"itemType": "book",
"creators": [
{
"firstName": "Jason",
"lastName": "Puckett",
"creatorType": "author"
}
],
"notes": [],
"tags": [
"Zotero",
"Bibliographical citations",
"Computer programs",
"Citation of electronic information resources",
"Computer programs"
],
"seeAlso": [],
"attachments": [],
"ISBN": "9780838985892",
"title": "Zotero: a guide for librarians, researchers, and educators",
"place": "Chicago",
"publisher": "Association of College and Research Libraries",
"date": "2011",
"callNumber": "PN171.F56 P83 2011",
"libraryCatalog": "Library of Congress Catalog",
"shortTitle": "Zotero"
}
]
}
]
/** END TEST CASES **/

View file

@ -1,15 +1,15 @@
{
"translatorID":"a6ee60df-1ddc-4aae-bb25-45e0537be973",
"translatorType":1,
"label":"MARC",
"creator":"Simon Kornblith, updated for unimarc by Sylvain Machefert",
"target":"marc",
"minVersion":"1.0.0b3.r1",
"maxVersion":"",
"priority":100,
"browserSupport":"gcs",
"inRepository":true,
"lastUpdated":"2011-07-01 06:23:45"
"translatorID": "a6ee60df-1ddc-4aae-bb25-45e0537be973",
"label": "MARC",
"creator": "Simon Kornblith, Sylvain Machefert",
"target": "marc",
"minVersion": "2.1.9",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 1,
"browserSupport": "gcsn",
"lastUpdated": "2011-07-21 17:16:37"
}
function detectImport() {
@ -171,8 +171,8 @@ record.prototype.getField = function(field) {
// add to array, replacing null characters
fields.push([this.content.substr(location[0], this.indicatorLength),
this.content.substr(location[0]+this.indicatorLength,
location[1]-this.indicatorLength-1).replace(/\x00/g, "")]);
this.content.substr(location[0]+this.indicatorLength,
location[1]-this.indicatorLength-1).replace(/\x00/g, "")]);
}
return fields;
@ -195,6 +195,10 @@ record.prototype.getFieldSubfields = function(tag) { // returns a two-dimensiona
var subfieldIndex = subfields[j].substr(0, this.subfieldCodeLength-1);
if(!returnFields[i][subfieldIndex]) {
returnFields[i][subfieldIndex] = subfields[j].substr(this.subfieldCodeLength-1);
} else {
// Duplicate subfield
Zotero.debug("Duplicate subfield '"+tag+" "+subfieldIndex+"="+subfields[j]);
returnFields[i][subfieldIndex] = returnFields[i][subfieldIndex] + " " + subfields[j].substr(this.subfieldCodeLength-1);
}
}
}
@ -240,6 +244,24 @@ record.prototype._associateDBField = function(item, fieldNo, part, fieldName, ex
}
}
// add field to DB as note
record.prototype._associateNotes = function(item, fieldNo, part) {
var field = this.getFieldSubfields(fieldNo);
var texts = [];
for(var i in field) {
for(var j=0; j<part.length; j++) {
var myPart = part[j];
if(field[i][myPart]) {
texts.push(clean(field[i][myPart]));
}
}
}
var text = texts.join(' ');
if (text.trim() != "")
item.notes.push({note: text});
}
// add field to DB as tags
record.prototype._associateTags = function(item, fieldNo, part) {
var field = this.getFieldSubfields(fieldNo);
@ -335,8 +357,8 @@ record.prototype.translate = function(item) {
this._associateDBField(item, "330", "a", "abstractNote");
// Extract tags
// TODO : Ajouter les autres champs en 6xx avec les autorit<EFBFBD>s construites.
// n<EFBFBD>cessite de reconstruire les autorit<69>s
// TODO : Ajouter les autres champs en 6xx avec les autorités construites.
// nécessite de reconstruire les autorités
this._associateTags(item, "610", "a");
// Extract scale (for maps)
@ -427,6 +449,17 @@ record.prototype.translate = function(item) {
this._associateTags(item, "658", "ab");
// hierarchical geographic place name
this._associateTags(item, "662", "abcdfgh");
// Extract note fields
// http://www.loc.gov/marc/bibliographic/bd5xx.html
// general note
this._associateNotes(item, "500", "a");
// formatted contents (table of contents)
this._associateNotes(item, "505", "art");
// summary
this._associateNotes(item, "520", "ab");
// biographical or historical data
this._associateNotes(item, "545", "ab");
// Extract title
this._associateDBField(item, "245", "ab", "title");
@ -446,9 +479,12 @@ record.prototype.translate = function(item) {
this._associateDBField(item, "260", "c", "date", pullNumber);
// Extract pages
this._associateDBField(item, "300", "a", "numPages", pullNumber);
// Extract series
// Extract series and series number
// The current preference is 490
this._associateDBField(item, "490", "a", "series");
this._associateDBField(item, "490", "v", "seriesNumber");
// 440 was made obsolete as of 2008; see http://www.loc.gov/marc/bibliographic/bd4xx.html
this._associateDBField(item, "440", "a", "series");
// Extract series number
this._associateDBField(item, "440", "v", "seriesNumber");
// Extract call number
this._associateDBField(item, "084", "ab", "callNumber");
@ -459,6 +495,7 @@ record.prototype.translate = function(item) {
this._associateDBField(item, "050", "ab", "callNumber");
this._associateDBField(item, "090", "a", "callNumber");
this._associateDBField(item, "099", "a", "callNumber");
this._associateDBField(item, "852", "khim", "callNumber");
//German
if (!item.place) this._associateDBField(item, "410", "a", "place");
@ -524,4 +561,49 @@ function doImport() {
holdOver += text;
}
}
}
}
exports.record = record;
exports.fieldTerminator = fieldTerminator;
exports.recordTerminator = recordTerminator;
exports.subfieldDelimiter = subfieldDelimiter;
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "import",
"input": "01841cam a2200385Ma 45\u00020001000700000005001700007008004100024010001700065035002300082035001800105040003000123043001200153050001500165049001500180100003900195245028100234260005900515300006100574500019500635500014500830510003000975510002701005510004501032500002601077610004401103600004001147600004801187650004501235610004501280852005801325946003101383910001001414994001201424947001901436\u001e790862\u001e20080120004008.0\u001e880726s1687 sp bf 000 0cspa d\u001e \u001fa 03021876 \u001e \u001fa(OCoLC)ocm29051663\u001e \u001fa(NBYdb)790862\u001e \u001faMNU\u001fcMNU\u001fdOCL\u001fdDIBAM\u001fdIBV\u001e \u001fas-py---\u001e0 \u001faF2681\u001fb.X3\u001e \u001faIBVA\u001flbklr\u001e1 \u001faXarque, Francisco,\u001fdca. 1609-1691.\u001e10\u001faInsignes missioneros de la Compañia de Jesus en la prouincia del Paraguay :\u001fbestado presente de sus missiones en Tucuman, Paraguay, y Rio de la Plata, que comprehende su distrito /\u001fcpor el doct. d. Francisco Xarque, dean de la Catredral [sic] de Santa Maria de Albarrazin ...\u001e \u001faEn Pamplona :\u001fbPor Juan Micòn, Impressor,\u001fcaño 1687.\u001e \u001fa[24], 432 p., [1] folded leaf of plates :\u001fbmap ;\u001fc22 cm.\u001e \u001faBrunet and Graesse both mention a map of Paraguay; this copy has a map of Chile with title: Tabula geocraphica [sic] regni Chile / studio et labore P. Procuratoris Chilensis Societatis Jesu.\u001e \u001faIn 3 books; the first two are biographies of Jesuits, Simon Mazeta and Francisco Diaz Taño, the 3rd deals with Jesuit missions in Paraguay.\u001e4 \u001faNUC pre-1956,\u001fcNX0000604.\u001e4 \u001faSabin,\u001fc105716 (v.29).\u001e4 \u001faPalau y Dulcet (2nd ed.),\u001fc123233 (v.7).\u001e \u001faHead and tail pieces.\u001e20\u001faJesuits\u001fzParaguay\u001fvEarly works to 1800.\u001e10\u001faMasseta, Simon,\u001fdca. 1582-ca. 1656.\u001e10\u001faCuellar y Mosquera, Gabriel de,\u001fd1593-1677.\u001e 0\u001faMissions\u001fzParaguay\u001fvEarly works to 1800.\u001e20\u001faJesuits\u001fvBiography\u001fvEarly works to 1800.\u001e8 \u001fbvau,ayer\u001fkVAULT\u001fhAyer\u001fi1343\u001fi.J515\u001fiP211\u001fiX2\u001fi1687\u001ft1\u001e \u001faOCLC RECON PROJECT\u001farc3758\u001e \u001fa35535\u001e \u001fa02\u001fbIBV\u001e \u001faMARS\u001fa20071227\u001e\u001d",
"items": [
{
"itemType": "book",
"creators": [
{
"firstName": "Francisco",
"lastName": "Xarque",
"creatorType": "author"
}
],
"notes": [
{
"note": "Brunet and Graesse both mention a map of Paraguay; this copy has a map of Chile with title: Tabula geocraphica [sic] regni Chile / studio et labore P. Procuratoris Chilensis Societatis Jesu In 3 books; the first two are biographies of Jesuits, Simon Mazeta and Francisco Diaz Taño, the 3rd deals with Jesuit missions in Paraguay Head and tail pieces"
}
],
"tags": [
"Masseta, Simon",
"Cuellar y Mosquera, Gabriel de",
"Missions",
"Paraguay"
],
"seeAlso": [],
"attachments": [],
"title": "Insignes missioneros de la Compañia de Jesus en la prouincia del Paraguay: estado presente de sus missiones en Tucuman, Paraguay, y Rio de la Plata, que comprehende su distrito",
"place": "En Pamplona",
"publisher": "Por Juan Micòn, Impressor",
"date": "1687",
"numPages": "24",
"callNumber": "VAULT Ayer 1343 .J515 P211 X2 1687"
}
]
}
]
/** END TEST CASES **/

View file

@ -1,14 +1,15 @@
{
"translatorID":"2e43f4a9-d2e2-4112-a6ef-b3528b39b4d2",
"translatorType":4,
"label":"MIT Press Journals",
"creator":"Michael Berkowitz",
"target":"http://www.mitpressjournals.org/",
"minVersion":"1.0.0b4.r5",
"maxVersion":"",
"priority":100,
"inRepository":true,
"lastUpdated":"2009-01-08 08:19:07"
"translatorID": "2e43f4a9-d2e2-4112-a6ef-b3528b39b4d2",
"label": "MIT Press Journals",
"creator": "Michael Berkowitz",
"target": "http://www.mitpressjournals.org/",
"minVersion": "1.0.0b4.r5",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "g",
"lastUpdated": "2011-07-13 12:10:55"
}
function detectWeb(doc, url) {
@ -66,4 +67,57 @@ function doWeb(doc, url) {
});
}, function() {Zotero.done();});
Zotero.wait();
}
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://www.mitpressjournals.org/toc/afar/43/4",
"items": "multiple"
},
{
"type": "web",
"url": "http://www.mitpressjournals.org/doi/abs/10.1162/afar.2010.43.4.60",
"items": [
{
"itemType": "journalArticle",
"creators": [
{
"lastName": "Verswijver",
"firstName": "Gustaaf",
"creatorType": "author"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"attachments": [
{
"url": false,
"title": "African Arts Snapshot",
"mimeType": "text/html"
},
{
"url": false,
"title": "African Arts Full Text PDF",
"mimeType": "application/pdf"
}
],
"title": "Removable Hair Caps of Karamoja (Uganda)",
"date": "2011/07/13 2010",
"DOI": "i: 10.1162/afar.2010.43.4.60</p>",
"publicationTitle": "African Arts",
"pages": "60-71",
"volume": "43",
"issue": "4",
"publisher": "MIT Press",
"ISBN": "0001-9933",
"ISSN": "0001-9933",
"url": "http://dx.doi.org/10.1162/afar.2010.43.4.60",
"libraryCatalog": "MIT Press Journals"
}
]
}
]
/** END TEST CASES **/

View file

@ -1,16 +1,21 @@
{
"translatorID":"0e2235e7-babf-413c-9acf-f27cce5f059c",
"translatorType":3,
"label":"MODS",
"creator":"Simon Kornblith",
"target":"xml",
"minVersion":"2.1b3",
"maxVersion":"",
"priority":50,
"configOptions":{"dataMode":"xml/e4x"},
"displayOptions":{"exportNotes":true},
"inRepository":true,
"lastUpdated":"2011-04-04 16:00:00"
"translatorID": "0e2235e7-babf-413c-9acf-f27cce5f059c",
"label": "MODS",
"creator": "Simon Kornblith and Richard Karnesky",
"target": "xml",
"minVersion": "2.1.9",
"maxVersion": "",
"priority": 50,
"configOptions": {
"dataMode": "xml/e4x"
},
"displayOptions": {
"exportNotes": true
},
"inRepository": true,
"translatorType": 3,
"browserSupport": "g",
"lastUpdated": "2011-07-18 13:49:58"
}
function detectImport() {
@ -39,8 +44,14 @@ function doExport() {
if(item.title) {
mods.titleInfo.title = item.title;
}
if(item.shortTitle) {
mods.titleInfo += <titleInfo type="abbreviated"><title>{item.shortTitle}</title></titleInfo>;
}
// XML tag typeOfResource/genre; object field type
//
// The exact marcGenre of a book section can, perhaps, be debated;
// But it should have 'book' as the host's genre.
var modsType, marcGenre;
if(item.itemType == "book" || item.itemType == "bookSection") {
modsType = "text";
@ -84,8 +95,7 @@ function doExport() {
// XML tag genre; object field thesisType, type
if(item.thesisType) {
mods.genre += <genre>{item.thesisType}</genre>;
}
if(item.type) {
} else if(item.type) {
mods.genre += <genre>{item.type}</genre>;
}
@ -96,22 +106,41 @@ function doExport() {
roleTerm = "aut";
} else if(item.creators[j].creatorType == "editor") {
roleTerm = "edt";
} else if(item.creators[j].creatorType == "translator") {
roleTerm = "trl";
} else {
roleTerm = "ctb";
}
// FIXME - currently all names are personal
if(item.creators[j].fieldMode == 1) {
mods.name += <name type="personal">
<namePart>{item.creators[j].lastName}</namePart>
<role><roleTerm type="code" authority="marcrelator">{roleTerm}</roleTerm></role>
</name>;
} else {
mods.name += <name type="personal">
<namePart type="family">{item.creators[j].lastName}</namePart>
<namePart type="given">{item.creators[j].firstName}</namePart>
<role><roleTerm type="code" authority="marcrelator">{roleTerm}</roleTerm></role>
</name>;
if(item.creators[j].creatorType != "seriesEditor") {
if(isPartialItem && item.creators[j].creatorType == "editor"){
if(item.creators[j].fieldMode == 1) {
mods.relatedItem.name += <name type="personal">
<namePart>{item.creators[j].lastName}</namePart>
<role><roleTerm type="code" authority="marcrelator">{roleTerm}</roleTerm></role>
</name>;
} else {
mods.relatedItem.name += <name type="personal">
<namePart type="family">{item.creators[j].lastName}</namePart>
<namePart type="given">{item.creators[j].firstName}</namePart>
<role><roleTerm type="code" authority="marcrelator">{roleTerm}</roleTerm></role>
</name>;
}
} else {
if(item.creators[j].fieldMode == 1) {
mods.name += <name type="personal">
<namePart>{item.creators[j].lastName}</namePart>
<role><roleTerm type="code" authority="marcrelator">{roleTerm}</roleTerm></role>
</name>;
} else {
mods.name += <name type="personal">
<namePart type="family">{item.creators[j].lastName}</namePart>
<namePart type="given">{item.creators[j].firstName}</namePart>
<role><roleTerm type="code" authority="marcrelator">{roleTerm}</roleTerm></role>
</name>;
}
}
}
}
@ -141,29 +170,17 @@ function doExport() {
// XML tag detail; object field volume
if(item.volume) {
if(parseInt(item.volume) == item.volume) {
part += <detail type="volume"><number>{item.volume}</number></detail>;
} else {
part += <detail type="volume"><text>{item.volume}</text></detail>;
}
part += <detail type="volume"><number>{item.volume}</number></detail>;
}
// XML tag detail; object field number
if(item.issue) {
if(parseInt(item.issue) == item.issue) {
part += <detail type="issue"><number>{item.issue}</number></detail>;
} else {
part += <detail type="issue"><text>{item.issue}</text></detail>;
}
part += <detail type="issue"><number>{item.issue}</number></detail>;
}
// XML tag detail; object field section
if(item.section) {
if(parseInt(item.section) == item.section) {
part += <detail type="section"><number>{item.section}</number></detail>;
} else {
part += <detail type="section"><text>{item.section}</text></detail>;
}
part += <detail type="section"><number>{item.section}</number></detail>;
}
// XML tag detail; object field pages
@ -209,9 +226,11 @@ function doExport() {
var tag = <{dateType}>{item.date}</{dateType}>;
originInfo += tag;
}
if(item.accessDate) {
originInfo += <dateCaptured>{item.accessDate}</dateCaptured>;
}
if(item.numPages) {
mods.physicalDescription = <physicalDescription><extent unit="pages"><total>{item.numPages}</total></extent></physicalDescription>;
}
if(originInfo.length() != 1) {
if(isPartialItem) {
// For a journal article, bookSection, etc., this goes under the host
@ -220,6 +239,40 @@ function doExport() {
mods.originInfo += <originInfo>{originInfo}</originInfo>;
}
}
// eXist Solutions points out that most types are more often
// monographic than not & will use this internally.
// Perhaps comment this out in the main distribution, though.
mods.originInfo.issuance = "monographic";
if(isPartialItem) {
// eXist Solutions points out that these types are more often
// continuing than not & will use this internally.
// Perhaps comment this out in the main distribution, though.
if(item.itemType == "journalArticle" || item.itemType == "magazineArticle" || item.itemType == "newspaperArticle") {
mods.relatedItem.originInfo.issuance = "continuing";
if(item.itemType == "journalArticle" || item.itemType == "magazineArticle") {
mods.relatedItem.genre += <genre authority="marcgt">periodical</genre>;
} else if (item.itemType == "newspaperArticle") {
mods.relatedItem.genre += <genre authority="marcgt">newspaper</genre>;
}
}
else if (item.itemType == "bookSection" || item.itemType == "conferencePaper" || item.itemType == "encyclopediaArticle") {
mods.relatedItem.originInfo.issuance = "monographic";
if (item.itemType == "bookSection") {
mods.relatedItem.genre += <genre authority="marcgt">book</genre>;
} else if (item.itemType == "conferencePaper") {
mods.relatedItem.genre += <genre authority="marcgt">conference publication</genre>;
if (item.conferenceName) {
mods.relatedItem.name += <name type="conference">
<namePart>{item.conferenceName}</namePart>
</name>;
}
} else if (item.itemType == "encyclopediaArticle") {
mods.relatedItem.genre += <genre authority="marcgt">encyclopedia</genre>;
}
}
}
// XML tag identifier; object fields ISBN, ISSN
if(isPartialItem) {
@ -246,15 +299,19 @@ function doExport() {
if(item.callNumber) {
mods.classification = item.callNumber;
}
// XML tag location.url; object field archiveLocation
if(item.url) {
mods.location.url += item.url;
if(item.accessDate) {
mods.location.url.@dateLastAccessed = item.accessDate;
}
}
// XML tag location.physicalLocation; object field archiveLocation
if(item.archiveLocation) {
mods.location.physicalLocation = item.archiveLocation;
}
// XML tag location.url; object field archiveLocation
if(item.url) {
mods.location.url = item.url;
mods.location += <location><physicalLocation>{item.archiveLocation}</physicalLocation></location>;
}
// XML tag title.titleInfo; object field journalAbbreviation
@ -286,18 +343,34 @@ function doExport() {
for(var j in item.tags) {
mods.subject += <subject><topic>{item.tags[j].tag}</topic></subject>;
}
/** LANGUAGE **/
if(item.language) {
mods.language.languageTerm = <languageTerm type="text">{item.language}</languageTerm>;
}
/** EXTRA->NOTE **/
if(item.extra) {
mods.note += <note>{item.extra}</note>;
}
// XML tag relatedItem.titleInfo; object field series
if(item.seriesTitle || item.series || item.seriesNumber || item.seriesText) {
var series = <relatedItem type="series"/>;
// eXist Solutions points out that these types are more often
// continuing than not & will use this internally.
// Perhaps comment this out in the main distribution, though.
series.originInfo.issuance = "continuing";
if(item.series) {
series.titleInfo.title = item.series;
}
if(item.seriesTitle) {
series.titleInfo.partTitle = item.seriesTitle;
series.titleInfo.title += <title>{item.seriesTitle}</title>;
}
if(item.seriesText) {
@ -305,16 +378,36 @@ function doExport() {
}
if(item.seriesNumber) {
series.titleInfo.partNumber = item.seriesNumber;
series.part.detail = <detail type="volume"><number>{item.seriesNumber}</number></detail>;
}
// handle series editors
for(var j in item.creators) {
var roleTerm = "";
if(item.creators[j].creatorType == "seriesEditor") {
roleTerm = "pbd";
if(item.creators[j].fieldMode == 1) {
series.name += <name type="personal">
<namePart>{item.creators[j].lastName}</namePart>
<role><roleTerm type="code" authority="marcrelator">{roleTerm}</roleTerm></role>
</name>;
} else {
series.name += <name type="personal">
<namePart type="family">{item.creators[j].lastName}</namePart>
<namePart type="given">{item.creators[j].firstName}</namePart>
<role><roleTerm type="code" authority="marcrelator">{roleTerm}</roleTerm></role>
</name>;
}
}
}
// TODO: make this work in import
/*if(item.itemType == "bookSection") {
// For a book section, series info must go inside host tag
//
if(isPartialItem) {
mods.relatedItem.relatedItem = series;
} else {*/
} else {
mods.relatedItem += series;
//}
}
}
modsCollection.mods += mods;
@ -742,9 +835,24 @@ function doImport() {
// Language
// create an array of languages
var languages = new Array();
// E4X filter might need to be updated to include languageTerms that are @type="code" only
for each(var language in mods.m::language.m::languageTerm.(@type == "text")) {
languages.push(language.text().toString());
for each(var language in mods.m::language) {
var code = false;
for each(var term in language.m::languageTerm) {
if (term.@type == "text") {
languages.push(term.text().toString());
code = false;
break;
// code authorities should be used, not ignored
// but we ignore them for now
} else if (term.@type == "code" || term.@authority) {
code = term.text().toString();
}
}
// If we have a code or text content of the node
// (prefer the former), then we add that
if (code || (code = language.text().toString())) {
languages.push(code);
}
}
// join the list separated by semicolons & add it to zotero item
newItem.language = languages.join('; ');
@ -753,3 +861,135 @@ function doImport() {
newItem.complete();
}
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "import",
"input": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\u000a<modsCollection xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.loc.gov/mods/v3\" xsi:schemaLocation=\"http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-3.xsd\">\u000a<mods version=\"3.3\">\u000a <titleInfo>\u000a \u0009 \u0009<title>FranUlmer.com -- Home Page</title>\u000a \u0009</titleInfo>\u000a \u0009<titleInfo type=\"alternative\"><title>Fran Ulmer, Democratic candidate for Governor, Alaska, 2002</title>\u000a \u0009</titleInfo>\u000a \u0009<name type=\"personal\">\u000a \u0009 \u0009<namePart>Ulmer, Fran</namePart>\u000a \u0009</name>\u000a \u0009<genre>Web site</genre>\u000a \u0009<originInfo>\u000a \u0009 \u0009<dateCaptured point=\"start\" encoding=\"iso8601\">20020702 </dateCaptured>\u000a \u0009 \u0009<dateCaptured point=\"end\" encoding=\"iso8601\"> 20021203</dateCaptured>\u000a \u0009</originInfo>\u000a \u0009<language>\u000a \u0009 \u0009<languageTerm authority=\"iso639-2b\">eng</languageTerm>\u000a \u0009</language>\u000a \u0009<physicalDescription>\u000a \u0009 \u0009<internetMediaType>text/html</internetMediaType>\u000a \u0009 \u0009<internetMediaType>image/jpg</internetMediaType>\u000a \u0009</physicalDescription>\u000a \u0009<abstract>Web site promoting the candidacy of Fran Ulmer, Democratic candidate for Governor, Alaska, 2002. Includes candidate biography, issue position statements, campaign contact information, privacy policy and campaign news press releases. Site features enable visitors to sign up for campaign email list, volunteer, make campaign contributions and follow links to other internet locations. </abstract>\u000a \u0009<subject>\u000a \u0009 \u0009<topic>Elections</topic>\u000a \u0009 \u0009<geographic>Alaska</geographic>\u000a \u0009</subject>\u000a \u0009<subject>\u000a \u0009 \u0009<topic>Governors</topic>\u000a \u0009 \u0009<geographic>Alaska</geographic>\u000a \u0009 \u0009<topic>Election</topic>\u000a \u0009</subject>\u000a \u0009<subject>\u000a \u0009 \u0009<topic>Democratic Party (AK)</topic>\u000a \u0009</subject>\u000a \u0009<relatedItem type=\"host\">\u000a \u0009 \u0009<titleInfo>\u000a \u0009 \u0009 \u0009<title>Election 2002 Web Archive</title>\u000a \u0009 \u0009</titleInfo>\u000a \u0009 \u0009<location>\u000a \u0009 \u0009 \u0009<url>http://www.loc.gov/minerva/collect/elec2002/</url>\u000a \u0009 \u0009</location>\u000a \u0009</relatedItem>\u000a \u0009<location>\u000a \u0009 \u0009<url displayLabel=\"Active site (if available)\">http://www.franulmer.com/</url>\u000a \u0009</location>\u000a \u0009<location>\u000a \u0009 \u0009<url displayLabel=\"Archived site\">http://wayback-cgi1.alexa.com/e2002/*/http://www.franulmer.com/</url>\u000a \u0009</location>\u000a</mods>\u000a</modsCollection>",
"items": [
{
"itemType": "document",
"creators": [
{
"firstName": "Fran",
"lastName": "Ulmer",
"creatorType": "author",
"fieldMode": 1
}
],
"notes": [],
"tags": [
"Elections",
"Governors",
"Election",
"Democratic Party (AK)"
],
"seeAlso": [],
"attachments": [],
"title": "FranUlmer.com -- Home Page",
"publicationTitle": "Election 2002 Web Archive",
"url": "http://wayback-cgi1.alexa.com/e2002/*/http://www.franulmer.com/",
"abstractNote": "Web site promoting the candidacy of Fran Ulmer, Democratic candidate for Governor, Alaska, 2002. Includes candidate biography, issue position statements, campaign contact information, privacy policy and campaign news press releases. Site features enable visitors to sign up for campaign email list, volunteer, make campaign contributions and follow links to other internet locations.",
"language": "eng"
}
]
},
{
"type": "import",
"input": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\u000a<modsCollection xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.loc.gov/mods/v3\" xsi:schemaLocation=\"http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-3.xsd\">\u000a<mods version=\"3.3\">\u000a <titleInfo>\u000a \u0009 \u0009<title>At Gettysburg, or, What a Girl Saw and Heard of the Battle: A True Narrative</title>\u000a \u0009</titleInfo>\u000a \u0009<name type=\"personal\">\u000a \u0009 \u0009<namePart>Alleman, Tillie Pierce [1848-1914]</namePart>\u000a \u0009 \u0009<role>\u000a \u0009 \u0009 \u0009<roleTerm type=\"code\" authority=\"marcrelator\">aut</roleTerm>\u000a \u0009 \u0009 \u0009<roleTerm type=\"text\" authority=\"marcrelator\">Author</roleTerm>\u000a \u0009 \u0009</role>\u000a \u0009</name>\u000a \u0009<typeOfResource>text</typeOfResource>\u000a \u0009<originInfo>\u000a \u0009 \u0009<place>\u000a \u0009 \u0009 \u0009<placeTerm type=\"text\">New York</placeTerm>\u000a \u0009 \u0009</place>\u000a \u0009 \u0009<publisher>W. Lake Borland</publisher>\u000a \u0009 \u0009<dateIssued keyDate=\"yes\" encoding=\"w3cdtf\">1889</dateIssued>\u000a \u0009</originInfo>\u000a \u0009<language>\u000a \u0009 \u0009<languageTerm authority=\"iso639-2b\">eng</languageTerm>\u000a \u0009 \u0009<languageTerm type=\"text\">English</languageTerm>\u000a \u0009</language>\u000a \u0009<physicalDescription>\u000a \u0009 \u0009<internetMediaType>text/html</internetMediaType>\u000a \u0009 \u0009<digitalOrigin>reformatted digital</digitalOrigin>\u000a \u0009</physicalDescription>\u000a \u0009<subject authority=\"lcsh\">\u000a \u0009 \u0009<topic >Gettysburg, Battle of, Gettysburg, Pa., 1863</topic>\u000a \u0009</subject>\u000a \u0009<subject authority=\"lcsh\">\u000a \u0009 \u0009<topic>Gettysburg (Pa.) -- History -- Civil War, 1861-1865</topic>\u000a \u0009</subject>\u000a \u0009<subject authority=\"lcsh\">\u000a \u0009 \u0009<topic>United States -- History -- Civil War, 1861-1865 -- Campaigns</topic>\u000a \u0009</subject>\u000a \u0009<classification authority=\"lcc\">E475.53 .A42</classification>\u000a \u0009<relatedItem type=\"host\">\u000a \u0009 \u0009<titleInfo type=\"uniform\" authority=\"dlfaqcoll\">\u000a \u0009 \u0009 \u0009<title>A Celebration of Women Writers: Americana</title>\u000a \u0009 \u0009</titleInfo>\u000a \u0009</relatedItem>\u000a \u0009<location>\u000a \u0009 \u0009<url usage=\"primary display\" access=\"object in context\"> http://digital.library.upenn.edu/women/alleman/gettysburg/gettysburg.html\u000a</url>\u000a \u0009</location>\u000a \u0009<accessCondition> Personal, noncommercial use of this item is permitted in the United States of America. Please see http://digital.library.upenn.edu/women/ for other rights and restrictions that may apply to this resource.\u000a</accessCondition>\u000a<recordInfo>\u000a \u0009<recordSource>University of Pennsylvania Digital Library</recordSource>\u000a \u0009<recordOrigin> MODS auto-converted from a simple Online Books Page metadata record. For details, see http://onlinebooks.library.upenn.edu/mods.html </recordOrigin>\u000a \u0009<languageOfCataloging>\u000a \u0009 \u0009<languageTerm type=\"code\" authority=\"iso639-2b\">eng</languageTerm>\u000a \u0009</languageOfCataloging>\u000a</recordInfo>\u000a</mods>\u000a</modsCollection>",
"items": [
{
"itemType": "document",
"creators": [
{
"firstName": "Tillie Pierce [1848-1914",
"lastName": "Alleman",
"creatorType": "author",
"fieldMode": 1
}
],
"notes": [],
"tags": [
"Gettysburg, Battle of, Gettysburg, Pa., 1863",
"Gettysburg (Pa.) -- History -- Civil War, 1861-1865",
"United States -- History -- Civil War, 1861-1865 -- Campaigns"
],
"seeAlso": [],
"attachments": [],
"title": "At Gettysburg, or, What a Girl Saw and Heard of the Battle: A True Narrative",
"rights": "Personal, noncommercial use of this item is permitted in the United States of America. Please see http://digital.library.upenn.edu/women/ for other rights and restrictions that may apply to this resource.",
"publicationTitle": "A Celebration of Women Writers: Americana",
"callNumber": "E475.53 .A42",
"url": "http://digital.library.upenn.edu/women/alleman/gettysburg/gettysburg.html",
"language": "English"
}
]
},
{
"type": "import",
"input": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\u000a<modsCollection xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.loc.gov/mods/v3\" xsi:schemaLocation=\"http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-3.xsd\">\u000a<mods version=\"3.3\">\u000a <titleInfo>\u000a \u0009 \u0009<title>Telescope Peak from Zabriskie Point</title>\u000a \u0009</titleInfo>\u000a \u0009<titleInfo type=\"alternative\" >\u000a \u0009 \u0009<title>Telescope PK from Zabriskie Pt.</title>\u000a \u0009</titleInfo>\u000a \u0009<name type=\"personal\">\u000a \u0009 \u0009<namePart type=\"family\">Cushman</namePart>\u000a \u0009 \u0009<namePart type=\"given\">Charles Weever</namePart>\u000a \u0009 \u0009<namePart type=\"date\">1896-1972</namePart>\u000a \u0009 \u0009<role>\u000a \u0009 \u0009 \u0009<roleTerm type=\"code\" authority=\"marcrelator\">pht</roleTerm>\u000a \u0009 \u0009 \u0009<roleTerm type=\"text\" authority=\"marcrelator\">Photographer</roleTerm>\u000a \u0009 \u0009</role>\u000a \u0009</name>\u000a \u0009<typeOfResource>still image</typeOfResource>\u000a \u0009<genre authority=\"gmgpc\">Landscape photographs</genre>\u000a \u0009<originInfo>\u000a \u0009 \u0009<dateCreated encoding=\"w3cdtf\" keyDate=\"yes\">1955-03-22</dateCreated>\u000a \u0009 \u0009<copyrightDate encoding=\"w3cdtf\">2003</copyrightDate>\u000a \u0009</originInfo>\u000a \u0009<physicalDescription>\u000a \u0009 \u0009<internetMediaType>image/jpeg</internetMediaType>\u000a \u0009 \u0009<digitalOrigin>reformatted digital</digitalOrigin>\u000a \u0009 \u0009<note> Original 35mm slide was digitized in 2003 as a TIFF image. Display versions in JPEG format in three sizes are available.</note>\u000a \u0009 \u0009<note>100 f 6.3 tl</note>\u000a \u0009</physicalDescription>\u000a \u0009<subject authority=\"lctgm\">\u000a \u0009 \u0009<topic>Mountains</topic>\u000a \u0009</subject>\u000a \u0009<subject authority=\"lctgm\">\u000a \u0009 \u0009<topic>Snow</topic>\u000a \u0009</subject>\u000a \u0009<subject>\u000a \u0009 \u0009<topic>Telescope Peak (Inyo County, Calif.)</topic>\u000a \u0009</subject>\u000a \u0009<subject>\u000a \u0009 \u0009<topic>Zabriskie Point (Calif.)</topic>\u000a \u0009</subject>\u000a \u0009<subject>\u000a \u0009 \u0009<hierarchicalGeographic>\u000a \u0009 \u0009 \u0009<country>United States</country>\u000a \u0009 \u0009 \u0009<state>California</state>\u000a \u0009 \u0009 \u0009<county>Inyo</county>\u000a \u0009 \u0009</hierarchicalGeographic>\u000a \u0009</subject>\u000a \u0009<relatedItem type=\"original\">\u000a \u0009 \u0009<originInfo>\u000a \u0009 \u0009 \u0009<dateCreated encoding=\"w3cdtf\" keyDate=\"yes\">1955-03-22</dateCreated>\u000a \u0009 \u0009</originInfo>\u000a \u0009 \u0009<physicalDescription>\u000a \u0009 \u0009 \u0009<form authority=\"gmd\">graphic</form>\u000a \u0009 \u0009 \u0009<extent>1 slide : col. ; 35mm</extent>\u000a \u0009 \u0009 \u0009<note>Original 35mm slide was digitized in 2003 as a TIFF image. Display versions in JPEG format in three sizes are available.</note>\u000a \u0009 \u0009</physicalDescription>\u000a \u0009 \u0009<location>\u000a \u0009 \u0009 \u0009<physicalLocation displayLabel=\"Original slide\"> Indiana University, Bloomington. University Archives P07803 </physicalLocation>\u000a \u0009 \u0009</location>\u000a \u0009</relatedItem>\u000a \u0009<relatedItem type=\"host\">\u000a \u0009 \u0009<titleInfo type=\"uniform\" authority=\"dlfaqcoll\">\u000a \u0009 \u0009 \u0009<title> Indiana University Digital Library Program: Charles W. Cushman Photograph Collection</title>\u000a \u0009 \u0009</titleInfo>\u000a \u0009</relatedItem>\u000a \u0009<identifier displayLabel=\"Cushman number\" type=\"local\">955.11</identifier>\u000a \u0009<identifier displayLabel=\"IU Archives number\" type=\"local\">P07803</identifier>\u000a \u0009<location>\u000a \u0009 \u0009<url>http://purl.dlib.indiana.edu/iudl/archives/cushman/P07803</url>\u000a \u0009 \u0009<url access=\"preview\">http://quod.lib.umich.edu/m/mods/thumbs/Indiana/oai.dlib.indiana.edu/ archives/cushman/oai_3Aoai.dlib.indiana.edu_3Aarchives_5Ccushman_5CP07803.png</url>\u000a \u0009</location>\u000a \u0009<accessCondition> Copyright and reproduction rights for all Charles W. Cushman photographs are held by Indiana University and administered by the University Archives, Indiana University, Bloomington, IN 47405</accessCondition>\u000a \u0009<recordInfo>\u000a \u0009<recordContentSource>Indiana University Digital Library Program</recordContentSource>\u000a \u0009<recordCreationDate encoding=\"w3cdtf\">2004-09-09</recordCreationDate>\u000a \u0009<recordIdentifier>archives/cushman/P07803</recordIdentifier>\u000a \u0009</recordInfo>\u000a</mods>\u000a\u000a</modsCollection>",
"items": [
{
"itemType": "artwork",
"creators": [
{
"firstName": "Charles Weever",
"lastName": "Cushman",
"creatorType": "author"
}
],
"notes": [],
"tags": [
"Mountains",
"Snow",
"Telescope Peak (Inyo County, Calif.)",
"Zabriskie Point (Calif.)"
],
"seeAlso": [],
"attachments": [],
"title": "Telescope Peak from Zabriskie Point",
"source": "Indiana University Digital Library Program",
"accessionNumber": "archives/cushman/P07803",
"rights": "Copyright and reproduction rights for all Charles W. Cushman photographs are held by Indiana University and administered by the University Archives, Indiana University, Bloomington, IN 47405",
"publicationTitle": "Indiana University Digital Library Program: Charles W. Cushman Photograph Collection",
"url": "http://quod.lib.umich.edu/m/mods/thumbs/Indiana/oai.dlib.indiana.edu/ archives/cushman/oai_3Aoai.dlib.indiana.edu_3Aarchives_5Ccushman_5CP07803.png"
}
]
},
{
"type": "import",
"input": "<modsCollection xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.loc.gov/mods/v3\" xsi:schemaLocation=\"http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-3.xsd\">\u000a<mods version=\"3.3\">\u000a <titleInfo>\u000a \u0009 \u0009<title>Hiring and recruitment practices in academic libraries</title>\u000a \u0009</titleInfo>\u000a \u0009<name type=\"personal\">\u000a \u0009 \u0009<namePart>Raschke, Gregory K.</namePart>\u000a \u0009 \u0009<displayForm>Gregory K. Raschke</displayForm>\u000a \u0009</name>\u000a \u0009<typeOfResource>text</typeOfResource>\u000a \u0009<genre>journal article</genre>\u000a \u0009<originInfo>\u000a \u0009 \u0009<place>\u000a \u0009 \u0009 \u0009<text>Baltimore, Md.</text>\u000a \u0009 \u0009</place>\u000a \u0009 \u0009<publisher>Johns Hopkins University Press</publisher>\u000a \u0009 \u0009<dateIssued>2003</dateIssued>\u000a \u0009 \u0009<issuance>monographic</issuance>\u000a \u0009</originInfo>\u000a \u0009<language authority=\"iso639-2b\">eng</language>\u000a \u0009<physicalDescription>\u000a \u0009 \u0009<form authority=\"marcform\">print</form>\u000a \u0009 \u0009<extent>15 p.</extent>\u000a \u0009</physicalDescription>\u000a \u0009<abstract>\u000aAcademic libraries need to change their recruiting and hiring procedures to stay competitive in today's changing marketplace. By taking too long to find and to hire talented professionals in a tight labor market, academic libraries are losing out on top candidates and limiting their ability to become innovative and dynamic organizations. Traditional, deliberate, and risk-averse hiring models lead to positions remaining open for long periods, opportunities lost as top prospects find other positions, and a reduction in the overall talent level of the organization. To be more competitive and effective in their recruitment and hiring processes, academic libraries must foster manageable internal solutions, look to other professions for effective hiring techniques and models, and employ innovative concepts from modern personnel management literature. </abstract>\u000a \u0009<subject>\u000a \u0009 \u0009<topic>College librarians</topic>\u000a \u0009 \u0009<topic>Recruiting</topic>\u000a \u0009 \u0009<geographic>United States</geographic>\u000a \u0009</subject>\u000a \u0009<subject>\u000a \u0009 \u0009<topic>College librarians</topic>\u000a \u0009 \u0009<topic>Selection and appointment</topic>\u000a \u0009 \u0009<geographic>United States</geographic>\u000a \u0009</subject>\u000a \u0009<relatedItem type=\"host\">\u000a \u0009 \u0009<titleInfo>\u000a \u0009 \u0009 \u0009<title>portal: libraries and the academy</title>\u000a \u0009 \u0009</titleInfo>\u000a \u0009 \u0009<part>\u000a \u0009 \u0009 \u0009<detail type=\"volume\">\u000a \u0009 \u0009 \u0009 \u0009<number>3</number>\u000a \u0009 \u0009 \u0009 \u0009<caption>vol.</caption>\u000a \u0009 \u0009 \u0009</detail>\u000a \u0009 \u0009 \u0009<detail type=\"number\">\u000a \u0009 \u0009 \u0009 \u0009<number>1</number>\u000a \u0009 \u0009 \u0009 \u0009<caption>no.</caption>\u000a \u0009 \u0009 \u0009</detail>\u000a \u0009 \u0009 \u0009<extent unit=\"page\">\u000a \u0009 \u0009 \u0009 \u0009<start>53</start>\u000a \u0009 \u0009 \u0009 \u0009<end>57</end>\u000a \u0009 \u0009 \u0009</extent>\u000a \u0009 \u0009 \u0009<date>Jan. 2003</date>\u000a \u0009 \u0009</part>\u000a \u0009 \u0009<identifier type=\"issn\">1531-2542</identifier>\u000a \u0009</relatedItem>\u000a</mods>\u000a\u000a</modsCollection>",
"items": [
{
"itemType": "document",
"creators": [
{
"firstName": "Gregory K",
"lastName": "Raschke",
"creatorType": "author",
"fieldMode": 1
}
],
"notes": [],
"tags": [
"College librarians",
"Recruiting",
"College librarians",
"Selection and appointment"
],
"seeAlso": [],
"attachments": [],
"title": "Hiring and recruitment practices in academic libraries",
"publicationTitle": "portal: libraries and the academy",
"ISSN": "1531-2542",
"volume": "3",
"pages": "53-57",
"abstractNote": "Academic libraries need to change their recruiting and hiring procedures to stay competitive in today's changing marketplace. By taking too long to find and to hire talented professionals in a tight labor market, academic libraries are losing out on top candidates and limiting their ability to become innovative and dynamic organizations. Traditional, deliberate, and risk-averse hiring models lead to positions remaining open for long periods, opportunities lost as top prospects find other positions, and a reduction in the overall talent level of the organization. To be more competitive and effective in their recruitment and hiring processes, academic libraries must foster manageable internal solutions, look to other professions for effective hiring techniques and models, and employ innovative concepts from modern personnel management literature.",
"language": "eng"
}
]
}
]
/** END TEST CASES **/

View file

@ -1,15 +1,15 @@
{
"translatorID": "ce7a3727-d184-407f-ac12-52837f3361ff",
"label": "NYTimes.com",
"creator": "Simon Kornblith",
"target": "^https?://(?:query\\.nytimes\\.com/search/(?:alternate/)?|(?:select\\.|www\\.)?nytimes\\.com/.)",
"minVersion": "1.0.0b3.r1",
"maxVersion": "",
"priority": 100,
"browserSupport":"gcs",
"inRepository": true,
"translatorType": 4,
"lastUpdated": "2011-06-19 21:21:19"
"translatorID": "ce7a3727-d184-407f-ac12-52837f3361ff",
"label": "NYTimes.com",
"creator": "Simon Kornblith",
"target": "^https?://(?:query\\.nytimes\\.com/search/(?:alternate/)?|(?:select\\.|www\\.)?nytimes\\.com/.)",
"minVersion": "2.1.9",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcs",
"lastUpdated": "2011-07-04 01:09:00"
}
function detectWeb(doc, url) {
@ -74,7 +74,7 @@ function scrape(doc, url) {
}
// We want to get everything on one page
newItem.attachments.push({url:url.replace(/\.html\??([^/]*)(pagewanted=[^&]*)?([^/]*)$/,".html?pagewanted=all&$1$2"), title:"New York Times Snapshot",
mimeType:"text/html"});
mimeType:"text/html"});
} else {
newItem.url = doc.location.href;
var metaTagHTML = doc.getElementsByTagName("meta");
@ -89,9 +89,9 @@ function scrape(doc, url) {
var singlePage = false;
if (!newItem.url.match(/\?pagewanted=all/)
&& (singlePage = doc.evaluate('//ul[@id="toolsList"]/li[@class="singlePage"]/a', doc, nsResolver,
XPathResult.ANY_TYPE, null).iterateNext())) {
XPathResult.ANY_TYPE, null).iterateNext())) {
newItem.attachments.push({url:singlePage.href, title:"New York Times Snapshot",
mimeType:"text/html"});
mimeType:"text/html"});
} else {
newItem.attachments.push({document:doc, title:"New York Times Snapshot"});
}
@ -149,14 +149,15 @@ function doWeb(doc, url) {
if(searchResults) {
var items = Zotero.Utilities.getItemArray(doc, searchResults, '^http://(?:select\.|www\.)nytimes.com/.*\.html(\\?|$)');
items = Zotero.selectItems(items);
if(!items) return true;
Zotero.selectItems(items, function (items) {
if(!items) return true;
var urls = [];
for(var i in items) urls.push(i);
var urls = [];
for(var i in items) urls.push(i);
Zotero.Utilities.HTTP.doGet(urls, function(text, response, url) { scrape(text, url) }, function() { Zotero.done(); }, null);
Zotero.wait();
Zotero.Utilities.HTTP.doGet(urls, function(text, response, url) { scrape(text, url) }, function() { Zotero.done(); }, null);
Zotero.wait();
});
} else {
scrape(doc);
}
@ -164,323 +165,50 @@ function doWeb(doc, url) {
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://www.nytimes.com/2010/08/21/education/21harvard.html?scp=1&sq=marc%20hauser&st=cse&gwh=4B8CBC2383B24F22FED81E754DFA960B",
"items": [
{
"itemType": "newspaperArticle",
"creators": [
{
"firstName": "Nicholas",
"lastName": "Wade",
"creatorType": "author"
}
],
"notes": [],
"tags": [
"Science and Technology",
"Research",
"Ethics",
"Hauser, Marc D",
"Harvard University"
],
"seeAlso": [],
"attachments": [
{
"document": "[object]",
"title": "New York Times Snapshot"
}
],
"publicationTitle": "The New York Times",
"ISSN": "0362-4331",
"url": "https://www.nytimes.com/2010/08/21/education/21harvard.html?scp=1&sq=marc%20hauser&st=cse&gwh=4B8CBC2383B24F22FED81E754DFA960B",
"date": "2010-08-20",
"title": "Harvard Finds Marc Hauser Guilty of Scientific Misconduct",
"section": "Education",
"accessionNumber": "1248068890906",
"libraryCatalog": "NYTimes.com",
"accessDate": "CURRENT_TIMESTAMP"
}
]
},
{
"type": "web",
"url": "http://query.nytimes.com/search/query?frow=0&n=10&srcht=a&query=marc+hauser&srchst=nyt&submit.x=18&submit.y=12&hdlquery=&bylquery=&daterange=period&mon1=01&day1=01&year1=2010&mon2=01&day2=18&year2=2011",
"items": [
{
"itemType": "newspaperArticle",
"creators": [
{
"firstName": "Nicholas",
"lastName": "Wade",
"creatorType": "author"
}
],
"notes": [],
"tags": [
"Science and Technology",
"Research",
"Ethics",
"Hauser, Marc D",
"Harvard University"
],
"seeAlso": [],
"attachments": [
{
"url": "http://www.nytimes.com/2010/08/21/education/21harvard.html?pagewanted=all&scp=1&sq=marc+hauser&st=nyt",
"title": "New York Times Snapshot",
"mimeType": "text/html"
}
],
"publicationTitle": "The New York Times",
"ISSN": "0362-4331",
"url": "http://www.nytimes.com/2010/08/21/education/21harvard.html?scp=1&sq=marc+hauser&st=nyt",
"date": "2010-08-20",
"title": "Harvard Finds Marc Hauser Guilty of Scientific Misconduct",
"section": "Education",
"accessionNumber": "1248068890906",
"libraryCatalog": "NYTimes.com"
},
{
"itemType": "newspaperArticle",
"creators": [
{
"firstName": "Nicholas",
"lastName": "Wade",
"creatorType": "author"
}
],
"notes": [],
"tags": [
"Laboratories and Scientific Equipment",
"Research",
"Ethics",
"Hauser, Marc D",
"Harvard University"
],
"seeAlso": [],
"attachments": [
{
"url": "http://www.nytimes.com/2010/08/14/education/14harvard.html?pagewanted=all&scp=3&sq=marc+hauser&st=nyt",
"title": "New York Times Snapshot",
"mimeType": "text/html"
}
],
"publicationTitle": "The New York Times",
"ISSN": "0362-4331",
"url": "http://www.nytimes.com/2010/08/14/education/14harvard.html?scp=3&sq=marc+hauser&st=nyt",
"date": "2010-08-13",
"title": "In Inquiry at Marc Hausers Harvard Lab, a Raid and Then a 3-Year Wait",
"section": "Education",
"accessionNumber": "1247468623821",
"libraryCatalog": "NYTimes.com"
},
{
"itemType": "newspaperArticle",
"creators": [
{
"firstName": "Nicholas",
"lastName": "Wade",
"creatorType": "author"
}
],
"notes": [],
"tags": [
"Hauser, Marc D",
"Harvard University",
"Office of Research Integrity"
],
"seeAlso": [],
"attachments": [
{
"url": "http://www.nytimes.com/2010/08/13/education/13harvard.html?pagewanted=all&scp=4&sq=marc+hauser&st=nyt",
"title": "New York Times Snapshot",
"mimeType": "text/html"
}
],
"publicationTitle": "The New York Times",
"ISSN": "0362-4331",
"url": "http://www.nytimes.com/2010/08/13/education/13harvard.html?scp=4&sq=marc+hauser&st=nyt",
"date": "2010-08-12",
"title": "Inquiry on Harvard Lab Threatens Ripple Effect",
"section": "Education",
"accessionNumber": "1247468617115",
"libraryCatalog": "NYTimes.com"
},
{
"itemType": "newspaperArticle",
"creators": [
{
"firstName": "Nicholas",
"lastName": "Wade",
"creatorType": "author"
}
],
"notes": [],
"tags": [
"Monkeys and Apes",
"Science and Technology",
"Ethics",
"Hauser, Marc D",
"University of Virginia"
],
"seeAlso": [],
"attachments": [
{
"url": "http://www.nytimes.com/2010/08/28/science/28harvard.html?pagewanted=all&scp=5&sq=marc+hauser&st=nyt",
"title": "New York Times Snapshot",
"mimeType": "text/html"
}
],
"publicationTitle": "The New York Times",
"ISSN": "0362-4331",
"url": "http://www.nytimes.com/2010/08/28/science/28harvard.html?scp=5&sq=marc+hauser&st=nyt",
"date": "2010-08-27",
"title": "Marc Hauser May Have Fabricated Data at Harvard Lab",
"section": "Science",
"accessionNumber": "1248068931442",
"libraryCatalog": "NYTimes.com"
},
{
"itemType": "newspaperArticle",
"creators": [
{
"firstName": "Nicholas",
"lastName": "Wade",
"creatorType": "author"
}
],
"notes": [],
"tags": [
"Psychology and Psychologists",
"Monkeys and Apes",
"Science and Technology",
"Hauser, Marc D",
"Harvard University"
],
"seeAlso": [],
"attachments": [
{
"url": "http://www.nytimes.com/2010/10/26/science/26hauser.html?pagewanted=all&scp=7&sq=marc+hauser&st=nyt",
"title": "New York Times Snapshot",
"mimeType": "text/html"
}
],
"publicationTitle": "The New York Times",
"ISSN": "0362-4331",
"url": "http://www.nytimes.com/2010/10/26/science/26hauser.html?scp=7&sq=marc+hauser&st=nyt",
"date": "2010-10-25",
"title": "Harvard Case Against Marc Hauser Is Hard to Define",
"section": "Science",
"accessionNumber": "1248069238889",
"libraryCatalog": "NYTimes.com"
},
{
"itemType": "newspaperArticle",
"creators": [
{
"firstName": "Nicholas",
"lastName": "Wade",
"creatorType": "author"
}
],
"notes": [],
"tags": [
"Research",
"Colleges and Universities",
"Ethics",
"Hauser, Marc",
"Harvard University"
],
"seeAlso": [],
"attachments": [
{
"url": "http://www.nytimes.com/2010/08/12/education/12harvard.html?pagewanted=all&scp=8&sq=marc+hauser&st=nyt",
"title": "New York Times Snapshot",
"mimeType": "text/html"
}
],
"publicationTitle": "The New York Times",
"ISSN": "0362-4331",
"url": "http://www.nytimes.com/2010/08/12/education/12harvard.html?scp=8&sq=marc+hauser&st=nyt",
"date": "2010-08-11",
"title": "Marc Hauser, Harvard Academic, Faces Inquiry",
"section": "Education",
"accessionNumber": "1247468609178",
"libraryCatalog": "NYTimes.com"
},
{
"itemType": "newspaperArticle",
"creators": [
{
"firstName": "David",
"lastName": "Brooks",
"creatorType": "author"
}
],
"notes": [],
"tags": [
"Ethics",
"Bloom, Paul",
"Haidt, Jonathan",
"Phelps, Elizabeth",
"Greene, Joshua",
"Edge Foundation"
],
"seeAlso": [],
"attachments": [
{
"url": "http://www.nytimes.com/2010/07/23/opinion/23brooks.html?pagewanted=all&scp=9&sq=marc+hauser&st=nyt",
"title": "New York Times Snapshot",
"mimeType": "text/html"
}
],
"publicationTitle": "The New York Times",
"ISSN": "0362-4331",
"url": "http://www.nytimes.com/2010/07/23/opinion/23brooks.html?scp=9&sq=marc+hauser&st=nyt",
"date": "2010-07-22",
"title": "The Moral Naturalists",
"section": "Opinion",
"accessionNumber": "1247468494988",
"libraryCatalog": "NYTimes.com"
},
{
"itemType": "newspaperArticle",
"creators": [
{
"firstName": "Claudia",
"lastName": "Dreifus",
"creatorType": "author"
}
],
"notes": [],
"tags": [
"Dolphins and Porpoises",
"Brain",
"Psychology and Psychologists",
"Whales and Whaling",
"Science and Technology",
"Reiss, Diana"
],
"seeAlso": [],
"attachments": [
{
"url": "http://www.nytimes.com/2010/09/21/science/21conversation.html?pagewanted=all&scp=10&sq=marc+hauser&st=nyt",
"title": "New York Times Snapshot",
"mimeType": "text/html"
}
],
"publicationTitle": "The New York Times",
"ISSN": "0362-4331",
"url": "http://www.nytimes.com/2010/09/21/science/21conversation.html?scp=10&sq=marc+hauser&st=nyt",
"date": "2010-09-20",
"title": "Studying the Big-Brained Dolphin",
"section": "Science",
"accessionNumber": "1248069061708",
"libraryCatalog": "NYTimes.com"
}
]
}
{
"type": "web",
"url": "https://www.nytimes.com/2010/08/21/education/21harvard.html?scp=1&sq=marc%20hauser&st=cse&gwh=4B8CBC2383B24F22FED81E754DFA960B",
"items": [
{
"itemType": "newspaperArticle",
"creators": [
{
"firstName": "Nicholas",
"lastName": "Wade",
"creatorType": "author"
}
],
"notes": [],
"tags": [
"Science and Technology",
"Research",
"Ethics",
"Hauser, Marc D",
"Harvard University"
],
"seeAlso": [],
"attachments": [
{
"document": "[object]",
"title": "New York Times Snapshot"
}
],
"publicationTitle": "The New York Times",
"ISSN": "0362-4331",
"url": "https://www.nytimes.com/2010/08/21/education/21harvard.html?scp=1&sq=marc%20hauser&st=cse&gwh=4B8CBC2383B24F22FED81E754DFA960B",
"date": "2010-08-20",
"title": "Harvard Finds Marc Hauser Guilty of Scientific Misconduct",
"section": "Education",
"accessionNumber": "1248068890906",
"libraryCatalog": "NYTimes.com",
"accessDate": "CURRENT_TIMESTAMP"
}
]
},
{
"type": "web",
"url": "http://query.nytimes.com/search/query?frow=0&n=10&srcht=a&query=marc+hauser&srchst=nyt&submit.x=18&submit.y=12&hdlquery=&bylquery=&daterange=period&mon1=01&day1=01&year1=2010&mon2=01&day2=18&year2=2011",
"items": "multiple"
}
]
/** END TEST CASES **/
/** END TEST CASES **/

View file

@ -1,14 +1,15 @@
{
"translatorID":"9575e804-219e-4cd6-813d-9b690cbfc0fc",
"translatorType":4,
"label":"PLoS Journals",
"creator":"Michael Berkowitz And Rintze Zelle",
"target":"^http://www\\.plos(one|ntds|compbiol|pathogens|genetics|medicine|biology)\\.org/(search|article)/",
"minVersion":"1.0.0b4.r5",
"maxVersion":"",
"priority":100,
"inRepository":true,
"lastUpdated":"2009-06-04 00:00:00"
"translatorID": "9575e804-219e-4cd6-813d-9b690cbfc0fc",
"label": "PLoS Journals",
"creator": "Michael Berkowitz And Rintze Zelle",
"target": "^http://www\\.plos(one|ntds|compbiol|pathogens|genetics|medicine|biology)\\.org/(search|article)/",
"minVersion": "2.1",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcs",
"lastUpdated": "2011-07-03 14:59:21"
}
function detectWeb(doc, url) {
@ -21,34 +22,39 @@ function detectWeb(doc, url) {
function getSelectedItems(doc, articleRegEx) {
var items = new Object();
var texts = new Array();
var items = {};
var texts = [];
var articles = doc.evaluate(articleRegEx, doc, null, XPathResult.ANY_TYPE, null);
var next_art = articles.iterateNext();
while (next_art) {
items[next_art.href] = next_art.textContent;
next_art = articles.iterateNext();
}
items = Zotero.selectItems(items);
for (var i in items) {
texts.push(i);
}
return(texts);
Zotero.selectItems(items, function(items) {
for (var i in items) {
texts.push(i);
}
processTexts(texts);
});
}
function doWeb(doc, url) {
if (url.indexOf("Search.action") != -1 || url.indexOf("browse.action") != -1) {
var articlex = '//span[@class="article"]/a';
var texts = getSelectedItems(doc, articlex);
getSelectedItems(doc, articlex);
} else if (url.indexOf("browseIssue.action") != -1) {
var articlex = '//div[@class="article"]/h3/a';
var texts = getSelectedItems(doc, articlex);
getSelectedItems(doc, articlex);
} else {
var texts = new Array(url);
processTexts([url]);
}
Zotero.wait();
}
var risLinks = new Array();
for (var i in texts) {
function processTexts(texts) {
var risLinks = [];
for (var i in texts) {
texts[i]=texts[i].replace(/;jsessionid[^;]+/, "");//Strip sessionID string
texts[i]=texts[i].replace(/\?.*/, "");//Strip referrer messes
var risLink = texts[i].replace("info", "getRisCitation.action?articleURI=info");
@ -80,5 +86,187 @@ function doWeb(doc, url) {
});
translator.translate();
}, function() {Zotero.done();});
Zotero.wait();
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://www.plosbiology.org/article/info%3Adoi%2F10.1371%2Fjournal.pbio.1001090",
"items": [
{
"itemType": "journalArticle",
"creators": [
{
"lastName": "Tauzin",
"firstName": "Sébastien ",
"creatorType": "author"
},
{
"lastName": "Chaigne-Delalande",
"firstName": "Benjamin ",
"creatorType": "author"
},
{
"lastName": "Selva",
"firstName": "Eric ",
"creatorType": "author"
},
{
"lastName": "Khadra",
"firstName": "Nadine ",
"creatorType": "author"
},
{
"lastName": "Daburon",
"firstName": "Sophie ",
"creatorType": "author"
},
{
"lastName": "Contin-Bordes",
"firstName": "Cécile ",
"creatorType": "author"
},
{
"lastName": "Blanco",
"firstName": "Patrick ",
"creatorType": "author"
},
{
"lastName": "Le Seyec",
"firstName": "Jacques ",
"creatorType": "author"
},
{
"lastName": "Ducret",
"firstName": "Thomas ",
"creatorType": "author"
},
{
"lastName": "Counillon",
"firstName": "Laurent ",
"creatorType": "author"
},
{
"lastName": "Moreau",
"firstName": "Jean-François ",
"creatorType": "author"
},
{
"lastName": "Hofman",
"firstName": "Paul ",
"creatorType": "author"
},
{
"lastName": "Vacher",
"firstName": "Pierre ",
"creatorType": "author"
},
{
"lastName": "Legembre",
"firstName": "Patrick ",
"creatorType": "author"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"attachments": [
{
"url": false,
"title": "PLoS Full Text PDF",
"mimeType": "application/pdf"
},
{
"url": false,
"title": "PLoS Snapshot",
"mimeType": "text/html",
"snapshot": true
}
],
"title": "The Naturally Processed CD95L Elicits a c-Yes/Calcium/PI3K-Driven Cell Migration Pathway",
"date": "June 21, 2011",
"abstractNote": "The “death receptor” CD95 (also known as Fas) plays an essential role in ensuring immune tolerance of self antigens as well as in the elimination of the body's cells that have been infected or transformed. This receptor is engaged by the membrane-bound ligand CD95L, which can be released into blood circulation after cleavage by metalloproteases. Hitherto, most of the studies on the CD95 signal have been performed with chimeric CD95Ls that mimic the membrane-bound ligand and exhibit a level of aggregation beyond that described for the metalloprotease-cleaved ligand. Multi-aggregated CD95L elicits a caspase-driven apoptotic signal. In this study, we observe that levels of soluble and naturally processed CD95L in sera of patients suffering from lupus correlate with disease severity. Strikingly, although this soluble CD95L fails to trigger cell death unlike its chimeric version, it induces a “non-canonical” Ca2+/c-yes/PI3K-dependent signaling pathway that promotes the transmigration of T-lymphocytes across the endothelial barrier. These findings shed light on an entirely new role for the soluble CD95L that may contribute to local or systemic tissue damage by enhancing the infiltration of activated T-lymphocytes. Overall, these findings underline the importance of revisiting the role of this “apoptotic cytokine” in the context of chronic inflammatory disorders.",
"publicationTitle": "PLoS Biol",
"journalAbbreviation": "PLoS Biol",
"volume": "9",
"issue": "6",
"pages": "e1001090",
"publisher": "Public Library of Science",
"url": "http://dx.doi.org/10.1371/journal.pbio.1001090",
"DOI": "10.1371/journal.pbio.1001090",
"libraryCatalog": "PLoS Biol"
}
]
},
{
"type": "web",
"url": "http://www.plosbiology.org/search/simpleSearch.action?from=globalSimpleSearch&filterJournals=PLoSBiology&query=amygdala&x=0&y=0",
"items": "multiple"
},
{
"type": "web",
"url": "http://www.plosmedicine.org/article/info%3Adoi%2F10.1371%2Fjournal.pmed.1000098",
"items": [
{
"itemType": "journalArticle",
"creators": [
{
"lastName": "Chiasson",
"firstName": "T. Carter ",
"creatorType": "author"
},
{
"lastName": "Manns",
"firstName": "Braden J. ",
"creatorType": "author"
},
{
"lastName": "Stelfox",
"firstName": "Henry Thomas ",
"creatorType": "author"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"attachments": [
{
"url": false,
"title": "PLoS Full Text PDF",
"mimeType": "application/pdf"
},
{
"url": false,
"title": "PLoS Snapshot",
"mimeType": "text/html",
"snapshot": true
}
],
"title": "An Economic Evaluation of Venous Thromboembolism Prophylaxis Strategies in Critically Ill Trauma Patients at Risk of Bleeding",
"date": "June 23, 2009",
"abstractNote": "Using decision analysis, Henry Stelfox and colleagues estimate the cost-effectiveness of three venous thromboembolism prophylaxis strategies in patients with severe traumatic injuries who were also at risk for bleeding complications.",
"publicationTitle": "PLoS Med",
"journalAbbreviation": "PLoS Med",
"volume": "6",
"issue": "6",
"pages": "e1000098",
"publisher": "Public Library of Science",
"url": "http://dx.doi.org/10.1371/journal.pmed.1000098",
"DOI": "10.1371/journal.pmed.1000098",
"libraryCatalog": "PLoS Med"
}
]
},
{
"type": "web",
"url": "http://www.plosmedicine.org/search/simpleSearch.action?from=globalSimpleSearch&filterJournals=PLoSMedicine&query=hematoma&x=0&y=0",
"items": "multiple"
},
{
"type": "web",
"url": "http://www.plosmedicine.org/article/browseIssue.action",
"items": "multiple"
}
]
/** END TEST CASES **/

View file

@ -1,14 +1,14 @@
{
"translatorID": "fce388a6-a847-4777-87fb-6595e710b7e7",
"label": "ProQuest 2",
"creator": "Avram Lyon",
"target": "^https?://search\\.proquest\\.com[^/]*(/pqrl|/pqdt)?/(docview|publication|publicationissue|results)",
"minVersion": "2.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"lastUpdated": "2011-05-24 11:36:36"
"translatorID": "fce388a6-a847-4777-87fb-6595e710b7e7",
"label": "ProQuest",
"creator": "Avram Lyon",
"target": "^https?://search\\.proquest\\.com[^/]*(/pqrl|/pqdt|/hnp[a-z]*)?/(docview|publication|publicationissue|results)",
"minVersion": "2.1",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"lastUpdated": "2011-08-02 02:41:31"
}
/*
@ -38,9 +38,24 @@ function detectWeb(doc, url) {
var record_rows = doc.evaluate('//div[@class="display_record_indexing_row"]', doc, nsResolver, XPathResult.ANY_TYPE, null);
if (record_rows.iterateNext()) {
return "journalArticle";
type = doc.evaluate('//div[@class="display_record_indexing_fieldname" and contains(text(),"Document Type")]/following-sibling::div[@class="display_record_indexing_data"]',
doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
if (type) {
type = type.textContent.trim();
type = mapToZotero(type);
if (type) return type;
}
// Fall back on journalArticle-- even if we couldn't guess the type
return "journalArticle";
}
var resultitem = doc.evaluate('//li[@class="resultItem"]', doc, nsResolver, XPathResult.ANY_TYPE, null);
if (url.indexOf("/results/") === -1) {
var abstract_link = doc.evaluate('//a[@class="formats_base_sprite format_abstract"]', doc, nsResolver, XPathResult.ANY_TYPE, null);
if (abstract_link.iterateNext()) {
return "journalArticle";
}
}
var resultitem = doc.evaluate('//li[@class="resultItem" or contains(@class, "resultItem ")]', doc, nsResolver, XPathResult.ANY_TYPE, null);
if (resultitem.iterateNext()) {
return "multiple";
}
@ -58,7 +73,7 @@ function doWeb(doc, url) {
scrape(doc,url);
} else if (detected) {
var articles = new Array();
var results = doc.evaluate('//li[@class="resultItem"]', doc, nsResolver, XPathResult.ANY_TYPE, null);
var results = doc.evaluate('//li[@class="resultItem" or contains(@class, "resultItem ")]', doc, nsResolver, XPathResult.ANY_TYPE, null);
var items = new Array();
var result;
while(result = results.iterateNext()) {
@ -67,23 +82,31 @@ function doWeb(doc, url) {
var url = link.href;
items[url] = title;
}
items = Zotero.selectItems(items);
if(!items) return true;
for (var i in items) {
articles.push(i);
}
Zotero.Utilities.processDocuments(articles, scrape, function () {Zotero.done();});
Zotero.selectItems(items, function (items) {
if(!items) return true;
for (var i in items) {
articles.push(i);
}
Zotero.Utilities.processDocuments(articles, scrape, function () {Zotero.done();});
});
Zotero.wait();
}
}
function scrape (doc) {
var url = doc.location.href;
var namespace = doc.documentElement.namespaceURI;
var nsResolver = namespace ? function(prefix) {
if (prefix == 'x') return namespace; else return null;
} : null;
var record_rows = doc.evaluate('//div[@class="display_record_indexing_row"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
var abstract_link = doc.evaluate('//a[@class="formats_base_sprite format_abstract"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
if (!record_rows && abstract_link) {
Zotero.Utilities.processDocuments(abstract_link.href, scrape, function() {Zotero.done();});
return true;
}
var url = doc.location.href;
// ProQuest provides us with two different data sources; we can pull the RIS
// (which is nicely embedded in each page!), or we can scrape the Display Record section
// We're going to prefer the latter, since it gives us richer data.
@ -96,7 +119,9 @@ function scrape (doc) {
item.thesisType = [];
var account_id;
while (record_row = record_rows.iterateNext()) {
var field = doc.evaluate('./div[@class="display_record_indexing_fieldname"]', record_row, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent.trim();
var field = doc.evaluate('./div[@class="display_record_indexing_fieldname"]', record_row, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()
if (!field) continue;
field = field.textContent.trim();
var value = doc.evaluate('./div[@class="display_record_indexing_data"]', record_row, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent.trim();
// Separate values in a single field are generally wrapped in <a> nodes; pull a list of them
var valueAResult = doc.evaluate('./div[@class="display_record_indexing_data"]/a', record_row, nsResolver, XPathResult.ANY_TYPE, null);
@ -167,6 +192,10 @@ function scrape (doc) {
item.rights = value; break;
case "Database":
item.libraryCatalog = value; break;
case "Document URL":
item.attachments.push({url:value.replace(/\?accountid=[0-9]+$/,''),
title: "ProQuest Record",
mimeType: "text/html"}); break;
case "Language of Publication":
item.language = value; break;
case "Section":
@ -179,46 +208,63 @@ function scrape (doc) {
}
}
var abs = doc.evaluate('//div[@id="abstract_field"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
var abs = doc.evaluate('//div[@id="abstract_field" or @id="abstractSummary"]/p', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
if (abs) {
item.abstractNote = abs.textContent
.replace(/^.*\[\s*Show all\s*\]/,"")
.replace(/\[\s*Show less\s*\]/,"")
.replace(/\[\s*[Ss]how all\s*\].*/,"")
.replace(/\[\s*[Ss]how less\s*\].*/,"")
.replace(/\[\s*PUBLICATION ABSTRACT\s*\]/,"")
.trim();
}
// Ok, now we'll pull the RIS and run it through the translator. And merge with the temporary item.
// RIS LOGIC GOES HERE
// Sometimes the PDF is right on this page
var realLink = doc.evaluate('//div[@id="pdffailure"]/div[@class="body"]/a', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
if (realLink) {
item.attachments.push({url:realLink.href, title:"ProQuest PDF", mimeType:"application/pdf"});
} else {
// The PDF link requires two requests-- we fetch the PDF full text page
var pdf = doc.evaluate('//a[@class="formats_base_sprite format_pdf"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
if (pdf) {
var pdfDoc = Zotero.Utilities.retrieveDocument(pdf.href);
// This page gives a beautiful link directly to the PDF, right in the HTML
realLink = pdfDoc.evaluate('//div[@id="pdffailure"]/div[@class="body"]/a', pdfDoc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
if (realLink) {
item.attachments.push({url:realLink.href, title:"ProQuest PDF", mimeType:"application/pdf"});
}
} else {
// If no PDF, we'll save at least something. This might be fulltext, but we're not sure.
item.attachments.push({url:url, title:"ProQuest HTML", mimeType:"text/html"});
}
}
item.place = item.place.join(', ');
item.thesisType = item.thesisType.join(', ');
item.proceedingsTitle = item.publicationTitle;
// On historical newspapers, we see:
// Rights: Copyright New York Times Company Dec 1, 1852
// Date: 1852
// We can improve on this, so we do.
var fullerDate = item.rights.match(/([A-Z][a-z]{2} \d{1,2}, \d{4}$)/);
if (!item.date ||
(item.date.match(/^\d{4}$/) && fullerDate)) {
item.date = fullerDate[1];
}
if (!item.itemType && item.libraryCatalog && item.libraryCatalog.match(/Historical Newspapers/))
item.itemType = "newspaperArticle";
if(!item.itemType) item.itemType="journalArticle";
item.complete();
// Ok, now we'll pull the RIS and run it through the translator. And merge with the temporary item.
// RIS LOGIC GOES HERE
// Sometimes the PDF is right on this page
var realLink = doc.evaluate('//div[@id="pdffailure"]/div[@class="body"]/a', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
if (realLink) {
item.attachments.push({url:realLink.href,
title:"ProQuest PDF",
mimeType:"application/pdf"});
item.complete();
} else {
// The PDF link requires two requests-- we fetch the PDF full text page
var pdf = doc.evaluate('//a[@class="formats_base_sprite format_pdf"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
if (pdf) {
Zotero.Utilities.processDocuments(pdf.href, function(pdfDoc){
// This page gives a beautiful link directly to the PDF, right in the HTML
realLink = pdfDoc.evaluate('//div[@id="pdffailure"]/div[@class="body"]/a', pdfDoc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
if (realLink) {
item.attachments.push({url:realLink.href,
title:"ProQuest PDF",
mimeType:"application/pdf"});
}
item.complete();
}, function () {});
} else {
item.complete();
}
}
}
// This map is not complete. See debug output to catch unassigned types
@ -228,6 +274,7 @@ function mapToZotero (type) {
"Book Review-Mixed" : false, // FIX AS NECESSARY
"Reports" : "report",
"REPORT" : "report",
"Historical Newspapers" : "newspaperArticle",
"Newspapers" : "newspaperArticle",
//"News" : "newspaperArticle", // Otherwise Foreign Policy is treated as a newspaper http://search.proquest.com/docview/840433348
"Magazines" : "magazineArticle",
@ -241,3 +288,61 @@ function mapToZotero (type) {
Zotero.debug("No mapping for type: "+type);
return false;
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://search.proquest.com/docview/213445241",
"items": [
{
"itemType": "journalArticle",
"creators": [
{
"firstName": "Gerald F",
"lastName": "Powers",
"creatorType": "author"
},
{
"firstName": "Drew",
"lastName": "Christiansen",
"creatorType": "author"
},
{
"firstName": "Robert T",
"lastName": "Hennemeyer",
"creatorType": "author"
}
],
"notes": [],
"tags": [
"Peace",
"Book reviews"
],
"seeAlso": [],
"attachments": [
{
"url": false,
"title": "ProQuest Record",
"mimeType": "text/html"
}
],
"place": "Winnipeg",
"title": "Peacemaking: moral & policy challenges for a new world // Review",
"publicationTitle": "Peace Research",
"volume": "27",
"issue": "2",
"pages": "90-100",
"numPages": "0",
"date": "May 1995",
"publisher": "Menno Simons College",
"ISSN": "00084697",
"language": "English",
"rights": "Copyright Peace Research May 1995",
"proceedingsTitle": "Peace Research",
"libraryCatalog": "ProQuest",
"shortTitle": "Peacemaking"
}
]
}
]
/** END TEST CASES **/

View file

@ -49,7 +49,7 @@ function scrape(doc, url) {
while (i = headings.iterateNext()) {
fieldTitle = i.textContent;
dataTags[fieldTitle] = Zotero.Utilities.cleanTags(content.iterateNext().textContent.replace(/^\s*|\s*$/g, ''));
Zotero.debug(i.textContent);
//Zotero.debug(i.textContent);
if (fieldTitle == "Creator") {
creatorType.push("author");
creatorField.push("Creator");
@ -78,14 +78,14 @@ function scrape(doc, url) {
creatorType.push("contributor");
creatorField.push("Contributor");
creatorContent.push(dataTags[fieldTitle]);
}
if (fieldTitle == "Imprint") {
} else if (fieldTitle == "Imprint") {
var place = dataTags["Imprint"].split(":");
newItem.place = place[0];
Zotero.debug(place);
}
if (fieldTitle == "Subject") {
newItem.tags[i] = dataTags["Subject"];
//Zotero.debug(place);
} else if (fieldTitle == "Subject") {
newItem.tags.push(dataTags["Subject"]);
} else {
//Zotero.debug("Have: " + fieldTitle + "=>" + dataTags[fieldTitle]);
}
}
@ -114,7 +114,7 @@ function scrape(doc, url) {
newItem.extra = "LoC Class " + dataTags["LoCClass"];
}
associateData (newItem, dataTags, "Title", "title");
associateData (newItem, dataTags, "Title", "title");
associateData (newItem, dataTags, "Language", "language");
associateData (newItem, dataTags, "CopyrightStatus", "rights");
@ -155,3 +155,39 @@ function doWeb(doc, url) {
scrape(doc, url);
}
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://www.gutenberg.org/ebooks/20321",
"items": [
{
"itemType": "book",
"creators": [
{
"firstName": "Bartolomé de las",
"lastName": "Casas",
"creatorType": "author"
}
],
"notes": [],
"tags": [
"Indians, Treatment of -- Latin America",
"Spain -- Colonies -- America"
],
"seeAlso": [],
"attachments": [],
"date": "Release Date Jan 9, 2007",
"extra": "LoC Class F1401: Latin America local history: General",
"title": "A Brief Account of the Destruction of the Indies\u000aOr, a faithful NARRATIVE OF THE Horrid and Unexampled Massacres, Butcheries, and all manner of Cruelties, that Hell and Malice could invent, committed by the Popish Spanish Party on the inhabitants of West-India, TOGETHER With the Devastations of several Kingdoms in America by Fire and Sword, for the space of Forty and Two Years, from the time of its first Discovery by them.",
"language": "English",
"rights": "Public domain in the USA.",
"url": "http://www.gutenberg.org/ebooks/20321",
"libraryCatalog": "Project Gutenberg"
}
]
}
]
/** END TEST CASES **/

View file

@ -4,12 +4,13 @@
"label":"RDF",
"creator":"Simon Kornblith",
"target":"rdf",
"minVersion":"2.1b2",
"minVersion":"2.1.9",
"maxVersion":"",
"priority":100,
"browserSupport":"gcsn",
"configOptions":{"dataMode":"rdf/xml"},
"inRepository":true,
"lastUpdated":"2011-02-03 07:00:12"
"lastUpdated":"2011-07-08 04:51:41"
}
function detectImport() {
@ -299,7 +300,7 @@ function importItem(newItem, node, type) {
}
if(!newItem.itemType) {
newItem.itemType = Export.defaultUnknownType;
newItem.itemType = exports.defaultUnknownType;
}
// regular author-type creators
@ -633,10 +634,8 @@ function doImport() {
}
}
/*
/**
* Export doImport and defaultUnknownType to other translators
*/
var Export = {
"doImport":doImport,
"defaultUnknownType":"book"
};
exports.doImport = doImport;
exports.defaultUnknownType = "book";

View file

@ -7,10 +7,10 @@
"minVersion":"2.1.3",
"maxVersion":"",
"priority":100,
"browserSupport":"gcs",
"browserSupport":"gcsn",
"inRepository":true,
"displayOptions":{"exportCharset":"UTF-8", "exportNotes":true},
"lastUpdated":"2011-06-17 20:07:40"
"lastUpdated":"2011-07-08 04:51:41"
}
function detectImport() {
@ -119,7 +119,7 @@ function processTag(item, tag, value) {
if (tag != "N1" && tag != "AB" && Zotero.Utilities.unescapeHTML) {
value = Zotero.Utilities.unescapeHTML(value);
}
if(fieldMap[tag]) {
item[fieldMap[tag]] = value;
} else if(inputFieldMap[tag]) {
@ -271,7 +271,8 @@ function processTag(item, tag, value) {
// to overlook or ignore this, so we will too on import
} else if(tag == "N2" || tag == "AB") {
// abstract
item.abstractNote = value;
if (item.abstractNote) item.abstractNote += "\n" + value;
else item.abstractNote = value;
} else if(tag == "KW") {
// keywords/tags
@ -416,7 +417,7 @@ function doImport(attachments) {
// if this line is a tag, take a look at the previous line to map
// its tag
if(tag) {
Zotero.debug("tag: '"+tag+"'; data: '"+data+"'");
//Zotero.debug("tag: '"+tag+"'; data: '"+data+"'");
processTag(item, tag, data);
}
@ -455,7 +456,7 @@ function doImport(attachments) {
}
if(tag && tag != "ER") { // save any unprocessed tags
Zotero.debug(tag);
//Zotero.debug(tag);
processTag(item, tag, data);
completeItem(item);
}

View file

@ -7,10 +7,11 @@
"minVersion":"1.0.0b4.r5",
"maxVersion":"",
"priority":100,
"browserSupport":"gcsn",
"configOptions":{"dataMode":"line"},
"displayOptions":{"exportCharset":"UTF-8"},
"inRepository":true,
"lastUpdated":"2011-01-11 04:31:00"
"lastUpdated":"2011-07-08 04:51:41"
}
function detectImport() {

View file

@ -0,0 +1,363 @@
{
"translatorID":"23ba3be6-412d-4dde-9cc1-c4df0cc09378",
"label":"Rice University Library Catalog",
"creator":"Mang Sun",
"target":"^https?://[^/]*\\.rice\\.edu[^/]*/uhtbin/cgisirsi",
"minVersion":"2.1",
"maxVersion":"",
"priority":90,
"inRepository":"1",
"translatorType":4,
"lastUpdated":"2011-07-29 12:52:04"
}
/* Based on the SIRSI translator by Simon Kornblith and Michael Berkowitz,
and the modifications for Rutgers (IRIS) by Chad Mills.
*/
// Priority of 90 to override SIRSI
function detectWeb(doc, url) {
if (doc.evaluate('//div[@class="columns_container"]/div[contains(@class, "left_column")]/div[@class="content_container"]/div[@class="content"]/form[@id="hitlist"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
return "multiple";
} else if (doc.evaluate('//div[@class="columns_container"]/div[contains(@class, "left_column")]/form[@name="item_view"]/div[@class="content_container item_details"]/div[@class="content"]/h3[.="Item Details"] ', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
return "book";
}
}
function scrape(doc) {
var namespace = doc.documentElement.namespaceURI;
var nsResolver = namespace ? function(prefix) {
if (prefix == 'x') return namespace; else return null;
} : null;
var xpath = '/html/body/div[@class="columns_container"]/div[contains(@class, "left_column")]/form[@name="item_view"]/div[@class="content_container item_details"]/div[@class="content"]/ul[contains(@class, "detail_page")]/li[@id="detail_marc_record"]/dl/dt[@class="viewmarctags"]';
var elmts = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null);
var elmt = elmts.iterateNext();
if(!elmt) {
return false;
}
var newItem = new Zotero.Item("book");
newItem.extra = "";
newItem.series = "";
var seriesItemCount = 0;
while(elmt) {
try {
//By Rice. Select all non space text nodes.
var node = doc.evaluate('./text()[normalize-space()]', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
if(node) {
if (doc.evaluate('following-sibling::dd[position()=1]/a/text()', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext())
{
//By Rice. Some meta data must be retrieved from the text node of anchor tags.
var value = Zotero.Utilities.superCleanString(doc.evaluate('following-sibling::dd[position()=1]/a/text()[normalize-space()]', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().nodeValue);
}
else
{
//while other metadata can be retrieved directly from the text node of DD tags
var value = Zotero.Utilities.superCleanString(doc.evaluate('following-sibling::dd[position()=1]/text()[normalize-space()]', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().nodeValue);
}
//acquire label and create super clean text by removing colon, space and etc.
casedField = Zotero.Utilities.superCleanString(node.nodeValue);
field = casedField.toLowerCase();
if(field == "publisher") {
newItem.publisher = value;
}else if(field == "pub date") {
var re = /[0-9]+/;
var m = re.exec(value);
newItem.date = m[0];
}else if(field == "isbn") {
var re = /^[0-9](?:[0-9X]+)/;
var m = re.exec(value);
newItem.ISBN = m[0];
}else if(field == "title") {
var titleParts = value.split(" / ");
re = /\[(.+)\]/i;
if (re.test(titleParts[0])) {
var ar = re.exec(titleParts[0]);
var itype = ar[1].toLowerCase();
if(itype== "phonodisc" || itype == "sound recording"){
newItem.itemType = "audioRecording";
}else if(itype=="videorecording"){
newItem.itemType = "videoRecording";
}else if(itype=="electronic resource"){
//newItem.itemType = "webPage";
//Rice treats eletronic resource as book
newItem.itemType = "book";
}
}
newItem.title = Zotero.Utilities.capitalizeTitle(titleParts[0]);
}else if(field == "series") {//push onto item, delimit with semicolon when needed
if (seriesItemCount != 0){
newItem.series += "; " + value;
}else if(seriesItemCount == 0) {
newItem.series = value;
}
seriesItemCount++;//bump counter
}else if(field == "dissertation note") {
newItem.itemType = "thesis";
var thesisParts = value.split("--");
var uniDate = thesisParts[1].split(", ");
newItem.university = uniDate[0];
newItem.date = uniDate[1];
}else if(field == "edition") {
newItem.edition = value;
}else if(field == "physical description") {
var physParts = value.split(" : ");
var physParts = physParts[0].split(" ; ");
//determine pages, split on " p."
var physPages = value.split(" p.");
//break off anything in the beginning before the numbers
var pageParts = physPages[0].split(" ");
newItem.numPages = pageParts[pageParts.length-1];
}else if(field == "publication info") {
var pubParts = value.split(" : ");
newItem.place = pubParts[0];
//drop off first part of array and recombine
pubParts.shift();
var i;
var publisherInfo;
for (i in pubParts) {
if (i == 0) {
publisherInfo = pubParts[i] + " : ";
} else {
publisherInfo = publisherInfo + pubParts[i] + " : ";
}
}//END for
//drop off last colon
publisherInfo = publisherInfo.substring(0,(publisherInfo.length - 3));
//break apart publication parts into Publisher and Date
var publisherParts = publisherInfo.split(",");
newItem.publisher = publisherParts[0];
//check that first character isn't a 'c', if so drop it
if (publisherParts[1].substring(1,2) == "c") {
newItem.date = publisherParts[1].substring(2);
}
else {
newItem.date = publisherParts[1];
}
}else if(field == "personal author") {
newItem.creators.push(Zotero.Utilities.cleanAuthor(value, "author", true));
}else if(field == "performer") {
newItem.creators.push(Zotero.Utilities.cleanAuthor(value, "performer", true));
}else if(field == "author"){
newItem.creators.push(Zotero.Utilities.cleanAuthor(value, "author", true));
}else if(field == "added author") {
newItem.creators.push(Zotero.Utilities.cleanAuthor(value, "contributor", true));
}else if(field == "conference author" || field == "corporate author") {
//The following line is included by Rice to handle corporate or conference author
newItem.creators.push(Zotero.Utilities.cleanAuthor(value, "author", true));
}else if(field == "subject" || field == "corporate subject" || field == "geographic term") {
var subjects = value.split("--");
newItem.tags = newItem.tags.concat(subjects);
}else if(field == "personal subject") {
var subjects = value.split(", ");
newItem.tags = newItem.tags.push(value[0]+", "+value[1]);
}else if(value && field != "http") {
newItem.extra += casedField+": "+value+"\n";
}
}
} catch (e) {}
elmt = elmts.iterateNext();
}//END if node
if(newItem.extra) {
newItem.extra = newItem.extra.substr(0, newItem.extra.length-1);
}
var callNumber = doc.evaluate('//tr/td[1][@class="holdingslist"]/strong/text()', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
if(callNumber && callNumber.nodeValue) {
newItem.callNumber = callNumber.nodeValue;
}
newItem.libraryCatalog = "Rice University Library Catalog";
newItem.complete();
//Zotero.debug('hi');
return true;
}//END try
function doWeb(doc, url){
var namespace = doc.documentElement.namespaceURI;
var nsResolver = namespace ? function(prefix) {
if (prefix == 'x') return namespace; else return null;
} : null;
var sirsiNew = true; //toggle between SIRSI -2003 and SIRSI 2003+
//Adapted to catch the hitlist page of Rice Catalog
var xpath = '/html/body/div[@class="columns_container"]/div[contains(@class, "left_column")]/div[@class="content_container"]/div[@class="content"]/form[@id="hitlist"]/ul[@class="hit_list"]/li/ul[starts-with(@class, "hit_list_row")]/li[@class="hit_list_item_info"]/dl';
if(doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) {
Zotero.debug("SIRSI doWeb: searchsum");
sirsiNew = true;
}else if (doc.evaluate('//form[@name="hitlist"]/table/tbody/tr', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) {
Zotero.debug("SIRSI doWeb: hitlist");
sirsiNew = false;
}else if (doc.evaluate('//tr[th[@class="viewmarctags"]][td[@class="viewmarctags"]]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) {
Zotero.debug("SIRSI doWeb: viewmarctags");
sirsiNew = true;
}else if (doc.evaluate('//input[@name="VOPTIONS"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) {
Zotero.debug("SIRSI doWeb: VOPTIONS");
sirsiNew = false;
}else {
var elmts = doc.evaluate('/html/body/form//text()', doc, nsResolver, XPathResult.ANY_TYPE, null);
//var elmts = doc.evaluate(' ', doc, nsResolver, XPathResult.ANY_TYPE, null);
while(elmt = elmts.iterateNext()) {
if(Zotero.Utilities.superCleanString(elmt.nodeValue) == "Viewing record") {
Zotero.debug("SIRSI doWeb: Viewing record");
sirsiNew = false;
}
}//END while elmts
}//END FUNCTION doWeb
// Zotero.debug(xpath);
if (sirsiNew) { //executes Simon's SIRSI 2003+ scraper code
if(!scrape(doc)) {
var checkboxes = new Array();
var urls = new Array();
var availableItems = new Array();
//pull items
var tableRows = doc.evaluate('//ul[@class="hit_list"]/li/ul[contains(@class, "hit_list_row")][//input[@value="Details"]]', doc, nsResolver, XPathResult.ANY_TYPE, null);
// Go through table rows
while(tableRow = tableRows.iterateNext()) {
var input = doc.evaluate('.//input[@value="Details"]', tableRow, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
//var text = doc.evaluate('.//strong', tableRow, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
var text = doc.evaluate('.//dd[@class="title"]/a', tableRow, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
if(text) {
availableItems[input.name] = text;
}
}//END while
var items = Zotero.selectItems(availableItems);
if(!items) {
return true;
}
var hostRe = new RegExp("^http(?:s)?://[^/]+");
var m = hostRe.exec(doc.location.href);
Zotero.debug("href: " + doc.location.href);
var hitlist = doc.forms.namedItem("hitlist");
var baseUrl = m[0]+hitlist.getAttribute("action")+"?first_hit="+hitlist.elements.namedItem("first_hit").value+"&last_hit="+hitlist.elements.namedItem("last_hit").value;
var alexandria = new Array();
for(var i in items) {
alexandria.push(baseUrl+"&"+i+"=Details");
}
Zotero.Utilities.processDocuments(alexandria, function(doc) { scrape(doc) }, function() { Zotero.done() }, null);
Zotero.wait();
}//END if not scrape(doc)
}else{ //executes Simon's SIRSI -2003 translator code
Zotero.debug("Running SIRSI -2003 code");
var uri = doc.location.href;
var recNumbers = new Array();
var xpath = '//form[@name="hitlist"]/table/tbody/tr';
var elmts = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null);
var elmt = elmts.iterateNext();
if(elmt) { // Search results page
var uriRegexp = /^http:\/\/[^\/]+/;
var m = uriRegexp.exec(uri);
var postAction = doc.forms.namedItem("hitlist").getAttribute("action");
var newUri = m[0]+postAction.substr(0, postAction.length-1)+"40";
var titleRe = /<br>\s*(.*[^\s])\s*<br>/i;
var items = new Array();
do {
var checkbox = doc.evaluate('.//input[@type="checkbox"]', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
// Collect title
var title = doc.evaluate("./td[2]", elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
if(checkbox && title) {
items[checkbox.name] = Zotero.Utilities.trimInternal(title);
}
} while(elmt = elmts.iterateNext());
items = Zotero.selectItems(items);
if(!items) {
return true;
}
for(var i in items) {
recNumbers.push(i);
}
} else {// Normal page
// this regex will fail about 1/100,000,000 tries
var uriRegexp = /^((.*?)\/([0-9]+?))\//;
var m = uriRegexp.exec(uri);
var newUri = m[1]+"/40"
var elmts = doc.evaluate('/html/body/form', doc, nsResolver, XPathResult.ANY_TYPE, null);
while(elmt = elmts.iterateNext()) {
var initialText = doc.evaluate('.//text()[1]', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
if(initialText && initialText.nodeValue && Zotero.Utilities.superCleanString(initialText.nodeValue) == "Viewing record") {
recNumbers.push(doc.evaluate('./b[1]/text()[1]', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().nodeValue);
break;
}
}
}
var translator = Zotero.loadTranslator("import");
translator.setTranslator("a6ee60df-1ddc-4aae-bb25-45e0537be973");
var marc = translator.getTranslatorObject();
Zotero.Utilities.loadDocument(newUri+'?marks='+recNumbers.join(",")+'&shadow=NO&format=FLAT+ASCII&sort=TITLE&vopt_elst=ALL&library=ALL&display_rule=ASCENDING&duedate_code=l&holdcount_code=t&DOWNLOAD_x=22&DOWNLOAD_y=12&address=&form_type=', function(doc) {
var pre = doc.getElementsByTagName("pre");
var text = pre[0].textContent;
var documents = text.split("*** DOCUMENT BOUNDARY ***");
for(var j=1; j<documents.length; j++) {
var uri = newUri+"?marks="+recNumbers[j]+"&shadow=NO&format=FLAT+ASCII&sort=TITLE&vopt_elst=ALL&library=ALL&display_rule=ASCENDING&duedate_code=l&holdcount_code=t&DOWNLOAD_x=22&DOWNLOAD_y=12&address=&form_type=";
var lines = documents[j].split("\n");
var record = new marc.record();
var tag, content;
var ind = "";
for(var i=0; i<lines.length; i++) {
var line = lines[i];
if(line[0] == "." && line.substr(4,2) == ". ") {
if(tag) {
content = content.replace(/\|([a-z])/g, marc.subfieldDelimiter+"$1");
record.addField(tag, ind, content);
}
} else {
content += " "+line.substr(6);
continue;
}
tag = line.substr(1, 3);
if(tag[0] != "0" || tag[1] != "0") {
ind = line.substr(6, 2);
content = line.substr(8);
} else {
content = line.substr(7);
if(tag == "000") {
tag = undefined;
record.leader = "00000"+content;
Zotero.debug("the leader is: "+record.leader);
}
}
}//end FOR
var newItem = new Zotero.Item();
record.translate(newItem);
newItem.libraryCatalog = "Rice University Library ";
newItem.complete();
}//end FOR
Zotero.done();
});
Zotero.wait();
}//END while
}//END scrape function

View file

@ -1,15 +1,15 @@
{
"translatorID": "b6d0a7a-d076-48ae-b2f0-b6de28b194e",
"label": "ScienceDirect",
"creator": "Michael Berkowitz",
"target": "https?://[^/]*science-?direct\\.com[^/]*/science(\\/article)?(\\?(?:.+\\&|)ob=(?:ArticleURL|ArticleListURL|PublicationURL))?",
"minVersion": "1.0.0b3.r1",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcs",
"lastUpdated": "2011-06-20 02:05:48"
"translatorID": "b6d0a7a-d076-48ae-b2f0-b6de28b194e",
"label": "ScienceDirect",
"creator": "Michael Berkowitz",
"target": "^https?://[^/]*science-?direct\\.com[^/]*/science(\\/article)?(\\?(?:.+\\&|)ob=(?:ArticleURL|ArticleListURL|PublicationURL))?",
"minVersion": "2.1",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcs",
"lastUpdated": "2011-07-09 01:55:35"
}
function detectWeb(doc, url) {
@ -168,7 +168,7 @@ function doWeb(doc, url) {
item.abstractNote = item.notes[0].note;
item.notes = new Array();
}
item.DOI = item.DOI.substr(10);
item.DOI = item.DOI.replace(/^doi:\s+/i, '');
item.complete();
});
translator.translate();
@ -330,54 +330,53 @@ function doWeb(doc, url) {
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://www.sciencedirect.com/science/article/pii/S0896627311004430#bib5",
"items": [
{
"itemType": "journalArticle",
"creators": [
{
"lastName": "Schaaf",
"firstName": "Christian P.",
"creatorType": "author"
},
{
"lastName": "Zoghbi",
"firstName": "Huda Y.",
"creatorType": "author"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"attachments": [
{
"url": false,
"title": "ScienceDirect Snapshot",
"mimeType": "text/html"
},
{
"url": false,
"title": "ScienceDirect Full Text PDF",
"mimeType": "application/pdf"
}
],
"title": "Solving the Autism Puzzle a Few Pieces at a Time",
"publicationTitle": "Neuron",
"volume": "70",
"issue": "5",
"pages": "806-808",
"date": "June 9, 2011",
"backupPublicationTitle": "",
"ISBN": "0896-6273",
"ISSN": "0896-6273",
"DOI": "16/j.neuron.2011.05.025",
"url": "http://www.sciencedirect.com/science/article/pii/S0896627311004430",
"abstractNote": "\u000aIn this issue, a pair of studies (Levy et al. and Sanders et al.) identify several de novo copy-number variants that together account for 5%-8% of cases of simplex autism spectrum disorders. These studies suggest that several hundreds of loci are likely to contribute to the complex genetic heterogeneity of this group of disorders. An accompanying study in this issue (Gilman et al.), presents network analysis implicating these CNVs in neural processes related to synapse development, axon targeting, and neuron motility.",
"libraryCatalog": "ScienceDirect"
}
]
}
{
"type": "web",
"url": "http://www.sciencedirect.com/science/article/pii/S0896627311004430#bib5",
"items": [
{
"itemType": "journalArticle",
"creators": [
{
"lastName": "Schaaf",
"firstName": "Christian P.",
"creatorType": "author"
},
{
"lastName": "Zoghbi",
"firstName": "Huda Y.",
"creatorType": "author"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"attachments": [
{
"url": false,
"title": "ScienceDirect Snapshot",
"mimeType": "text/html"
},
{
"url": false,
"title": "ScienceDirect Full Text PDF",
"mimeType": "application/pdf"
}
],
"title": "Solving the Autism Puzzle a Few Pieces at a Time",
"publicationTitle": "Neuron",
"volume": "70",
"issue": "5",
"pages": "806-808",
"date": "June 9, 2011",
"ISBN": "0896-6273",
"ISSN": "0896-6273",
"DOI": "10.1016/j.neuron.2011.05.025",
"url": "http://www.sciencedirect.com/science/article/pii/S0896627311004430",
"abstractNote": "In this issue, a pair of studies (Levy et al. and Sanders et al.) identify several de novo copy-number variants that together account for 5%-8% of cases of simplex autism spectrum disorders. These studies suggest that several hundreds of loci are likely to contribute to the complex genetic heterogeneity of this group of disorders. An accompanying study in this issue (Gilman et al.), presents network analysis implicating these CNVs in neural processes related to synapse development, axon targeting, and neuron motility.",
"libraryCatalog": "ScienceDirect"
}
]
}
]
/** END TEST CASES **/

View file

@ -1,20 +1,38 @@
{
"translatorID":"a14ac3eb-64a0-4179-970c-92ecc2fec992",
"translatorType":4,
"label":"Scopus",
"creator":"Michael Berkowitz and Rintze Zelle",
"target":"http://[^/]*www.scopus.com[^/]*",
"minVersion":"1.0.0b4.r5",
"maxVersion":"",
"priority":100,
"inRepository":true,
"lastUpdated":"2009-06-04 00:00:00"
"translatorID": "a14ac3eb-64a0-4179-970c-92ecc2fec992",
"label": "Scopus",
"creator": "Michael Berkowitz, Rintze Zelle and Avram Lyon",
"target": "^http://www\\.scopus\\.com[^/]*",
"minVersion": "2.1",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"lastUpdated": "2011-07-27 14:06:10"
}
/*
Scopus Translator
Copyright (C) 2008-2011 Center for History and New Media
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function detectWeb(doc, url) {
if (url.indexOf("/results/") != -1) {
if (url.indexOf("/results/") !== -1) {
return "multiple";
} else if (url.indexOf("/record/") != -1) {
} else if (url.indexOf("/record/") !== -1) {
return "journalArticle";
}
}
@ -24,7 +42,7 @@ function getEID(url) {
}
function returnURL(eid) {
return 'http://www.scopus.com/scopus/citation/output.url?origin=recordpage&eid=' + eid + '&src=s&view=CiteAbsKeywsRefs';
return 'http://www.scopus.com/citation/output.url?origin=recordpage&eid=' + eid + '&src=s&view=FullDocument&outputType=export';
}
function doWeb(doc, url) {
@ -36,24 +54,35 @@ function doWeb(doc, url) {
var articles = new Array();
if (detectWeb(doc, url) == "multiple") {
items = new Object();
var boxes = doc.evaluate('//table/tbody/tr[@class]/td[@class="fldtextPad"][1]', doc, nsResolver, XPathResult.ANY_TYPE, null);
var boxes = doc.evaluate('//div[@id="resultsBody"]/table/tbody/tr[@class and (not(@id) or not(contains(@id,"previewabstractrow")))]/td[@class="fldtextPad"][1]', doc, nsResolver, XPathResult.ANY_TYPE, null);
var box;
while (box = boxes.iterateNext()) {
var title = Zotero.Utilities.trimInternal(doc.evaluate('.//span[@class="txtBoldOnly"]', box, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent);
var link = doc.evaluate('.//a[@class="outwardLink"]', box, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().href;
items[link] = title;
}
items = Zotero.selectItems(items);
for (var i in items) {
articles.push(returnURL(getEID(i)));
var link = doc.evaluate('.//a', box, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
items[link.href] = Zotero.Utilities.trimInternal(link.textContent);
}
Zotero.selectItems(items, function (items) {
for (var i in items) {
articles.push(returnURL(getEID(i)));
}
scrape(articles);
});
} else {
articles = [returnURL(getEID(url))];
scrape(articles);
}
Zotero.Utilities.processDocuments(articles, function(newDoc) {
var eid = getEID(newDoc.location.href);
var stateKey = newDoc.evaluate('//input[@name="stateKey"]', newDoc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().value;
var get = 'http://www.scopus.com/scopus/citation/export.url';
Zotero.wait();
}
function scrape(articles) {
var article = articles.shift();
Zotero.Utilities.doGet(article, function(text, obj) {
var stateKey = text.match(/<input[^>]*name="stateKey"[^>]*>/);
if (!stateKey) Zotero.debug("No stateKey");
else stateKey = stateKey[0].match(/value="([^"]*)"/)[1];
var eid = text.match(/<input[^>]*name="eid"[^>]*>/);
if (!eid) Zotero.debug("No eid");
else eid = eid[0].match(/value="([^"]*)"/)[1];
var get = 'http://www.scopus.com/citation/export.url';
var post = 'origin=recordpage&sid=&src=s&stateKey=' + stateKey + '&eid=' + eid + '&sort=&exportFormat=RIS&view=CiteAbsKeyws&selectedCitationInformationItemsAll=on';
var rislink = get + "?" + post;
Zotero.Utilities.HTTP.doGet(rislink, function(text) {
@ -62,14 +91,17 @@ function doWeb(doc, url) {
translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7");
translator.setString(text);
translator.setHandler("itemDone", function(obj, item) {
if (item.notes[0]['note']) {
item.abstractNote = item.notes[0]['note'];
item.notes = new Array();
item.complete();
for (i in item.notes) {
if (item.notes[i]['note'].match(/Export Date:|Source:/))
delete item.notes[i];
}
delete item.url;
item.complete();
});
translator.translate();
}, function() {
if (articles.length > 0) scrape(articles);
else Zotero.done();
});
}, function() {Zotero.done();});
Zotero.wait();
}
});
}

94
translators/Twitter.js Normal file

File diff suppressed because one or more lines are too long

View file

@ -7,9 +7,10 @@
"minVersion":"1.0.0b3.r1",
"maxVersion":"",
"priority":100,
"browserSupport":"gcsn",
"configOptions":{"dataMode":"rdf/xml"},
"inRepository":true,
"lastUpdated":"2011-01-11 04:31:00"
"lastUpdated":"2011-07-08 04:51:41"
}
function doExport() {

View file

@ -19,7 +19,7 @@ function doWeb(doc, url) { return FW.doWeb(doc, url); }
FW.Scraper({
itemType : 'document',
detect : "always",
title : FW.Xpath('//table[@class="cable"]/tbody/tr[2]/td/a').text().prepend("Wikileaks Cable "),
title : FW.Xpath('//div[@class="pane big"]/h3').text().remove(/^Viewing cable /).prepend("Wikileaks Cable ")
attachments : [{
url: FW.Url(),
title: "Wikileaks cable snapshot",

View file

@ -8,8 +8,9 @@
"maxVersion":"",
"priority":100,
"displayOptions":{"exportCharset":"UTF-8"},
"browserSupport":"gcsn",
"inRepository":true,
"lastUpdated":"2011-01-11 04:31:00"
"lastUpdated":"2011-07-08 04:51:41"
}
var fieldMap = {

View file

@ -1,14 +1,14 @@
{
"translatorID": "fe728bc9-595a-4f03-98fc-766f1d8d0936",
"label": "Wiley Online Library",
"creator": "Sean Takats, Michael Berkowitz and Avram Lyon",
"target": "https?://onlinelibrary\\.wiley\\.com[^\\/]*/(?:doi|advanced/search)",
"minVersion": "1.0.0b4.r5",
"maxVersion": "",
"priority": 100,
"inRepository": "1",
"translatorType": 4,
"lastUpdated": "2011-03-27 01:29:16"
"translatorID": "fe728bc9-595a-4f03-98fc-766f1d8d0936",
"label": "Wiley Online Library",
"creator": "Sean Takats, Michael Berkowitz and Avram Lyon",
"target": "^https?://onlinelibrary\\.wiley\\.com[^\\/]*/(?:doi|advanced/search)",
"minVersion": "1.0.0b4.r5",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"lastUpdated": "2011-07-20 17:14:04"
}
function detectWeb(doc, url){
@ -23,6 +23,10 @@ function detectWeb(doc, url){
}
function doWeb(doc, url){
// Define ZU, Z
if (!ZU) var ZU = Zotero.Utilities;
if (!Z) var Z = Zotero;
var namespace = doc.documentElement.namespaceURI;
var nsResolver = namespace ? function(prefix) {
if (prefix == 'x') return namespace; else return null;
@ -96,25 +100,25 @@ function scrape(doc,url)
var nsResolver = namespace ? function(prefix) {
if (prefix == 'x') return namespace; else return null;
} : null;
var newItem=new Zotero.Item("journalArticle");
var temp;
var xpath;
var row;
var rows;
var temp;
var xpath;
var row;
var rows;
newItem.url = doc.location.href;
var metaTags = doc.getElementsByTagName("meta");
newItem.url = doc.location.href;
var metaTags = doc.getElementsByTagName("meta");
var pages = [false, false];
var doi = false;
var pdf = false;
var html = false;
var pages = [false, false];
var doi = false;
var pdf = false;
var html = false;
for (var i = 0; i< metaTags.length; i++) {
var tag = metaTags[i].getAttribute("name");
var value = metaTags[i].getAttribute("content");
//Zotero.debug(pages + pdf + html);
//Zotero.debug("Have meta tag: " + tag + " => " + value);
//Zotero.debug("Have meta tag: " + tag + " => " + value);
switch (tag) {
// PRISM
case "prism.publicationName": newItem.publicationTitle = value; break;
@ -132,7 +136,11 @@ function scrape(doc,url)
case "citation_journal_title": if (!newItem.publicationTitle) newItem.publicationTitle = value; break;
case "citation_authors":
if (newItem.creators.length == 0) {
for each(var author in value.split(';')) newItem.creators.push(Zotero.Utilities.cleanAuthor(author, "author", true));
for each(var author in value.split(';')) {
if (author.toUpperCase() == author)
author = ZU.capitalizeTitle(author.toLowerCase(), true);
newItem.creators.push(Zotero.Utilities.cleanAuthor(author, "author", true));
}
}
break;
case "citation_title": if (!newItem.title) newItem.title = value; break;
@ -168,10 +176,7 @@ function scrape(doc,url)
Zotero.debug("Ignoring meta tag: " + tag + " => " + value);
}
}
if (pdf) newItem.attachments = [{url:pdf, title:"Wiley Full Text PDF", mimeType:"application/pdf"}];
if (html) newItem.attachments = [{url:html, title:"Wiley Full Text HTML"}];
if (pages[0] && pages[1]) newItem.pages = pages.join('-')
else newItem.pages = pages[0] ? pages[1] : (pages[1] ? pages[1] : "");
@ -180,7 +185,29 @@ function scrape(doc,url)
var abstractNode = doc.evaluate('//div[@id="abstract"]/div[@class="para"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
if (abstractNode) newItem.abstractNote = abstractNode.textContent;
}
newItem.complete();
// Fix things in uppercase
var toFix = [ "title", "shortTitle" ];
for each (var i in toFix) {
if (newItem[i] && newItem[i].toUpperCase() == newItem[i])
newItem[i] = Zotero.Utilities.capitalizeTitle(newItem[i].toLowerCase(), true);
}
// Remove final asterisk in title if present
newItem.title = newItem.title.replace(/\*$/,'');
if (html) newItem.attachments = [{url:html, title:"Wiley Full Text HTML"}];
if (pdf) {
Zotero.Utilities.doGet(pdf, function(text) {
pdf = text.match(/<iframe id="pdfDocument" src="([^"]*)"/);
if (pdf) newItem.attachments.push({url:pdf[1].replace(/&amp;/g,"&"), title:"Wiley Full Text PDF", mimeType:"application/pdf"});
//<iframe id="pdfDocument" src="http://onlinelibrary.wiley.com/store/10.1111/j.1088-4963.2009.01154.x/asset/j.1088-4963.2009.01154.x.pdf?v=1&amp;t=gqcawqo5&amp;s=7ea8c89d203f02c212feeda25925ae663d37cc48" width="100%" height="100%">
newItem.complete();
}, function () {Zotero.done()});
} else {
newItem.complete();
}
}
// Implementation of ISBN and ISSN check-digit verification
@ -318,3 +345,85 @@ idCheck = function(isbn) {
if(!valid13) {num13 = false};
return {"isbn10" : num10, "isbn13" : num13, "issn" : num8};
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://onlinelibrary.wiley.com/doi/10.1111/j.1088-4963.2009.01154.x/abstract",
"items": [
{
"itemType": "journalArticle",
"creators": [
{
"firstName": "Michael",
"lastName": "Otsuka",
"creatorType": "author"
},
{
"firstName": "Alex",
"lastName": "Voorhoeve",
"creatorType": "author"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"attachments": [
{
"url": false,
"title": "Wiley Full Text PDF",
"mimeType": "application/pdf"
}
],
"url": "http://onlinelibrary.wiley.com/doi/10.1111/j.1088-4963.2009.01154.x/abstract",
"DOI": "10.1111/j.1088-4963.2009.01154.x",
"volume": "37",
"issue": "2",
"publicationTitle": "Philosophy & Public Affairs",
"publisher": "Blackwell Publishing Inc",
"ISSN": "1088-4963",
"title": "Why It Matters That Some Are Worse Off Than Others: An Argument against the Priority View",
"language": "en",
"date": "2009/03/01",
"pages": "171-199",
"libraryCatalog": "Wiley Online Library",
"shortTitle": "Why It Matters That Some Are Worse Off Than Others"
}
]
},
{
"type": "web",
"url": "http://onlinelibrary.wiley.com/doi/10.1111/j.1533-6077.2008.00144.x/abstract",
"items": [
{
"itemType": "journalArticle",
"creators": [
{
"firstName": "David",
"lastName": "Copp",
"creatorType": "author"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"attachments": [],
"url": "http://onlinelibrary.wiley.com/doi/10.1111/j.1533-6077.2008.00144.x/abstract",
"DOI": "10.1111/j.1533-6077.2008.00144.x",
"volume": "18",
"issue": "1",
"publicationTitle": "Philosophical Issues",
"publisher": "Blackwell Publishing Inc",
"ISSN": "1758-2237",
"title": "Darwinian Skepticism About Moral Realism",
"language": "en",
"date": "2008/09/01",
"pages": "186-206",
"libraryCatalog": "Wiley Online Library"
}
]
}
]
/** END TEST CASES **/

View file

@ -10,9 +10,10 @@
"configOptions":{"getCollections":"true", "dataMode":"rdf/xml"},
"displayOptions":{"exportNotes":true, "exportFileData":false},
"inRepository":true,
"lastUpdated":"2011-01-11 04:31:00"
"lastUpdated":"2011-07-08 04:51:41"
}
var item;
var rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
var n = {
@ -79,15 +80,21 @@ function generateCollection(collection) {
*/
function getDisplayTitle(item) {
if(!item.title && (item.itemType == "interview" || item.itemType == "letter")) {
var participants = [creator for each(creator in item.creators)
var participants = []
for each(var creator in item.creators) {
if (item.itemType == "letter" && creator.creatorType == "recipient" ||
item.itemType == "interview" && creator.creatorType == "interviewer")];
item.itemType == "interview" && creator.creatorType == "interviewer") {
participants.push(creator);
}
}
var displayTitle = "["+(item.itemType == "letter" ? "Letter" : "Interview");
if(participants.length) {
//var names = [creator.firstName ? creator.firstName+" "+creator.lastName : creator.lastName
var names = [creator.lastName
for each(creator in participants)];
var names = [];
for each(var creator in participants) {
names.push(creator.lastName);
}
displayTitle += (item.itemType == "letter" ? " to " : " of ")+names[0];

View file

@ -1,18 +1,20 @@
{
"translatorID":"ecddda2e-4fc6-4aea-9f17-ef3b56d7377a",
"translatorType":4,
"label":"arXiv.org",
"creator":"Sean Takats and Michael Berkowitz",
"target":"http://(?:([^\\.]+\\.))?(?:(arxiv\\.org|xxx.lanl.gov)/(?:find/\\w|list/\\w|abs/)|eprintweb.org/S/(?:search|archive|article)(?!.*refs$)(?!.*cited$))",
"minVersion":"1.0.0b3.r1",
"maxVersion":"",
"priority":100,
"inRepository":true,
"lastUpdated":"2011-01-11 04:31:00"
"translatorID": "ecddda2e-4fc6-4aea-9f17-ef3b56d7377a",
"label": "arXiv.org",
"creator": "Sean Takats and Michael Berkowitz",
"target": "http://(?:([^\\.]+\\.))?(?:(arxiv\\.org|xxx.lanl.gov)/(?:find/\\w|list/\\w|abs/)|eprintweb.org/S/(?:search|archive|article)(?!.*refs$)(?!.*cited$))",
"minVersion": "2.1.9",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcs",
"lastUpdated": "2011-07-27 13:39:47"
}
function detectWeb(doc, url) {
var searchRe = /^http:\/\/(?:([^\.]+\.))?(?:(arxiv\.org|xxx\.lanl\.gov)\/(?:find|list)|eprintweb.org\/S\/(?:archive|search$))/;
var searchRe = new RegExp('^http://(?:([^\.]+\.))?(?:(arxiv\.org|xxx\.lanl\.gov)/(?:find|list)|eprintweb.org/S/(?:archive|search$))');
if(searchRe.test(url)) {
return "multiple";
} else {
@ -26,10 +28,11 @@ function getPDF(articleID) {
}
function doWeb(doc, url) {
var eprintMultRe = /^http:\/\/(?:www\.)?eprintweb.org\/S\/(?:search|archive)/;
// eprintweb appears to be defunct as of mid-2011. leaving relevant code here for now
var eprintMultRe = new RegExp('^http://(?:www\.)?eprintweb.org/S/(?:search|archive)');
var eprintMultM = eprintMultRe.exec(url);
var eprintSingRe = /^http:\/\/(?:www\.)?eprintweb.org\/S\/(?:article|search\/[0-9]+\/A[0-9]+)/;
var eprintSingRe = new RegExp('^http://(?:www\.)?eprintweb.org/S/(?:article|search/[0-9]+/A[0-9]+)');
var eprintSingM = eprintSingRe.exec(url);
if (eprintMultM) {
@ -41,13 +44,8 @@ function doWeb(doc, url) {
var titlesXPath = '//div[@id="dlpage"]/dl/dd/div[@class="meta"]/div[@class="list-title"]';
}
var namespace = doc.documentElement.namespaceURI;
var nsResolver = namespace ? function(prefix) {
if (prefix == 'x') return namespace; else return null;
} : null;
var elmts = doc.evaluate(elmtsXPath, doc, nsResolver, XPathResult.ANY_TYPE, null);
var titles = doc.evaluate(titlesXPath, doc, nsResolver, XPathResult.ANY_TYPE, null);
var elmts = doc.evaluate(elmtsXPath, doc, null, XPathResult.ANY_TYPE, null);
var titles = doc.evaluate(titlesXPath, doc, null, XPathResult.ANY_TYPE, null);
var newURIs = new Array();
var elmt = elmts.iterateNext();
@ -59,11 +57,11 @@ function doWeb(doc, url) {
var i=0;
if (eprintMultM){
do {
var newID = doc.evaluate('./text()', elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
var newID = doc.evaluate('./text()', elmt, null, XPathResult.ANY_TYPE, null).iterateNext().textContent;
newID = newID.replace(/arXiv:/, "");
newID = newID.replace(/\//g, "%2F");
newID = newID.replace(/v\d*/, ""); //remove version number
availableItems[i] = doc.evaluate(titleNode, title, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
availableItems[i] = doc.evaluate(titleNode, title, null, XPathResult.ANY_TYPE, null).iterateNext().textContent;
arXivIDs[i] = newID;
i++;
} while ((elmt = elmts.iterateNext()) && (title = titles.iterateNext()));
@ -74,118 +72,181 @@ function doWeb(doc, url) {
newID = newID.replace(/arXiv:/, "");
newID = newID.replace(/\//g, "%2F");
newID = newID.replace(/v\d*/, ""); //remove version number
availableItems[i] = Zotero.Utilities.trimInternal(title.textContent.replace(/^\s*Title:\s+/, ""));
availableItems[i] = ZU.trimInternal(title.textContent.replace(/^\s*Title:\s+/, ""));
arXivIDs[i] = newID;
i++;
} while ((elmt = elmts.iterateNext()) && (title = titles.iterateNext()));
}
var items = Zotero.selectItems(availableItems);
if(!items) {
return true;
}
for(var i in items) {
newURIs.push("http://export.arxiv.org/oai2?verb=GetRecord&identifier=oai%3AarXiv.org%3A" + arXivIDs[i] + "&metadataPrefix=oai_dc");
}
var items = Zotero.selectItems(availableItems, function(items) {
if(!items) {
return true;
}
for(var i in items) {
newURIs.push("http://export.arxiv.org/oai2?verb=GetRecord&identifier=oai%3AarXiv.org%3A" + arXivIDs[i] + "&metadataPrefix=oai_dc");
}
Zotero.Utilities.HTTP.doGet(newURIs, parseXML, function() {Zotero.done();}, null);
});
}
else {
if (eprintSingM){
var titleID = doc.evaluate('//td[@class="ti"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
var arXivID = doc.evaluate('//table/tbody/tr[4]/td/table/tbody/tr/td[1]/table/tbody/tr[1]/td[@class="txt"]/b', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
var titleID = doc.evaluate('//td[@class="ti"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent;
var arXivID = doc.evaluate('//table/tbody/tr[4]/td/table/tbody/tr/td[1]/table/tbody/tr[1]/td[@class="txt"]/b', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent;
arXivID = arXivID.substring(0, arXivID.indexOf(" "));
arXivID = arXivID.replace(/arXiv:/, "");
arXivID = arXivID.replace(/\//g, "%2F");
} else {
var arXivID = doc.evaluate('//title', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
var arXivID = doc.evaluate('//title', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent;
var titleRe = /\[([^\]]*)]/;
var m = titleRe.exec(arXivID);
arXivID = m[1];
arXivID = arXivID.replace(/\//g, "%2F");
}
arXivID = arXivID.replace(/v\d*/, ""); //remove version number
Zotero.debug("ID= "+ arXivID);
newURIs.push("http://export.arxiv.org/oai2?verb=GetRecord&identifier=oai%3AarXiv.org%3A" + arXivID + "&metadataPrefix=oai_dc");
Zotero.Utilities.HTTP.doGet(newURIs, parseXML, function() {Zotero.done();}, null);
}
Zotero.Utilities.HTTP.doGet(newURIs, function(text) {
var newItem = new Zotero.Item("journalArticle");
// remove header
text = text.replace(/<!DOCTYPE[^>]*>/, "").replace(/<\?xml[^>]*\?>/, "");
// fix non-compliant XML tags (colons)
text = text.replace(/<dc:/g, "<dc_").replace(/<\/dc:/g, "</dc_");
text = text.replace(/<oai_dc:dc/g, "<oai_dc_dc").replace(/<\/oai_dc:dc/g, "</oai_dc_dc");
text = text.replace(/<OAI-PMH[^>]*>/, "").replace(/<\/OAI-PMH[^>]*>/, "");
text = "<zotero>" + text + "</zotero>";
var xml = new XML(text);
var title;
var citation = xml.GetRecord.record.metadata.oai_dc_dc;
var test = xml..responseDate.text().toString();
if (citation.dc_title.length()){
title = Zotero.Utilities.trimInternal(citation.dc_title.text().toString());
newItem.title = title;
}
Zotero.debug("article title: " + title);
var type = "";
if(citation.dc_creator.length()) {
var authors = citation.dc_creator;
for(var j=0; j<authors.length(); j++) {
Zotero.debug("author: " + authors[j]);
newItem.creators.push(Zotero.Utilities.cleanAuthor(authors[j].text().toString(),type,true));
}
}
if (citation.dc_date.length()) {
var dates = citation.dc_date;
newItem.date = Zotero.Utilities.trimInternal(dates[0].text().toString());
}
if (citation.dc_description.length()) {
var descriptions = citation.dc_description;
for (var j=0; j<descriptions.length(); j++) {
var noteStr = Zotero.Utilities.trimInternal(descriptions[j].text().toString());
newItem.notes.push({note:noteStr});
}
}
if (citation.dc_subject.length()) {
var subjects = citation.dc_subject;
for (var j=0; j<subjects.length(); j++) {
var subjectValue = Zotero.Utilities.trimInternal(subjects[j].text().toString());
newItem.tags.push(subjectValue);
}
}
if (citation.dc_identifier.length()) {
var identifiers = citation.dc_identifier;
for (var j=0; j<identifiers.length(); j++) {
var identifier = Zotero.Utilities.trimInternal(identifiers[j].text().toString());
if (identifier.substr(0, 4) == "doi:") {
newItem.DOI = identifier;
}
else if (identifier.substr(0, 7) == "http://") {
newItem.url = identifier;
}
else {
newItem.extra = identifier;
}
}
}
var articleID = "";
if (xml.GetRecord.record.header.identifier.length()) {
articleID = xml.GetRecord.record.header.identifier.text().toString();
articleID = articleID.substr(14);
var idPrefixRegex = /^arXiv:/i;
if (idPrefixRegex.test (articleID))
newItem.publicationTitle = articleID;
else
newItem.publicationTitle = "arXiv:" + articleID;
}
// TODO add "arXiv.org" to bib data?
newItem.attachments.push({url:newItem.url, title:"arXiv.org Snapshot", mimeType:"text/html"});
newItem.attachments.push(getPDF(articleID));
if (newItem.notes[0]['note']) {
newItem.abstractNote = newItem.notes[0]['note'];
newItem.notes = new Array();
}
newItem.complete();
}, function() {Zotero.done();}, null);
Zotero.wait();
}
function parseXML(text) {
var newItem = new Zotero.Item("journalArticle");
// remove header
text = text.replace(/<!DOCTYPE[^>]*>/, "").replace(/<\?xml[^>]*\?>/, "");
// fix non-compliant XML tags (colons)
text = text.replace(/<dc:/g, "<dc_").replace(/<\/dc:/g, "</dc_");
text = text.replace(/<oai_dc:dc/g, "<oai_dc_dc").replace(/<\/oai_dc:dc/g, "</oai_dc_dc");
text = text.replace(/<OAI-PMH[^>]*>/, "").replace(/<\/OAI-PMH[^>]*>/, "");
text = "<zotero>" + text + "</zotero>";
var xml = (new DOMParser()).parseFromString(text, "text/xml");
newItem.title = getXPathNodeTrimmed(xml, "dc_title");
getCreatorNodes(xml, "dc_creator", newItem, "author");
newItem.date = getXPathNodeTrimmed(xml, "dc_date");
var descriptions = ZU.xpath(xml, "//GetRecord/record/metadata/oai_dc_dc/dc_description");
for(var j=0; j<descriptions.length; j++) {
var noteStr = ZU.trimInternal(descriptions[j].textContent);
newItem.notes.push({note:noteStr});
}
var subjects = ZU.xpath(xml, "//GetRecord/record/metadata/oai_dc_dc/dc_subject");
for(var j=0; j<subjects.length; j++) {
var subject = ZU.trimInternal(subjects[j].textContent);
newItem.tags.push(subject);
}
var identifiers = ZU.xpath(xml, "//GetRecord/record/metadata/oai_dc_dc/dc_identifier");
for(var j=0; j<identifiers.length; j++) {
var identifier = ZU.trimInternal(identifiers[j].textContent);
if (identifier.substr(0, 4) == "doi:") {
newItem.DOI = identifier;
}
else if (identifier.substr(0, 7) == "http://") {
newItem.url = identifier;
}
else {
newItem.extra = identifier;
}
}
var articleID = ZU.xpath(xml, "//GetRecord/record/header/identifier");
articleID = ZU.trimInternal(articleID[0].textContent);
articleID = articleID.substr(14);
var idPrefixRegex = new RegExp('^arXiv:', "i");
if (idPrefixRegex.test (articleID)) {
newItem.publicationTitle = articleID;
}
else {
newItem.publicationTitle = "arXiv:" + articleID;
}
// TODO add "arXiv.org" to bib data?
newItem.attachments.push({url:newItem.url, title:"arXiv.org Snapshot", mimeType:"text/html"});
newItem.attachments.push(getPDF(articleID));
if (newItem.notes[0]['note']) {
newItem.abstractNote = newItem.notes[0]['note'];
newItem.notes = new Array();
}
newItem.complete();
}
function getXPathNodeTrimmed(xml, name) {
var node = ZU.xpath(xml, "//GetRecord/record/metadata/oai_dc_dc/"+name);
var val = "";
if(node.length){
val = Zotero.Utilities.trimInternal(node[0].textContent);
}
return val;
}
function getCreatorNodes(xml, name, newItem, creatorType) {
var nodes = ZU.xpath(xml, "//GetRecord/record/metadata/oai_dc_dc/"+name);
for(var i=0; i<nodes.length; i++) {
newItem.creators.push(Zotero.Utilities.cleanAuthor(nodes[i].textContent, creatorType, true));
}
}/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://arxiv.org/list/astro-ph/new",
"items": "multiple"
},
{
"type": "web",
"url": "http://arxiv.org/abs/1107.4612",
"items": [
{
"itemType": "journalArticle",
"creators": [
{
"firstName": "O'Dea, D.",
"lastName": "T",
"creatorType": "author"
},
{
"firstName": "Clark, C.",
"lastName": "N",
"creatorType": "author"
},
{
"firstName": "Contaldi, C.",
"lastName": "R",
"creatorType": "author"
},
{
"firstName": "MacTavish, C.",
"lastName": "J",
"creatorType": "author"
}
],
"notes": [],
"tags": [
"Astrophysics - Cosmology and Extragalactic Astrophysics",
"Astrophysics - Galaxy Astrophysics"
],
"seeAlso": [],
"attachments": [
{
"url": false,
"title": "arXiv.org Snapshot",
"mimeType": "text/html"
},
{
"url": false,
"mimeType": "application/pdf",
"title": "1107.4612 PDF"
}
],
"title": "A Model For Polarised Microwave Foreground Emission From Interstellar Dust",
"date": "2011-07-22",
"url": "http://arxiv.org/abs/1107.4612",
"publicationTitle": "arXiv:1107.4612",
"abstractNote": "The upcoming generation of cosmic microwave background (CMB) experiments face a major challenge in detecting the weak cosmic B-mode signature predicted as a product of primordial gravitational waves. To achieve the required sensitivity these experiments must have impressive control of systematic effects and detailed understanding of the foreground emission that will influence the signal. In this paper we describe a model of foreground dust intensity and polarisation. The model includes a 3D description of the Galactic magnetic field, examining both large and small scales. We also include in the model the details of the dust density, grain alignment and the intrinsic polarisation of the emission from an individual grain. We present here Stokes parameter maps at 150 GHz and provide an on-line repository for these and additional template maps at frequencies that will be targeted by upcoming experiments such as EBEX, Spider and SPTpol.",
"libraryCatalog": "arXiv.org"
}
]
}
]
/** END TEST CASES **/

View file

@ -1,4 +1,4 @@
4 # Increment number when modifying file
5 # Increment number when modifying file
96b9f483-c44d-5784-cdad-ce21b984 # Amazon
add7c71c-21f3-ee14-d188-caf9da12 # SIRSI 2003+
@ -11,10 +11,11 @@ da440efe-646c-4a18-9958-abe1f7d55cde # NCSU Library (Endeca 2)
e07e9b8c-0e98-4915-bb5a-32a08cb2f365 # Open WorldCat (Search)
490909d7-7d79-4c7a-a136-77df618d4db2 # Worldcat.org
dd149efc-7f0e-43e4-b3df-b6d15e171717 # Persée
8c1f42d5-02fa-437b-b2b2-73afc768eb07 # PNAS (replaced by HighWire 2.0)
56ea09bc-57ee-4f50-976e-cf7cb1f6c6d8 # Royal Society Publishing (replaced by HighWire 2.0)
83538f48-906f-40ef-bdb3-e94f63676307 # NAA RecordSearch (replaced by National Archives of Australia)
dbb5d4bc-3b21-47a2-9751-5dcbb65b902a # AMS Online Journals - Allenpress (replaced with DOI for now)
d2416f31-4f24-4e18-8c66-06122af5bc2c # Women in Judaism (replaced with COinS)
bc39e05b-141a-4322-85f0-a5b86edf896b # Hindawi
e78d20f7-488-4023-831-dfe39679f3f # ACM (replaced by newer version)
3f44a651-8b6b-4591-8ca4-4bfb943a13f4 # Edutopia (replaced with nothing)
636c8ea6-2af7-4488-8ccd-ea280e4a7a98 # Sage Journals Online (replaced by Highwire 2.0)

View file

@ -1,14 +1,14 @@
{
"translatorID": "587709d3-80c5-467d-9fc8-ed41c31e20cf",
"label": "eLibrary.ru",
"creator": "Avram Lyon",
"target": "^http://elibrary\\.ru/",
"minVersion": "1.0.0b4.r5",
"maxVersion": "",
"priority": 100,
"inRepository": "1",
"translatorType": 4,
"lastUpdated": "2011-03-12 22:55:32"
"translatorID": "587709d3-80c5-467d-9fc8-ed41c31e20cf",
"label": "eLibrary.ru",
"creator": "Avram Lyon",
"target": "^http://elibrary\\.ru/",
"minVersion": "2.1",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"lastUpdated": "2011-08-02 22:31:22"
}
/*
@ -32,7 +32,7 @@
function detectWeb(doc, url){
if (url.match(/\/item.asp/)) {
return "journalArticle";
} else if (url.match(/\/query_results\.asp/) || url.match(/\/contents\.asp/)){
} else if (url.match(/\/(query_results|contents|org_items)\.asp/)){
return "multiple";
}
}
@ -68,17 +68,17 @@ function doWeb(doc, url){
}
function scrape (doc) {
var n = doc.documentElement.namespaceURI;
var ns = n ? function(prefix) {
if (prefix == 'x') return n; else return null;
} : null;
var n = doc.documentElement.namespaceURI;
var ns = n ? function(prefix) {
if (prefix == 'x') return n; else return null;
} : null;
var datablock = doc.evaluate('//td[@align="right" and @width="100%" and @valign="top"]', doc, ns, XPathResult.ANY_TYPE, null).iterateNext();
var tableLabels = doc.evaluate('./table/tbody/tr[1]/td[@bgcolor="#dddddd"][1]|./table//table[1]//tr[1]/td[@bgcolor="#dddddd"][1]', datablock, ns, XPathResult.ANY_TYPE, null);
var titleBlock, authorBlock, publicationBlock, metaBlock, codeBlock, keywordBlock, abstractBlock, referenceBlock;
var t = 0, label; // Table number and label
while ((label = tableLabels.iterateNext()) !== null) {
while ((label = tableLabels.iterateNext()) !== null) {
t++;
label = label.textContent;
@ -194,17 +194,17 @@ function scrape (doc) {
switch (item.itemType) {
case "обзорная статья": // Would be "review article"
case "научная статья":
item.itemType = "journalArticle";
break;
item.itemType = "journalArticle";
break;
case "учебное пособие":
case "монография":
item.itemType = "book";
break;
item.itemType = "book";
break;
case "публикация в сборнике трудов конференции":
item.itemType = "conferencePaper";
break;
item.itemType = "conferencePaper";
break;
default:
Zotero.debug("Unknown type: "+item.itemType+". Using 'journalArticle'");
Zotero.debug("Unknown type: "+item.itemType+". Using 'journalArticle'");
item.itemType = "journalArticle";
break;
}
@ -275,4 +275,42 @@ function mapper (from, to, block, doc) {
Zotero.debug("Unmapped field: "+name.textContent.trim());
}
return [key, value.textContent.trim()];
}
}/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://elibrary.ru/org_items.asp?orgsid=3326",
"items": "multiple"
},
{
"type": "web",
"url": "http://elibrary.ru/item.asp?id=9541154",
"items": [
{
"itemType": "journalArticle",
"creators": [
{
"firstName": "М.В",
"lastName": "Свет",
"creatorType": "author"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"attachments": [],
"title": "Иноязычные заимствования в художественной прозе на иврите в XX в",
"publicationTitle": "Вестник Московского университета. Серия 13: Востоковедение",
"publisher": "Издательство Московского государственного университета",
"date": "2007",
"ISSN": "0320-8095",
"extra": "Цитируемость в РИНЦ: 0",
"issue": "1",
"pages": "40-58",
"language": "русский",
"libraryCatalog": "eLibrary.ru"
}
]
}
]
/** END TEST CASES **/