Make high contrast and draggable toolbar items mutually exclusive.

This commit is contained in:
hackademix 2022-02-28 15:50:56 +01:00
parent bd68d31773
commit 64d2ae84fa
4 changed files with 7 additions and 2 deletions

View File

@ -50,7 +50,7 @@ body {
display: block; display: block;
top: 0; top: 0;
padding: 0; padding: 0;
text-align: left; align-items: center;
line-height: 1em; line-height: 1em;
position: relative; position: relative;
} }

View File

@ -101,6 +101,7 @@ addEventListener("unload", e => {
} }
await include("/ui/toolbar.js"); await include("/ui/toolbar.js");
UI.toolbarInit();
{ {
let handlers = { let handlers = {
"options": e => { "options": e => {

View File

@ -18,7 +18,10 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
{ UI.toolbarInit = () => {
if (UI.toolbarInit.done || UI.highContrast || UI.local.highContrast)
return;
UI.toolbarInit.done = true;
let toolbar = document.getElementById("top"); let toolbar = document.getElementById("top");
let spacer = toolbar.querySelector(".spacer"); let spacer = toolbar.querySelector(".spacer");
let hider = toolbar.querySelector(".hider"); let hider = toolbar.querySelector(".hider");

View File

@ -222,6 +222,7 @@ var UI = (() => {
}, },
async toggle() { async toggle() {
let hc = "highContrast" in UI ? UI.highContrast : await this.detect(); let hc = "highContrast" in UI ? UI.highContrast : await this.detect();
if (UI.toolbarInit) UI.toolbarInit();
if (hc) { if (hc) {
if (this.css) { if (this.css) {
document.documentElement.appendChild(this.css); document.documentElement.appendChild(this.css);