termites 1.0.9 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server.js +25 -3
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1085,15 +1085,37 @@ class TermitesServer {
|
|
|
1085
1085
|
}));
|
|
1086
1086
|
}
|
|
1087
1087
|
}
|
|
1088
|
-
|
|
1088
|
+
function isMobileDevice() {
|
|
1089
|
+
return 'ontouchstart' in window || navigator.maxTouchPoints > 0 ||
|
|
1090
|
+
/Mobile|Android|iPhone|iPad|iPod|webOS|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
1091
|
+
}
|
|
1092
|
+
function handleViewportResize() {
|
|
1093
|
+
// Only adjust body height on mobile devices (handles keyboard popup)
|
|
1094
|
+
if (isMobileDevice() && window.visualViewport) {
|
|
1095
|
+
const vh = window.visualViewport.height;
|
|
1096
|
+
document.body.style.height = vh + 'px';
|
|
1097
|
+
// Scroll viewport to top to prevent offset issues
|
|
1098
|
+
window.scrollTo(0, 0);
|
|
1099
|
+
} else {
|
|
1100
|
+
// On desktop, use full viewport height
|
|
1101
|
+
document.body.style.height = '';
|
|
1102
|
+
}
|
|
1103
|
+
handleResize();
|
|
1104
|
+
}
|
|
1105
|
+
window.addEventListener('resize', handleViewportResize);
|
|
1089
1106
|
window.addEventListener('orientationchange', () => {
|
|
1090
1107
|
// Delay fit after orientation change to let browser settle
|
|
1091
|
-
setTimeout(
|
|
1108
|
+
setTimeout(handleViewportResize, 100);
|
|
1092
1109
|
});
|
|
1093
1110
|
// Also handle visual viewport changes (mobile keyboard show/hide)
|
|
1094
1111
|
if (window.visualViewport) {
|
|
1095
|
-
window.visualViewport.addEventListener('resize',
|
|
1112
|
+
window.visualViewport.addEventListener('resize', handleViewportResize);
|
|
1113
|
+
window.visualViewport.addEventListener('scroll', () => {
|
|
1114
|
+
if (isMobileDevice()) window.scrollTo(0, 0);
|
|
1115
|
+
});
|
|
1096
1116
|
}
|
|
1117
|
+
// Initial adjustment
|
|
1118
|
+
handleViewportResize();
|
|
1097
1119
|
connect();
|
|
1098
1120
|
applyTheme(currentTheme);
|
|
1099
1121
|
}
|