<commit_before>'use strict';

function init() {

    var DEBUG = window.adbYtDebug || false;
    DEBUG =true;

    var adbYtLog = function (msg) {
        if (console && DEBUG) {
            console.warn(msg);
        }
    };
    adbYtLog('inited');

    var videoAdContainer = document.getElementsByClassName('video-ads html5-stop-propagation')[0];

    function listener(e) {
        adbYtLog('listener triggered');

        if (e.target.innerHTML.length > 0 && document.getElementsByClassName('videoAdUi').length > 0) {
            adbYtLog('skiping video ad');
            document.getElementsByClassName('video-stream html5-main-video')[0].src = '';
        }

        var flashAdContainer = document.getElementsByClassName('ad-container ad-container-single-media-element-annotations')[0];
        if (flashAdContainer && flashAdContainer.style.display !== 'none') {
            adbYtLog('undisplay overlay ad');
            flashAdContainer.style.display = 'none';
        }
    }

    if (videoAdContainer) {
        videoAdContainer.addEventListener('DOMSubtreeModified', listener);
    } else {
        // wait for the url
    }
}

init();
<commit_msg>fixing init so it doesn't fail via navigation<commit_after>'use strict';

var DEBUG = window.adbYtDebug || false;

var adbYtLog = function(msg) {
    if (console && DEBUG) {
        console.warn(msg);
    }
};

var player = document.querySelector('#player');

function skipAds(e) {
    adbYtLog('listener triggered');

    if (e.target.innerHTML.length > 0 && document.getElementsByClassName('videoAdUi').length > 0) {
        adbYtLog('skiping video ad');
        document.getElementsByClassName('video-stream html5-main-video')[0].src = '';
    }

    var flashAdContainer = document.getElementsByClassName('ad-container ad-container-single-media-element-annotations')[0];
    if (flashAdContainer && flashAdContainer.style.display !== 'none') {
        adbYtLog('undisplay overlay ad');
        flashAdContainer.style.display = 'none';
    }
}

function init() {

    var videoAdContainer = document.getElementsByClassName('video-ads html5-stop-propagation')[0];

    if (videoAdContainer) {

        adbYtLog('inited');
        player.removeEventListener('DOMSubtreeModified', init);
        videoAdContainer.addEventListener('DOMSubtreeModified', skipAds);
    }
}

player.addEventListener('DOMSubtreeModified', init);

{'fraction_non_alphanumeric': 0.13411567476948869, 'fraction_numerical': 0.00586756077116513, 'mean_word_length': 3.270125223613596, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '637386', 'n_tokens_mistral': 721, 'n_tokens_neox': 698, 'n_words': 125}