Skip to content

Commit

Permalink
fix(core): 修改 userjs.templete 模板文件,兼容跨域响应式,并修改 homepage 等字段
Browse files Browse the repository at this point in the history
  • Loading branch information
enncy committed Jun 11, 2022
1 parent 1f5c9e8 commit f945a80
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
3 changes: 2 additions & 1 deletion scripts/build-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ function createUserJs(cb) {
const template = fs.readFileSync('../userjs.template').toString();
const script = fs.readFileSync('../dist/index.js').toString();
const style = fs.readFileSync('../dist/style.css').toString();
const userjs = template.replace(/{{version}}/g, version).replace(/{{script}}/g, script).replace(/{{style}}/g, style);
const userjs = template.replace(/{{VERSION_SLOT}}/g, version)
.replace(/{{SCRIPT_SLOT}}/g, script).replace(/{{STYLE_SLOT}}/g, style);
fs.writeFileSync('../dist/ocs.user.js', userjs);
cb();
}
Expand Down
19 changes: 10 additions & 9 deletions userjs.template
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
// ==UserScript==
// @name OCS 网课助手
// @version {{VERSION}}
// @version {{VERSION_SLOT}}
// @description OCS 网课助手,支持各平台网课学习,支持超星学习通,知道智慧树,智慧职教(职教云),等网课的学习,作业,考试功能。
// @author enncy
// @license MIT
// @namespace https://enncy.cn
// @homepage https://enncy.github.io/online-course-script/
// @source https://github.com/enncy/online-course-script/
// @homepage https://docs.ocsjs.com
// @source https://github.com/ocsjs/ocsjs
// @icon https://cdn.ocsjs.com/logo.ico
// @connect enncy.cn
// @connect icodef.com
// @connect ocsjs.com
// @connect localhost
// @connect ocsjs.com
// @connect localhost
// @match *://*.chaoxing.com/*
// @match *://*.edu.cn/*
// @match *://*.org.cn/*
// @match *://*.zhihuishu.com/*
// @match *://*.icve.com.cn/*
// @match *://*.icve.com.cn/*
// @grant unsafeWindow
// @grant GM_xmlhttpRequest
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_addValueChangeListener
// @grant GM_removeValueChangeListener
// @run-at document-start
// ==/UserScript==

{{SCRIPT_SLOT}}

{{script}}

const OCS_STYLE = `{{style}}`;
const OCS_STYLE = `{{STYLE_SLOT}}`;

/* eslint no-undef: 0 */

Expand Down

0 comments on commit f945a80

Please sign in to comment.