From 633b7a224339bdec21169740fc3077442d66d6db Mon Sep 17 00:00:00 2001
From: ACTCD <101378590+ACTCD@users.noreply.github.com>
Date: Tue, 16 Jul 2024 07:54:28 +0800
Subject: [PATCH 1/4] feat: add ios app webview dynamic type support
---
src/app/App.svelte | 68 +++++++++++++--------------
src/app/app.css | 30 ++++++++++++
xcode/App-Shared/ViewController.swift | 2 +-
3 files changed, 63 insertions(+), 37 deletions(-)
diff --git a/src/app/App.svelte b/src/app/App.svelte
index ea20d80c..7d4c50c6 100644
--- a/src/app/App.svelte
+++ b/src/app/App.svelte
@@ -31,33 +31,36 @@
+
+
- You can turn on the Userscripts iOS Safari extension in Settings.
+ You can turn on the Userscripts iOS Safari extension in Settings or Safari,
+ then use the extension in Safari.
+
- Read the docs.
+ Read online documentation
@@ -76,7 +79,7 @@
flex-direction: column;
height: 100%;
justify-content: center;
- padding: 0 1rem;
+ padding: 16px;
text-align: center;
-webkit-touch-callout: none;
user-select: none;
@@ -87,27 +90,22 @@
}
.icon {
- height: 8rem;
- width: 8rem;
+ margin-top: 80px;
+ height: min(8rem, 256px);
+ width: min(8rem, 256px);
}
.logo {
align-items: flex-end;
display: flex;
- margin: 1rem 0;
+ margin: min(1rem, 32px) 0;
}
.logo :global(svg) {
- height: 1.5rem;
- }
-
- .logo > span {
- text-align: left;
- min-width: 3.5rem;
- margin-left: 0.5rem;
+ height: min(1.5rem, 32px);
}
- .logo span,
+ .version,
.current {
color: var(--text-color-disabled);
font: var(--text-small);
@@ -123,7 +121,7 @@
font: var(--text-default);
font-weight: 500;
letter-spacing: var(--letter-spacing-default);
- margin: 2rem 0 1rem;
+ margin: 2rem 0;
padding: 0.5rem 1rem;
}
@@ -137,8 +135,6 @@
font-size: 0.875rem;
font-weight: 400;
word-break: break-all;
- min-height: 7rem;
- max-height: 10rem;
}
#directory button {
diff --git a/src/app/app.css b/src/app/app.css
index 2eaa3de0..a5d041a3 100644
--- a/src/app/app.css
+++ b/src/app/app.css
@@ -15,6 +15,36 @@ body {
-webkit-font-smoothing: antialiased;
}
+/* ios */
+@supports (-webkit-touch-callout: none) {
+ html {
+ height: auto;
+ overflow: visible;
+ overscroll-behavior: none;
+ }
+
+ /**
+ * Dynamic Type
+ * https://support.apple.com/102453
+ * https://webkit.org/blog/3709/using-the-system-font-in-web-content/
+ * https://developer.apple.com/library/archive/releasenotes/General/WhatsNewInSafari/Articles/Safari_7_0.html#//apple_ref/doc/uid/TP40014305-CH5-SW10
+ * https://github.com/w3c/csswg-drafts/issues/3708
+ */
+ @supports (font: -apple-system-body) {
+ html {
+ /* stylelint-disable-next-line font-family-no-missing-generic-family-keyword */
+ font: -apple-system-body; /* default 17px */
+ }
+ }
+
+ /* Avoid page zoom */
+ input,
+ textarea,
+ select {
+ font-size: max(1rem, 16px);
+ }
+}
+
@media screen and (height <= 400px) {
html {
font-size: 80%;
diff --git a/xcode/App-Shared/ViewController.swift b/xcode/App-Shared/ViewController.swift
index 15430135..ff51fb9d 100644
--- a/xcode/App-Shared/ViewController.swift
+++ b/xcode/App-Shared/ViewController.swift
@@ -27,7 +27,7 @@ class ViewController: UIViewController, WKNavigationDelegate, WKScriptMessageHan
logger?.debug("\(#function, privacy: .public) - DEBUG mode: isInspectable = true")
#endif
view = webView
- self.webView.scrollView.isScrollEnabled = false
+// self.webView.scrollView.isScrollEnabled = false
self.webView.isOpaque = false
let backgroundColor = UIColor.init(red: (47/255.0), green: (51/255.0), blue: (55/255.0), alpha: 1.0)
view.setValue(backgroundColor, forKey: "backgroundColor")
From eacf635b5f2273091644b51ebbafbed6dae49b68 Mon Sep 17 00:00:00 2001
From: ACTCD <101378590+ACTCD@users.noreply.github.com>
Date: Tue, 16 Jul 2024 19:49:24 +0800
Subject: [PATCH 2/4] feat: add footer links and improve phrase
---
src/app/App.svelte | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/src/app/App.svelte b/src/app/App.svelte
index 7d4c50c6..ccd6efb1 100644
--- a/src/app/App.svelte
+++ b/src/app/App.svelte
@@ -54,14 +54,11 @@
You can turn on the Userscripts iOS Safari extension in Settings or Safari,
- then use the extension in Safari.
-
+ then use the extension in Safari. Please refer to the "Usage" section in the
- Read online documentation
-
+ .GIT_TAG ?? 'main'}/README.md#usage">README of this version.
Change Userscripts Directory
@@ -70,6 +67,20 @@
{directory}
+
From fee7589e02a0982a70ed9c9b8fe9fd45853c9cfb Mon Sep 17 00:00:00 2001
From: ACTCD <101378590+ACTCD@users.noreply.github.com>
Date: Wed, 17 Jul 2024 03:38:07 +0800
Subject: [PATCH 3/4] refactor: completely re-layout the entire page
---
src/app/App.svelte | 145 +++++++++++++++++++++++----------------------
1 file changed, 74 insertions(+), 71 deletions(-)
diff --git a/src/app/App.svelte b/src/app/App.svelte
index ccd6efb1..7c17951c 100644
--- a/src/app/App.svelte
+++ b/src/app/App.svelte
@@ -2,6 +2,8 @@
import icon from "./img/icon.png";
import logo from "./img/logo.svg?raw";
+ const baseUrl = "https://github.com/quoid/userscripts";
+
let version = "v0.0.0";
let build = "(0)";
let directory = "init";
@@ -27,96 +29,106 @@
-
-
+
+
- {@html logo}
+
{@html logo}
+
-
- {#if import.meta.env.GIT_TAG && import.meta.env.GIT_COMMIT}
+
+
+ You can turn on the Userscripts iOS Safari extension in Settings or
+ Safari, then use the extension in Safari. Please refer to the "Usage"
+ section in the
- {import.meta.env.GIT_TAG}
-
- (
- {import.meta.env.GIT_COMMIT.slice(0, 7)}
- )
- {:else}
- {version}
- {build}
- {/if}
+ href="${baseUrl}/blob/{import.meta.env.GIT_TAG ??
+ 'main'}/README.md#usage">README of this version.
+
-
-
- You can turn on the Userscripts iOS Safari extension in Settings or Safari,
- then use the extension in Safari. Please refer to the "Usage" section in the
- README of this version .
-
-
- Change Userscripts Directory
-
-
CURRENT DIRECTORY:
-
-
{directory}
+
+
+ Change Userscripts Directory
+
+
CURRENT DIRECTORY:
+
+ {directory}
+
-