Skip to content

Commit eaa8f40

Browse files
authored
Merge pull request #1462 from luckylsk34/master
Fix for issue #1461
2 parents 887ea27 + 5b7a49f commit eaa8f40

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

src/jupyter_contrib_nbextensions/nbextensions/zenmode/main.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
}
1616

1717
#notebook-container {
18-
background-color: rgba(255, 255, 255, 0.8);
18+
background-color: rgba(255, 255, 255, 0);
1919
}
2020

21+
/*
2122
.cell {
2223
background-color: rgb(255, 255, 255);
2324
}
2425
25-
/*
2626
.CodeMirror {
2727
background: #F8FCCF;
2828
}

src/jupyter_contrib_nbextensions/nbextensions/zenmode/main.js

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,14 @@ define([
6060
$('#zenmode-toggle-btn .fa').removeClass("fa-rebel").addClass("fa-empire");
6161
$('#zenmodecss').remove();
6262

63-
// retrieve and reapply old bg css settings
64-
var oldBg = $('body').attr(oldBgAttrName) || "#ffffff";
65-
$('body').css({"background": oldBg});
6663

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+
6771
// This should be changed at some point in the future to preserve non-zenmode visibility settings
6872
$(menu_pattern).toggle(true);
6973
$(header_pattern).toggle(true);
@@ -84,15 +88,19 @@ define([
8488
background = requirejs.toUrl("./images/" + background);
8589
}
8690

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+
}
96104

97105
if (hide_menubar)
98106
{$(menu_pattern).toggle(false);}

0 commit comments

Comments
 (0)