Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
UGL
website
Commits
91cf0427
Commit
91cf0427
authored
Jun 22, 2021
by
Joe TS Dell
Browse files
conditional text
parent
a04c44c0
Changes
4
Hide whitespace changes
Inline
Side-by-side
public/content/Citation Sheet2.xlsx
0 → 100644
View file @
91cf0427
File added
public/js/add_paper.js
View file @
91cf0427
var
item_debug
function
addpaper
(
item
)
{
var
new_row
=
document
.
getElementById
(
"
cont_paper
"
)
if
(
item
===
undefined
)
{
}
else
{
item_debug
=
item
var
authors
=
""
;
for
(
var
i
=
0
;
i
<
item
.
item
.
authors
.
length
;
i
++
)
{
authors
+=
item
.
item
.
authors
[
i
].
lastName
+
"
,
"
+
item
.
item
.
authors
[
i
].
firstName
.
substring
(
0
,
1
)
+
"
.,
"
...
...
@@ -23,7 +24,7 @@ function addpaper(item) {
last_item
=
item
var
PDF_HTML
=
''
if
(
'
pdf
'
in
item
.
links
)
{
// to be replaced by if (item.YouTubelink) or so...
var
pdf_link
=
item
.
links
.
pdf
// to be replaced by item.pdf_link or so...
PDF_HTML
=
`<a type="button" href="
${
pdf_link
}
" class="btn btn-outline-success btn-circle" target="_blank"> <i class="far fa-file-pdf"> </i></a> PDF `
}
...
...
@@ -34,16 +35,24 @@ function addpaper(item) {
UrlHTML
=
`<a type="button" href="
${
url
}
" class="btn btn-outline-info btn-circle" target="_blank"> <i class="fas fa-globe"></i> </a> Link `
}
// Do Authors and Keywords
var
doi
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
doi
+=
'
<small class="text-muted">
'
doi
+=
item
.
item
.
conference
.
name
&&
item
.
item
.
journal
.
name
!=
""
?
item
.
item
.
journal
.
name
+
'
'
:
""
doi
+=
item
.
item
.
conference
.
volume
&&
item
.
item
.
journal
.
volume
!=
""
?
item
.
item
.
journal
.
volume
+
'
'
:
""
doi
+=
item
.
item
.
conference
.
pages
&&
item
.
item
.
journal
.
pages
!=
""
?
item
.
item
.
journal
.
pages
+
'
'
:
""
doi
+=
item
.
item
.
conference
.
DOI
&&
item
.
item
.
DOI
!=
""
&&
item
.
item
.
DOI
!=
undefined
?
item
.
item
.
journal
.
DOI
+
'
'
:
""
doi
+=
`</small>`
}
if
(
'
conference
'
in
item
.
item
)
{
doi
=
'
<small class="text-muted">
'
+
item
.
item
.
conference
.
name
+
'
,
'
+
item
.
item
.
conference
.
date
+
'
,
'
+
item
.
item
.
DOI
doi
+=
'
<small class="text-muted">
'
doi
+=
item
.
item
.
conference
.
name
&&
item
.
item
.
conference
.
name
!=
""
?
item
.
item
.
conference
.
name
+
'
'
:
""
doi
+=
item
.
item
.
conference
.
date
&&
item
.
item
.
conference
.
date
!=
""
?
item
.
item
.
conference
.
date
+
'
'
:
""
doi
+=
item
.
item
.
conference
.
DOI
&&
item
.
item
.
conference
.
DOI
!=
""
?
item
.
item
.
conference
.
DOI
+
'
'
:
""
doi
+=
`</small>`
}
new_row
.
innerHTML
=
new_row
.
innerHTML
+
'
<div class="card" style="max-width: 1080px;">
'
+
'
<div class="row publication_card g-0">
'
+
...
...
@@ -63,10 +72,10 @@ function addpaper(item) {
'
</h5>
'
+
doi
+
'
<br>
'
+
PDF_HTML
+
'
'
+
PDF_HTML
+
'
'
+
//BIBTEX BUTTON
// '<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' +
UrlHTML
+
'
</small>
'
+
...
...
public/js/citationSheetParse.js
View file @
91cf0427
...
...
@@ -117,25 +117,25 @@ xmlHttpRequest.onload = function (e) {
}
item
[
"
item
"
].
title
=
jsonOutput
[
i
].
Titel
;
item
[
"
item
"
].
project
=
jsonOutput
[
i
].
Project
;
item
[
"
item
"
].
imageLink
=
jsonOutput
[
i
][
"
Path to demo image
"
]
item
[
"
item
"
].
journal
.
name
=
jsonOutput
[
i
].
Journal
;
item
[
"
item
"
].
journal
.
volume
=
jsonOutput
[
i
].
Volume
;
item
[
"
item
"
].
journal
.
year
=
jsonOutput
[
i
].
Year
;
item
[
"
item
"
].
journal
.
pages
=
jsonOutput
[
i
].
Pages
;
item
[
"
item
"
].
conference
.
name
=
jsonOutput
[
i
].
Conference
;
item
[
"
item
"
].
conference
.
place
=
jsonOutput
[
i
][
"
City and Country
"
]
item
[
"
item
"
].
conference
.
date
=
jsonOutput
[
i
].
Date
;
item
[
"
item
"
].
publisher
=
jsonOutput
[
i
].
Publisher
;
item
[
"
item
"
].
type
=
jsonOutput
[
i
][
"
Type of Work
"
]
;
item
[
"
item
"
].
project
=
jsonOutput
[
i
].
Project
;
item
[
"
item
"
].
reviewed
=
jsonOutput
[
i
][
"
Peer-Reviewed
"
]
;
item
[
"
item
"
].
open
=
jsonOutput
[
i
][
"
Open Access
"
]
;
item
[
"
item
"
].
DOI
=
jsonOutput
[
i
].
DOI
;
item
[
"
links
"
].
pdf
=
jsonOutput
[
i
].
PDF_Link
;
item
[
"
links
"
].
url
=
jsonOutput
[
i
].
URL
;
item
[
"
links
"
].
demo
=
jsonOutput
[
i
].
Demo
;
item
[
"
item
"
].
project
=
jsonOutput
[
i
].
Project
?
jsonOutput
[
i
].
Project
:
""
item
[
"
item
"
].
imageLink
=
jsonOutput
[
i
][
"
Path to demo image
"
]
?
jsonOutput
[
i
][
"
Path to demo image
"
]
:
""
item
[
"
item
"
].
journal
.
name
=
jsonOutput
[
i
].
Journal
?
jsonOutput
[
i
].
Journal
:
""
item
[
"
item
"
].
journal
.
volume
=
jsonOutput
[
i
].
Volume
?
jsonOutput
[
i
].
Volume
:
""
item
[
"
item
"
].
journal
.
year
=
jsonOutput
[
i
].
Year
?
jsonOutput
[
i
].
Year
:
""
item
[
"
item
"
].
journal
.
pages
=
jsonOutput
[
i
].
Pages
?
jsonOutput
[
i
].
Pages
:
""
item
[
"
item
"
].
conference
.
name
=
jsonOutput
[
i
].
Conference
?
jsonOutput
[
i
].
Conference
:
""
item
[
"
item
"
].
conference
.
place
=
jsonOutput
[
i
][
"
City and Country
"
]
?
jsonOutput
[
i
][
"
City and Country
"
]
:
""
item
[
"
item
"
].
conference
.
date
=
jsonOutput
[
i
].
Date
?
jsonOutput
[
i
].
Date
:
""
item
[
"
item
"
].
publisher
=
jsonOutput
[
i
].
Publisher
?
jsonOutput
[
i
].
Publisher
:
""
item
[
"
item
"
].
type
=
jsonOutput
[
i
][
"
Type of Work
"
]
?
jsonOutput
[
i
][
"
Type of Work
"
]
:
""
item
[
"
item
"
].
project
=
jsonOutput
[
i
].
Project
?
jsonOutput
[
i
].
Project
:
""
item
[
"
item
"
].
reviewed
=
jsonOutput
[
i
][
"
Peer-Reviewed
"
]
?
jsonOutput
[
i
][
"
Peer-Reviewed
"
]
:
""
item
[
"
item
"
].
open
=
jsonOutput
[
i
][
"
Open Access
"
]
?
jsonOutput
[
i
][
"
Open Access
"
]
:
""
item
[
"
item
"
].
DOI
=
jsonOutput
[
i
].
DOI
?
jsonOutput
[
i
].
DOI
:
""
item
[
"
links
"
].
pdf
=
jsonOutput
[
i
].
PDF_Link
?
jsonOutput
[
i
].
PDF_Link
:
""
item
[
"
links
"
].
url
=
jsonOutput
[
i
].
URL
?
jsonOutput
[
i
].
URL
:
""
item
[
"
links
"
].
demo
=
jsonOutput
[
i
].
Demo
?
jsonOutput
[
i
].
Demo
:
""
var
month
=
""
;
...
...
public/js/citationSheetParse_joe.js
0 → 100644
View file @
91cf0427
//
// begining of xlsx to json coversion
//
var
jsonContent
=
[];
var
bibAuthors
=
""
;
var
bit1stAuthorLN
=
""
;
/* set up XMLHttpRequest */
var
url
=
"
./content/CitationSheet_June.xlsx
"
;
var
xmlHttpRequest
=
new
XMLHttpRequest
();
xmlHttpRequest
.
open
(
"
GET
"
,
url
,
true
);
xmlHttpRequest
.
responseType
=
"
arraybuffer
"
;
xmlHttpRequest
.
onload
=
function
(
e
)
{
var
arraybuffer
=
xmlHttpRequest
.
response
;
// convert data to binary string //
var
data
=
new
Uint8Array
(
arraybuffer
);
var
arr
=
new
Array
();
for
(
var
i
=
0
;
i
!=
data
.
length
;
++
i
)
arr
[
i
]
=
String
.
fromCharCode
(
data
[
i
]);
var
bstr
=
arr
.
join
(
""
);
// Call XLSX //
var
workbook
=
XLSX
.
read
(
bstr
,
{
type
:
"
binary
"
});
// DO SOMETHING WITH workbook HERE //
var
first_sheet_name
=
workbook
.
SheetNames
[
0
];
// Get worksheet //
var
worksheet
=
workbook
.
Sheets
[
first_sheet_name
];
var
jsonOutput
=
XLSX
.
utils
.
sheet_to_json
(
worksheet
);
// console.log(jsonOutput);
for
(
i
=
0
;
i
<
jsonOutput
.
length
;
i
++
)
{
var
authors
;
if
(
jsonOutput
[
i
].
Authors
!=
undefined
){
authors
=
jsonOutput
[
i
].
Authors
.
replace
(
"
and
"
,
""
).
trim
().
split
(
"
,
"
);
}
var
bibAuthors
;
var
item
=
{
"
item
"
:
{
"
title
"
:
""
,
"
project
"
:
""
,
"
authors
"
:
[],
"
imageLink
"
:
""
,
"
keywords
"
:
""
,
"
journal
"
:
{
"
name
"
:
"
journal
"
,
"
volume
"
:
""
,
"
year
"
:
""
,
"
pages
"
:
""
},
"
conference
"
:{
"
name
"
:
""
,
"
place
"
:
""
,
"
date
"
:
""
},
"
DOI
"
:
""
,
"
publisher
"
:
""
,
"
type
"
:
""
,
"
project
"
:
""
,
"
reviewed
"
:
""
,
"
open
"
:
""
},
"
links
"
:
{
"
pdf
"
:
""
,
"
url
"
:
""
,
"
demo
"
:
""
},
"
bibtex
"
:
""
}
bibAuthors
=
""
;
bit1stAuthorLN
=
""
;
for
(
j
=
0
;
j
<
authors
.
length
;
j
++
)
{
var
author
=
{
"
firstName
"
:
""
,
"
lastName
"
:
""
}
if
(
authors
[
j
].
trim
().
split
(
"
"
).
length
==
1
)
{
author
[
"
firstName
"
]
=
authors
[
j
].
trim
().
split
(
"
.
"
)[
0
];
author
[
"
lastName
"
]
=
authors
[
j
].
trim
().
split
(
"
.
"
)[
1
];
item
[
"
item
"
].
authors
.
push
(
author
);
bibAuthors
+=
authors
[
j
].
trim
().
split
(
"
.
"
)[
1
]
+
"
,
"
+
authors
[
j
].
trim
().
split
(
"
.
"
)[
0
]
+
"
and
"
;
}
else
if
(
authors
[
j
].
trim
().
split
(
"
"
).
length
==
2
)
{
author
[
"
firstName
"
]
=
authors
[
j
].
trim
().
split
(
"
"
)[
0
];
author
[
"
lastName
"
]
=
authors
[
j
].
trim
().
split
(
"
"
)[
1
];
item
[
"
item
"
].
authors
.
push
(
author
);
bibAuthors
+=
authors
[
j
].
trim
().
split
(
"
"
)[
1
]
+
"
,
"
+
authors
[
j
].
trim
().
split
(
"
"
)[
0
]
+
"
and
"
;
}
else
if
(
authors
[
j
].
trim
().
split
(
"
"
).
length
==
3
)
{
author
[
"
firstName
"
]
=
authors
[
j
].
trim
().
split
(
"
"
)[
0
];
author
[
"
lastName
"
]
=
authors
[
j
].
trim
().
split
(
"
"
)[
2
];
item
[
"
item
"
].
authors
.
push
(
author
);
bibAuthors
+=
authors
[
j
].
trim
().
split
(
"
"
)[
2
]
+
"
,
"
+
authors
[
j
].
trim
().
split
(
"
"
)[
0
]
+
"
and
"
;
}
}
if
(
jsonOutput
[
i
].
Keywords
!=
undefined
)
{
item
[
"
item
"
].
keywords
=
jsonOutput
[
i
].
Keywords
.
split
(
"
,
"
);
}
else
{
item
[
"
item
"
].
keywords
=
jsonOutput
[
i
].
Keywords
;
}
if
(
authors
[
0
].
split
(
"
"
).
length
==
3
){
bit1stAuthorLN
=
authors
[
0
].
split
(
"
"
)[
2
];
}
else
if
(
authors
[
0
].
split
(
"
"
).
length
==
2
){
bit1stAuthorLN
=
authors
[
0
].
split
(
"
"
)[
1
];
}
else
if
(
authors
[
0
].
split
(
"
"
).
length
==
1
){
bit1stAuthorLN
=
authors
[
0
].
split
(
"
"
)[
0
];
}
item
[
"
item
"
].
title
=
jsonOutput
[
i
].
Titel
;
item
[
"
item
"
].
project
=
jsonOutput
[
i
].
Project
?
jsonOutput
[
i
].
Project
:
""
item
[
"
item
"
].
imageLink
=
jsonOutput
[
i
][
"
Path to demo image
"
]
?
jsonOutput
[
i
][
"
Path to demo image
"
]
:
""
item
[
"
item
"
].
journal
.
name
=
jsonOutput
[
i
].
Journal
?
jsonOutput
[
i
].
Journal
:
""
item
[
"
item
"
].
journal
.
volume
=
jsonOutput
[
i
].
Volume
?
jsonOutput
[
i
].
Volume
:
""
item
[
"
item
"
].
journal
.
year
=
jsonOutput
[
i
].
Year
?
jsonOutput
[
i
].
Year
:
""
item
[
"
item
"
].
journal
.
pages
=
jsonOutput
[
i
].
Pages
?
jsonOutput
[
i
].
Pages
:
""
item
[
"
item
"
].
conference
.
name
=
jsonOutput
[
i
].
Conference
?
jsonOutput
[
i
].
Conference
:
""
item
[
"
item
"
].
conference
.
place
=
jsonOutput
[
i
][
"
City and Country
"
]
?
jsonOutput
[
i
][
"
City and Country
"
]
:
""
item
[
"
item
"
].
conference
.
date
=
jsonOutput
[
i
].
Date
?
jsonOutput
[
i
].
Date
:
""
item
[
"
item
"
].
publisher
=
jsonOutput
[
i
].
Publisher
?
jsonOutput
[
i
].
Publisher
:
""
item
[
"
item
"
].
type
=
jsonOutput
[
i
][
"
Type of Work
"
]
?
jsonOutput
[
i
][
"
Type of Work
"
]
:
""
item
[
"
item
"
].
project
=
jsonOutput
[
i
].
Project
?
jsonOutput
[
i
].
Project
:
""
item
[
"
item
"
].
reviewed
=
jsonOutput
[
i
][
"
Peer-Reviewed
"
]
?
jsonOutput
[
i
][
"
Peer-Reviewed
"
]
:
""
item
[
"
item
"
].
open
=
jsonOutput
[
i
][
"
Open Access
"
]
?
jsonOutput
[
i
][
"
Open Access
"
]
:
""
item
[
"
item
"
].
DOI
=
jsonOutput
[
i
].
DOI
?
jsonOutput
[
i
].
DOI
:
""
item
[
"
links
"
].
pdf
=
jsonOutput
[
i
].
PDF_Link
?
jsonOutput
[
i
].
PDF_Link
:
""
item
[
"
links
"
].
url
=
jsonOutput
[
i
].
URL
?
jsonOutput
[
i
].
URL
:
""
item
[
"
links
"
].
demo
=
jsonOutput
[
i
].
Demo
?
jsonOutput
[
i
].
Demo
:
""
var
month
=
""
;
if
(
jsonOutput
[
i
].
Date
!=
undefined
){
month
=
jsonOutput
[
i
].
Date
.
toString
().
split
(
"
,
"
)[
0
].
trim
();
}
//// BibTex /////////////////////
item
[
"
bibtex
"
]
=
"
@article{
"
+
bit1stAuthorLN
+
jsonOutput
[
i
].
Year
+
"
,
"
+
"
title={
"
+
jsonOutput
[
i
].
Titel
+
"
},author={
"
+
bibAuthors
.
trim
().
substring
(
0
,
bibAuthors
.
trim
().
lastIndexOf
(
"
"
))
+
"
},journal={
"
+
jsonOutput
[
i
].
Journal
+
"
},volume={
"
+
jsonOutput
[
i
].
Volume
+
"
},month={
"
+
month
+
"
},pages={
"
+
jsonOutput
[
i
].
Pages
+
"
},year={
"
+
jsonOutput
[
i
].
Year
+
"
},DOI ={
"
+
jsonOutput
[
i
].
DOI
+
"
},url ={
"
+
jsonOutput
[
i
].
URL
+
"
}}
"
jsonContent
.
push
(
item
);
}
//console.log(jsonContent);
}
xmlHttpRequest
.
send
();
// str = str.substring(0, lastIndex);
//
// ending of xlsx to json coversion
//
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment