Replace js code with proper elm using elm-scroll package

This commit is contained in:
Eike Kettner
2020-09-14 23:35:21 +02:00
parent 3852c69da1
commit ad110b2a05
8 changed files with 31 additions and 47 deletions

View File

@ -32,37 +32,6 @@ elmApp.ports.setAllProgress.subscribe(function(input) {
}, 100);
});
elmApp.ports.scrollToTop.subscribe(function() {
window.scrollTo(0, 0);
});
elmApp.ports.scrollToElem.subscribe(function(argList) {
var id = argList && argList.length >= 1
? argList[0] : null;
var offset = argList && argList.length >= 2
? argList[1] : null;
if (id && id != "") {
window.setTimeout(function() {
var el = document.getElementById(id);
if (el) {
if (el["scrollIntoViewIfNeeded"]) {
el.scrollIntoViewIfNeeded();
} else {
el.scrollIntoView({
behavior: "auto",
block: "center",
inline: "nearest"
});
}
if (offset && offset != 0) {
window.scrollBy(0, offset);
}
}
}, 20);
}
});
elmApp.ports.saveUiSettings.subscribe(function(args) {
if (Array.isArray(args) && args.length == 2) {
var authResult = args[0];