RedditHomeChromeStyle.swift 825 B

12345678910111213141516171819202122232425262728293031
  1. import Foundation
  2. enum RedditHomeChromeStyle {
  3. /// Keeps Reddit header separators flush with the in-app sidebar divider.
  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. header,
  12. header > * {
  13. margin-left: 0 !important;
  14. }
  15. header faceplate-border,
  16. header [role="separator"],
  17. header hr {
  18. width: 100% !important;
  19. max-width: none !important;
  20. margin-left: 0 !important;
  21. margin-right: 0 !important;
  22. }
  23. `;
  24. (document.head || document.documentElement).appendChild(style);
  25. })();
  26. """
  27. }