// ==UserScript== // @name Acfun 宽屏和画质切换 // @namespace AcfunFilmModeSwitch // @version 0.4 // @description Acfun 视频播放直播自动切换为宽屏和最高画质 // @author Jianeddie // @match *://*.acfun.cn/v/ac* // @match *://*.acfun.cn/live/* // @connect www.acfun.cn // @license MIT // @downloadURL none // ==/UserScript== function sleep (time) { return new Promise((resolve) => setTimeout(resolve, time)); } function reset() { let rd = document.querySelector('.right-column.dark-style'); let ck = Math.trunc(innerHeight * 0.85); if (rd !== null){ document.getElementById("ACPlayer").style.cssText = "height: "+ ck +"px"; } } function filmmode() { sleep(1200).then(() => { try{ let fb = document.querySelector('.btn-film-model'); let ck = Math.trunc(innerHeight * 0.85); if (fb.querySelector('.btn-span').getAttribute('data-bind-attr')=='false') { fb.click(); fb.querySelector('.btn-span').setAttribute('data-bind-attr', 'true'); } sleep(1200).then(() => { let fc = document.querySelector('.right-column.dark-style'); if (fc == null){ fb.click(); fb.querySelector('.btn-span').setAttribute('data-bind-attr', 'false'); fb.click(); fb.querySelector('.btn-span').setAttribute('data-bind-attr', 'true'); } document.getElementById("ACPlayer").style.cssText = "height: "+ ck +"px"; document.querySelector(".quality-panel ul li").click(); }); }catch(err){ //console.log("filmmodeClcik error:"+err); return sleep(100).then(() => {filmmode();}); } }); } window.onload = filmmode; window.onresize = reset; sleep(4000).then(() => { var bm = document.querySelector('.btn-film-model'); bm.addEventListener('click', function(){ sleep(100).then(() => {reset();}); }); });