From d795d9f39cf73a79fd94f0cea9104cea81ff9d35 Mon Sep 17 00:00:00 2001 From: Joe TS Dell <thunyathep.s@outlook.com> Date: Thu, 22 Apr 2021 12:11:48 +0200 Subject: [PATCH] update --- public/content/paper2.json | 5 +- public/js/add_paper.js | 109 +++++++++++++++++++------------------ public/js/search.js | 9 +-- 3 files changed, 62 insertions(+), 61 deletions(-) diff --git a/public/content/paper2.json b/public/content/paper2.json index 8be8681..fcf4881 100644 --- a/public/content/paper2.json +++ b/public/content/paper2.json @@ -634,11 +634,8 @@ "lastName": "Coors" } ], - "journal": {}, + "journal": {} - "keywords": [ - "..." - ] }, "links": {} }, diff --git a/public/js/add_paper.js b/public/js/add_paper.js index 586b9fa..bc0aa80 100644 --- a/public/js/add_paper.js +++ b/public/js/add_paper.js @@ -1,83 +1,86 @@ -function addpaper(item){ - var new_row = document.getElementById("cont_paper") +function addpaper(item) { + var new_row = document.getElementById("cont_paper") - if(item === undefined) { + if (item === undefined) { + + } else { - }else{ - var authors = ""; - for (var i = 0; i < item.item.authors.length; i++) { + 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 = ""; + // check if there is keywords in item + if ("keywords" in item.item) { + for (var i = 0; i < item.item.keywords.length; i++) { console.log(i); - authors += item.item.authors[i].lastName + ", " + item.item.authors[i].firstName.substring(0,1) + "., " + keywords += '<span class="badge badge-pill badge-light">' + item.item.keywords[i] + '</span>' //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` + 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){ + 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 + 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 - + 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` + 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="row">' + '<div class="col-md-3">' + - '<img src="' + item.item.imageLink + '" alt="..." style="width:100%">' + - '</div>'+ + '<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 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>' + + '</div>' + + '</div>' + } +} \ No newline at end of file diff --git a/public/js/search.js b/public/js/search.js index 2f5aadb..6af5163 100644 --- a/public/js/search.js +++ b/public/js/search.js @@ -77,10 +77,11 @@ $(document).ready(function(){ 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]); - } + // if(Math.abs(arrayLength - i) <= 2){ + // console.log("close to " + i) + // addpaper(stuff_paper[i]); + // } + addpaper(stuff_paper[i]); //Do something } -- GitLab