ReddTube Video Downloader and Next Button

Adds download and next buttons to the video player and changes the background color on www.redd.tube

// ==UserScript==
// @name         ReddTube Video Downloader and Next Button
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Adds download and next buttons to the video player and changes the background color on www.redd.tube
// @author       Your Name
// @match        *://www.redd.tube/*
// @grant        none
// @license     MIT
// ==/UserScript==

(function() {
    'use strict';

    // Wait for the DOM to fully load
    window.addEventListener('load', function() {
        // Find the video source element
        var videoSource = document.querySelector('#video-player source');

        // Create a button element for downloading the video
        var downloadVideoBtn = document.createElement('button');

        // Set background image to the download button
        downloadVideoBtn.style.backgroundImage = 'url("https://i.ibb.co/bm8j1jj/download.png")';
        downloadVideoBtn.style.backgroundRepeat = 'no-repeat';
        downloadVideoBtn.style.backgroundPosition = 'center';
        downloadVideoBtn.style.backgroundSize = 'contain';
        downloadVideoBtn.id = 'download-video-btn';

        // Add styles to the download button
        downloadVideoBtn.style.position = 'absolute';
        downloadVideoBtn.style.top = '10px';
        downloadVideoBtn.style.left = '10px';
        downloadVideoBtn.style.zIndex = '999';
        downloadVideoBtn.style.width = '30px'; // Adjust width as needed
        downloadVideoBtn.style.height = '30px'; // Adjust height as needed
        downloadVideoBtn.style.border = 'none'; // Remove border

        // Append the download button to the fixed container
        document.querySelector('.fixed-container').appendChild(downloadVideoBtn);

        // Add click event listener to the download button
        downloadVideoBtn.addEventListener('click', function() {
            // Get the video source URL
            var videoUrl = videoSource.getAttribute('src');
            // Open the video URL in a new tab
            var newTab = window.open(videoUrl, '_blank');
        });

        // Create a button element for going to the next video
        var nextVideoBtn = document.createElement('button');

        // Set background image to the next button
        nextVideoBtn.style.backgroundImage = 'url("https://i.ibb.co/qmY24dL/next.png")';
        nextVideoBtn.style.backgroundRepeat = 'no-repeat';
        nextVideoBtn.style.backgroundPosition = 'center';
        nextVideoBtn.style.backgroundSize = 'contain';
        nextVideoBtn.id = 'next-video-btn';

        // Add styles to the next button
        nextVideoBtn.style.position = 'absolute';
        nextVideoBtn.style.top = '10px';
        nextVideoBtn.style.left = '50px'; // Adjust left position as needed to place it next to the download button
        nextVideoBtn.style.zIndex = '999';
        nextVideoBtn.style.width = '30px'; // Adjust width as needed
        nextVideoBtn.style.height = '30px'; // Adjust height as needed
        nextVideoBtn.style.border = 'none'; // Remove border

        // Append the next button to the fixed container
        document.querySelector('.fixed-container').appendChild(nextVideoBtn);

        // Add click event listener to the next button
        nextVideoBtn.addEventListener('click', function() {
            // Find and click the original "Next" button in the HTML
            var nextButton = Array.from(document.querySelectorAll('a.btn')).find(el => el.textContent.includes("Next"));
            if (nextButton) {
                nextButton.click();
            }
        });

        // Select the video element by its id
        var videoPlayer = document.getElementById("video-player");

        // Check if the video player element exists
        if (videoPlayer) {
            // Override the background color style
            videoPlayer.style.backgroundColor = "#333333";
        }

        // Override inline style for video player
        document.body.style.backgroundColor = "#333333"; /* Change to #333333 for dark grey */

        var style = document.createElement('style');
        style.innerHTML = `
            /* Override inline style for video player */
            body {
                background-color: #333333 !important; /* Change to #333333 for dark grey */
            }

            #video-player {
                background-color: #333333 !important; /* Override the inline style */
            }

            /* Style for download button */
            #download-video-btn {
                background-color: transparent;
                border: none;
                cursor: pointer;
            }

            /* Style for next button */
            #next-video-btn {
                background-color: transparent;
                border: none;
                cursor: pointer;
            }

            /* Style for NAV BAR */

            #js-header > div > nav {
            background-color: #333333;
            color: white;

            }

            body > div.shortcode-html {
            background-color: 333333 !important;
            }
        `;
        document.head.appendChild(style);
    });

})();