1
- var body = $ ( 'body' ) , content = $ ( '#explorer content' ) , wrap = document . querySelector ( '#explorer wrap' ) , wrapper = $ ( wrap )
1
+ var body = jQuery ( 'body' ) , content = jQuery ( '#explorer content' ) , wrap = document . querySelector ( '#explorer wrap' ) , wrapper = jQuery ( wrap )
2
2
3
3
function importMomentLocale ( locale , cb ) {
4
4
importMomentLocaleCallback = cb
@@ -218,7 +218,7 @@ function initApp(){
218
218
app . on ( 'background-mode-unlock' , name => {
219
219
if ( parent . player && parent . winman ) parent . winman && parent . winman . backgroundModeUnlock ( name )
220
220
} ) ;
221
- $ ( ( ) => {
221
+ jQuery ( ( ) => {
222
222
console . log ( 'load app' )
223
223
if ( typeof ( Explorer ) == 'undefined' ) {
224
224
parent . updateWebView ( )
@@ -421,7 +421,7 @@ function initApp(){
421
421
explorer . reset ( )
422
422
}
423
423
} , 100 )
424
- } , true )
424
+ } , { passive : true } )
425
425
426
426
explorer . on ( 'prompt-start' , explorer . reset . bind ( explorer ) )
427
427
explorer . on ( 'ask-start' , explorer . reset . bind ( explorer ) )
@@ -446,7 +446,7 @@ function initApp(){
446
446
break
447
447
}
448
448
}
449
- } )
449
+ } , { passive : true } )
450
450
451
451
langUpdated ( )
452
452
app . emit ( 'init' )
@@ -501,7 +501,7 @@ function initApp(){
501
501
haUpdate ( )
502
502
} )
503
503
504
- var elp = $ ( '.explorer-location-pagination' ) , elpTxt = elp . find ( 'span' ) , elpTimer = 0 , elpDuration = 5000 , elpShown = false
504
+ var elp = jQuery ( '.explorer-location-pagination' ) , elpTxt = elp . find ( 'span' ) , elpTimer = 0 , elpDuration = 5000 , elpShown = false
505
505
const elpShow = txt => {
506
506
clearTimeout ( elpTimer )
507
507
if ( ! elpShown ) {
@@ -528,7 +528,7 @@ function initApp(){
528
528
explorer . on ( 'focus' , elpListener )
529
529
explorer . on ( 'render' , elpListener )
530
530
531
- var haTop = $ ( '#home-arrows-top' ) , haBottom = $ ( '#home-arrows-bottom' )
531
+ var haTop = jQuery ( '#home-arrows-top' ) , haBottom = jQuery ( '#home-arrows-bottom' )
532
532
haTop . on ( 'click' , ( ) => explorer . arrow ( 'up' ) )
533
533
haBottom . on ( 'click' , ( ) => explorer . arrow ( 'down' ) )
534
534
@@ -679,15 +679,21 @@ function initApp(){
679
679
}
680
680
} )
681
681
682
- var parentRoot = jQuery ( parent . document . documentElement )
683
- var energySaver = {
682
+ const parentRoot = jQuery ( parent . document . documentElement )
683
+ const energySaver = {
684
+ active : false ,
684
685
start : ( ) => {
686
+ if ( energySaver . active || typeof ( config ) == 'undefined' || ! config [ 'timeout-secs-energy-saving' ] ) return
687
+ energySaver . active = true
685
688
parent . animateBackground ( 'none' )
686
- parentRoot . addClass ( 'curtains curtains-alpha' ) . removeClass ( 'curtains-close' )
689
+ parent . player . closeCurtains ( true , false )
687
690
} ,
688
691
end : ( ) => {
689
- typeof ( config ) != 'undefined' && parent . animateBackground ( config [ 'animate-background' ] )
690
- parentRoot . addClass ( 'curtains-close curtains-alpha' ) . removeClass ( 'curtains' )
692
+ if ( ! energySaver . active || typeof ( config ) == 'undefined' || ! config [ 'timeout-secs-energy-saving' ] ) return
693
+ energySaver . active = false
694
+ parent . player . openCurtains ( true , true , ( ) => {
695
+ typeof ( config ) != 'undefined' && parent . animateBackground ( config [ 'animate-background' ] )
696
+ } )
691
697
}
692
698
}
693
699
idle . on ( 'idle' , ( ) => {
@@ -701,7 +707,7 @@ function initApp(){
701
707
streamer . active || streamer . isTuning ( ) || energySaver . start ( )
702
708
} )
703
709
idle . on ( 'active' , ( ) => energySaver . end ( ) )
704
- streamer . on ( 'show' , ( ) => energySaver . start ( ) )
710
+ streamer . on ( 'show' , ( ) => parent . animateBackground ( 'none' ) )
705
711
streamer . on ( 'hide' , ( ) => {
706
712
idle . reset ( ) // will not call idle.on('active') if not idle, so keep lines below to ensure
707
713
energySaver . end ( )
@@ -714,13 +720,13 @@ function initApp(){
714
720
hs . title = hs . alt = lang . EXIT
715
721
hs . addEventListener ( 'click' , ( ) => {
716
722
parent . winman && parent . winman . askExit ( )
717
- } )
723
+ } , { passive : true } )
718
724
719
725
let ha = document . getElementById ( 'header-about' )
720
726
ha . title = ha . alt = lang . ABOUT
721
727
ha . addEventListener ( 'click' , ( ) => {
722
728
app . emit ( 'about-dialog' )
723
- } )
729
+ } , { passive : true } )
724
730
725
731
ha = hs = undefined
726
732
@@ -756,7 +762,7 @@ function initApp(){
756
762
} else {
757
763
parent . addEventListener ( 'load' , ( ) => {
758
764
parent . appChannel . localEmit ( 'frontend' )
759
- } )
765
+ } , { once : true , passive : true } )
760
766
}
761
767
} )
762
768
}
0 commit comments