Skip to content

The design language that makes your AI harness better at design.

JavaScript
1.7 KB
Raw Blame
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Consent hiding: a late banner that closes itself</title>
  <style>
    /* An empty tall page with Usercentrics' root in the DOM at load, its own
       inline display: block !important outranking the hide rule, so the first
       pass hides it inline. On the first scroll the dialog renders; further
       down the manager closes it by setting its own display: none. The late
       wall check leaves that closed root closed, and the page is scanned.
       Pinned by crates/browser/tests/consent_hiding.rs. */
    body { font: 16px/1.5 system-ui, sans-serif; margin: 0; min-height: 3000px; background: #f3f4f6; }
  </style>
</head>
<body>
  <div id="usercentrics-root" style="display: block !important"></div>
  <script>
    const root = document.getElementById('usercentrics-root');
    window.addEventListener('scroll', () => {
      if (!root.shadowRoot) {
        root.attachShadow({ mode: 'open' }).innerHTML =
          '<style>.box { position: fixed; top: 80px; left: 50%; width: 640px; margin-left: -320px; padding: 32px; background: #fff; }</style>'
          + '<div class="box" role="dialog" aria-label="Privacy settings"><h2>Privacy settings</h2>'
          + '<p>We use cookies and similar technologies to provide this website, to measure how it is used and to show you personalised content and advertising. You can accept all of these purposes, reject them, or choose which ones you allow in the settings.</p></div>';
      } else if (window.scrollY > 600) {
        root.style.setProperty('display', 'none');
      }
    }, { passive: true });
  </script>
</body>
</html>