Commit b92a6cd3 authored by Maxime Chaillet's avatar Maxime Chaillet

Merge branch 'master' into 'issue22'

# Conflicts:
#   www/min/doi.min.js
parents 61d38293 680d6478
Pipeline #2153 failed with stages
......@@ -25,8 +25,9 @@ module.exports = function(grunt) {
'bower_components/jquery/dist/jquery.js',
'bower_components/bootstrap/dist/js/bootstrap.js',
'bower_components/dustjs-linkedin/dist/dust-full.min.js',
'bower_components/dustjs-helpers/dist/dust-helpers.min.js' ],
'min/doi.min.js': [
'bower_components/dustjs-helpers/dist/dust-helpers.min.js',
'bower_components/lodash/dist/lodash.min.js' ],
'min/doi.min.js': [
'src/*js']
}
}
......@@ -77,6 +78,6 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-css');
grunt.loadNpmTasks('grunt-include-source');
grunt.registerTask('default', ['jshint', 'dustjs', 'uglify', 'cssmin', 'wiredep:prod']);
grunt.registerTask('default', ['jshint', 'dustjs', 'uglify', 'cssmin']);
grunt.registerTask('dev', ['jshint', 'includeSource:dev', 'dustjs', 'cssmin', 'wiredep:dev']);
};
......@@ -28,6 +28,7 @@
"jquery": "^3.2.1",
"dustjs-linkedin": "^2.7.5",
"bootstrap": "^3.3.7",
"dustjs-helpers": "^1.7.3"
"dustjs-helpers": "^1.7.3",
"lodash": "^4.17.5"
}
}
......@@ -22,6 +22,7 @@
<script src="bower_components/dustjs-linkedin/dist/dust-full.min.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script src="bower_components/dustjs-helpers/dist/dust-helpers.min.js"></script>
<script src="bower_components/lodash/lodash.js"></script>
<!-- endbower -->
<!-- Using grunt-include-source, the proper all dustjs templates files (not minified are included below -->
......
......@@ -13,16 +13,10 @@
<script src="/min/doi.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var params = new URLSearchParams(document.location.search.substring(1));
var doi;
if (params.get("DOI")){
doi = params.get("DOI");
}
else{
doi = document.location.pathname.substring(1,document.location.pathname.length )
}
new DOIController(new DOIView()).getData(doi);
$(document).ready(function() {
// retrieve the doi code from an url of the format http://doi.esrf.fr/prefix/suffix
var doi = document.location.pathname.substring(1);
new DOIController(new DOIView()).getData(doi);
});
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -81,7 +81,7 @@ DOIController.prototype.getData = function(doi) {
// return false otherwise
DOIController.prototype.hasAcceptedPrefix = function(doi) {
var prefix = doi.split('/')[0];
return this.acceptedPrefix.includes(prefix);
return (_.findIndex(this.acceptedPrefix, function(o){ return prefix==o; }) != -1);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment