forked from sgs006/Udacity-Yearbook-Project
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgtable.js
63 lines (54 loc) · 1.79 KB
/
gtable.js
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
var resourceSpreadsheet = '15_xFyNCeTMRxSbdJuqhezhw1Ahb69NplZG8iNjs9AII';
// https://script.google.com/macros/s/AKfycbygukdW3tt8sCPcfDikMnMuNu9bH5fpt7Kv50p2bM/exc?id=15_xFyNCeTMRxSbdJuqhezhw1Ahb69NplZG8iNjs9AII&sheet=Resources
function init() {
Tabletop.init({
key: resourceSpreadsheet,
callback: resourceData,
simpleSheet: true
});
}
function resourceData(data, tabletop) {
for (var i = 0; i < data.length; i++) {
if (data[i].Free == 0) {
$('.post').append(
'<tr>' +
'<td id="col1" scope="row">' +
data[i].Resource +
'</td>' +
'<td class="text">' +
'<span class="fa-stack fa-2x"><i class="fa fa-usd fa-stack-1x"></i><i class="fa fa-circle-thin fa-stack-2x"></i></span>' +
'</td>' +
'<td class="text" id = "' + data[i].Type + '">' +
data[i].Type +
'</td>' +
'<td class="text">' +
data[i].Description +
'</td>' +
'<td id="address"><a href ="' +
data[i].Link + '" target="_blank">Check it out!</a> ' +
'</td>' +
'</tr>' );
}
else if (data[i].Free == 1) {
$('.post').append(
'<tr>' +
'<td id="col1" scope="row">' +
data[i].Resource +
'</td>' +
'<td class="text">' +
'<span class="fa-stack fa-2x"><i class="fa fa-usd fa-stack-1x"></i><i class="fa fa-ban fa-stack-2x" style="color:Red"></i></span>' +
'</td>' +
'<td class="text" id = "' + data[i].Type + '">' +
data[i].Type +
'</td>' +
'<td class="text">' +
data[i].Description +
'</td>' +
'<td id="address"><a href ="' +
data[i].Link + '" target="_blank">Check it out!</a> ' +
'</td>' +
'</tr>' );
}
}
}
window.addEventListener('DOMContentLoaded', init);