-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
executable file
·551 lines (507 loc) · 24.5 KB
/
index.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
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
<!DOCTYPE html>
<html>
<head>
<title>CycleStreets mobile web site</title>
<meta charset="utf-8" />
<meta name='description' content='Plan cycle journeys on the move with CycleStreets Mobile. Route from A to B on a map and see turn-by-turn OpenStreetMap directions, with estimated journey times. Set your preferred speed and route type. Upload photos of cycling issues and see other photos from the CycleStreets community.' />
<meta name="author" content="Anna Powell-Smith" />
<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1" />
<link href="/favicon.ico" rel="icon" type="image/x-icon" />
<!-- Meta tags to indicate mobile-friendly content -->
<meta name="HandHeldFriendly" content="true" /> <!-- For BlackBerry -->
<meta name="mobileoptimized" content="0" /> <!-- For IE Mobile -->
<!-- iOS startup icons -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon" href="apple-touch-icon.png" />
<link rel="apple-touch-startup-image" href="apple-touch-startup-image.png" />
<!-- Smart App banners -->
<meta name="apple-itunes-app" content="app-id=391984737" />
<!-- Facebook tags -->
<link rel="image_src" type="image/png" href="/images/facebook_previews/journey.png" />
<!-- Stylesheets -->
<link rel="stylesheet" href="https://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css" />
<link rel="stylesheet" href="css/cyclestreets.css" />
<!-- Scripts -->
<script type="text/javascript" src="https://code.jquery.com/jquery-1.7.0.min.js"></script>
<script type="text/javascript" src="https://maps.google.com/maps/api/js?region=GB"></script>
<script type="text/javascript" src="js/cyclestreets.js"></script>
<script type="text/javascript">
$(document).ready(function() {
// We need to initialise dynamic content in hash pages here,
// onDomLoad, but before jQuery Mobile has loaded.
// Logic to load the Category lists.
var categoryselect = $('#category');
var metacategoryselect = $('#metacategory');
if ((getItem('categories')==null)||(getItem('metacategories')==null)) {
$.mobile.pageLoading();
var category_url = CS_API_V2 + 'photomap.categories';
var catdata = { 'key' : CS_API_KEY };
$.ajax({
url: category_url,
dataType: 'jsonp',
data: catdata,
jsonpCallback: 'photomapcategories',
success: function(data) {
$.mobile.pageLoading(true);
if ($(data).length > 0) {
var category_list = '';
var metacategory_list = '';
var categories = data.categories;
var metacategories = data.metacategories;
$.each(categories, function(i,v) {
var name = v.name;
var tag = i;
categoryselect.append("<option value="+tag+">"+name+"</option>");
});
$.each(metacategories, function(i,v) {
var name = v.name;
var tag = i;
metacategoryselect.append("<option value="+tag+">"+name+"</option>");
});
// Store the categories locally.
setItem('categories',categories);
setItem('metacategories', metacategories);
} else {
toastMessage("Sorry, no categories found!");
}
},
error: function() {
$.mobile.pageLoading(true);
toastMessage("Sorry, error retrieving categories!");
}
});
} else {
var catlist = getItem('categories');
var metacatlist = getItem('metacategories');
categoryselect.find('option').remove();
metacategoryselect.find('option').remove()
$.each(catlist, function(index, value) {
categoryselect.append("<option value=" + value['tag'] + ">" + value['name'] + "</option>");
});
$.each(metacatlist, function(index, value) {
metacategoryselect.append("<option value=" + value['tag'] + ">" + value['name'] + "</option>");
});
}
// Select correct default options for photo upload.
categoryselect.val("cycleparking");
metacategoryselect.val("bad");
// Logic for the Prefs page.
if (getItem("plan")!=null) {
$("#plan").val(getItem("plan"));
}
if (getItem("cyclingspeed")!=null) {
$("#cyclingspeed").val(getItem("cyclingspeed"));
}
if (getItem("maptype")!=null) {
$("#maptype").val(getItem("maptype"));
}
$('#plan').change(function() {
setItem("plan", $('#plan').val());
});
$('#cyclingspeed').change(function() {
setItem("cyclingspeed", $('#cyclingspeed').val());
});
$('#maptype').change(function() {
setItem("maptype", $('#maptype').val());
});
if (getItem("username")===null) {
$("#cleardetails").hide();
}
$('#clearusername').click(function() {
removeItem("username");
$('#cleardetails').hide();
alert("Your username has been cleared.")
});
// Logic for Saved Routes page.
var all_keys = getRouteKeys();
for (var i = 0; i < all_keys.length; i++) {
(function () {
var key = all_keys[i];
var route_num = key.split('-')[1];
var route_info = getItem(key);
var route_url = '/journey/#' + route_num + "/" + route_info.plan;
var list_route = "<li><a rel='external' href='" + route_url + "'>";
list_route += "<p><strong>";
if (route_info.date !== undefined) {
// This munging seems necessary for compatibility with Android
var d = new Date(route_info.date.replace(/\-/ig, '/').split('T')[0]);
var curr_month = d.getMonth() + 1;
list_route += d.getDate() + "/" + curr_month + "/" + d.getFullYear() + "<br/>";
}
list_route += route_info.from + " to " + route_info.to + "</strong></p>";
list_route += "<p>" + route_info.distance + " miles, ";
list_route += route_info.time + " mins at ";
list_route += route_info.speed + "mph, " + route_info.plan + "</p></a></li>";
$('#saved-list').append($(list_route));
}());
}
});
</script>
<script type="text/javascript" src="https://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js"></script>
<script type="text/javascript">
$(function() {
// Detect iPhone/Android OS and suggest native apps.
var ua = navigator.userAgent;
var uachecker = {
iphone: ua.match(/iPhone/),
ipad: ua.match(/iPad/),
ipod: ua.match(/iPod/),
android: ua.match(/Android/),
blackberry10: ua.match(/BB10/),
winphone: ua.match(/Windows Phone [8-9]/)
};
if (uachecker.android) {
$('#user-agent-link').attr('href','https://play.google.com/store/apps/details?id=net.cyclestreets');
$('#market-name').text("Google Play");
$('#native-app').show();
} else if ((uachecker.iphone) || (uachecker.ipad) || (uachecker.ipod)) {
$('#user-agent-link').attr('href','https://itunes.apple.com/gb/app/cyclestreets-uk-cycle-journey/id391984737');
$('#market-name').text("iTunes");
$('#native-app').show();
} else if (uachecker.blackberry10) {
$('#user-agent-link').attr('href','https://appworld.blackberry.com/webstore/content/21867253/');
$('#market-name').text("BlackBerry World");
$('#native-app').show();
} else if (uachecker.winphone) {
$('#user-agent-link').attr('href','https://www.microsoft.com/en-us/store/apps/cyclestreets/9nblggh2rsp8');
$('#market-name').text("Windows Phone Store");
$('#native-app').show();
}
$('#hide-native').click(function() {
$('#native-app').fadeOut();
});
// Disable photo upload for iPhone/iPad/iPod (iOS5 and below): https://stackoverflow.com/questions/12840810
if ($('#uploadfields').prop('disabled')) {
$('#uploadfields').hide();
$('#uploads-not-available').show();
}
// Logic to load the Category lists.
var categoryselect = $('#category');
var metacategoryselect = $('#metacategory');
// Route by Address: validate form.
$('#route-form').submit(function(event) {
event.preventDefault();
$.mobile.pageLoading();
$('#routebutton').text('Searching...');
var routefrom = $('#routefrom').val().trim();
var routeto = $('#routeto').val().trim();
// Make sure that the user has entered something.
if ((routeto==='')||(routefrom==='')) {
toastMessage("Please enter both a start and destination address!");
$.mobile.pageLoading(true);
return false;
}
$('#route-header').text('Getting route...');
geocodeWithCycleStreets(routefrom,routeto);
});
// Saved Routes logic.
$('#clear-saved-routes').hide();
if ($('#saved-list li').length>0) {
$('#clear-saved-routes').show();
$('#no-routes').hide();
$('#begin-a-route').hide();
}
$('#clear-saved-routes').click(function() {
if(!confirm("Clear all routes?")) return false;
if (eraseRoutes()) {
$('#saved-list li').hide();
$('#clear-saved-routes').hide();
$('#no-routes').text('Routes have been cleared.');
$('#no-routes').show();
} else {
toastMessage("Sorry, something went wrong");
}
});
// Logic for the Upload page.
$('#signinfields').hide();
var accountform = $('#account-form');
var description = $('#description');
// Validate categories when user clicks link.
$('#signin-link').click(function(event) {
if ((categoryselect.val()==='') || (metacategoryselect.val()==='')) {
toastMessage("Please choose a category & type!");
return false;
}
if ($('#mediaupload').val()=='') {
toastMessage("Please choose a file!");
return false;
}
$('#signinfields').show();
$('#uploadfields').hide();
// Hide all registration fields, by default.
$('div.registration').hide();
// Load username from local storage, if it exists.
$('#username').val(getItem('username'));
// Toggle signin/register switch.
$("input[name='login']").change(function(){
if ($("input[name='login']:checked").val()=='register') {
$('div.registration').show();
$('signin-submit').text("Register & upload");
} else {
$('div.registration').hide();
}
});
// Validate submitted fields.
$('input#signin-submit').click(function(event) {
$.mobile.pageLoading();
if ($('#username').val() === "") {
$.mobile.pageLoading(true);
toastMessage("Please supply a username!");
return false;
}
if ((/^([a-z0-9]{5,})$/.test($('#username').val()))===false) {
$.mobile.pageLoading(true);
toastMessage("Please use only letters & numbers in your username!");
return false;
}
setItem("username", $('#username').val());
if ($('#password').val() === "") {
$.mobile.pageLoading(true);
toastMessage("Please supply a password!");
return false;
}
if ($("input#email").is(":visible")) {
if ($("input#email").val()===''){
$.mobile.pageLoading(true);
toastMessage('Please supply an email address!');
return false;
}
// Check passwords match, if visible.
if ($("input#password2").is(":visible")) {
if ($("input#password").val() != $("input#password2").val()){
$.mobile.pageLoading(true);
toastMessage('Your passwords do not match!');
return false;
}
}
}
return true;
});
});
});
</script>
</head>
<body>
<!-- Home page -->
<div data-role="page" id="home" data-title="CycleStreets » Home">
<div data-role="header" data-position="inline" data-theme="z">
<a href="#about" data-rel="dialog" data-icon="info" data-transition="pop" class="ui-btn-left">About</a>
<h1>CycleStreets</h1>
<a href="#prefs" data-rel="dialog" data-icon="gear" data-transition="pop" class="ui-btn-right">Prefs</a>
</div>
<div data-role="content">
<p>Welcome to CycleStreets! Plan a cycle route & add/view cycling-related photos.</p>
<p><a href="/journey/" rel="external" data-role="button" data-icon="arrow-r" data-iconpos="right">Route on map</a></p>
<p><a href="#route-by-address" data-role="button" data-icon="arrow-r" data-iconpos="right">Route by address</a></p>
<p><a href="#saved-routes" data-role="button" data-icon="arrow-r" data-iconpos="right">Saved routes</a></p>
<p><a href="#upload" data-role="button" data-icon="arrow-r" data-iconpos="right">Upload a photo</a></p>
<p><a href="/photomap/" rel="external" data-role="button" data-icon="arrow-r" data-iconpos="right">Photos near me</a></p>
<p>Go to <a href="https://www.cyclestreets.net/?desktopsite" rel="external">CycleStreets desktop site</a>.</p>
</div>
<div data-role="footer" data-theme="z" id='native-app' class="native-footer">
Get the Cyclestreets app!
<a href="" id="hide-native" data-role="button" data-icon="delete" data-iconpos="notext"></a>
<div id="native-button"><a href="https://itunes.apple.com/gb/app/cyclestreets-uk-cycle-journey/id391984737" id="user-agent-link" data-role="button">Go to <span id="market-name">iTunes</span></a></div>
</div>
</div>
<!-- Route by address -->
<div data-role="page" id="route-by-address" data-title="CycleStreets » Route by address">
<div data-role="header" data-theme="z" id="first-header">
<a href="/" rel="external" class="ui-btn-left" data-icon='home'>Home</a>
<h1 id="route-header">Route by address or postcode</h1>
</div>
<div data-role="content">
<form id="route-form" action="route-without-js.php" method="get" data-ajax="false" class="inset">
<div data-role="fieldcontain">
<label for="routefrom">From:</label>
<!--
<input type="text" id="routefrom" placeholder="Leave blank to use current location" />
-->
<input type="text" id="routefrom" />
<div data-role="fieldcontain">
</div>
<label for="routeto">To:</label>
<input type="text" id="routeto" />
</div>
<fieldset class="ui-grid-a">
<div class="ui-block-b">
<button type="submit" data-theme="z" id="routebutton">Find route</button>
</div>
</fieldset>
</form>
</div>
</div>
<!-- Saved routes page -->
<div data-role="page" id="saved-routes" data-title="CycleStreets » Saved routes">
<div data-role="header" data-theme="z">
<a href="/" class="ui-btn-left" data-icon='home'>Home</a>
<h1>Saved routes</h1>
</div>
<div data-role="content">
<ul data-role="listview" id='saved-list' data-inset="true">
</ul>
<p id="no-routes">You don't have any saved routes yet.</p>
<p id="clear-saved-routes" data-role="button" data-icon="delete" data-iconpos="right" data-theme="z">Clear saved routes</p>
<a data-role="button" rel="external" data-icon="arrow-r" data-iconpos="right" data-theme="z" href="/journey/" id="begin-a-route">Begin a route</a>
</div>
</div>
<!-- Upload photo page -->
<div data-role="page" id="upload" data-title="CycleStreets » Upload a photo">
<div data-role="header" data-theme="z">
<a href="/" class="ui-btn-left" data-icon='home'>Home</a>
<h1>Upload a photo</h1>
</div>
<div data-role="content">
<form id="account-form" method="post" enctype="multipart/form-data" data-ajax="false" action="upload.php" >
<!-- Upload div, initially visible -->
<div id="uploads-not-available" class="hidden">
<p>Sorry - to upload photos, you need to install the CycleStreets iPhone app, as your device's browser does not support uploads.</p>
<a href="https://itunes.apple.com/gb/app/cyclestreets-uk-cycle-journey/id391984737" data-role="button" class="itunes-button">Find CycleStreets on iTunes</a>
</div>
<div id="uploadfields">
<fieldset>
<p>Upload photographs of road problems or good practice here.</p>
<div data-role="fieldcontain">
<label for="mediaupload">Pick photo: </label>
<input type="file" id="mediaupload" name="mediaupload" accept="image/jpeg, image/jpg" />
</div>
<div data-role="fieldcontain">
<label for="metacategory" class="select">Type:</label>
<select name="metacategory" id="metacategory">
</select>
</div>
<div data-role="fieldcontain">
<label for="category" class="select">Category:</label>
<select name="category" id="category">
</select>
</div>
<div data-role="fieldcontain">
<label for="description">Description (optional):</label>
<textarea cols="40" rows="8" name="description" id="description"></textarea>
</div>
<div class="ui-grid-a">
<div class="ui-block-b">
<input type="button" name="signin-link" id="signin-link" data-icon="arrow-r" data-iconpos="right" value="Upload photo" />
</div>
</div>
</fieldset>
</div>
<!-- Signin div, initially hidden -->
<div id="signinfields">
<p>Provide your CycleStreets account details to upload this photo. If you don't already have an account, it's free to register.</p>
<!-- Radio buttons to choose signin/register -->
<fieldset data-role="controlgroup" data-theme="z" data-type="horizontal" >
<input type="radio" name="login" id="radio-signin" value="signin" checked="checked" />
<label for="radio-signin">Signin</label>
<input type="radio" name="login" id="radio-register" value="register" />
<label for="radio-register">Register</label>
</fieldset>
<fieldset>
<div data-role="fieldcontain" id="userfield">
<label for="username">User name:</label>
<input type="text" name="username" id="username" />
</div>
<div data-role="fieldcontain" id="screenfield" class="registration">
<label for="name">Screen name (optional):</label>
<input type="text" name="name" id="name" />
</div>
<div data-role="fieldcontain" id="emailfield" class="registration">
<label for="email">Email:</label>
<input type="email" name="email" id="email" />
</div>
<div data-role="fieldcontain" id="passfield">
<label for="password">Password:</label>
<input type="password" name="password" id="password" />
</div>
<div data-role="fieldcontain" id="passfield2" class="registration">
<label for="password2">Password (again):</label>
<input type="password" name="password2" id="password2" />
</div>
<div class="ui-block-a">
<input type="submit" data-theme="z" id="signin-submit" value="Signin & upload" />
</div>
</fieldset>
</div> <!-- end of signin div -->
</form>
</div>
</div>
<!-- Preferences page -->
<div data-role="page" id="prefs" data-position="inline" data-title="CycleStreets » Preferences">
<div data-role="header" data-position="inline" data-theme="z">
<h1>Preferences</h1>
</div>
<div data-role="content" data-position="inline">
<p>Set your preferred route plan, map style, and cycling speed here.</p>
<div data-role="fieldcontain">
<label for="plan">Plan:</label>
<select name="plan" id="plan">
<option value="fastest">Fastest</option>
<option value="balanced" selected="selected">Balanced</option>
<option value="quietest">Quietest</option>
</select>
</div>
<div data-role="fieldcontain">
<label for="maptype">Map:</label>
<select name="maptype" id="maptype">
<option value="OCM">OpenCycleMap</option>
<option value="OSM">OpenStreetMap</option>
<option value="OS">Ordnance Survey</option>
</select>
</div>
<div data-role="fieldcontain">
<label for="cyclingspeed">Speed:</label>
<select name="cyclingspeed" id="cyclingspeed">
<option value="10">Unhurried (10 mph)</option>
<option value="12" selected="selected">Cruising (12 mph)</option>
<option value="15">Quick (15 mph)</option>
</select>
</div>
<div data-role="fieldcontain" id="cleardetails">
<label for="clearusername">Clear saved user name:</label>
<input type="button" data-theme="z" name="clearusername" id="clearusername" value="Clear" />
</div>
<div class="ui-grid-a">
<div class="ui-block-b">
<p><a href="/" data-role="button" data-rel="back" data-theme="z">Close</a></p>
</div>
</div>
</div>
</div> -->
<!-- About page -->
<div data-role="page" id="about" data-title="CycleStreets » About">
<div data-role="header" data-theme="z" data-position="inline">
<h1>About</h1>
</div>
<div data-role="content">
<p>CycleStreets is a UK-wide cycle journey planner system, which lets you plan routes from A to B by bike. It is designed by cyclists, for cyclists, and caters for the needs of both confident and less confident cyclists.</p>
<h3>People</h3>
<p>CycleStreets was created by Simon Nuttall (lead developer) and Martin Lucas-Smith, both regular bicycle users based in Cambridge.</p>
<p>Development of this mobile HTML application was supported by <a rel="external" href="http://www.cyclingscotland.org/">Cycling Scotland</a> and written by <a rel="external" href="https://twitter.com/darkgreener">Anna Powell-Smith</a>.</p>
<h3>Attributions</h3>
<p>The map data is from <a rel="external" href="https://www.openstreetmap.org/">OpenStreetMap</a>, and we are immensely grateful to all the volunteers who created the base data. Map tiles are (c) OpenStreetMap contributors, <a rel="external" href="https://www.openstreetmap.org/copyright">ODbL</a>. Please consider <a rel="external" href="http://donate.openstreetmap.org/">donating to OpenStreetMap</a>.</p>
<p>Map tiles are also provided from <a rel="external" href="http://www.opencyclemap.org/">OpenCycleMap</a>, which is based on OpenStreetMap, and Ordnance Survey's <a rel="external" href="https://www.ordnancesurvey.co.uk/innovate/innovate-with-open-space.html">OpenSpace</a>.The mobile HTML application was developed using <a rel="external" href="https://jquerymobile.com/">jQuery Mobile</a> and <a rel="external" href="http://glyphish.com/">Glyphish icons</a>.</p>
<h3>Licensing</h3>
<p>CycleStreets routes are based on OpenStreetMap data, and can therefore be re-used freely under the <a rel="external" href="https://www.openstreetmap.org/copyright">ODbL licence</a>.</p>
<h3>Support CycleStreets</h3>
<p>CycleStreets is a non-profit organisation run by cyclists, for cyclists. You can support our work by:</p>
<ul>
<li>donating to help us pay for bandwidth and keep the lead programmers fed!</li>
<li>promoting CycleStreets by telling other cyclists and writing about us.</li>
<li>contributing code to our project, or data to OpenStreetMap.</li>
</ul>
<p>Donate now with PayPal:</p>
<div class="ui-grid-a">
<div class="ui-block-b">
<p><a href="https://www.cyclestreets.org/donate/" data-role="button" data-theme="z">Donate to CycleStreets</a></p>
</div>
</div>
<div class="ui-grid-a">
<div class="ui-block-b">
<p><a href="/" data-role="button" data-rel="back" data-theme="z">Close</a></p>
</div>
</div>
</div>
</div>
</body>
</html>