-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
executable file
·72 lines (54 loc) · 1.78 KB
/
Copy pathmain.js
File metadata and controls
executable file
·72 lines (54 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
var facultyURL = 'https://docs.google.com/spreadsheets/d/1FOYpxQQQ9EZUsuBDR_LKwVsQRz7pHF414g_X27h7ajo/pubhtml';
Tabletop.init({
key: facultyURL,
callback: processData,
simpleSheet: true,
});
function mergeOrganizationAndWebsite(org, website) {
if (!website) { return org; }
return '<span class="invisible">' + org + '</span>'
+ '<a target="_blank" href="http://' + website + '">' + org + '</a>';
}
function mergeTitleResearchNeeds(title, research, needs) {
res = '';
if (title) {
res += '<h3>' + title + '</h3>';
}
res += '<p><span class="emphasis">Public Humanities Project: </span>' + research + '</p>';
if (needs) {
res += '<p><span class="emphasis">Student Researchers: </span>' + needs + '</p>';
}
return res;
}
function emailToLink(name, email) {
if (!email) { return name; }
return name + ' <a href="mailto:' + email + '"> <i class="fa fa-envelope"> </a>';
}
function processData(data, tabletop) {
if (!data[0]) return;
var processedData = [];
for (i in data) {
var r = data[i];
if (r.Display !== 'y') continue;
// Add a row to the final dataset
processedData.push([
mergeOrganizationAndWebsite(r.Organization, r.Website) + '<br><br>' + emailToLink(r.Name, r.Email),
mergeTitleResearchNeeds(r.Title, r.Project, r['Student Researchers']),
]);
}
$(document).ready(function() {
var table = $('#results').DataTable({
paging: false,
info: false,
ordering: true,
data: processedData,
columns: [
{title: 'Organization', width: '200px', className: 'td-center'},
{title: 'Project', orderable: false},
]
});
$('input[name="filter"]').change(function() {
table.draw();
});
});
}