Falcon / Hide empty ad container

// ==UserScript==
// @name         Hide empty ad container
// @namespace    https://hi.cellmean.com
// @version      0.2
// @description  hide first ad container in homepage video list
// @icon         https://www.youtube.com/s/desktop/07288e99/img/favicon_96.png
// @author       Falcon
// @match        https://www.youtube.com/*
// @run-at      document-start
// @grant        none
// @license MIT

// ==/UserScript==
/*jshint esversion: 6 */
(function() {
    'use strict';
    let hideAd = ()=>{
        let adContainer = document.querySelector('ytd-display-ad-renderer[layout=display-ad-layout-top-landscape-image]')
        if (adContainer) {
            adContainer.parentComponent.setAttribute('style','display:none')
        }

    }
    document.addEventListener ("DOMContentLoaded", hideAd)
    
    window.addEventListener ("load", hideAd);

    setTimeout(hideAd, 1000);
    

})();