cleanup some css and js

This commit is contained in:
djmaze 2021-08-10 17:07:26 +02:00
parent 8a730a3ff2
commit 308e65f94f
4 changed files with 172 additions and 195 deletions

View file

@ -1,37 +1,36 @@
(doc => { (doc => {
let visible = "visible", let idle = 'idle',
visible = 'visible',
status = visible, status = visible,
timer = 0, timer = 0,
wakeUp = () => { wakeUp = () => {
clearTimeout(timer); clearTimeout(timer);
if (status !== visible) {
status = visible; status = visible;
}
timer = setTimeout(() => { timer = setTimeout(() => {
if (status === visible) { if (status === visible) {
status = "idle"; status = idle;
dispatchEvent(new CustomEvent("idle")); dispatchEvent(new CustomEvent(idle));
} }
}, 10000); }, 10000);
}, },
init = () => { init = () => {
init = ()=>{}; init = () => 0;
// Safari // Safari
addEventListener('pagehide', () => status = "hidden"); addEventListener('pagehide', () => status = 'hidden');
// Else // Else
doc.addEventListener("visibilitychange", () => { doc.addEventListener('visibilitychange', () => {
status = doc.visibilityState; status = doc.visibilityState;
doc.hidden || wakeUp(); doc.hidden || wakeUp();
}); });
wakeUp(); wakeUp();
["mousemove","keyup","touchstart"].forEach(t => doc.addEventListener(t, wakeUp)); ['mousemove','keyup','touchstart'].forEach(t => doc.addEventListener(t, wakeUp));
["scroll","pageshow"].forEach(t => addEventListener(t, wakeUp)); ['scroll','pageshow'].forEach(t => addEventListener(t, wakeUp));
}; };
this.ifvisible = { this.ifvisible = {
idle: callback => { idle: callback => {
init(); init();
addEventListener("idle", callback); addEventListener(idle, callback);
}, },
now: () => { now: () => {
init(); init();

View file

@ -150,12 +150,6 @@ html.rl-no-preview-pane {
line-height: 30px; line-height: 30px;
} }
.listLoading .icon-spinner {
width: 0.75em;
height: 0.75em;
margin: 0;
}
.listDragOver { .listDragOver {
max-height: 0; max-height: 0;
overflow: hidden; overflow: hidden;

View file

@ -38,8 +38,8 @@
.icon-spinner { .icon-spinner {
height: 10px; height: 0.75em;
width: 10px; width: 0.75em;
margin: 0 -1px; margin: 0 -1px;
@ -48,21 +48,6 @@
border-radius: 100%; border-radius: 100%;
} }
.btn-success .icon-spinner {
border-color: #fff;
border-top-color: #999;
&.animated {
border-color: transparent;
border-top-color: #fff;
}
}
.btn-large .icon-spinner {
height: 13px;
width: 13px;
margin: -1px -2px;
}
.icon-spinner:not(.not-animated), .icon-spinner:not(.not-animated),
.list-loading .icon-spinner.not-animated { .list-loading .icon-spinner.not-animated {
border-color: transparent; border-color: transparent;
@ -70,6 +55,11 @@
animation: rotation .8s infinite ease-in-out; animation: rotation .8s infinite ease-in-out;
} }
.btn.btn-success .icon-spinner {
border-color: transparent;
border-top-color: #fff;
}
.fontastic.icon-spinner { .fontastic.icon-spinner {
text-indent: -5em; text-indent: -5em;
overflow: hidden; overflow: hidden;

View file

@ -6,7 +6,11 @@
*/ */
(doc => { (doc => {
let ua = navigator.userAgent.toLowerCase(), let ua = navigator.userAgent.toLowerCase();
// Chrome on mobile supports drag & drop
if (ua.includes('mobile') && ua.includes('gecko/')) {
let opt = { passive: false, capture: false },
dropEffect = 'move', dropEffect = 'move',
effectAllowed = 'all', effectAllowed = 'all',
@ -133,18 +137,12 @@
cDst.getContext('2d').drawImage(cSrc, 0, 0); cDst.getContext('2d').drawImage(cSrc, 0, 0);
} }
// copy style (without transitions) // copy style (without transitions)
let cs = getComputedStyle(src), i; let cs = getComputedStyle(src);
for (i = 0; i < cs.length; i++) { Object.entries(cs).forEach(([key, value]) => key.includes('transition') || (dst.style[key] = value));
let key = cs[i];
if (key.indexOf('transition') < 0) {
dst.style[key] = cs[key];
}
}
dst.style.pointerEvents = 'none'; dst.style.pointerEvents = 'none';
// and repeat for all children // and repeat for all children
for (i = 0; i < src.children.length; i++) { let i = src.children.length;
copyStyle(src.children[i], dst.children[i]); while (i--) copyStyle(src.children[i], dst.children[i]);
}
}, },
// return false when cancelled // return false when cancelled
@ -165,10 +163,6 @@
return false; return false;
}; };
// Chrome on mobile supports drag & drop
if (ua.includes('mobile') && ua.includes('gecko/')) {
let opt = { passive: false, capture: false };
doc.addEventListener('touchstart', e => { doc.addEventListener('touchstart', e => {
// clear all variables // clear all variables
reset(); reset();