Put Youtube subtitles on top of everything

Use this script if you want subtitles float on entire screen!

04.05.2020 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Put Youtube subtitles on top of everything
// @namespace    http://www.chaochaogege.com
// @version      0.2
// @description  Use this script if you want subtitles float on entire screen!
// @author       You
// @match        https://www.youtube.com/watch?*
// @grant        none
// @require https://greasyfork.org/scripts/402597-monitor-dom-change/code/monitor%20dom%20change.js?version=801281
// ==/UserScript==

!function() {
    const over = document.querySelector('#primary-inner')
    let right = ''
    let left = ''
    let top = ''
    let bottom = ''
    // const subtitlesdiv = document.querySelector('.caption-window')
    monitordom(over,(lists) => {
        if (lists.addedNodes.length > 0){
            const n = lists.addedNodes[0]
            if (typeof n.className == 'string' && n.className.includes('caption-window')) {
                let stylelists = n.style
                n.style.position = "fixed"
                stylelists['top'] = top
                stylelists['right'] = right
                stylelists['left'] = left
                stylelists['bottom'] = bottom
            }
        }
        if(lists.type === 'attributes') {
        if (typeof lists.target.className === 'string' && lists.target.className.includes('caption-window')) {
            let stylelists = lists.target.style
            top = stylelists['top']
            bottom = stylelists['bottom']
            left = stylelists['left']
            right = stylelists['right']
        }
        }
    },{attributes: true, childList: true, subtree: true})
    over.style['z-index'] = 4000
    over.style.position = 'relative'
}()