Greasy Fork is available in English.
try to take over the world!
当前为
// ==UserScript==
// @name 斗鱼默认最高画质
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.douyu.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
window.onload = function(){
function autoClick(){
console.time()
let dom = Array.from(document.querySelectorAll('input')).find((item,index)=>{return item.value.includes('画质')})
if(dom){
const ul_dom = Array.from(dom.parentNode.childNodes).find((item)=>item.tagName=='UL')
const li_dom = Array.from(ul_dom.childNodes)
let seleteIndex = 0
li_dom.forEach((item,index)=>{
if(item.className!=''){
seleteIndex = index
}
})
if(seleteIndex==0){
console.log('默认为最高画质,无需切换')
console.timeEnd()
console.log('ok')
}else{
const old_quality = li_dom[seleteIndex].innerText
const new_quelity = li_dom[0].innerText
li_dom[0].click()
console.log(`已从${old_quality}切换到${new_quelity}`)
console.timeEnd()
console.log('ok')
}
}else{
setTimeout(()=>{
autoClick()
},1000)
}
}
autoClick()
}
// Your code here...
})();