@@ -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 ( ) {
0 commit comments