remove old scroll engine for notifs
This commit is contained in:
parent
9adce79471
commit
533c5066c1
@ -103,56 +103,4 @@ definePageMetadata(computed(() => ({
|
||||
title: i18n.ts.notifications,
|
||||
icon: 'fas fa-bell',
|
||||
})));
|
||||
|
||||
if (isMobile.value) {
|
||||
document.addEventListener('touchstart', handleTouchStart, false);
|
||||
document.addEventListener('touchmove', handleTouchMove, false);
|
||||
|
||||
let xDown = null;
|
||||
let yDown = null;
|
||||
|
||||
function getTouches(evt) {
|
||||
return (
|
||||
evt.touches || evt.originalEvent.touches
|
||||
);
|
||||
}
|
||||
|
||||
function handleTouchStart(evt) {
|
||||
const firstTouch = getTouches(evt)[0];
|
||||
xDown = firstTouch.clientX;
|
||||
yDown = firstTouch.clientY;
|
||||
}
|
||||
|
||||
function handleTouchMove(evt) {
|
||||
if (!xDown || !yDown) {
|
||||
return;
|
||||
}
|
||||
|
||||
let xUp = evt.touches[0].clientX;
|
||||
let yUp = evt.touches[0].clientY;
|
||||
|
||||
let xDiff = xDown - xUp;
|
||||
let yDiff = yDown - yUp;
|
||||
|
||||
let next = 'home';
|
||||
let tabs = ['all', 'unread', 'mentions', 'directNotes'];
|
||||
|
||||
if (Math.abs(xDiff) > Math.abs(yDiff)) {
|
||||
if (xDiff < 0) {
|
||||
if (tab === 'all') {
|
||||
next = 'directNotes';
|
||||
}
|
||||
else {
|
||||
next = tabs[(tabs.indexOf(tab) - 1) % tabs.length];
|
||||
}
|
||||
} else {
|
||||
next = tabs[(tabs.indexOf(tab) + 1) % tabs.length];
|
||||
}
|
||||
tab = next;
|
||||
}
|
||||
xDown = null;
|
||||
yDown = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user