fix: animations running even when option is disabled

This commit is contained in:
sethburkart123
2024-06-19 14:33:01 +10:00
parent 2c381966d2
commit c70243f83d
+35 -28
View File
@@ -281,21 +281,23 @@ export function OpenWhatsNewPopup() {
'JdDA45GYEUc', 'PLSlFV-9e6dvyvZJFPCtBMb3LSp-LGbrbI', document.querySelector('.whatsnewImg')!, true, true, '100%', '100%' 'JdDA45GYEUc', 'PLSlFV-9e6dvyvZJFPCtBMb3LSp-LGbrbI', document.querySelector('.whatsnewImg')!, true, true, '100%', '100%'
) )
animate( if (settingsState.animations) {
[popup, bkelement as HTMLElement], animate(
{ scale: [0, 1], opacity: [0, 1] }, [popup, bkelement as HTMLElement],
{ easing: spring({ stiffness: 220, damping: 18 }) } { scale: [0, 1], opacity: [0, 1] },
) { easing: spring({ stiffness: 220, damping: 18 }) }
)
animate(
'.whatsnewTextContainer *', animate(
{ opacity: [0, 1], y: [10, 0] }, '.whatsnewTextContainer *',
{ { opacity: [0, 1], y: [10, 0] },
delay: stagger(0.05, { start: 0.1 }), {
duration: 0.5, delay: stagger(0.05, { start: 0.1 }),
easing: [.22, .03, .26, 1] duration: 0.5,
} easing: [.22, .03, .26, 1]
) }
)
}
delete settingsState.justupdated delete settingsState.justupdated
@@ -333,6 +335,8 @@ async function DeleteWhatsNew() {
const bkelement = document.getElementById('whatsnewbk') const bkelement = document.getElementById('whatsnewbk')
const popup = document.getElementsByClassName('whatsnewContainer')[0] const popup = document.getElementsByClassName('whatsnewContainer')[0]
if (!settingsState.animations) return;
animate( animate(
[popup, bkelement!], [popup, bkelement!],
{ opacity: [1, 0], scale: [1, 0] }, { opacity: [1, 0], scale: [1, 0] },
@@ -1126,7 +1130,8 @@ export function OpenMenuOptions() {
'display', 'display',
'flex', 'flex',
'important', 'important',
) )import { settingsState } from '/src/seqta/utils/listeners/SettingsState.ts.js';
} }
saveNewOrder(sortable) saveNewOrder(sortable)
}) })
@@ -1981,7 +1986,7 @@ export async function loadHomePage() {
// Creates the shortcut container into the home container // Creates the shortcut container into the home container
const Shortcut = stringToHTML(/* html */` const Shortcut = stringToHTML(/* html */`
<div class="shortcut-container border" style="opacity: 0;"> <div class="shortcut-container border">
<div class="shortcuts border" id="shortcuts"></div> <div class="shortcuts border" id="shortcuts"></div>
</div>`) </div>`)
@@ -1990,7 +1995,7 @@ export async function loadHomePage() {
// Creates the container div for the timetable portion of the home page // Creates the container div for the timetable portion of the home page
const Timetable = stringToHTML(/* html */` const Timetable = stringToHTML(/* html */`
<div class="timetable-container border" style="opacity: 0;"> <div class="timetable-container border" ${settingsState.animations ? `style="opacity: 0;"` : ''}>
<div class="home-subtitle"> <div class="home-subtitle">
<h2 id="home-lesson-subtitle">Today\'s Lessons</h2> <h2 id="home-lesson-subtitle">Today\'s Lessons</h2>
<div class="timetable-arrows"> <div class="timetable-arrows">
@@ -2098,7 +2103,7 @@ export async function loadHomePage() {
// Creates the notices container into the home container // Creates the notices container into the home container
const NoticesStr = /* html */ ` const NoticesStr = /* html */ `
<div class="notices-container border"> <div class="notices-container border" ${settingsState.animations ? `style="opacity: 0;"` : ''}>
<div style="display: flex; justify-content: space-between"> <div style="display: flex; justify-content: space-between">
<h2 class="home-subtitle">Notices</h2> <h2 class="home-subtitle">Notices</h2>
<input type="date" value=${TodayFormatted} /> <input type="date" value=${TodayFormatted} />
@@ -2110,15 +2115,17 @@ export async function loadHomePage() {
// Appends the shortcut container into the home container // Appends the shortcut container into the home container
document.getElementById('home-container')!.append(Notices.firstChild!) document.getElementById('home-container')!.append(Notices.firstChild!)
animate( if (settingsState.animations) {
'.home-container > div', animate(
{ opacity: [0, 1], y: [10, 0] }, '.home-container > div',
{ { opacity: [0, 1], y: [10, 0] },
delay: stagger(0.2, { start: 0 }), {
duration: 0.6, delay: stagger(0.2, { start: 0 }),
easing: [.22, .03, .26, 1] duration: 0.6,
} easing: [.22, .03, .26, 1]
) }
)
};
callHomeTimetable(TodayFormatted) callHomeTimetable(TodayFormatted)