Remove lenta.ru banner

Remove big top banner on header

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Remove lenta.ru banner
// @namespace    https://lenta.ru/
// @version      0.2
// @description  Remove big top banner on header
// @author       You
// @match        *://*.lenta.ru/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=lenta.ru
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
  'use strict';
    // Define the array of classes to check
    const CLASSES = ['layout__header-ghost', 'js-layout-header', 'js-site-container', 'layout__footer-ghost', 'layout__footer'];

    // Get all the child elements of the layout__container class
    let elements = document.querySelectorAll('.layout__container > *');

    // Loop through the elements
    for (let i = 0; i < elements.length; i++) {
        // Get the element's class list
        let classList = elements[i].classList;

        // Check if the element has any of the classes in the array
        let hasClass = false;
        for (let j = 0; j < CLASSES.length; j++) {
            if (classList.contains(CLASSES[j])) {
                hasClass = true;
                break;
            }
        }

        // If the element does not have any of the classes, remove it from the DOM
        if (!hasClass) {
            elements[i].parentNode.removeChild(elements[i]);
        }
    }

})();