Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
<!-- Loading Overlay - Prevents FOUC -->
<style>
/* Inline critical loading styles for instant rendering */
.app-loading-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
/* The page's own theme colours, set in <head> before this appears,
so the overlay never flashes a different colour. */
background: var(--bg-primary, #1a1b26);
z-index: 9999;
display: flex;
align-items: center;
justify-content: center;
/* Invisible at first and faded in only if the page is still loading
after 400 ms: a page that loads quickly goes straight from its
background to its content with no spinner flashing in between. */
opacity: 0;
animation: app-loading-appear 0.2s ease-out 0.4s forwards;
transition: opacity 0.3s ease-out;
}
@keyframes app-loading-appear {
to { opacity: 1; }
}
.app-loading-overlay.fade-out {
opacity: 0;
animation: none;
pointer-events: none;
}
.app-loading-content {
text-align: center;
}
.app-loading-spinner {
width: 50px;
height: 50px;
margin: 0 auto 20px;
border: 3px solid var(--border-primary, rgba(255, 255, 255, 0.1));
border-top-color: var(--text-accent, #7aa2f7);
border-radius: 50%;
animation: spin 1s linear infinite;
}
.app-loading-text {
color: var(--text-muted, #a0a0b0);
font-size: 14px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
letter-spacing: 0.5px;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
/* The class is set on <html> at once, in <head>, so the page is hidden
from the first paint. Set on <body> only, it was added by a timer once
<body> existed, and Firefox could paint the mounted page before that:
the content appeared for a frame, then disappeared until the page was
ready. */
html.app-loading body, body.app-loading { overflow: hidden; }
html.app-loading body > *:not(.app-loading-overlay),
body.app-loading > *:not(.app-loading-overlay) { opacity: 0; }
</style>
<script>
// Immediate loading overlay initialization
(function() {
if (!window.__appLoaderHidden) document.documentElement.classList.add('app-loading');
function initLoadingOverlay() {
// If the page already finished initialising and hid the loader,
// adding the overlay now would cover the page for good. This
// happens when the timer below fires after a fast page init
// (seen on /account), since that page has no timeout fallback.
if (window.__appLoaderHidden) return;
if (!document.body) {
// Body not ready yet, wait a bit
setTimeout(initLoadingOverlay, 10);
return;
}
document.body.classList.add('app-loading');
var overlay = document.createElement('div');
overlay.className = 'app-loading-overlay';
overlay.innerHTML = '<div class="app-loading-content"><div class="app-loading-spinner"></div><div class="app-loading-text">Loading Speakr...</div></div>';
document.body.appendChild(overlay);
}
initLoadingOverlay();
})();
</script>
<script src="{{ url_for('static', filename='js/loading.js') }}"></script>