Significantly Enhance UI/UX and Speed Up the Application by Automatically Pressing the "See More" Button

Hello everyone,

As you know, despite numerous attempts to improve the performance and speed of sites on Softr, we are always striving for faster speeds and a better experience for our users. I appreciate all the contributors and participants in the community.

Today, I want to share a JavaScript code that automatically presses the “See More” button to enhance the user experience and improve the site speed by displaying fewer items in the list block.

The code is:

html

نسخ الكود

<script>
// Function to find buttons and set up the observer
function findAndObserveButtons() {
  const buttons = document.querySelectorAll('.filters-bottom-section .MuiButtonBase-root');

  buttons.forEach((button) => {
    observer.observe(button);
  });
}

// Define the observer for the described button
const observer = new IntersectionObserver((entries) => {
  entries.forEach((entry) => {
    if (entry.isIntersecting) {
      // When the button becomes visible, click it
      entry.target.click();
      // Stop observing the button after clicking it
      observer.unobserve(entry.target);
    }
  });
});

// Repeatedly search for buttons every second
setInterval(findAndObserveButtons, 1000);

// Start observing for the first time
findAndObserveButtons();

</script>

Thank you. If you have any modifications or improvements to the code, I would be delighted to hear from you.