优酷自动选低清画质并全屏

a优酷自动选低清画质并全屏的插件

// ==UserScript==
// @name         优酷自动选低清画质并全屏
// @namespace
// @version      1.1.3
// @description  a优酷自动选低清画质并全屏的插件
// @author       cw
// @license
// @namespace    http://tampermonkey.net/
// @match        https://v.youku.com/*
// @grant GM_addStyle
// @run-at document-start
// ==/UserScript==

(function() {
    window.addEventListener('load',function(){
        try{
            const el= document.querySelectorAll('.kui-quality-quality-item');
            const elLength=el.length
            let count =10
            if( ['智能','自动'].includes(el[elLength-1].textContent)){
                el[elLength-2].click()
            }else{
                el[elLength-1].click()
            }

            setTimeout(()=>{
                (function(){
                    const el=document.querySelector('.kui-fullscreen-icon-0')
                    count-=1
                    if(!!el){
                        el.click()
                    }else{
                        setTimeout(()=>{
                            !!count&&arguments?.callee()
                        },1000)
                    }
                })()
            },20000)
        } catch(error){
            console.log(error)
        }

    })
})();