MCPcopy Create free account
hub / github.com/Rello/analytics / initSplash

Function initSplash

js/splash.js:40–89  ·  view source on GitHub ↗
(splash)

Source from the content-addressed store, hash-verified

38 }
39
40 function initSplash(splash) {
41 if (window.__analyticsAppScriptLoaded !== true) {
42 return false;
43 }
44
45 splash.hidden = false;
46 splash.setAttribute('aria-hidden', 'false');
47
48 const appContent = splash.closest('#content') || document.getElementById('content');
49 if (appContent) {
50 appContent.classList.add('has-splash');
51 }
52
53 const splashName = splash.querySelector('[data-splash-name]');
54 if (splashName && !splashName.textContent.trim()) {
55 splashName.textContent = typeof t === 'function'
56 ? t('analytics', 'Analytics for Nextcloud')
57 : 'Analytics for Nextcloud';
58 }
59
60 let cleanupDelayMs = 8000;
61 const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
62 if (!prefersReducedMotion) {
63 const drawMs = parseDuration(splash.dataset.drawMs, DEFAULT_SPLASH_DURATIONS.draw);
64 const revealMs = parseDuration(splash.dataset.revealMs, DEFAULT_SPLASH_DURATIONS.reveal);
65 const holdMs = parseDuration(splash.dataset.holdMs, DEFAULT_SPLASH_DURATIONS.hold);
66 const fadeMs = parseDuration(splash.dataset.fadeMs, DEFAULT_SPLASH_DURATIONS.fade);
67 cleanupDelayMs = drawMs + revealMs + holdMs + fadeMs + 100;
68
69 splash.style.setProperty('--splash-draw-ms', `${drawMs}ms`);
70 splash.style.setProperty('--splash-reveal-ms', `${revealMs}ms`);
71 splash.style.setProperty('--splash-hold-ms', `${holdMs}ms`);
72 splash.style.setProperty('--splash-fade-ms', `${fadeMs}ms`);
73 }
74
75 splash.addEventListener('animationend', event => {
76 if (event.animationName === 'splashHide' || event.animationName === 'splashFallbackHide') {
77 removeSplash(splash, appContent);
78 }
79 });
80 window.setTimeout(() => {
81 removeSplash(splash, appContent);
82 }, cleanupDelayMs);
83
84 window.requestAnimationFrame(() => {
85 splash.classList.add('is-running');
86 });
87
88 return true;
89 }
90
91 function initAvailableSplashes() {
92 const splashes = document.querySelectorAll('[data-splash]:not([data-splash-ready])');

Callers 1

initAvailableSplashesFunction · 0.85

Calls 6

parseDurationFunction · 0.85
removeSplashFunction · 0.85
closestMethod · 0.80
tFunction · 0.50
addMethod · 0.45
addEventListenerMethod · 0.45

Tested by

no test coverage detected