diff --git a/inject-auto-scroll.js b/inject-auto-scroll.js new file mode 100644 index 0000000..d951399 --- /dev/null +++ b/inject-auto-scroll.js @@ -0,0 +1,36 @@ +// Auto-scroll script for Home Assistant Dashboard +// Inject this into the browser console (F12) on the dashboard page + +(function() { + let currentIndex = 0; + const scrollInterval = 5000; // 5 seconds + const cards = document.querySelectorAll('ha-card'); + + // Make each card full viewport height + cards.forEach(card => { + card.style.minHeight = window.innerHeight + 'px'; + }); + + function scrollToNext() { + if (cards.length === 0) return; + + currentIndex = (currentIndex + 1) % cards.length; + const targetCard = cards[currentIndex]; + + targetCard.scrollIntoView({ + behavior: 'smooth', + block: 'start' + }); + + console.log(`Scrolled to card ${currentIndex + 1} of ${cards.length}`); + } + + // Start auto-scrolling + console.log('Auto-scroll started: changing card every 5 seconds'); + setInterval(scrollToNext, scrollInterval); + + // Scroll to first card immediately + if (cards.length > 0) { + cards[0].scrollIntoView({ behavior: 'smooth', block: 'start' }); + } +})();