If anyone wants to set this up to auto-run all the way to the right and then all the way back to the left, here is a vibe-coded (sorry) browser console script. Makes a great "screen-saver" if you kick off the script and then put your browser in full screen mode :)
(function() {
let direction = 'right'; // Start by going right
let intervalId;
function getCurrentAnimalName() {
const animalDiv = document.querySelector('.animal-name');
return animalDiv ? animalDiv.textContent.trim() : '';
}
function pressKey(keyCode) {
const event = new KeyboardEvent('keydown', {
key: keyCode === 37 ? 'ArrowLeft' : 'ArrowRight',
keyCode: keyCode,
code: keyCode === 37 ? 'ArrowLeft' : 'ArrowRight',
which: keyCode,
bubbles: true
});
document.dispatchEvent(event);
}
function autoScroll() {
const currentName = getCurrentAnimalName();
if (direction === 'right') {
pressKey(39); // Right arrow
if (currentName === 'Pando Clone') {
console.log('Reached Pando Clone, switching to left');
direction = 'left';
}
} else {
pressKey(37); // Left arrow
if (currentName === 'DNA') {
console.log('Reached DNA, switching to right');
direction = 'right';
}
}
}
// Start the interval
intervalId = setInterval(autoScroll, 3000);
// Log start message and provide stop function
console.log('Auto-scroll started! To stop, call: stopAutoScroll()');
// Expose stop function globally
window.stopAutoScroll = function() {
clearInterval(intervalId);
console.log('Auto-scroll stopped');
};
})();
You could try posting both at the LLM and ask it to explain the stuff I changed, if you're interested in learning more Javascript. Assuming you aren't already deep in the JS trenches and only vibed bc you couldn't be bothered.
Comments (277) 139 threads
Show all comments
Showing thread 36 of 139