Skip to content

Commit

Permalink
docs: img
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Apr 6, 2024
1 parent 3de227c commit c05d1a5
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 10 deletions.
2 changes: 1 addition & 1 deletion api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ export interface RawGlobalRuleProps {
* 示例2-点击目标节点的右上区域
* - [快照-1](https://i.gkd.li/i/14112390)
* - [快照-2](https://i.gkd.li/i/14319672)
* - [图片-1](https://github.com/gkd-kit/gkd/assets/38517192/2cac0614-5eba-48a1-9149-4e564cb79945)
* - [图片-1](https://a.gkd.li/0019.gif)
* ```json5
* {
* right: 'width*0.1352',
Expand Down
18 changes: 18 additions & 0 deletions docs/.vitepress/plugins/mirror.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ export const mirror = (): Plugin | undefined => {
};
};

const imageAssetVersion = await fetch(
'https://registry.npmmirror.com/@gkd-kit/assets/latest/files/package.json',
).then((r) => r.json().then((j) => j.version as string));

export const transformHtml = (code: string) => {
if (!useMirror) return;
const doc = parseDocument(code);
Expand All @@ -89,5 +93,19 @@ export const transformHtml = (code: string) => {
links.forEach((e) => {
e.attribs.href = mirrorBaseUrl + e.attribs.href;
});

const images = DomUtils.findAll((e) => {
return (
e.name === 'img' &&
!!e.attribs.src &&
e.attribs.src.startsWith('https://a.gkd.li/')
);
}, doc.children);
images.forEach((e) => {
e.attribs.src = e.attribs.src.replace(
'https://a.gkd.li/',
`https://registry.npmmirror.com/@gkd-kit/assets/${imageAssetVersion}/files/assets/`,
);
});
return render(doc, { encodeEntities: false });
};
7 changes: 7 additions & 0 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ const zoomImages = () => {
.forEach((v) => {
images.push(v);
});
document
.querySelectorAll<HTMLImageElement>(
'img[src^="https://registry.npmmirror.com/@gkd-kit/assets/"]',
)
.forEach((v) => {
images.push(v);
});

for (const img of images) {
if (!img.getAttribute('zoom-inited')) {
Expand Down
8 changes: 4 additions & 4 deletions docs/faq/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

| | | | |
| --------------------------------------- | --------------------------------------- | --------------------------------------- | --------------------------------------- |
| ![image](https://a.gkd.li/png/0013.png) | ![image](https://a.gkd.li/png/0014.png) | ![image](https://a.gkd.li/png/0015.png) | ![image](https://a.gkd.li/png/0016.png) |
| ![image](https://a.gkd.li/png/0017.png) | ![image](https://a.gkd.li/png/0018.png) | | |
| ![image](https://a.gkd.li/0013.png) | ![image](https://a.gkd.li/0014.png) | ![image](https://a.gkd.li/0015.png) | ![image](https://a.gkd.li/0016.png) |
| ![image](https://a.gkd.li/0017.png) | ![image](https://a.gkd.li/0018.png) | | |

如果您按照以上步骤设置后回到 无障碍列表 仍然提示不可用, 您可以试试 **重启手机**, 此解决方案来自 [Herobrine2005928](https://github.com/orgs/gkd-kit/discussions/433#discussioncomment-8899920)

Expand All @@ -42,7 +42,7 @@

| | |
| --------------------------------------- | --------------------------------------- |
| ![image](https://a.gkd.li/png/0004.png) | ![image](https://a.gkd.li/png/0005.png) |
| ![image](https://a.gkd.li/0004.png) | ![image](https://a.gkd.li/0005.png) |

你可能已经看到这个界面还有一个开关, 也就是下方的 `快捷方式` 开关

Expand All @@ -54,4 +54,4 @@

| | | | |
| --------------------------------------- | --------------------------------------- | --------------------------------------- | --------------------------------------- |
| ![image](https://a.gkd.li/png/0009.png) | ![image](https://a.gkd.li/png/0010.png) | ![image](https://a.gkd.li/png/0011.png) | ![image](https://a.gkd.li/png/0012.png) |
| ![image](https://a.gkd.li/0009.png) | ![image](https://a.gkd.li/0010.png) | ![image](https://a.gkd.li/0011.png) | ![image](https://a.gkd.li/0012.png) |
4 changes: 2 additions & 2 deletions docs/guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import { apkUrl, apkName, apkImgUrl } from '/.vitepress/utils/apk';

| | | | |
| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| ![image](https://a.gkd.li/png/0001.png) | ![image](https://a.gkd.li/png/0002.png) | ![image](https://a.gkd.li/png/0003.png) | ![image](https://a.gkd.li/png/0004.png) |
| ![image](https://a.gkd.li/png/0005.png) | ![image](https://a.gkd.li/png/0006.png) | ![image](https://a.gkd.li/png/0007.png) | ![image](https://a.gkd.li/png/0008.png) |
| ![image](https://a.gkd.li/0001.png) | ![image](https://a.gkd.li/0002.png) | ![image](https://a.gkd.li/0003.png) | ![image](https://a.gkd.li/0004.png) |
| ![image](https://a.gkd.li/0005.png) | ![image](https://a.gkd.li/0006.png) | ![image](https://a.gkd.li/0007.png) | ![image](https://a.gkd.li/0008.png) |

如果您的手机的无障碍列表界面无法授权 GKD 或者显示 `受限制的设置(出于安全考虑,此设置目前不可用)`

Expand Down
16 changes: 13 additions & 3 deletions docs/selector/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,13 @@ import ValueField from '/.vitepress/components/ValueField.vue';

## 关系选择器 {#connect}

关系选择器 由 关系操作符 和 关系表达式 构成, 用于连接两个属性选择器, 简单示例: `div > a`, 它 表示/约束 两个节点之间的关系
关系选择器 由 关系操作符 和 关系表达式 构成, 用于连接两个属性选择器

简单示例: `div > a`, 它 表示/约束 两个节点之间的关系, 下面介绍 [关系操作符](#connect-operator)[关系表达式](#connect-exp)

### 关系表达式 {#connect-exp}

关系表达式 有两种
关系表达式 表示查找节点的范围, 有两种

- 元组表达式 `(a1,a2,a3,a_n)`, 其中 a1, a2, a3, a_n 是常量有序递增正整数, 示例 `(1)`, `(2,3,5)`
- 多项式表达式 `(an+b)`, 其中 a 和 b 是常量整数, 它是元组表达式的另一种表示, 这个元组的数字满足集合 `{an+b|an+b>=1,n>=1}` 如果集合为空集则表达式非法\
Expand All @@ -141,6 +143,14 @@ import ValueField from '/.vitepress/components/ValueField.vue';

关系操作符 表示查找节点的方向, 有 5 种关系操作符, `+`, `-`, `>`, `<`, `<<`

| 操作符 | 名称 | 图例 | 选择器 |
| :----: | :----------: | :------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------: |
| + | 前置兄弟节点 | ![image](https://a.gkd.li/0020.png){width=250} | [\* + \[\_id=33\]](https://i.gkd.li/i/14045424?gkd=KiArIFtfaWQ9MzNd) |
| - | 后置兄弟节点 | ![image](https://a.gkd.li/0021.png){width=250} | [\* - \[\_id=32\]](https://i.gkd.li/i/14045424?gkd=KiAtIFtfaWQ9MzJd) |
| > | 祖先节点 | ![image](https://a.gkd.li/0022.png){width=250} | [\* > \[\_id=90\]](https://i.gkd.li/i/14045424?gkd=KiA-IFtfaWQ9OTBd) |
| < | 直接子节点 | ![image](https://a.gkd.li/0023.png){width=250} | [\* < \[\_id=89\]](https://i.gkd.li/i/14045424?gkd=KiA8IFtfaWQ9ODld) |
| << | 子孙节点 | ![image](https://a.gkd.li/0024.png){width=250} | [\* <<2 \[\_id=29\]](https://i.gkd.li/i/14045424?gkd=KiA8PDIgW19pZD0yOV0) |

将 关系操作符 和 关系表达式 连接起来就得到了 关系选择器

`A +(a1,a2,a3,a_n) B` : A 是 B 的前置兄弟节点, 并且 A.index 满足 B.index-(a_m), 其中 a_m 是元组的任意一个数字
Expand Down Expand Up @@ -217,7 +227,7 @@ TextView[id=`com.byted.pangle:id/tt_item_tv`][text=`不感兴趣`] <n LinearLayo

Kotlin Wasm 需要你的浏览器支持 [WasmGC](https://developer.chrome.com/blog/wasmgc?hl=zh-cn), 也就是版本需要满足下列条件

![image](https://github.com/gkd-kit/gkd/assets/38517192/15c8dee9-6480-428b-be4f-45939b4046e5)
![image](https://a.gkd.li/0025.png)

如果你的浏览器版本不满足, 正则表达式将自动回退到 Js 端实现, 以下是在 Js 端使用正则表达式需要注意的地方

Expand Down

0 comments on commit c05d1a5

Please sign in to comment.