Skip to content
Permalink
Browse files

massive commit - changes http to https? for almost all remaining tran…

…slators, also adds callbacks and removes nsResolver
  • Loading branch information...
adam3smith committed Apr 4, 2014
1 parent 6425b75 commit c08e17c0f40bf242a62366334743ad4aff6976d7
61 AIP.js
@@ -2,14 +2,14 @@
"translatorID": "48d3b115-7e09-4134-ad5d-0beda6296761",
"label": "AIP",
"creator": "Aurimas Vinckevicius",
"target": "^http://scitation\\.aip\\.org/(?:search\\?|content/)",
"target": "^https?://scitation\\.aip\\.org/(?:search\\?|content/)",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2013-12-06 17:49:29"
"lastUpdated": "2014-04-03 16:35:05"
}

function getSearchResults(doc) {
@@ -154,15 +154,15 @@ var testCases = [
"notes": [],
"tags": [
"Antiferroelectricity",
"Antiferroelectricity",
"Dielectric oxides",
"Dielectric oxides",
"Image reconstruction",
"Image reconstruction",
"Iron group ions",
"Iron group ions",
"Image reconstruction",
"Ozone",
"Ozone"
"Electron energy loss spectroscopy",
"Nanorods",
"Crystal structure",
"Ferroelectricity",
"Optical aberrations"
],
"seeAlso": [],
"attachments": [
@@ -175,7 +175,21 @@ var testCases = [
}
],
"title": "Local stabilisation of polar order at charged antiphase boundaries in antiferroelectric (Bi0.85Nd0.15)(Ti0.1Fe0.9)O3",
"publisher": "AIP Publishing",
"institution": "AIP Publishing",
"company": "AIP Publishing",
"label": "AIP Publishing",
"distributor": "AIP Publishing",
"date": "2013/08/13",
"reportType": "Text",
"letterType": "Text",
"manuscriptType": "Text",
"mapType": "Text",
"thesisType": "Text",
"websiteType": "Text",
"presentationType": "Text",
"postType": "Text",
"audioFileType": "Text",
"publicationTitle": "APL Materials",
"volume": "1",
"issue": "2",
@@ -184,7 +198,8 @@ var testCases = [
"pages": "021102",
"ISSN": "2166-532X",
"url": "http://scitation.aip.org/content/aip/journal/aplmater/1/2/10.1063/1.4818002",
"libraryCatalog": "scitation.aip.org"
"libraryCatalog": "scitation.aip.org",
"accessDate": "CURRENT_TIMESTAMP"
}
]
},
@@ -203,11 +218,15 @@ var testCases = [
],
"notes": [],
"tags": [
"Advanced materials",
"Insulator surfaces",
"Materials science",
"Numerical analysis",
"Surface finishing"
"Surface finishing",
"Advanced materials",
"Materials science",
"Number theory",
"Radiative heat transfer",
"Thermal analysis",
"Thermal nonlinear materials"
],
"seeAlso": [],
"attachments": [
@@ -221,15 +240,31 @@ var testCases = [
],
"title": "Evaluation of thermal resistance of building insulations with reflective surfaces",
"publisher": "AIP Publishing",
"institution": "AIP Publishing",
"company": "AIP Publishing",
"label": "AIP Publishing",
"distributor": "AIP Publishing",
"date": "2012/09/26",
"reportType": "Text",
"letterType": "Text",
"manuscriptType": "Text",
"mapType": "Text",
"thesisType": "Text",
"websiteType": "Text",
"presentationType": "Text",
"postType": "Text",
"audioFileType": "Text",
"volume": "1479",
"issue": "1",
"conferenceName": "NUMERICAL ANALYSIS AND APPLIED MATHEMATICS ICNAAM 2012: International Conference of Numerical Analysis and Applied Mathematics",
"abstractNote": "The thermal resistance of advanced insulation materials, applied namely in civil engineering, containing reflective surfaces and air gaps, cannot be evaluated correctly using the valid European standards because of presence of the dominant nonlinear radiative heat transfer and other phenomena not included in the recommended computational formulae. The proper general physical analysis refers to rather complicated problems from classical thermodynamics, whose both existence theory and numerical analysis contain open questions and cannot be done in practice when the optimization of composition of insulation layers is required. This paper, coming from original experimental results, demonstrates an alternative simplified computational approach, taking into account the most important physical processes, useful in the design of modern insulation systems.",
"DOI": "10.1063/1.4756630",
"pages": "2204-2207",
"ISSN": "0094-243X, 1551-7616",
"url": "http://scitation.aip.org/content/aip/proceeding/aipcp/10.1063/1.4756630",
"libraryCatalog": "scitation.aip.org",
"proceedingsTitle": "AIP Conference Proceedings"
"accessDate": "CURRENT_TIMESTAMP",
"publicationTitle": "AIP Conference Proceedings"
}
]
},
@@ -2,18 +2,18 @@
"translatorID": "5ae63913-669a-4792-9f45-e089a37de9ab",
"label": "BAILII",
"creator": "Bill McKinney",
"target": "http:\\/\\/www\\.bailii\\.org(?:\\/cgi\\-bin\\/markup\\.cgi\\?doc\\=)?\\/\\w+\\/cases\\/.+",
"target": "^https?:\\/\\/www\\.bailii\\.org(?:\\/cgi\\-bin\\/markup\\.cgi\\?doc\\=)?\\/\\w+\\/cases\\/.+",
"minVersion": "1.0.0b4.r1",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2013-02-09 12:08:46"
"lastUpdated": "2014-04-03 16:36:35"
}

