-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnews.js
67 lines (53 loc) · 1.64 KB
/
news.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
64
65
66
67
var publicSpreadsheetUrl = 'https://docs.google.com/spreadsheets/d/14ElF367q6QKVW_j98CCM1rU4IR2FB2BryVvMHOPFWdE/edit?usp=sharing';
// var publicSpreadsheetUrl = 'https://docs.google.com/spreadsheets/d/1uKLFKf_ZIci6eTLRvzQnbBHc5h0cz2Q48PA_A2emtEE/edit#gid=998515236';
function init() {
Tabletop.init({
key: publicSpreadsheetUrl,
callback: showInfo,
simpleSheet: false
})
}
function showInfo(data, tabletop) {
let project = d3.select('#projects-list').selectAll('.project').data(data["news"].elements, function(d) {
return d.id
})
project.exit().remove();
project = project.enter().append('li')
.classed('project', true)
.merge(project)
project.append('h3')
.text(function(d) {
return d.date
})
// project.append('h2')
// .text(function(d) {
// return d.title
// })
//
// project.append('h3')
// .text(function(d) {
// return d.subtitle
// })
// project.append('div')
// .classed('project-image', true)
// .classed('responsive-img', true)
// .style('background-image', function(d) {
// let imagename = d.image
// return `url("https://raw.githubusercontent.com/bea92/Prode/prova-interfaccia-diversa/img/${imagename}.jpg")`;
// })
project.append('p')
.classed('text-left', true)
.text(function(d) {
return d.testo
})
// project.append('p')
// .classed('text-right', true)
// .classed('go-to-website', true)
// .append('a')
// .attr('href', function(d) {
// return d.link // qua mettere il link al sito e basta
// })
// .attr('target', '_blank')
// .text('visita il sito web')
}
window.addEventListener('DOMContentLoaded', init)