Skip to content
Permalink
Browse files

Fixes and Updates - O (zotero#1214)

* Update OECD.js
* Update Old Bailey Online.js
* Update Open Journal Systems.js
* Update Open WorldCat.js
* Activate OpenEdition Books.js on server and bookmarklet
* Update tests in OSTI Energy Citations.js
* Update tests in Oxford English Dictionary.js
* Rewrite Oxford University Press.js
* Rewrite Optical Society of America.js
I couldn't get the RIS, BibTeX, etc. data by any POST
call anymore. Even more, it is not possible to resend
in the browser the same POST call. Therefore, I changed
to use the metadata translator. The metadata is
very good here!
* Rewrite OZON.ru.js (again)
CC @roveo
  • Loading branch information...
zuphilip authored and adam3smith committed Jan 8, 2017
1 parent c9a994d commit cfc429178c9a8233894bc8f8b829dee8419bce78
Showing with 559 additions and 618 deletions.
  1. +25 −25 OECD.js
  2. +38 −39 OSTI Energy Citations.js
  3. +128 −119 OZON.ru.js
  4. +30 −64 Old Bailey Online.js
  5. +5 −49 Open Journal Systems.js
  6. +5 −4 Open WorldCat.js
  7. +2 −2 OpenEdition Books.js
  8. +143 −210 Optical Society of America.js
  9. +13 −13 Oxford English Dictionary.js
  10. +170 −93 Oxford University Press.js
50 OECD.js
@@ -9,7 +9,7 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcs",
"lastUpdated": "2014-01-05 11:58:51"
"lastUpdated": "2017-01-03 07:41:53"
}

/*
@@ -35,15 +35,15 @@
*/

function detectWeb(doc, url) {
var menuitem = ZU.xpathText(doc, '//li[@class="menuitem"]/a[@class="on"]');
var bodyId = doc.body.getAttribute("id");
if (ZU.xpathText(doc, '//ul[@class="sidebar-list"]//a[contains(@title, "Cite this")]')){
if (ZU.xpathText(doc, '//li[@class="editorial-board"]')){
return "journalArticle";
}
else if (menuitem && menuitem.indexOf("BOOK")!=-1) {
} else if (bodyId && bodyId=="bookpage") {
return "book";
} else {
return "report";
}
else return "report"
}
if (ZU.xpath(doc, '//table[contains (@class, "search-results")]').length>0){
return "multiple";
@@ -81,31 +81,31 @@ function scrape(doc, url){
var RWurl = url + "?fmt=txt";
Zotero.Utilities.HTTP.doGet(RWurl, function (text) {

text = text.replace(/\nK\d+\s/g, "\nK1 ");
if(text.search(/RT Generic/)!=-1){
text = text.replace(/RT Generic/, "RT Report");
text = text.replace(/JF (.+)/, "CL $1");
}
text = text.replace(/\nK\d+\s/g, "\nK1 ");
if(text.search(/RT Generic/)!=-1){
text = text.replace(/RT Generic/, "RT Report");
text = text.replace(/JF (.+)/, "CL $1");
}
//Zotero.debug(text)
var translator = Zotero.loadTranslator("import");
translator.setTranslator("1a3506da-a303-4b0a-a1cd-f216e6138d86");
translator.setString(text);
translator.setHandler("itemDone", function(obj, item) {
if (language) item.language = language[1];
if (item.itemType =="report" || item.itemType =="book"){
if (!item.place) item.place="Paris";
}
for (var i in item.creators){
if (!item.creators[i].firstName) item.creators[i].fieldMode = 1;
}
//we need to run through this to get the PDF because of redirect.
if (pdfurl){
ZU.processDocuments(pdfurl.replace(/,\s.+/, ""), function(newdoc){
item.attachments = [{document: newdoc, title: "OECD Fulltext", }];
item.complete();
})
}
else item.complete();
if (language) item.language = language[1];
if (item.itemType =="report" || item.itemType =="book"){
if (!item.place) item.place="Paris";
}
for (var i in item.creators){
if (!item.creators[i].firstName) item.creators[i].fieldMode = 1;
}
//we need to run through this to get the PDF because of redirect.
if (pdfurl){
ZU.processDocuments(pdfurl.replace(/,\s.+/, ""), function(newdoc){
item.attachments = [{document: newdoc, title: "OECD Fulltext", }];
item.complete();
})
}
else item.complete();
});
translator.translate();
});
@@ -9,7 +9,7 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2015-03-31 22:43:59"
"lastUpdated": "2017-01-03 11:31:22"
}

/*
@@ -101,6 +101,7 @@ function doWeb(doc,url)
});
}
}

/** BEGIN TEST CASES **/
var testCases = [
{
@@ -109,6 +110,7 @@ var testCases = [
"items": [
{
"itemType": "journalArticle",
"title": "Phase Transition from Hadronic Matter to Quark Matter",
"creators": [
{
"firstName": "P.",
@@ -126,15 +128,17 @@ var testCases = [
"creatorType": "author"
}
],
"notes": [],
"tags": [
"physics of elementary particles and fields",
"nuclear matter",
"quark matter",
"quarks",
"superconductivity"
],
"seeAlso": [],
"date": "2007/04/01",
"DOI": "10.1103/PhysRevC.75.045202",
"accessDate": "CURRENT_TIMESTAMP",
"institution": "Thomas Jefferson National Accelerator Facility, Newport",
"language": "English",
"libraryCatalog": "www.osti.gov",
"number": "JLAB-THY-06-545; DOE/ER/40150-4072",
"place": "News, VA",
"publicationTitle": "Phys.Rev.C",
"url": "http://www.osti.gov/scitech/biblio/893699",
"volume": "75",
"attachments": [
{
"title": "Full Text PDF",
@@ -144,40 +148,38 @@ var testCases = [
"title": "Snapshot"
}
],
"title": "Phase Transition from Hadronic Matter to Quark Matter",
"date": "2007/04/01",
"publicationTitle": "Phys.Rev.C",
"volume": "75",
"institution": "Thomas Jefferson National Accelerator Facility, Newport",
"number": "JLAB-THY-06-545; DOE/ER/40150-4072",
"DOI": "10.1103/PhysRevC.75.045202",
"language": "English",
"url": "http://www.osti.gov/scitech/biblio/893699",
"libraryCatalog": "www.osti.gov",
"accessDate": "CURRENT_TIMESTAMP",
"place": "News, VA"
"tags": [
"nuclear matter",
"physics of elementary particles and fields",
"quark matter",
"quarks",
"superconductivity"
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "http://www.osti.gov/scitech/biblio/1084504",
"url": "https://www.osti.gov/scitech/biblio/1084504",
"items": [
{
"itemType": "report",
"title": "Superconductivity",
"creators": [
{
"firstName": "Boris A.",
"lastName": "Maiorov",
"creatorType": "author"
}
],
"notes": [],
"tags": [
"condensed matter physics",
"superconductivity & superfluidity(75)"
],
"seeAlso": [],
"date": "2013/06/19",
"institution": "Los Alamos National Laboratory (LANL)",
"language": "English",
"libraryCatalog": "www.osti.gov",
"reportNumber": "LA-UR-13-24526",
"url": "https://www.osti.gov/scitech/biblio/1084504",
"attachments": [
{
"title": "Full Text PDF",
@@ -187,17 +189,14 @@ var testCases = [
"title": "Snapshot"
}
],
"title": "Superconductivity",
"date": "2013/06/19",
"institution": "Los Alamos National Laboratory (LANL)",
"number": "LA-UR-13-24526",
"DOI": "10.2172/1084504",
"language": "English",
"url": "http://www.osti.gov/scitech/biblio/1084504",
"libraryCatalog": "www.osti.gov",
"accessDate": "CURRENT_TIMESTAMP"
"tags": [
"condensed matter physics",
"superconductivity & superfluidity(75)"
],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/
/** END TEST CASES **/

0 comments on commit cfc4291

Please sign in to comment.
You can’t perform that action at this time.