Skip to content

Commit 4f98a95

Browse files
committed
Add data link demo page
1 parent cc040bf commit 4f98a95

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Live demos:
99

1010
* [Basic example](https://ble-lter.github.io/Zotero-JavaScript-Search-Client/minimal.html)
1111
* [Complete example](https://ble-lter.github.io/Zotero-JavaScript-Search-Client/complete.html)
12+
* [Data link example](https://ble-lter.github.io/Zotero-JavaScript-Search-Client/data_links.html)
1213

1314
## Motivation
1415

data_links.html

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<title>Zotero Search Demo with Data Links</title>
6+
<meta charset="utf-8" />
7+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
8+
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
9+
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css"
10+
integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
11+
<link href="search.css" rel="stylesheet" type="text/css">
12+
<script src="cors.js"></script>
13+
<script src="pagination.js"></script>
14+
<script src="zotero.js"></script>
15+
</head>
16+
17+
<body>
18+
<div class="container">
19+
<h1>Zotero Search Demo with Data Links</h1>
20+
<p>This <a href="https://github.com/BLE-LTER/Zotero-JavaScript-Search-Client"
21+
rel="noopener">Zotero-JavaScript-Search-Client</a> example demonstrates how data links are added to a publication citation when DOIs are found within the <strong>Extra</strong> field in Zotero.
22+
The group is just a test group, and the data links aren't related to the publication in this example, but the example does illustrate the functionality. Look for the example to be replaced with a real-world example as users apply this functionality to their own libraries.</p>
23+
<form id="zoteroSearchForm" name="zoteroSearchForm">
24+
<input class="search-input" name="q" placeholder="Enter search term" type="text">
25+
<input type="submit" value="Search">
26+
</form>
27+
28+
<div class="loading" id="loading-div">
29+
<i class="fas fa-spinner fa-pulse fa-3x fa-fw"></i>
30+
<span class="sr-only">Loading...</span>
31+
</div>
32+
33+
<p>Search results will be written below:</p>
34+
<div class="resultCount" id="resultCount"></div>
35+
<div id="searchResults"></div>
36+
<div class="pagination" id="paginationBot"></div>
37+
</div>
38+
<script>
39+
ZOTERO_CONFIG["zotId"] = "2221709";
40+
ZOTERO_CONFIG["includeCols"] = ["Year", "Type"];
41+
</script>
42+
</body>
43+
44+
</html>

zotero.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ function parseZoteroResults(resultText) {
156156
for (var i = 0; i < dois.length; i++) {
157157
var doi = dois[i];
158158
if (doi.startsWith("https://doi.org/")) {
159-
links.push(' <a href="' + doi + '" target="_blank" rel="noopener">Data Link</a>');
159+
links.push(' <a href="' + doi + '" target="_blank" rel="noopener">Data link.</a>');
160160
}
161161
}
162162
return links.join(" ");

0 commit comments

Comments
 (0)