nodebb-plugin-pdf-secure 1.2.17 → 1.2.18
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/static/lib/main.js +2 -0
- package/static/viewer-app.js +41 -27
- package/static/viewer.css +12 -0
- package/static/viewer.html +13 -0
package/package.json
CHANGED
package/static/lib/main.js
CHANGED
|
@@ -194,7 +194,9 @@
|
|
|
194
194
|
iframe.style.top = '0';
|
|
195
195
|
iframe.style.left = '0';
|
|
196
196
|
iframe.style.width = '100vw';
|
|
197
|
+
iframe.style.width = '100dvw'; // Override: dynamic viewport (excludes browser chrome)
|
|
197
198
|
iframe.style.height = '100vh';
|
|
199
|
+
iframe.style.height = '100dvh'; // Override: dynamic viewport (excludes address bar on mobile)
|
|
198
200
|
iframe.style.zIndex = '2147483647';
|
|
199
201
|
|
|
200
202
|
// Lock body scroll
|
package/static/viewer-app.js
CHANGED
|
@@ -2417,12 +2417,22 @@
|
|
|
2417
2417
|
// ERGONOMIC FEATURES
|
|
2418
2418
|
// ==========================================
|
|
2419
2419
|
|
|
2420
|
-
|
|
2420
|
+
|
|
2421
|
+
// Fullscreen state (tracks both native and simulated fullscreen)
|
|
2422
|
+
let isFullscreen = false;
|
|
2423
|
+
|
|
2424
|
+
// Fullscreen toggle function — delegates to parent iframe handler via postMessage
|
|
2421
2425
|
function toggleFullscreen() {
|
|
2422
|
-
if (
|
|
2423
|
-
|
|
2426
|
+
if (window.self !== window.top) {
|
|
2427
|
+
// Inside iframe: ask parent to handle fullscreen
|
|
2428
|
+
window.parent.postMessage({ type: 'pdf-secure-fullscreen-toggle' }, '*');
|
|
2424
2429
|
} else {
|
|
2425
|
-
|
|
2430
|
+
// Standalone mode: use native fullscreen
|
|
2431
|
+
if (document.fullscreenElement) {
|
|
2432
|
+
document.exitFullscreen();
|
|
2433
|
+
} else {
|
|
2434
|
+
document.documentElement.requestFullscreen().catch(() => { });
|
|
2435
|
+
}
|
|
2426
2436
|
}
|
|
2427
2437
|
}
|
|
2428
2438
|
|
|
@@ -2430,7 +2440,7 @@
|
|
|
2430
2440
|
function updateFullscreenIcon() {
|
|
2431
2441
|
const icon = document.getElementById('fullscreenIcon');
|
|
2432
2442
|
const btn = document.getElementById('fullscreenBtn');
|
|
2433
|
-
if (
|
|
2443
|
+
if (isFullscreen) {
|
|
2434
2444
|
icon.innerHTML = '<path d="M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"/>';
|
|
2435
2445
|
btn.classList.add('active');
|
|
2436
2446
|
} else {
|
|
@@ -2439,32 +2449,36 @@
|
|
|
2439
2449
|
}
|
|
2440
2450
|
}
|
|
2441
2451
|
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2452
|
+
// Apply fullscreen CSS class and touch restrictions
|
|
2453
|
+
function applyFullscreenTouchRestrictions() {
|
|
2454
|
+
document.body.classList.toggle('viewer-fullscreen', isFullscreen);
|
|
2455
|
+
if (isFullscreen) {
|
|
2456
|
+
document.documentElement.style.touchAction = 'pan-y pinch-zoom';
|
|
2457
|
+
document.documentElement.style.overscrollBehavior = 'none';
|
|
2458
|
+
} else {
|
|
2459
|
+
document.documentElement.style.touchAction = '';
|
|
2460
|
+
document.documentElement.style.overscrollBehavior = '';
|
|
2461
|
+
}
|
|
2462
|
+
}
|
|
2446
2463
|
|
|
2447
|
-
//
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2464
|
+
// Listen for fullscreen state from parent (simulated fullscreen)
|
|
2465
|
+
window.addEventListener('message', (event) => {
|
|
2466
|
+
if (event.data && event.data.type === 'pdf-secure-fullscreen-state') {
|
|
2467
|
+
isFullscreen = event.data.isFullscreen;
|
|
2468
|
+
updateFullscreenIcon();
|
|
2469
|
+
applyFullscreenTouchRestrictions();
|
|
2453
2470
|
}
|
|
2454
|
-
lastClickTime = now;
|
|
2455
2471
|
});
|
|
2456
2472
|
|
|
2457
|
-
//
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
container.addEventListener('touchstart', autoFullscreen, { once: true });
|
|
2467
|
-
}
|
|
2473
|
+
// Local fullscreen events (standalone mode)
|
|
2474
|
+
document.addEventListener('fullscreenchange', () => {
|
|
2475
|
+
isFullscreen = !!(document.fullscreenElement || document.webkitFullscreenElement);
|
|
2476
|
+
updateFullscreenIcon();
|
|
2477
|
+
applyFullscreenTouchRestrictions();
|
|
2478
|
+
});
|
|
2479
|
+
|
|
2480
|
+
document.getElementById('fullscreenBtn').onclick = () => toggleFullscreen();
|
|
2481
|
+
|
|
2468
2482
|
|
|
2469
2483
|
// Mouse wheel zoom with Ctrl (debounced, clamped 0.5x-5x)
|
|
2470
2484
|
let zoomTimeout;
|
package/static/viewer.css
CHANGED
|
@@ -1482,3 +1482,15 @@ body {
|
|
|
1482
1482
|
height: 56px;
|
|
1483
1483
|
}
|
|
1484
1484
|
}
|
|
1485
|
+
|
|
1486
|
+
/* ==========================================
|
|
1487
|
+
FULLSCREEN STATE (simulated fullscreen on mobile)
|
|
1488
|
+
========================================== */
|
|
1489
|
+
/* Ensure bottom toolbar is visible and viewer container makes room for it */
|
|
1490
|
+
body.viewer-fullscreen #bottomToolbar {
|
|
1491
|
+
display: block;
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
body.viewer-fullscreen #viewerContainer {
|
|
1495
|
+
bottom: calc(var(--bottom-bar-height) + var(--safe-area-bottom));
|
|
1496
|
+
}
|
package/static/viewer.html
CHANGED
|
@@ -1353,6 +1353,18 @@
|
|
|
1353
1353
|
}
|
|
1354
1354
|
}
|
|
1355
1355
|
|
|
1356
|
+
/* ==========================================
|
|
1357
|
+
FULLSCREEN STATE (simulated fullscreen on mobile)
|
|
1358
|
+
========================================== */
|
|
1359
|
+
/* Ensure bottom toolbar is visible and viewer container makes room for it */
|
|
1360
|
+
body.viewer-fullscreen #bottomToolbar {
|
|
1361
|
+
display: block;
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
body.viewer-fullscreen #viewerContainer {
|
|
1365
|
+
bottom: calc(var(--bottom-bar-height) + var(--safe-area-bottom));
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1356
1368
|
/* ==========================================
|
|
1357
1369
|
TABLET BREAKPOINT (600px - 1024px)
|
|
1358
1370
|
========================================== */
|
|
@@ -4463,6 +4475,7 @@
|
|
|
4463
4475
|
|
|
4464
4476
|
// Apply touch restrictions when entering/exiting fullscreen
|
|
4465
4477
|
function applyFullscreenTouchRestrictions() {
|
|
4478
|
+
document.body.classList.toggle('viewer-fullscreen', isFullscreen);
|
|
4466
4479
|
if (isFullscreen) {
|
|
4467
4480
|
document.documentElement.style.touchAction = 'pan-y pinch-zoom';
|
|
4468
4481
|
document.documentElement.style.overscrollBehavior = 'none';
|