Loading...
Loading...
Compare original and translation side by side
tokenizedHtmltokenizedHtml/page-reduce <URL>--phase1-only--output <dir>/page-reduce <URL>--phase1-only--output <dir>if [[ -n "${CLAUDE_SKILL_DIR:-}" ]]; then
BUNDLE="${CLAUDE_SKILL_DIR}/scripts/page-reduce-bundle.js"
else
BUNDLE="$(find ~/.claude \
-path "*/page-reduce/scripts/page-reduce-bundle.js" \
-type f 2>/dev/null | head -1)"
fiif [[ -n "${CLAUDE_SKILL_DIR:-}" ]]; then
BUNDLE="${CLAUDE_SKILL_DIR}/scripts/page-reduce-bundle.js"
else
BUNDLE="$(find ~/.claude \
-path "*/page-reduce/scripts/page-reduce-bundle.js" \
-type f 2>/dev/null | head -1)"
fiplaywright-cliplaywright-cli --helpplaywright-cliplaywright-cli --helpplaywright-cli openpage-prep[...document.body.querySelectorAll('*')].forEach(el => {
const s = window.getComputedStyle(el);
if (s.position === 'fixed' || s.position === 'sticky')
el.style.position = 'relative';
});playwright-cli openpage-prep[...document.body.querySelectorAll('*')].forEach(el => {
const s = window.getComputedStyle(el);
if (s.position === 'fixed' || s.position === 'sticky')
el.style.position = 'relative';
});initScript--configwindow.__reduceResultevalREDUCE_CONFIG="/tmp/reduce-config-$$.json"
BOOTSTRAP="/tmp/reduce-bootstrap-$$.js"--configinitScriptwindow.__reduceResultevalREDUCE_CONFIG="/tmp/reduce-config-$$.json"
BOOTSTRAP="/tmp/reduce-bootstrap-$$.js"
Parse the returned JSON:
```json
{
"url": "...", "title": "...", "viewport": { "width": 1280 }, "templateHash": "...",
"sections": [{ "index": 0, "sectionType": "hero", "xpath": "...", "tokenizedHtml": "...",
"layout": { "numCols": 2, "numRows": 1 }, "features": ["hasHeading", "hasCTA"] }]
}--phase1-onlyphase1-output.json
解析返回的JSON:
```json
{
"url": "...", "title": "...", "viewport": { "width": 1280 }, "templateHash": "...",
"sections": [{ "index": 0, "sectionType": "hero", "xpath": "...", "tokenizedHtml": "...",
"layout": { "numCols": 2, "numRows": 1 }, "features": ["hasHeading", "hasCTA"] }]
}--phase1-onlyphase1-output.jsontokenizedHtml{REPEAT:N}data-analytics-*{FORM:N-fields}{NAV:N-items}{REPEAT:N}unknowntabstokenizedHtml{REPEAT:N}data-analytics-*{FORM:N-fields}{NAV:N-items}{REPEAT:N}unknowntabs<!-- section:0 type:hero xpath:/html/body/main/section[1] -->
<section class="hero">
<h1>{HEADING:1}</h1>
<p>{TEXT}</p>
{CTA:Get Started}
{IMAGE:1200x600}
</section>
<!-- section:1 type:cards xpath:/html/body/main/div[2] -->
<div class="cards-container">
<div class="card">
{IMAGE:400x300}
<h3>{HEADING:3}</h3>
<p>{TEXT}</p>
<a>{LINK:Read more}</a>
</div>
<div class="card">
{IMAGE:400x300}
<h3>{HEADING:3}</h3>
<p>{TEXT}</p>
<a>{LINK:Read more}</a>
</div>
{REPEAT:4}
</div><!-- section:0 type:hero xpath:/html/body/main/section[1] -->
<section class="hero">
<h1>{HEADING:1}</h1>
<p>{TEXT}</p>
{CTA:Get Started}
{IMAGE:1200x600}
</section>
<!-- section:1 type:cards xpath:/html/body/main/div[2] -->
<div class="cards-container">
<div class="card">
{IMAGE:400x300}
<h3>{HEADING:3}</h3>
<p>{TEXT}</p>
<a>{LINK:Read more}</a>
</div>
<div class="card">
{IMAGE:400x300}
<h3>{HEADING:3}</h3>
<p>{TEXT}</p>
<a>{LINK:Read more}</a>
</div>
{REPEAT:4}
</div>playwright-clipage-prepplaywright-clipage-prepscripts/page-reduce-bundle.jscd <detector-repo>
npm run build # builds dist/detect.js
npm run build:skill # builds dist/reduce-for-skill.js
cat dist/detect.js dist/reduce-for-skill.js > <skills-repo>/skills/page-reduce/scripts/page-reduce-bundle.jsscripts/page-reduce-bundle.jscd <detector-repo>
npm run build # 构建dist/detect.js
npm run build:skill # 构建dist/reduce-for-skill.js
cat dist/detect.js dist/reduce-for-skill.js > <skills-repo>/skills/page-reduce/scripts/page-reduce-bundle.js