Move usableLocalStorage() above functions that make use of it

This commit is contained in:
Roy Wellington Ⅳ 2018-10-16 22:15:27 -07:00
parent 8362aa2178
commit cbe98ec803

View File

@ -26,21 +26,6 @@ function onEach(arr, func) {
return false;
}
function updateLocalStorage(name, value) {
if (usableLocalStorage()) {
localStorage[name] = value;
} else {
// No Web Storage support so we do nothing
}
}
function getCurrentValue(name) {
if (usableLocalStorage() && localStorage[name] !== undefined) {
return localStorage[name];
}
return null;
}
function usableLocalStorage() {
// Check if the browser supports localStorage at all:
if (typeof(Storage) === "undefined") {
@ -59,6 +44,21 @@ function usableLocalStorage() {
return true;
}
function updateLocalStorage(name, value) {
if (usableLocalStorage()) {
localStorage[name] = value;
} else {
// No Web Storage support so we do nothing
}
}
function getCurrentValue(name) {
if (usableLocalStorage() && localStorage[name] !== undefined) {
return localStorage[name];
}
return null;
}
function switchTheme(styleElem, mainStyleElem, newTheme) {
var fullBasicCss = "rustdoc" + resourcesSuffix + ".css";
var fullNewTheme = newTheme + resourcesSuffix + ".css";