Skip to content

Commit 796fd8d

Browse files
added option to hide stations
1 parent e76a582 commit 796fd8d

File tree

4 files changed

+37
-29
lines changed

4 files changed

+37
-29
lines changed

cache.manifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CACHE MANIFEST
2-
# version 266
2+
# version 268
33

44
# gogole maps files
55
http://maps.google.com/maps/api/js?v=3.10&sensor=false&language=en_us&key=AIzaSyCOqkcNey4CCyG4X0X5qxHAhCgD8g5DwXg

index.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,13 @@ <h2><i class="icon-settings rfloat"></i>Settings</h2>
112112
<input type="checkbox" id="opt_haxis_hours">
113113
</div>
114114
</div>
115+
<div class="row option">
116+
<span><b>Hide receivers from the map</b></span>
117+
<div class="switch off" id="sw_hide_receivers">
118+
<span class="thumb hourswitch"></span>
119+
<input type="checkbox" id="opt_hide_receivers">
120+
</div>
121+
</div>
115122
<div class="row option">
116123
<span><b>Availability offline</b></span>
117124
<div class="switch off" id="sw_offline">
@@ -128,7 +135,7 @@ <h2><i class="icon-settings rfloat"></i>Settings</h2>
128135
</div>
129136
<div class="row info">
130137
<span>
131-
Chase car equipped with radio reciever
138+
Chase car equipped with radio receiver
132139
</span>
133140
</div>
134141
<div class="row option">

js/app.js

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -469,35 +469,10 @@ $(window).ready(function() {
469469

470470
// settings page
471471

472-
// daylight overlay
473-
$('#sw_daylight').click(function() {
474-
var e = $(this);
475-
var name = e.attr('id').replace('sw', 'opt');
476-
var on;
477-
478-
if(e.hasClass('on')) {
479-
e.removeClass('on').addClass('off');
480-
on = 0;
481-
nite.hide();
482-
483-
//analytics
484-
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'Functionality', 'Turn Off', 'Nite Overlay']);
485-
} else {
486-
e.removeClass('off').addClass('on');
487-
on = 1;
488-
nite.show();
489-
490-
//analytics
491-
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'Functionality', 'Turn On', 'Nite Overlay']);
492-
}
493-
494-
offline.set(name, on);
495-
});
496-
497472
if(offline.get('opt_daylight')) $('#sw_daylight').removeClass('off').addClass('on');
498473

499474
// offline and mobile
500-
$('#sw_offline, #sw_station, #sw_imperial, #sw_haxis_hours').click(function() {
475+
$('#sw_offline, #sw_station, #sw_imperial, #sw_haxis_hours, #sw_daylight, #sw_hide_receivers').click(function() {
501476
var e = $(this);
502477
var name = e.attr('id').replace('sw', 'opt');
503478
var on;
@@ -516,14 +491,37 @@ $(window).ready(function() {
516491
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'Functionality', 'Turn On', name]);
517492
}
518493

494+
// remember choice
519495
offline.set(name, on);
520-
if(name == "opt_imperial" || name == "opt_haxis_hours") refreshUI();
496+
497+
// execute functionality
498+
switch(name) {
499+
case "opt_imperial":;
500+
case "opt_haxis_hours":;
501+
refreshUI();
502+
break;
503+
case "opt_daylight":
504+
if(on) { nite.show(); }
505+
else { nite.hide(); }
506+
break;
507+
case "opt_hide_receivers":
508+
if(on) {
509+
updateReceivers([]);
510+
clearTimeout(periodical_listeners);
511+
}
512+
else {
513+
refreshReceivers();
514+
}
515+
516+
}
521517
});
522518

519+
// set the switch, based on the remembered choice
523520
if(offline.get('opt_offline')) $('#sw_offline').removeClass('off').addClass('on');
524521
if(offline.get('opt_station')) $('#sw_station').removeClass('off').addClass('on');
525522
if(offline.get('opt_imperial')) $('#sw_imperial').removeClass('off').addClass('on');
526523
if(offline.get('opt_haxis_hours')) $('#sw_haxis_hours').removeClass('off').addClass('on');
524+
if(offline.get('opt_hide_receivers')) $('#sw_hide_receivers').removeClass('off').addClass('on');
527525

528526
// force re-cache
529527
$('#sw_cache').click(function() {

js/tracker.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,9 @@ function refresh() {
931931
}
932932

933933
function refreshReceivers() {
934+
// if options to hide receivers is selected do nothing
935+
if(offline.get('opt_hide_receivers')) return;
936+
934937
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'ajax', 'refresh', 'Recievers']);
935938

936939
$.ajax({

0 commit comments

Comments
 (0)