RedditHomeChromeStyle.swift 855 B

123456789101112131415161718192021222324252627
  1. import Foundation
  2. enum RedditHomeChromeStyle {
  3. /// Hides Reddit's header Log In button and user-menu trigger in the embedded WebView.
  4. static let injectionScript = """
  5. (function() {
  6. const STYLE_ID = 'reddora-home-chrome-style';
  7. if (document.getElementById(STYLE_ID)) return;
  8. const style = document.createElement('style');
  9. style.id = STYLE_ID;
  10. style.textContent = `
  11. #login-button,
  12. faceplate-tracker:has(#login-button),
  13. #expand-user-drawer-button,
  14. activate-feature:has(#expand-user-drawer-button),
  15. rpl-tooltip:has(#expand-user-drawer-button) {
  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. }