Upload app.js
Browse files- static/app.js +21 -1
static/app.js
CHANGED
|
@@ -1044,7 +1044,12 @@ function renderVisible() {
|
|
| 1044 |
if (DOM.multiSelectToggle && DOM.multiSelectToggle.checked) updateSelectionUI();
|
| 1045 |
|
| 1046 |
requestAnimationFrame(() => {
|
| 1047 |
-
measureHeights()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1048 |
updateScrollTrack();
|
| 1049 |
});
|
| 1050 |
}
|
|
@@ -1143,6 +1148,7 @@ function measureHeights() {
|
|
| 1143 |
const els = DOM.resultsList.querySelectorAll(".result-item");
|
| 1144 |
let measuredSum = 0;
|
| 1145 |
let measuredCount = 0;
|
|
|
|
| 1146 |
for (let i = 0; i < els.length; i++) {
|
| 1147 |
const idx = parseInt(els[i].dataset.index);
|
| 1148 |
if (idx >= 0) {
|
|
@@ -1160,6 +1166,7 @@ function measureHeights() {
|
|
| 1160 |
} else {
|
| 1161 |
VSCROLL.heightsDirty = true;
|
| 1162 |
}
|
|
|
|
| 1163 |
}
|
| 1164 |
}
|
| 1165 |
}
|
|
@@ -1168,8 +1175,10 @@ function measureHeights() {
|
|
| 1168 |
if (Math.abs(nextEstimate - VSCROLL.estimatedHeight) > 1) {
|
| 1169 |
VSCROLL.estimatedHeight = nextEstimate;
|
| 1170 |
VSCROLL.heightsDirty = true;
|
|
|
|
| 1171 |
}
|
| 1172 |
}
|
|
|
|
| 1173 |
}
|
| 1174 |
|
| 1175 |
function updateStatusBar() {
|
|
@@ -2003,6 +2012,10 @@ function setupQuickScroll() {
|
|
| 2003 |
VSCROLL.isDraggingThumb = false;
|
| 2004 |
document.removeEventListener("mousemove", onMouseMove);
|
| 2005 |
document.removeEventListener("mouseup", onMouseUp);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2006 |
maybeLoadNextPage();
|
| 2007 |
}
|
| 2008 |
|
|
@@ -2027,6 +2040,11 @@ function setupQuickScroll() {
|
|
| 2027 |
VSCROLL.isDraggingThumb = false;
|
| 2028 |
document.removeEventListener("touchmove", onTouchMove);
|
| 2029 |
document.removeEventListener("touchend", onTouchEnd);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2030 |
maybeLoadNextPage();
|
| 2031 |
}
|
| 2032 |
|
|
@@ -2034,6 +2052,7 @@ function setupQuickScroll() {
|
|
| 2034 |
dragging = true; VSCROLL.isDraggingThumb = true; startY = e.touches[0].clientY; startST = DOM.resultsContainer.scrollTop; e.stopPropagation();
|
| 2035 |
document.addEventListener("touchmove", onTouchMove, { passive: false });
|
| 2036 |
document.addEventListener("touchend", onTouchEnd);
|
|
|
|
| 2037 |
});
|
| 2038 |
}
|
| 2039 |
|
|
@@ -2081,6 +2100,7 @@ function applyMobileMode() {
|
|
| 2081 |
updateSidebarVisibility();
|
| 2082 |
if (DOM.sidebarExpandBtn) DOM.sidebarExpandBtn.style.display = (STATE.mode === "repo" && !STATE.isMobile) ? "" : "none";
|
| 2083 |
updateSelectionUI();
|
|
|
|
| 2084 |
}
|
| 2085 |
function autoDetectMobile() { return window.innerWidth <= 768; }
|
| 2086 |
|
|
|
|
| 1044 |
if (DOM.multiSelectToggle && DOM.multiSelectToggle.checked) updateSelectionUI();
|
| 1045 |
|
| 1046 |
requestAnimationFrame(() => {
|
| 1047 |
+
if (measureHeights()) {
|
| 1048 |
+
VSCROLL.renderStart = -1;
|
| 1049 |
+
VSCROLL.renderEnd = -1;
|
| 1050 |
+
renderVisible();
|
| 1051 |
+
return;
|
| 1052 |
+
}
|
| 1053 |
updateScrollTrack();
|
| 1054 |
});
|
| 1055 |
}
|
|
|
|
| 1148 |
const els = DOM.resultsList.querySelectorAll(".result-item");
|
| 1149 |
let measuredSum = 0;
|
| 1150 |
let measuredCount = 0;
|
| 1151 |
+
let changed = false;
|
| 1152 |
for (let i = 0; i < els.length; i++) {
|
| 1153 |
const idx = parseInt(els[i].dataset.index);
|
| 1154 |
if (idx >= 0) {
|
|
|
|
| 1166 |
} else {
|
| 1167 |
VSCROLL.heightsDirty = true;
|
| 1168 |
}
|
| 1169 |
+
changed = true;
|
| 1170 |
}
|
| 1171 |
}
|
| 1172 |
}
|
|
|
|
| 1175 |
if (Math.abs(nextEstimate - VSCROLL.estimatedHeight) > 1) {
|
| 1176 |
VSCROLL.estimatedHeight = nextEstimate;
|
| 1177 |
VSCROLL.heightsDirty = true;
|
| 1178 |
+
changed = true;
|
| 1179 |
}
|
| 1180 |
}
|
| 1181 |
+
return changed;
|
| 1182 |
}
|
| 1183 |
|
| 1184 |
function updateStatusBar() {
|
|
|
|
| 2012 |
VSCROLL.isDraggingThumb = false;
|
| 2013 |
document.removeEventListener("mousemove", onMouseMove);
|
| 2014 |
document.removeEventListener("mouseup", onMouseUp);
|
| 2015 |
+
if (STATE._deferredAppendWhileDragging) {
|
| 2016 |
+
STATE._deferredAppendWhileDragging = false;
|
| 2017 |
+
if (consumeCachedAppendPage()) return;
|
| 2018 |
+
}
|
| 2019 |
maybeLoadNextPage();
|
| 2020 |
}
|
| 2021 |
|
|
|
|
| 2040 |
VSCROLL.isDraggingThumb = false;
|
| 2041 |
document.removeEventListener("touchmove", onTouchMove);
|
| 2042 |
document.removeEventListener("touchend", onTouchEnd);
|
| 2043 |
+
document.removeEventListener("touchcancel", onTouchEnd);
|
| 2044 |
+
if (STATE._deferredAppendWhileDragging) {
|
| 2045 |
+
STATE._deferredAppendWhileDragging = false;
|
| 2046 |
+
if (consumeCachedAppendPage()) return;
|
| 2047 |
+
}
|
| 2048 |
maybeLoadNextPage();
|
| 2049 |
}
|
| 2050 |
|
|
|
|
| 2052 |
dragging = true; VSCROLL.isDraggingThumb = true; startY = e.touches[0].clientY; startST = DOM.resultsContainer.scrollTop; e.stopPropagation();
|
| 2053 |
document.addEventListener("touchmove", onTouchMove, { passive: false });
|
| 2054 |
document.addEventListener("touchend", onTouchEnd);
|
| 2055 |
+
document.addEventListener("touchcancel", onTouchEnd);
|
| 2056 |
});
|
| 2057 |
}
|
| 2058 |
|
|
|
|
| 2100 |
updateSidebarVisibility();
|
| 2101 |
if (DOM.sidebarExpandBtn) DOM.sidebarExpandBtn.style.display = (STATE.mode === "repo" && !STATE.isMobile) ? "" : "none";
|
| 2102 |
updateSelectionUI();
|
| 2103 |
+
requestAnimationFrame(updateScrollTrack);
|
| 2104 |
}
|
| 2105 |
function autoDetectMobile() { return window.innerWidth <= 768; }
|
| 2106 |
|