mirror of
https://github.com/zombieFox/nightTab.git
synced 2024-11-24 17:14:28 +01:00
[refactor] theme module
This commit is contained in:
parent
218af1dbc3
commit
ee1f0d4508
@ -73,10 +73,7 @@ var control = (function() {
|
||||
path: "theme.accent.current",
|
||||
type: "color",
|
||||
func: function() {
|
||||
theme.render.accent.color();
|
||||
link.render.clear();
|
||||
link.render.item.all();
|
||||
sortable(".link-area");
|
||||
theme.accent();
|
||||
}
|
||||
}, {
|
||||
element: helper.e(".control-layout-width"),
|
||||
|
@ -55,7 +55,6 @@ var keyboard = (function() {
|
||||
// ctrl+alt+d
|
||||
if (event.ctrlKey && event.altKey && event.keyCode == 68) {
|
||||
theme.toggle();
|
||||
theme.render.theme();
|
||||
control.update();
|
||||
data.save();
|
||||
};
|
||||
|
@ -1,23 +1,29 @@
|
||||
var theme = (function() {
|
||||
|
||||
var toggle = function() {
|
||||
var style = {
|
||||
dark: function() {
|
||||
helper.setObject({
|
||||
object: state.get(),
|
||||
path: "theme.style",
|
||||
newValue: "light"
|
||||
})
|
||||
},
|
||||
light: function() {
|
||||
helper.setObject({
|
||||
object: state.get(),
|
||||
path: "theme.style",
|
||||
newValue: "dark"
|
||||
})
|
||||
}
|
||||
};
|
||||
style[state.get().theme.style]();
|
||||
var mod = {};
|
||||
|
||||
mod.theme = {
|
||||
light: function() {
|
||||
helper.setObject({
|
||||
object: state.get(),
|
||||
path: "theme.style",
|
||||
newValue: "light"
|
||||
});
|
||||
},
|
||||
dark: function() {
|
||||
helper.setObject({
|
||||
object: state.get(),
|
||||
path: "theme.style",
|
||||
newValue: "dark"
|
||||
});
|
||||
},
|
||||
toggle: function() {
|
||||
if (state.get().theme.style == "dark") {
|
||||
mod.theme.light();
|
||||
} else if (state.get().theme.style == "light") {
|
||||
mod.theme.dark();
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
var render = {};
|
||||
@ -98,6 +104,18 @@ var theme = (function() {
|
||||
}
|
||||
};
|
||||
|
||||
var toggle = function() {
|
||||
mod.theme.toggle();
|
||||
render.theme();
|
||||
};
|
||||
|
||||
var accent = function() {
|
||||
theme.render.accent.color();
|
||||
link.render.clear();
|
||||
link.render.item.all();
|
||||
sortable(".link-area");
|
||||
};
|
||||
|
||||
var init = function() {
|
||||
render.theme();
|
||||
render.accent.random();
|
||||
@ -107,9 +125,10 @@ var theme = (function() {
|
||||
|
||||
// exposed methods
|
||||
return {
|
||||
init: init,
|
||||
render: render,
|
||||
toggle: toggle,
|
||||
init: init
|
||||
accent: accent
|
||||
};
|
||||
|
||||
})();
|
||||
|
@ -610,7 +610,7 @@ var update = (function() {
|
||||
// loop over all updates in _update object
|
||||
for (var key in _update) {
|
||||
if (version.compare(data.version, key) == -1) {
|
||||
console.log("\t= running update", key);
|
||||
console.log("\t > running update", key);
|
||||
data = _update[key](data);
|
||||
data.version = key;
|
||||
};
|
||||
@ -618,7 +618,7 @@ var update = (function() {
|
||||
|
||||
// if no update is needed version bump
|
||||
if (version.compare(data.version, version.get()) == -1) {
|
||||
console.log("\t= nothing to update, version bump to", version.get());
|
||||
console.log("\t > nothing to update, version bump to", version.get());
|
||||
data.version = version.get();
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
var version = (function() {
|
||||
|
||||
var current = "3.52.0";
|
||||
var current = "3.53.0";
|
||||
|
||||
var compare = function(a, b) {
|
||||
var pa = a.split(".");
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "nightTab",
|
||||
"short_name": "nightTab",
|
||||
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
|
||||
"version": "3.52.0",
|
||||
"version": "3.53.0",
|
||||
"manifest_version": 2,
|
||||
"chrome_url_overrides": {
|
||||
"newtab": "index.html"
|
||||
|
Loading…
Reference in New Issue
Block a user