Adding Rintze's changes to work with the preview website
This commit is contained in:
parent
5c1018daaa
commit
0f77e5f273
1 changed files with 21 additions and 3 deletions
|
@ -2,8 +2,8 @@
|
||||||
"translatorID":"fcf41bed-0cbc-3704-85c7-8062a0068a7a",
|
"translatorID":"fcf41bed-0cbc-3704-85c7-8062a0068a7a",
|
||||||
"translatorType":12,
|
"translatorType":12,
|
||||||
"label":"NCBI PubMed",
|
"label":"NCBI PubMed",
|
||||||
"creator":"Simon Kornblith and Michael Berkowitz",
|
"creator":"Simon Kornblith, Michael Berkowitz and Rintze Zelle",
|
||||||
"target":"http://[^/]*www\\.ncbi\\.nlm\\.nih\\.gov[^/]*/(pubmed|sites/entrez|entrez/query\\.fcgi\\?.*db=PubMed)",
|
"target":"http://[^/]*(www|preview)\.ncbi\.nlm\.nih\.gov[^/]*/(pubmed|sites/entrez|entrez/query\.fcgi\?.*db=PubMed)",
|
||||||
"minVersion":"1.0.0b3.r1",
|
"minVersion":"1.0.0b3.r1",
|
||||||
"maxVersion":"",
|
"maxVersion":"",
|
||||||
"priority":100,
|
"priority":100,
|
||||||
|
@ -16,9 +16,19 @@ function detectWeb(doc, url) {
|
||||||
var nsResolver = namespace ? function(prefix) {
|
var nsResolver = namespace ? function(prefix) {
|
||||||
if (prefix == 'x') return namespace; else return null;
|
if (prefix == 'x') return namespace; else return null;
|
||||||
} : null;
|
} : null;
|
||||||
|
|
||||||
|
var items = doc.evaluate('//input[@name="EntrezSystem2.PEntrez.Pubmed.Pubmed_ResultsPanel.Pubmed_ResultsController.ResultCount"]', doc,
|
||||||
|
nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
|
||||||
|
if (items) {
|
||||||
|
if (items.value > 1) {
|
||||||
|
return "multiple";
|
||||||
|
} else if (items.value == 1) {
|
||||||
|
return "journalArticle";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var uids = doc.evaluate('//input[@type="checkbox" or @name="uid"]', doc,
|
var uids = doc.evaluate('//input[@type="checkbox" or @name="uid"]', doc,
|
||||||
nsResolver, XPathResult.ANY_TYPE, null);
|
nsResolver, XPathResult.ANY_TYPE, null);
|
||||||
if(uids.iterateNext() && doc.title.indexOf("PMC Results") == -1) {
|
if(uids.iterateNext() && doc.title.indexOf("PMC Results") == -1) {
|
||||||
if (uids.iterateNext() && doc.title.indexOf("PMC Results") == -1){
|
if (uids.iterateNext() && doc.title.indexOf("PMC Results") == -1){
|
||||||
return "multiple";
|
return "multiple";
|
||||||
|
@ -201,6 +211,14 @@ function doWeb(doc, url) {
|
||||||
ids.push(uid.value);
|
ids.push(uid.value);
|
||||||
lookupPMIDs(ids, doc);
|
lookupPMIDs(ids, doc);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
var uids= doc.evaluate('//p[@class="pmid"]', doc,
|
||||||
|
nsResolver, XPathResult.ANY_TYPE, null);
|
||||||
|
var uid = uids.iterateNext();
|
||||||
|
if (uid) {
|
||||||
|
ids.push(uid.textContent.match(/\d+/)[0]);
|
||||||
|
lookupPMIDs(ids, doc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue