- DeepLinkRouter als pure-Logic-Enum aus RootView extrahiert (resolveToWebURL, isExplorePath, route) - 11 DeepLinkRouterTests grün: custom-scheme, https passthrough, Erkunden-vs-Lesen-Routing, Substring-Guard - WebShellScripts.hideWebHeader: WKUserScript injiziert at document.start CSS, das den zitare-Web-Header (body header:has(a.brand)) ausblendet. Native TabBar übernimmt globale Navigation, Content bleibt sichtbar. - Simulator-Verifikation: Quote rendert ohne doppelte Nav-Leiste, 17 (UI + Unit) Tests grün Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
30 lines
1.1 KiB
Swift
30 lines
1.1 KiB
Swift
import Foundation
|
|
import WebKit
|
|
|
|
/// User-Scripts, die in jeden `WKWebView` injiziert werden.
|
|
///
|
|
/// `WKUserScript` ist MainActor-isolated; deshalb sind die Factory-
|
|
/// Methoden hier ebenfalls MainActor. Aufrufer leben sowieso auf Main
|
|
/// (SwiftUI `makeUIView`/`makeNSView` sind MainActor).
|
|
@MainActor
|
|
enum WebShellScripts {
|
|
/// Versteckt den zitare-Web-Header (`<header>` mit `<a class="brand">`),
|
|
/// weil die native TabBar bereits global navigiert. Footer und
|
|
/// Hauptinhalt bleiben sichtbar.
|
|
///
|
|
/// CSS wird at document.start als `<style>`-Tag injiziert — vor dem
|
|
/// First Paint, kein Flicker.
|
|
static let hideWebHeader: WKUserScript = .init(
|
|
source: """
|
|
(function() {
|
|
var css = 'body header:has(a.brand) { display: none !important; }';
|
|
var style = document.createElement('style');
|
|
style.setAttribute('data-zitare-native', 'hide-web-header');
|
|
style.textContent = css;
|
|
(document.head || document.documentElement).appendChild(style);
|
|
})();
|
|
""",
|
|
injectionTime: .atDocumentStart,
|
|
forMainFrameOnly: true
|
|
)
|
|
}
|