Skip to content
Snippets Groups Projects
Commit 833a5868 authored by mazenovi's avatar mazenovi
Browse files

normalise module import

parent a9fa6436
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -7,6 +7,8 @@ dblp = require("./dblp");
dissem_in = require("./dissem_in");
me = require("./me");
me.author();
// open links with default browser in app
// see also https://github.com/electron/electron/issues/1344#issuecomment-171516636
var shell = require('electron').shell;
......@@ -16,8 +18,6 @@ $(document).on('click', 'a[href^="http"]', function(event) {
shell.openExternal(this.href);
});
me.author();
$(document).on('blur', '.autosave input', function(event) {
config.update();
me.author();
......@@ -31,5 +31,5 @@ $(document).on('keypress', '.autosave input', function(event) {
});
$(document).on('click', '#halQueryBtn', function(event) {
hal($('#halQuery').val());
hal.search($('#halQuery').val());
});
......@@ -7,53 +7,55 @@
config = require('./config');
module.exports = function (query) {
module.exports = {
console.log('hal("' + query + '")');
search: function (query) {
$('#hal .docs tbody').html(
nunjucks.render('partials/doc_row_hal_progress.njk')
)
console.log('hal("' + query + '")');
$.ajax({
url: "http://api.archives-ouvertes.fr/search",
dataType:'json',
type: 'get',
data: {
"q": query,
"fl": "title_s, fileMain_s,halId_s,authLastNameFirstName_s,collCode_s,docType_s,ePublicationDate_s,journalDate_s,producedDate_s,submittedDate_s,releasedDate_s,writingDate_s,authIdHal_i", // why? authIdHal_s,authOrcidIdExt_id",
"sort": "submittedDate_s desc"
},
success:function(data){
console.log(data);
if(data.response.docs.length){
console.log('update rows tpl');
$('#hal .docs tbody').html(
data.response.docs.reduce(function(docs, curr, ind, arr){
if(ind == 1) {
docs = nunjucks.render(
$('#hal .docs tbody').html(
nunjucks.render('partials/doc_row_hal_progress.njk')
)
$.ajax({
url: "http://api.archives-ouvertes.fr/search",
dataType:'json',
type: 'get',
data: {
"q": query,
"fl": "title_s, fileMain_s,halId_s,authLastNameFirstName_s,collCode_s,docType_s,ePublicationDate_s,journalDate_s,producedDate_s,submittedDate_s,releasedDate_s,writingDate_s,authIdHal_i", // why? authIdHal_s,authOrcidIdExt_id",
"sort": "submittedDate_s desc"
},
success:function(data){
console.log(data);
if(data.response.docs.length){
console.log('update rows tpl');
$('#hal .docs tbody').html(
data.response.docs.reduce(function(docs, curr, ind, arr){
if(ind == 1) {
docs = nunjucks.render(
'partials/doc_row_hal.njk', {
elt: arr[ind-1],
regExp: new RegExp(config.collection, 'g')
}
);
}
return docs += nunjucks.render(
'partials/doc_row_hal.njk', {
elt: arr[ind-1],
elt: curr,
regExp: new RegExp(config.collection, 'g')
}
);
}
return docs += nunjucks.render(
'partials/doc_row_hal.njk', {
elt: curr,
regExp: new RegExp(config.collection, 'g')
}
);
})
);
$('#hal .count').html(data.response.numFound + " docs found (" + data.response.docs.length + " displayed)", "");
}
else {
// comprends pas
console.log('delete rows tpl');
$('#hal .docs tbody').html("");
$('#hal .count').html(" 0 docs found (0 displayed)");
})
);
$('#hal .count').html(data.response.numFound + " docs found (" + data.response.docs.length + " displayed)", "");
}
else {
console.log('delete rows tpl');
$('#hal .docs tbody').html("");
$('#hal .count').html(" 0 docs found (0 displayed)");
}
}
}
});
});
}
};
......@@ -54,8 +54,8 @@ module.exports = {
}
});
},
halUpdateShow: function(hal_id) {
hal("authIdHal_i:" + hal_id );
halTabUpdateAndShow: function(hal_id) {
hal.search("authIdHal_i:" + hal_id );
$('#halQuery').val("authIdHal_i:" + hal_id);
$('#search a[href="#hal"]').tab('show');
}
......@@ -81,7 +81,7 @@ function docsByHalId(hal_id) {
$('.numFound-' + hal_id).html(
data.response.numFound
+ " <a href=\"https://hal.archives-ouvertes.fr/search/index/?qa[authIdHal_i][]=" + hal_id + "\"><i class=\"fa fa-link\"></i></a>"
+ " <a onClick=\"me.halUpdateShow(" + hal_id + ")\"><i class=\"fa fa-chevron-circle-right\" aria-hidden=\"true\"></i></a>"
+ " <a onClick=\"me.halTabUpdateAndShow(" + hal_id + ")\"><i class=\"fa fa-chevron-circle-right\" aria-hidden=\"true\"></i></a>"
);
},
error:function(err) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment