Zyn Warning Removals & Topbar Adjustments

Adjusts styles on Zyn site to remove warnings that take up 20% of the view.

  1. // ==UserScript==
  2. // @name Zyn Warning Removals & Topbar Adjustments
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.6
  5. // @description Adjusts styles on Zyn site to remove warnings that take up 20% of the view.
  6. // @author sharmanhall
  7. // @match https://us.zyn.com/*
  8. // @match https://*.us.zyn.com/*
  9. // @match https://*.zyn.com/*
  10. // @match https://us.zyn.com/*
  11. // @grant none
  12. // @icon https://www.google.com/s2/favicons?sz=48&domain=zyn.com
  13. // @run-at document-start
  14. // @license MIT
  15. // ==/UserScript==
  16.  
  17. (function() {
  18. 'use strict';
  19.  
  20. // Inject CSS to force the warning to be hidden and the header to be at the top
  21. const style = document.createElement('style');
  22. style.textContent = `
  23. .has-warning .header {
  24. top: 0 !important;
  25. }
  26. .site-warning,
  27. .zynheader-warning,
  28. .zyn-header .zynheader-warning {
  29. display: none !important;
  30. visibility: hidden !important;
  31. z-index:-99999999 !important;
  32. }
  33.  
  34. .site-warning {
  35. font-size: 0px !important;
  36. line-height: 0px !important;
  37. }
  38. }
  39. `;
  40. document.head.appendChild(style);
  41.  
  42. // MutationObserver to watch for dynamically added elements
  43. const observer = new MutationObserver(() => {
  44. document.querySelectorAll('.has-warning .header').forEach(element => {
  45. element.style.top = '0';
  46. });
  47.  
  48. document.querySelectorAll('.site-warning, .zynheader-warning, .zyn-header .zynheader-warning').forEach(element => {
  49. element.style.display = 'none';
  50. element.style.setProperty('display', 'none', 'important');
  51. element.style.visibility = 'hidden';
  52. element.style.setProperty('visibility', 'hidden', 'important');
  53. });
  54. });
  55.  
  56. // Observe the whole document for changes in the subtree and child elements
  57. observer.observe(document.body, { childList: true, subtree: true });
  58. })();