Skip to content

Commit a47b971

Browse files
Merge branch 'master' into feature-time
2 parents 5e28d02 + 7a094e0 commit a47b971

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ <h2><i class="icon-settings rfloat"></i>Settings</h2>
101101
<div class="row option">
102102
<span><b>Cloud layer</b></span>
103103
<div class="switch off" id="sw_layers_clouds">
104-
<span class="thumb hourswitch"></span>
104+
<span class="thumb"></span>
105105
<input type="checkbox" id="opt_layers_clouds">
106106
</div>
107107
</div>
@@ -115,14 +115,14 @@ <h2><i class="icon-settings rfloat"></i>Settings</h2>
115115
<div class="row option">
116116
<span><b>Horizontal speed in hours</b></span>
117117
<div class="switch off" id="sw_haxis_hours">
118-
<span class="thumb hourswitch"></span>
118+
<span class="thumb"></span>
119119
<input type="checkbox" id="opt_haxis_hours">
120120
</div>
121121
</div>
122122
<div class="row option">
123123
<span><b>Hide receivers from the map</b></span>
124124
<div class="switch off" id="sw_hide_receivers">
125-
<span class="thumb hourswitch"></span>
125+
<span class="thumb"></span>
126126
<input type="checkbox" id="opt_hide_receivers">
127127
</div>
128128
</div>

js/app.js

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -477,10 +477,19 @@ $(window).ready(function() {
477477

478478
// settings page
479479

480-
if(offline.get('opt_daylight')) $('#sw_daylight').removeClass('off').addClass('on');
481-
482-
// offline and mobile
483-
$('#sw_layers_clouds, #sw_offline, #sw_station, #sw_imperial, #sw_haxis_hours, #sw_daylight, #sw_hide_receivers').click(function() {
480+
// list of all switches
481+
var opts = [
482+
"#sw_layers_clouds",
483+
"#sw_offline",
484+
"#sw_station",
485+
"#sw_imperial",
486+
"#sw_haxis_hours",
487+
"#sw_daylight",
488+
"#sw_hide_receivers"
489+
];
490+
491+
// applies functionality when switches are toggled
492+
$(opts.join(',')).click(function() {
484493
var e = $(this);
485494
var name = e.attr('id').replace('sw', 'opt');
486495
var on;
@@ -528,12 +537,12 @@ $(window).ready(function() {
528537
});
529538

530539
// set the switch, based on the remembered choice
531-
if(offline.get('opt_offline')) $('#sw_offline').removeClass('off').addClass('on');
532-
if(offline.get('opt_station')) $('#sw_station').removeClass('off').addClass('on');
533-
if(offline.get('opt_imperial')) $('#sw_imperial').removeClass('off').addClass('on');
534-
if(offline.get('opt_haxis_hours')) $('#sw_haxis_hours').removeClass('off').addClass('on');
535-
if(offline.get('opt_hide_receivers')) $('#sw_hide_receivers').removeClass('off').addClass('on');
536-
if(offline.get('opt_layers_clouds')) $('#sw_layers_clouds').removeClass('off').addClass('on');
540+
for(var k in opts) {
541+
var switch_id = opts[k];
542+
var opt_name = switch_id.replace("#sw_", "opt_");
543+
544+
if(offline.get(opt_name)) $(switch_id).removeClass('off').addClass('on');
545+
}
537546

538547
// force re-cache
539548
$('#sw_cache').click(function() {

0 commit comments

Comments
 (0)