From 3f5086087e8ac94c044e8a7bf1d6df87eb6b27bb Mon Sep 17 00:00:00 2001 From: sethburkart123 Date: Wed, 19 Jun 2024 09:50:58 +1000 Subject: [PATCH] fix: remove popup animation when animations are disabled --- src/SEQTA.ts | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/src/SEQTA.ts b/src/SEQTA.ts index f89a4124..ea03f716 100644 --- a/src/SEQTA.ts +++ b/src/SEQTA.ts @@ -862,11 +862,16 @@ export function closeSettings() { if (SettingsClicked == true) { ExtensionSettings!.classList.add('hide') - animate( - '#ExtensionPopup', - { opacity: [1, 0], scale: [1, 0] }, - { easing: spring({ stiffness: 220, damping: 18 }) } - ) + if (settingsState.animations) { + animate( + '#ExtensionPopup', + { opacity: [1, 0], scale: [1, 0] }, + { easing: spring({ stiffness: 220, damping: 18 }) } + ) + } else { + ExtensionSettings.style.opacity = '0' + ExtensionSettings.style.transform = 'scale(0)' + } SettingsClicked = false if (ExtensionIframe.contentWindow) { @@ -903,11 +908,16 @@ export function addExtensionSettings() { const ExtensionIframe = document.getElementById('ExtensionIframe') as HTMLIFrameElement extensionPopup.classList.add('hide') - animate( - '#ExtensionPopup', - { opacity: [1, 0], scale: [1, 0] }, - { easing: [.22, .03, .26, 1] } - ) + if (settingsState.animations) { + animate( + '#ExtensionPopup', + { opacity: [1, 0], scale: [1, 0] }, + { easing: spring({ stiffness: 220, damping: 18 }) } + ) + } else { + extensionPopup.style.opacity = '0' + extensionPopup.style.transform = 'scale(0)' + } if (ExtensionIframe.contentWindow) { ExtensionIframe.contentWindow.postMessage('popupClosed', '*') } @@ -1153,12 +1163,22 @@ export function setupSettingsButton() { AddedSettings!.addEventListener('click', function () { if (SettingsClicked) { extensionPopup!.classList.add('hide'); - animate('#ExtensionPopup', { opacity: [1, 0], scale: [1, 0] }, { easing: spring({ stiffness: 220, damping: 18 }) }); + if (settingsState.animations) { + animate('#ExtensionPopup', { opacity: [1, 0], scale: [1, 0] }, { easing: spring({ stiffness: 220, damping: 18 }) }); + } else { + extensionPopup!.style.opacity = '0' + extensionPopup!.style.transform = 'scale(0)' + } (document.getElementById('ExtensionIframe')! as HTMLIFrameElement).contentWindow!.postMessage('popupClosed', '*'); SettingsClicked = false; } else { extensionPopup!.classList.remove('hide'); - animate('#ExtensionPopup', { opacity: [0, 1], scale: [0, 1] }, { easing: spring({ stiffness: 260, damping: 24 }) }); + if (settingsState.animations) { + animate('#ExtensionPopup', { opacity: [0, 1], scale: [0, 1] }, { easing: spring({ stiffness: 260, damping: 24 }) }); + } else { + extensionPopup!.style.opacity = '1' + extensionPopup!.style.transform = 'scale(1)' + } SettingsClicked = true; } });