[feature] add link opacity controls

This commit is contained in:
zombieFox 2020-03-25 22:06:12 +00:00
parent f2e1ddf541
commit 27f84c55ff
11 changed files with 140 additions and 31 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "nightTab", "name": "nightTab",
"version": "5.0.0", "version": "5.1.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "nightTab", "name": "nightTab",
"version": "5.0.0", "version": "5.1.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

@ -183,11 +183,11 @@
} }
.is-link-item-color-by-theme .link-panel-front { .is-link-item-color-by-theme .link-panel-front {
background-color: rgb(var(--link-item-color-theme)); background-color: rgba(var(--link-item-color-theme), var(--link-item-opacity));
} }
.is-link-item-color-by-custom .link-panel-front { .is-link-item-color-by-custom .link-panel-front {
background-color: rgb(var(--link-item-color-custom)); background-color: rgba(var(--link-item-color-custom), var(--link-item-opacity));
} }
.is-link-style-block .link-panel-front { .is-link-style-block .link-panel-front {
@ -234,7 +234,7 @@
.is-link-item-color-by-theme .link-item:focus-within .link-panel-front, .is-link-item-color-by-theme .link-item:focus-within .link-panel-front,
.is-link-item-color-by-theme .link-item:focus .link-panel-front, .is-link-item-color-by-theme .link-item:focus .link-panel-front,
.is-link-item-color-by-theme .link-item:hover .link-panel-front { .is-link-item-color-by-theme .link-item:hover .link-panel-front {
background-color: rgb(var(--theme-color-03)); background-color: rgba(var(--theme-color-03), var(--link-item-opacity));
} }
.is-link-item-shadow-show.is-link-orientation-bottom .link-item:focus .link-panel-front, .is-link-item-shadow-show.is-link-orientation-bottom .link-item:focus .link-panel-front,
@ -735,7 +735,11 @@
justify-content: flex-end; justify-content: flex-end;
z-index: 2; z-index: 2;
transition: height var(--layout-timing-extra-fast), border-radius var(--layout-timing-extra-fast), top var(--layout-timing-extra-fast), clip-path var(--layout-timing-extra-fast); transition: height var(--layout-timing-extra-fast), border-radius var(--layout-timing-extra-fast), top var(--layout-timing-extra-fast), clip-path var(--layout-timing-extra-fast);
clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); }
.is-edit .link-panel-back {
height: 100%;
top: 0;
} }
.is-link-orientation-top .link-panel-back { .is-link-orientation-top .link-panel-back {
@ -758,42 +762,65 @@
top: var(--layout-line-width); top: var(--layout-line-width);
} }
.is-edit.is-link-item-line-show .link-panel-back {
height: 100%;
}
.is-edit.is-link-item-line-show.is-link-orientation-top .link-panel-back,
.is-edit.is-link-item-line-show.is-link-orientation-bottom .link-panel-back {
top: 0;
}
.is-link-orientation-top .link-panel-back {
clip-path: polygon(0 0, 100% 0, 100% calc(0% + var(--link-item-padding)), 0 calc(0% + var(--link-item-padding)));
}
.is-link-orientation-bottom .link-panel-back {
clip-path: polygon(0 calc(100% - var(--link-item-padding)), 100% calc(100% - var(--link-item-padding)), 100% 100%, 0 100%);
}
.is-link-orientation-top.is-link-item-line-show .link-panel-back {
clip-path: polygon(0 0, 100% 0, 100% calc(var(--layout-line-width) + var(--link-item-padding)), 0 calc(var(--layout-line-width) + var(--link-item-padding)));
}
.is-link-orientation-bottom.is-link-item-line-show .link-panel-back {
clip-path: polygon(0 calc(100% - var(--layout-line-width) - var(--link-item-padding)), 100% calc(100% - var(--layout-line-width) - var(--link-item-padding)), 100% 100%, 0 100%);
}
.is-link-orientation-top .link-item:focus .link-panel-back,
.is-link-orientation-top .link-item:focus-within .link-panel-back,
.is-link-orientation-top .link-item:hover .link-panel-back,
.is-link-orientation-bottom .link-item:focus .link-panel-back,
.is-link-orientation-bottom .link-item:focus-within .link-panel-back,
.is-link-orientation-bottom .link-item:hover .link-panel-back {
top: 0;
height: 100%;
}
.is-link-item-url-show.is-link-orientation-top .link-item:focus .link-panel-back, .is-link-item-url-show.is-link-orientation-top .link-item:focus .link-panel-back,
.is-link-item-url-show.is-link-orientation-top .link-item:focus-within .link-panel-back, .is-link-item-url-show.is-link-orientation-top .link-item:focus-within .link-panel-back,
.is-link-item-url-show.is-link-orientation-top .link-item:hover .link-panel-back { .is-link-item-url-show.is-link-orientation-top .link-item:hover .link-panel-back {
height: 100%; clip-path: polygon(0 0, 100% 0, 100% calc(var(--link-item-url-height) + var(--link-item-padding)), 0 calc(var(--link-item-url-height) + var(--link-item-padding)));
top: 0;
clip-path: polygon(0 0, 100% 0, 100% calc(var(--link-item-url-height) + 10%), 0 calc(var(--link-item-url-height) + 10%));
} }
.is-link-item-url-show.is-link-orientation-bottom .link-item:focus .link-panel-back, .is-link-item-url-show.is-link-orientation-bottom .link-item:focus .link-panel-back,
.is-link-item-url-show.is-link-orientation-bottom .link-item:focus-within .link-panel-back, .is-link-item-url-show.is-link-orientation-bottom .link-item:focus-within .link-panel-back,
.is-link-item-url-show.is-link-orientation-bottom .link-item:hover .link-panel-back { .is-link-item-url-show.is-link-orientation-bottom .link-item:hover .link-panel-back {
height: 100%; clip-path: polygon(0 calc(100% - calc(var(--link-item-url-height) + var(--link-item-padding))), 100% calc(100% - calc(var(--link-item-url-height) + var(--link-item-padding))), 100% 100%, 0 100%);
top: 0;
clip-path: polygon(0 calc(100% - calc(var(--link-item-url-height) + 10%)), 100% calc(100% - calc(var(--link-item-url-height) + 10%)), 100% 100%, 0 100%);
} }
.is-edit.is-link-orientation-top .link-panel-back,
.is-edit.is-link-orientation-top .link-panel-back,
.is-edit.is-link-orientation-top .link-panel-back, .is-edit.is-link-orientation-top .link-panel-back,
.is-edit.is-link-orientation-top .link-item:focus .link-panel-back, .is-edit.is-link-orientation-top .link-item:focus .link-panel-back,
.is-edit.is-link-orientation-top .link-item:focus-within .link-panel-back, .is-edit.is-link-orientation-top .link-item:focus-within .link-panel-back,
.is-edit.is-link-orientation-top .link-item:hover .link-panel-back { .is-edit.is-link-orientation-top .link-item:hover .link-panel-back {
height: 100%; clip-path: polygon(0 0, 100% 0, 100% calc(var(--link-item-edit-height) + var(--link-item-padding)), 0 calc(var(--link-item-edit-height) + var(--link-item-padding)));
top: 0;
clip-path: polygon(0 0, 100% 0, 100% calc(100% - calc(var(--link-item-edit-height) - 10%)), 0 calc(100% - calc(var(--link-item-edit-height) - 10%)))
} }
.is-edit.is-link-orientation-bottom .link-panel-back,
.is-edit.is-link-orientation-bottom .link-panel-back,
.is-edit.is-link-orientation-bottom .link-panel-back, .is-edit.is-link-orientation-bottom .link-panel-back,
.is-edit.is-link-orientation-bottom .link-item:focus .link-panel-back, .is-edit.is-link-orientation-bottom .link-item:focus .link-panel-back,
.is-edit.is-link-orientation-bottom .link-item:focus-within .link-panel-back, .is-edit.is-link-orientation-bottom .link-item:focus-within .link-panel-back,
.is-edit.is-link-orientation-bottom .link-item:hover .link-panel-back { .is-edit.is-link-orientation-bottom .link-item:hover .link-panel-back {
height: 100%; clip-path: polygon(0 calc(100% - var(--link-item-edit-height) - var(--link-item-padding)), 100% calc(100% - var(--link-item-edit-height) - var(--link-item-padding)), 100% 100%, 0 100%);
top: 0;
clip-path: polygon(0 calc(100% - calc(var(--link-item-edit-height) + 10%)), 100% calc(100% - calc(var(--link-item-edit-height) + 10%)), 100% 100%, 0 100%);
} }
.link-control { .link-control {

View File

@ -116,6 +116,8 @@
--link-item-display-translate-y: 0em; --link-item-display-translate-y: 0em;
--link-item-display-name-size: 0.9em; --link-item-display-name-size: 0.9em;
--link-item-border: 0; --link-item-border: 0;
--link-item-opacity: 1;
--link-item-padding: 1em;
/* layout */ /* layout */
--layout-size: 1; --layout-size: 1;
--layout-width: 80%; --layout-width: 80%;
@ -339,6 +341,10 @@
--link-item-edit-height: 50%; --link-item-edit-height: 50%;
} }
.is-link-item-opacity {
--link-item-padding: 0em;
}
@media (min-width: 700px) { @media (min-width: 700px) {
:root { :root {
/* theme */ /* theme */

View File

@ -30,5 +30,14 @@
</div> </div>
</div> </div>
</div> </div>
<hr>
<div class="form-wrap">
<label for="control-link-item-opacity-range">Opacity</label>
<div class="form-group form-group-block">
<input id="control-link-item-opacity-range" class="control-link-item-opacity-range mr-3" type="range" value="0" tabindex="-1">
<input class="control-link-item-opacity-number form-group-item-medium form-group-radius-left" type="number" value="0" tabindex="-1">
<button class="control-link-item-opacity-default button" tabindex="-1" title="Reset to default"><span class="icon-replay"></span></button>
</div>
</div>
</div> </div>
</div> </div>

View File

@ -3848,6 +3848,54 @@ var control = (function() {
func: function() { func: function() {
link.render.item.color.custom(); link.render.item.color.custom();
} }
}, {
element: ".control-link-item-opacity-range",
path: "link.item.opacity",
type: "range",
valueConvert: ["float"],
valueModify: {
min: 0,
max: 100
},
mirrorElement: [{
element: ".control-link-item-opacity-number",
path: "link.item.opacity",
type: "number",
valueConvert: ["float"]
}],
func: function() {
link.render.item.opacity();
render.class();
}
}, {
element: ".control-link-item-opacity-number",
path: "link.item.opacity",
type: "range",
valueConvert: ["float"],
valueModify: {
min: 0,
max: 100
},
mirrorElement: [{
element: ".control-link-item-opacity-range",
path: "link.item.opacity",
type: "number",
valueConvert: ["float"]
}],
func: function() {
link.render.item.opacity();
render.class();
}
}, {
element: ".control-link-item-opacity-default",
type: "button",
func: function() {
mod.default("link.item.opacity");
link.render.item.opacity();
render.update.control.header();
render.update.control.menu();
render.class();
}
}], }],
border: [{ border: [{
element: ".control-link-item-border-range", element: ".control-link-item-border-range",
@ -6652,6 +6700,14 @@ var control = (function() {
return state.get.current().link.show; return state.get.current().link.show;
}, },
name: "is-link-item-color-by-" + state.get.current().link.item.color.by name: "is-link-item-color-by-" + state.get.current().link.item.color.by
}, {
remove: [
"is-link-item-opacity"
],
condition: function() {
return (state.get.current().link.item.opacity < 1);
},
name: "is-link-item-opacity"
}, { }, {
remove: [ remove: [
"is-link-item-display-direction-horizontal", "is-link-item-display-direction-horizontal",

View File

@ -706,11 +706,6 @@ var link = (function() {
}; };
render.item = { render.item = {
color: {
custom: function() {
helper.e("html").style.setProperty("--link-item-color-custom", state.get.current().link.item.color.rgb.r + ", " + state.get.current().link.item.color.rgb.g + ", " + state.get.current().link.item.color.rgb.b);
}
},
link: function() { link: function() {
var linkItemOptions = { var linkItemOptions = {
tag: "div", tag: "div",
@ -1296,6 +1291,11 @@ var link = (function() {
}); });
}; };
}, },
color: {
custom: function() {
helper.e("html").style.setProperty("--link-item-color-custom", state.get.current().link.item.color.rgb.r + ", " + state.get.current().link.item.color.rgb.g + ", " + state.get.current().link.item.color.rgb.b);
}
},
border: function() { border: function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--link-item-border", state.get.current().link.item.border); html.style.setProperty("--link-item-border", state.get.current().link.item.border);
@ -1317,6 +1317,10 @@ var link = (function() {
gutter: function() { gutter: function() {
var html = helper.e("html"); var html = helper.e("html");
html.style.setProperty("--link-item-display-gutter", state.get.current().link.item.display.gutter); html.style.setProperty("--link-item-display-gutter", state.get.current().link.item.display.gutter);
},
opacity: function() {
var html = helper.e("html");
html.style.setProperty("--link-item-opacity", state.get.current().link.item.opacity);
} }
}; };
@ -1991,6 +1995,7 @@ var link = (function() {
render.item.translate.x(); render.item.translate.x();
render.item.translate.y(); render.item.translate.y();
render.item.gutter(); render.item.gutter();
render.item.opacity();
render.area.width(); render.area.width();
}; };

View File

@ -217,7 +217,8 @@ var state = (function() {
}, },
newTab: false, newTab: false,
size: 1, size: 1,
border: 0 border: 0,
opacity: 1
}, },
show: true, show: true,
add: false, add: false,
@ -418,7 +419,8 @@ var state = (function() {
} }
}, },
size: 1, size: 1,
border: 0 border: 0,
opacity: 1
} }
}, },
group: { group: {

View File

@ -903,6 +903,10 @@ var update = (function() {
data.state.header.clock.separator.text = ":"; data.state.header.clock.separator.text = ":";
data.state.header.date.separator.text = "/"; data.state.header.date.separator.text = "/";
return data; return data;
},
"5.1.0": function(data) {
data.state.link.item.opacity = 1;
return data;
} }
}; };

View File

@ -1,6 +1,6 @@
var version = (function() { var version = (function() {
var current = "5.0.0"; var current = "5.1.0";
var name = "Zonked Tarsier"; var name = "Zonked Tarsier";

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