26 lines
1.2 KiB
JavaScript
26 lines
1.2 KiB
JavaScript
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
const root = __dirname;
|
|
const header = `// ==UserScript==
|
|
// @name 华谊题库助手 · CSV导出与划词检索
|
|
// @namespace local.huayi.question-bank
|
|
// @version 1.1.0
|
|
// @description 按题库采集与同名CSV导出,支持多题库批量导入、文字搜索、划词查答案、选择复制与隐藏面板。
|
|
// @match https://www.shhuayi-elearning.cn/*
|
|
// @match https://shhuayi-elearning.cn/*
|
|
// @run-at document-start
|
|
// @noframes
|
|
// @grant unsafeWindow
|
|
// @grant GM_getValue
|
|
// @grant GM_setValue
|
|
// @grant GM_registerMenuCommand
|
|
// @grant GM_addValueChangeListener
|
|
// ==/UserScript==
|
|
`;
|
|
const sources = ['src/core.js', 'src/adapter.js', 'src/app.js'];
|
|
const body = sources.map(file => `\n// ---- ${file} ----\n${fs.readFileSync(path.join(root, file), 'utf8')}`).join('\n');
|
|
fs.mkdirSync(path.join(root, 'dist'), { recursive: true });
|
|
const target = path.join(root, 'dist/huayi-question-bank.user.js');
|
|
fs.writeFileSync(target, `${header}\n(function () {\n'use strict';\n${body}\n})();\n`, 'utf8');
|
|
console.log(`已生成 ${target}`);
|