From b5ed00a9f13a3b23d66c1464222ade4d711a60d7 Mon Sep 17 00:00:00 2001 From: Dan Cojocaru Date: Sun, 22 Jan 2023 09:55:36 +0100 Subject: [PATCH] Embed header in window controls overlay --- about.html | 1 + base.css | 38 ++++++++++++++++++++++++++++++++++++++ index.html | 7 ++++++- manifest.json | 1 + route.html | 3 ++- showcase.html | 3 ++- station.html | 3 ++- sw.js | 8 +++++--- train.html | 3 ++- view-station.html | 4 +++- view-train.html | 4 +++- 11 files changed, 65 insertions(+), 10 deletions(-) diff --git a/about.html b/about.html index 5b836da..4d3d7dc 100644 --- a/about.html +++ b/about.html @@ -21,6 +21,7 @@

About

+

InfoTren

diff --git a/base.css b/base.css index 63a6639..197f32e 100644 --- a/base.css +++ b/base.css @@ -72,10 +72,41 @@ footer .rsk { } header { + position: fixed; + left: env(titlebar-area-x, 0); + top: env(titlebar-area-y, 0); + width: env(titlebar-area-width, 100%); + height: env(titlebar-area-height, 36px); + -webkit-app-region: drag; + app-region: drag; + display: flex; align-items: center; } +.header-placeholder { + margin-top: env(titlebar-area-height, 36px); +} + +header.embedded { + background-color: #0000ff; + color: white; +} + +@media (display-mode: window-controls-overlay) { + header { + background-color: #0000ff; + color: white; + } + + header .back { + -webkit-app-region: no-drag; + app-region: no-drag; + + filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(83deg) brightness(104%) contrast(101%); + } +} + header .left, header .right { flex-grow: 1; flex-basis: 0; @@ -87,6 +118,13 @@ header .back { cursor: pointer; } +header.embedded .back { + -webkit-app-region: no-drag; + app-region: no-drag; + + filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(83deg) brightness(104%) contrast(101%); +} + h1 { font-size: 17px; font-weight: 400; diff --git a/index.html b/index.html index 5b87f32..3cbe8db 100644 --- a/index.html +++ b/index.html @@ -16,7 +16,12 @@ -

InfoTren

+
+
+

InfoTren

+
+
+
    diff --git a/manifest.json b/manifest.json index 8b998e1..eb0eea4 100644 --- a/manifest.json +++ b/manifest.json @@ -7,6 +7,7 @@ "background_color": "#ffffff", "display": "standalone", "display_override": [ + "window-controls-overlay", "standalone", "minimal-ui" ], diff --git a/route.html b/route.html index f2e4a8b..9801a28 100644 --- a/route.html +++ b/route.html @@ -20,11 +20,12 @@
    - + Back

    Find Route

    +
    diff --git a/showcase.html b/showcase.html index fb07010..0954ffc 100644 --- a/showcase.html +++ b/showcase.html @@ -14,11 +14,12 @@
    - + Back

    Showcase

    +

    h1

    diff --git a/station.html b/station.html index 0b6057c..7c2b858 100644 --- a/station.html +++ b/station.html @@ -18,11 +18,12 @@
    - + Back

    Station Information

    +

    diff --git a/sw.js b/sw.js index aad7573..8c7c75c 100755 --- a/sw.js +++ b/sw.js @@ -1,4 +1,4 @@ -const VERSION = 'v28' +const VERSION = 'v29' const API_ORIGIN = 'https://scraper.infotren.dcdev.ro/' const API_TRAINS = `${API_ORIGIN}v3/trains` const API_STATIONS = `${API_ORIGIN}v3/stations` @@ -49,7 +49,7 @@ const CACHE_FIRST = [ // API API_TRAINS, API_STATIONS, - API_ITINERARIES, + // API_ITINERARIES, ]; /** @@ -61,7 +61,9 @@ function shouldReturnFromCacheFirst(url) { } self.addEventListener('install', (event) => { - self.skipInstall() + if ('skipInstall' in self) { + self.skipInstall() + } event.waitUntil( caches .open(VERSION) diff --git a/train.html b/train.html index 3cb0b70..cd4cca5 100644 --- a/train.html +++ b/train.html @@ -19,11 +19,12 @@
    - + Back

    Train Information

    +

    diff --git a/view-station.html b/view-station.html index e2855d3..a3f180b 100644 --- a/view-station.html +++ b/view-station.html @@ -21,11 +21,13 @@
    - + Back

    View Station

    +
    +