Browse Source

Fix revealing spoilers when animation is disabled

master
Eduard Kuzmenko 3 years ago
parent
commit
cca5e6f0e2
  1. 13
      src/components/chat/bubbles.ts
  2. 6
      src/scss/partials/_spoiler.scss

13
src/components/chat/bubbles.ts

@ -1060,15 +1060,24 @@ export default class ChatBubbles {
const duration = 400 / 2; const duration = 400 / 2;
const showDuration = 5000; const showDuration = 5000;
const useRafs = !isVisible ? 1 : 0; const useRafs = !isVisible ? 2 : 0;
if(useRafs) { if(useRafs) {
messageDiv.classList.add('will-change'); messageDiv.classList.add('will-change');
} }
SetTransition(messageDiv, className, true, duration + showDuration, () => { const spoilerTimeout = messageDiv.dataset.spoilerTimeout;
if(spoilerTimeout !== null) {
clearTimeout(+spoilerTimeout);
delete messageDiv.dataset.spoilerTimeout;
}
SetTransition(messageDiv, className, true, duration, () => {
messageDiv.dataset.spoilerTimeout = '' + window.setTimeout(() => {
SetTransition(messageDiv, className, false, duration, () => { SetTransition(messageDiv, className, false, duration, () => {
messageDiv.classList.remove('will-change'); messageDiv.classList.remove('will-change');
delete messageDiv.dataset.spoilerTimeout;
}); });
}, showDuration);
}, useRafs); }, useRafs);
return; return;

6
src/scss/partials/_spoiler.scss

@ -63,4 +63,10 @@
} }
} }
} }
&:not(.is-spoiler-visible) {
.spoiler {
cursor: pointer;
}
}
} }

Loading…
Cancel
Save