代码拉取完成,页面将自动刷新
//注入页面用于控制DOM
chrome.storage.sync.get('isRun', data => {
if (!data.isRun || window.location.host != 'study.zhihuishu.com')
return
document.addEventListener('DOMContentLoaded', () => {
console.log('js injected in')
chrome.storage.sync.get('setting', res => {
//console.log(res.setting)
let [speed, next, quiz, fluent, volume] = res.setting
function volumeShut() {
if (!volume)
return
document.getElementsByClassName('volumeIcon')[0].click();
console.log('volume shut down')
}
function speedUP() {
if (!speed)
return
document.getElementsByClassName('speedTab15')[0].click()
console.log('set 1.5 speed up')
}
function setBQ() {
if (!fluent)
return
document.getElementsByClassName('definiLines')[0].children[2].click()
console.log('set video in fluent quality')
}
function nextClass() {
if (!next)
return
document.getElementById('nextBtn').click()
console.log('go to next lesson')
}
function closeQuiz() {
if (!quiz)
return
if (document.getElementsByClassName('wrap_popchapter')[0]) {
document.getElementsByClassName('tmui_txt_hidd')[0].click()
console.log('close the quiz window')
}
}
function thread() {
setInterval(() => {
if (next && document.getElementsByClassName('passTime')[0].style.width == '100%') {
setTimeout(() => {
nextClass()
setTimeout(init, 2500)
}, 500)
}
}, 3000)
setInterval(closeQuiz, 100)
}
function init() {
volumeShut()
speedUP()
setBQ()
}
function addPageAction(){
document.getElementsByClassName('next_lesson')[0].addEventListener('click',() => setTimeout(init, 1000))
}
function main() {
addPageAction()
init()
thread()
}
setTimeout(main, 1000)
})
});
})
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。