Last active
April 25, 2017 08:08
-
-
Save tyage/aa2723df73f7a19b15a769404189da8a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
window.$$ = $$; | |
window.$ = $; | |
processAnime = (index) => { | |
console.log(index) | |
const anime = $$('.list-group-element-heading')[index]; | |
if (anime === undefined) { | |
$$('[rel=previous]')[1].click(); | |
setTimeout(() => processAnime(0), 1000); | |
return; | |
} | |
const next = () => processAnime(index + 1); | |
$('a', anime).click(); | |
setTimeout(() => checkEpisodes(next), 1000); | |
}; | |
checkEpisodes = (next) => { | |
$$('.card-header-tabs-element')[1].click(); | |
setTimeout(() => readAllEpisodes(next), 1000); | |
}; | |
readAllEpisodes = (next) => { | |
const episodes = $$('.list-group-element-buttons').map(e => $('.button-default', e)).filter(e => !e.classList.contains('active')); | |
readNextEpisode(episodes, next); | |
}; | |
readNextEpisode = (episodes, next) => { | |
if (episodes.length === 0) { backToAnime(next); return; } | |
episodes.pop().click(); | |
setTimeout(() => readNextEpisode(episodes, next), 1000); | |
}; | |
backToAnime = (next) => { | |
history.back(); | |
setTimeout(() => backToList(next), 1000); | |
}; | |
backToList = (next) => { | |
history.back(); | |
setTimeout(next, 1000); | |
}; | |
processAnime(0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment