Add dashboard-wrapper.html

This commit is contained in:
2025-12-31 04:26:40 -08:00
parent 3e7a78b304
commit fd37c21b89

66
dashboard-wrapper.html Normal file
View File

@@ -0,0 +1,66 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Kiosk Dashboard</title>
<style>
body, html {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
iframe {
width: 100%;
height: 100%;
border: none;
}
</style>
</head>
<body>
<iframe id="dashboard" src="http://homeassistant.local:8123/dashboard-kiosk/0"></iframe>
<script>
// Wait for iframe to load, then inject scroll script
document.getElementById('dashboard').addEventListener('load', function() {
const iframe = this;
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
// Wait a bit for content to load
setTimeout(() => {
try {
const script = iframeDoc.createElement('script');
script.textContent = `
(function() {
const cards = Array.from(document.querySelectorAll('ha-card'));
// Make cards full height and larger
cards.forEach(card => {
card.style.minHeight = window.innerHeight + 'px';
card.style.fontSize = '2.5em';
const content = card.querySelector('.card-content');
if (content) content.style.fontSize = '2em';
});
// Auto-scroll
let i = 0;
setInterval(() => {
if (cards.length === 0) return;
i = (i + 1) % cards.length;
cards[i].scrollIntoView({ behavior: 'smooth', block: 'start' });
}, 5000);
window.scrollTo({ top: 0, behavior: 'smooth' });
console.log('Auto-scroll enabled: ' + cards.length + ' cards');
})();
`;
iframeDoc.head.appendChild(script);
} catch (e) {
console.error('Could not inject script (CORS):', e);
}
}, 3000);
});
</script>
</body>
</html>