diff --git a/www/min/doi.min.js b/www/min/doi.min.js index 6de65f49aa38939b4b009bef70a5c1a00441e0d5..c47ac6eb3fc88e96e76eeba441a2294d97aea83f 100644 --- a/www/min/doi.min.js +++ b/www/min/doi.min.js @@ -1 +1 @@ -function DOIController(e){this.doiServer="https://data.datacite.org/",this.acceptedPrefix=["10.5072","10.15151"],this.view=e}function findRegExpInText(e,t){return t.search(e)}function extractFieldsFromCategories(e){_.forEach(e.subject[0],function(t){switch(t.subject_scheme){case"Proposal Type Description":e.proposalType=t.text;break;case"Proposal":e.proposalNumber=t.text;break;case"instrument":e.beamline=t.text}})}function extractFieldsFromDoi(e){var t=RegExp(/\/\w*-*[Ee][Ss][Rr][Ff]-[Ee][Ss]-(\d+)$/);e.investigationId=t.exec(e.doi)[1]}function createCitation(e){var t=_.transform(e.creator,function(e,t){if(t.givenName)e.push(t.familyName+" "+t.givenName);else{var r=new RegExp(/\s([^a-z]+$)/),n=new RegExp(/^(.[^A-Z]+)+\b/),a=r.exec(t.name),s=n.exec(t.name);a&&s?e.push(a[1]+" "+s[0].trim()):e.push(t.name)}},[]),r=_.join(t,"; ")+". ("+e.date_registered+"). "+e.title+". "+e.publisher+" (ESRF). doi:"+e.doi+"";e.citation=r}function DOIView(){}var BEAMLINEURL=[{name:"BM05",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.fr/UsersAndScience/Experiments/XNP/BM05"},{name:"BM29",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/UsersAndScience/Experiments/MX/About_our_beamlines/BM29"},{name:"CM01",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/home/UsersAndScience/Experiments/MX/About_our_beamlines/CM01.html"},{name:"ID01",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/UsersAndScience/Experiments/XNP/ID01"},{name:"ID06",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/home/UsersAndScience/Experiments/MEx/id06-large-volume-press.html"},{name:"ID11",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.fr/UsersAndScience/Experiments/StructMaterials/ID11"},{name:"ID16A",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.fr/UsersAndScience/Experiments/XNP/ID16A"},{name:"ID16B",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.fr/UsersAndScience/Experiments/XNP/ID16B"},{name:"ID17",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.fr/UsersAndScience/Experiments/CBS/ID17"},{name:"ID19",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.fr/home/UsersAndScience/Experiments/StructMaterials/ID19.html"},{name:"ID21",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/UsersAndScience/Experiments/XNP/ID21"},{name:"ID22",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/id22"},{name:"ID23-1",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/UsersAndScience/Experiments/MX/About_our_beamlines/ID23-1"},{name:"ID23-2",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/UsersAndScience/Experiments/MX/About_our_beamlines/ID23-2"},{name:"ID29",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/home/UsersAndScience/Experiments/Beamlines/content/content/id29.html"},{name:"ID30A1",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/MASSIF1"},{name:"ID30A3",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/home/UsersAndScience/Experiments/MX/About_our_beamlines/id30a-3--massif-3.html"},{name:"ID30B",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/id30b"},{name:"ID32",startDate:"2000-01-01T00:00+00:00",endDate:"2100-12-31T00:00+00:00",url:"http://www.esrf.eu/ID32"}];DOIController.prototype.getData=function(e){var t=this;this.view.setDOI(e),this.hasAcceptedPrefix(e)?$.ajax({headers:{Accept:"application/vnd.datacite.datacite+json"},type:"GET",url:this.doiServer+e,beforeSend:function(){t.view.setLoading("Retrieving data from Server")},complete:function(){t.view.setLoading(!1)},success:function(e){if(e){extractFieldsFromCategories(e),extractFieldsFromDoi(e),createCitation(e);var r=new Date(e.date_collected+"T00:00+00:00");e.beamlineUrl=t.findsUrl(e.beamline,r),dust.render("esrf-landing-page",{data:e},function(e,t){$("#main").html(t)})}else"welcome-page"===t.origin?t.view.displayMessage("doi-not-found-page2","Sorry, the requested DOI was not found.","error"):t.view.displayMessage("doi-not-found-page","Sorry, the requested DOI was not found.","main")},error:function(e,r,n){"welcome-page"===t.origin?t.view.displayMessage("doi-not-found-page2","
Sorry, there was a connexion problem with the datacite server.
","error"):t.view.displayMessage("doi-not-found-page","Sorry, there was a connexion problem with the datacite server.
","main"),t.view.setLoading(!1)}}):"welcome-page"===t.origin?t.view.displayMessage("doi-not-found-page2","The DOI "+e+' was not found at ESRF because its prefix is not ESRF specific. Please use the DOI search engine at doi.org.
',"error"):t.view.displayMessage("doi-not-found-page","The DOI "+e+' was not found at ESRF because its prefix is not ESRF specific. Please use the DOI search engine at doi.org.
',"main")},DOIController.prototype.hasAcceptedPrefix=function(e){var t=e.split("/")[0];return-1!=_.findIndex(this.acceptedPrefix,function(e){return t==e})},DOIController.prototype.displayMainContent=function(e){"welcome-page"===this.origin&&dust.render("welcome-page",{},function(e,t){$("#main").html(t)}),"index"===this.origin&&this.getData(e)},DOIController.prototype.setOrigin=function(e){this.origin=e},DOIController.prototype.findsUrl=function(e,t){for(var r="noLink",n=0;BEAMLINEURL[n]&&"noLink"===r;){var a=new Date(BEAMLINEURL[n].startDate),s=new Date(BEAMLINEURL[n].endDate);BEAMLINEURL[n].name.toLowerCase()===e.toLowerCase()&&t>a&&tSorry, there was a connexion problem with the datacite server.
","error"):t.view.displayMessage("doi-not-found-page","Sorry, there was a connexion problem with the datacite server.
","main"),t.view.setLoading(!1)}}):"welcome-page"===t.origin?t.view.displayMessage("doi-not-found-page2","The DOI "+e+' was not found at ESRF because its prefix is not ESRF specific. Please use the DOI search engine at doi.org.
',"error"):t.view.displayMessage("doi-not-found-page","The DOI "+e+' was not found at ESRF because its prefix is not ESRF specific. Please use the DOI search engine at doi.org.
',"main")},DOIController.prototype.hasAcceptedPrefix=function(e){var t=e.split("/")[0];return-1!=_.findIndex(this.acceptedPrefix,function(e){return t==e})},DOIController.prototype.displayMainContent=function(e){"welcome-page"===this.origin&&dust.render("welcome-page",{},function(e,t){$("#main").html(t)}),"index"===this.origin&&this.getData(e)},DOIController.prototype.setOrigin=function(e){this.origin=e},DOIController.prototype.findsUrl=function(e,t){for(var r="noLink",n=0;BEAMLINEURL[n]&&"noLink"===r;){var a=new Date(BEAMLINEURL[n].startDate),s=new Date(BEAMLINEURL[n].endDate);BEAMLINEURL[n].name.toLowerCase()===e.toLowerCase()&&t>a&&t