DeadLyBro / Youtube Shorts to Normal Video

// ==UserScript==
// @name         Youtube Shorts to Normal Video
// @namespace    https://linktr.ee/DeadLyBro
// @description  EN: Convert Youtube Shorts videos to normal videos with one button. TR: Youtube Shorts videolarını bir buton ile normal videoya dönüştürün.
// @author       DeadLyBro
// @copyright    2023, DeadLyBro (https://openuserjs.org/users/DeadLyBro)
// @version      1.4
// @match        https://www.youtube.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @grant        none
// @license      MIT
// ==/UserScript==

// ==OpenUserJS==
// @author       DeadLyBro
// @updateURL    https://openuserjs.org/meta/DeadLyBro/Youtube_Shorts_to_Normal_Video.meta.js
// @downloadURL  https://openuserjs.org/install/DeadLyBro/Youtube_Shorts_to_Normal_Video.user.js
// ==/OpenUserJS==

(function() {
    'use strict';

    setInterval(() => {
        if (document.baseURI.startsWith("https://www.youtube.com/shorts")) {

            function addCustomButton() {

                const activeElements = document.querySelectorAll('[is-active]');

                activeElements.forEach((activeElement) => {

                    const likeButton = activeElement.querySelector('[id="like-button"]');

                    if (likeButton) {

                        if (!likeButton.querySelector('.NormalVideoButton')) {
                            let myButton = document.createElement("button");
                            myButton.innerText = `Normal Video`
                            myButton.classList.add('NormalVideoButton');
                            myButton.addEventListener("click", (e) => { location.href = `https://www.youtube.com/watch?v=${document.URL.slice(31)}` });
                            likeButton.prepend(myButton);
                        }
                    }
                });
            }

            if (!document.querySelector('.NormalVideoButtonCSS')){
                let myCSS = document.createElement('style');
                myCSS.classList.add('NormalVideoButtonCSS');
                myCSS.innerHTML = `.NormalVideoButton {  background: #272727;  color: white;  border: unset;  border-radius: 5px;  margin-bottom: 10px;} .NormalVideoButton:hover { cursor: pointer; }`
                document.body.append(myCSS);
            }

            setInterval(addCustomButton, 1000); // Saniyede bir çalışır.
        }
    }, 1000); // Saniyede bir URL kontrolü yapar, eğer shorts videosundaysanız kodlar çalışır.

})();