Support short DOIs in cleanDOI() and update DOI copyAsURL prefix (#1356)

This commit is contained in:
bwiernik 2017-11-07 22:48:12 +01:00 committed by Dan Stillman
parent 01c71fd970
commit e935001586
2 changed files with 2 additions and 2 deletions

View File

@ -427,7 +427,7 @@
// Pull out DOI, in case there's a prefix // Pull out DOI, in case there's a prefix
var doi = Zotero.Utilities.cleanDOI(val); var doi = Zotero.Utilities.cleanDOI(val);
if (doi) { if (doi) {
doi = "http://dx.doi.org/" + encodeURIComponent(doi); doi = "https://doi.org/" + encodeURIComponent(doi);
label.classList.add("pointer"); label.classList.add("pointer");
label.setAttribute("onclick", "ZoteroPane_Local.loadURI('" + doi + "', event)"); label.setAttribute("onclick", "ZoteroPane_Local.loadURI('" + doi + "', event)");
label.setAttribute("tooltiptext", Zotero.getString('locate.online.tooltip')); label.setAttribute("tooltiptext", Zotero.getString('locate.online.tooltip'));

View File

@ -311,7 +311,7 @@ Zotero.Utilities = {
throw "cleanDOI: argument must be a string"; throw "cleanDOI: argument must be a string";
} }
var doi = x.match(/10\.[0-9]{4,}\/[^\s]*[^\s\.,]/); var doi = x.match(/10(?:\.[0-9]{4,})?\/[^\s]*[^\s\.,]/);
return doi ? doi[0] : null; return doi ? doi[0] : null;
}, },