24 lines
892 B
Python
24 lines
892 B
Python
"""Build the page-context userscript from reviewed local components; no external assets."""
|
|
from pathlib import Path
|
|
ROOT = Path(__file__).resolve().parent
|
|
header = '''// ==UserScript==
|
|
// @name 新闻工作台 · 导入排版与流程
|
|
// @namespace local.dww11.auto-news
|
|
// @version 0.2.2
|
|
// @match https://www.dww11.com/*
|
|
// @match https://dww11.com/*
|
|
// @match https://house.dww11.com/*
|
|
// @grant none
|
|
// @run-at document-idle
|
|
// @noframes
|
|
// ==/UserScript==
|
|
'''
|
|
parts = []
|
|
for name in ('importer.js', 'formatter.js', 'results.js', 'runner.js'):
|
|
source = (ROOT / 'browser' / name).read_text()
|
|
if '// ==/UserScript==' in source:
|
|
source = source.split('// ==/UserScript==', 1)[1]
|
|
parts.append(source)
|
|
(ROOT / 'browser/auto-news.user.js').write_text(header + '\n'.join(parts))
|
|
print('已生成 browser/auto-news.user.js')
|