2018-12-26 08:45:53 +01:00
|
|
|
var state = (function() {
|
|
|
|
|
2019-01-03 23:30:27 +01:00
|
|
|
var current = {
|
|
|
|
header: {
|
|
|
|
clock: {
|
|
|
|
active: true,
|
|
|
|
hour24: true,
|
|
|
|
show: {
|
|
|
|
leadingZero: true,
|
|
|
|
seconds: true,
|
|
|
|
seperator: true,
|
|
|
|
meridiem: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
editAdd: {
|
|
|
|
active: true,
|
|
|
|
},
|
|
|
|
accent: {
|
|
|
|
active: true,
|
|
|
|
},
|
|
|
|
search: {
|
|
|
|
searching: false,
|
|
|
|
active: true,
|
|
|
|
grow: true,
|
|
|
|
engine: {
|
|
|
|
selected: "google",
|
|
|
|
google: {
|
|
|
|
url: "https://www.google.com/search"
|
|
|
|
},
|
|
|
|
duckduckgo: {
|
|
|
|
url: "https://duckduckgo.com/"
|
|
|
|
},
|
|
|
|
giphy: {
|
|
|
|
url: "https://giphy.com/search/"
|
|
|
|
},
|
|
|
|
custom: {
|
|
|
|
url: ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
buttons: {
|
|
|
|
show: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
link: {
|
|
|
|
editObject: null,
|
|
|
|
action: null,
|
|
|
|
newTab: false,
|
|
|
|
style: "block",
|
|
|
|
sort: "none"
|
|
|
|
},
|
|
|
|
layout: {
|
|
|
|
alignment: "left",
|
|
|
|
container: "wide",
|
|
|
|
theme: {
|
|
|
|
r: 0,
|
|
|
|
g: 255,
|
|
|
|
b: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
edit: {
|
|
|
|
active: false
|
|
|
|
},
|
|
|
|
menu: {
|
|
|
|
open: false
|
|
|
|
},
|
|
|
|
modal: {
|
|
|
|
active: false
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-12-26 08:45:53 +01:00
|
|
|
var get = function() {
|
|
|
|
return current;
|
|
|
|
};
|
|
|
|
|
2019-01-03 23:30:27 +01:00
|
|
|
var restore = function(data) {
|
|
|
|
if ("state" in data) {
|
|
|
|
current = data.state;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
var change = function(override) {
|
|
|
|
var options = {
|
|
|
|
path: null,
|
|
|
|
value: null
|
|
|
|
};
|
|
|
|
if (override) {
|
|
|
|
options = helper.applyOptions(options, override);
|
|
|
|
};
|
|
|
|
if (options.path != null) {
|
|
|
|
helper.setObject({
|
|
|
|
path: options.path,
|
|
|
|
object: current,
|
|
|
|
newValue: options.value
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
var init = function() {
|
|
|
|
if (data.load()) {
|
|
|
|
restore(data.load());
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-12-26 08:45:53 +01:00
|
|
|
return {
|
2019-01-03 23:30:27 +01:00
|
|
|
init: init,
|
|
|
|
get: get,
|
|
|
|
change: change,
|
|
|
|
restore: restore
|
2018-12-26 08:45:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
})();
|