-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
146 lines (124 loc) · 4.55 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
<!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>GoldGo</title>
<link rel="image_src" href="/assets/background.jpg" / >
<!-- Bootstrap -->
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/cover.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script data-main="scripts/main" src="scripts/require.js"></script>
</head>
<body class="coverbg">
<div class="site-wrapper">
<div class="site-wrapper-inner">
<div class="cover-container">
<!-- <div class="masthead clearfix">
<div class="inner">
<h3 class="masthead-brand">GoldGo</h3>
<ul class="nav masthead-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Features</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</div> -->
<div class="inner cover">
<h1 class="cover-heading title">Getting Old, Getting Out</h1>
<div class="panel">
<div class="panel-body">
<p class="lead">What's going on in:</p>
<div class="input-group input-group-lg">
<input type="text" class="form-control" placeholder="Postcode" id="postcode">
<span class="input-group-btn">
<button class="btn btn-default" type="button" id="go">Go!</button>
</span>
</div>
<div id="home-pos" style="display: none">
<p class="lead">- or -</p>
<p class="lead">
<button class="btn btn-lg btn-default btn-block" type="button" id="nearme">Find something near you!</button>
</p>
</div>
</div>
</div>
</div>
<div class="mastfoot">
<div class="inner">
<p id="loc">Hand crafted with love in sunny Brisbane, Queensland.</p>
<p>Built by Tech Stars, <a href="mailto:[email protected]">David</a> & <a href="mailto:[email protected]">Kurt</a>.</p>
</div>
</div>
</div>
</div>
</div>
<script>
require(['domReady', 'jquery'], function (domReady, $) {
domReady(function () {
var x = $('#loc');
var position;
var setPosition = function(pos) {
position = pos;
}
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition, showError);
} else {
$(x).text("Geolocation is not supported by this browser.");
hideFindButton();
}
}
function showPosition(pos) {
showFindButton();
setPosition(pos);
$(x).html("Latitude: " + pos.coords.latitude +
", Longitude: " + pos.coords.longitude);
}
function showError(error) {
switch(error.code) {
case error.PERMISSION_DENIED:
$(x).text("User denied the request for Geolocation.");
break;
case error.POSITION_UNAVAILABLE:
$(x).text("Location information is unavailable.");
break;
case error.TIMEOUT:
$(x).text("The request to get user location timed out.");
break;
case error.UNKNOWN_ERROR:
$(x).text("An unknown error occurred.");
break;
}
hideFindButton();
}
var hideFindButton = function() {
$('#home-pos').hide();
}
var showFindButton = function() {
$('#home-pos').show();
}
$('#go').click(function() {
var postcode = $('#postcode').val();
if (postcode.match(/^(0[289][0-9]{2})|([1345689][0-9]{3})|(2[0-8][0-9]{2})|(290[0-9])|(291[0-4])|(7[0-4][0-9]{2})|(7[8-9][0-9]{2})$/)) {
window.location = 'listings.php?postcode=' + postcode;
} else {
alert('Sorry, that is not a valid Australian postocde.');
}
})
$('#nearme').click(function() {
window.location = 'listings.php?lat=' + position.coords.latitude + '&lng=' + position.coords.longitude;
})
getLocation();
});
});
</script>
</body>
</html>