From 793fb8f654f5b944ed372cf39e8903c5ced9a7c6 Mon Sep 17 00:00:00 2001 From: steveklabnik Date: Tue, 19 Sep 2017 16:59:16 -0400 Subject: [PATCH 1/3] Change key for theme to not clobber old books Fixes https://github.com/azerupi/mdBook/issues/448 --- src/theme/book.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/theme/book.js b/src/theme/book.js index d7f0e690..8351bc7f 100644 --- a/src/theme/book.js +++ b/src/theme/book.js @@ -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); } From f562878131c06cb976bd9e847a523e4ba0851551 Mon Sep 17 00:00:00 2001 From: steveklabnik Date: Fri, 22 Sep 2017 13:56:58 -0400 Subject: [PATCH 2/3] I forgot one theme, thanks budziq --- src/theme/index.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/theme/index.hbs b/src/theme/index.hbs index 3b4dbd12..f4803886 100644 --- a/src/theme/index.hbs +++ b/src/theme/index.hbs @@ -60,7 +60,7 @@ From 9b64db908fbaedcf6e9df6764344ab9874b3b94f Mon Sep 17 00:00:00 2001 From: steveklabnik Date: Fri, 22 Sep 2017 13:58:45 -0400 Subject: [PATCH 3/3] prefix sidebar too --- src/theme/book.js | 8 ++++---- src/theme/index.hbs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/theme/book.js b/src/theme/book.js index 8351bc7f..56dc7425 100644 --- a/src/theme/book.js +++ b/src/theme/book.js @@ -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'); } } } diff --git a/src/theme/index.hbs b/src/theme/index.hbs index f4803886..e115ee64 100644 --- a/src/theme/index.hbs +++ b/src/theme/index.hbs @@ -67,7 +67,7 @@