Merge pull request #449 from steveklabnik/fix-regression

Change key for theme to not clobber old books
This commit is contained in:
Mathieu David 2017-09-23 20:42:31 +02:00 committed by GitHub
commit a0515bd104
2 changed files with 8 additions and 8 deletions

View File

@ -7,7 +7,7 @@ $( document ).ready(function() {
window.onunload = function(){};
// Set theme
var theme = store.get('theme');
var theme = store.get('mdbook-theme');
if (theme === null || theme === undefined) { theme = 'light'; }
set_theme(theme);
@ -145,7 +145,7 @@ $( document ).ready(function() {
});
}
store.set('theme', theme);
store.set('mdbook-theme', theme);
$('body').removeClass().addClass(theme);
}
@ -336,17 +336,17 @@ function sidebarToggle() {
var html = $("html");
if ( html.hasClass("sidebar-hidden") ) {
html.removeClass("sidebar-hidden").addClass("sidebar-visible");
store.set('sidebar', 'visible');
store.set('mdbook-sidebar', 'visible');
} else if ( html.hasClass("sidebar-visible") ) {
html.removeClass("sidebar-visible").addClass("sidebar-hidden");
store.set('sidebar', 'hidden');
store.set('mdbook-sidebar', 'hidden');
} else {
if($("#sidebar").position().left === 0){
html.addClass("sidebar-hidden");
store.set('sidebar', 'hidden');
store.set('mdbook-sidebar', 'hidden');
} else {
html.addClass("sidebar-visible");
store.set('sidebar', 'visible');
store.set('mdbook-sidebar', 'visible');
}
}
}

View File

@ -60,14 +60,14 @@
<body class="light">
<!-- Set the theme before any content is loaded, prevents flash -->
<script type="text/javascript">
var theme = store.get('theme');
var theme = store.get('mdbook-theme');
if (theme === null || theme === undefined) { theme = 'light'; }
$('body').removeClass().addClass(theme);
</script>
<!-- Hide / unhide sidebar before it is displayed -->
<script type="text/javascript">
var sidebar = store.get('sidebar');
var sidebar = store.get('mdbook-sidebar');
if (sidebar === "hidden") { $("html").addClass("sidebar-hidden") }
else if (sidebar === "visible") { $("html").addClass("sidebar-visible") }
</script>