blob: 7ee8f406127688c5d388e5e8e39d91aa65dce06e (
plain)
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
168
169
170
171
172
173
174
175
176
177
|
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<link rel="stylesheet" href="../src/leaflet-soton.css" />
<link rel="stylesheet" href="../resources/leaflet/dist/leaflet.css" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px }
#top_bar {
height: 10%;
width:100%;
height:5%;
border-bottom: 1px solid #000;
overflow:hidden;
background-color:#ccc
}
#map_canvas { height: 90% }
.info_photo {
float:right;
padding: 0em 0em 0.3em 1em;
}
.info {
font-family: sans-serif;
width: 400px;
height: 200px;
overflow-y: auto;
}
.info_label {
font-weight: bold;
font-size: 130%;
}
.info_n {
font-size: 200%;
}
.info_link {
margin-bottom: 1em;
font-size: small;
}
.info_txt {
margin-bottom: 0.5em;
}
#resultsDiv {
padding-bottom: 2em;
}
#resultsDiv a {
display: block;
padding-top: 0.3em;
padding-left: 5%;
padding-right: 5%;
}
#resultsDiv a .n {
padding-right: 0.5em;
display: block;
float: right;
font-size: 90%;
}
#resultsDiv a .label {
display: block;
padding-left: 0.5em;
border-bottom: solid 1px #ccc;
padding-bottom: 0.3em;
font-size: 120%;
}
#searchBox {
text-align: center;
width: 90%;
font-size: 140%;
padding: 0.1em;
border: solid 1px #000;
}
</style>
</head>
<body>
<div id="top_bar">
<div style='font-size:40px;padding:5px 5px 3px 5px;'>
Building Search
</div>
</div>
<div id="map" style="width:70%; height:95%; float:right"></div>
<div style='height:95%;overflow-y:auto;border-right:1px solid #000'>
<div style='padding-bottom:0.5em;border-bottom:solid 1px #000;margin-bottom:0.5em'>
<div style='margin:0.3em;text-align:center;clear:both;'>
<input id='searchBox' />
</div>
<div style='text-align:center'>
<label>
<input id='res' type='checkbox' name='res' value='yes' />
Include Halls and Residential Buildings
</label>
</div>
<div style='text-align:center;margin-top:0.3em;font-size:80%'>
Type "b12." to search for a specific building number.
</div>
</div>
<div id='resultsDiv'>
</div>
</div>
<script src="../resources/leaflet/dist/leaflet.js"></script>
<script src="../src/leaflet-soton.js"></script>
<script type="text/javascript">
LS.imagePath = '../resources/images/';
LS.dataPath = '../data.json';
var map = LS.map('map');
LS.on("dataload", function(data) {
var searchBox = document.getElementById("searchBox");
var residentialTickBox = document.getElementById("res");
var resultsDiv = document.getElementById("resultsDiv");
var buildings = data.buildings.features.sort(function(a, b) {
return a.properties.name.localeCompare(b.properties.name);
});
function filter() {
var searchText = searchBox.value.toLowerCase();
resultsDiv.innerHTML = "";
var results = [];
buildings.forEach(function(building) {
var name = building.properties.name;
if (name.length === 0)
return;
if (name.toLowerCase().indexOf(searchText) !== -1) {
var a = document.createElement("a");
a.href = "#";
a.onclick = function() {
map.showPopupByURI(building.properties.uri);
};
var label = document.createElement("span");
label.textContent = name;
label.className = "label";
a.appendChild(label);
var n = document.createElement("span");
n.textContent = building.properties.loc_ref;
n.className = "n";
a.appendChild(n);
resultsDiv.appendChild(a);
results.push(building.properties.uri);
}
});
if (results.length === 1) {
map.showPopupByURI(results[0]);
}
}
searchBox.onkeyup = filter;
filter();
});
</script>
</body>
</html>
|