Trans: Fix for more IEEE problems
This commit is contained in:
parent
c1c9673dc6
commit
4b4968a24e
1 changed files with 29 additions and 6 deletions
|
@ -8,7 +8,7 @@
|
||||||
"maxVersion":"",
|
"maxVersion":"",
|
||||||
"priority":100,
|
"priority":100,
|
||||||
"inRepository":true,
|
"inRepository":true,
|
||||||
"lastUpdated":"2011-01-11 04:31:00"
|
"lastUpdated":"2011-05-05 22:04:16"
|
||||||
}
|
}
|
||||||
|
|
||||||
function detectWeb(doc, url) {
|
function detectWeb(doc, url) {
|
||||||
|
@ -30,7 +30,10 @@ function doWeb(doc, url) {
|
||||||
if (prefix == 'x') return namespace; else return null;
|
if (prefix == 'x') return namespace; else return null;
|
||||||
} : null;
|
} : null;
|
||||||
|
|
||||||
var articleRe = /[?&]ar(N|n)umber=([0-9]+)/;
|
var hostRe = new RegExp("^(https?://[^/]+)/");
|
||||||
|
var hostMatch = hostRe.exec(url);
|
||||||
|
|
||||||
|
var articleRe = /[?&]ar(?:N|n)umber=([0-9]+)/;
|
||||||
var m = articleRe.exec(url);
|
var m = articleRe.exec(url);
|
||||||
|
|
||||||
if(detectWeb(doc, url) == "multiple") {
|
if(detectWeb(doc, url) == "multiple") {
|
||||||
|
@ -59,12 +62,25 @@ function doWeb(doc, url) {
|
||||||
|
|
||||||
var urls = new Array();
|
var urls = new Array();
|
||||||
for(var url in items) {
|
for(var url in items) {
|
||||||
|
// Some pages don't show the metadata we need (http://forums.zotero.org/discussion/16283)
|
||||||
|
// No data: http://ieeexplore.ieee.org/search/srchabstract.jsp?tp=&arnumber=1397982
|
||||||
|
// Data: http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=1397982
|
||||||
|
var arnumber = url.match(/arnumber=(\d+)/)[1];
|
||||||
|
url = url.replace(/\/search\/.*$/, "/xpls/abs_all.jsp?arnumber="+arnumber);
|
||||||
urls.push(url);
|
urls.push(url);
|
||||||
}
|
}
|
||||||
Zotero.Utilities.processDocuments(urls, scrape, function () { Zotero.done(); });
|
Zotero.Utilities.processDocuments(urls, scrape, function () { Zotero.done(); });
|
||||||
Zotero.wait();
|
Zotero.wait();
|
||||||
} else {
|
} else {
|
||||||
scrape(doc, url);
|
if (url.indexOf("/search/") !== -1) {
|
||||||
|
// Address the same missing metadata problem as above
|
||||||
|
var arnumber = url.match(/arnumber=(\d+)/)[1];
|
||||||
|
url = url.replace(/\/search\/.*$/, "/xpls/abs_all.jsp?arnumber="+arnumber);
|
||||||
|
Zotero.Utilities.processDocuments([url], scrape, function () { Zotero.done(); });
|
||||||
|
Zotero.wait();
|
||||||
|
} else {
|
||||||
|
scrape(doc, url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +133,8 @@ function scrape(doc,url) {
|
||||||
var row;
|
var row;
|
||||||
var rows;
|
var rows;
|
||||||
|
|
||||||
newItem.url = doc.location.href;
|
newItem.attachments = [];
|
||||||
|
newItem.tags = [];
|
||||||
var metaTags = doc.getElementsByTagName("meta");
|
var metaTags = doc.getElementsByTagName("meta");
|
||||||
|
|
||||||
var pages = [false, false];
|
var pages = [false, false];
|
||||||
|
@ -164,7 +181,7 @@ function scrape(doc,url) {
|
||||||
&& value != "null" && value != "") newItem.language = value; break;
|
&& value != "null" && value != "") newItem.language = value; break;
|
||||||
case "citation_doi": if (!newItem.DOI) newItem.DOI = value; break;
|
case "citation_doi": if (!newItem.DOI) newItem.DOI = value; break;
|
||||||
case "citation_abstract": newItem.abstractNote = value; break;
|
case "citation_abstract": newItem.abstractNote = value; break;
|
||||||
case "citation_abstract_html_url": newItem.url = value; break;
|
case "citation_abstract_html_url": newItem.attachments.push({url:value, title:"IEEE Xplore Abstract Record", snapshot:false}); break;
|
||||||
case "citation_pdf_url": if(!pdf) pdf = value; break;
|
case "citation_pdf_url": if(!pdf) pdf = value; break;
|
||||||
case "citation_keywords": newItem.tags.push(value); break;
|
case "citation_keywords": newItem.tags.push(value); break;
|
||||||
case "citation_fulltext_html_url": if(!pdf) pdf = value; break;
|
case "citation_fulltext_html_url": if(!pdf) pdf = value; break;
|
||||||
|
@ -182,7 +199,13 @@ function scrape(doc,url) {
|
||||||
Zotero.debug("Ignoring meta tag: " + tag + " => " + value);
|
Zotero.debug("Ignoring meta tag: " + tag + " => " + value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (html) newItem.attachments = [{url:html, title:"IEEE Xplore Full Text HTML"}];
|
|
||||||
|
// Split if we have only one tag
|
||||||
|
if (newItem.tags.length == 1) {
|
||||||
|
newItem.tags = newItem.tags[0].split(";");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (html) newItem.attachments.push({url:html, title:"IEEE Xplore Full Text HTML"});
|
||||||
|
|
||||||
if (pages[0] && pages[1]) newItem.pages = pages.join('-')
|
if (pages[0] && pages[1]) newItem.pages = pages.join('-')
|
||||||
else newItem.pages = pages[0] ? pages[1] : (pages[1] ? pages[1] : "");
|
else newItem.pages = pages[0] ? pages[1] : (pages[1] ? pages[1] : "");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue