From c70243f83d6dc211a730f88900b51c30cab8dca8 Mon Sep 17 00:00:00 2001 From: sethburkart123 Date: Wed, 19 Jun 2024 14:33:01 +1000 Subject: [PATCH] fix: animations running even when option is disabled --- src/SEQTA.ts | 63 +++++++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/src/SEQTA.ts b/src/SEQTA.ts index 83a80e78..5c73b820 100644 --- a/src/SEQTA.ts +++ b/src/SEQTA.ts @@ -281,21 +281,23 @@ export function OpenWhatsNewPopup() { 'JdDA45GYEUc', 'PLSlFV-9e6dvyvZJFPCtBMb3LSp-LGbrbI', document.querySelector('.whatsnewImg')!, true, true, '100%', '100%' ) - animate( - [popup, bkelement as HTMLElement], - { scale: [0, 1], opacity: [0, 1] }, - { easing: spring({ stiffness: 220, damping: 18 }) } - ) - - animate( - '.whatsnewTextContainer *', - { opacity: [0, 1], y: [10, 0] }, - { - delay: stagger(0.05, { start: 0.1 }), - duration: 0.5, - easing: [.22, .03, .26, 1] - } - ) + if (settingsState.animations) { + animate( + [popup, bkelement as HTMLElement], + { scale: [0, 1], opacity: [0, 1] }, + { easing: spring({ stiffness: 220, damping: 18 }) } + ) + + animate( + '.whatsnewTextContainer *', + { opacity: [0, 1], y: [10, 0] }, + { + delay: stagger(0.05, { start: 0.1 }), + duration: 0.5, + easing: [.22, .03, .26, 1] + } + ) + } delete settingsState.justupdated @@ -333,6 +335,8 @@ async function DeleteWhatsNew() { const bkelement = document.getElementById('whatsnewbk') const popup = document.getElementsByClassName('whatsnewContainer')[0] + if (!settingsState.animations) return; + animate( [popup, bkelement!], { opacity: [1, 0], scale: [1, 0] }, @@ -1126,7 +1130,8 @@ export function OpenMenuOptions() { 'display', 'flex', 'important', - ) + )import { settingsState } from '/src/seqta/utils/listeners/SettingsState.ts.js'; + } saveNewOrder(sortable) }) @@ -1981,7 +1986,7 @@ export async function loadHomePage() { // Creates the shortcut container into the home container const Shortcut = stringToHTML(/* html */` -
+
`) @@ -1990,7 +1995,7 @@ export async function loadHomePage() { // Creates the container div for the timetable portion of the home page const Timetable = stringToHTML(/* html */` -
+

Today\'s Lessons

@@ -2098,7 +2103,7 @@ export async function loadHomePage() { // Creates the notices container into the home container const NoticesStr = /* html */ ` -
+

Notices

@@ -2110,15 +2115,17 @@ export async function loadHomePage() { // Appends the shortcut container into the home container document.getElementById('home-container')!.append(Notices.firstChild!) - animate( - '.home-container > div', - { opacity: [0, 1], y: [10, 0] }, - { - delay: stagger(0.2, { start: 0 }), - duration: 0.6, - easing: [.22, .03, .26, 1] - } - ) + if (settingsState.animations) { + animate( + '.home-container > div', + { opacity: [0, 1], y: [10, 0] }, + { + delay: stagger(0.2, { start: 0 }), + duration: 0.6, + easing: [.22, .03, .26, 1] + } + ) + }; callHomeTimetable(TodayFormatted)