585949b709
Migrate from matomo.morenorub.io to matomo.txeo.club in both CSP headers and tracking script. Also fix errcheck lint warnings in cv_streaming.go.
94 lines
3.0 KiB
HTML
94 lines
3.0 KiB
HTML
{{define "body-scripts"}}
|
|
<!-- CMD+K Command Bar - Lazy loaded placeholder -->
|
|
<div id="cmd-k-container"></div>
|
|
|
|
<!-- External JavaScript - CSP Compliant -->
|
|
<script src="/static/js/main.js"></script>
|
|
|
|
<!-- Ninja Keys Lazy Loader - Only loads when CMD+K is pressed -->
|
|
<script>
|
|
(function() {
|
|
let ninjaLoaded = false;
|
|
let ninjaLoading = false;
|
|
|
|
async function loadNinjaKeys() {
|
|
if (ninjaLoaded || ninjaLoading) return;
|
|
ninjaLoading = true;
|
|
|
|
// Use esm.sh with bundle option to reduce module requests
|
|
await import('https://esm.sh/ninja-keys@1.2.2?bundle');
|
|
|
|
// Create the ninja-keys element
|
|
const container = document.getElementById('cmd-k-container');
|
|
const ninjaKeys = document.createElement('ninja-keys');
|
|
ninjaKeys.id = 'cmd-k-bar';
|
|
ninjaKeys.placeholder = 'Type a command or search...';
|
|
ninjaKeys.hideBreadcrumbs = true;
|
|
container.appendChild(ninjaKeys);
|
|
|
|
// Load the initialization script
|
|
const script = document.createElement('script');
|
|
script.src = '/static/js/ninja-keys-init.js';
|
|
document.body.appendChild(script);
|
|
|
|
ninjaLoaded = true;
|
|
ninjaLoading = false;
|
|
|
|
// Open the palette after a brief delay for initialization
|
|
setTimeout(() => {
|
|
if (ninjaKeys.open) ninjaKeys.open();
|
|
}, 100);
|
|
}
|
|
|
|
function openNinjaKeys() {
|
|
const nk = document.getElementById('cmd-k-bar');
|
|
if (nk && typeof nk.open === 'function') {
|
|
nk.open();
|
|
}
|
|
}
|
|
|
|
// Listen for CMD+K / Ctrl+K
|
|
document.addEventListener('keydown', function(e) {
|
|
if ((e.metaKey || e.ctrlKey) && e.key === 'k') {
|
|
e.preventDefault();
|
|
if (ninjaLoaded) {
|
|
openNinjaKeys();
|
|
} else {
|
|
loadNinjaKeys();
|
|
}
|
|
}
|
|
});
|
|
|
|
// Also handle click on cmd-k button
|
|
document.addEventListener('click', function(e) {
|
|
if (e.target.closest('#cmd-k-button, .cmd-k-trigger')) {
|
|
e.preventDefault();
|
|
if (ninjaLoaded) {
|
|
openNinjaKeys();
|
|
} else {
|
|
loadNinjaKeys();
|
|
}
|
|
}
|
|
});
|
|
})();
|
|
</script>
|
|
|
|
<!-- Matomo Analytics - First-party subdomain to bypass ad blockers -->
|
|
<script>
|
|
var _paq = window._paq = window._paq || [];
|
|
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
|
_paq.push(['trackPageView']);
|
|
_paq.push(['enableLinkTracking']);
|
|
(function() {
|
|
var u="https://matomo.txeo.club/";
|
|
_paq.push(['setTrackerUrl', u+'matomo.php']);
|
|
_paq.push(['setSiteId', '4']);
|
|
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
|
g.async=true;
|
|
g.src=u+'matomo.js';
|
|
s.parentNode.insertBefore(g,s);
|
|
})();
|
|
</script>
|
|
<!-- End Matomo Code -->
|
|
{{end}}
|