RedditAuthChromeStyle.swift 886 B

123456789101112131415161718192021222324252627
  1. import Foundation
  2. enum RedditAuthChromeStyle {
  3. /// Hides Reddit auth modal close buttons in the embedded WebView.
  4. static let injectionScript = """
  5. (function() {
  6. const STYLE_ID = 'reddora-auth-chrome-style';
  7. if (document.getElementById(STYLE_ID)) return;
  8. const style = document.createElement('style');
  9. style.id = STYLE_ID;
  10. style.textContent = `
  11. auth-flow-modal button[aria-label="Close"],
  12. auth-flow-modal button[aria-label="close"],
  13. faceplate-modal button[aria-label="Close"],
  14. shreddit-signup-drawer button[aria-label="Close"],
  15. [role="dialog"] button[aria-label="Close"] {
  16. display: none !important;
  17. visibility: hidden !important;
  18. pointer-events: none !important;
  19. }
  20. `;
  21. (document.head || document.documentElement).appendChild(style);
  22. })();
  23. """
  24. }