Skip to content

Commit

Permalink
fix(script): 新增超星分录题支持
Browse files Browse the repository at this point in the history
  • Loading branch information
enncy committed Jun 22, 2023
1 parent a090a95 commit 68c007b
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 55 deletions.
3 changes: 2 additions & 1 deletion packages/scripts/src/projects/cx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1484,6 +1484,7 @@ export function getValidNumber(...nums: number[]) {
* 5 名词解释
* 6 论述题
* 7 计算题
* 9 分录题
* 10 资料题
* 11 连线题
* 14 完形填空
Expand All @@ -1498,7 +1499,7 @@ function getQuestionType(
? 'multiple'
: val === 3
? 'judgement'
: [2, 4, 5, 6, 7, 10].some((t) => t === val)
: [2, 4, 5, 6, 7, 9, 10].some((t) => t === val)
? 'completion'
: val === 11
? 'line'
Expand Down
112 changes: 58 additions & 54 deletions scripts/build-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,60 +38,64 @@ async function createUserJs(cb) {
const ocs = require(path.join(distPath, 'index.js'));

const createOptions = () =>
/** @type {import('../packages/utils').CreateOptions} */
({
parseRequire: true,
parseResource: true,
resourceBuilder: (key, value) => `const ${key} = \`${value}\`;`,
metaDataFormatter: {
header: '==UserScript==',
footer: '==/UserScript==',
prefix: '// ',
symbol: '@',
gap: '\t'.repeat(4)
},
metadata: {
name: 'OCS 网课助手',
version: version,
description: `OCS(online-course-script) 网课助手,专注于帮助大学生从网课中释放出来。让自己的时间把握在自己的手中,拥有人性化的操作页面,流畅的步骤提示,支持 ${ocs
.definedProjects()
.filter((p) => p.studyProject)
.map((s) => `【${s.name}】`)
.join(' ')},等网课的学习,作业。具体的功能请查看脚本悬浮窗中的教程页面,OCS官网 https://docs.ocsjs.com 。`,
author: 'enncy',
license: 'MIT',
namespace: 'https://enncy.cn',
homepage: 'https://docs.ocsjs.com',
source: 'https://github.com/ocsjs/ocsjs',
icon: 'https://cdn.ocsjs.com/logo.png',
connect: ['enncy.cn', 'icodef.com', 'ocsjs.com', 'localhost'],
match: Array.from(new Set(ocs
.definedProjects()
.map((p) => p.domains.map((d) => `*://*.${d}/*`))
.flat())),
grant: [
'GM_info',
'GM_getTab',
'GM_saveTab',
'GM_setValue',
'GM_getValue',
'unsafeWindow',
'GM_listValues',
'GM_deleteValue',
'GM_notification',
'GM_xmlhttpRequest',
'GM_getResourceText',
'GM_addValueChangeListener',
'GM_removeValueChangeListener'
],
require: [path.join(__dirname, distPath, 'index.js')],
resource: [`STYLE ${path.join(__dirname, '../packages/scripts/assets/css/style.css')}`],
'run-at': 'document-start',
antifeature: 'payment'
},
entry: path.join(__dirname, '../packages/scripts/entry.js'),
dist: path.join(__dirname, distPath, 'ocs.user.js')
});
/** @type {import('../packages/utils').CreateOptions} */
({
parseRequire: true,
parseResource: true,
resourceBuilder: (key, value) => `const ${key} = \`${value}\`;`,
metaDataFormatter: {
header: '==UserScript==',
footer: '==/UserScript==',
prefix: '// ',
symbol: '@',
gap: '\t'.repeat(4)
},
metadata: {
name: 'OCS 网课助手',
version: version,
description: `OCS(online-course-script) 网课助手,专注于帮助大学生从网课中释放出来。让自己的时间把握在自己的手中,拥有人性化的操作页面,流畅的步骤提示,支持 ${ocs
.definedProjects()
.filter((p) => p.studyProject)
.map((s) => `【${s.name}】`)
.join(' ')},等网课的学习,作业。具体的功能请查看脚本悬浮窗中的教程页面,OCS官网 https://docs.ocsjs.com 。`,
author: 'enncy',
license: 'MIT',
namespace: 'https://enncy.cn',
homepage: 'https://docs.ocsjs.com',
source: 'https://github.com/ocsjs/ocsjs',
icon: 'https://cdn.ocsjs.com/logo.png',
connect: ['enncy.cn', 'icodef.com', 'ocsjs.com', 'localhost'],
match: Array.from(
new Set(
ocs
.definedProjects()
.map((p) => p.domains.map((d) => `*://*.${d}/*`))
.flat()
)
),
grant: [
'GM_info',
'GM_getTab',
'GM_saveTab',
'GM_setValue',
'GM_getValue',
'unsafeWindow',
'GM_listValues',
'GM_deleteValue',
'GM_notification',
'GM_xmlhttpRequest',
'GM_getResourceText',
'GM_addValueChangeListener',
'GM_removeValueChangeListener'
],
require: [path.join(__dirname, distPath, 'index.js')],
resource: [`STYLE ${path.join(__dirname, '../packages/scripts/assets/css/style.css')}`],
'run-at': 'document-start',
antifeature: 'payment'
},
entry: path.join(__dirname, '../packages/scripts/entry.js'),
dist: path.join(__dirname, distPath, 'ocs.user.js')
});

await createUserScript(createOptions());
const opts = createOptions();
Expand Down

0 comments on commit 68c007b

Please sign in to comment.