-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex_template.html
117 lines (93 loc) · 3.16 KB
/
index_template.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
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
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
</head>
<body>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css">
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<link rel="stylesheet" href="../fs/Control.FullScreen.css" />
<script src="../fs/Control.FullScreen.js"></script>
<style type="text/css" media="screen">
body {
background-color: white;
text-align: center;
font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 16px;
color: #FBFAF7;
color: black;
-webkit-font-smoothing: antialiased;
}
a {
color:#5252CC;
font-weight:200;
text-decoration:none;
}
a:hover {
text-decoration: underline;
}
.leaflet-container {background: white;}
.leaflet-container img.leaflet-image-layer {
max-width: none !important;
}
#map { width: 100%px; height: 500px; }
.leaflet-control-zoom-fullscreen { background-image: url(../fs/icon-fullscreen.png); }
/* on selector per rule as explained here : http://www.sitepoint.com/html5-full-screen-api/ */
#map:-webkit-full-screen { width: 100% !important; height: 100% !important; z-index: 99999; }
#map:-moz-full-screen { width: 100% !important; height: 100% !important; z-index: 99999; }
#map:full-screen { width: 100% !important; height: 100% !important; z-index: 99999; }
.leaflet-pseudo-fullscreen { position: fixed !important; width: 100% !important; height: 100% !important; top: 0px !important; left: 0px !im\
portant; z-index: 99999; }
.my-label {
width:100px;
font-size:20px;
}
</style>
<div id="map"></div>
<p>
t-SNE visualization of FOOTBALL news from The Guardian
<br>
<a href=https://twitter.com/RyanKeisler>@RyanKeisler</a>
<a href='https://github.com/rkeisler/tsne_guardian'>(code+info)</a>
[<a href='http://stanford.edu/~rkeisler/tsne_guardian/us/'>U.S.</a>,
<a href='http://stanford.edu/~rkeisler/tsne_guardian/world/'>WORLD</a>,
<a href='http://stanford.edu/~rkeisler/tsne_guardian/football/'>FOOTBALL</a>]
</p>
</body>
<script>
// adapted from http://kempe.net/blog/2014/06/14/leaflet-pan-zoom-image.html
// create the slippy map
var map = L.map('map', {
minZoom: 1,
maxZoom: 5,
center: [0, 0],
zoom: 1,
crs: L.CRS.Simple,
fullscreenControl: true
});
// detect fullscreen toggling
map.on('enterFullscreen', function(){
if(window.console) window.console.log('enterFullscreen');
});
map.on('exitFullscreen', function(){
if(window.console) window.console.log('exitFullscreen');
});
// dimensions of the image
var w = 7500;
var h = 4000;
// you will need to replace this with a link to your own image.
var url = 'http://stanford.edu/~rkeisler/tsne_guardian/football/big_football.jpg';
// calculate the edges of the image, in coordinate space
var southWest = map.unproject([0, h], map.getMaxZoom()-1);
var northEast = map.unproject([w, 0], map.getMaxZoom()-1);
var bounds = new L.LatLngBounds(southWest, northEast);
// add the image overlay,
// so that it covers the entire map
L.imageOverlay(url, bounds).addTo(map);
// tell leaflet that the map is exactly as big as the image
map.setMaxBounds(bounds);
// add rectangles with headlines.
var myOpacity = 0.001;
// add rectangles here
</script>
</html>