#161 Improved query to find first unseen episode

This commit is contained in:
Serraniel 2021-02-08 19:13:07 +01:00
parent 3436f2a646
commit 6ab597924e
Signed by: Serraniel
GPG key ID: 3690B4E7364525D3

View file

@ -18,8 +18,10 @@ export function init(): void {
function observeSearchResults(searchRes: Element): void {
let observer = new MutationObserver(mutations => {
mutations.forEach(mutation => {
let num = searchRes.getElementsByClassName('md-2-line border _md-button-wrap _md md-clickable animelist-completed').length;
scrollTo(searchRes, num);
let scrollTarget = searchRes.querySelector('.ep-view md-list-item:not(.animelist-completed)');
if (assigned(scrollTarget)) {
scrollTarget.scrollIntoView();
}
});
});