Skip to content

Commit

Permalink
Make PMC https only
Browse files Browse the repository at this point in the history
Update tests
  • Loading branch information
adam3smith committed Sep 29, 2017
1 parent cedbded commit 08a0389
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions PubMed Central.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"translatorID": "27ee5b2c-2a5a-4afc-a0aa-d386642d4eed",
"label": "PubMed Central",
"creator": "Michael Berkowitz and Rintze Zelle",
"target": "^https?://(www\\.)?ncbi\\.nlm\\.nih\\.gov/pmc",
"target": "^https://(www\\.)?ncbi\\.nlm\\.nih\\.gov/pmc",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2017-01-26 04:49:54"
"lastUpdated": "2017-09-29 03:13:21"
}

function detectWeb(doc, url) {
Expand Down Expand Up @@ -89,7 +89,7 @@ function getSearchResults(doc, checkOnly) {
}

function lookupPMCIDs(ids, doc, pdfLink) {
var newUri = "//eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pmc&retmode=xml&id="
var newUri = "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pmc&retmode=xml&id="
+ encodeURIComponent(ids.join(","));
Zotero.debug(newUri);
ZU.doGet(newUri, function (text) {
Expand Down Expand Up @@ -187,7 +187,7 @@ function lookupPMCIDs(ids, doc, pdfLink) {
}
}

var linkurl = "http://www.ncbi.nlm.nih.gov/pmc/articles/PMC" + ids[i] + "/";
var linkurl = "https://www.ncbi.nlm.nih.gov/pmc/articles/PMC" + ids[i] + "/";
newItem.url = linkurl;
newItem.attachments = [{
url: linkurl,
Expand All @@ -199,11 +199,11 @@ function lookupPMCIDs(ids, doc, pdfLink) {
if (pdfLink) {
var pdfFileName = pdfLink[ids[i]];
} else if (ZU.xpathText(article, 'selfuri/@xlinktitle') == "pdf") {
var pdfFileName = "http://www.ncbi.nlm.nih.gov/pmc/articles/PMC" +
var pdfFileName = "https://www.ncbi.nlm.nih.gov/pmc/articles/PMC" +
ids[i] + "/pdf/" + ZU.xpathText(article, 'selfuri/@xlinkhref');
} else if (ZU.xpathText(article, 'articleid[@pubidtype="publisherid"]')){
//this should work on most multiples
var pdfFileName = "http://www.ncbi.nlm.nih.gov/pmc/articles/PMC" +
var pdfFileName = "https://www.ncbi.nlm.nih.gov/pmc/articles/PMC" +
ids[i] + "/pdf/" + ZU.xpathText(article, 'articleid[@pubidtype="publisherid"]') + ".pdf";
}

Expand Down Expand Up @@ -275,7 +275,7 @@ var testCases = [
"libraryCatalog": "PubMed Central",
"pages": "37",
"publicationTitle": "Respiratory Research",
"url": "http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2377243/",
"url": "https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2377243/",
"volume": "9",
"attachments": [
{
Expand Down Expand Up @@ -368,7 +368,7 @@ var testCases = [
"libraryCatalog": "PubMed Central",
"pages": "2767-2777",
"publicationTitle": "Statistics in medicine",
"url": "http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3139813/",
"url": "https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3139813/",
"volume": "30",
"attachments": [
{
Expand Down Expand Up @@ -435,7 +435,7 @@ var testCases = [
"journalAbbreviation": "PLoS One",
"libraryCatalog": "PubMed Central",
"publicationTitle": "PLoS ONE",
"url": "http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2801612/",
"url": "https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2801612/",
"volume": "5",
"attachments": [
{
Expand Down Expand Up @@ -499,7 +499,7 @@ var testCases = [
"pages": "88-102",
"publicationTitle": "Immunological Reviews",
"shortTitle": "The human immune response to tuberculosis and its treatment",
"url": "http://www.ncbi.nlm.nih.gov/pmc/articles/PMC4368415/",
"url": "https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4368415/",
"volume": "264",
"attachments": [
{
Expand Down

1 comment on commit 08a0389

@adomasven
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding your comment about relative protocol // resolution. This is probably browser (and perhaps even OS) specific, the resolution branch that the Connector takes is this one:

if (this.document) {
	var a = this.document.createElement('a');
	a.href = url;
	resolved = a.href;
}

Please sign in to comment.