-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
277 lines (258 loc) · 10.1 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
<!DOCTYPE html>
<html>
<head>
<title>Snowpool</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="./assets/css/jquery.mobile-1.3.1.min.css" />
<link rel="stylesheet" href="./assets/css/jquery.flash.css" />
<script src="./assets/js/jquery-1.9.1.min.js"></script>
<script src="./assets/js/global.js"></script>
<script src="./assets/js/jquery.mobile-1.3.1.min.js"></script>
<link rel="stylesheet" href="./assets/css/custom.snowpool.css" />
</head>
<body>
<div id="home" data-role="page">
<div data-role="header">
<h1>Snowpool</h1>
</div>
<div data-role="content">
<ul id="country_list" data-role="listview">
</ul>
</div>
<div data-role="footer">
</div>
<script>
$( "#home" ).on( "pageshow", function( event, ui ) {
if (window.localStorage.getItem("chosenCountry")){
//then move straight to that country's show
$.mobile.changePage("#country_pool_list");
}else{
$.getJSON("http://api.snowpool.org/countries.js?callback=?", function(data) {
if(data.length == 0){
return;
}
$("#country_list").empty();
$('<li data-role="list-divider">Choose your country</li>').appendTo("#country_list");
$.each(data, function(i,item){
$('<li><a class="country_click" id="'+item.country.cached_slug+'" href="#country_pool_list">'+item.country.name+'</li>').appendTo("#country_list");
});
$("#country_list").listview('refresh');
});
}
});
</script>
</div> <!--end of main page -->
<!-- about page -->
<div data-role="page" id="about">
<div data-role="header">
<a href="#country_pool_list" class="home_button" class="ui-btn-left">Home</a>
<h1>Snowpool</h1>
<a href="#sign_in" class="login_button ui-btn-right">Sign in</a>
</div>
<div data-role="content">
<div id="aboutContent"></div>
</div>
<div data-role="footer">
<a href="#country_pool_list" class="home_button" class="ui-btn-left">Home</a>
</div>
<script>
$( "#about" ).on( "pageshow", function( event, ui ) {
$.getJSON("http://api.snowpool.org/about.js?callback=?", function(data) {
$("#aboutContent").empty().append(data.about);
});
});
</script>
</div> <!--end of main page -->
<!-- settings page -->
<div data-role="page" id="settings">
<div data-role="header">
<a href="#country_pool_list" class="home_button" class="ui-btn-left">Home</a>
<h1>Snowpool</h1>
<a href="#sign_in" class="login_button ui-btn-right">Sign in</a>
<a href="#add_carpool" class="add_carpool_button ui-btn-right">Add Carpool</a>
</div>
<div data-role="content">
<div id="settings_details">
</div>
<br/>
<a href="#home" rel="external" class="change_country_button" class="ui-btn-left">Change Country</a>
</div>
<div data-role="footer">
<a href="#country_pool_list" class="home_button" class="ui-btn-left">Home</a>
</div>
<script>
$( "#settings" ).on( "pageshow", function( event, ui ) {
//get the latest settings
$("#settings_details").empty().append("<strong>Country:</strong>"+users_country() + "<br/>");
$("#settings_details").trigger('create');
});
</script>
</div> <!--end of settings page -->
<!-- pools page -->
<div data-role="page" id="country_pool_list">
<div data-role="header">
<a href="#refresh" rel="external" class="refresh_button" class="ui-btn-left" data-icon="refresh">Refresh</a>
<h1>Snowpool</h1>
<a href="#sign_in" class="login_button ui-btn-right">Sign in</a>
<a href="#add_carpool" class="add_carpool_button ui-btn-right">Add Carpool</a>
</div>
<div data-role="content">
<div data-role="controlgroup" data-type="horizontal" data-inline="true">
<button class="filterbutton" id="allFilter">All</button>
<button class="filterbutton" id="offeredFilter">Offered</button>
<button class="filterbutton" id="wantedFilter">Wanted</button>
</div>
<ul id="append-pools" data-filter="true" data-filter-placeholder="Search pools" data-role="listview">
</ul>
</div>
<div data-role="footer" class="ui-bar">
<a href="#refresh" rel="external" class="refresh_button" class="ui-btn-left" data-icon="refresh">Refresh</a>
<a href="#about">About</a>
<a href="#settings" class="ui-btn-right" data-icon="settings">Settings</a>
</div>
<script>
$( "#country_pool_list" ).on( "pageshow", function( event, ui ) {
empty_and_refresh_carpools();
});
</script>
</div> <!--end of main page -->
<div data-role="page" id="pool_view">
<div data-role="header">
<a href="#country_pool_list" class="home_button" class="ui-btn-left">Home</a>
<h1>Snowpool</h1>
<a href="#sign_in" class="login_button ui-btn-right">Sign in</a>
</div>
<div data-role="content">
<div class="pool_flash"></div>
<div id="pool_details">
</div>
</div>
<div data-role="footer">
<a href="#country_pool_list" class="home_button" class="ui-btn-left">Home</a>
</div>
<script>
$( "#pool_view" ).on( "pageshow", function( event, ui ) {
$(".pool_flash").empty();
});
</script>
</div> <!--end of main page -->
<div id="sign_in" data-role="page">
<div data-role="header">
<h1>Snowpool</h1>
<a href="#country_pool_list" class="home_button" class="ui-btn-left">Home</a>
</div>
<div data-role="content">
<h5>You must create your account at www.snowpool.org before you can login with the mobile application</h5>
<div data-role="fieldcontain">
<label for="email">Email Address:</label>
<input type="email" name="email" id="sign_in_email" value="" />
</div>
</div>
<div data-role="content">
<div data-role="fieldcontain">
<label for="password">Password:</label>
<input type="password" name="password" id="sign_in_password" value="" />
</div>
</div>
<button type="submit" data-theme="a" id="sign_in_button">Sign in</button>
<div data-role="footer">
<a href="#about" class="ui-btn-left">About</a>
</div>
</div> <!--end of main page -->
<div id="add_carpool" data-role="page">
<div data-role="header">
<h1>Snowpool</h1>
<a href="#country_pool_list" class="home_button" class="ui-btn-left">Home</a>
</div>
<div data-role="content">
<div id="carpool_details">
<div data-role="fieldcontain">
<label for="carpool_field">Ski Field:</label>
<select id="carpool_field"></select>
</div>
<div data-role="fieldcontain">
<label for="carpool_date_leaving">Date leaving:</label>
<select id="carpool_date_leaving"></select>
</div>
<div data-role="fieldcontain">
<label for="carpool_date_returning">Date returning:</label>
<select id="carpool_date_returning"></select>
</div>
<div data-role="fieldcontain">
<label for="carpool_spaces">Spaces free:</label>
<select id="carpool_spaces">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</div>
<div data-role="fieldcontain">
<label for="carpool_leaving_from">Leaving from:</label>
<input type="text" id="carpool_leaving_from"/>
</div>
<div data-role="fieldcontain">
<label for="carpool_telephone">Telephone:</label>
<input type="text" id="carpool_telephone" />
</div>
<div data-role="fieldcontain">
<label for="carpool_wanted">Carpool Wanted:</label>
<input type="checkbox" id="carpool_wanted" value="1"/>
</div>
<div data-role="fieldcontain">
<label for="carpool_driven_before">Driven here before:</label>
<input type="checkbox" id="carpool_driven_before" value="1"/>
</div>
<div data-role="fieldcontain">
<label for="carpool_message">Message:</label>
<textarea id="carpool_message"></textarea>
</div>
<button type="submit" data-theme="a" id="submit_carpool_button">Submit Carpool</button>
</div><!-- end of carpool details div -->
</div>
<div data-role="footer">
<a href="#about" class="ui-btn-left">About</a>
</div>
<script>
$( "#add_carpool" ).on( "pageinit", function( event ) {
//input the field selector
var fields = users_fields();
var output = [];
output.push('<option selected value="">Select Field...</option>');
if (fields){
$.each(fields,function(){
output.push('<option value="'+ this.field.id +'">'+ this.field.name +'</option>');
});
$('#carpool_field').html(output.join(''));
$("#carpool_field").selectmenu('refresh', true);
}else{
alert("For some reason there are no fields.. please contact [email protected] with this issue!");
}
//setup the leaving date selects
var d = new Date();
d.setDate(d.getDate()-1);
var output = [];
$('#mySelect').html(output.join(''));
for (var i=0;i<10;i++){
d.setDate(d.getDate()+1);
var to_add = print_date(d);
if (i == 1){
output.push('<option selected value="'+ to_add +'">'+ to_add +'</option>');
}else{
output.push('<option value="'+ to_add +'">'+ to_add +'</option>');
}
}
$('#carpool_date_leaving').html(output.join(''));
$('#carpool_date_returning').html(output.join(''));
$("#carpool_date_leaving").selectmenu('refresh', true);
$("#carpool_date_returning").selectmenu('refresh', true);
$("#carpool_telephone").val(users_telephone());
$("#carpool_leaving_from").val(users_city());
$("#carpool_details").trigger('create');
});
$( "#add_carpool" ).on( "pageshow", function( event, ui ) {
});
</script>
</div> <!--end of main page -->
</body>
</html>