Remove Demos From Steam While Browsing

Remove demo panels only if they contain the "Free Demo" indicator

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Remove Demos From Steam While Browsing
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Remove demo panels only if they contain the "Free Demo" indicator
// @match        https://store.steampowered.com/*
// @grant        none
// ==/UserScript==

(function() {
  'use strict';

  function removeFreeDemoPanels() {
    // Find all candidate demo panel containers.
    const panels = document.querySelectorAll('div._1_P15GG6AKyF_NMX2j4-Mu.Panel.Focusable');
    panels.forEach(panel => {
      // Look for a child element with the Free Demo indicator.
      const freeDemoIndicator = panel.querySelector('div._3j4dI1yA7cRfCvK8h406OB');
      if (freeDemoIndicator && freeDemoIndicator.textContent.trim() === "Free Demo") {
        panel.remove();
        console.log("Removed Free Demo panel:", panel);
      }
    });
  }

  // Run on initial page load.
  window.addEventListener('load', removeFreeDemoPanels);

  // Observe DOM mutations in case panels are added dynamically.
  const observer = new MutationObserver(mutations => {
    for (const mutation of mutations) {
      if (mutation.addedNodes.length > 0) {
        removeFreeDemoPanels();
      }
    }
  });

  observer.observe(document.body, { childList: true, subtree: true });
})();