32 lines
952 B
Python
32 lines
952 B
Python
from pathlib import Path
|
|||
|
|
import glob
|
||
|
|
|
||
|
|
# Find latest bundle JS file
|
||
|
|
js_files = sorted(Path('e:/GitHub/blog/public/js').glob('bundle.min.*.js'), key=lambda p: p.stat().st_mtime, reverse=True)
|
||
|
|
if not js_files:
|
||
|
|
print("No JS bundle found!")
|
||
|
|
exit(1)
|
||
|
|
|
||
|
|
path = str(js_files[0])
|
||
|
|
print(f"Checking: {path}")
|
||
|
|
|
||
|
|
with open(path, 'r', encoding='utf-8') as f:
|
||
|
|
content = f.read()
|
||
|
|
|
||
|
|
idx = content.find('window.initCodeFold=function')
|
||
|
|
if idx == -1:
|
||
|
|
print("NOT FOUND")
|
||
|
|
else:
|
||
|
|
chunk = content[idx:idx+800]
|
||
|
|
print(chunk[:600])
|
||
|
|
print()
|
||
|
|
# Check for the key changes
|
||
|
|
checks = [
|
||
|
|
('parentNode.classList.contains("code-fold-container")', 'early return check'),
|
||
|
|
('pre.scrollHeight', 'pre scrollHeight'),
|
||
|
|
('block.scrollHeight', 'block fallback'),
|
||
|
|
('contentHeight', 'contentHeight var'),
|
||
|
|
]
|
||
|
|
for pattern, desc in checks:
|
||
|
|
found = pattern in chunk
|
||
|
|
print(f" {desc}: {'YES' if found else 'MISSING!'}")
|