Simplify UserBackground code

This commit is contained in:
djmaze 2021-07-20 16:49:03 +02:00
parent e13337e247
commit 18cedbabad
4 changed files with 14 additions and 32 deletions

View file

@ -38,7 +38,6 @@ import {
} from 'Common/Cache';
import {
userBackground,
mailBox,
root,
openPgpWorkerJs,
@ -112,16 +111,6 @@ class AppUser extends AbstractApp {
lastTime = currentTime;
}, interval);
if (SettingsGet('UserBackgroundHash')) {
setTimeout(() => {
const img = userBackground(SettingsGet('UserBackgroundHash'));
if (img) {
$htmlCL.add('UserBackground');
doc.body.style.backgroundImage = "url("+img+")";
}
}, 1000);
}
const fn = (ev=>$htmlCL.toggle('rl-ctrl-key-pressed', ev.ctrlKey)).debounce(500);
['keydown','keyup'].forEach(t => doc.addEventListener(t, fn));