Skip to content

armgit / Pake

Public Imported from GitHub
0

Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.

docs: add auto-refresh inject example to faq

Tw937604e58503c4
diff --git a/docs/faq.md b/docs/faq.md
index 3f7a88a2..9cd5cd37 100644
--- a/docs/faq.md
+++ b/docs/faq.md
@@ -352,6 +352,33 @@ This is usually due to web compatibility issues. Try:
pake https://example.com --inject ./fix.js
```
+ For pages that need periodic reloads, you can keep this behavior in a small injected script instead of adding a dedicated Pake option:
+
+ ```javascript
+ function isEditing(element) {
+ if (!element) return false;
+ const tagName = element.tagName;
+ return (
+ element.isContentEditable ||
+ tagName === "INPUT" ||
+ tagName === "TEXTAREA" ||
+ tagName === "SELECT"
+ );
+ }
+
+ setInterval(() => {
+ if (!document.hidden && !isEditing(document.activeElement)) {
+ window.location.reload();
+ }
+ }, 300000);
+ ```
+
+ Save it as `refresh.js` and package with:
+
+ ```bash
+ pake https://news.ycombinator.com --name HackerNews --inject ./refresh.js
+ ```
+
3. **Check if the site requires specific permissions** that may not be available in WebView
---
diff --git a/docs/faq_CN.md b/docs/faq_CN.md
index d4549cb2..cccf004e 100644
--- a/docs/faq_CN.md
+++ b/docs/faq_CN.md
@@ -352,6 +352,33 @@ Pake 可以自动转换图标,但提供正确的格式更可靠。
pake https://example.com --inject ./fix.js
```
+ 对于需要定时刷新的页面,建议把这类行为放在一个小的注入脚本里,而不是增加专门的 Pake 参数:
+
+ ```javascript
+ function isEditing(element) {
+ if (!element) return false;
+ const tagName = element.tagName;
+ return (
+ element.isContentEditable ||
+ tagName === "INPUT" ||
+ tagName === "TEXTAREA" ||
+ tagName === "SELECT"
+ );
+ }
+
+ setInterval(() => {
+ if (!document.hidden && !isEditing(document.activeElement)) {
+ window.location.reload();
+ }
+ }, 300000);
+ ```
+
+ 将其保存为 `refresh.js`,然后这样打包:
+
+ ```bash
+ pake https://news.ycombinator.com --name HackerNews --inject ./refresh.js
+ ```
+
3. **检查网站是否需要 WebView 中可能不可用的特定权限**
---