function detectWeb(doc, url) {
var liiRegexp= /^http:\/\/www\.bailii\.org(?:\/cgi\-bin\/markup\.cgi\?doc\=)?\/\w+\/cases\/.+\.html/
var liiRegexp= /^https?:\/\/www\.bailii\.org(?:\/cgi\-bin\/markup\.cgi\?doc\=)?\/\w+\/cases\/.+\.html/
if(liiRegexp.test(url)) {
return "case";
} else {
99 BOCC.js
@@ -2,14 +2,14 @@
"translatorID": "ecd1b7c6-8d31-4056-8c15-1807b2489254",
"label": "BOCC",
"creator": "José Antonio Meira da Rocha",
"target": "^http:\\/\\/[^/]*bocc[^/]*/(?:_listas|_esp)",
"target": "^https?:\\/\\/[^/]*bocc[^/]*/(?:_listas|_esp)",
"minVersion": "1.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsbv",
"lastUpdated": "2012-01-30 22:52:22"
"lastUpdated": "2014-04-03 16:46:48"
}

/* Translator for Biblioteca Online de Ciências da Comunicação (BOCC,
@@ -57,10 +57,6 @@ function getAuthors(newItem, itemsAutors) {
}
// Standard Zotero translator entry point
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 itemsAutors = new Object();
@@ -78,24 +74,24 @@ function doWeb(doc, url) {
if (detectWeb(doc, url) == "multiple") {
// Return XPathResult object
// accessible with .iterateNext() method
var content = doc.evaluate("//table[@class='ag']/tbody/tr[1]/td[@class='agenda']", doc, nsResolver, XPathResult.ANY_TYPE, null);
var content = doc.evaluate("//table[@class='ag']/tbody/tr[1]/td[@class='agenda']", doc, null, XPathResult.ANY_TYPE, null);
// All articles are in same <td>
// Get the first <td> data
bloco = content.iterateNext().innerHTML;
lines = bloco.split('<br><br>');
//Zotero.debug('Artigo===>'+lines[0]+'<===');
///////////////////////////////////////////////
// Try get tags
var tematica = doc.evaluate("//title", doc, nsResolver, XPathResult.ANY_TYPE, null);
var tematica = doc.evaluate("//title", doc, null, XPathResult.ANY_TYPE, null);
tematica = tematica.iterateNext().textContent;
//Zotero.debug('<Title>===>'+tematica+'<===');
var isTematica = tematica.match('Temática');
if (isTematica) {
// Get tematicas list to build tags list
var tematicanum;
var tematicasnums = doc.evaluate('//a[@class="tematica"]/@href', doc, nsResolver, XPathResult.ANY_TYPE, null);
var tematicasnums = doc.evaluate('//a[@class="tematica"]/@href', doc, null, XPathResult.ANY_TYPE, null);
var tematicasname;
var tematicasnames = doc.evaluate('//a[@class="tematica"]', doc, nsResolver, XPathResult.ANY_TYPE, null);
var tematicasnames = doc.evaluate('//a[@class="tematica"]', doc, null, XPathResult.ANY_TYPE, null);

var tematicas = new Object();
while (tematicanum = tematicasnums.iterateNext()) {
@@ -164,51 +160,50 @@ function doWeb(doc, url) {
* Assumes window.arguments[0].dataIn is an object with
* URLs as keys and descriptions as values
*/
items = Zotero.selectItems(items);
for (var n in items) {
Zotero.debug('Item '+n+' ==>'+items[n]+'<==');
};

var filetitle;
var filemime;
for (var item in items) {
var newItem = new Zotero.Item("journalArticle");
newItem.title = items[item];
newItem.date = itemDate[item];
newItem.publicationTitle = "Biblioteca Online de Ciências da Comunicação";
newItem.ISSN = '1646-3137';
newItem.journalAbbreviation = 'BOCC' ;
// http://www.bocc.ubi.pt
newItem.url = site+item.replace("..", "");
fileurl = site+item.replace("..", "")
Zotero.debug('Doc ===>'+fileurl+'<===');
if (fileurl.match('.html$|.htm$|.HTML$|.HTM$')) {
filetitle = 'Anexo HTML';
filemime = 'text/html';
};
if (fileurl.match('.pdf$|.PDF$')) {
filetitle = 'Anexo PDF';
filemime = 'application/pdf';
};
Zotero.debug('File title ===>'+filetitle+'<===');
Zotero.debug('File mime ===>'+filemime+'<===');
newItem.attachments.push(
{url:fileurl, title:filetitle, mimeType:filemime}
);
temp = itemsAutors[item];
for (var i in temp) {
newItem.creators.push(Zotero.Utilities.cleanAuthor(temp[i], "author"));


Zotero.selectItems(items, function (items) {
if (!items) {
return true;
}
if (isTematica) {
for (var i = 0; i < tagsContent.length; i++) {
newItem.tags[i] = tagsContent[i];
var filetitle;
var filemime;
for (var item in items) {
var newItem = new Zotero.Item("journalArticle");
newItem.title = items[item];
newItem.date = itemDate[item];
newItem.publicationTitle = "Biblioteca Online de Ciências da Comunicação";
newItem.ISSN = '1646-3137';
newItem.journalAbbreviation = 'BOCC' ;
// http://www.bocc.ubi.pt
newItem.url = site+item.replace("..", "");
fileurl = site+item.replace("..", "")
Zotero.debug('Doc ===>'+fileurl+'<===');
if (fileurl.match('.html$|.htm$|.HTML$|.HTM$')) {
filetitle = 'Anexo HTML';
filemime = 'text/html';
};
if (fileurl.match('.pdf$|.PDF$')) {
filetitle = 'Anexo PDF';
filemime = 'application/pdf';
};
Zotero.debug('File title ===>'+filetitle+'<===');
Zotero.debug('File mime ===>'+filemime+'<===');
newItem.attachments.push(
{url:fileurl, title:filetitle, mimeType:filemime}
);
temp = itemsAutors[item];
for (var i in temp) {
newItem.creators.push(Zotero.Utilities.cleanAuthor(temp[i], "author"));
}
if (isTematica) {
for (var i = 0; i < tagsContent.length; i++) {
newItem.tags[i] = tagsContent[i];
}
}
newItem.complete();
}
newItem.complete();
}
//debug

Zotero.wait();
})
}
}
/** BEGIN TEST CASES **/
@@ -2,14 +2,14 @@
"translatorID": "a571680e-6338-46c2-a740-3cd9eb80fc7f",
"label": "Beobachter",
"creator": "ibex",
"target": "^http://((www\\.)?beobachter\\.ch/.)",
"target": "^https?://((www\\.)?beobachter\\.ch/.)",
"minVersion": "2.1.9",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2013-09-16 00:37:06"
"lastUpdated": "2014-04-03 16:37:44"
}

/*
@@ -71,8 +71,7 @@ function doWeb(doc, url) {
} else {
urls.push(doc.location.href);
}
ZU.processDocuments(urls, scrape, function() { Z.done(); } );
Z.wait();
ZU.processDocuments(urls, scrape);
}

/* Zotero API */
@@ -2,14 +2,14 @@
"translatorID": "7cb0089b-9551-44b2-abca-eb03cbf586d9",
"label": "BioOne",
"creator": "Michael Berkowitz",
"target": "^http://[^/]*www\\.bioone\\.org[^/]*/",
"target": "^https?://[^/]*www\\.bioone\\.org[^/]*/s",
"minVersion": "1.0.0b4.r5",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2013-12-11 16:13:35"
"lastUpdated": "2014-04-03 16:38:14"
}

/*
Oops, something went wrong.

0 comments on commit c08e17c

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