-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathattribution.html
81 lines (65 loc) · 2.1 KB
/
attribution.html
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
73
74
75
76
77
78
79
80
81
---
layout: default
permalink: /attribution/
---
<style lang="text/css">
<!--
ul#attributions
{
list-style-type: disc;
padding-left: 1.5em;
}
ul#attributions li a { white-space: nowrap }
-->
</style>
<section id="js-more" class="limiter clearfix">
<div class="col12 clearfix pad4y">
<span class="sprite houses block space-bottom2"></span>
<div class="col12 clearfix">
<div class="col8 margin2">
<h2 class="space-bottom1">Required Attribution</h2>
<p class="prose">Data can be copied, redistributed, and adapted. For these sources, attribution is required:</p>
<ul id="attributions"></ul>
</div>
</div>
</div>
</section>
<script language="javascript">
<!--
var req = new XMLHttpRequest();
req.open("GET", "https://results.openaddresses.io/latest/licenses.json", false);
req.send();
var data = JSON.parse(req.responseText),
list = document.getElementById('attributions'),
defined = function(a) { return a['attribution'] != undefined },
compare = function(a, b) { return (a['attribution'] > b['attribution']) ? 1 : -1 },
licenses = data['licenses'].filter(defined).sort(compare);
for(var i = 0; i < licenses.length; i++)
{
var item = document.createElement('li'),
attr = licenses[i]['attribution'],
sources = licenses[i]['sources'];
item.appendChild(document.createTextNode(attr));
item.appendChild(document.createTextNode(' – '));
if(sources.length > 2)
{
item.appendChild(document.createElement('br'));
}
for(var j = 0; j < sources.length; j++)
{
var link = document.createElement('a'),
name = sources[j][0].replace('.json', ''),
href = sources[j][1];
if(href) { link['href'] = href }
link.appendChild(document.createTextNode(name));
item.appendChild(link);
if(j + 1 < sources.length) {
item.appendChild(document.createTextNode(', '));
} else {
item.appendChild(document.createTextNode('.'));
}
}
list.appendChild(item);
}
-->
</script>