Update translators from GitHub
This commit is contained in:
parent
1f73a84cb0
commit
440d692d33
|
@ -1 +1 @@
|
|||
2011-08-21 05:25:00
|
||||
2011-08-29 18:20:00
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
"minVersion": "2.1",
|
||||
"maxVersion": "",
|
||||
"priority": 100,
|
||||
"browserSupport": "gcs",
|
||||
"inRepository": true,
|
||||
"translatorType": 4,
|
||||
"lastUpdated": "2011-07-29 01:03:06"
|
||||
"lastUpdated": "2011-08-22 22:43:11"
|
||||
}
|
||||
|
||||
function detectWeb(doc, url) {
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
"maxVersion": "",
|
||||
"priority": 300,
|
||||
"inRepository": true,
|
||||
"translatorType": 4,
|
||||
"translatorType": 6,
|
||||
"browserSupport": "gcs",
|
||||
"lastUpdated": "2011-07-01 19:16:28"
|
||||
"lastUpdated": "2011-08-25 23:46:18"
|
||||
}
|
||||
|
||||
function detectWeb(doc, url) {
|
||||
var spanTags = doc.getElementsByTagName("span");
|
||||
|
||||
|
||||
var encounteredType = false;
|
||||
|
||||
// This and the x: prefix in the XPath are to work around an issue with pages
|
||||
|
@ -83,13 +83,13 @@ function completeCOinS(newItems, couldUseFullItems, doc) {
|
|||
for(var i in newItems) {
|
||||
selectArray[i] = newItems[i].title;
|
||||
}
|
||||
|
||||
|
||||
Zotero.selectItems(selectArray, function (selectArray) {
|
||||
var useIndices = new Array();
|
||||
for(var i in selectArray) {
|
||||
useIndices.push(i);
|
||||
}
|
||||
completeItems(newItems, useIndices, couldUseFullItems);
|
||||
var useIndices = new Array();
|
||||
for(var i in selectArray) {
|
||||
useIndices.push(i);
|
||||
}
|
||||
completeItems(newItems, useIndices, couldUseFullItems);
|
||||
});
|
||||
} else if(newItems.length) {
|
||||
completeItems(newItems, [0], couldUseFullItems);
|
||||
|
@ -195,6 +195,15 @@ function doWeb(doc, url) {
|
|||
}
|
||||
}
|
||||
|
||||
function doExport() {
|
||||
var item;
|
||||
var co;
|
||||
|
||||
while (item = Zotero.nextItem()) {
|
||||
co = Zotero.Utilities.createContextObject(item, "1.0");
|
||||
Zotero.write("<span class='Z3988' title='"+ Zotero.Utilities.htmlSpecialChars(co) +"'></span>\n");
|
||||
}
|
||||
}
|
||||
/** BEGIN TEST CASES **/
|
||||
var testCases = [
|
||||
{
|
||||
|
@ -269,4 +278,4 @@ var testCases = [
|
|||
]
|
||||
}
|
||||
]
|
||||
/** END TEST CASES **/
|
||||
/** END TEST CASES **/
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
"minVersion": "2.1",
|
||||
"maxVersion": "",
|
||||
"priority": 100,
|
||||
"browserSupport": "gcs",
|
||||
"inRepository": true,
|
||||
"translatorType": 4,
|
||||
"lastUpdated": "2011-07-26 01:43:28"
|
||||
"lastUpdated": "2011-08-22 22:29:49"
|
||||
}
|
||||
|
||||
function detectWeb(doc, url) {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"priority":90,
|
||||
"browserSupport":"gcs",
|
||||
"inRepository":true,
|
||||
"lastUpdated":"2011-06-23 08:05:22"
|
||||
"lastUpdated":"2011-07-29 18:13:47"
|
||||
}
|
||||
|
||||
/* CrossRef uses unixref; documentation at http://www.crossref.org/schema/documentation/unixref1.0/unixref.html */
|
||||
|
@ -24,7 +24,7 @@ function detectSearch(item) {
|
|||
}
|
||||
|
||||
function fixAuthorCapitalization(string) {
|
||||
if(string.toUpperCase() == string) {
|
||||
if(typeof string === "string" && string.toUpperCase() === string) {
|
||||
string = string.toLowerCase().replace(/\b[a-z]/g, function(m) { return m[0].toUpperCase() });
|
||||
}
|
||||
return string;
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
"minVersion": "2.1",
|
||||
"maxVersion": "",
|
||||
"priority": 100,
|
||||
"browserSupport": "gcs",
|
||||
"inRepository": true,
|
||||
"translatorType": 4,
|
||||
"lastUpdated": "2011-07-29 01:21:09"
|
||||
"lastUpdated": "2011-08-22 22:43:24"
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
"minVersion": "2.1",
|
||||
"maxVersion": "",
|
||||
"priority": 99,
|
||||
"browserSupport": "gcs",
|
||||
"inRepository": true,
|
||||
"translatorType": 4,
|
||||
"lastUpdated": "2011-07-30 12:25:40"
|
||||
"lastUpdated": "2011-08-22 22:29:32"
|
||||
}
|
||||
|
||||
function detectWeb(doc, url) {
|
||||
|
|
201
translators/JBJS Am.js
Normal file
201
translators/JBJS Am.js
Normal file
|
@ -0,0 +1,201 @@
|
|||
{
|
||||
"translatorID": "8a325571-c2a8-417a-8a25-b1dca65154c3",
|
||||
"label": "JBJS Am",
|
||||
"creator": "Max Gordon and Avram Lyon",
|
||||
"target": "^https?://(?:www\\.)?jbjs.org[^\\/]*/(?:searchresults|issue|article)\\.aspx",
|
||||
"minVersion": "1.0",
|
||||
"maxVersion": "",
|
||||
"priority": 100,
|
||||
"inRepository": true,
|
||||
"translatorType": 4,
|
||||
"browserSupport": "gcs",
|
||||
"lastUpdated": "2011-08-26 00:33:07"
|
||||
}
|
||||
|
||||
/*
|
||||
JBJS Translator
|
||||
Copyright (C) 2011 Max Gordon and Avram Lyon
|
||||
|
||||
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 Affero 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
This translator is derived from the Wiley Online Library translator, which
|
||||
was first written by Sean Takats and Michael Berkowitz.
|
||||
*/
|
||||
|
||||
function detectWeb(doc, url){
|
||||
var namespace = doc.documentElement.namespaceURI;
|
||||
var nsResolver = namespace ? function(prefix) {
|
||||
if (prefix == 'x') return namespace; else return null;
|
||||
} : null;
|
||||
|
||||
if (url.match(/\/issue|\/searchresults/)) {
|
||||
return "multiple";
|
||||
} else return "journalArticle";
|
||||
}
|
||||
|
||||
function doWeb(doc, url){
|
||||
var namespace = doc.documentElement.namespaceURI;
|
||||
var nsResolver = namespace ? function(prefix) {
|
||||
if (prefix == 'x') return namespace; else return null;
|
||||
} : null;
|
||||
var host = 'http://' + doc.location.host + "/";
|
||||
|
||||
var urls = new Array();
|
||||
if(detectWeb(doc, url) == "multiple") { //search
|
||||
var title;
|
||||
var availableItems = new Array();
|
||||
var articles = doc.evaluate('//div[@class="articleContent"]//a[@class="relatedArticle"]', doc, nsResolver, XPathResult.ANY_TYPE, null);
|
||||
//Zotero.debug(articles);
|
||||
var article = false;
|
||||
while (article = articles.iterateNext()) {
|
||||
availableItems[article.href] = article.textContent;
|
||||
}
|
||||
Zotero.selectItems(availableItems, function (items) {
|
||||
if(!items) {
|
||||
return true;
|
||||
}
|
||||
for (var i in items) {
|
||||
urls.push(i);
|
||||
}
|
||||
Zotero.Utilities.processDocuments(urls, scrape, function () { Zotero.done(); });
|
||||
});
|
||||
} else { //single article
|
||||
scrape(doc, url);
|
||||
}
|
||||
Zotero.wait();
|
||||
}
|
||||
|
||||
function scrape(doc,url)
|
||||
{
|
||||
var namespace = doc.documentElement.namespaceURI;
|
||||
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;
|
||||
|
||||
newItem.url = doc.location.href;
|
||||
var metaTags = doc.getElementsByTagName("meta");
|
||||
|
||||
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);
|
||||
switch (tag) {
|
||||
// Google.
|
||||
case "citation_journal_title": if (!newItem.publicationTitle) newItem.publicationTitle = value; break;
|
||||
case "citation_journal_abbrev": if (!newItem.journalAbbreviation) newItem.journalAbbreviation = value; break;
|
||||
case "citation_author":
|
||||
newItem.creators.push(Zotero.Utilities.cleanAuthor(value, "author", true));
|
||||
case "citation_title": if (!newItem.title) newItem.title = value; break;
|
||||
case "citation_publisher": if (!newItem.publisher) newItem.publisher = value; break;
|
||||
case "citation_date": if (!newItem.date && value != "NaN" && value != "") newItem.date = value; break;
|
||||
case "citation_year": if (!newItem.date && value != "NaN" && value != "") newItem.date = value; break;
|
||||
case "citation_volume": if (!newItem.volume && value != "NaN" && value != "") newItem.volume = value; break;
|
||||
case "citation_issue": if (!newItem.issue && value != "NaN" && value != "") newItem.issue = value; break;
|
||||
case "citation_firstpage": if (!pages[0] && value != "NaN" && value != "") pages[0] = value; break;
|
||||
case "citation_lastpage": if (!pages[1] && value != "NaN" && value != "") pages[1] = value; break;
|
||||
case "citation_issn": if (!newItem.ISSN && value != "NaN" && value != "") newItem.ISSN = value; break;
|
||||
case "citation_isbn": if (!newItem.ISBN && value != "NaN" && value != "") newItem.ISBN = value; break;
|
||||
case "citation_doi": if (!newItem.DOI) newItem.DOI = value; break;
|
||||
case "citation_reference": break; // These are citations in the paper-- Z doesn't use them
|
||||
default:
|
||||
Zotero.debug("Ignoring meta tag: " + tag + " => " + value);
|
||||
}
|
||||
}
|
||||
|
||||
if (pages[0] && pages[1]) newItem.pages = pages.join('-')
|
||||
else newItem.pages = pages[0] ? pages[1] : (pages[1] ? pages[1] : "");
|
||||
|
||||
// Get the abstract
|
||||
var abstractNode = doc.evaluate('//div[h2/text()="Abstract"]/following-sibling::div[1]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
|
||||
if (abstractNode) newItem.abstractNote = abstractNode.textContent;
|
||||
|
||||
newItem.complete();
|
||||
}
|
||||
|
||||
/** BEGIN TEST CASES **/
|
||||
var testCases = [
|
||||
{
|
||||
"type": "web",
|
||||
"url": "http://www.jbjs.org/article.aspx?articleid=35426",
|
||||
"items": [
|
||||
{
|
||||
"itemType": "journalArticle",
|
||||
"creators": [
|
||||
{
|
||||
"firstName": "Delamarter",
|
||||
"lastName": "Rick",
|
||||
"creatorType": "author"
|
||||
},
|
||||
{
|
||||
"firstName": "Zigler",
|
||||
"lastName": "Jack E. ",
|
||||
"creatorType": "author"
|
||||
},
|
||||
{
|
||||
"firstName": "Balderston",
|
||||
"lastName": "Richard A. ",
|
||||
"creatorType": "author"
|
||||
},
|
||||
{
|
||||
"firstName": "Cammisa",
|
||||
"lastName": "Frank P. ",
|
||||
"creatorType": "author"
|
||||
},
|
||||
{
|
||||
"firstName": "Goldstein",
|
||||
"lastName": "Jeffrey A. ",
|
||||
"creatorType": "author"
|
||||
},
|
||||
{
|
||||
"firstName": "Spivak",
|
||||
"lastName": "Jeffrey M. ",
|
||||
"creatorType": "author"
|
||||
}
|
||||
],
|
||||
"notes": [],
|
||||
"tags": [],
|
||||
"seeAlso": [],
|
||||
"attachments": [],
|
||||
"url": "http://www.jbjs.org/article.aspx?articleid=35426",
|
||||
"publicationTitle": "The Journal of Bone and Joint Surgery (American)",
|
||||
"journalAbbreviation": "JBJS",
|
||||
"title": "Prospective, Randomized, Multicenter Food and Drug Administration Investigational Device Exemption Study of the ProDisc-L Total Disc Replacement Compared with Circumferential Arthrodesis for the Treatment of Two-Level Lumbar Degenerative Disc Disease: Results at Twenty-four Months",
|
||||
"volume": "93",
|
||||
"issue": "8",
|
||||
"date": "4/20/2011 12:00:00 AM",
|
||||
"ISSN": "0021-9355",
|
||||
"DOI": "10.2106/JBJS.I.00680",
|
||||
"publisher": "The Journal of Bone and Joint Surgery",
|
||||
"pages": "705-715",
|
||||
"abstractNote": "Background: \n Disc replacement arthroplasty previously has been shown to be an effective alternative to spine fusion for the treatment of single-level lumbar degenerative disc disease. The purpose of the present study was to determine the twenty-four-month results of a clinical trial of the ProDisc-L total disc replacement as compared with spinal fusion for the treatment of degenerative disc disease at two contiguous vertebral levels from L3 to S1.Methods: \n A total of 237 patients were treated in a randomized controlled trial designed as a non-inferiority study for regulatory application purposes. Blocked randomization was performed with use of a 2:1 ratio of total disc arthroplasty to circumferential arthrodesis. Evaluations, including patient self-assessments, physical and neurological examinations, and radiographic examinations, were performed preoperatively, six weeks postoperatively, and three, six, twelve, eighteen, and twenty-four months postoperatively.Results: \n At twenty-four months, 58.8% (eighty-seven) of 148 patients in the total disc replacement group were classified as a statistical success, compared with 47.8% (thirty-two) of sixty-seven patients in the arthrodesis group; non-inferiority was demonstrated. The mean Oswestry Disability Index in both groups significantly improved from baseline (p < 0.0001); the mean percentage improvement for the total disc replacement group was significantly better than that for the arthrodesis group (p = 0.0282). An established clinical criterion for success, a =15-point improvement in the Oswestry Disability Index from baseline, occurred in 73.2% (109) of 149 patients in the total disc replacement group and 59.7% (thirty-seven) of sixty-two patients in the arthrodesis group. The Short Form-36 physical component scores were significantly better for the total disc replacement group as compared with the arthrodesis group (p = 0.0141 at twenty-four months). Visual analog scale scores for satisfaction significantly favored total disc replacement from three to twenty-four months. At twenty-four months, 78.2% (111) of 142 patients in the total disc replacement group and 62.1% (thirty-six) of fifty-eight patients in the arthrodesis group responded “yes” when asked if they would have the same surgery again. Lumbar spine range of motion on radiographs averaged 7.8° at the superior disc and 6.2° at the inferior disc in patients with total disc replacement. Reduction in narcotics usage significantly favored the total disc replacement group at twenty-four months after surgery (p = 0.0020).Conclusions: \n Despite the relatively short duration of follow-up and design limitations, the present study suggests that two-level lumbar disc arthroplasty is an alternative to and offers clinical advantages in terms of pain relief and functional recovery in comparison with arthrodesis. Longer-term follow-up is needed to determine the risks for implant wear and/or degenerative segment changes.Level of Evidence: \n Therapeutic Level I. See Instructions to Authors for a complete description of levels of evidence.",
|
||||
"libraryCatalog": "JBJS Am",
|
||||
"shortTitle": "Prospective, Randomized, Multicenter Food and Drug Administration Investigational Device Exemption Study of the ProDisc-L Total Disc Replacement Compared with Circumferential Arthrodesis for the Treatment of Two-Level Lumbar Degenerative Disc Disease"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
/** END TEST CASES **/
|
|
@ -9,7 +9,7 @@
|
|||
"inRepository": true,
|
||||
"translatorType": 1,
|
||||
"browserSupport": "gcsn",
|
||||
"lastUpdated": "2011-07-21 17:16:37"
|
||||
"lastUpdated": "2011-08-22 23:29:49"
|
||||
}
|
||||
|
||||
function detectImport() {
|
||||
|
@ -563,10 +563,12 @@ function doImport() {
|
|||
}
|
||||
}
|
||||
|
||||
exports.record = record;
|
||||
exports.fieldTerminator = fieldTerminator;
|
||||
exports.recordTerminator = recordTerminator;
|
||||
exports.subfieldDelimiter = subfieldDelimiter;
|
||||
var exports = {
|
||||
"record":record,
|
||||
"fieldTerminator":fieldTerminator,
|
||||
"recordTerminator":recordTerminator,
|
||||
"subfieldDelimiter":subfieldDelimiter
|
||||
};
|
||||
|
||||
/** BEGIN TEST CASES **/
|
||||
var testCases = [
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
"minVersion": "1.0.0b4.r5",
|
||||
"maxVersion": "",
|
||||
"priority": 100,
|
||||
"browserSupport": "gcs",
|
||||
"inRepository": true,
|
||||
"translatorType": 4,
|
||||
"browserSupport": "g",
|
||||
"lastUpdated": "2011-07-13 12:10:55"
|
||||
"lastUpdated": "2011-08-22 22:31:06"
|
||||
}
|
||||
|
||||
function detectWeb(doc, url) {
|
||||
|
|
|
@ -7,8 +7,9 @@
|
|||
"minVersion":"1.0.0b4.r5",
|
||||
"maxVersion":"",
|
||||
"priority":100,
|
||||
"browserSupport":"g",
|
||||
"inRepository":true,
|
||||
"lastUpdated":"2008-08-21 15:45:00"
|
||||
"lastUpdated":"2011-08-22 22:44:24"
|
||||
}
|
||||
|
||||
function detectWeb(doc, url) {
|
||||
|
|
|
@ -0,0 +1,166 @@
|
|||
{
|
||||
"translatorID": "fcfcfe9c-f6dd-48c6-aef9-61adbba31a4e",
|
||||
"label": "National Library of Australia - Australian Newspapers",
|
||||
"creator": "Tim Sherratt",
|
||||
"target": "^https?://trove\\.nla\\.gov\\.au/(?:newspaper|ndp)/",
|
||||
"minVersion": "2.0",
|
||||
"maxVersion": "",
|
||||
"priority": 100,
|
||||
"inRepository": true,
|
||||
"translatorType": 4,
|
||||
"browserSupport": "g",
|
||||
"lastUpdated": "2011-08-24 15:59:48"
|
||||
}
|
||||
|
||||
/*
|
||||
National Library of Australia - Australian Newspapers Translator
|
||||
Copyright (C) 2011 Tim Sherratt (tim@discontents.com.au, @wragge)
|
||||
|
||||
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 Affero 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.match(/\/newspaper\/result/i) || url.match(/\/ndp\/del\/page/)) {
|
||||
return "multiple";
|
||||
} else if (url.match(/\/ndp\/del\/article\//i)) {
|
||||
return "newspaperArticle";
|
||||
}
|
||||
}
|
||||
|
||||
function doWeb(doc, url) {
|
||||
var namespace = doc.documentElement.namespaceURI;
|
||||
var nsResolver = namespace ? function(prefix) {
|
||||
if (prefix == 'x') return namespace; else return null;
|
||||
} : null;
|
||||
var articles = new Array();
|
||||
var items = new Object();
|
||||
var nextTitle;
|
||||
if (detectWeb(doc, url) == "multiple") {
|
||||
// Search results
|
||||
if (url.match(/\/newspaper\/result/i)) {
|
||||
var titles = doc.evaluate('//div[@id="tnewspapers"]/ol/li[@class="article "]/dl/dt/a', doc, nsResolver, XPathResult.ANY_TYPE, null);
|
||||
// All the articles on a page
|
||||
} else if (url.match(/\/ndp\/del\/page/)) {
|
||||
var titles = doc.evaluate('//ul[@class="articles"]/li/h4/a', doc, nsResolver, XPathResult.ANY_TYPE, null);
|
||||
}
|
||||
while (nextTitle = titles.iterateNext()) {
|
||||
if (nextTitle.textContent != '[coming soon]') {
|
||||
items[nextTitle.href] = nextTitle.textContent; }
|
||||
}
|
||||
items = Zotero.selectItems(items);
|
||||
for (var i in items) {
|
||||
articles.push(i);
|
||||
}
|
||||
} else {
|
||||
articles = [url];
|
||||
}
|
||||
Zotero.Utilities.processDocuments(articles, scrape, function(){Zotero.done();});
|
||||
Zotero.wait();
|
||||
}
|
||||
|
||||
function scrape(doc) {
|
||||
var namespace = doc.documentElement.namespaceURI;
|
||||
var nsResolver = namespace ? function(prefix) {
|
||||
if (prefix == 'x') return namespace; else return null;
|
||||
} : null;
|
||||
var nextTag, nextImg, nextLine;
|
||||
var newItem = new Zotero.Item("newspaperArticle");
|
||||
newItem.libraryCatalog = 'National Library of Australia - Trove - Australian Newspapers';
|
||||
// Get the persistent identifier.
|
||||
articleId = doc.location.href.match(/http:\/\/[a-z]+\.nla\.gov\.au\/ndp\/del\/article\/(\d+)/)[1];
|
||||
newItem.url = 'http://nla.gov.au/nla.news-article' + articleId
|
||||
// Gather all the basic details
|
||||
newItem.title = Zotero.Utilities.trimInternal(doc.evaluate('//meta[@name="newsarticle_headline"]/@content', doc, nsResolver, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.textContent);
|
||||
var pubDetails = doc.evaluate('//div[@class="box title"]/strong', doc, nsResolver, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.textContent;
|
||||
newItem.publicationTitle = pubDetails.match(/(.+?) \(/)[1];
|
||||
if (pubDetails.indexOf(':') != -1) {
|
||||
newItem.place = pubDetails.match(/\((.+?) :/)[1];
|
||||
}
|
||||
newItem.date = doc.evaluate('//div[@class="box issue"]/strong', doc, nsResolver, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.textContent.match(/\w+ (\d{1,2} .+)/)[1];
|
||||
newItem.pages = Zotero.Utilities.trim(doc.evaluate('//select[@name="id"]/option[@selected="selected"]', doc, nsResolver, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.textContent);
|
||||
// Get tags.
|
||||
var tags = doc.evaluate('//p[@class="tags"]/a', doc, nsResolver, XPathResult.ANY_TYPE, null);
|
||||
while (nextTag = tags.iterateNext()) {
|
||||
newItem.tags.push(nextTag.textContent);
|
||||
}
|
||||
// Get OCRed text
|
||||
var OCRLines = doc.evaluate('//p[@class="S8"]/span', doc, nsResolver, XPathResult.ANY_TYPE, null);
|
||||
var OCRText = '';
|
||||
while (nextLine = OCRLines.iterateNext()) {
|
||||
OCRText = OCRText + nextLine.textContent + '\n';
|
||||
}
|
||||
if (OCRText != '') {
|
||||
newItem.abstractNote = OCRText;
|
||||
}
|
||||
/* Uncomment this section if you want to save jpgs of the article (the pdfs are generally easier to work with).
|
||||
// Change the number at the end of the string to alter zoom factor - '/3?print=n'
|
||||
var imgDoc = Zotero.Utilities.retrieveDocument('http://trove.nla.gov.au/ndp/del/printArticleJpg/' + newItem.url.match(/.*?(\d+)/)[1] + '/3?print=n');
|
||||
var imgs = imgDoc.evaluate('//img[@id="articleImg"]', imgDoc, nsResolver, XPathResult.ANY_TYPE, null);
|
||||
// With high zoom values or long articles there might be multiple images, so loop through and save them all.
|
||||
var imgNum = 1;
|
||||
while (nextImg = imgs.iterateNext()) {
|
||||
newItem.attachments.push({url:nextImg.src, title: newItem.publicationTitle + ', ' + newItem.date + ', p. ' + newItem.pages + ' - ' + imgNum, mimeType:'image/jpeg'});
|
||||
imgNum++;
|
||||
}
|
||||
*/
|
||||
// Save PDF version as attachment
|
||||
newItem.attachments.push({url: 'http://trove.nla.gov.au/ndp/del/printArticlePdf/' + articleId + '/3?print=n', title: newItem.publicationTitle + ', ' + newItem.date + ', p. ' + newItem.pages, mimeType:'application/pdf'});
|
||||
newItem.complete();
|
||||
}
|
||||
|
||||
// Search result test fails when run automatically:
|
||||
// http://trove.nla.gov.au/newspaper/result?q=clement+wragge
|
||||
|
||||
/** BEGIN TEST CASES **/
|
||||
var testCases = [
|
||||
{
|
||||
"type": "web",
|
||||
"url": "http://trove.nla.gov.au/ndp/del/article/972415",
|
||||
"items": [
|
||||
{
|
||||
"itemType": "newspaperArticle",
|
||||
"creators": [],
|
||||
"notes": [],
|
||||
"tags": [],
|
||||
"seeAlso": [],
|
||||
"attachments": [
|
||||
{
|
||||
"url": false,
|
||||
"title": "The Argus, 8 August 1945, p. 1",
|
||||
"mimeType": "application/pdf"
|
||||
}
|
||||
],
|
||||
"libraryCatalog": "National Library of Australia - Trove - Australian Newspapers",
|
||||
"url": "http://nla.gov.au/nla.news-article972415",
|
||||
"title": "ATOMIC BOMB WARNING TO JAPS PEOPLE TOLD OF HORRORS OF NEW WEAPON Intensive Broadcast Campaign FROM OUR OWN CORRESPONDENT IN NEW YORK AND AAP NOW THAT AN ATOMIC BOMB HAS BEEN DROPPED ON JAPAN ALL POSSIBLE MEANS ARE BEING USED TO TELL THE JAPANESE OF THE HORRORS OF THE BOMB AND AT THE SAME TIME TO DRIVE HOME TO THEM THE POTSDAM SURRENDER TERMS. Four powerful Office of War Information stations are broadcasting news to Japan, while leaflets being produced at Saipan and Manila will be dropped over Japanese communities and troop concentrations. The two regular newspapers which are carried to Japan weekly by Super-Fortresses—\"Jiho,\" published on Saipan, and \"Rakkason,\" published in Manila—will lead with the atomic bomb story.",
|
||||
"publicationTitle": "The Argus",
|
||||
"place": "Melbourne, Vic.",
|
||||
"date": "8 August 1945",
|
||||
"pages": "1",
|
||||
"abstractNote": "ATOMIC BOMB WARNING TO JAPS\n PEOPLE TOLD OF\n HORRORS\n OF NEW WEAPON\n Intensive Broadcast Campaign\n FROM OUR OWN CORRESPONDENT IN NEW YORK AND AAP\n NOW THAT AN ATOMIC BOMB HAS BEEN DROPPED ON JAPAN\n ALL POSSIBLE MEANS ARE BEING USED TO TELL THE\n JAPANESE OF THE HORRORS OF THE BOMB AND AT THE\n SAME TIME TO DRIVE HOME TO THEM THE POTSDAM\n SURRENDER TERMS.\n Four powerful Office of War Information stations are broadcasting\n news to Japan, while leaflets being produced at Saipan and Manila will\n be dropped over Japanese communities and troop concentrations.\n The two regular newspapers which are carried to Japan weekly by\n Super-Fortresses - \"Jiho,\" published on Saipan, and \"Rakkason,\"\n published in Manila-will lead with the atomic bomb story.\n The Office of War Information\n revealed yesterday that \n transmissions to Japan began\n immediately after President\n Truman's statement that the\n atomic bomb was already in use\n was issued.\n New York Times Washington\n correspondent says that while\n Mr Stimson, US War Secretary,\n said the atomic bomb should\n prove a tremendous aid in\n shortening the war against\n Japan, other responsible officials\n thought that that was an \n extreme understatement, and\n that Japan might be unable to\n remain in the war under the\n coming rain of atomic bombs.\n Obviously the news was \n released now, the correspondent\n adds, because of the possible\n psychological effect in forcing\n the Japanese to surrender.\n DETAILS AWAITED\n Meanwhile London is eagerly\n awaiting an official statement\n on the scientific details of the\n atomic bomb, which Sir John\n Anderson, who supervised \n research work in Britain, said\n would be issued in a few days.\n Press Association says it is\n clear from the announcements\n already made that the industrial\n application of this new \n source of energy will require\n many years of research and \n development before it is ready\n for exploitation.\n Reuter's military correspondent\n says: \"It seems that the \n secrets of the atomic bomb will\n not be shared by any power\n other than those directly \n concerned with its production.\n \"As soon as the Big Three's\n experts had an opportunity to\n study all the strategic implications,\n it is likely that consultations \n will begin to consider \n methods for the agreed control\n of the super-bomb's manufacture\n and use. \n \"Its offensive uses at the\n moment are in the limelight,\n but its use in defence may\n equally outmode the present\n forms of aerial warfare.\n \"So far experts have been \n unable to do anything more than\n grasp the sheer magnitude of\n the revolution facing them, but\n the Big Three Governments are\n expected to act speedily to\n regulate this unforeseen \n situation.\"\n DECISION OUTDATED\n The correspondent adds: \"The\n strategic decisions taken at\n Teheran, Yalta, and Potsdam,\n according to military experts,\n have already been outdated by\n the advent of the bomb.\n \"Security can no longer be \n defined for instance by control of\n the Dardanelles and the Suez\n Canal, and by possession of this\n or that port, river, or \n mountain."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "web",
|
||||
"url": "http://trove.nla.gov.au/newspaper/result?q=clement+wragge",
|
||||
"items": "multiple"
|
||||
},
|
||||
{
|
||||
"type": "web",
|
||||
"url": "http://trove.nla.gov.au/ndp/del/page/32665",
|
||||
"items": "multiple"
|
||||
}
|
||||
]
|
||||
/** END TEST CASES **/
|
|
@ -6,10 +6,11 @@
|
|||
"minVersion": "2.1",
|
||||
"maxVersion": "",
|
||||
"priority": 100,
|
||||
"browserSupport": "gcs",
|
||||
"inRepository": true,
|
||||
"translatorType": 4,
|
||||
"browserSupport": "gcs",
|
||||
"lastUpdated": "2011-07-03 14:59:21"
|
||||
"lastUpdated": "2011-08-22 22:31:21"
|
||||
}
|
||||
|
||||
function detectWeb(doc, url) {
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
"minVersion": "2.1",
|
||||
"maxVersion": "",
|
||||
"priority": 100,
|
||||
"browserSupport": "gcs",
|
||||
"inRepository": true,
|
||||
"translatorType": 4,
|
||||
"lastUpdated": "2011-08-03 11:08:32"
|
||||
"lastUpdated": "2011-08-22 22:32:08"
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -7,8 +7,9 @@
|
|||
"minVersion":"2.1",
|
||||
"maxVersion":"",
|
||||
"priority":100,
|
||||
"browserSupport":"gcs",
|
||||
"inRepository":true,
|
||||
"lastUpdated":"2011-04-11 00:15:00"
|
||||
"lastUpdated":"2011-08-22 22:31:32"
|
||||
}
|
||||
|
||||
function detectWeb(doc, url) {
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
{
|
||||
"translatorID": "c54d1932-73ce-dfd4-a943-109380e06574",
|
||||
"label": "Project MUSE",
|
||||
"creator": "Simon Kornblith, Avram Lyon",
|
||||
"target": "^https?://[^/]*muse\\.jhu\\.edu[^/]*/(?:journals/[^/]+/[^/]+/[^/]+\\.html|search/results)",
|
||||
"minVersion": "1.0.0b4.r1",
|
||||
"creator": "Simon Kornblith, Avram Lyon, Sean Takats",
|
||||
"target": "^https?://[^/]*muse\\.jhu\\.edu[^/]*/(login\\?uri=/)?(?:journals/[^/]+/(summary/)?[^/]+/[^/]+\\.html|search/results)",
|
||||
"minVersion": "2.1.9",
|
||||
"maxVersion": "",
|
||||
"priority": 100,
|
||||
"inRepository": "1",
|
||||
"inRepository": true,
|
||||
"translatorType": 4,
|
||||
"lastUpdated": "2011-03-02 23:38:17"
|
||||
"browserSupport": "gcs",
|
||||
"lastUpdated": "2011-08-25 10:00:51"
|
||||
}
|
||||
|
||||
function detectWeb(doc, url) {
|
||||
|
@ -21,70 +22,60 @@ function detectWeb(doc, url) {
|
|||
}
|
||||
|
||||
function doWeb(doc, url) {
|
||||
var namespace = doc.documentElement.namespaceURI;
|
||||
var nsResolver = namespace ? function(prefix) {
|
||||
if (prefix == 'x') return namespace; else return null;
|
||||
} : null;
|
||||
|
||||
|
||||
var searchRe = new RegExp("^https?://[^/]+/search/results|/search/save");
|
||||
if(detectWeb(doc, url) == "multiple") {
|
||||
var items = new Array();
|
||||
var items = {};
|
||||
var attachments = new Array();
|
||||
var pdfRe = /PDF/;
|
||||
var htmlRe = /HTML/;
|
||||
if (searchRe.test(url)) {
|
||||
// Search results
|
||||
var tableRows = doc.evaluate('//save_form//tr[@class="resultsrow"]',
|
||||
doc, nsResolver, XPathResult.ANY_TYPE, null);
|
||||
doc, null, XPathResult.ANY_TYPE, null);
|
||||
var tableRow;
|
||||
// Go through table rows
|
||||
while(tableRow = tableRows.iterateNext()) {
|
||||
var input = doc.evaluate('.//div[@class="links"]//a[last()]', tableRow, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
|
||||
var title = doc.evaluate('.//div[@class="title"]', tableRow, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
|
||||
var input = doc.evaluate('.//div[@class="links"]//a[last()]', tableRow, null, XPathResult.ANY_TYPE, null).iterateNext();
|
||||
var title = doc.evaluate('.//div[@class="title"]', tableRow, null, XPathResult.ANY_TYPE, null).iterateNext();
|
||||
if(input && input.href && title && title.textContent) {
|
||||
items[input.href] = title.textContent;
|
||||
}
|
||||
}
|
||||
} else if (url.match(/\/toc\//)) {
|
||||
//Zotero.debug("here");
|
||||
var results = doc.evaluate('//div[@class="article"]',
|
||||
doc, nsResolver, XPathResult.ANY_TYPE, null);
|
||||
doc, null, XPathResult.ANY_TYPE, null);
|
||||
var result;
|
||||
while(result = results.iterateNext()) {
|
||||
//Zotero.debug(result.textContent);
|
||||
var link = doc.evaluate('.//div[@class="links"]/p//a[last()]', result, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
|
||||
var title = doc.evaluate('.//div[@class="title"]', result, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
|
||||
//Zotero.debug(link.textContent);
|
||||
var link = doc.evaluate('.//div[@class="links"]/p//a[last()]', result, null, XPathResult.ANY_TYPE, null).iterateNext();
|
||||
var title = doc.evaluate('.//div[@class="title"]', result, null, XPathResult.ANY_TYPE, null).iterateNext();
|
||||
if(link && link.href && title && title.textContent) {
|
||||
items[link.href] = title.textContent;
|
||||
//Zotero.debug(link.href);
|
||||
}
|
||||
}
|
||||
// Some journals have old-style TOCs for back issues
|
||||
// Ex. http://muse.jhu.edu/journals/eighteenth-century_studies/toc/ecs33.4.html
|
||||
if (items.length == 0) {
|
||||
var articles = doc.evaluate('//ul', doc, nsResolver, XPathResult.ANY_TYPE, null);
|
||||
var articles = doc.evaluate('//ul', doc, null, XPathResult.ANY_TYPE, null);
|
||||
var article;
|
||||
while (article = articles.iterateNext()) {
|
||||
var link = doc.evaluate('./li/a[contains(@href,".html")]', article, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
|
||||
var title = doc.evaluate('./li/i', article, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
|
||||
//Zotero.debug(link.textContent);
|
||||
var link = doc.evaluate('./li/a[contains(@href,".html")]', article, null, XPathResult.ANY_TYPE, null).iterateNext();
|
||||
var title = doc.evaluate('./li/i', article, null, XPathResult.ANY_TYPE, null).iterateNext();
|
||||
if(link && link.href && title && title.textContent) {
|
||||
items[link.href] = title.textContent;
|
||||
//Zotero.debug(link.href);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
items = Zotero.selectItems(items);
|
||||
if(!items) {
|
||||
return true;
|
||||
}
|
||||
var i;
|
||||
var urls = [];
|
||||
for (i in items) {urls.push(i);};
|
||||
|
||||
Zotero.Utilities.processDocuments(urls, scrapeOne, function() {Zotero.done();});
|
||||
Zotero.selectItems(items, function(items) {
|
||||
if(!items) {
|
||||
return true;
|
||||
}
|
||||
var i;
|
||||
var urls = [];
|
||||
for (i in items) {urls.push(i);};
|
||||
Zotero.Utilities.processDocuments(urls, scrapeOne, function() {Zotero.done();}, null);
|
||||
});
|
||||
} else scrapeOne(doc);
|
||||
Zotero.wait();
|
||||
}
|
||||
|
@ -92,32 +83,25 @@ function doWeb(doc, url) {
|
|||
// Given an article page, get the RIS and open it
|
||||
function scrapeOne(doc) {
|
||||
var url = doc.location.href;
|
||||
//Zotero.debug("scrapeOne has "+doc.location.href)
|
||||
var namespace = doc.documentElement.namespaceURI;
|
||||
var nsResolver = namespace ? function(prefix) {
|
||||
if (prefix == 'x') return namespace; else return null;
|
||||
} : null;
|
||||
|
||||
var hostRe = new RegExp("^(http://[^/]+)/");
|
||||
var m = hostRe.exec(url);
|
||||
var host = m[1];
|
||||
|
||||
var getPDF = doc.evaluate('//a[text() = "PDF Version"]', doc,
|
||||
nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
|
||||
var getPDF = doc.evaluate('//a[text() = "PDF Version" or text() = "[Access article in PDF]"]', doc,
|
||||
null, XPathResult.ANY_TYPE, null).iterateNext();
|
||||
var DOI = doc.evaluate('//div[@class="doi"]', doc,
|
||||
nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
|
||||
null, XPathResult.ANY_TYPE, null).iterateNext();
|
||||
var abstract = doc.evaluate('//abstract', doc,
|
||||
nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
|
||||
null, XPathResult.ANY_TYPE, null).iterateNext();
|
||||
|
||||
|
||||
var newUrl = url.replace(host, host+"/metadata/zotero").replace("/summary/","/");;
|
||||
//Zotero.debug(newUrl);
|
||||
var newUrl = url.replace(host, host+"/metadata/zotero").replace("/summary/","/").replace("/login?uri=","");
|
||||
Zotero.Utilities.HTTP.doGet(newUrl, function(text) {
|
||||
var translator = Zotero.loadTranslator("import");
|
||||
//set RIS translator
|
||||
translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7");
|
||||
translator.setString(text);
|
||||
Zotero.debug(text);
|
||||
translator.setHandler("itemDone", function(obj, item) {
|
||||
if(item.notes && item.notes[0]) {
|
||||
item.extra = item.notes[0].note;
|
||||
|
@ -141,3 +125,52 @@ function scrapeOne(doc) {
|
|||
translator.translate();
|
||||
});
|
||||
}
|
||||
/** BEGIN TEST CASES **/
|
||||
var testCases = [
|
||||
{
|
||||
"type": "web",
|
||||
"url": "http://muse.jhu.edu/journals/past_and_present/summary/v191/191.1higonnet.html",
|
||||
"items": [
|
||||
{
|
||||
"itemType": "journalArticle",
|
||||
"creators": [
|
||||
{
|
||||
"lastName": "Higonnet",
|
||||
"firstName": "Patrice L. R.",
|
||||
"creatorType": "author"
|
||||
}
|
||||
],
|
||||
"tags": [],
|
||||
"seeAlso": [],
|
||||
"attachments": [
|
||||
{
|
||||
"document": false,
|
||||
"title": "Project MUSE Snapshot"
|
||||
},
|
||||
{
|
||||
"title": "Project MUSE Full Text PDF",
|
||||
"mimeType": "application/pdf",
|
||||
"url": false
|
||||
}
|
||||
],
|
||||
"title": "Terror, Trauma and the 'Young Marx' Explanation of Jacobin Politics",
|
||||
"publicationTitle": "Past & Present",
|
||||
"volume": "191",
|
||||
"pages": "121-164",
|
||||
"date": "2006",
|
||||
"publisher": "Oxford University Press",
|
||||
"ISBN": "1477-464X",
|
||||
"ISSN": "1477-464X",
|
||||
"url": "http://muse.jhu.edu/journals/past_and_present/v191/191.1higonnet.html",
|
||||
"extra": "<p>Number 191, May 2006</p>",
|
||||
"libraryCatalog": "Project MUSE"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "web",
|
||||
"url": "http://muse.jhu.edu/journals/journal_of_social_history/toc/jsh.44.4.html",
|
||||
"items": "multiple"
|
||||
}
|
||||
]
|
||||
/** END TEST CASES **/
|
|
@ -10,12 +10,11 @@
|
|||
"browserSupport":"gcsn",
|
||||
"configOptions":{"dataMode":"rdf/xml"},
|
||||
"inRepository":true,
|
||||
"lastUpdated":"2011-07-08 04:51:41"
|
||||
"lastUpdated":"2011-08-22 23:56:28"
|
||||
}
|
||||
|
||||
function detectImport() {
|
||||
// unfortunately, Mozilla will let you create a data source from any type
|
||||
// of XML, so we need to make sure there are actually nodes
|
||||
// Make sure there are actually nodes
|
||||
|
||||
var nodes = Zotero.RDF.getAllResources();
|
||||
if(nodes) {
|
||||
|
@ -637,5 +636,7 @@ function doImport() {
|
|||
/**
|
||||
* Export doImport and defaultUnknownType to other translators
|
||||
*/
|
||||
exports.doImport = doImport;
|
||||
exports.defaultUnknownType = "book";
|
||||
var exports = {
|
||||
"doImport":doImport,
|
||||
"defaultUnknownType":"book"
|
||||
};
|
|
@ -1,14 +1,15 @@
|
|||
{
|
||||
"translatorID":"b1c90b99-2e1a-4374-a03b-92e45f1afc55",
|
||||
"translatorType":4,
|
||||
"label":"Radio Free Europe / Radio Liberty",
|
||||
"creator":"Avram Lyon",
|
||||
"target":"^http://www\\.rferl\\.org/|^http://www\\.azatliq\\.org/|^http://www\\.azattyq\\.org/|^http://rus\\.azattyq\\.org/|^http://da\\.azadiradio\\.org/|^http://pa\\.azadiradio\\.org/|^http://www\\.azattyk\\.org/|^http://www\\.ozodi\\.org/|^http://www\\.ozodlik\\.org/|^http://www\\.evropaelire\\.org/|^http://www\\.slobodnaevropa\\.org/|^http://www\\.makdenes\\.org/|^http://www\\.iraqhurr\\.org/|^http://www\\.radiofarda\\.com/|^http://www\\.azatutyun\\.am/|^http://www\\.azadliq\\.org/|^http://www\\.svaboda\\.org/|^http://www\\.tavisupleba\\.org/|^http://www\\.azathabar\\.com/|^http://www\\.svobodanews\\.ru/|^http://www\\.europalibera\\.org/|^http://www\\.radiosvoboda\\.org/",
|
||||
"minVersion":"1.0.0b4.r5",
|
||||
"maxVersion":"",
|
||||
"priority":100,
|
||||
"inRepository":true,
|
||||
"lastUpdated":"2011-05-24 00:45:00"
|
||||
"translatorID": "b1c90b99-2e1a-4374-a03b-92e45f1afc55",
|
||||
"label": "Radio Free Europe / Radio Liberty",
|
||||
"creator": "Avram Lyon",
|
||||
"target": "^http://www\\.rferl\\.org/|^http://www\\.azatliq\\.org/|^http://www\\.azattyq\\.org/|^http://rus\\.azattyq\\.org/|^http://da\\.azadiradio\\.org/|^http://pa\\.azadiradio\\.org/|^http://www\\.azattyk\\.org/|^http://www\\.ozodi\\.org/|^http://www\\.ozodlik\\.org/|^http://www\\.evropaelire\\.org/|^http://www\\.slobodnaevropa\\.org/|^http://www\\.makdenes\\.org/|^http://www\\.iraqhurr\\.org/|^http://www\\.radiofarda\\.com/|^http://www\\.azatutyun\\.am/|^http://www\\.azadliq\\.org/|^http://www\\.svaboda\\.org/|^http://www\\.tavisupleba\\.org/|^http://www\\.azathabar\\.com/|^http://www\\.svobodanews\\.ru/|^http://www\\.europalibera\\.org/|^http://www\\.radiosvoboda\\.org/",
|
||||
"minVersion": "2.1.9",
|
||||
"maxVersion": "",
|
||||
"priority": 100,
|
||||
"inRepository": true,
|
||||
"translatorType": 4,
|
||||
"browserSupport": "gcs",
|
||||
"lastUpdated": "2011-08-18 15:31:42"
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -119,9 +120,9 @@ function doWeb(doc, url){
|
|||
if ((author = author.iterateNext()) !== null) {
|
||||
author = author.textContent;
|
||||
// Sometimes we have "By Author"
|
||||
if(author.substr(0, 3).toLowerCase() == "by ") {
|
||||
author = author.substr(3);
|
||||
}
|
||||
if(author.substr(0, 3).toLowerCase() == "by ") {
|
||||
author = author.substr(3);
|
||||
}
|
||||
var cleaned = Zotero.Utilities.cleanAuthor(author, "author");
|
||||
// If we have only one name, set the author to one-name mode
|
||||
if (cleaned.firstName == "") {
|
||||
|
@ -221,4 +222,47 @@ function addAudio(text) {
|
|||
var audio = text.match(/http:\/\/realaudio\.rferl\.org[^"]*\.mp3/);
|
||||
if (audio) item.attachments.push({url:audio[0], mimeType:"application/octet-stream", title:"RFE/RL Audio"})
|
||||
item.complete();
|
||||
}
|
||||
}
|
||||
|
||||
/** BEGIN TEST CASES **/
|
||||
var testCases = [
|
||||
{
|
||||
"type": "web",
|
||||
"url": "http://www.azatliq.org/content/article/24281041.html",
|
||||
"items": [
|
||||
{
|
||||
"itemType": "newspaperArticle",
|
||||
"creators": [
|
||||
{
|
||||
"firstName": "Гүзәл",
|
||||
"lastName": "Мәхмүтова",
|
||||
"creatorType": "author"
|
||||
}
|
||||
],
|
||||
"notes": [],
|
||||
"tags": [],
|
||||
"seeAlso": [],
|
||||
"attachments": [
|
||||
{
|
||||
"url": false,
|
||||
"title": " Азатлык Радиосы Snapshot",
|
||||
"mimeType": "text/html"
|
||||
},
|
||||
{
|
||||
"url": false,
|
||||
"mimeType": "application/octet-stream",
|
||||
"title": "RFE/RL Audio"
|
||||
}
|
||||
],
|
||||
"title": "Татар яшьләре татарлыкны сакларга тырыша",
|
||||
"section": "татарстан",
|
||||
"date": "29.07.2011",
|
||||
"url": "http://www.azatliq.org/content/article/24281041.html",
|
||||
"publicationTitle": "Азатлык Радиосы",
|
||||
"language": "Tatar/Bashkir",
|
||||
"libraryCatalog": "Radio Free Europe / Radio Liberty"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
/** END TEST CASES **/
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
"minVersion": "1.0.0b4.r5",
|
||||
"maxVersion": "",
|
||||
"priority": 100,
|
||||
"browserSupport": "gcs",
|
||||
"inRepository": true,
|
||||
"translatorType": 4,
|
||||
"lastUpdated": "2011-08-16 03:36:22"
|
||||
"lastUpdated": "2011-08-22 22:32:21"
|
||||
}
|
||||
|
||||
function detectWeb(doc, url) {
|
||||
|
|
|
@ -6,12 +6,30 @@
|
|||
"minVersion": "1.0.0b4.r5",
|
||||
"maxVersion": "",
|
||||
"priority": 100,
|
||||
"browserSupport": "gcs",
|
||||
"inRepository": true,
|
||||
"translatorType": 4,
|
||||
"browserSupport": "g",
|
||||
"lastUpdated": "2011-08-18 01:25:48"
|
||||
"lastUpdated": "2011-08-22 22:33:07"
|
||||
}
|
||||
|
||||
/*
|
||||
Wiley Online Translator
|
||||
Copyright (C) 2011 CHNM and Avram Lyon
|
||||
|
||||
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 Affero 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){
|
||||
var namespace = doc.documentElement.namespaceURI;
|
||||
var nsResolver = namespace ? function(prefix) {
|
||||
|
|
89
translators/cablegatesearch.net.js
Normal file
89
translators/cablegatesearch.net.js
Normal file
File diff suppressed because one or more lines are too long
|
@ -6,9 +6,10 @@
|
|||
"minVersion": "2.1",
|
||||
"maxVersion": "",
|
||||
"priority": 100,
|
||||
"browserSupport": "gcs",
|
||||
"inRepository": true,
|
||||
"translatorType": 4,
|
||||
"lastUpdated": "2011-08-03 10:41:53"
|
||||
"lastUpdated": "2011-08-22 22:43:15"
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
{
|
||||
"translatorID":"e7e01cac-1e37-4da6-b078-a0e8343b0e98",
|
||||
"translatorType":4,
|
||||
"label":"unAPI",
|
||||
"creator":"Simon Kornblith",
|
||||
"target":null,
|
||||
"minVersion":"2.1",
|
||||
"maxVersion":"",
|
||||
"priority":200,
|
||||
"inRepository":true,
|
||||
"detectXPath":"//link[@rel='unapi-server']",
|
||||
"lastUpdated":"2011-06-09 01:57:14"
|
||||
"translatorID": "e7e01cac-1e37-4da6-b078-a0e8343b0e98",
|
||||
"label": "unAPI",
|
||||
"creator": "Simon Kornblith",
|
||||
"target": "",
|
||||
"minVersion": "2.1",
|
||||
"maxVersion": "",
|
||||
"priority": 200,
|
||||
"inRepository": true,
|
||||
"translatorType": 4,
|
||||
"browserSupport": "gcs",
|
||||
"lastUpdated": "2011-08-26 18:39:33"
|
||||
}
|
||||
|
||||
var RECOGNIZABLE_FORMATS = ["rdf_zotero", "rdf_bibliontology", "mods", "marc", "unimarc", "ris",
|
||||
|
@ -168,13 +168,13 @@ UnAPIID.prototype = {
|
|||
*/
|
||||
"isSupported":function(callback) {
|
||||
if(this.hasOwnProperty("format")) {
|
||||
callback(me.format.isSupported);
|
||||
callback(this.format.isSupported);
|
||||
return;
|
||||
}
|
||||
|
||||
var me = this;
|
||||
|
||||
getDefaultFormat(function() {
|
||||
getDefaultFormat(function(defaultFormat) {
|
||||
// first try default format, since this won't require >1 HTTP request
|
||||
if(defaultFormat.isSupported) {
|
||||
me.format = defaultFormat;
|
||||
|
@ -260,7 +260,11 @@ function determineDetectItemType(ids, supportedId) {
|
|||
determineDetectItemType(ids, (isSupported ? id : supportedId));
|
||||
} else {
|
||||
// If all IDs have been handled, get foundItemType for only supported ID
|
||||
supportedId.getItemType(Zotero.done);
|
||||
if(isSupported) {
|
||||
id.getItemType(Zotero.done);
|
||||
} else {
|
||||
Zotero.done(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -337,3 +341,53 @@ function doWeb(doc, url) {
|
|||
return;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/** BEGIN TEST CASES **/
|
||||
var testCases = [
|
||||
{
|
||||
"type": "web",
|
||||
"url": "http://search8.library.utoronto.ca/UTL/index?N=0&Ntk=Anywhere&Ntt=nimni+challenge+of+post-zionism&Ntx=mode%2Bmatchallpartial&Nu=p_work_normalized&Np=1&formName=search_form_simple",
|
||||
"items": [
|
||||
{
|
||||
"itemType": "book",
|
||||
"creators": [
|
||||
{
|
||||
"lastName": "Nimni",
|
||||
"firstName": "Ephraim.",
|
||||
"creatorType": "contributor"
|
||||
}
|
||||
],
|
||||
"notes": [],
|
||||
"tags": [
|
||||
"Post-Zionism.",
|
||||
"Zionism -- Philosophy.",
|
||||
"National characteristics, Israeli.",
|
||||
"Israel -- Politics and government."
|
||||
],
|
||||
"seeAlso": [],
|
||||
"attachments": [
|
||||
{
|
||||
"url": false
|
||||
}
|
||||
],
|
||||
"itemID": "4908720 (UTL catalogue ckey)",
|
||||
"title": "The challenge of Post-Zionism : alternatives to Israeli fundamentalist politics",
|
||||
"date": "2003",
|
||||
"publisher": "Zed Books",
|
||||
"place": "New York",
|
||||
"ISBN": "185649893X",
|
||||
"ISSN": "185649893X",
|
||||
"url": "http://www.loc.gov/catdir/description/hol032/2002190908.html",
|
||||
"libraryCatalog": "search8.library.utoronto.ca",
|
||||
"shortTitle": "The challenge of Post-Zionism"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "web",
|
||||
"url": "http://search8.library.utoronto.ca/UTL/index?N=0&Ntk=Anywhere&Ntt=adam+smith&Ntx=mode%2Bmatchallpartial&Nu=p_work_normalized&Np=1&formName=search_form_simple",
|
||||
"items": "multiple"
|
||||
}
|
||||
]
|
||||
/** END TEST CASES **/
|
Loading…
Reference in New Issue
Block a user