diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js index 104464b3881..7052d2138b6 100644 --- a/src/librustdoc/html/static/js/search.js +++ b/src/librustdoc/html/static/js/search.js @@ -1619,7 +1619,7 @@ window.initSearch = function(rawSearchIndex) { } function updateCrate(ev) { - updateLocalStorage("rustdoc-saved-filter-crate", ev.target.value); + updateLocalStorage("saved-filter-crate", ev.target.value); // In case you "cut" the entry from the search input, then change the crate filter // before paste back the previous search, you get the old search results without // the filter. To prevent this, we need to remove the previous results. diff --git a/src/librustdoc/html/static/js/settings.js b/src/librustdoc/html/static/js/settings.js index 47a8fcdfd5e..139fa5c9a11 100644 --- a/src/librustdoc/html/static/js/settings.js +++ b/src/librustdoc/html/static/js/settings.js @@ -4,7 +4,7 @@ (function () { function changeSetting(settingName, value) { - updateLocalStorage("rustdoc-" + settingName, value); + updateLocalStorage(settingName, value); switch (settingName) { case "theme": diff --git a/src/librustdoc/html/static/js/source-script.js b/src/librustdoc/html/static/js/source-script.js index 498f60e9f25..90490acccfd 100644 --- a/src/librustdoc/html/static/js/source-script.js +++ b/src/librustdoc/html/static/js/source-script.js @@ -82,11 +82,11 @@ function toggleSidebar() { if (child.innerText === ">") { sidebar.classList.add("expanded"); child.innerText = "<"; - updateLocalStorage("rustdoc-source-sidebar-show", "true"); + updateLocalStorage("source-sidebar-show", "true"); } else { sidebar.classList.remove("expanded"); child.innerText = ">"; - updateLocalStorage("rustdoc-source-sidebar-show", "false"); + updateLocalStorage("source-sidebar-show", "false"); } } @@ -97,7 +97,7 @@ function createSidebarToggle() { var inner = document.createElement("div"); - if (getCurrentValue("rustdoc-source-sidebar-show") === "true") { + if (getCurrentValue("source-sidebar-show") === "true") { inner.innerText = "<"; } else { inner.innerText = ">"; @@ -120,7 +120,7 @@ function createSourceSidebar() { var sidebar = document.createElement("div"); sidebar.id = "source-sidebar"; - if (getCurrentValue("rustdoc-source-sidebar-show") !== "true") { + if (getCurrentValue("source-sidebar-show") !== "true") { container.classList.remove("expanded"); } else { container.classList.add("expanded"); diff --git a/src/librustdoc/html/static/js/storage.js b/src/librustdoc/html/static/js/storage.js index 06bb34eb115..ccf3d0a581a 100644 --- a/src/librustdoc/html/static/js/storage.js +++ b/src/librustdoc/html/static/js/storage.js @@ -15,7 +15,7 @@ var settingsDataset = (function () { })(); function getSettingValue(settingName) { - var current = getCurrentValue('rustdoc-' + settingName); + var current = getCurrentValue(settingName); if (current !== null) { return current; } @@ -106,7 +106,7 @@ function hasOwnPropertyRustdoc(obj, property) { function updateLocalStorage(name, value) { try { - window.localStorage.setItem(name, value); + window.localStorage.setItem("rustdoc-" + name, value); } catch(e) { // localStorage is not accessible, do nothing } @@ -114,7 +114,7 @@ function updateLocalStorage(name, value) { function getCurrentValue(name) { try { - return window.localStorage.getItem(name); + return window.localStorage.getItem("rustdoc-" + name); } catch(e) { return null; } @@ -127,7 +127,7 @@ function switchTheme(styleElem, mainStyleElem, newTheme, saveTheme) { // If this new value comes from a system setting or from the previously // saved theme, no need to save it. if (saveTheme) { - updateLocalStorage("rustdoc-theme", newTheme); + updateLocalStorage("theme", newTheme); } if (styleElem.href === newHref) { @@ -158,7 +158,7 @@ function useSystemTheme(value) { value = true; } - updateLocalStorage("rustdoc-use-system-theme", value); + updateLocalStorage("use-system-theme", value); // update the toggle if we're on the settings page var toggle = document.getElementById("use-system-theme"); @@ -231,7 +231,7 @@ if (getSettingValue("use-system-theme") !== "false" && window.matchMedia) { if (getSettingValue("use-system-theme") === null && getSettingValue("preferred-dark-theme") === null && darkThemes.indexOf(localStoredTheme) >= 0) { - updateLocalStorage("rustdoc-preferred-dark-theme", localStoredTheme); + updateLocalStorage("preferred-dark-theme", localStoredTheme); } // call the function to initialize the theme at least once!