[feature] add header button colour dot control

This commit is contained in:
zombieFox 2019-12-23 11:48:49 +00:00
parent cdded4a772
commit 9ac5a3e5c9
9 changed files with 51 additions and 5 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "nighttab", "name": "nighttab",
"version": "4.5.0", "version": "4.4.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "nighttab", "name": "nighttab",
"version": "4.5.0", "version": "4.4.0",
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.", "description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -784,6 +784,12 @@
<label for="control-header-button-coloraccent-show"><span class="label-icon"></span> Show Colour/Accent</label> <label for="control-header-button-coloraccent-show"><span class="label-icon"></span> Show Colour/Accent</label>
</div> </div>
<p class="control-header-button-coloraccent-show-helper form-helper small">Colour and Accent can also be found under Theme.</p> <p class="control-header-button-coloraccent-show-helper form-helper small">Colour and Accent can also be found under Theme.</p>
<div class="form-indent">
<div class="input-wrap">
<input id="control-header-button-coloraccent-dot-show" class="control-header-button-coloraccent-dot-show" type="checkbox" tabindex="-1">
<label for="control-header-button-coloraccent-dot-show"><span class="label-icon"></span> Show colour dots</label>
</div>
</div>
<hr> <hr>
<div class="input-wrap"> <div class="input-wrap">
<label for="control-header-button-size">Size</label> <label for="control-header-button-size">Size</label>

View File

@ -1663,6 +1663,13 @@ var control = (function() {
render.class(); render.class();
render.dependents(); render.dependents();
} }
}, {
element: helper.e(".control-header-button-coloraccent-dot-show"),
path: "header.button.colorAccent.dot.show",
type: "checkbox",
func: function() {
header.render.button.dot();
}
}, { }, {
element: helper.e(".control-header-button-size"), element: helper.e(".control-header-button-size"),
path: "header.button.size", path: "header.button.size",
@ -3482,6 +3489,12 @@ var control = (function() {
_disable.input(".control-header-radius", true); _disable.input(".control-header-radius", true);
}; };
}; };
var _button = function() {
_disable.input(".control-header-button-coloraccent-dot-show", true);
if (state.get.current().header.button.colorAccent.show) {
_disable.input(".control-header-button-coloraccent-dot-show", false);
};
};
var _search = function() { var _search = function() {
if (state.get.current().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);
@ -3613,6 +3626,7 @@ var control = (function() {
_clock(); _clock();
_date(); _date();
_shade(); _shade();
_button();
_search(); _search();
_greeting(); _greeting();
_transitional(); _transitional();

View File

@ -149,6 +149,23 @@ var header = (function() {
} }
}; };
action[state.get.current().header.button.style](); action[state.get.current().header.button.style]();
},
dot: function() {
if (state.get.current().header.button.colorAccent.dot.show) {
helper.addClass(helper.getClosest(helper.e(".control-theme-color-rgb-quick"), ".input-wrap"), "input-color-dot");
helper.addClass(helper.getClosest(helper.e(".control-theme-color-rgb-quick"), ".input-wrap"), "input-color-dot-accent");
helper.removeClass(helper.getClosest(helper.e(".control-theme-color-rgb-quick"), ".input-wrap"), "input-hide");
helper.addClass(helper.getClosest(helper.e(".control-theme-accent-current-quick"), ".input-wrap"), "input-color-dot");
helper.addClass(helper.getClosest(helper.e(".control-theme-accent-current-quick"), ".input-wrap"), "input-color-dot-accent");
helper.removeClass(helper.getClosest(helper.e(".control-theme-accent-current-quick"), ".input-wrap"), "input-hide");
} else {
helper.removeClass(helper.getClosest(helper.e(".control-theme-color-rgb-quick"), ".input-wrap"), "input-color-dot");
helper.removeClass(helper.getClosest(helper.e(".control-theme-color-rgb-quick"), ".input-wrap"), "input-color-dot-accent");
helper.addClass(helper.getClosest(helper.e(".control-theme-color-rgb-quick"), ".input-wrap"), "input-hide");
helper.removeClass(helper.getClosest(helper.e(".control-theme-accent-current-quick"), ".input-wrap"), "input-color-dot");
helper.removeClass(helper.getClosest(helper.e(".control-theme-accent-current-quick"), ".input-wrap"), "input-color-dot-accent");
helper.addClass(helper.getClosest(helper.e(".control-theme-accent-current-quick"), ".input-wrap"), "input-hide");
};
} }
}; };

View File

@ -105,7 +105,10 @@ var state = (function() {
show: true show: true
}, },
colorAccent: { colorAccent: {
show: true show: true,
dot: {
show: true
}
}, },
style: "box", style: "box",
size: 1 size: 1

View File

@ -716,6 +716,12 @@ var update = (function() {
data.state.header.button.colorAccent = data.state.header.button.accent; data.state.header.button.colorAccent = data.state.header.button.accent;
delete data.state.header.button.accent; delete data.state.header.button.accent;
return data; return data;
},
"4.4.0": function(data) {
data.state.header.button.colorAccent.dot = {
show: true
};
return data;
} }
}; };

View File

@ -1,6 +1,6 @@
var version = (function() { var version = (function() {
var current = "4.5.0"; var current = "4.4.0";
var name = "Naughty Goose"; var name = "Naughty Goose";

View File

@ -2,7 +2,7 @@
"name": "nightTab", "name": "nightTab",
"short_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.", "description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
"version": "4.5.0", "version": "4.4.0",
"manifest_version": 2, "manifest_version": 2,
"chrome_url_overrides": { "chrome_url_overrides": {
"newtab": "index.html" "newtab": "index.html"