diff --git a/loader/app/animation.ts b/loader/app/animation.ts index 24419985..6ec50e25 100644 --- a/loader/app/animation.ts +++ b/loader/app/animation.ts @@ -132,8 +132,8 @@ export function abort() { loopInterval = 0; } -export function finalize() { - if(getUrlParameter("loader-abort") === "1") { +export function finalize(abortAnimation: boolean) { + if(abortAnimation) { abort(); } else { finalizing = true; diff --git a/loader/app/loader/loader.ts b/loader/app/loader/loader.ts index 4496d2f3..bd118f51 100644 --- a/loader/app/loader/loader.ts +++ b/loader/app/loader/loader.ts @@ -2,6 +2,7 @@ import * as script_loader from "./script_loader"; import * as style_loader from "./style_loader"; import * as template_loader from "./template_loader"; import * as Animation from "../animation"; +import {getUrlParameter} from "./utils"; declare global { interface Window { @@ -27,13 +28,15 @@ export interface Config { error: boolean; baseUrl: string; + abortAnimationOnFinish: boolean; } export let config: Config = { loader_groups: false, verbose: false, error: true, - baseUrl: "./" + baseUrl: "./", + abortAnimationOnFinish: getUrlParameter("loader-abort") === "1" }; export type Task = { @@ -298,7 +301,7 @@ export async function execute(customLoadingAnimations: boolean) { if(config.verbose) console.debug("[loader] finished loader. (Total time: %dms)", Date.now() - load_begin); - Animation.finalize(); + Animation.finalize(config.abortAnimationOnFinish); } export function execute_managed(customLoadingAnimations: boolean) { diff --git a/loader/exports/loader.d.ts b/loader/exports/loader.d.ts index 851fc6d3..51ac6e9d 100644 --- a/loader/exports/loader.d.ts +++ b/loader/exports/loader.d.ts @@ -1,4 +1,5 @@ export interface Config { + abortAnimationOnFinish: boolean; loader_groups: boolean; verbose: boolean; error: boolean; diff --git a/shared/js/main.tsx b/shared/js/main.tsx index b54f5b99..bd1112d4 100644 --- a/shared/js/main.tsx +++ b/shared/js/main.tsx @@ -326,6 +326,7 @@ const task_teaweb_starter: loader.Task = { } else $(document).one('click', () => aplayer.initializeFromGesture()); } + loader.config.abortAnimationOnFinish = settings.static_global(Settings.KEY_LOADER_ANIMATION_ABORT); } catch (ex) { console.error(ex.stack); if(ex instanceof ReferenceError || ex instanceof TypeError) diff --git a/shared/js/settings.ts b/shared/js/settings.ts index 07106ed9..97c6ea91 100644 --- a/shared/js/settings.ts +++ b/shared/js/settings.ts @@ -498,6 +498,13 @@ export class Settings extends StaticSettings { valueType: "boolean", }; + static readonly KEY_LOADER_ANIMATION_ABORT: ValuedSettingsKey = { + key: 'loader_animation_abort', + defaultValue: false, + description: 'Abort the loader animation when the app has been finished loading', + valueType: "boolean", + }; + static readonly FN_LOG_ENABLED: (category: string) => SettingsKey = category => { return { key: "log." + category.toLowerCase() + ".enabled",