mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-22 17:03:49 +01:00
remove old scroll engine for notifs
This commit is contained in:
parent
cf19f5bf72
commit
fa71663bf4
@ -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