More visual/theming tweaks.

This commit is contained in:
hackademix 2022-03-12 22:28:01 +01:00
parent 59af507e1b
commit ca2d95daaa
12 changed files with 129 additions and 111 deletions

37
src/common/themes.css Normal file
View File

@ -0,0 +1,37 @@
/*
* Copyright (C) 2005-2022 Giorgio Maone <https://maone.net>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
.__NoScript_Theme__, .__NoScript_Theme__[data-theme="dark"] {
--accent-color: #d12027;
--fg-color1: #ccc;
--fg-color2: #fff;
--text-color: #ddd;
--bg-color1: #000;
--bg-color2: #212026;
--form-color1: #333;
--form-color2: #111;
--focus-color: #8007;
--tab-color1: #6668;
--tab-color2: #3348;
--form-check-color: var(--bg-color2);
--form-control-color: var(--accent-color);
--hilite-color: #f008;
}
@media (prefers-color-scheme: light) {
.__NoScript_Theme__ {
--fg-color1: #555;
--fg-color2: #000;
--text-color: #333;
--bg-color1: #ddd;
--bg-color2: #fff;
--form-color1: #ccc;
--form-color2: #eee;
--tab-color1: #ddda;
--tab-color2: #8888;
--focus-color: #f787;
}
}

View File

@ -1,42 +1,9 @@
/*
* Copyright (C) 2005-2021 Giorgio Maone <https://maone.net>
* Copyright (C) 2005-2022 Giorgio Maone <https://maone.net>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
a.__NoScript_PlaceHolder__ {
--accent-color: #d12027;
--fg-color1: #ccc;
--fg-color2: #fff;
--text-color: #ddd;
--bg-color1: #000;
--bg-color2: #212026;
--form-color1: #333;
--form-color2: #111;
--focus-color: #4007;
--tab-color1: #6668;
--tab-color2: #3348;
--form-check-color: var(--bg-color2);
--form-control-color: var(--accent-color);
--hilite-color: #8008;
}
@media (prefers-color-scheme: light) {
a.__NoScript_PlaceHolder__ {
--fg-color1: #555;
--fg-color2: #000;
--text-color: #333;
--bg-color1: #ddd;
--bg-color2: #fff;
--form-color1: #ccc;
--form-color2: #eee;
--tab-color1: #ddda;
--tab-color2: #8888;
--focus-color: #faa7;
}
}
a.__NoScript_PlaceHolder__ {
outline: 2px solid --var(--accent-color);
color: var(--text-color) !important;

View File

@ -77,6 +77,7 @@
"match_about_blank": true,
"all_frames": true,
"css": [
"/common/themes.css",
"/content/content.css"
]
},

@ -1 +1 @@
Subproject commit 1a868c35124b18f042c5f3dc6023b36323a47499
Subproject commit 74ffe5f583fe952d1114ae08665bfcaa132eb280

View File

@ -3,38 +3,7 @@
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
:root, :root[data-theme="dark"] {
--accent-color: #d12027;
--fg-color1: #ccc;
--fg-color2: #fff;
--text-color: #ddd;
--bg-color1: #000;
--bg-color2: #212026;
--form-color1: #333;
--form-color2: #111;
--focus-color: #4007;
--tab-color1: #6668;
--tab-color2: #3348;
--form-check-color: var(--bg-color2);
--form-control-color: var(--accent-color);
--hilite-color: #8008;
}
@media (prefers-color-scheme: light) {
:root {
--fg-color1: #555;
--fg-color2: #000;
--text-color: #333;
--bg-color1: #ddd;
--bg-color2: #fff;
--form-color1: #ccc;
--form-color2: #eee;
--tab-color1: #ddda;
--tab-color2: #8888;
--focus-color: #faa7;
}
}
@import url(../common/themes.css);
body {
background-color: var(--bg-color2);
@ -76,10 +45,11 @@ button {
cursor: pointer;
}
input[type="text"], textarea {
input[type="text"], textarea, select {
color: var(--text-color);
background-color: var(--bg-color2);
border: 1px solid var(--fg-color1);
border-radius: .4em;
padding: 0.5em;
margin: 0.5em;
}
@ -92,8 +62,9 @@ input[type="checkbox"]:not(.https-only, .temp) {
color: currentColor;
width: 1.2em;
height: 1.2em;
min-width: 1.2em;
border: 0.15em solid currentColor;
border-radius: 0.2em;
border-radius: 0.3em;
transform: translateY(-0.075em);
display: grid;
place-content: center;
@ -102,8 +73,8 @@ input[type="checkbox"]:not(.https-only, .temp) {
input[type="checkbox"]:not(.https-only, .temp)::before {
content: "";
width: 0.65em;
height: 0.65em;
width: 0.7em;
height: 0.7em;
clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
transform: scale(0);
transform-origin: bottom left;
@ -119,6 +90,40 @@ input[type="checkbox"]:not(.https-only, .temp):checked {
border-color: var(--form-control-color);
}
input[type="radio"]:not(.preset) {
-webkit-appearance: none;
appearance: none;
background-color: var(--form-color1);
margin: .4em;
font: inherit;
color: currentColor;
width: 1.2em;
height: 1.2em;
min-width: 1.2em;
border: 0.15em solid currentColor;
border-radius: 50%;
transform: translateY(-0.075em);
display: grid;
place-content: center;
}
input[type="radio"]:not(.preset)::before {
content: "";
width: 0.7em;
height: 0.7em;
border-radius: 50%;
transform: scale(0);
transition: 120ms transform ease-in-out;
box-shadow: inset 1em 1em var(--form-control-color);
background-color: CanvasText;
}
input[type="radio"]:not(.preset):checked::before {
transform: scale(1);
}
input:disabled, button:disabled, select:disabled {
filter: grayscale(100%);
opacity: .7;
@ -127,3 +132,12 @@ input:disabled, button:disabled, select:disabled {
:disabled {
cursor: not-allowed !important;
}
:focus-visible, .cap:focus-within {
outline: 0;
filter:
drop-shadow(2px 2px 2px var(--focus-color))
drop-shadow(-2px 2px 2px var(--focus-color))
drop-shadow(2px -2px 2px var(--focus-color))
drop-shadow(-2px -2px 2px var(--focus-color));
}

View File

@ -60,10 +60,6 @@ body {
font-size: 1em;
}
#sect-general label, #sect-general button, #sect-general span {
white-space: nowrap;
}
section form, section fieldset {
margin: .5em 0;
}
@ -98,7 +94,10 @@ fieldset:disabled {
display: none;
}
#debug-tools {
padding-left: 2.5em;
font-weight: bold;
}
.error {
background: #ff8;
@ -118,7 +117,8 @@ input, button {
}
button.add {
font-weight: bold;
font-size: 1.4em;
padding: .2em .4em;
}
#import-container {
@ -177,7 +177,7 @@ button.add {
padding: .4em .8em;
}
@media (max-width: 100mm) {
@media (max-width: 550px) {
.flextabs__toggle {
border-radius: 1em;
}

View File

@ -48,15 +48,19 @@ SPDX-License-Identifier: GPL-3.0-or-later
<div class="flextabs__content flextabs__content--active--last">
<section id="sect-general">
<div class="opt-group">
<span id="global-opt">
<input type="checkbox" id="opt-global"><label for="opt-global" id="lbl-global">__MSG_NoEnforcement__</label>
</span>
<span id="auto-opt">
<input type="checkbox" class="enforcement_required" id="opt-auto"><label for="opt-auto" id="lbl-auto">__MSG_AutoAllowTopLevel__</label>
</span>
<span id="cascadeRestrictions-opt">
<input type="checkbox" class="enforcement_required" id="opt-cascadeRestrictions"><label for="opt-cascadeRestrictions" id="lbl-cascadeRestrictions">__MSG_CascadeRestrictions__</label>
</span>
<span id="global-opt">
<input type="checkbox" id="opt-global"><label for="opt-global" id="lbl-global">__MSG_NoEnforcement__</label>
</span>
</div>
<div class="opt-group">
<span id="auto-opt">
<input type="checkbox" class="enforcement_required" id="opt-auto"><label for="opt-auto" id="lbl-auto">__MSG_AutoAllowTopLevel__</label>
</span>
</div>
<div class="opt-group">
<span id="cascadeRestrictions-opt">
<input type="checkbox" class="enforcement_required" id="opt-cascadeRestrictions"><label for="opt-cascadeRestrictions" id="lbl-cascadeRestrictions">__MSG_CascadeRestrictions__</label>
</span>
</div>
<fieldset class="enforcement_required">
@ -83,13 +87,13 @@ SPDX-License-Identifier: GPL-3.0-or-later
<h3 class="flextabs__tab appearance_tab"><button class="flextabs__toggle">__MSG_SectionAppearance__</button></h3>
<div class="flextabs__content appearance_tab">
<div class="opt-group desktop">
<div class="opt-group">
<span id="showCtxMenuItem-opt">
<input type="checkbox" id="opt-showCtxMenuItem">
<label for="opt-showCtxMenuItem" id="lbl-showCtxMenuItem">__MSG_ShowCtxMenuItem__</label>
</span>
</div>
<div class="opt-group desktop">
<div class="opt-group">
<span id="showCountBadge-opt">
<input type="checkbox" id="opt-showCountBadge">
<label for="opt-showCountBadge" id="lbl-showCountBadge">__MSG_ShowCountBadge__</label>

View File

@ -7,9 +7,8 @@
@import url("./common.css");
html {
background: linear-gradient(to bottom, var(--form-color1) 0, var(--bg-color2) 41%, var(--bg-color1) 90%, var(--focus-color) 100%) no-repeat;
background: linear-gradient(to bottom, var(--form-color1) 0, var(--bg-color2) 41%, var(--bg-color1) 94%, var(--hilite-color) 100%) no-repeat;
background-color: var(--bg-color1);
}
@ -98,11 +97,10 @@ html.mobile > body {
.choices div {
display: flex;
flex-direction: row;
align-items: baseline;
align-items: center;
}
.choices label {
display: block;
padding-bottom: .5em;
word-break: break-all;
}

View File

@ -5,7 +5,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
-->
<!DOCTYPE html>
<html>
<html class="__NoScript_Theme__">
<head>
<meta charset="utf-8">
<title></title>

View File

@ -108,5 +108,6 @@ tr.site {
}
:focus {
outline: 1px dotted yellow;
outline: max(2px, 0.15em) solid currentColor;
outline-offset: max(2px, 0.15em);
}

View File

@ -25,7 +25,7 @@
align-items: center;
}
@media (max-width: 100mm) {
@media (max-width: 550px) {
body {
background-size: 4em !important;
padding-right: 0 !important;
@ -135,7 +135,6 @@
.capsContext select {
display: none;
margin: 0 1em;
}
.contextual .capsContext select {
@ -183,8 +182,9 @@ input[type="checkbox"] {
vertical-align: middle;
}
html:not(.mobile) .sites > tr.site:focus-within {
box-shadow: 0 0 2px 2px var(--focus-color);
html:not(.mobile) .sites > tr.site:is(:focus-within, :hover) {
/* box-shadow: 0 0 1px 1px var(--focus-color);*/
background: linear-gradient(to bottom, var(--form-color1) 0, var(--bg-color2) 41%, var(--bg-color1) 100%) no-repeat;
border-color: transparent;
}
@ -357,15 +357,6 @@ span.preset {
overflow: visible;
}
:focus-visible, .cap:focus-within {
outline: 0;
filter:
drop-shadow(2px 2px 2px var(--focus-color))
drop-shadow(-2px 2px 2px var(--focus-color))
drop-shadow(2px -2px 2px var(--focus-color))
drop-shadow(-2px -2px 2px var(--focus-color));
}
input.preset[value="T_TRUSTED"] {
background-image: url(/img/ui-temp64.png);
}
@ -430,7 +421,7 @@ input.preset:checked ~ input.temp {
.customizer fieldset {
background-color: var(--form-color2);
margin: 0 0.06em 0.06em 0.06em;
margin: 0;
box-shadow: var(--form-color1) 0 2px 2px;
position: relative;
}
@ -470,7 +461,9 @@ input.preset:checked ~ input.temp {
}
span.cap {
padding: 0.5em;
padding: 0.3em;
margin: 0.2em;
border-radius: .4em;
font-weight: normal;
display: inline-flex;
align-items: center;
@ -478,6 +471,7 @@ span.cap {
span.cap.needed {
font-weight: bold;
color: var(--fg-color2);
background-color: var(--hilite-color);
}

View File

@ -47,8 +47,10 @@ var UI = (() => {
"/nscl/common/Policy.js",
];
this.mobile = UA.mobile;
let root = document.documentElement;
root.classList.add("__NoScript_Theme__");
if (this.mobile) {
document.documentElement.classList.toggle("mobile", true);
root.classList.add("mobile");
}
await include(scripts);