You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1.3 KiB
30 lines
1.3 KiB
|
1 day ago
|
# -*- coding: utf-8 -*-
|
||
|
|
"""票 14 前置扫描:demo/index.html 函数签名 + 控件 id + 关键 JS 段行号"""
|
||
|
|
import io, re, sys
|
||
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||
|
|
P = r"e:\code\crm-backend-matt\.scratch\customer-demo-ref\demo\index.html"
|
||
|
|
txt = open(P, encoding='utf-8').read()
|
||
|
|
lines = txt.split('\n')
|
||
|
|
|
||
|
|
# 1) 全部函数签名(行号)
|
||
|
|
print("== FUNCTIONS ==")
|
||
|
|
for i, ln in enumerate(lines, 1):
|
||
|
|
for m in re.finditer(r'(?:async\s+)?function\s+([A-Za-z_$][\w$]*)\s*\(([^)]*)\)', ln):
|
||
|
|
print(f"L{i} {m.group(1)}({m.group(2)[:60]})")
|
||
|
|
|
||
|
|
# 2) HTML/JS 控件 id
|
||
|
|
ids = sorted(set(re.findall(r'id="([^"]+)"', txt)))
|
||
|
|
print("\n== IDS(%d) ==" % len(ids))
|
||
|
|
print(", ".join(ids))
|
||
|
|
|
||
|
|
# 3) 关键锚点行号(辅助定向阅读)
|
||
|
|
anchors = ["dlgCreate", "dlgOppCreate", "doOppCreate", "impUpload", "impConfirm",
|
||
|
|
"cimpUpload", "cimpConfirm", "transfer/", "dlgTransferEntry", "dedup",
|
||
|
|
"reminder", "check-name", "check-phone", "reveal", "defect-panel",
|
||
|
|
"svDelete", "saveForm", "loadForm", "errbox", "memberUserIds",
|
||
|
|
"batchUnarchive", "unarchive", "openQa", "qaSubmit", "dlgFollow", "act("]
|
||
|
|
print("\n== ANCHORS ==")
|
||
|
|
for a in anchors:
|
||
|
|
hits = [i for i, ln in enumerate(lines, 1) if a in ln][:8]
|
||
|
|
print(f"{a}: {hits}")
|