Move usableLocalStorage() above functions that make use of it
This commit is contained in:
parent
8362aa2178
commit
cbe98ec803
1 changed files with 15 additions and 15 deletions
|
@ -26,21 +26,6 @@ function onEach(arr, func) {
|
||||||
return false;
|
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() {
|
function usableLocalStorage() {
|
||||||
// Check if the browser supports localStorage at all:
|
// Check if the browser supports localStorage at all:
|
||||||
if (typeof(Storage) === "undefined") {
|
if (typeof(Storage) === "undefined") {
|
||||||
|
@ -59,6 +44,21 @@ function usableLocalStorage() {
|
||||||
return true;
|
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) {
|
function switchTheme(styleElem, mainStyleElem, newTheme) {
|
||||||
var fullBasicCss = "rustdoc" + resourcesSuffix + ".css";
|
var fullBasicCss = "rustdoc" + resourcesSuffix + ".css";
|
||||||
var fullNewTheme = newTheme + resourcesSuffix + ".css";
|
var fullNewTheme = newTheme + resourcesSuffix + ".css";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue