Skor_X User

Better code embed.

// ==UserScript==
// @name         Youtube auto close popup
// @version      1
// @description  Will auto close the Youtube popup prompting you to continue playing
// @author       Telokis, Skor_X
// @include      /^https?://(?:www\.)?youtube\.com/.*/
// @downloadURL  https://pastebin.com/raw/w2ecSspS
// @grant        none
// @license      MIT
// @copyright    2018, Telokis (https://openuserjs.org//users/Telokis)
// ==/UserScript==

(function () {
    "use strict";

    var __ytPlaybackContinueInterval, __ytPlaybackContinueCount = 0;

    __ytPlaybackContinueInterval = setInterval(function () {
        var popup = document.querySelector("ytd-popup-container.ytd-app paper-dialog.ytd-popup-container[role=dialog]");
        if (popup && window.getComputedStyle(popup).display !== "none") {
            var confirmButton = popup.querySelector(
                "yt-confirm-dialog-renderer .buttons.style-scope.yt-confirm-dialog-renderer>yt-button-renderer#confirm-button");

            if (confirmButton) {
                __ytPlaybackContinueCount++;
                confirmButton.click();

                console.log("%c⏯️ %cVideo playback %ccontinued... 😉", "font-size: 125%;", "color: aqua;");
            }
        }

        var viewCountContainer = document.querySelector("yt-view-count-renderer");
        if (viewCountContainer) {
            for (var i = 0; i < viewCountContainer.children.length; i++) {
                var el = viewCountContainer.children[i];

                //looking for / creating continues counter
                var countEl = el.querySelector(".playback-conti-count");
                if (!countEl)
                {
                    countEl = document.createElement('span');
                    countEl.classList.add("playback-conti-count");
                    countEl.style.fontSize = "80%";

                    el.appendChild(countEl);
                }

                countEl.innerHTML = "&nbsp; " + __ytPlaybackContinueCount + " continues";
            }
        }
    }, 250);
})();

`// ==UserScript==
// @name Youtube auto close popup
// @version 1
// @description Will auto close the Youtube popup prompting you to continue playing
// @author Telokis, Skor_X
// @include /^https?://(?:www.)?youtube.com/.*/
// @downloadURL https://pastebin.com/raw/w2ecSspS
// @grant none
// @license MIT
// @copyright 2018, Telokis (https://openuserjs.org//users/Telokis)
// ==/UserScript==

(function () {
"use strict";

var __ytPlaybackContinueInterval, __ytPlaybackContinueCount = 0;

__ytPlaybackContinueInterval = setInterval(function () {
    var popup = document.querySelector("ytd-popup-container.ytd-app paper-dialog.ytd-popup-container[role=dialog]");
    if (popup && window.getComputedStyle(popup).display !== "none") {
        var confirmButton = popup.querySelector(
            "yt-confirm-dialog-renderer .buttons.style-scope.yt-confirm-dialog-renderer>yt-button-renderer#confirm-button");

        if (confirmButton) {
            __ytPlaybackContinueCount++;
            confirmButton.click();

            console.log("%c⏯️ %cVideo playback %ccontinued... 😉", "font-size: 125%;", "color: aqua;");
        }
    }

    var viewCountContainer = document.querySelector("yt-view-count-renderer");
    if (viewCountContainer) {
        for (var i = 0; i < viewCountContainer.children.length; i++) {
            var el = viewCountContainer.children[i];

            //looking for / creating continues counter
            var countEl = el.querySelector(".playback-conti-count");
            if (!countEl)
            {
                countEl = document.createElement('span');
                countEl.classList.add("playback-conti-count");
                countEl.style.fontSize = "80%";

                el.appendChild(countEl);
            }

            countEl.innerHTML = "&nbsp; " + __ytPlaybackContinueCount + " continues";
        }
    }
}, 250);

})();
`