@@ -60,10 +60,14 @@ define([
60
60
$ ( '#zenmode-toggle-btn .fa' ) . removeClass ( "fa-rebel" ) . addClass ( "fa-empire" ) ;
61
61
$ ( '#zenmodecss' ) . remove ( ) ;
62
62
63
- // retrieve and reapply old bg css settings
64
- var oldBg = $ ( 'body' ) . attr ( oldBgAttrName ) || "#ffffff" ;
65
- $ ( 'body' ) . css ( { "background" : oldBg } ) ;
66
63
64
+ // Remove zenmode css settings only when changes were made.
65
+ if ( backgrounds . length != 0 ) {
66
+ $ ( 'body' ) . css ( {
67
+ 'background-image' : 'none'
68
+ } )
69
+ }
70
+
67
71
// This should be changed at some point in the future to preserve non-zenmode visibility settings
68
72
$ ( menu_pattern ) . toggle ( true ) ;
69
73
$ ( header_pattern ) . toggle ( true ) ;
@@ -84,15 +88,19 @@ define([
84
88
background = requirejs . toUrl ( "./images/" + background ) ;
85
89
}
86
90
87
- // save old bg css, then apply new
88
- $ ( 'body' ) . attr ( oldBgAttrName , ( $ ( 'body' ) . get ( 0 ) . style . background || "" ) ) ;
89
- $ ( 'body' ) . css ( {
90
- 'background' : 'url(' + background + ') no-repeat center center fixed' ,
91
- '-webkit-background-size' : 'cover' ,
92
- '-moz-background-size' : 'cover' ,
93
- '-o-background-size' : 'cover' ,
94
- 'background-size' : 'cover'
95
- } ) ;
91
+ // Apply zenmode css when there are images to be used.
92
+ if ( backgrounds . length != 0 ) {
93
+ $ ( 'body' ) . css ( {
94
+ 'background-image' : 'url(' + background + ')' ,
95
+ 'background-repeat' : 'no-repeat' ,
96
+ 'background-position' : 'center center' ,
97
+ 'background-attachment' : 'fixed' ,
98
+ '-webkit-background-size' : 'cover' ,
99
+ '-moz-background-size' : 'cover' ,
100
+ '-o-background-size' : 'cover' ,
101
+ 'background-size' : 'cover'
102
+ } ) ;
103
+ }
96
104
97
105
if ( hide_menubar )
98
106
{ $ ( menu_pattern ) . toggle ( false ) ; }
0 commit comments