Feature/#161 autoscroll w2g #176

Merged
Serraniel merged 7 commits from feature/#161-autoscroll-w2g into develop 2021-02-13 21:42:24 +01:00
Showing only changes of commit 6ab597924e - Show all commits

View file

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