vers. 3.0.2 - iPhone: il guscio riempie davvero lo schermo
Su iOS 26 (app installata) la finestra riportata al sito è più corta dello schermo di circa 60 punti, anche se la WebView lo copre tutto: vh, dvh e position: fixed lasciavano una fascia vuota sotto la tab bar. Ora js/app.js misura lo schermo e imposta l'altezza del guscio (--shell-h) solo su iPhone in modalità installata e a schermo intero. Player, banner PWA, finestra istruzioni, avviso offline e barra di avanzamento sono figli del guscio con position: absolute, così seguono il guscio e non il viewport. Cache del service worker v8. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
3aa7130880
commit
3cbffd5423
5 files changed
+58
-10
No files matched your search
+9
-7
@@ -245,11 +245,13 @@ button {
|
|||||||
|
|
||||||
/* Ancorato ai bordi dello schermo: su iOS (app installata, barra di stato trasparente) le altezze in vh/dvh
|
/* Ancorato ai bordi dello schermo: su iOS (app installata, barra di stato trasparente) le altezze in vh/dvh
|
||||||
possono risultare più corte dello schermo e lasciare una fascia vuota sotto la tab bar */
|
possono risultare più corte dello schermo e lasciare una fascia vuota sotto la tab bar */
|
||||||
|
/* Tutto ciò che è "fisso" (player, banner, overlay, barra di avanzamento) è figlio del guscio con position: absolute:
|
||||||
|
segue il guscio, non il viewport. Su iPhone (app installata) iOS 26 riporta un viewport più corto dello schermo:
|
||||||
|
js/app.js misura lo schermo e imposta --shell-h, che qui ha la precedenza su bottom: 0. */
|
||||||
.app-shell {
|
.app-shell {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
/* Nessuna altezza esplicita: con top e bottom impostati un'altezza avrebbe la precedenza su bottom
|
height: var(--shell-h, auto);
|
||||||
e riporterebbe il valore sbagliato di iOS */
|
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-rows: auto minmax(0, 1fr) auto;
|
grid-template-rows: auto minmax(0, 1fr) auto;
|
||||||
grid-template-areas: "top" "main" "tab";
|
grid-template-areas: "top" "main" "tab";
|
||||||
@@ -474,7 +476,7 @@ button {
|
|||||||
|
|
||||||
/* Barra di avanzamento durante il cambio pagina */
|
/* Barra di avanzamento durante il cambio pagina */
|
||||||
.route-progress {
|
.route-progress {
|
||||||
position: fixed;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
height: 3px;
|
height: 3px;
|
||||||
@@ -1704,7 +1706,7 @@ iframe.contentplayer {
|
|||||||
|
|
||||||
/* Barra a tutta larghezza, agganciata in basso: sopra la tab bar su telefono, accanto alla sidebar su computer */
|
/* Barra a tutta larghezza, agganciata in basso: sopra la tab bar su telefono, accanto alla sidebar su computer */
|
||||||
.player-dock {
|
.player-dock {
|
||||||
position: fixed;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: calc(var(--tabbar-h) + var(--safe-bottom));
|
bottom: calc(var(--tabbar-h) + var(--safe-bottom));
|
||||||
@@ -2101,7 +2103,7 @@ iframe.contentplayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.pwa-install-banner {
|
.pwa-install-banner {
|
||||||
position: fixed;
|
position: absolute;
|
||||||
left: 8px;
|
left: 8px;
|
||||||
right: 8px;
|
right: 8px;
|
||||||
bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 8px);
|
bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 8px);
|
||||||
@@ -2166,7 +2168,7 @@ body.has-player .pwa-install-banner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.pwa-modal-overlay {
|
.pwa-modal-overlay {
|
||||||
position: fixed;
|
position: absolute;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
z-index: 110000;
|
z-index: 110000;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -2291,7 +2293,7 @@ body.has-player .pwa-install-banner {
|
|||||||
|
|
||||||
/* Offline */
|
/* Offline */
|
||||||
.offline-overlay {
|
.offline-overlay {
|
||||||
position: fixed;
|
position: absolute;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
z-index: 999999;
|
z-index: 999999;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -2,6 +2,14 @@
|
|||||||
|
|
||||||
<changelog>
|
<changelog>
|
||||||
|
|
||||||
|
<version>
|
||||||
|
<number>3.0.2</number>
|
||||||
|
<logs>
|
||||||
|
<log>iPhone (app installata): su iOS 26 la finestra riportata al sito è più corta dello schermo e sotto la barra delle sezioni restava una fascia vuota. Ora l'app misura lo schermo e si adatta da sola; player, banner e avvisi seguono il guscio dell'app.</log>
|
||||||
|
</logs>
|
||||||
|
</version>
|
||||||
|
|
||||||
|
|
||||||
<version>
|
<version>
|
||||||
<number>3.0.1</number>
|
<number>3.0.1</number>
|
||||||
<logs>
|
<logs>
|
||||||
|
|||||||
@@ -758,7 +758,7 @@
|
|||||||
'<button type="button" class="btn btn-accent btn-lg offline-btn" id="offlineRetryBtn">' +
|
'<button type="button" class="btn btn-accent btn-lg offline-btn" id="offlineRetryBtn">' +
|
||||||
'<svg class="icon" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/></svg>' +
|
'<svg class="icon" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/></svg>' +
|
||||||
'<span>Riprova</span></button></div>';
|
'<span>Riprova</span></button></div>';
|
||||||
body.appendChild(overlay);
|
(document.getElementById('app') || body).appendChild(overlay);
|
||||||
|
|
||||||
var btn = $('#offlineRetryBtn');
|
var btn = $('#offlineRetryBtn');
|
||||||
btn.addEventListener('click', function () {
|
btn.addEventListener('click', function () {
|
||||||
@@ -814,8 +814,45 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* iPhone, app installata: iOS 26 riporta una finestra più corta dello schermo (di circa l'altezza della barra
|
||||||
|
* di Safari) anche se la WebView copre tutto lo schermo. vh, dvh e position: fixed seguono quel valore e sotto
|
||||||
|
* la tab bar resta una fascia vuota. Qui si misura lo schermo e si dà al guscio la sua altezza vera (--shell-h).
|
||||||
|
*/
|
||||||
|
var Schermo = {
|
||||||
|
iphone: /iPhone|iPod/.test(navigator.userAgent),
|
||||||
|
standalone: function () {
|
||||||
|
return navigator.standalone === true || (window.matchMedia && window.matchMedia('(display-mode: standalone)').matches);
|
||||||
|
},
|
||||||
|
adatta: function () {
|
||||||
|
var root = document.documentElement;
|
||||||
|
if (!this.iphone || !this.standalone()) { root.style.removeProperty('--shell-h'); return; }
|
||||||
|
var portrait = window.innerHeight >= window.innerWidth;
|
||||||
|
var screenH = portrait ? Math.max(screen.width, screen.height) : Math.min(screen.width, screen.height);
|
||||||
|
var screenW = portrait ? Math.min(screen.width, screen.height) : Math.max(screen.width, screen.height);
|
||||||
|
var h = window.innerHeight;
|
||||||
|
var differenza = screenH - h;
|
||||||
|
// Solo a schermo intero e per uno scarto "da barra" (fino a 140 pt): altrimenti si lascia fare al CSS
|
||||||
|
if (window.innerWidth === screenW && differenza > 2 && differenza <= 140) {
|
||||||
|
root.style.setProperty('--shell-h', screenH + 'px');
|
||||||
|
} else {
|
||||||
|
root.style.removeProperty('--shell-h');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
init: function () {
|
||||||
|
var self = this;
|
||||||
|
var aggiorna = function () { self.adatta(); };
|
||||||
|
aggiorna();
|
||||||
|
window.addEventListener('resize', aggiorna);
|
||||||
|
window.addEventListener('orientationchange', function () { setTimeout(aggiorna, 300); });
|
||||||
|
window.addEventListener('pageshow', aggiorna);
|
||||||
|
if (window.visualViewport) window.visualViewport.addEventListener('resize', aggiorna);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
if (!content || gusciVecchio()) return;
|
if (!content || gusciVecchio()) return;
|
||||||
|
Schermo.init();
|
||||||
Offline.init();
|
Offline.init();
|
||||||
Player.init();
|
Player.init();
|
||||||
Podcast.init();
|
Podcast.init();
|
||||||
|
|||||||
+2
-1
@@ -120,7 +120,6 @@ $legal = rpi_legal_links();
|
|||||||
<audio id="radio-audio" preload="none"></audio>
|
<audio id="radio-audio" preload="none"></audio>
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- PWA: invito a installare (telefono) -->
|
<!-- PWA: invito a installare (telefono) -->
|
||||||
<div id="pwa-install-banner" class="pwa-install-banner" hidden>
|
<div id="pwa-install-banner" class="pwa-install-banner" hidden>
|
||||||
@@ -162,3 +161,5 @@ $legal = rpi_legal_links();
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div><!-- /.app-shell -->
|
||||||
Reference in new issue
Block a user