[refactor] move default setting values to state module

This commit is contained in:
zombieFox 2019-12-02 21:40:45 +00:00
parent 0bdbfee545
commit 05808e4c6d
21 changed files with 444 additions and 311 deletions

View File

@ -8,7 +8,7 @@ var autoSuggest = (function() {
mod.open = function() { mod.open = function() {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "autoSuggest", path: "autoSuggest",
newValue: true newValue: true
}); });
@ -16,7 +16,7 @@ var autoSuggest = (function() {
mod.close = function() { mod.close = function() {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "autoSuggest", path: "autoSuggest",
newValue: false newValue: false
}); });

View File

@ -15,12 +15,12 @@ var background = (function() {
mod.clear = { mod.clear = {
file: function() { file: function() {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "background.image.file.name", path: "background.image.file.name",
newValue: "" newValue: ""
}); });
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "background.image.file.data", path: "background.image.file.data",
newValue: "" newValue: ""
}); });
@ -30,12 +30,12 @@ var background = (function() {
mod.image = { mod.image = {
file: function(name, data) { file: function(name, data) {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "background.image.file.name", path: "background.image.file.name",
newValue: name newValue: name
}); });
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "background.image.file.data", path: "background.image.file.data",
newValue: data newValue: data
}); });
@ -71,7 +71,7 @@ var background = (function() {
render.color = { render.color = {
custom: function() { custom: function() {
helper.e("html").style.setProperty("--background-color-custom", state.get().background.color.custom.r + ", " + state.get().background.color.custom.g + ", " + state.get().background.color.custom.b); helper.e("html").style.setProperty("--background-color-custom", state.get.current().background.color.custom.r + ", " + state.get.current().background.color.custom.g + ", " + state.get.current().background.color.custom.b);
}, },
clearHTML: function() { clearHTML: function() {
helper.e("html").style.backgroundColor = ""; helper.e("html").style.backgroundColor = "";
@ -80,16 +80,16 @@ var background = (function() {
render.image = function() { render.image = function() {
var html = helper.e("html"); var html = helper.e("html");
if (state.get().background.image.show) { if (state.get.current().background.image.show) {
if (state.get().background.image.from == "file") { if (state.get.current().background.image.from == "file") {
html.style.setProperty("--background-image", "url(" + state.get().background.image.file.data + ")"); html.style.setProperty("--background-image", "url(" + state.get.current().background.image.file.data + ")");
} else if (state.get().background.image.from == "url") { } else if (state.get.current().background.image.from == "url") {
if (/\s+/g.test(state.get().background.image.url)) { if (/\s+/g.test(state.get.current().background.image.url)) {
var allUrls = state.get().background.image.url.split(/\s+/); var allUrls = state.get.current().background.image.url.split(/\s+/);
var randomUrl = allUrls[Math.floor(Math.random() * allUrls.length)]; var randomUrl = allUrls[Math.floor(Math.random() * allUrls.length)];
html.style.setProperty("--background-image", "url(" + randomUrl + ")"); html.style.setProperty("--background-image", "url(" + randomUrl + ")");
} else { } else {
html.style.setProperty("--background-image", "url(" + state.get().background.image.url + ")"); html.style.setProperty("--background-image", "url(" + state.get.current().background.image.url + ")");
}; };
}; };
} else { } else {
@ -99,27 +99,27 @@ var background = (function() {
render.blur = function() { render.blur = function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--background-blur", state.get().background.image.blur + "px"); html.style.setProperty("--background-blur", state.get.current().background.image.blur + "px");
}; };
render.grayscale = function() { render.grayscale = function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--background-grayscale", state.get().background.image.grayscale); html.style.setProperty("--background-grayscale", state.get.current().background.image.grayscale);
}; };
render.opacity = function() { render.opacity = function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--background-opacity", state.get().background.image.opacity); html.style.setProperty("--background-opacity", state.get.current().background.image.opacity);
}; };
render.scale = function() { render.scale = function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--background-scale", state.get().background.image.scale); html.style.setProperty("--background-scale", state.get.current().background.image.scale);
}; };
render.accent = function() { render.accent = function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--background-accent", state.get().background.image.accent); html.style.setProperty("--background-accent", state.get.current().background.image.accent);
}; };
render.input = { render.input = {
@ -127,16 +127,16 @@ var background = (function() {
helper.e(".control-background-image-file").value = ""; helper.e(".control-background-image-file").value = "";
}, },
picker: function() { picker: function() {
helper.e(".control-background-color-custom-current-picker").value = helper.rgbToHex(state.get().background.color.custom); helper.e(".control-background-color-custom-current-picker").value = helper.rgbToHex(state.get.current().background.color.custom);
}, },
hex: function() { hex: function() {
helper.e(".control-background-color-custom-current-hex").value = helper.rgbToHex(state.get().background.color.custom); helper.e(".control-background-color-custom-current-hex").value = helper.rgbToHex(state.get.current().background.color.custom);
} }
}; };
render.feedback = { render.feedback = {
init: function() { init: function() {
if (state.get().background.image.file.name != "") { if (state.get.current().background.image.file.name != "") {
render.feedback.current(); render.feedback.current();
} else { } else {
render.feedback.empty(); render.feedback.empty();
@ -150,7 +150,7 @@ var background = (function() {
current: function() { current: function() {
var controlBackgroundImageFileFeedback = helper.e(".control-background-image-file-feedback"); var controlBackgroundImageFileFeedback = helper.e(".control-background-image-file-feedback");
var para1 = helper.node("p:Image loaded.|class:muted small"); var para1 = helper.node("p:Image loaded.|class:muted small");
var para2 = helper.node("p:" + state.get().background.image.file.name); var para2 = helper.node("p:" + state.get.current().background.image.file.name);
controlBackgroundImageFileFeedback.appendChild(para1); controlBackgroundImageFileFeedback.appendChild(para1);
controlBackgroundImageFileFeedback.appendChild(para2); controlBackgroundImageFileFeedback.appendChild(para2);
}, },

View File

@ -19,7 +19,7 @@ var clock = (function() {
}; };
render.all = function() { render.all = function() {
if (state.get().header.clock.seconds.show || state.get().header.clock.minutes.show || state.get().header.clock.hours.show) { if (state.get.current().header.clock.seconds.show || state.get.current().header.clock.minutes.show || state.get.current().header.clock.hours.show) {
var timeDateNow = moment(); var timeDateNow = moment();
var timeStrings = { var timeStrings = {
hours: null, hours: null,
@ -31,20 +31,20 @@ var clock = (function() {
hours: { hours: {
word: function() { word: function() {
timeStrings.hours = timeDateNow.hours(); timeStrings.hours = timeDateNow.hours();
if (!state.get().header.clock.hour24.show && timeDateNow.hours() > 12) { if (!state.get.current().header.clock.hour24.show && timeDateNow.hours() > 12) {
timeStrings.hours = timeStrings.hours - 12; timeStrings.hours = timeStrings.hours - 12;
}; };
timeStrings.hours = helper.toWords(timeStrings.hours); timeStrings.hours = helper.toWords(timeStrings.hours);
if (state.get().header.clock.hour24.show && timeDateNow.hours() > 0 && timeDateNow.hours() < 10) { if (state.get.current().header.clock.hour24.show && timeDateNow.hours() > 0 && timeDateNow.hours() < 10) {
timeStrings.hours = "Zero " + timeStrings.hours; timeStrings.hours = "Zero " + timeStrings.hours;
}; };
}, },
number: function() { number: function() {
timeStrings.hours = timeDateNow.hours(); timeStrings.hours = timeDateNow.hours();
if (!state.get().header.clock.hour24.show && timeDateNow.hours() > 12) { if (!state.get.current().header.clock.hour24.show && timeDateNow.hours() > 12) {
timeStrings.hours = timeStrings.hours - 12; timeStrings.hours = timeStrings.hours - 12;
}; };
if (state.get().header.clock.hour24.show && timeDateNow.hours() < 10) { if (state.get.current().header.clock.hour24.show && timeDateNow.hours() < 10) {
timeStrings.hours = "0" + timeStrings.hours; timeStrings.hours = "0" + timeStrings.hours;
}; };
} }
@ -81,28 +81,28 @@ var clock = (function() {
timeStrings.meridiem = timeDateNow.format("A"); timeStrings.meridiem = timeDateNow.format("A");
} }
}; };
action.hours[state.get().header.clock.hours.display](); action.hours[state.get.current().header.clock.hours.display]();
action.minutes[state.get().header.clock.minutes.display](); action.minutes[state.get.current().header.clock.minutes.display]();
action.seconds[state.get().header.clock.seconds.display](); action.seconds[state.get.current().header.clock.seconds.display]();
action.meridiem(); action.meridiem();
var clock = helper.e(".clock"); var clock = helper.e(".clock");
var elementHours = helper.node("span:" + timeStrings.hours + "|class:clock-item clock-hours"); var elementHours = helper.node("span:" + timeStrings.hours + "|class:clock-item clock-hours");
var elementMinutes = helper.node("span:" + timeStrings.minutes + "|class:clock-item clock-minutes"); var elementMinutes = helper.node("span:" + timeStrings.minutes + "|class:clock-item clock-minutes");
var elementSeconds = helper.node("span:" + timeStrings.seconds + "|class:clock-item clock-seconds"); var elementSeconds = helper.node("span:" + timeStrings.seconds + "|class:clock-item clock-seconds");
var elementMeridiem = helper.node("span:" + timeStrings.meridiem + "|class:clock-item clock-meridiem"); var elementMeridiem = helper.node("span:" + timeStrings.meridiem + "|class:clock-item clock-meridiem");
if (state.get().header.clock.hours.show) { if (state.get.current().header.clock.hours.show) {
clock.appendChild(elementHours); clock.appendChild(elementHours);
}; };
if (state.get().header.clock.minutes.show) { if (state.get.current().header.clock.minutes.show) {
clock.appendChild(elementMinutes); clock.appendChild(elementMinutes);
}; };
if (state.get().header.clock.seconds.show) { if (state.get.current().header.clock.seconds.show) {
clock.appendChild(elementSeconds); clock.appendChild(elementSeconds);
}; };
if (!state.get().header.clock.hour24.show && state.get().header.clock.meridiem.show) { if (!state.get.current().header.clock.hour24.show && state.get.current().header.clock.meridiem.show) {
clock.appendChild(elementMeridiem); clock.appendChild(elementMeridiem);
}; };
if (state.get().header.clock.separator.show) { if (state.get.current().header.clock.separator.show) {
var separatorCharacter = ":"; var separatorCharacter = ":";
var parts = clock.querySelectorAll("span"); var parts = clock.querySelectorAll("span");
if (parts.length > 1) { if (parts.length > 1) {

View File

@ -152,7 +152,10 @@ var control = (function() {
} }
}], }],
func: function() { func: function() {
mod.setValue("layout.width", 80); mod.setValue("layout.width", helper.getObject({
object: state.mod.default,
path: "layout.width"
}));
layout.render.width(); layout.render.width();
render.update(); render.update();
} }
@ -298,7 +301,10 @@ var control = (function() {
} }
}], }],
func: function() { func: function() {
mod.setValue("layout.padding", 4); mod.setValue("layout.padding", helper.getObject({
object: state.mod.default,
path: "layout.padding"
}));
layout.render.padding(); layout.render.padding();
render.update(); render.update();
} }
@ -363,7 +369,10 @@ var control = (function() {
} }
}], }],
func: function() { func: function() {
mod.setValue("layout.gutter", 2); mod.setValue("layout.gutter", helper.getObject({
object: state.mod.default,
path: "layout.gutter"
}));
layout.render.gutter(); layout.render.gutter();
render.update(); render.update();
} }
@ -429,7 +438,10 @@ var control = (function() {
} }
}], }],
func: function() { func: function() {
mod.setValue("layout.size", 1); mod.setValue("layout.size", helper.getObject({
object: state.mod.default,
path: "layout.size"
}));
layout.render.size(); layout.render.size();
render.update(); render.update();
} }
@ -515,7 +527,7 @@ var control = (function() {
}], }],
func: function() { func: function() {
mod.setValue("header.area.width", helper.getObject({ mod.setValue("header.area.width", helper.getObject({
object: state.get(), object: state.get.current(),
path: "link.area.width" path: "link.area.width"
})); }));
header.render.area.width(); header.render.area.width();
@ -694,7 +706,10 @@ var control = (function() {
} }
}], }],
func: function() { func: function() {
mod.setValue("header.greeting.size", 1); mod.setValue("header.greeting.size", helper.getObject({
object: state.mod.default,
path: "header.greeting.size"
}));
header.render.greeting.size(); header.render.greeting.size();
render.update(); render.update();
} }
@ -786,7 +801,10 @@ var control = (function() {
} }
}], }],
func: function() { func: function() {
mod.setValue("header.transitional.size", 1); mod.setValue("header.transitional.size", helper.getObject({
object: state.mod.default,
path: "header.transitional.size"
}));
header.render.transitional.size(); header.render.transitional.size();
render.update(); render.update();
} }
@ -1002,7 +1020,10 @@ var control = (function() {
} }
}], }],
func: function() { func: function() {
mod.setValue("header.clock.size", 1); mod.setValue("header.clock.size", helper.getObject({
object: state.mod.default,
path: "header.clock.size"
}));
header.render.clock.size(); header.render.clock.size();
render.update(); render.update();
} }
@ -1356,7 +1377,10 @@ var control = (function() {
} }
}], }],
func: function() { func: function() {
mod.setValue("header.date.size", 1); mod.setValue("header.date.size", helper.getObject({
object: state.mod.default,
path: "header.date.size"
}));
header.render.date.size(); header.render.date.size();
render.update(); render.update();
} }
@ -1602,7 +1626,10 @@ var control = (function() {
} }
}], }],
func: function() { func: function() {
mod.setValue("header.search.size", 1); mod.setValue("header.search.size", helper.getObject({
object: state.mod.default,
path: "header.search.size"
}));
header.render.search.size(); header.render.search.size();
render.update(); render.update();
} }
@ -1698,7 +1725,10 @@ var control = (function() {
} }
}], }],
func: function() { func: function() {
mod.setValue("header.button.size", 1); mod.setValue("header.button.size", helper.getObject({
object: state.mod.default,
path: "header.button.size"
}));
header.render.button.size(); header.render.button.size();
render.update(); render.update();
} }
@ -1814,7 +1844,10 @@ var control = (function() {
} }
}], }],
func: function() { func: function() {
mod.setValue("group.name.size", 1); mod.setValue("group.name.size", helper.getObject({
object: state.mod.default,
path: "group.name.size"
}));
link.render.group.size(); link.render.group.size();
render.update(); render.update();
} }
@ -1964,7 +1997,7 @@ var control = (function() {
}], }],
func: function() { func: function() {
mod.setValue("link.area.width", helper.getObject({ mod.setValue("link.area.width", helper.getObject({
object: state.get(), object: state.get.current(),
path: "header.area.width" path: "header.area.width"
})); }));
link.render.area.width(); link.render.area.width();
@ -2089,7 +2122,10 @@ var control = (function() {
} }
}], }],
func: function() { func: function() {
mod.setValue("link.item.size", 1); mod.setValue("link.item.size", helper.getObject({
object: state.mod.default,
path: "link.item.size"
}));
link.render.item.size(); link.render.item.size();
render.update(); render.update();
} }
@ -2178,7 +2214,10 @@ var control = (function() {
element: helper.e(".control-link-item-display-letcon-letter-size-default"), element: helper.e(".control-link-item-display-letcon-letter-size-default"),
type: "button", type: "button",
func: function() { func: function() {
mod.setValue("link.item.display.letcon.letter.size", 3); mod.setValue("link.item.display.letcon.letter.size", helper.getObject({
object: state.mod.default,
path: "link.item.display.letcon.letter.size"
}));
link.render.item.display.letter(); link.render.item.display.letter();
render.update(); render.update();
} }
@ -2196,7 +2235,10 @@ var control = (function() {
element: helper.e(".control-link-item-display-letcon-icon-size-default"), element: helper.e(".control-link-item-display-letcon-icon-size-default"),
type: "button", type: "button",
func: function() { func: function() {
mod.setValue("link.item.display.letcon.icon.size", 3); mod.setValue("link.item.display.letcon.icon.size", helper.getObject({
object: state.mod.default,
path: "link.item.display.letcon.icon.size"
}));
link.render.item.display.icon(); link.render.item.display.icon();
render.update(); render.update();
} }
@ -2222,7 +2264,10 @@ var control = (function() {
element: helper.e(".control-link-item-display-name-size-default"), element: helper.e(".control-link-item-display-name-size-default"),
type: "button", type: "button",
func: function() { func: function() {
mod.setValue("link.item.display.name.size", 0.9); mod.setValue("link.item.display.name.size", helper.getObject({
object: state.mod.default,
path: "link.item.display.name.size"
}));
link.render.item.name(); link.render.item.name();
render.update(); render.update();
} }
@ -2239,7 +2284,10 @@ var control = (function() {
element: helper.e(".control-link-item-display-rotate-default"), element: helper.e(".control-link-item-display-rotate-default"),
type: "button", type: "button",
func: function() { func: function() {
mod.setValue("link.item.display.rotate", 0); mod.setValue("link.item.display.rotate", helper.getObject({
object: state.mod.default,
path: "link.item.display.rotate"
}));
link.render.item.rotate(); link.render.item.rotate();
render.update(); render.update();
} }
@ -2257,7 +2305,10 @@ var control = (function() {
element: helper.e(".control-link-item-display-translate-x-default"), element: helper.e(".control-link-item-display-translate-x-default"),
type: "button", type: "button",
func: function() { func: function() {
mod.setValue("link.item.display.translate.x", 0); mod.setValue("link.item.display.translate.x", helper.getObject({
object: state.mod.default,
path: "link.item.display.translate.x"
}));
link.render.item.translate.x(); link.render.item.translate.x();
render.update(); render.update();
} }
@ -2275,7 +2326,10 @@ var control = (function() {
element: helper.e(".control-link-item-display-translate-y-default"), element: helper.e(".control-link-item-display-translate-y-default"),
type: "button", type: "button",
func: function() { func: function() {
mod.setValue("link.item.display.translate.y", 0); mod.setValue("link.item.display.translate.y", helper.getObject({
object: state.mod.default,
path: "link.item.display.translate.y"
}));
link.render.item.translate.y(); link.render.item.translate.y();
render.update(); render.update();
} }
@ -2466,7 +2520,10 @@ var control = (function() {
element: helper.e(".control-theme-radius-default"), element: helper.e(".control-theme-radius-default"),
type: "button", type: "button",
func: function() { func: function() {
mod.setValue("theme.radius", 0.25); mod.setValue("theme.radius", helper.getObject({
object: state.mod.default,
path: "theme.radius"
}));
theme.render.radius(); theme.render.radius();
render.update(); render.update();
} }
@ -2678,7 +2735,7 @@ var control = (function() {
mod.setValue = function(path, value) { mod.setValue = function(path, value) {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: path, path: path,
newValue: value newValue: value
}); });
@ -2742,12 +2799,12 @@ var control = (function() {
}); });
}; };
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: object.path, path: object.path,
newValue: newValue newValue: newValue
}); });
// console.log("state set", object.path, helper.getObject({ // console.log("state set", object.path, helper.getObject({
// object: state.get(), // object: state.get.current(),
// path: object.path // path: object.path
// })); // }));
}; };
@ -2807,23 +2864,23 @@ var control = (function() {
helper.removeClass(html, "is-header-area-alignment-left"); helper.removeClass(html, "is-header-area-alignment-left");
helper.removeClass(html, "is-header-area-alignment-center"); helper.removeClass(html, "is-header-area-alignment-center");
helper.removeClass(html, "is-header-area-alignment-right"); helper.removeClass(html, "is-header-area-alignment-right");
helper.addClass(html, "is-header-area-alignment-" + state.get().header.area.alignment); helper.addClass(html, "is-header-area-alignment-" + state.get.current().header.area.alignment);
}; };
var _item = function() { var _item = function() {
helper.removeClass(html, "is-header-item-alignment-left"); helper.removeClass(html, "is-header-item-alignment-left");
helper.removeClass(html, "is-header-item-alignment-center"); helper.removeClass(html, "is-header-item-alignment-center");
helper.removeClass(html, "is-header-item-alignment-right"); helper.removeClass(html, "is-header-item-alignment-right");
helper.addClass(html, "is-header-item-alignment-" + state.get().header.item.alignment); helper.addClass(html, "is-header-item-alignment-" + state.get.current().header.item.alignment);
}; };
var _clock = function() { var _clock = function() {
if (state.get().header.clock.seconds.show || state.get().header.clock.minutes.show || state.get().header.clock.hours.show) { if (state.get.current().header.clock.seconds.show || state.get.current().header.clock.minutes.show || state.get.current().header.clock.hours.show) {
helper.addClass(html, "is-header-clock-show"); helper.addClass(html, "is-header-clock-show");
} else { } else {
helper.removeClass(html, "is-header-clock-show"); helper.removeClass(html, "is-header-clock-show");
}; };
}; };
var _date = function() { var _date = function() {
if (state.get().header.date.date.show || state.get().header.date.day.show || state.get().header.date.month.show || state.get().header.date.year.show) { if (state.get.current().header.date.date.show || state.get.current().header.date.day.show || state.get.current().header.date.month.show || state.get.current().header.date.year.show) {
helper.addClass(html, "is-header-date-show"); helper.addClass(html, "is-header-date-show");
} else { } else {
helper.removeClass(html, "is-header-date-show"); helper.removeClass(html, "is-header-date-show");
@ -2836,35 +2893,35 @@ var control = (function() {
helper.removeClass(html, "is-header-search-text-alignment-left"); helper.removeClass(html, "is-header-search-text-alignment-left");
helper.removeClass(html, "is-header-search-text-alignment-center"); helper.removeClass(html, "is-header-search-text-alignment-center");
helper.removeClass(html, "is-header-search-text-alignment-right"); helper.removeClass(html, "is-header-search-text-alignment-right");
if (state.get().header.search.show) { if (state.get.current().header.search.show) {
helper.addClass(html, "is-header-search-show"); helper.addClass(html, "is-header-search-show");
helper.addClass(html, "is-header-search-style-" + state.get().header.search.style); helper.addClass(html, "is-header-search-style-" + state.get.current().header.search.style);
helper.addClass(html, "is-header-search-text-alignment-" + state.get().header.search.text.alignment); helper.addClass(html, "is-header-search-text-alignment-" + state.get.current().header.search.text.alignment);
}; };
helper.e(".control-header-search-engine-custom-name").value = state.get().header.search.engine.custom.name; helper.e(".control-header-search-engine-custom-name").value = state.get.current().header.search.engine.custom.name;
helper.e(".control-header-search-engine-custom-url").value = state.get().header.search.engine.custom.url; helper.e(".control-header-search-engine-custom-url").value = state.get.current().header.search.engine.custom.url;
}; };
var _button = function() { var _button = function() {
if (state.get().header.button.editAdd.show) { if (state.get.current().header.button.editAdd.show) {
helper.addClass(html, "is-header-button-editadd-show"); helper.addClass(html, "is-header-button-editadd-show");
} else { } else {
helper.removeClass(html, "is-header-button-editadd-show"); helper.removeClass(html, "is-header-button-editadd-show");
}; };
if (state.get().header.button.accent.show) { if (state.get.current().header.button.accent.show) {
helper.addClass(html, "is-header-button-accent-show"); helper.addClass(html, "is-header-button-accent-show");
} else { } else {
helper.removeClass(html, "is-header-button-accent-show"); helper.removeClass(html, "is-header-button-accent-show");
}; };
}; };
var _greeting = function() { var _greeting = function() {
if (state.get().header.greeting.show) { if (state.get.current().header.greeting.show) {
helper.addClass(html, "is-header-greeting-show"); helper.addClass(html, "is-header-greeting-show");
} else { } else {
helper.removeClass(html, "is-header-greeting-show"); helper.removeClass(html, "is-header-greeting-show");
}; };
}; };
var _transitional = function() { var _transitional = function() {
if (state.get().header.transitional.show && (state.get().header.date.date.show || state.get().header.date.day.show || state.get().header.date.month.show || state.get().header.date.year.show || state.get().header.clock.seconds.show || state.get().header.clock.minutes.show || state.get().header.clock.hours.show)) { if (state.get.current().header.transitional.show && (state.get.current().header.date.date.show || state.get.current().header.date.day.show || state.get.current().header.date.month.show || state.get.current().header.date.year.show || state.get.current().header.clock.seconds.show || state.get.current().header.clock.minutes.show || state.get.current().header.clock.hours.show)) {
helper.addClass(html, "is-header-transitional-show"); helper.addClass(html, "is-header-transitional-show");
} else { } else {
helper.removeClass(html, "is-header-transitional-show"); helper.removeClass(html, "is-header-transitional-show");
@ -2872,10 +2929,10 @@ var control = (function() {
}; };
var _shade = function() { var _shade = function() {
helper.removeClass(html, "is-header-shade-show"); helper.removeClass(html, "is-header-shade-show");
if (state.get().header.shade.show) { if (state.get.current().header.shade.show) {
helper.addClass(html, "is-header-shade-show"); helper.addClass(html, "is-header-shade-show");
}; };
if (state.get().header.radius) { if (state.get.current().header.radius) {
helper.addClass(html, "is-header-radius"); helper.addClass(html, "is-header-radius");
} else { } else {
helper.removeClass(html, "is-header-radius"); helper.removeClass(html, "is-header-radius");
@ -2884,17 +2941,17 @@ var control = (function() {
var _border = function() { var _border = function() {
helper.removeClass(html, "is-header-border-top"); helper.removeClass(html, "is-header-border-top");
helper.removeClass(html, "is-header-border-bottom"); helper.removeClass(html, "is-header-border-bottom");
if (state.get().header.border.top > 0) { if (state.get.current().header.border.top > 0) {
helper.addClass(html, "is-header-border-top"); helper.addClass(html, "is-header-border-top");
}; };
if (state.get().header.border.bottom > 0) { if (state.get.current().header.border.bottom > 0) {
helper.addClass(html, "is-header-border-bottom"); helper.addClass(html, "is-header-border-bottom");
}; };
}; };
var _position = function() { var _position = function() {
helper.removeClass(html, "is-header-position-sticky"); helper.removeClass(html, "is-header-position-sticky");
helper.removeClass(html, "is-header-position-inline"); helper.removeClass(html, "is-header-position-inline");
helper.addClass(html, "is-header-position-" + state.get().header.position); helper.addClass(html, "is-header-position-" + state.get.current().header.position);
}; };
_area(); _area();
_item(); _item();
@ -2913,10 +2970,10 @@ var control = (function() {
helper.removeClass(html, "is-group-area-alignment-left"); helper.removeClass(html, "is-group-area-alignment-left");
helper.removeClass(html, "is-group-area-alignment-center"); helper.removeClass(html, "is-group-area-alignment-center");
helper.removeClass(html, "is-group-area-alignment-right"); helper.removeClass(html, "is-group-area-alignment-right");
helper.addClass(html, "is-group-area-alignment-" + state.get().group.area.alignment); helper.addClass(html, "is-group-area-alignment-" + state.get.current().group.area.alignment);
}; };
var _name = function() { var _name = function() {
if (state.get().group.name.show) { if (state.get.current().group.name.show) {
helper.addClass(html, "is-group-name-show"); helper.addClass(html, "is-group-name-show");
} else { } else {
helper.removeClass(html, "is-group-name-show"); helper.removeClass(html, "is-group-name-show");
@ -2925,11 +2982,11 @@ var control = (function() {
var _order = function() { var _order = function() {
helper.removeClass(html, "is-group-order-headerbody"); helper.removeClass(html, "is-group-order-headerbody");
helper.removeClass(html, "is-group-order-bodyheader"); helper.removeClass(html, "is-group-order-bodyheader");
helper.addClass(html, "is-group-order-" + state.get().group.order); helper.addClass(html, "is-group-order-" + state.get.current().group.order);
}; };
var _border = function() { var _border = function() {
helper.removeClass(html, "is-group-border"); helper.removeClass(html, "is-group-border");
if (state.get().group.border > 0) { if (state.get.current().group.border > 0) {
helper.addClass(html, "is-group-border"); helper.addClass(html, "is-group-border");
}; };
}; };
@ -2968,42 +3025,42 @@ var control = (function() {
helper.removeClass(html, "is-link-orientation-top"); helper.removeClass(html, "is-link-orientation-top");
helper.removeClass(html, "is-link-orientation-bottom"); helper.removeClass(html, "is-link-orientation-bottom");
helper.removeClass(html, "is-link-edit"); helper.removeClass(html, "is-link-edit");
if (state.get().link.show) { if (state.get.current().link.show) {
helper.addClass(html, "is-link-show"); helper.addClass(html, "is-link-show");
helper.addClass(html, "is-link-area-alignment-" + state.get().link.area.alignment); helper.addClass(html, "is-link-area-alignment-" + state.get.current().link.area.alignment);
helper.addClass(html, "is-link-item-display-direction-" + state.get().link.item.display.direction); helper.addClass(html, "is-link-item-display-direction-" + state.get.current().link.item.display.direction);
helper.addClass(html, "is-link-item-display-order-" + state.get().link.item.display.order); helper.addClass(html, "is-link-item-display-order-" + state.get.current().link.item.display.order);
helper.addClass(html, "is-link-display-alignment-" + state.get().link.item.display.alignment); helper.addClass(html, "is-link-display-alignment-" + state.get.current().link.item.display.alignment);
helper.addClass(html, "is-link-style-" + state.get().link.style); helper.addClass(html, "is-link-style-" + state.get.current().link.style);
helper.addClass(html, "is-link-orientation-" + state.get().link.orientation); helper.addClass(html, "is-link-orientation-" + state.get.current().link.orientation);
if (state.get().link.item.display.letcon.show) { if (state.get.current().link.item.display.letcon.show) {
helper.addClass(html, "is-link-item-display-letcon-show"); helper.addClass(html, "is-link-item-display-letcon-show");
}; };
if (state.get().link.item.display.name.show) { if (state.get.current().link.item.display.name.show) {
helper.addClass(html, "is-link-item-display-name-show"); helper.addClass(html, "is-link-item-display-name-show");
}; };
if (state.get().link.item.url.show) { if (state.get.current().link.item.url.show) {
helper.addClass(html, "is-link-item-url-show"); helper.addClass(html, "is-link-item-url-show");
}; };
if (state.get().link.item.line.show) { if (state.get.current().link.item.line.show) {
helper.addClass(html, "is-link-item-line-show"); helper.addClass(html, "is-link-item-line-show");
}; };
if (state.get().link.item.shadow.show) { if (state.get.current().link.item.shadow.show) {
helper.addClass(html, "is-link-item-shadow-show"); helper.addClass(html, "is-link-item-shadow-show");
}; };
if (state.get().link.item.hoverScale.show) { if (state.get.current().link.item.hoverScale.show) {
helper.addClass(html, "is-link-item-hoverscale-show"); helper.addClass(html, "is-link-item-hoverscale-show");
}; };
if (state.get().link.item.border > 0) { if (state.get.current().link.item.border > 0) {
helper.addClass(html, "is-link-item-border"); helper.addClass(html, "is-link-item-border");
}; };
if (state.get().link.edit) { if (state.get.current().link.edit) {
helper.addClass(html, "is-link-edit"); helper.addClass(html, "is-link-edit");
}; };
}; };
}; };
var _theme = function() { var _theme = function() {
if (state.get().theme.radius > 0) { if (state.get.current().theme.radius > 0) {
helper.addClass(html, "is-theme-radius"); helper.addClass(html, "is-theme-radius");
} else { } else {
helper.removeClass(html, "is-theme-radius"); helper.removeClass(html, "is-theme-radius");
@ -3022,17 +3079,17 @@ var control = (function() {
helper.removeClass(html, "is-layout-alignment-bottomright"); helper.removeClass(html, "is-layout-alignment-bottomright");
helper.removeClass(html, "is-layout-order-headerlink"); helper.removeClass(html, "is-layout-order-headerlink");
helper.removeClass(html, "is-layout-order-linkheader"); helper.removeClass(html, "is-layout-order-linkheader");
helper.addClass(html, "is-layout-alignment-" + state.get().layout.alignment); helper.addClass(html, "is-layout-alignment-" + state.get.current().layout.alignment);
helper.addClass(html, "is-layout-order-" + state.get().layout.order); helper.addClass(html, "is-layout-order-" + state.get.current().layout.order);
if (state.get().layout.scrollPastEnd) { if (state.get.current().layout.scrollPastEnd) {
helper.addClass(html, "is-layout-scrollpastend"); helper.addClass(html, "is-layout-scrollpastend");
}; };
}; };
var _background = function() { var _background = function() {
helper.removeClass(html, "is-background-color-by-theme"); helper.removeClass(html, "is-background-color-by-theme");
helper.removeClass(html, "is-background-color-by-custom"); helper.removeClass(html, "is-background-color-by-custom");
helper.addClass(html, "is-background-color-by-" + state.get().background.color.by); helper.addClass(html, "is-background-color-by-" + state.get.current().background.color.by);
if (state.get().background.image.show) { if (state.get.current().background.image.show) {
helper.addClass(html, "is-background-image-show"); helper.addClass(html, "is-background-image-show");
} else { } else {
helper.removeClass(html, "is-background-image-show"); helper.removeClass(html, "is-background-image-show");
@ -3072,51 +3129,51 @@ var control = (function() {
var _header = function() { var _header = function() {
var _clock = function() { var _clock = function() {
var activeCount = 0; var activeCount = 0;
var toCheck = [state.get().header.clock.seconds.show, state.get().header.clock.minutes.show, state.get().header.clock.hours.show]; var toCheck = [state.get.current().header.clock.seconds.show, state.get.current().header.clock.minutes.show, state.get.current().header.clock.hours.show];
toCheck.forEach(function(arrayItem, index) { toCheck.forEach(function(arrayItem, index) {
if (arrayItem == true) { if (arrayItem == true) {
activeCount++; activeCount++;
}; };
}); });
if (activeCount >= 2 && (state.get().header.clock.seconds.show || state.get().header.clock.minutes.show || state.get().header.clock.hours.show)) { if (activeCount >= 2 && (state.get.current().header.clock.seconds.show || state.get.current().header.clock.minutes.show || state.get.current().header.clock.hours.show)) {
_disable.input(".control-header-clock-separator-show", false); _disable.input(".control-header-clock-separator-show", false);
} else { } else {
_disable.input(".control-header-clock-separator-show", true); _disable.input(".control-header-clock-separator-show", true);
}; };
if (state.get().header.clock.seconds.show || state.get().header.clock.minutes.show || state.get().header.clock.hours.show) { if (state.get.current().header.clock.seconds.show || state.get.current().header.clock.minutes.show || state.get.current().header.clock.hours.show) {
_disable.input(".control-header-clock-hour24-show", false); _disable.input(".control-header-clock-hour24-show", false);
_disable.input(".control-header-clock-meridiem-show", false); _disable.input(".control-header-clock-meridiem-show", false);
} else { } else {
_disable.input(".control-header-clock-hour24-show", true); _disable.input(".control-header-clock-hour24-show", true);
_disable.input(".control-header-clock-meridiem-show", true); _disable.input(".control-header-clock-meridiem-show", true);
}; };
if ((state.get().header.clock.seconds.show || state.get().header.clock.minutes.show || state.get().header.clock.hours.show) && !state.get().header.clock.hour24.show) { if ((state.get.current().header.clock.seconds.show || state.get.current().header.clock.minutes.show || state.get.current().header.clock.hours.show) && !state.get.current().header.clock.hour24.show) {
_disable.input(".control-header-clock-meridiem-show", false); _disable.input(".control-header-clock-meridiem-show", false);
} else { } else {
_disable.input(".control-header-clock-meridiem-show", true); _disable.input(".control-header-clock-meridiem-show", true);
}; };
if (state.get().header.clock.hours.show) { if (state.get.current().header.clock.hours.show) {
_disable.input(".control-header-clock-hours-display-number", false); _disable.input(".control-header-clock-hours-display-number", false);
_disable.input(".control-header-clock-hours-display-word", false); _disable.input(".control-header-clock-hours-display-word", false);
} else { } else {
_disable.input(".control-header-clock-hours-display-number", true); _disable.input(".control-header-clock-hours-display-number", true);
_disable.input(".control-header-clock-hours-display-word", true); _disable.input(".control-header-clock-hours-display-word", true);
}; };
if (state.get().header.clock.minutes.show) { if (state.get.current().header.clock.minutes.show) {
_disable.input(".control-header-clock-minutes-display-number", false); _disable.input(".control-header-clock-minutes-display-number", false);
_disable.input(".control-header-clock-minutes-display-word", false); _disable.input(".control-header-clock-minutes-display-word", false);
} else { } else {
_disable.input(".control-header-clock-minutes-display-number", true); _disable.input(".control-header-clock-minutes-display-number", true);
_disable.input(".control-header-clock-minutes-display-word", true); _disable.input(".control-header-clock-minutes-display-word", true);
}; };
if (state.get().header.clock.seconds.show) { if (state.get.current().header.clock.seconds.show) {
_disable.input(".control-header-clock-seconds-display-number", false); _disable.input(".control-header-clock-seconds-display-number", false);
_disable.input(".control-header-clock-seconds-display-word", false); _disable.input(".control-header-clock-seconds-display-word", false);
} else { } else {
_disable.input(".control-header-clock-seconds-display-number", true); _disable.input(".control-header-clock-seconds-display-number", true);
_disable.input(".control-header-clock-seconds-display-word", true); _disable.input(".control-header-clock-seconds-display-word", true);
}; };
if (state.get().header.clock.seconds.show || state.get().header.clock.minutes.show || state.get().header.clock.hours.show) { if (state.get.current().header.clock.seconds.show || state.get.current().header.clock.minutes.show || state.get.current().header.clock.hours.show) {
_disable.element("[for=control-header-clock-size]", false); _disable.element("[for=control-header-clock-size]", false);
_disable.input(".control-header-clock-size", false); _disable.input(".control-header-clock-size", false);
_disable.element(".control-header-clock-size-count", false); _disable.element(".control-header-clock-size-count", false);
@ -3130,18 +3187,18 @@ var control = (function() {
}; };
var _date = function() { var _date = function() {
var activeCount = 0; var activeCount = 0;
var toCheck = [state.get().header.date.day.show, state.get().header.date.date.show, state.get().header.date.month.show, state.get().header.date.year.show]; var toCheck = [state.get.current().header.date.day.show, state.get.current().header.date.date.show, state.get.current().header.date.month.show, state.get.current().header.date.year.show];
toCheck.forEach(function(arrayItem, index) { toCheck.forEach(function(arrayItem, index) {
if (arrayItem == true) { if (arrayItem == true) {
activeCount++; activeCount++;
}; };
}); });
if (activeCount >= 2 && (state.get().header.date.day.show || state.get().header.date.date.show || state.get().header.date.month.show || state.get().header.date.year.show)) { if (activeCount >= 2 && (state.get.current().header.date.day.show || state.get.current().header.date.date.show || state.get.current().header.date.month.show || state.get.current().header.date.year.show)) {
_disable.input(".control-header-date-separator-show", false); _disable.input(".control-header-date-separator-show", false);
} else { } else {
_disable.input(".control-header-date-separator-show", true); _disable.input(".control-header-date-separator-show", true);
}; };
if (state.get().header.date.date.show && state.get().header.date.month.show) { if (state.get.current().header.date.date.show && state.get.current().header.date.month.show) {
_disable.element(".control-header-date-format-label", false); _disable.element(".control-header-date-format-label", false);
_disable.input(".control-header-date-format-datemonth", false); _disable.input(".control-header-date-format-datemonth", false);
_disable.input(".control-header-date-format-monthdate", false); _disable.input(".control-header-date-format-monthdate", false);
@ -3150,14 +3207,14 @@ var control = (function() {
_disable.input(".control-header-date-format-datemonth", true); _disable.input(".control-header-date-format-datemonth", true);
_disable.input(".control-header-date-format-monthdate", true); _disable.input(".control-header-date-format-monthdate", true);
}; };
if (state.get().header.date.day.show) { if (state.get.current().header.date.day.show) {
_disable.input(".control-header-date-day-display-number", false); _disable.input(".control-header-date-day-display-number", false);
_disable.input(".control-header-date-day-display-word", false); _disable.input(".control-header-date-day-display-word", false);
} else { } else {
_disable.input(".control-header-date-day-display-number", true); _disable.input(".control-header-date-day-display-number", true);
_disable.input(".control-header-date-day-display-word", true); _disable.input(".control-header-date-day-display-word", true);
}; };
if (state.get().header.date.date.show) { if (state.get.current().header.date.date.show) {
_disable.input(".control-header-date-date-display-number", false); _disable.input(".control-header-date-date-display-number", false);
_disable.input(".control-header-date-date-display-word", false); _disable.input(".control-header-date-date-display-word", false);
_disable.input(".control-header-date-date-ordinal", false); _disable.input(".control-header-date-date-ordinal", false);
@ -3168,21 +3225,21 @@ var control = (function() {
_disable.input(".control-header-date-date-ordinal", true); _disable.input(".control-header-date-date-ordinal", true);
_disable.element(".control-header-date-date-ordinal-helper", true); _disable.element(".control-header-date-date-ordinal-helper", true);
}; };
if (state.get().header.date.month.show) { if (state.get.current().header.date.month.show) {
_disable.input(".control-header-date-month-display-number", false); _disable.input(".control-header-date-month-display-number", false);
_disable.input(".control-header-date-month-display-word", false); _disable.input(".control-header-date-month-display-word", false);
} else { } else {
_disable.input(".control-header-date-month-display-number", true); _disable.input(".control-header-date-month-display-number", true);
_disable.input(".control-header-date-month-display-word", true); _disable.input(".control-header-date-month-display-word", true);
}; };
if (state.get().header.date.year.show) { if (state.get.current().header.date.year.show) {
_disable.input(".control-header-date-year-display-number", false); _disable.input(".control-header-date-year-display-number", false);
_disable.input(".control-header-date-year-display-word", false); _disable.input(".control-header-date-year-display-word", false);
} else { } else {
_disable.input(".control-header-date-year-display-number", true); _disable.input(".control-header-date-year-display-number", true);
_disable.input(".control-header-date-year-display-word", true); _disable.input(".control-header-date-year-display-word", true);
}; };
if (state.get().header.date.day.show && state.get().header.date.day.display == "number") { if (state.get.current().header.date.day.show && state.get.current().header.date.day.display == "number") {
_disable.element(".control-header-date-day-week-start-label", false); _disable.element(".control-header-date-day-week-start-label", false);
_disable.input(".control-header-date-day-week-start-monday", false); _disable.input(".control-header-date-day-week-start-monday", false);
_disable.input(".control-header-date-day-week-start-sunday", false); _disable.input(".control-header-date-day-week-start-sunday", false);
@ -3193,7 +3250,7 @@ var control = (function() {
_disable.input(".control-header-date-day-week-start-sunday", true); _disable.input(".control-header-date-day-week-start-sunday", true);
_disable.element(".control-header-date-day-week-start-helper", true); _disable.element(".control-header-date-day-week-start-helper", true);
}; };
if (state.get().header.date.day.show && state.get().header.date.day.display == "word") { if (state.get.current().header.date.day.show && state.get.current().header.date.day.display == "word") {
_disable.element(".control-header-date-day-length-label", false); _disable.element(".control-header-date-day-length-label", false);
_disable.input(".control-header-date-day-length-long", false); _disable.input(".control-header-date-day-length-long", false);
_disable.input(".control-header-date-day-length-short", false); _disable.input(".control-header-date-day-length-short", false);
@ -3202,7 +3259,7 @@ var control = (function() {
_disable.input(".control-header-date-day-length-long", true); _disable.input(".control-header-date-day-length-long", true);
_disable.input(".control-header-date-day-length-short", true); _disable.input(".control-header-date-day-length-short", true);
}; };
if (state.get().header.date.month.show && state.get().header.date.month.display == "word") { if (state.get.current().header.date.month.show && state.get.current().header.date.month.display == "word") {
_disable.element(".control-header-date-month-length-label", false); _disable.element(".control-header-date-month-length-label", false);
_disable.input(".control-header-date-month-length-long", false); _disable.input(".control-header-date-month-length-long", false);
_disable.input(".control-header-date-month-length-short", false); _disable.input(".control-header-date-month-length-short", false);
@ -3211,14 +3268,14 @@ var control = (function() {
_disable.input(".control-header-date-month-length-long", true); _disable.input(".control-header-date-month-length-long", true);
_disable.input(".control-header-date-month-length-short", true); _disable.input(".control-header-date-month-length-short", true);
}; };
if (state.get().header.date.month.show && state.get().header.date.month.display == "number") { if (state.get.current().header.date.month.show && state.get.current().header.date.month.display == "number") {
_disable.input(".control-header-date-month-ordinal", false); _disable.input(".control-header-date-month-ordinal", false);
_disable.element(".control-header-date-month-ordinal-helper", false); _disable.element(".control-header-date-month-ordinal-helper", false);
} else { } else {
_disable.input(".control-header-date-month-ordinal", true); _disable.input(".control-header-date-month-ordinal", true);
_disable.element(".control-header-date-month-ordinal-helper", true); _disable.element(".control-header-date-month-ordinal-helper", true);
}; };
if (state.get().header.date.day.show || state.get().header.date.date.show || state.get().header.date.month.show || state.get().header.date.year.show) { if (state.get.current().header.date.day.show || state.get.current().header.date.date.show || state.get.current().header.date.month.show || state.get.current().header.date.year.show) {
_disable.element("[for=control-header-date-size]", false); _disable.element("[for=control-header-date-size]", false);
_disable.input(".control-header-date-size", false); _disable.input(".control-header-date-size", false);
_disable.element(".control-header-date-size-count", false); _disable.element(".control-header-date-size-count", false);
@ -3231,7 +3288,7 @@ var control = (function() {
}; };
}; };
var _shade = function() { var _shade = function() {
if (state.get().header.shade.show) { if (state.get.current().header.shade.show) {
_disable.input(".control-header-shade-style-always", false); _disable.input(".control-header-shade-style-always", false);
_disable.element(".control-header-shade-style-always-helper", false); _disable.element(".control-header-shade-style-always-helper", false);
_disable.input(".control-header-shade-style-scroll", false); _disable.input(".control-header-shade-style-scroll", false);
@ -3252,7 +3309,7 @@ var control = (function() {
}; };
}; };
var _search = function() { var _search = function() {
if (state.get().header.search.show) { if (state.get.current().header.search.show) {
_disable.element(".control-header-search-style-label", false); _disable.element(".control-header-search-style-label", false);
_disable.input(".control-header-search-style-auto", false); _disable.input(".control-header-search-style-auto", false);
_disable.element(".control-header-search-style-auto-helper", false); _disable.element(".control-header-search-style-auto-helper", false);
@ -3309,7 +3366,7 @@ var control = (function() {
_disable.input(".control-header-search-size-default", true); _disable.input(".control-header-search-size-default", true);
_disable.element(".control-header-search-size-helper", true); _disable.element(".control-header-search-size-helper", true);
}; };
if (state.get().header.search.show && state.get().header.search.engine.selected === "custom") { if (state.get.current().header.search.show && state.get.current().header.search.engine.selected === "custom") {
_disable.element("[for=control-header-search-engine-custom-name]", false); _disable.element("[for=control-header-search-engine-custom-name]", false);
_disable.input(".control-header-search-engine-custom-name", false); _disable.input(".control-header-search-engine-custom-name", false);
_disable.element("[for=control-header-search-engine-custom-url]", false); _disable.element("[for=control-header-search-engine-custom-url]", false);
@ -3322,7 +3379,7 @@ var control = (function() {
_disable.input(".control-header-search-engine-custom-url", true); _disable.input(".control-header-search-engine-custom-url", true);
_disable.element(".control-header-search-engine-custom-helper", true); _disable.element(".control-header-search-engine-custom-helper", true);
}; };
if (state.get().header.search.show && state.get().header.search.style === "custom") { if (state.get.current().header.search.show && state.get.current().header.search.style === "custom") {
_disable.element("[for=control-header-search-width]", false); _disable.element("[for=control-header-search-width]", false);
_disable.input(".control-header-search-width", false); _disable.input(".control-header-search-width", false);
_disable.element(".control-header-search-width-count", false); _disable.element(".control-header-search-width-count", false);
@ -3333,7 +3390,7 @@ var control = (function() {
}; };
}; };
var _greeting = function() { var _greeting = function() {
if (state.get().header.greeting.show) { if (state.get.current().header.greeting.show) {
_disable.element("[for=control-header-greeting-name]", false); _disable.element("[for=control-header-greeting-name]", false);
_disable.input(".control-header-greeting-name", false); _disable.input(".control-header-greeting-name", false);
_disable.input(".control-header-greeting-type-good", false); _disable.input(".control-header-greeting-type-good", false);
@ -3356,14 +3413,14 @@ var control = (function() {
}; };
}; };
var _transitional = function() { var _transitional = function() {
if (state.get().header.date.date.show || state.get().header.date.day.show || state.get().header.date.month.show || state.get().header.date.year.show || state.get().header.clock.seconds.show || state.get().header.clock.minutes.show || state.get().header.clock.hours.show) { if (state.get.current().header.date.date.show || state.get.current().header.date.day.show || state.get.current().header.date.month.show || state.get.current().header.date.year.show || state.get.current().header.clock.seconds.show || state.get.current().header.clock.minutes.show || state.get.current().header.clock.hours.show) {
_disable.input(".control-header-transitional-show", false); _disable.input(".control-header-transitional-show", false);
_disable.element(".control-header-transitional-show-helper", false); _disable.element(".control-header-transitional-show-helper", false);
} else { } else {
_disable.input(".control-header-transitional-show", true); _disable.input(".control-header-transitional-show", true);
_disable.element(".control-header-transitional-show-helper", true); _disable.element(".control-header-transitional-show-helper", true);
}; };
if (state.get().header.transitional.show && ((state.get().header.date.date.show || state.get().header.date.day.show || state.get().header.date.month.show || state.get().header.date.year.show || state.get().header.clock.seconds.show || state.get().header.clock.minutes.show || state.get().header.clock.hours.show))) { if (state.get.current().header.transitional.show && ((state.get.current().header.date.date.show || state.get.current().header.date.day.show || state.get.current().header.date.month.show || state.get.current().header.date.year.show || state.get.current().header.clock.seconds.show || state.get.current().header.clock.minutes.show || state.get.current().header.clock.hours.show))) {
_disable.input(".control-header-transitional-type-timeanddate", false); _disable.input(".control-header-transitional-type-timeanddate", false);
_disable.input(".control-header-transitional-type-its", false); _disable.input(".control-header-transitional-type-its", false);
_disable.element("[for=control-header-transitional-size]", false); _disable.element("[for=control-header-transitional-size]", false);
@ -3394,7 +3451,7 @@ var control = (function() {
}; };
}; };
var _group = function() { var _group = function() {
if (state.get().group.name.show) { if (state.get.current().group.name.show) {
_disable.element("[for=control-group-name-size]", false); _disable.element("[for=control-group-name-size]", false);
_disable.input(".control-group-name-size", false); _disable.input(".control-group-name-size", false);
_disable.element(".control-group-name-size-count", false); _disable.element(".control-group-name-size-count", false);
@ -3489,7 +3546,7 @@ var control = (function() {
_disable.input(".control-link-accent-clear", true); _disable.input(".control-link-accent-clear", true);
_disable.input(".control-link-accent-set", true); _disable.input(".control-link-accent-set", true);
_disable.element(".control-link-accent-set-helper", true); _disable.element(".control-link-accent-set-helper", true);
if (state.get().link.show) { if (state.get.current().link.show) {
_disable.input(".control-layout-order-headerlink", false); _disable.input(".control-layout-order-headerlink", false);
_disable.input(".control-layout-order-linkheader", false); _disable.input(".control-layout-order-linkheader", false);
_disable.element(".control-layout-order-helper", false); _disable.element(".control-layout-order-helper", false);
@ -3531,7 +3588,7 @@ var control = (function() {
_disable.input(".control-link-accent-clear", false); _disable.input(".control-link-accent-clear", false);
_disable.input(".control-link-accent-set", false); _disable.input(".control-link-accent-set", false);
_disable.element(".control-link-accent-set-helper", false); _disable.element(".control-link-accent-set-helper", false);
if (state.get().link.item.display.letcon.show) { if (state.get.current().link.item.display.letcon.show) {
_disable.element("[for=control-link-item-display-letcon-letter-size]", false); _disable.element("[for=control-link-item-display-letcon-letter-size]", false);
_disable.input(".control-link-item-display-letcon-letter-size", false); _disable.input(".control-link-item-display-letcon-letter-size", false);
_disable.element(".control-link-item-display-letcon-letter-size-count", false); _disable.element(".control-link-item-display-letcon-letter-size-count", false);
@ -3541,13 +3598,13 @@ var control = (function() {
_disable.element(".control-link-item-display-letcon-icon-size-count", false); _disable.element(".control-link-item-display-letcon-icon-size-count", false);
_disable.input(".control-link-item-display-letcon-icon-size-default", false); _disable.input(".control-link-item-display-letcon-icon-size-default", false);
}; };
if (state.get().link.item.display.name.show) { if (state.get.current().link.item.display.name.show) {
_disable.element("[for=control-link-item-display-name-size]", false); _disable.element("[for=control-link-item-display-name-size]", false);
_disable.input(".control-link-item-display-name-size", false); _disable.input(".control-link-item-display-name-size", false);
_disable.element(".control-link-item-display-name-size-count", false); _disable.element(".control-link-item-display-name-size-count", false);
_disable.input(".control-link-item-display-name-size-default", false); _disable.input(".control-link-item-display-name-size-default", false);
}; };
if (state.get().link.item.display.letcon.show || state.get().link.item.display.name.show) { if (state.get.current().link.item.display.letcon.show || state.get.current().link.item.display.name.show) {
_disable.element(".control-link-item-display-alignment-grid", false); _disable.element(".control-link-item-display-alignment-grid", false);
_disable.element(".control-link-item-display-alignment-label", false); _disable.element(".control-link-item-display-alignment-label", false);
_disable.input(".control-link-item-display-alignment-topleft", false); _disable.input(".control-link-item-display-alignment-topleft", false);
@ -3572,7 +3629,7 @@ var control = (function() {
_disable.element(".control-link-item-display-translate-y-count", false); _disable.element(".control-link-item-display-translate-y-count", false);
_disable.input(".control-link-item-display-translate-y-default", false); _disable.input(".control-link-item-display-translate-y-default", false);
}; };
if (state.get().link.item.display.letcon.show && state.get().link.item.display.name.show) { if (state.get.current().link.item.display.letcon.show && state.get.current().link.item.display.name.show) {
_disable.input(".control-link-item-display-direction-horizontal", false); _disable.input(".control-link-item-display-direction-horizontal", false);
_disable.input(".control-link-item-display-direction-vertical", false); _disable.input(".control-link-item-display-direction-vertical", false);
_disable.input(".control-link-item-display-order-letconname", false); _disable.input(".control-link-item-display-order-letconname", false);
@ -3583,7 +3640,7 @@ var control = (function() {
}; };
}; };
var _theme = function() { var _theme = function() {
if (state.get().theme.accent.random.active) { if (state.get.current().theme.accent.random.active) {
_disable.input(".control-theme-accent-random-style-any", false); _disable.input(".control-theme-accent-random-style-any", false);
_disable.input(".control-theme-accent-random-style-light", false); _disable.input(".control-theme-accent-random-style-light", false);
_disable.input(".control-theme-accent-random-style-dark", false); _disable.input(".control-theme-accent-random-style-dark", false);
@ -3600,7 +3657,7 @@ var control = (function() {
}; };
}; };
var _background = function() { var _background = function() {
if (state.get().background.image.show) { if (state.get.current().background.image.show) {
_disable.input(".control-background-image-from-file", false); _disable.input(".control-background-image-from-file", false);
_disable.input(".control-background-image-from-url", false); _disable.input(".control-background-image-from-url", false);
_disable.element("[for=control-background-image-opacity]", false); _disable.element("[for=control-background-image-opacity]", false);
@ -3637,7 +3694,7 @@ var control = (function() {
_disable.input(".control-background-image-scale", true); _disable.input(".control-background-image-scale", true);
_disable.element(".control-background-image-scale-count", true); _disable.element(".control-background-image-scale-count", true);
}; };
if (state.get().background.image.show && state.get().background.image.from == "file") { if (state.get.current().background.image.show && state.get.current().background.image.from == "file") {
_disable.element(".control-background-image-file-feedback", false); _disable.element(".control-background-image-file-feedback", false);
_disable.input(".control-background-image-file", false); _disable.input(".control-background-image-file", false);
_disable.input(".control-background-image-file-clear", false); _disable.input(".control-background-image-file-clear", false);
@ -3648,18 +3705,18 @@ var control = (function() {
_disable.input(".control-background-image-file-clear", true); _disable.input(".control-background-image-file-clear", true);
_disable.element(".control-background-image-file-helper", true); _disable.element(".control-background-image-file-helper", true);
}; };
if (state.get().background.image.show && state.get().background.image.from == "url") { if (state.get.current().background.image.show && state.get.current().background.image.from == "url") {
_disable.input(".control-background-image-url", false); _disable.input(".control-background-image-url", false);
_disable.element(".control-background-image-url-helper", false); _disable.element(".control-background-image-url-helper", false);
} else { } else {
_disable.input(".control-background-image-url", true); _disable.input(".control-background-image-url", true);
_disable.element(".control-background-image-url-helper", true); _disable.element(".control-background-image-url-helper", true);
}; };
if (state.get().background.color.by == "theme") { if (state.get.current().background.color.by == "theme") {
_disable.input(".control-background-color-custom-current-picker", true); _disable.input(".control-background-color-custom-current-picker", true);
_disable.input(".control-background-color-custom-current-hex", true); _disable.input(".control-background-color-custom-current-hex", true);
_disable.element(".control-background-color-theme-helper", true); _disable.element(".control-background-color-theme-helper", true);
} else if (state.get().background.color.by == "custom") { } else if (state.get.current().background.color.by == "custom") {
_disable.input(".control-background-color-custom-current-picker", false); _disable.input(".control-background-color-custom-current-picker", false);
_disable.input(".control-background-color-custom-current-hex", false); _disable.input(".control-background-color-custom-current-hex", false);
_disable.element(".control-background-color-theme-helper", false); _disable.element(".control-background-color-theme-helper", false);
@ -3688,19 +3745,19 @@ var control = (function() {
var setValue = { var setValue = {
checkbox: function(object) { checkbox: function(object) {
object.element.checked = helper.getObject({ object.element.checked = helper.getObject({
object: state.get(), object: state.get.current(),
path: object.path path: object.path
}); });
}, },
radio: function(object) { radio: function(object) {
helper.e("." + object.element.className.substring(0, object.element.className.lastIndexOf("-") + 1) + helper.getObject({ helper.e("." + object.element.className.substring(0, object.element.className.lastIndexOf("-") + 1) + helper.getObject({
object: state.get(), object: state.get.current(),
path: object.path path: object.path
})).checked = true; })).checked = true;
}, },
text: function(object) { text: function(object) {
var newValue = helper.getObject({ var newValue = helper.getObject({
object: state.get(), object: state.get.current(),
path: object.path path: object.path
}); });
if (object.valueMod) { if (object.valueMod) {
@ -3712,7 +3769,7 @@ var control = (function() {
}, },
textarea: function(object) { textarea: function(object) {
var newValue = helper.getObject({ var newValue = helper.getObject({
object: state.get(), object: state.get.current(),
path: object.path path: object.path
}); });
if (object.valueMod) { if (object.valueMod) {
@ -3724,13 +3781,13 @@ var control = (function() {
}, },
number: function(object) { number: function(object) {
object.element.value = helper.getObject({ object.element.value = helper.getObject({
object: state.get(), object: state.get.current(),
path: object.path path: object.path
}); });
}, },
range: function(object) { range: function(object) {
var newValue = helper.getObject({ var newValue = helper.getObject({
object: state.get(), object: state.get.current(),
path: object.path path: object.path
}); });
if (object.valueMod) { if (object.valueMod) {
@ -3742,7 +3799,7 @@ var control = (function() {
}, },
color: function(object) { color: function(object) {
object.element.value = helper.rgbToHex(helper.getObject({ object.element.value = helper.rgbToHex(helper.getObject({
object: state.get(), object: state.get.current(),
path: object.path path: object.path
})); }));
} }

View File

@ -234,7 +234,7 @@ var data = (function() {
mod.set(_saveName, JSON.stringify({ mod.set(_saveName, JSON.stringify({
nighttab: true, nighttab: true,
version: version.get().number, version: version.get().number,
state: state.get(), state: state.get.current(),
bookmarks: bookmarks.get() bookmarks: bookmarks.get()
})); }));
}; };

View File

@ -19,7 +19,7 @@ var date = (function() {
}; };
render.all = function() { render.all = function() {
if (state.get().header.date.date.show || state.get().header.date.day.show || state.get().header.date.month.show || state.get().header.date.year.show) { if (state.get.current().header.date.date.show || state.get.current().header.date.day.show || state.get.current().header.date.month.show || state.get.current().header.date.year.show) {
var timeDateNow = moment(); var timeDateNow = moment();
var dateStrings = { var dateStrings = {
day: null, day: null,
@ -31,31 +31,31 @@ var date = (function() {
day: { day: {
word: function() { word: function() {
dateStrings.day = timeDateNow.format("dddd"); dateStrings.day = timeDateNow.format("dddd");
if (state.get().header.date.day.length == "short") { if (state.get.current().header.date.day.length == "short") {
dateStrings.day = dateStrings.day.substring(0, 3); dateStrings.day = dateStrings.day.substring(0, 3);
}; };
}, },
number: function() { number: function() {
dateStrings.day = timeDateNow.day(); dateStrings.day = timeDateNow.day();
if (state.get().header.date.day.weekStart == "monday") { if (state.get.current().header.date.day.weekStart == "monday") {
if (dateStrings.day == 0) { if (dateStrings.day == 0) {
dateStrings.day = 7; dateStrings.day = 7;
}; };
} else if (state.get().header.date.day.weekStart == "sunday") { } else if (state.get.current().header.date.day.weekStart == "sunday") {
dateStrings.day = dateStrings.day + 1; dateStrings.day = dateStrings.day + 1;
}; };
} }
}, },
date: { date: {
word: function() { word: function() {
if (state.get().header.date.date.ordinal) { if (state.get.current().header.date.date.ordinal) {
dateStrings.date = helper.ordinalWords(helper.toWords(timeDateNow.date())); dateStrings.date = helper.ordinalWords(helper.toWords(timeDateNow.date()));
} else { } else {
dateStrings.date = helper.toWords(timeDateNow.date()); dateStrings.date = helper.toWords(timeDateNow.date());
}; };
}, },
number: function() { number: function() {
if (state.get().header.date.date.ordinal) { if (state.get.current().header.date.date.ordinal) {
dateStrings.date = timeDateNow.format("Do"); dateStrings.date = timeDateNow.format("Do");
} else { } else {
dateStrings.date = timeDateNow.format("DD"); dateStrings.date = timeDateNow.format("DD");
@ -65,12 +65,12 @@ var date = (function() {
month: { month: {
word: function() { word: function() {
dateStrings.month = timeDateNow.format("MMMM"); dateStrings.month = timeDateNow.format("MMMM");
if (state.get().header.date.month.length == "short") { if (state.get.current().header.date.month.length == "short") {
dateStrings.month = dateStrings.month.substring(0, 3); dateStrings.month = dateStrings.month.substring(0, 3);
}; };
}, },
number: function() { number: function() {
if (state.get().header.date.month.ordinal) { if (state.get.current().header.date.month.ordinal) {
dateStrings.month = helper.ordinalNumber(timeDateNow.month() + 1); dateStrings.month = helper.ordinalNumber(timeDateNow.month() + 1);
} else { } else {
dateStrings.month = timeDateNow.month() + 1; dateStrings.month = timeDateNow.month() + 1;
@ -86,46 +86,46 @@ var date = (function() {
} }
} }
}; };
wordOrNumber.day[state.get().header.date.day.display](); wordOrNumber.day[state.get.current().header.date.day.display]();
wordOrNumber.date[state.get().header.date.date.display](); wordOrNumber.date[state.get.current().header.date.date.display]();
wordOrNumber.month[state.get().header.date.month.display](); wordOrNumber.month[state.get.current().header.date.month.display]();
wordOrNumber.year[state.get().header.date.year.display](); wordOrNumber.year[state.get.current().header.date.year.display]();
var elementDay = helper.node("span:" + dateStrings.day + "|class:date-item date-day"); var elementDay = helper.node("span:" + dateStrings.day + "|class:date-item date-day");
var elementDate = helper.node("span:" + dateStrings.date + "|class:date-item date-date"); var elementDate = helper.node("span:" + dateStrings.date + "|class:date-item date-date");
var elementMonth = helper.node("span:" + dateStrings.month + "|class:date-item date-month"); var elementMonth = helper.node("span:" + dateStrings.month + "|class:date-item date-month");
var elementYear = helper.node("span:" + dateStrings.year + "|class:date-item date-year"); var elementYear = helper.node("span:" + dateStrings.year + "|class:date-item date-year");
var date = helper.e(".date"); var date = helper.e(".date");
if (state.get().header.date.day.show) { if (state.get.current().header.date.day.show) {
date.appendChild(elementDay); date.appendChild(elementDay);
}; };
if (state.get().header.date.date.show && state.get().header.date.month.show) { if (state.get.current().header.date.date.show && state.get.current().header.date.month.show) {
if (state.get().header.date.format == "datemonth") { if (state.get.current().header.date.format == "datemonth") {
if (state.get().header.date.date.show) { if (state.get.current().header.date.date.show) {
date.appendChild(elementDate); date.appendChild(elementDate);
}; };
if (state.get().header.date.month.show) { if (state.get.current().header.date.month.show) {
date.appendChild(elementMonth); date.appendChild(elementMonth);
}; };
} else if (state.get().header.date.format == "monthdate") { } else if (state.get.current().header.date.format == "monthdate") {
if (state.get().header.date.month.show) { if (state.get.current().header.date.month.show) {
date.appendChild(elementMonth); date.appendChild(elementMonth);
}; };
if (state.get().header.date.date.show) { if (state.get.current().header.date.date.show) {
date.appendChild(elementDate); date.appendChild(elementDate);
}; };
}; };
} else { } else {
if (state.get().header.date.date.show) { if (state.get.current().header.date.date.show) {
date.appendChild(elementDate); date.appendChild(elementDate);
}; };
if (state.get().header.date.month.show) { if (state.get.current().header.date.month.show) {
date.appendChild(elementMonth); date.appendChild(elementMonth);
}; };
}; };
if (state.get().header.date.year.show) { if (state.get.current().header.date.year.show) {
date.appendChild(elementYear); date.appendChild(elementYear);
}; };
if (state.get().header.date.separator.show) { if (state.get.current().header.date.separator.show) {
var separatorCharacter = "/"; var separatorCharacter = "/";
var parts = date.querySelectorAll("span"); var parts = date.querySelectorAll("span");
if (parts.length > 1) { if (parts.length > 1) {

View File

@ -6,7 +6,7 @@ var dropdown = (function() {
mod.open = function() { mod.open = function() {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "dropdown", path: "dropdown",
newValue: true newValue: true
}); });
@ -14,22 +14,22 @@ var dropdown = (function() {
mod.close = function() { mod.close = function() {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "dropdown", path: "dropdown",
newValue: false newValue: false
}); });
}; };
mod.toggle = function() { mod.toggle = function() {
if (state.get().dropdown) { if (state.get.current().dropdown) {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "dropdown", path: "dropdown",
newValue: false newValue: false
}); });
} else { } else {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "dropdown", path: "dropdown",
newValue: true newValue: true
}); });
@ -79,7 +79,7 @@ var dropdown = (function() {
render.offset = function() { render.offset = function() {
var formDropdownMenu = _currentFormDropdown.querySelector(".form-dropdown-menu"); var formDropdownMenu = _currentFormDropdown.querySelector(".form-dropdown-menu");
if (state.get().dropdown) { if (state.get.current().dropdown) {
var box = formDropdownMenu.getBoundingClientRect(); var box = formDropdownMenu.getBoundingClientRect();
if (box.right > window.innerWidth) { if (box.right > window.innerWidth) {
helper.addClass(formDropdownMenu, "form-dropdown-menu-left"); helper.addClass(formDropdownMenu, "form-dropdown-menu-left");
@ -100,7 +100,7 @@ var dropdown = (function() {
}; };
render.toggle = function() { render.toggle = function() {
if (state.get().dropdown) { if (state.get.current().dropdown) {
render.open(); render.open();
} else { } else {
render.close(); render.close();

View File

@ -24,7 +24,7 @@ var edge = (function() {
mod.open = function() { mod.open = function() {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "edge", path: "edge",
newValue: true newValue: true
}); });
@ -32,7 +32,7 @@ var edge = (function() {
mod.close = function() { mod.close = function() {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "edge", path: "edge",
newValue: false newValue: false
}); });

View File

@ -19,7 +19,7 @@ var greeting = (function() {
}; };
render.all = function() { render.all = function() {
if (state.get().header.greeting.show) { if (state.get.current().header.greeting.show) {
var greeting = helper.e(".greeting"); var greeting = helper.e(".greeting");
var message = { var message = {
good: function() { good: function() {
@ -34,9 +34,9 @@ var greeting = (function() {
return "Hi"; return "Hi";
} }
}; };
var string = message[state.get().header.greeting.type](); var string = message[state.get.current().header.greeting.type]();
if (state.get().header.greeting.name != "" && state.get().header.greeting.name != undefined) { if (state.get.current().header.greeting.name != "" && state.get.current().header.greeting.name != undefined) {
string = string + ", " + state.get().header.greeting.name; string = string + ", " + state.get.current().header.greeting.name;
}; };
var greetingItem = helper.node("span|class:greeting-item"); var greetingItem = helper.node("span|class:greeting-item");
var greetingItemText = helper.node("span:" + string + "|class:greeting-item-text"); var greetingItemText = helper.node("span:" + string + "|class:greeting-item-text");

View File

@ -30,7 +30,7 @@ var header = (function() {
render.area = { render.area = {
width: function() { width: function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--header-area-width", state.get().header.area.width + "%"); html.style.setProperty("--header-area-width", state.get.current().header.area.width + "%");
} }
}; };
@ -43,23 +43,23 @@ var header = (function() {
// var scrollHeight = document.documentElement.scrollHeight; // var scrollHeight = document.documentElement.scrollHeight;
var innerHeight = window.innerHeight; var innerHeight = window.innerHeight;
// if shade show // if shade show
if (state.get().header.shade.show) { if (state.get.current().header.shade.show) {
// shade always // shade always
if (state.get().header.shade.style == "always") { if (state.get.current().header.shade.style == "always") {
helper.removeClass(html, "is-header-shade-style-scroll"); helper.removeClass(html, "is-header-shade-style-scroll");
helper.addClass(html, "is-header-shade-style-always"); helper.addClass(html, "is-header-shade-style-always");
// shade scroll // shade scroll
} else if (state.get().header.shade.style == "scroll") { } else if (state.get.current().header.shade.style == "scroll") {
helper.removeClass(html, "is-header-shade-style-always"); helper.removeClass(html, "is-header-shade-style-always");
// check header position // check header position
if (state.get().layout.order == "headerlink") { if (state.get.current().layout.order == "headerlink") {
// check scroll position // check scroll position
if (scrollTop > fontSize * 2 && headerRect.top == 0) { if (scrollTop > fontSize * 2 && headerRect.top == 0) {
helper.addClass(html, "is-header-shade-style-scroll"); helper.addClass(html, "is-header-shade-style-scroll");
} else { } else {
helper.removeClass(html, "is-header-shade-style-scroll"); helper.removeClass(html, "is-header-shade-style-scroll");
}; };
} else if (state.get().layout.order == "linkheader") { } else if (state.get.current().layout.order == "linkheader") {
// check scroll position // check scroll position
if (headerRect.bottom == innerHeight && (scrollTop + innerHeight) < ((scrollTop + layoutRect.bottom) - (fontSize * 2))) { if (headerRect.bottom == innerHeight && (scrollTop + innerHeight) < ((scrollTop + layoutRect.bottom) - (fontSize * 2))) {
helper.addClass(html, "is-header-shade-style-scroll"); helper.addClass(html, "is-header-shade-style-scroll");
@ -76,60 +76,60 @@ var header = (function() {
render.opacity = function() { render.opacity = function() {
var html = helper.e("html"); var html = helper.e("html");
if (state.get().header.shade.show) { if (state.get.current().header.shade.show) {
html.style.setProperty("--header-shade-opacity", state.get().header.shade.opacity); html.style.setProperty("--header-shade-opacity", state.get.current().header.shade.opacity);
}; };
}; };
render.border = function() { render.border = function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--header-border-top", state.get().header.border.top); html.style.setProperty("--header-border-top", state.get.current().header.border.top);
html.style.setProperty("--header-border-bottom", state.get().header.border.bottom); html.style.setProperty("--header-border-bottom", state.get.current().header.border.bottom);
}; };
render.search = { render.search = {
width: function() { width: function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--header-search-width", state.get().header.search.width + "%"); html.style.setProperty("--header-search-width", state.get.current().header.search.width + "%");
}, },
size: function() { size: function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--header-search-size", state.get().header.search.size + "em"); html.style.setProperty("--header-search-size", state.get.current().header.search.size + "em");
} }
}; };
render.greeting = { render.greeting = {
size: function() { size: function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--header-greeting-size", state.get().header.greeting.size + "em"); html.style.setProperty("--header-greeting-size", state.get.current().header.greeting.size + "em");
} }
}; };
render.transitional = { render.transitional = {
size: function() { size: function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--header-transitional-size", state.get().header.transitional.size + "em"); html.style.setProperty("--header-transitional-size", state.get.current().header.transitional.size + "em");
} }
}; };
render.clock = { render.clock = {
size: function() { size: function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--header-clock-size", state.get().header.clock.size + "em"); html.style.setProperty("--header-clock-size", state.get.current().header.clock.size + "em");
} }
}; };
render.date = { render.date = {
size: function() { size: function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--header-date-size", state.get().header.date.size + "em"); html.style.setProperty("--header-date-size", state.get.current().header.date.size + "em");
} }
}; };
render.button = { render.button = {
size: function() { size: function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--header-button-size", state.get().header.button.size + "em"); html.style.setProperty("--header-button-size", state.get.current().header.button.size + "em");
}, },
style: function() { style: function() {
var action = { var action = {
@ -146,10 +146,10 @@ var header = (function() {
helper.addClass(helper.e(".control-menu-open"), "button-link"); helper.addClass(helper.e(".control-menu-open"), "button-link");
} }
}; };
action[state.get().header.button.style](); action[state.get.current().header.button.style]();
}, },
edit: function() { edit: function() {
if (!state.get().link.edit) { if (!state.get.current().link.edit) {
helper.e(".control-link-edit").checked = false; helper.e(".control-link-edit").checked = false;
}; };
} }

View File

@ -6,24 +6,24 @@ var keyboard = (function() {
window.addEventListener("keydown", function(event) { window.addEventListener("keydown", function(event) {
// esc // esc
if (event.keyCode == 27) { if (event.keyCode == 27) {
if (state.get().edge) { if (state.get.current().edge) {
edge.box.close(); edge.box.close();
} else if (state.get().menu) { } else if (state.get.current().menu) {
menu.close(); menu.close();
} else if (state.get().dropdown) { } else if (state.get.current().dropdown) {
dropdown.close(); dropdown.close();
} else if (state.get().autoSuggest) { } else if (state.get.current().autoSuggest) {
autoSuggest.close(); autoSuggest.close();
} else if (state.get().link.add) { } else if (state.get.current().link.add) {
link.add.item.close(); link.add.item.close();
} else if (state.get().group.add) { } else if (state.get.current().group.add) {
link.add.group.close(); link.add.group.close();
} else if (state.get().link.edit && state.get().modal) { } else if (state.get.current().link.edit && state.get.current().modal) {
link.add.item.close(); link.add.item.close();
} else if (state.get().link.edit) { } else if (state.get.current().link.edit) {
link.edit.close(); link.edit.close();
data.save(); data.save();
} else if (state.get().modal) { } else if (state.get.current().modal) {
modal.close(); modal.close();
shade.close(); shade.close();
}; };
@ -36,14 +36,14 @@ var keyboard = (function() {
window.addEventListener("keydown", function(event) { window.addEventListener("keydown", function(event) {
// ctrl+alt+a // ctrl+alt+a
if (event.ctrlKey && event.altKey && event.keyCode == 65) { if (event.ctrlKey && event.altKey && event.keyCode == 65) {
if (state.get().group.add) { if (state.get.current().group.add) {
link.add.group.close(); link.add.group.close();
}; };
if (!state.get().link.add) { if (!state.get.current().link.add) {
if (state.get().menu) { if (state.get.current().menu) {
menu.close(); menu.close();
}; };
if (state.get().modal) { if (state.get.current().modal) {
modal.close(); modal.close();
}; };
link.add.item.open(); link.add.item.open();
@ -56,14 +56,14 @@ var keyboard = (function() {
window.addEventListener("keydown", function(event) { window.addEventListener("keydown", function(event) {
// ctrl+alt+g // ctrl+alt+g
if (event.ctrlKey && event.altKey && event.keyCode == 71) { if (event.ctrlKey && event.altKey && event.keyCode == 71) {
if (state.get().link.add) { if (state.get.current().link.add) {
link.add.item.close(); link.add.item.close();
}; };
if (!state.get().group.add) { if (!state.get.current().group.add) {
if (state.get().menu) { if (state.get.current().menu) {
menu.close(); menu.close();
}; };
if (state.get().modal) { if (state.get.current().modal) {
modal.close(); modal.close();
}; };
link.add.group.open(); link.add.group.open();
@ -87,10 +87,10 @@ var keyboard = (function() {
window.addEventListener("keydown", function(event) { window.addEventListener("keydown", function(event) {
// ctrl+alt+m // ctrl+alt+m
if (event.ctrlKey && event.altKey && event.keyCode == 77) { if (event.ctrlKey && event.altKey && event.keyCode == 77) {
if (state.get().link.add) { if (state.get.current().link.add) {
link.add.item.close(); link.add.item.close();
link.add.group.close(); link.add.group.close();
} else if (state.get().modal) { } else if (state.get.current().modal) {
modal.close(); modal.close();
shade.close(); shade.close();
}; };
@ -112,7 +112,7 @@ var keyboard = (function() {
bind.ctrAltR = function() { bind.ctrAltR = function() {
window.addEventListener("keydown", function(event) { window.addEventListener("keydown", function(event) {
// ctrl+alt+r // ctrl+alt+r
if (state.get().theme.accent.random.active && event.ctrlKey && event.altKey && event.keyCode == 82) { if (state.get.current().theme.accent.random.active && event.ctrlKey && event.altKey && event.keyCode == 82) {
theme.render.accent.random(); theme.render.accent.random();
theme.render.accent.color(); theme.render.accent.color();
link.groupAndItems(); link.groupAndItems();

View File

@ -4,22 +4,22 @@ var layout = (function() {
render.width = function() { render.width = function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--layout-width", state.get().layout.width + "%"); html.style.setProperty("--layout-width", state.get.current().layout.width + "%");
}; };
render.padding = function() { render.padding = function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--layout-padding", state.get().layout.padding); html.style.setProperty("--layout-padding", state.get.current().layout.padding);
}; };
render.gutter = function() { render.gutter = function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--layout-gutter", state.get().layout.gutter); html.style.setProperty("--layout-gutter", state.get.current().layout.gutter);
}; };
render.size = function() { render.size = function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--layout-size", state.get().layout.size); html.style.setProperty("--layout-size", state.get.current().layout.size);
}; };
render.order = function() { render.order = function() {
@ -27,16 +27,16 @@ var layout = (function() {
var layout = helper.e(".layout"); var layout = helper.e(".layout");
var header = helper.e(".header"); var header = helper.e(".header");
var link = helper.e(".link"); var link = helper.e(".link");
if (state.get().layout.order == "headerlink") { if (state.get.current().layout.order == "headerlink") {
layout.insertBefore(header, link); layout.insertBefore(header, link);
} else if (state.get().layout.order == "linkheader") { } else if (state.get.current().layout.order == "linkheader") {
layout.insertBefore(link, header); layout.insertBefore(link, header);
}; };
}; };
render.title = function() { render.title = function() {
var title = helper.e("title"); var title = helper.e("title");
title.textContent = state.get().layout.title; title.textContent = state.get.current().layout.title;
}; };
var init = function() { var init = function() {

View File

@ -126,7 +126,7 @@ var link = (function() {
mod.edit = { mod.edit = {
toggle: function() { toggle: function() {
if (state.get().link.edit) { if (state.get.current().link.edit) {
mod.edit.close(); mod.edit.close();
} else { } else {
mod.edit.open(); mod.edit.open();
@ -134,14 +134,14 @@ var link = (function() {
}, },
open: function() { open: function() {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "link.edit", path: "link.edit",
newValue: true newValue: true
}); });
}, },
close: function() { close: function() {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "link.edit", path: "link.edit",
newValue: false newValue: false
}); });
@ -149,7 +149,7 @@ var link = (function() {
check: function() { check: function() {
if (bookmarks.get().length <= 0) { if (bookmarks.get().length <= 0) {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "link.edit", path: "link.edit",
newValue: false newValue: false
}); });
@ -161,14 +161,14 @@ var link = (function() {
item: { item: {
open: function() { open: function() {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "link.add", path: "link.add",
newValue: true newValue: true
}); });
}, },
close: function() { close: function() {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "link.add", path: "link.add",
newValue: false newValue: false
}); });
@ -177,14 +177,14 @@ var link = (function() {
group: { group: {
open: function() { open: function() {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "group.add", path: "group.add",
newValue: true newValue: true
}); });
}, },
close: function() { close: function() {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "group.add", path: "group.add",
newValue: false newValue: false
}); });
@ -326,7 +326,7 @@ var link = (function() {
render.area = { render.area = {
width: function() { width: function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--link-area-width", state.get().link.area.width + "%"); html.style.setProperty("--link-area-width", state.get.current().link.area.width + "%");
} }
}; };
@ -484,15 +484,15 @@ var link = (function() {
}, },
size: function() { size: function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--group-name-size", state.get().group.name.size + "em"); html.style.setProperty("--group-name-size", state.get.current().group.name.size + "em");
}, },
border: function() { border: function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--group-border", state.get().group.border); html.style.setProperty("--group-border", state.get.current().group.border);
}, },
tabindex: function() { tabindex: function() {
var allGroupControlItem = helper.eA(".group-control-item"); var allGroupControlItem = helper.eA(".group-control-item");
if (state.get().link.edit) { if (state.get.current().link.edit) {
allGroupControlItem.forEach(function(arrayItem, index) { allGroupControlItem.forEach(function(arrayItem, index) {
arrayItem.tabIndex = 1; arrayItem.tabIndex = 1;
}); });
@ -524,9 +524,9 @@ var link = (function() {
linkItemOptions.attr[0].value = linkItemOptions.attr[0].value + " link-text-light"; linkItemOptions.attr[0].value = linkItemOptions.attr[0].value + " link-text-light";
}; };
} else { } else {
if (invert(state.get().theme.accent.current, true) == "#000000") { if (invert(state.get.current().theme.accent.current, true) == "#000000") {
linkItemOptions.attr[0].value = linkItemOptions.attr[0].value + " link-text-dark"; linkItemOptions.attr[0].value = linkItemOptions.attr[0].value + " link-text-dark";
} else if (invert(state.get().theme.accent.current, true) == "#ffffff") { } else if (invert(state.get.current().theme.accent.current, true) == "#ffffff") {
linkItemOptions.attr[0].value = linkItemOptions.attr[0].value + " link-text-light"; linkItemOptions.attr[0].value = linkItemOptions.attr[0].value + " link-text-light";
}; };
}; };
@ -544,7 +544,7 @@ var link = (function() {
value: 1 value: 1
}] }]
}; };
if (state.get().link.newTab) { if (state.get.current().link.newTab) {
linkPanelFrontOptions.attr.push({ linkPanelFrontOptions.attr.push({
key: "target", key: "target",
value: "_blank" value: "_blank"
@ -1036,24 +1036,24 @@ var link = (function() {
display: { display: {
letter: function() { letter: function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--link-item-display-letter-size", state.get().link.item.display.letcon.letter.size + "em"); html.style.setProperty("--link-item-display-letter-size", state.get.current().link.item.display.letcon.letter.size + "em");
}, },
icon: function() { icon: function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--link-item-display-icon-size", state.get().link.item.display.letcon.icon.size + "em"); html.style.setProperty("--link-item-display-icon-size", state.get.current().link.item.display.letcon.icon.size + "em");
} }
}, },
name: function() { name: function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--link-item-display-name-size", state.get().link.item.display.name.size + "em"); html.style.setProperty("--link-item-display-name-size", state.get.current().link.item.display.name.size + "em");
}, },
size: function() { size: function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--link-item-size", state.get().link.item.size + "em"); html.style.setProperty("--link-item-size", state.get.current().link.item.size + "em");
}, },
tabindex: function() { tabindex: function() {
var allLinkControlItem = helper.eA(".link-control-item"); var allLinkControlItem = helper.eA(".link-control-item");
if (state.get().link.edit) { if (state.get.current().link.edit) {
allLinkControlItem.forEach(function(arrayItem, index) { allLinkControlItem.forEach(function(arrayItem, index) {
arrayItem.tabIndex = 1; arrayItem.tabIndex = 1;
}); });
@ -1065,20 +1065,20 @@ var link = (function() {
}, },
border: function() { border: function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--link-item-border", state.get().link.item.border); html.style.setProperty("--link-item-border", state.get.current().link.item.border);
}, },
rotate: function() { rotate: function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--link-item-display-rotate", state.get().link.item.display.rotate + "deg"); html.style.setProperty("--link-item-display-rotate", state.get.current().link.item.display.rotate + "deg");
}, },
translate: { translate: {
x: function() { x: function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--link-item-display-translate-x", state.get().link.item.display.translate.x + "em"); html.style.setProperty("--link-item-display-translate-x", state.get.current().link.item.display.translate.x + "em");
}, },
y: function() { y: function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--link-item-display-translate-y", state.get().link.item.display.translate.y + "em"); html.style.setProperty("--link-item-display-translate-y", state.get.current().link.item.display.translate.y + "em");
} }
} }
}; };
@ -1086,7 +1086,7 @@ var link = (function() {
render.all = function() { render.all = function() {
var linkSection = helper.e(".link"); var linkSection = helper.e(".link");
var bookmarksToRender = false; var bookmarksToRender = false;
if (state.get().search) { if (state.get.current().search) {
bookmarksToRender = search.get(); bookmarksToRender = search.get();
} else { } else {
bookmarksToRender = bookmarks.get(); bookmarksToRender = bookmarks.get();
@ -1128,7 +1128,7 @@ var link = (function() {
} }
}; };
// if searching // if searching
if (state.get().search) { if (state.get.current().search) {
// if bookmarks exist to be searched // if bookmarks exist to be searched
if (bookmarksToRender.total > 0) { if (bookmarksToRender.total > 0) {
make.bookmarks(bookmarksToRender.matching); make.bookmarks(bookmarksToRender.matching);
@ -1188,7 +1188,7 @@ var link = (function() {
var paraWrap1 = helper.node("div|class:p-wrap"); var paraWrap1 = helper.node("div|class:p-wrap");
var paraWrap2 = helper.node("div|class:p-wrap"); var paraWrap2 = helper.node("div|class:p-wrap");
var para1 = helper.node("p:No bookmarks matching \"" + helper.e(".header-search-input").value + "\" found.|class:mb-0"); var para1 = helper.node("p:No bookmarks matching \"" + helper.e(".header-search-input").value + "\" found.|class:mb-0");
var para2 = helper.node("p:\"Enter\" to Search " + state.get().header.search.engine[state.get().header.search.engine.selected].name + ".|class:small muted mb-0"); var para2 = helper.node("p:\"Enter\" to Search " + state.get.current().header.search.engine[state.get.current().header.search.engine.selected].name + ".|class:small muted mb-0");
paraWrap1.appendChild(para1); paraWrap1.appendChild(para1);
paraWrap2.appendChild(para2); paraWrap2.appendChild(para2);
linkEmpty.appendChild(paraWrap1); linkEmpty.appendChild(paraWrap1);

View File

@ -4,7 +4,7 @@ var menu = (function() {
mod.open = function() { mod.open = function() {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "menu", path: "menu",
newValue: true newValue: true
}); });
@ -12,7 +12,7 @@ var menu = (function() {
mod.close = function() { mod.close = function() {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "menu", path: "menu",
newValue: false newValue: false
}); });
@ -44,7 +44,7 @@ var menu = (function() {
render.tabindex = { render.tabindex = {
toggle: function() { toggle: function() {
var menu = helper.e(".menu"); var menu = helper.e(".menu");
if (state.get().menu) { if (state.get.current().menu) {
menu.tabIndex = 1; menu.tabIndex = 1;
menu.querySelectorAll("[tabindex]").forEach(function(arrayItem, index) { menu.querySelectorAll("[tabindex]").forEach(function(arrayItem, index) {
arrayItem.tabIndex = 1; arrayItem.tabIndex = 1;
@ -80,7 +80,7 @@ var menu = (function() {
}; };
var toggle = function() { var toggle = function() {
if (state.get().menu) { if (state.get.current().menu) {
close(); close();
} else { } else {
open(); open();

View File

@ -6,7 +6,7 @@ var modal = (function() {
mod.open = function() { mod.open = function() {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "modal", path: "modal",
newValue: true newValue: true
}); });
@ -14,7 +14,7 @@ var modal = (function() {
mod.close = function() { mod.close = function() {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "modal", path: "modal",
newValue: false newValue: false
}); });
@ -23,7 +23,7 @@ var modal = (function() {
var render = {}; var render = {};
render.toggle = function(override) { render.toggle = function(override) {
if (state.get().modal) { if (state.get.current().modal) {
render.open(override); render.open(override);
} else { } else {
render.close(); render.close();

View File

@ -4,7 +4,7 @@ var pagelock = (function() {
mod.lock = function() { mod.lock = function() {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "pagelock", path: "pagelock",
newValue: true newValue: true
}); });
@ -12,14 +12,14 @@ var pagelock = (function() {
mod.unlock = function() { mod.unlock = function() {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "pagelock", path: "pagelock",
newValue: false newValue: false
}); });
}; };
mod.toggle = function() { mod.toggle = function() {
if (state.get().menu || state.get().modal || state.get().autoSuggest) { if (state.get.current().menu || state.get.current().modal || state.get.current().autoSuggest) {
mod.lock(); mod.lock();
} else { } else {
mod.unlock(); mod.unlock();
@ -37,7 +37,7 @@ var pagelock = (function() {
}; };
render.toggle = function() { render.toggle = function() {
if (state.get().pagelock) { if (state.get.current().pagelock) {
render.lock(); render.lock();
} else { } else {
render.unlock(); render.unlock();

View File

@ -26,7 +26,7 @@ var search = (function() {
mod.searching = { mod.searching = {
set: function() { set: function() {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "search", path: "search",
newValue: helper.e(".search-input").value != "" newValue: helper.e(".search-input").value != ""
}); });
@ -36,7 +36,7 @@ var search = (function() {
var get = function() { var get = function() {
var searchInput = helper.e(".search-input"); var searchInput = helper.e(".search-input");
var string = searchInput.value.toLowerCase().replace(/\s/g, ""); var string = searchInput.value.toLowerCase().replace(/\s/g, "");
if (state.get().search) { if (state.get.current().search) {
var searchedBookmarks = { var searchedBookmarks = {
total: 0, total: 0,
matching: [] matching: []
@ -73,14 +73,14 @@ var search = (function() {
var search = helper.e(".search"); var search = helper.e(".search");
var searchInput = helper.e(".search-input"); var searchInput = helper.e(".search-input");
var placeholder = ""; var placeholder = "";
if (state.get().link.show) { if (state.get.current().link.show) {
placeholder = "Find bookmarks or search"; placeholder = "Find bookmarks or search";
} else { } else {
placeholder = "Search"; placeholder = "Search";
}; };
placeholder = placeholder + " " + state.get().header.search.engine[state.get().header.search.engine.selected].name; placeholder = placeholder + " " + state.get.current().header.search.engine[state.get.current().header.search.engine.selected].name;
searchInput.setAttribute("placeholder", placeholder); searchInput.setAttribute("placeholder", placeholder);
search.setAttribute("action", state.get().header.search.engine[state.get().header.search.engine.selected].url); search.setAttribute("action", state.get.current().header.search.engine[state.get.current().header.search.engine.selected].url);
}; };
render.clear = {}; render.clear = {};
@ -93,7 +93,7 @@ var search = (function() {
render.clear.button = function() { render.clear.button = function() {
var searchClear = helper.e(".search-clear"); var searchClear = helper.e(".search-clear");
if (state.get().search) { if (state.get.current().search) {
searchClear.removeAttribute("disabled"); searchClear.removeAttribute("disabled");
} else { } else {
searchClear.setAttribute("disabled", ""); searchClear.setAttribute("disabled", "");
@ -101,7 +101,7 @@ var search = (function() {
}; };
render.focus = function() { render.focus = function() {
if (state.get().header.search.focus) { if (state.get.current().header.search.focus) {
window.addEventListener("load", function(event) { window.addEventListener("load", function(event) {
helper.e(".search-input").focus(); helper.e(".search-input").focus();
}); });

View File

@ -6,7 +6,7 @@ var shade = (function() {
mod.open = function() { mod.open = function() {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "shade", path: "shade",
newValue: true newValue: true
}); });
@ -14,22 +14,22 @@ var shade = (function() {
mod.close = function() { mod.close = function() {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "shade", path: "shade",
newValue: false newValue: false
}); });
}; };
mod.toggle = function() { mod.toggle = function() {
if (state.get().shade) { if (state.get.current().shade) {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "shade", path: "shade",
newValue: false newValue: false
}); });
} else { } else {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "shade", path: "shade",
newValue: true newValue: true
}); });
@ -39,7 +39,7 @@ var shade = (function() {
var render = {}; var render = {};
render.toggle = function(override) { render.toggle = function(override) {
if (state.get().shade) { if (state.get.current().shade) {
render.open(override); render.open(override);
} else { } else {
render.close(); render.close();

View File

@ -255,8 +255,79 @@ var state = (function() {
autoSuggest: false autoSuggest: false
}; };
mod.get = function() { mod.default = {
header: {
area: {
width: 100
},
clock: {
size: 1
},
date: {
size: 1
},
search: {
size: 1
},
button: {
size: 1
},
greeting: {
size: 1
},
transitional: {
size: 1
}
},
group: {
name: {
size: 1
}
},
link: {
area: {
width: 100
},
item: {
display: {
letcon: {
letter: {
size: 3
},
icon: {
size: 3
}
},
name: {
size: 0.9
},
rotate: 0,
translate: {
x: 0,
y: 0
}
},
size: 1
}
},
layout: {
padding: 4,
gutter: 2,
size: 1,
width: 80
},
theme: {
radius: 0.25
}
};
mod.get = {
current: function() {
return mod.current; return mod.current;
},
default: function() {
return mod.default;
}
}; };
mod.restore = function(data) { mod.restore = function(data) {
@ -271,8 +342,13 @@ var state = (function() {
}; };
}; };
var get = function() { var get = {
return mod.get(); current: function() {
return mod.get.current();
},
default: function() {
return mod.get.default();
}
}; };
return { return {

View File

@ -5,22 +5,22 @@ var theme = (function() {
mod.theme = { mod.theme = {
light: function() { light: function() {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "theme.style", path: "theme.style",
newValue: "light" newValue: "light"
}); });
}, },
dark: function() { dark: function() {
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "theme.style", path: "theme.style",
newValue: "dark" newValue: "dark"
}); });
}, },
toggle: function() { toggle: function() {
if (state.get().theme.style == "dark") { if (state.get.current().theme.style == "dark") {
mod.theme.light(); mod.theme.light();
} else if (state.get().theme.style == "light") { } else if (state.get.current().theme.style == "light") {
mod.theme.dark(); mod.theme.dark();
}; };
} }
@ -32,22 +32,22 @@ var theme = (function() {
var html = helper.e("html"); var html = helper.e("html");
helper.removeClass(html, "is-theme-style-dark"); helper.removeClass(html, "is-theme-style-dark");
helper.removeClass(html, "is-theme-style-light"); helper.removeClass(html, "is-theme-style-light");
helper.addClass(html, "is-theme-style-" + state.get().theme.style); helper.addClass(html, "is-theme-style-" + state.get.current().theme.style);
}; };
render.radius = function() { render.radius = function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--theme-radius", state.get().theme.radius + "rem"); html.style.setProperty("--theme-radius", state.get.current().theme.radius + "rem");
}; };
render.accent = { render.accent = {
color: function() { color: function() {
var html = helper.e("html"); var html = helper.e("html");
var color = state.get().theme.accent.current; var color = state.get.current().theme.accent.current;
html.style.setProperty("--theme-accent", color.r + ", " + color.g + ", " + color.b); html.style.setProperty("--theme-accent", color.r + ", " + color.g + ", " + color.b);
}, },
random: function() { random: function() {
if (state.get().theme.accent.random.active) { if (state.get.current().theme.accent.random.active) {
var randomVal = function(min, max) { var randomVal = function(min, max) {
return Math.floor(Math.random() * (max - min) + 1) + min; return Math.floor(Math.random() * (max - min) + 1) + min;
}; };
@ -88,14 +88,14 @@ var theme = (function() {
}; };
} }
}; };
var hsl = color[state.get().theme.accent.random.style](); var hsl = color[state.get.current().theme.accent.random.style]();
var randomColor = helper.hslToRgb({ var randomColor = helper.hslToRgb({
h: hsl.h, h: hsl.h,
s: (hsl.s / 100), s: (hsl.s / 100),
l: (hsl.l / 100) l: (hsl.l / 100)
}); });
helper.setObject({ helper.setObject({
object: state.get(), object: state.get.current(),
path: "theme.accent.current", path: "theme.accent.current",
newValue: randomColor newValue: randomColor
}); });
@ -108,13 +108,13 @@ var theme = (function() {
render.input = { render.input = {
quick: function() { quick: function() {
helper.e(".control-theme-accent-current-quick").value = helper.rgbToHex(state.get().theme.accent.current); helper.e(".control-theme-accent-current-quick").value = helper.rgbToHex(state.get.current().theme.accent.current);
}, },
picker: function() { picker: function() {
helper.e(".control-theme-accent-current-picker").value = helper.rgbToHex(state.get().theme.accent.current); helper.e(".control-theme-accent-current-picker").value = helper.rgbToHex(state.get.current().theme.accent.current);
}, },
hex: function() { hex: function() {
helper.e(".control-theme-accent-current-hex").value = helper.rgbToHex(state.get().theme.accent.current); helper.e(".control-theme-accent-current-hex").value = helper.rgbToHex(state.get.current().theme.accent.current);
} }
}; };

View File

@ -19,29 +19,29 @@ var transitional = (function() {
}; };
render.all = function() { render.all = function() {
if (state.get().header.transitional.show) { if (state.get.current().header.transitional.show) {
var transitional = helper.e(".transitional"); var transitional = helper.e(".transitional");
var message = { var message = {
timeanddate: function() { timeanddate: function() {
if ((state.get().header.date.day.show || state.get().header.date.date.show || state.get().header.date.month.show || state.get().header.date.year.show) && (state.get().header.clock.seconds.show || state.get().header.clock.minutes.show || state.get().header.clock.hours.show)) { if ((state.get.current().header.date.day.show || state.get.current().header.date.date.show || state.get.current().header.date.month.show || state.get.current().header.date.year.show) && (state.get.current().header.clock.seconds.show || state.get.current().header.clock.minutes.show || state.get.current().header.clock.hours.show)) {
if (state.get().header.date.day.show && !state.get().header.date.date.show && !state.get().header.date.month.show && !state.get().header.date.year.show) { if (state.get.current().header.date.day.show && !state.get.current().header.date.date.show && !state.get.current().header.date.month.show && !state.get.current().header.date.year.show) {
return "The time and day is"; return "The time and day is";
} else { } else {
return "The time and date is"; return "The time and date is";
}; };
} else if (state.get().header.date.day.show || state.get().header.date.date.show || state.get().header.date.month.show || state.get().header.date.year.show) { } else if (state.get.current().header.date.day.show || state.get.current().header.date.date.show || state.get.current().header.date.month.show || state.get.current().header.date.year.show) {
if (state.get().header.date.day.show && !state.get().header.date.date.show && !state.get().header.date.month.show && !state.get().header.date.year.show) { if (state.get.current().header.date.day.show && !state.get.current().header.date.date.show && !state.get.current().header.date.month.show && !state.get.current().header.date.year.show) {
return "Today is"; return "Today is";
} else if (!state.get().header.date.day.show && state.get().header.date.date.show && !state.get().header.date.month.show && !state.get().header.date.year.show) { } else if (!state.get.current().header.date.day.show && state.get.current().header.date.date.show && !state.get.current().header.date.month.show && !state.get.current().header.date.year.show) {
return "The date is"; return "The date is";
} else if (!state.get().header.date.day.show && !state.get().header.date.date.show && state.get().header.date.month.show && !state.get().header.date.year.show) { } else if (!state.get.current().header.date.day.show && !state.get.current().header.date.date.show && state.get.current().header.date.month.show && !state.get.current().header.date.year.show) {
return "The month is"; return "The month is";
} else if (!state.get().header.date.day.show && !state.get().header.date.date.show && !state.get().header.date.month.show && state.get().header.date.year.show) { } else if (!state.get.current().header.date.day.show && !state.get.current().header.date.date.show && !state.get.current().header.date.month.show && state.get.current().header.date.year.show) {
return "The year is"; return "The year is";
} else { } else {
return "The date is"; return "The date is";
}; };
} else if (state.get().header.clock.seconds.show || state.get().header.clock.minutes.show || state.get().header.clock.hours.show) { } else if (state.get.current().header.clock.seconds.show || state.get.current().header.clock.minutes.show || state.get.current().header.clock.hours.show) {
return "The time is"; return "The time is";
}; };
}, },
@ -49,7 +49,7 @@ var transitional = (function() {
return "It's"; return "It's";
} }
}; };
var string = message[state.get().header.transitional.type](); var string = message[state.get.current().header.transitional.type]();
var transitionalItem = helper.node("span|class:transitional-item"); var transitionalItem = helper.node("span|class:transitional-item");
var transitionalItemText = helper.node("span:" + string + "|class:transitional-item-text"); var transitionalItemText = helper.node("span:" + string + "|class:transitional-item-text");
transitionalItem.appendChild(transitionalItemText); transitionalItem.appendChild(transitionalItemText);