diff --git a/.gitignore b/.gitignore index c2b33f1..edfa0eb 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ package-lock.json .DS_Store -dist/ \ No newline at end of file +dist/ +/.idea diff --git a/docs/assets/js/hal-wordcloud.js b/docs/assets/js/hal-wordcloud.js index 453b0b4..b00afc8 100644 --- a/docs/assets/js/hal-wordcloud.js +++ b/docs/assets/js/hal-wordcloud.js @@ -7,7 +7,7 @@ function init_wordcloud(container, debug) { container.appendChild(spinner); } -function HALwordcloud(hal_wordcloud_div, debug) { +function HALwordcloud(hal_wordcloud_div, idhal, debug) { if (debug) { console.log(globalHalData); } @@ -50,14 +50,14 @@ function HALwordcloud(hal_wordcloud_div, debug) { var word = Object.keys(wordFreq)[suffle[i]]; var freq = Object.values(wordFreq)[suffle[i]]; var new_freq = (9 * freq + max - 10 * min) / (max - min); - wordcloud_container.appendChild(keywordElement(word, new_freq)); + wordcloud_container.appendChild(keywordElement(word, idhal, new_freq)); }; hal_wordcloud_div.appendChild(wordcloud_container); document.getElementById("hal-wordcloud-spinner").style.display = "none"; } -function keywordElement(keyw, freq) { +function keywordElement(keyw, idhal, freq) { var container = document.createElement("a"); container.classList = "keyword keyword-" + freq; container.setAttribute("href", "https://hal.science/search/?q=*&authIdHal_s=" + idhal + "&keyword_s=" + keyw); @@ -99,6 +99,6 @@ document.addEventListener("halMainDone", () => { console.log(hal_wordcloud_div); } - HALwordcloud(hal_wordcloud_div, debug); + HALwordcloud(hal_wordcloud_div,hal_integrator_config["id"], debug); } }); diff --git a/docs/assets/js/hal.js b/docs/assets/js/hal.js index f4e1eec..e6a860c 100644 --- a/docs/assets/js/hal.js +++ b/docs/assets/js/hal.js @@ -70,6 +70,11 @@ const hal_helpers = { "title_en": "Lectures", }, + "PATENT": { + "icon": "fa-lightbulb", + "title_en": "Patents", + }, + "SOFTWARE": { "icon": "fa-microchip", "title_en": "Softwares", @@ -155,6 +160,7 @@ function initialHTML(type) { container.id = `hal-${type}`; const button = document.createElement("button"); + button.id=`hal-btn-${type}`; button.classList.add("hal-btn"); button.setAttribute("data-target", `#${type}`); @@ -343,7 +349,10 @@ async function genListPubli(id, type, debug = false) { // Remove loader document.getElementById("hal-" + type + "-spinner").style.display = "none"; document.getElementById("hal-" + type).style.display = "block"; - + if(hal_integrator_config["onLoad"].toLowerCase() === "collapsed"){ + document.getElementById(type).style.display = "none"; + document.getElementById("hal-btn-" + type).querySelector(".icon-drop_down").classList.add("fa-rotate-by"); + } // Update mathjax MathJax.typeset([document.getElementById(type)]); diff --git a/docs/pages/demo.html b/docs/pages/demo.html index 12a4757..fb31b8f 100644 --- a/docs/pages/demo.html +++ b/docs/pages/demo.html @@ -100,6 +100,13 @@ +
@@ -140,6 +147,7 @@ // Reset variables hal_integrator_config = { "id": "", + "onLoad":"collapsed", "typeList": [], "doit": true, "debug": false, @@ -182,6 +190,11 @@ hal_integrator_config["plugins"]["wordcloud"]["doit"] = false; } + if (form.querySelector("#toggle-display").checked) { + hal_integrator_config["onLoad"] = "collapsed"; + } else { + hal_integrator_config["onLoad"] = "expanded"; + } if (form.querySelector("#toggle-artdat").checked) { hal_integrator_config["plugins"]["artscore"]["doit"] = true; } else { diff --git a/src/js/hal_publications.js b/src/js/hal_publications.js index 5dc9d7a..a2ae83c 100644 --- a/src/js/hal_publications.js +++ b/src/js/hal_publications.js @@ -40,6 +40,7 @@ function initialHTML(type) { container.id = `hal-${type}`; const button = document.createElement("button"); + button.id=`hal-btn-${type}`; button.classList.add("hal-btn"); button.setAttribute("data-target", `#${type}`); @@ -228,6 +229,10 @@ async function genListPubli(id, type, debug = false) { // Remove loader document.getElementById("hal-" + type + "-spinner").style.display = "none"; document.getElementById("hal-" + type).style.display = "block"; + if(hal_integrator_config["onLoad"].toLowerCase() === "collapsed"){ + document.getElementById(type).style.display = "none"; + document.getElementById("hal-btn-" + type).querySelector(".icon-drop_down").classList.add("fa-rotate-by"); + } // Update mathjax MathJax.typeset([document.getElementById(type)]); diff --git a/src/js/hal_utils.js b/src/js/hal_utils.js index a5d2c31..e8ad0ab 100644 --- a/src/js/hal_utils.js +++ b/src/js/hal_utils.js @@ -37,6 +37,11 @@ export const hal_helpers = { "title_en": "Lectures", }, + "PATENT": { + "icon": "fa-lightbulb", + "title_en": "Patents", + }, + "SOFTWARE": { "icon": "fa-microchip", "title_en": "Softwares",