Zyn Warning Removals & Topbar Adjustments

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

目前为 2024-05-15 提交的版本。查看 最新版本

作者
sharmanhall
评分
0 0 0
版本
0.5
创建于
2024-05-15
更新于
2024-05-15
大小
2.0 KB
许可证
MIT
适用于

Zyn Warning Adjustments & Removals

This userscript adjusts the styles on the Zyn website to remove various warning elements that can interfere with the page layout and user experience.

Features

  • Forces the header to always stay at the top by setting top: 0 on .header elements within .has-warning containers.
  • Hides all elements with the class .site-warning, .zynheader-warning, and .zyn-header .zynheader-warning.
  • Uses CSS injection for immediate style application and a MutationObserver to handle dynamically added elements.

Installation

  1. Install a userscript manager like Tampermonkey or Greasemonkey in your browser.
  2. Create a new userscript and copy the following code into it:

    // ==UserScript==
    // @name         Zyn Warning Adjustments & Removals
    // @namespace    http://tampermonkey.net/
    // @version      0.5
    // @description  Adjusts styles on Zyn site to remove warnings that take up 20% of the view.
    // @author       sharmanhall
    // @match        https://us.zyn.com/*
    // @match        https://*.us.zyn.com/*
    // @match        https://*.zyn.com/*
    // @match        https://us.zyn.com/*
    // @grant        none
    // @icon         https://www.google.com/s2/favicons?sz=48&domain=zyn.com
    // @run-at       document-start
    // @license      MIT
    // ==/UserScript==
    
    (function() {
        'use strict';
    
        // Inject CSS to force the warning to be hidden and the header to be at the top
        const style = document.createElement('style');
        style.textContent = `
            .has-warning .header {
                top: 0 !important;
            }
            .site-warning,
            .zynheader-warning,
            .zyn-header .zynheader-warning {
                display: none !important;
                visibility: hidden !important;
            }
        `;
        document.head.appendChild(style);
    
        // MutationObserver to watch for dynamically added elements
        const observer = new MutationObserver(() => {
            document.querySelectorAll('.has-warning .header').forEach(element => {
                element.style.top = '0';
            });
    
            document.querySelectorAll('.site-warning, .zynheader-warning, .zyn-header .zynheader-warning').forEach(element => {
                element.style.display = 'none';
                element.style.setProperty('display', 'none', 'important');
                element.style.visibility = 'hidden';
                element.style.setProperty('visibility', 'hidden', 'important');
            });
        });
    
        // Observe the whole document for changes in the subtree and child elements
        observer.observe(document.body, { childList: true, subtree: true });
    })();
    
  3. Save the userscript and ensure it is enabled.

Changelog

Version 0.5

  • Added support for hiding .zyn-header .zynheader-warning elements.

Version 0.4

  • Added support for hiding .zynheader-warning elements.

Version 0.3

  • Improved performance by injecting CSS at document-start.

Version 0.2

  • Added MutationObserver to handle dynamically added elements.

Version 0.1

  • Initial release with basic functionality.