(function() { // Find the iframe const iframe = document.querySelector('iframe[src^="https://docs.google.com/spreadsheets"]'); if (!iframe) { console.error('Google Spreadsheet iframe not found'); return; } // Create a container for the iframe const container = document.createElement('div'); container.className = 'spreadsheet-container'; iframe.parentNode.insertBefore(container, iframe); container.appendChild(iframe); // Apply styles const style = document.createElement('style'); style.textContent = ` .spreadsheet-container { width: 100%; height: 560px; overflow: hidden; } .spreadsheet-container iframe { width: 100%; height: 100%; border: none; } body { overflow: hidden; } `; document.head.appendChild(style); // Add event listeners container.addEventListener('wheel', function(e) { e.preventDefault(); iframe.contentWindow.scrollBy(e.deltaX, e.deltaY); }, { passive: false }); container.addEventListener('mouseenter', function() { document.body.style.overflow = 'hidden'; }); container.addEventListener('mouseleave', function() { document.body.style.overflow = 'auto'; }); console.log('Spreadsheet scrolling behavior modified successfully'); })();