-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_index.template
167 lines (166 loc) · 6.04 KB
/
_index.template
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>The #BioCitationNeeded project</title>
<link href="bootstrap.min.css" rel="stylesheet">
<link href="style.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="html5shiv.min.js"></script>
<script src="respond.min.js"></script>
<![endif]-->
<script src="d3.min.js"></script>
<script src="topojson.min.js"></script>
<script src="datamaps.world.min.js"></script>
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">#BioCitationNeeded</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="index.html">English</a></li>
<li><a href="index-he.html">עברית</a></li>
<li><a target="_blank" href="https://github.com/no2bio/biocitationneeded#readme">About</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-md-8">
<h3>The #BioCitationNeeded project</h3>
</div>
<div class="col-md-4">
<form>
<select class="form-control" size="{{numtags}}" id="tag" onchange="colormap(this.value)">
{{#tags}}
{{#description}}{{! skip intro }}
<option value="{{name}}"{{#isdefault}} selected{{/isdefault}}>{{description}}</option>
{{/description}}
{{/tags}}
</select>
</form>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div id="worldmap" style="margin:4px auto; position:relative; width: 100%; height: 400px"></div>
{{#countries}}{{#any_citations}}
<dl class="dl-horizontal">
<dt id="{{id}}"><a title="{{name}}" href="country-{{id}}.html">{{name}}</a></dt>
<dd>
<ul class="list-group">
{{#citations}}
{{#value}}
<li class="list-group-item">
{{tag.description}}: <span{{#styling}} class="{{.}}"{{/styling}}>{{{.}}}</span>
</li>
{{/value}}
{{/citations}}
</ul>
</dd>
</dl>
{{/any_citations}}{{/countries}}
</div>
</div>
<hr>
<footer>
If you believe the information here is <a href="https://xkcd.com/386/">wrong</a> or incomplete
[and have <em>links</em> to back your claim], please
<a href="https://swatwt.com/whatmail">let us know</a>.
</footer>
</div><!-- /.container -->
<script src="jquery.min.js"></script>
<script src="bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="ie10-viewport-bug-workaround.js"></script>
<script>
$(function() {
colormap(document.getElementById('tag').value);
});
var map_data = {
{{#countries}}
{{mapid}}: {
fillKey: "defaultFill",
{{#citations}}
{{tag.name}}: {
styling: "{{#styling}}{{.}}{{/styling}}{{^styling}}defaultFill{{/styling}}",
value: "{{value}}"
},
{{/citations}}
},
{{/countries}}
};
var slugs = {
{{#countries}}
{{mapid}}: "{{id}}",
{{/countries}}
};
var map = new Datamap({
element: document.getElementById('worldmap'),
fills: {
defaultFill: "#7F7F7F",
good: "#336600",
bad: "#CC0000",
complicated: "#3333FF",
better: "#33CC00"
},
data: map_data,
hideAntarctica: true,
projection: 'mercator',
/*
// This projection is a tweak so that Israel doesn't look too small
// but it crops out stuff. To do: something better.
setProjection: function(element) {
var projection = d3.geo.conicEquidistant()
.center([31.3, 34.5])
.scale(300)
.translate([element.clientWidth / 2, element.clientHeight / 2])
.precision(.1);
var path = d3.geo.path()
.projection(projection);
return {path: path, projection: projection};
},
*/
geographyConfig: {
highlightFillColor: '#3F3F3F',
popupTemplate: function(geography, data) {
var value = current_tag&&'No information [yet]...'||'Please select a map...';
if (current_tag && data[current_tag]) {
value = data[current_tag].value || value;
}
return '<div class="hoverinfo"><strong>' +
geography.properties.name +
':</strong> ' + value + '</div>';
},
},
done: function(datamap) {
var svg = datamap.svg;
svg.selectAll('.datamaps-subunit').on('click', function(d) {
location.href='country-'+slugs[d.id]+'.html';
});
}
});
function colormap(tag) {
window.current_tag = tag;
var colors = {}
for (country in map_data) {
colors[country] = { fillKey: map_data[country][tag] && map_data[country][tag].styling || "defaultFill" };
}
map.updateChoropleth(colors);
}
</script>
</body>
</html>