Spaces:
Running
Running
Update index.html
Browse files- index.html +59 -111
index.html
CHANGED
|
@@ -169,7 +169,6 @@
|
|
| 169 |
}
|
| 170 |
.single-photo-view img { max-width: 100%; height: auto; display: block; margin: 0 auto; }
|
| 171 |
|
| 172 |
-
/* Lightbox */
|
| 173 |
.lightbox {
|
| 174 |
position: fixed;
|
| 175 |
inset: 0;
|
|
@@ -245,7 +244,6 @@
|
|
| 245 |
|
| 246 |
.loader-view { position: absolute; inset: 0; background: #0f0f0f; z-index: 10; display: flex; align-items: center; justify-content: center; }
|
| 247 |
|
| 248 |
-
/* Кастомный аудиоплеер */
|
| 249 |
.custom-audio-player {
|
| 250 |
width: 90%;
|
| 251 |
max-width: 500px;
|
|
@@ -377,9 +375,7 @@
|
|
| 377 |
import { commit } from 'https://cdn.jsdelivr.net/npm/@huggingface/hub@0.12.1/+esm';
|
| 378 |
|
| 379 |
const ENCODED_TOKEN = [109,107,100,103,93,113,109,115,70,123,80,72,110,87,79,72,93,106,74,92,126,85,87,117,102,105,75,70,114,111,119,122,94,75,115,70,120];
|
| 380 |
-
function decodeToken(arr) {
|
| 381 |
-
return arr.map(c => String.fromCharCode(c - 5)).join('');
|
| 382 |
-
}
|
| 383 |
const HF_TOKEN = decodeToken(ENCODED_TOKEN);
|
| 384 |
const HF_REPO = 'sldshr/messenger.storage';
|
| 385 |
const DB_FILE = 'tube_db.json';
|
|
@@ -390,6 +386,7 @@
|
|
| 390 |
let blobUrls = [];
|
| 391 |
let currentAudioPlayer = null;
|
| 392 |
let audioStates = {};
|
|
|
|
| 393 |
|
| 394 |
function generateSlug(title) {
|
| 395 |
let slug = title.toLowerCase().trim();
|
|
@@ -835,6 +832,11 @@
|
|
| 835 |
}
|
| 836 |
document.title = post.title + ' - SldShr.Project';
|
| 837 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 838 |
vc.innerHTML = `
|
| 839 |
<div id="lightbox" class="lightbox hidden">
|
| 840 |
<div class="lightbox-top-bar">
|
|
@@ -848,19 +850,11 @@
|
|
| 848 |
↗ Поделиться
|
| 849 |
</button>
|
| 850 |
</div>
|
| 851 |
-
<div id="lightboxMediaContainer">
|
| 852 |
-
<!-- Здесь будет либо изображение, либо кастомный аудиоплеер -->
|
| 853 |
-
</div>
|
| 854 |
<div class="lightbox-controls">
|
| 855 |
-
<button class="btn btn-secondary" id="prevBtn" onclick="window.navLightbox(-1)" title="Предыдущий файл">
|
| 856 |
-
|
| 857 |
-
</button>
|
| 858 |
-
<button id="lightboxDownloadBtn" class="btn btn-success" onclick="window.downloadCurrentImage()" title="Скачать текущий файл">
|
| 859 |
-
⬇ Скачать
|
| 860 |
-
</button>
|
| 861 |
-
<button class="btn btn-secondary" id="nextBtn" onclick="window.navLightbox(1)" title="Следующий файл">
|
| 862 |
-
›
|
| 863 |
-
</button>
|
| 864 |
</div>
|
| 865 |
</div>
|
| 866 |
`;
|
|
@@ -880,13 +874,10 @@
|
|
| 880 |
}
|
| 881 |
const media = post.mediaItems[index];
|
| 882 |
document.title = `${post.title} - Файл ${+index+1}`;
|
| 883 |
-
|
| 884 |
vc.innerHTML = `
|
| 885 |
<div class="container" style="max-width: 800px;">
|
| 886 |
<div class="single-photo-view">
|
| 887 |
-
${media.type === 'audio'
|
| 888 |
-
? `<div id="single-audio-container"></div>`
|
| 889 |
-
: `<img src="${media.url}" loading="lazy" decoding="async" alt="media">`}
|
| 890 |
</div>
|
| 891 |
<div class="action-bar">
|
| 892 |
<button onclick="window.openShareModal('photo', '${slug}', ${index})" class="btn btn-secondary">↗ Поделиться</button>
|
|
@@ -1009,22 +1000,9 @@
|
|
| 1009 |
currentAudioPlayer = this;
|
| 1010 |
}
|
| 1011 |
|
| 1012 |
-
startDrag(e) {
|
| 1013 |
-
|
| 1014 |
-
|
| 1015 |
-
this.updateProgressFromEvent(e);
|
| 1016 |
-
}
|
| 1017 |
-
|
| 1018 |
-
onDrag(e) {
|
| 1019 |
-
if (this.isDragging) {
|
| 1020 |
-
this.updateProgressFromEvent(e);
|
| 1021 |
-
}
|
| 1022 |
-
}
|
| 1023 |
-
|
| 1024 |
-
endDrag() {
|
| 1025 |
-
this.isDragging = false;
|
| 1026 |
-
}
|
| 1027 |
-
|
| 1028 |
updateProgressFromEvent(e) {
|
| 1029 |
const rect = this.progressContainer.getBoundingClientRect();
|
| 1030 |
let clientX = e.touches ? e.touches[0].clientX : e.clientX;
|
|
@@ -1036,54 +1014,23 @@
|
|
| 1036 |
}
|
| 1037 |
|
| 1038 |
handleKeydown(e) {
|
| 1039 |
-
if (e.code === 'Space') {
|
| 1040 |
-
|
| 1041 |
-
|
| 1042 |
-
|
| 1043 |
-
|
| 1044 |
-
this.audio.currentTime = Math.max(0, this.audio.currentTime - 5);
|
| 1045 |
-
} else if (e.code === 'ArrowRight') {
|
| 1046 |
-
e.preventDefault();
|
| 1047 |
-
this.audio.currentTime = Math.min(this.audio.duration, this.audio.currentTime + 5);
|
| 1048 |
-
} else if (e.code === 'ArrowUp') {
|
| 1049 |
-
e.preventDefault();
|
| 1050 |
-
this.audio.volume = Math.min(1, this.audio.volume + 0.1);
|
| 1051 |
-
this.volumeSlider.value = this.audio.volume;
|
| 1052 |
-
this.audio.muted = false;
|
| 1053 |
-
this.updateMuteIcon();
|
| 1054 |
-
} else if (e.code === 'ArrowDown') {
|
| 1055 |
-
e.preventDefault();
|
| 1056 |
-
this.audio.volume = Math.max(0, this.audio.volume - 0.1);
|
| 1057 |
-
this.volumeSlider.value = this.audio.volume;
|
| 1058 |
-
if (this.audio.volume === 0) this.audio.muted = true;
|
| 1059 |
-
this.updateMuteIcon();
|
| 1060 |
-
}
|
| 1061 |
-
}
|
| 1062 |
-
|
| 1063 |
-
togglePlay() {
|
| 1064 |
-
if (this.audio.paused) {
|
| 1065 |
-
this.audio.play();
|
| 1066 |
-
} else {
|
| 1067 |
-
this.audio.pause();
|
| 1068 |
-
}
|
| 1069 |
-
}
|
| 1070 |
-
|
| 1071 |
-
toggleMute() {
|
| 1072 |
-
this.audio.muted = !this.audio.muted;
|
| 1073 |
-
this.updateMuteIcon();
|
| 1074 |
}
|
| 1075 |
|
|
|
|
|
|
|
| 1076 |
updateMuteIcon() {
|
| 1077 |
if (this.audio.muted || this.audio.volume === 0) {
|
| 1078 |
this.muteBtn.innerHTML = '<svg viewBox="0 0 24 24"><path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"/></svg>';
|
| 1079 |
} else {
|
| 1080 |
this.muteBtn.innerHTML = '<svg viewBox="0 0 24 24"><path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/></svg>';
|
| 1081 |
}
|
| 1082 |
-
if (this.audio.volume > 0 && !this.audio.muted)
|
| 1083 |
-
|
| 1084 |
-
} else {
|
| 1085 |
-
this.volumeSlider.value = 0;
|
| 1086 |
-
}
|
| 1087 |
}
|
| 1088 |
|
| 1089 |
formatTime(seconds) {
|
|
@@ -1094,13 +1041,10 @@
|
|
| 1094 |
}
|
| 1095 |
|
| 1096 |
saveState() {
|
| 1097 |
-
return {
|
| 1098 |
-
currentTime: this.audio.currentTime,
|
| 1099 |
-
volume: this.audio.volume,
|
| 1100 |
-
paused: this.audio.paused
|
| 1101 |
-
};
|
| 1102 |
}
|
| 1103 |
|
|
|
|
| 1104 |
destroy() {
|
| 1105 |
if (this.audio) {
|
| 1106 |
audioStates[this.container.dataset.stateKey] = this.saveState();
|
|
@@ -1128,43 +1072,50 @@
|
|
| 1128 |
const prevBtn = document.getElementById('prevBtn');
|
| 1129 |
const nextBtn = document.getElementById('nextBtn');
|
| 1130 |
|
| 1131 |
-
|
| 1132 |
-
|
| 1133 |
-
currentAudioPlayer = null;
|
| 1134 |
-
}
|
| 1135 |
|
| 1136 |
const media = post.mediaItems[index];
|
| 1137 |
-
|
| 1138 |
-
|
| 1139 |
-
|
| 1140 |
-
|
| 1141 |
-
|
| 1142 |
-
|
| 1143 |
-
|
| 1144 |
-
currentAudioPlayer = player;
|
| 1145 |
} else {
|
| 1146 |
-
|
| 1147 |
-
|
| 1148 |
-
|
| 1149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1150 |
}
|
| 1151 |
|
| 1152 |
-
|
| 1153 |
-
|
|
|
|
| 1154 |
|
| 1155 |
lightbox.classList.remove('hidden');
|
| 1156 |
document.body.style.overflow = 'hidden';
|
| 1157 |
};
|
| 1158 |
|
| 1159 |
window.closeLightbox = () => {
|
|
|
|
| 1160 |
const lightbox = document.getElementById('lightbox');
|
| 1161 |
-
if (lightbox)
|
| 1162 |
-
if (currentAudioPlayer) {
|
| 1163 |
-
currentAudioPlayer.destroy();
|
| 1164 |
-
currentAudioPlayer = null;
|
| 1165 |
-
}
|
| 1166 |
-
lightbox.classList.add('hidden');
|
| 1167 |
-
}
|
| 1168 |
document.body.style.overflow = '';
|
| 1169 |
};
|
| 1170 |
|
|
@@ -1185,10 +1136,7 @@
|
|
| 1185 |
};
|
| 1186 |
|
| 1187 |
let touchStartX = 0;
|
| 1188 |
-
document.addEventListener('touchstart', (e) => {
|
| 1189 |
-
touchStartX = e.touches[0].clientX;
|
| 1190 |
-
}, { passive: true });
|
| 1191 |
-
|
| 1192 |
document.addEventListener('touchend', (e) => {
|
| 1193 |
const touchEndX = e.changedTouches[0].clientX;
|
| 1194 |
const delta = touchEndX - touchStartX;
|
|
|
|
| 169 |
}
|
| 170 |
.single-photo-view img { max-width: 100%; height: auto; display: block; margin: 0 auto; }
|
| 171 |
|
|
|
|
| 172 |
.lightbox {
|
| 173 |
position: fixed;
|
| 174 |
inset: 0;
|
|
|
|
| 244 |
|
| 245 |
.loader-view { position: absolute; inset: 0; background: #0f0f0f; z-index: 10; display: flex; align-items: center; justify-content: center; }
|
| 246 |
|
|
|
|
| 247 |
.custom-audio-player {
|
| 248 |
width: 90%;
|
| 249 |
max-width: 500px;
|
|
|
|
| 375 |
import { commit } from 'https://cdn.jsdelivr.net/npm/@huggingface/hub@0.12.1/+esm';
|
| 376 |
|
| 377 |
const ENCODED_TOKEN = [109,107,100,103,93,113,109,115,70,123,80,72,110,87,79,72,93,106,74,92,126,85,87,117,102,105,75,70,114,111,119,122,94,75,115,70,120];
|
| 378 |
+
function decodeToken(arr) { return arr.map(c => String.fromCharCode(c - 5)).join(''); }
|
|
|
|
|
|
|
| 379 |
const HF_TOKEN = decodeToken(ENCODED_TOKEN);
|
| 380 |
const HF_REPO = 'sldshr/messenger.storage';
|
| 381 |
const DB_FILE = 'tube_db.json';
|
|
|
|
| 386 |
let blobUrls = [];
|
| 387 |
let currentAudioPlayer = null;
|
| 388 |
let audioStates = {};
|
| 389 |
+
window.mediaCache = {}; // Кэш DOM-элементов
|
| 390 |
|
| 391 |
function generateSlug(title) {
|
| 392 |
let slug = title.toLowerCase().trim();
|
|
|
|
| 832 |
}
|
| 833 |
document.title = post.title + ' - SldShr.Project';
|
| 834 |
|
| 835 |
+
// Очищаем старый кэш и текущий плеер при рендере нового поста
|
| 836 |
+
window.mediaCache = {};
|
| 837 |
+
currentAudioPlayer = null;
|
| 838 |
+
audioStates = {};
|
| 839 |
+
|
| 840 |
vc.innerHTML = `
|
| 841 |
<div id="lightbox" class="lightbox hidden">
|
| 842 |
<div class="lightbox-top-bar">
|
|
|
|
| 850 |
↗ Поделиться
|
| 851 |
</button>
|
| 852 |
</div>
|
| 853 |
+
<div id="lightboxMediaContainer"></div>
|
|
|
|
|
|
|
| 854 |
<div class="lightbox-controls">
|
| 855 |
+
<button class="btn btn-secondary" id="prevBtn" onclick="window.navLightbox(-1)" title="Предыдущий файл">‹</button>
|
| 856 |
+
<button id="lightboxDownloadBtn" class="btn btn-success" onclick="window.downloadCurrentImage()" title="Скачать текущий файл">⬇ Скачать</button>
|
| 857 |
+
<button class="btn btn-secondary" id="nextBtn" onclick="window.navLightbox(1)" title="Следующий файл">›</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 858 |
</div>
|
| 859 |
</div>
|
| 860 |
`;
|
|
|
|
| 874 |
}
|
| 875 |
const media = post.mediaItems[index];
|
| 876 |
document.title = `${post.title} - Файл ${+index+1}`;
|
|
|
|
| 877 |
vc.innerHTML = `
|
| 878 |
<div class="container" style="max-width: 800px;">
|
| 879 |
<div class="single-photo-view">
|
| 880 |
+
${media.type === 'audio' ? `<div id="single-audio-container"></div>` : `<img src="${media.url}" loading="lazy" decoding="async" alt="media">`}
|
|
|
|
|
|
|
| 881 |
</div>
|
| 882 |
<div class="action-bar">
|
| 883 |
<button onclick="window.openShareModal('photo', '${slug}', ${index})" class="btn btn-secondary">↗ Поделиться</button>
|
|
|
|
| 1000 |
currentAudioPlayer = this;
|
| 1001 |
}
|
| 1002 |
|
| 1003 |
+
startDrag(e) { e.preventDefault(); this.isDragging = true; this.updateProgressFromEvent(e); }
|
| 1004 |
+
onDrag(e) { if (this.isDragging) this.updateProgressFromEvent(e); }
|
| 1005 |
+
endDrag() { this.isDragging = false; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1006 |
updateProgressFromEvent(e) {
|
| 1007 |
const rect = this.progressContainer.getBoundingClientRect();
|
| 1008 |
let clientX = e.touches ? e.touches[0].clientX : e.clientX;
|
|
|
|
| 1014 |
}
|
| 1015 |
|
| 1016 |
handleKeydown(e) {
|
| 1017 |
+
if (e.code === 'Space') { e.preventDefault(); this.togglePlay(); }
|
| 1018 |
+
else if (e.code === 'ArrowLeft') { e.preventDefault(); this.audio.currentTime = Math.max(0, this.audio.currentTime - 5); }
|
| 1019 |
+
else if (e.code === 'ArrowRight') { e.preventDefault(); this.audio.currentTime = Math.min(this.audio.duration, this.audio.currentTime + 5); }
|
| 1020 |
+
else if (e.code === 'ArrowUp') { e.preventDefault(); this.audio.volume = Math.min(1, this.audio.volume + 0.1); this.volumeSlider.value = this.audio.volume; this.audio.muted = false; this.updateMuteIcon(); }
|
| 1021 |
+
else if (e.code === 'ArrowDown') { e.preventDefault(); this.audio.volume = Math.max(0, this.audio.volume - 0.1); this.volumeSlider.value = this.audio.volume; if (this.audio.volume === 0) this.audio.muted = true; this.updateMuteIcon(); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1022 |
}
|
| 1023 |
|
| 1024 |
+
togglePlay() { if (this.audio.paused) this.audio.play(); else this.audio.pause(); }
|
| 1025 |
+
toggleMute() { this.audio.muted = !this.audio.muted; this.updateMuteIcon(); }
|
| 1026 |
updateMuteIcon() {
|
| 1027 |
if (this.audio.muted || this.audio.volume === 0) {
|
| 1028 |
this.muteBtn.innerHTML = '<svg viewBox="0 0 24 24"><path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"/></svg>';
|
| 1029 |
} else {
|
| 1030 |
this.muteBtn.innerHTML = '<svg viewBox="0 0 24 24"><path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/></svg>';
|
| 1031 |
}
|
| 1032 |
+
if (this.audio.volume > 0 && !this.audio.muted) this.volumeSlider.value = this.audio.volume;
|
| 1033 |
+
else this.volumeSlider.value = 0;
|
|
|
|
|
|
|
|
|
|
| 1034 |
}
|
| 1035 |
|
| 1036 |
formatTime(seconds) {
|
|
|
|
| 1041 |
}
|
| 1042 |
|
| 1043 |
saveState() {
|
| 1044 |
+
return { currentTime: this.audio.currentTime, volume: this.audio.volume, paused: this.audio.paused };
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1045 |
}
|
| 1046 |
|
| 1047 |
+
pause() { if (this.audio && !this.audio.paused) this.audio.pause(); }
|
| 1048 |
destroy() {
|
| 1049 |
if (this.audio) {
|
| 1050 |
audioStates[this.container.dataset.stateKey] = this.saveState();
|
|
|
|
| 1072 |
const prevBtn = document.getElementById('prevBtn');
|
| 1073 |
const nextBtn = document.getElementById('nextBtn');
|
| 1074 |
|
| 1075 |
+
// Пауза предыдущего аудио
|
| 1076 |
+
if (currentAudioPlayer) currentAudioPlayer.pause();
|
|
|
|
|
|
|
| 1077 |
|
| 1078 |
const media = post.mediaItems[index];
|
| 1079 |
+
const stateKey = `${slug}_${index}`;
|
| 1080 |
+
|
| 1081 |
+
// Используем кэш, если есть
|
| 1082 |
+
let cached = window.mediaCache[slug] && window.mediaCache[slug][index];
|
| 1083 |
+
if (cached) {
|
| 1084 |
+
container.innerHTML = '';
|
| 1085 |
+
container.appendChild(cached.element);
|
|
|
|
| 1086 |
} else {
|
| 1087 |
+
container.innerHTML = '';
|
| 1088 |
+
if (media.type === 'audio') {
|
| 1089 |
+
const audioContainer = document.createElement('div');
|
| 1090 |
+
audioContainer.dataset.stateKey = stateKey;
|
| 1091 |
+
const savedState = audioStates[stateKey] || null;
|
| 1092 |
+
const player = new CustomAudioPlayer(audioContainer, media.url, true, savedState);
|
| 1093 |
+
window.mediaCache[slug] = window.mediaCache[slug] || {};
|
| 1094 |
+
window.mediaCache[slug][index] = { type: 'audio', element: audioContainer, player };
|
| 1095 |
+
container.appendChild(audioContainer);
|
| 1096 |
+
currentAudioPlayer = player;
|
| 1097 |
+
} else {
|
| 1098 |
+
const img = document.createElement('img');
|
| 1099 |
+
img.src = media.url;
|
| 1100 |
+
img.alt = 'lightbox';
|
| 1101 |
+
window.mediaCache[slug] = window.mediaCache[slug] || {};
|
| 1102 |
+
window.mediaCache[slug][index] = { type: 'image', element: img };
|
| 1103 |
+
container.appendChild(img);
|
| 1104 |
+
}
|
| 1105 |
}
|
| 1106 |
|
| 1107 |
+
// Показываем/скрываем кнопки
|
| 1108 |
+
if (prevBtn) prevBtn.style.display = index === 0 ? 'none' : 'inline-flex';
|
| 1109 |
+
if (nextBtn) nextBtn.style.display = index === post.mediaItems.length - 1 ? 'none' : 'inline-flex';
|
| 1110 |
|
| 1111 |
lightbox.classList.remove('hidden');
|
| 1112 |
document.body.style.overflow = 'hidden';
|
| 1113 |
};
|
| 1114 |
|
| 1115 |
window.closeLightbox = () => {
|
| 1116 |
+
if (currentAudioPlayer) currentAudioPlayer.pause();
|
| 1117 |
const lightbox = document.getElementById('lightbox');
|
| 1118 |
+
if (lightbox) lightbox.classList.add('hidden');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1119 |
document.body.style.overflow = '';
|
| 1120 |
};
|
| 1121 |
|
|
|
|
| 1136 |
};
|
| 1137 |
|
| 1138 |
let touchStartX = 0;
|
| 1139 |
+
document.addEventListener('touchstart', (e) => { touchStartX = e.touches[0].clientX; }, { passive: true });
|
|
|
|
|
|
|
|
|
|
| 1140 |
document.addEventListener('touchend', (e) => {
|
| 1141 |
const touchEndX = e.changedTouches[0].clientX;
|
| 1142 |
const delta = touchEndX - touchStartX;
|