From 576b382f4f7a24111afc0e8b53b401560f2abce4 Mon Sep 17 00:00:00 2001 From: Patrick <patrick.wuerstle@gmx.de> Date: Fri, 12 Mar 2021 15:05:17 +0100 Subject: [PATCH] update Paper again --- public/content/paper.json | 164 ++++++++++++++++++++++++++++++++++++++ public/content/team.json | 0 public/css/search.css | 6 +- public/index.html | 32 +++++--- public/js/add_content.js | 6 +- public/js/add_paper.js | 83 +++++++++++++++++++ public/js/search.js | 77 +++++++++++++++++- 7 files changed, 356 insertions(+), 12 deletions(-) create mode 100644 public/content/paper.json create mode 100644 public/content/team.json create mode 100644 public/js/add_paper.js diff --git a/public/content/paper.json b/public/content/paper.json new file mode 100644 index 0000000..1d6828a --- /dev/null +++ b/public/content/paper.json @@ -0,0 +1,164 @@ +[ + { + "item": { + "title": "3D SAFE ROUTING NAVIGATION APPLICATION FOR PEDESTRIANS AND CYCLISTS BASED ON OPEN SOURCE TOOLS", + "project": "Hackathon", + "authors": [ + { + "firstName": "T", + "lastName": "Santhanavanich." + },{ + "firstName": "P", + "lastName": "Wuerstle" + },{ + "firstName": "J", + "lastName": "Silberer" + },{ + "firstName": "V", + "lastName": "Loidl" + },{ + "firstName": "P", + "lastName": "Rodrigues" + },{ + "firstName": "V", + "lastName": "Coors" + } + ], + "imageLink":"imgs/publication/3droute.jpg", + "keywords":["CityGML","SensorThings API","Open Geospatial Consortium","pgRouting","Warning"], + "journal": { + "name":"ISPRS Annals of Photogrammetry, Remote Sensing & Spatial Information Sciences", + "volume":"VI-4/W2-2020", + "year":"2020", + "pages":"143-147" + }, + "DOI":"https://doi.org/10.5194/isprs-annals-VI-4-W2-2020-143-2020" + }, + "links": { + "pdf":"", + "url": "https://www.isprs-ann-photogramm-remote-sens-spatial-inf-sci.net/VI-4-W2-2020/143/2020/", + "demo": "https://m4lab.hft-stuttgart.de/partizipation/" + } + }, + { + "item": { + "title": "3D SAFE ROUTING NAVIGATION APPLICATION FOR PEDESTRIANS AND CYCLISTS BASED ON OPEN SOURCE TOOLS", + "project": "Hackathon", + "authors": [ + { + "firstName": "T", + "lastName": "Santhanavanich." + },{ + "firstName": "P", + "lastName": "Wuerstle" + },{ + "firstName": "J", + "lastName": "Silberer" + },{ + "firstName": "V", + "lastName": "Loidl" + },{ + "firstName": "P", + "lastName": "Rodrigues" + },{ + "firstName": "V", + "lastName": "Coors" + } + ], + "imageLink":"imgs/publication/3droute.jpg", + "keywords":["CityGML","SensorThings API","Open Geospatial Consortium","pgRouting","Warning"], + "journal": { + "name":"ISPRS Annals of Photogrammetry, Remote Sensing & Spatial Information Sciences", + "volume":"VI-4/W2-2020", + "year":"2020", + "pages":"143--147" + }, + "DOI":"https://doi.org/10.5194/isprs-annals-VI-4-W2-2020-143-2020" + }, + "links": { + "pdf":"", + "url": "https://www.isprs-ann-photogramm-remote-sens-spatial-inf-sci.net/VI-4-W2-2020/143/2020/", + "demo": "https://m4lab.hft-stuttgart.de/partizipation/" + } + }, + { + "item": { + "title": "3D SAFE ROUTING NAVIGATION APPLICATION FOR PEDESTRIANS AND CYCLISTS BASED ON OPEN SOURCE TOOLS", + "project": "Hackathon", + "authors": [ + { + "firstName": "T", + "lastName": "Santhanavanich." + },{ + "firstName": "P", + "lastName": "Wuerstle" + },{ + "firstName": "J", + "lastName": "Silberer" + },{ + "firstName": "V", + "lastName": "Loidl" + },{ + "firstName": "P", + "lastName": "Rodrigues" + },{ + "firstName": "V", + "lastName": "Coors" + } + ], + "imageLink":"imgs/publication/3droute.jpg", + "keywords":["CityGML","SensorThings API","Open Geospatial Consortium","pgRouting","Warning"], + "journal": { + "name":"ISPRS Annals of Photogrammetry, Remote Sensing & Spatial Information Sciences", + "volume":"VI-4/W2-2020", + "year":"2020", + "pages":"143--147" + }, + "DOI":"https://doi.org/10.5194/isprs-annals-VI-4-W2-2020-143-2020" + }, + "links": { + "pdf":"", + "url": "https://www.isprs-ann-photogramm-remote-sens-spatial-inf-sci.net/VI-4-W2-2020/143/2020/" + + } + }, + { + "item": { + "title": "TEST 3D SAFE ROUTING NAVIGATION APPLICATION FOR PEDESTRIANS AND CYCLISTS BASED ON OPEN SOURCE TOOLS", + "project": "Hackathon", + "authors": [ + { + "firstName": "T", + "lastName": "Santhanavanich." + },{ + "firstName": "P", + "lastName": "Wuerstle" + },{ + "firstName": "J", + "lastName": "Silberer" + },{ + "firstName": "V", + "lastName": "Loidl" + },{ + "firstName": "P", + "lastName": "Rodrigues" + },{ + "firstName": "V", + "lastName": "Coors" + } + ], + "imageLink":"imgs/publication/3droute.jpg", + "keywords":["CityGML","SensorThings API","Open Geospatial Consortium","pgRouting","Warning"], + "conference":{ + "name":"Test", + "date":"20.03.2020" + }, + "DOI":"https://doi.org/10.5194/isprs-annals-VI-4-W2-2020-143-2020" + }, + "links": { + "url": "https://www.isprs-ann-photogramm-remote-sens-spatial-inf-sci.net/VI-4-W2-2020/143/2020/", + "demo": "https://m4lab.hft-stuttgart.de/partizipation/" + } + } +] + diff --git a/public/content/team.json b/public/content/team.json new file mode 100644 index 0000000..e69de29 diff --git a/public/css/search.css b/public/css/search.css index f719760..844b6dc 100644 --- a/public/css/search.css +++ b/public/css/search.css @@ -142,4 +142,8 @@ body { left: 0px; top: 10px; } - \ No newline at end of file + + .linesearch { + display: flex; /* equal height of the children */ + } + \ No newline at end of file diff --git a/public/index.html b/public/index.html index 5a20f39..5dcd1d1 100644 --- a/public/index.html +++ b/public/index.html @@ -129,9 +129,22 @@ </div> --> <hr> <div class="container"> - <h2 id="rgc_publication"><i class="fas fa-book"></i> Our Publication</h2> - <p id="rgc_publicationdesc" class="grey-text w-responsive mx-auto mb-5">Our Publication ...</p> - + <div class="linesearch" style="width:100%"> + <div class="col-md-4"> + <h2 id="rgc_publication"><i class="fas fa-book"></i> Our Publication</h2> + <p id="rgc_publicationdesc" class="grey-text w-responsive mx-auto mb-5">Our Publication ...</p> + </div> + <div class="col-md-5"></div> + <div class="col-md-4" style="float:right"> + <div class="search-wrapper"> + <div class="input-holder"> + <input type="text" id="search-input_paper" class="search-input" placeholder="Type to search" /> + <button id="search-button_paper" class="search-icon" onclick="searchToggle_paper(this, event);"><span></span></button> + </div> + <span class="close" onclick="searchToggle_paper(this, event);"></span> + </div> + </div> + </div> <!-- <li> Silberer, J., Santhanavanich, T., Müller, P., & Bäumer, T. (2020). Promoting Objective and Subjective Safety for Cyclists in Metropolitan Areas. In Innovations for Metropolitan Areas (pp. 273–284). Springer Berlin Heidelberg. https://doi.org/10.1007/978-3-662-60806-7_21 @@ -155,8 +168,8 @@ <li>...</li> </div> - <div class="container"> - <div class="card" style="max-width: 1080px;"> + <div class="container" id="cont_paper"> + <!-- <div class="card" style="max-width: 1080px;"> <div class="row"> <div class="col-md-3"> <img src="imgs/publication/3droute.jpg" alt="..." style="width:100%"> @@ -178,9 +191,9 @@ </div> </div> </div> - </div> + </div> --> - <div class="card" style="max-width: 1080px;"> + <!-- <div class="card" style="max-width: 1080px;"> <div class="row"> <div class="col-md-9"> @@ -204,7 +217,7 @@ <img src="imgs/publication/3droute.jpg" alt="..." style="width:100%"> </div> </div> - </div> + </div> --> <div class="card" style="max-width: 1080px;"> <div class="row"> <div class="col-md-3"> @@ -384,6 +397,7 @@ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/0.8.2/css/flag-icon.min.css"> <script src="js/language.js"></script> <script src="js/add_content.js"></script> + <script src="js/add_paper.js"></script> <!-- search library --> <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/fuse.js/dist/fuse.js"></script> @@ -398,4 +412,4 @@ </body> -</html> +</html> \ No newline at end of file diff --git a/public/js/add_content.js b/public/js/add_content.js index df50bf9..639f80b 100644 --- a/public/js/add_content.js +++ b/public/js/add_content.js @@ -1,6 +1,10 @@ function addcontent(item){ var new_row = document.getElementById("row_main") + if(item === undefined) { + }else{ + + // Prepare YouTube Link // var array_contains_youtube = true var YouTubeHTML = '' @@ -40,6 +44,6 @@ function addcontent(item){ '</div>' + '</div>' + '</div>' - +} } diff --git a/public/js/add_paper.js b/public/js/add_paper.js new file mode 100644 index 0000000..586b9fa --- /dev/null +++ b/public/js/add_paper.js @@ -0,0 +1,83 @@ +function addpaper(item){ + var new_row = document.getElementById("cont_paper") + + if(item === undefined) { + + }else{ + + var authors = ""; + for (var i = 0; i < item.item.authors.length; i++) { + console.log(i); + authors += item.item.authors[i].lastName + ", " + item.item.authors[i].firstName.substring(0,1) + "., " + //Do something + } + var keywords = ""; + for (var i = 0; i < item.item.keywords.length; i++) { + console.log(i); + keywords += '<span class="badge badge-pill badge-light">'+ item.item.keywords[i] +'</span>' + //Do something + } + authors = authors.substring(0, authors.length - 2); + // Prepare YouTube Link + // var array_contains_youtube = true + var YouTubeHTML = '' + if ('pdf' in item.links) { // to be replaced by if (item.YouTubelink) or so... + var YouTubelink = item.links.youtube // to be replaced by item.YouTubelink or so... + YouTubeHTML = `<button type="button" href="${YouTubelink}" class="btn btn-outline-info btn-circle"> <i class="fas fa-globe"></i> </button>Link` + } + // Do Authors and Keywords + var doi + if ('journal' in item.item){ + doi = '<small class="text-muted"> ' + item.item.journal.name + ',' + + item.item.journal.volume + ', ' + item.item.journal.pages + ', '+ item.item.DOI + } + if ('conference' in item.item){ + doi = '<small class="text-muted"> ' + item.item.conference.name + ',' + item.item.conference.date + ', '+ item.item.DOI + + } + // Prepare Explore Link + // var array_contains_explore_link = true + var ExploreHTML = '' + if ('demo' in item.links) { // to be replaced by if (item.YouTubelink) or so... + var ExploreLink = item.links.demo // to be replaced by item.ExploreLink or so... + ExploreHTML = `<button type="button" href="${ExploreLink}" class="btn btn-outline-success btn-circle"> <i class="far fa-file-pdf"> </i></button>PDF` + } + + new_row.innerHTML = new_row.innerHTML + '<div class="card" style="max-width: 1080px;">' + + '<div class="row">' + + '<div class="col-md-3">' + + '<img src="' + item.item.imageLink + '" alt="..." style="width:100%">' + + '</div>'+ + '<div class="col-md-9">' + + '<div class="card-body">' + + '<h5 class="card-title" style="margin-bottom:0px">' + + '<small>'+ authors +'</small>' + + '<br>' + + item.item.title + + '<br>' + + '<small>' + + keywords + + '</small>' + + '</h5>' + + doi + + '<br>' + + ExploreHTML + + '<button type="button" class="btn btn-outline-danger btn-circle" data-toggle="collapse" data-target="#bibtex-paper-vision" aria-expanded="false" aria-controls="bibtex-paper-vision"> <i class="fas fa-code"></i> </button>BIB' + + YouTubeHTML + + '</small>' + + '<pre id="bibtex-paper-vision" class="pre-style collapse">@article{santhanavanich20203d,' + + 'title={3D SAFE ROUTING NAVIGATION APPLICATION FOR PEDESTRIANS AND CYCLISTS BASED ON OPEN SOURCE TOOLS.},' + + 'author={Santhanavanich, T and Wuerstle, P and Silberer, J and Loidl, V and Rodrigues, P and Coors, V},' + + 'journal={ISPRS Annals of Photogrammetry, Remote Sensing \& Spatial Information Sciences},' + + 'volume={6},' + + 'year={2020}' + + '}' + + '}</pre>' + + '</div>' + + '</div>' + + '</div>' + + '</div>' + + } +} + diff --git a/public/js/search.js b/public/js/search.js index ca6c01b..faaff1a 100644 --- a/public/js/search.js +++ b/public/js/search.js @@ -6,9 +6,16 @@ const options = { keys: ["item.title","item.keywords", "item.author.firstName", "item.author.lastName"] } +const options_paper = { + includeScore: true, + // Search in `author` and in `tags` array + keys: ["item.title","item.keywords", + "item.author.firstName", "item.author.lastName"] +} // start search var searchanswer +var searchanswer_paper function search(){ const fuse = new Fuse(stuff, options); searchanswer = fuse.search(document.getElementById("search-input").value) @@ -23,10 +30,24 @@ function search(){ // alert(searchanswer); console.log(searchanswer); } - +function search_paper(){ + const fuse = new Fuse(stuff_paper, options); + searchanswer_paper = fuse.search(document.getElementById("search-input_paper").value) + + var new_row = document.getElementById("cont_paper") + new_row.innerHTML = ""; + var searchLength = searchanswer_paper.length; + for (var i = 0; i < searchLength; i++) { + addpaper(searchanswer_paper[i].item); + //Do something + } + // alert(searchanswer); + console.log(searchanswer_paper); +} //get json // --- can be adapted if we load the content from the json var stuff = [] +var stuff_paper = [] // $.getJSON("./content/content.json", function(result){ // stuff = result; // var new_row = document.getElementById("row_main") @@ -49,6 +70,21 @@ $(document).ready(function(){ //Do something } }); + $.getJSON("./content/paper.json", function(result){ + stuff_paper = result; + var new_row = document.getElementById("cont_paper") + new_row.innerHTML = ""; + var arrayLength = stuff_paper.length; + for (var i = 0; i < arrayLength; i++) { + + if(Math.abs(arrayLength - i) <= 2){ + console.log("close to " + i) + addpaper(stuff_paper[i]); + } + + //Do something + } + }); var userLang = navigator.language || navigator.userLanguage; console.log("The language is: " + userLang); if (userLang.includes("de")){ @@ -94,6 +130,36 @@ function searchToggle(obj, evt){ // addcontent(); } } +function searchToggle_paper(obj, evt){ + console.log("arrive") + var container = $(obj).closest('.search-wrapper'); + if(!container.hasClass('active')){ + container.addClass('active'); + evt.preventDefault(); + console.log("first") + } + else if(container.hasClass('active') && $(obj).closest('.input-holder').length == 0){ + container.removeClass('active'); + // clear input + console.log("second") + var new_row = document.getElementById("cont_paper") + new_row.innerHTML = ""; + var arrayLength = stuff_paper.length; + for (var i = 0; i < arrayLength; i++) { + if(Math.abs(arrayLength - i) <= 2){ + console.log("close to " + i) + addpaper(stuff_paper[i]); + } + + //Do something + } + container.find('#search-input_paper').val(''); + } else { + console.log("search") + search_paper(); + // addcontent(); + } +} // search on enter var input = document.getElementById("search-input"); @@ -103,4 +169,13 @@ input.addEventListener("keyup", function(event) { document.getElementById("search-button").click(); } +}); + +var input = document.getElementById("search-input_paper"); +input.addEventListener("keyup", function(event) { + if (event.keyCode === 13) { + event.preventDefault(); + + document.getElementById("search-button_paper").click(); + } }); \ No newline at end of file -- GitLab