[feature] add controls to clear or set all link colour override

This commit is contained in:
Kuldeep M 2019-06-26 11:35:51 +01:00
parent 1d06a1409f
commit 36ff6cb4a2
5 changed files with 62 additions and 2 deletions

View File

@ -894,6 +894,19 @@
</div>
</div>
</div>
<div class="menu-item">
<div class="menu-item-header">
<h1 class="menu-item-header-text">Accent override</h1>
</div>
<div class="menu-item-form">
<div class="button-wrap">
<button class="control-link-accent-clear button mb-0" tabindex="1">Remove all override colours</button>
</div>
<div class="button-wrap">
<button class="control-link-accent-set button mb-0" tabindex="1">Apply override colours to all Bookmarks</button>
</div>
</div>
</div>
</div>
<div class="menu-content-area menu-content-area-theme is-hidden">

View File

@ -1972,6 +1972,24 @@ var control = (function() {
link.render.item.all();
sortable(".link-area");
}
}, {
element: helper.e(".control-link-accent-clear"),
type: "button",
func: function() {
link.accent.clear();
link.clear();
link.render.item.all();
sortable(".link-area");
}
}, {
element: helper.e(".control-link-accent-set"),
type: "button",
func: function() {
link.accent.set();
link.clear();
link.render.item.all();
sortable(".link-area");
}
}, {
element: helper.e(".control-theme-style-dark"),
path: "theme.style",

View File

@ -683,6 +683,34 @@ var link = (function() {
};
};
var accent = {
set: function() {
var units = 360 / bookmarks.get().length;
var degree = 0;
bookmarks.get().forEach(function(arrayItem, index) {
arrayItem.accent.override = true;
arrayItem.accent.color = helper.hslToRgb({
h: degree,
s: 1,
l: 0.5
});
degree = degree + units;
});
},
clear: function() {
bookmarks.get().forEach(function(arrayItem, index) {
arrayItem.accent = {
override: false,
color: {
r: null,
g: null,
b: null
}
};
});
}
};
var init = function() {
render.area.width();
render.item.all();
@ -697,6 +725,7 @@ var link = (function() {
return {
stagedBookmarkData: stagedBookmarkData,
autoSuggestIconAction: autoSuggestIconAction,
accent: accent,
init: init,
clear: clear,
add: add,

View File

@ -1,6 +1,6 @@
var version = (function() {
var current = "3.25.0";
var current = "3.26.0";
var compare = function(a, b) {
var pa = a.split(".");

View File

@ -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.25.0",
"version": "3.26.0",
"manifest_version": 2,
"chrome_url_overrides": {
"newtab": "index.html"