Created
May 17, 2019 12:00
-
-
Save dinos80152/13caa1598a03f9f2636f02cb44453769 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class VoiceTube { | |
answer() { | |
if (document.querySelector('.title_info').textContent.includes('影片理解')) { | |
this.comprehension() | |
document.querySelector('.check_ans').click() | |
if (document.querySelector('.next_question') !== null) { | |
document.querySelector('.next_question').click() | |
} | |
if (document.querySelector('.go_game') !== null) { | |
document.querySelector('.go_game').click() | |
} | |
return | |
} | |
if (document.querySelector('.title_info').textContent.includes('字彙選擇')) { | |
this.vocabulary() | |
this.submit() | |
return | |
} | |
if (document.querySelector('.title_info').textContent.includes('拼字測驗')) { | |
this.spell() | |
this.submit() | |
return | |
} | |
if (document.querySelector('.title_info').textContent.includes('字彙聽打')) { | |
this.cloze() | |
this.submit() | |
return | |
} | |
if (document.querySelector('.title_info').textContent.includes('字彙配對')) { | |
this.match() | |
this.submit() | |
return | |
} | |
if (document.querySelector('.title_info').textContent.includes('字彙表')) { | |
document.querySelector('.check_ans').click() | |
return | |
} | |
if (document.querySelector('.title_info').textContent.includes('慣用語')) { | |
this.grammar() | |
this.submit() | |
return | |
} | |
} | |
comprehension() { | |
var ans = vt.comprehensionView.model.get_comprehension().answer_pos[0] | |
document.querySelectorAll('#question_main li')[parseInt(ans)].click() | |
} | |
vocabulary() { | |
var ans = vt.gameView.model.get_game().reading.answer_pos | |
document.querySelectorAll('#left_core_question li')[parseInt(ans)].click() | |
} | |
spell() { | |
document.querySelectorAll('#spell_question .fillInputs input').forEach(function(elem) { | |
elem.value = elem.dataset.result | |
}) | |
} | |
cloze() { | |
document.querySelectorAll('#cloze_question .cloze_error_line input').forEach(function(elem) { | |
elem.value = elem.getAttribute('data') | |
}) | |
} | |
firstMatchAnswer() { | |
return document.querySelector('.vocab-match-question span').dataset.content | |
} | |
match() { | |
document.querySelectorAll('.vocab-match-question span').forEach(function(elem) { | |
elem.dataset.ori = elem.dataset.content | |
elem.textContent = elem.dataset.content | |
}) | |
} | |
grammar() { | |
document.querySelectorAll('#grammar_usage_question .grammar_usage_input input').forEach(function(elem) { | |
elem.value = elem.getAttribute('data') | |
}) | |
} | |
submit() { | |
document.querySelector('.check_ans').click() | |
document.querySelector('.check_ans').click() | |
} | |
next() { | |
document.querySelector('.go_next_step').click() | |
} | |
skip() { | |
document.querySelector('.skip_speaking').click() | |
} | |
} | |
v = new VoiceTube |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment