自动压缩js大小
This commit is contained in:
parent
bdcdb5babb
commit
fcb9a678b3
21
build.js
Normal file
21
build.js
Normal file
@ -0,0 +1,21 @@
|
||||
let fs = require('fs');
|
||||
|
||||
let date = new Date();
|
||||
let version = '0.3.36';
|
||||
let head = `// ==UserScript==
|
||||
// @lastmodified ${date.getFullYear()}${('0' + (date.getMonth() + 1)).slice(-2)}${('0' + date.getDate()).slice(-2)}${('0' + date.getHours()).slice(-2)}${('0' + date.getMinutes()).slice(-2)}
|
||||
// @name 芜湖助手
|
||||
// @namespace WOOH
|
||||
// @version ${version}
|
||||
// @description 托恩,起飞!
|
||||
// @author Woohoo[2687093] Sabrina_Devil[2696209]
|
||||
// @match https://www.torn.com/*
|
||||
// @grant GM_xmlhttpRequest
|
||||
// @grant unsafeWindow
|
||||
// @connect *
|
||||
// ==/UserScript==
|
||||
`
|
||||
|
||||
const data = fs.readFileSync('./release.min.user.js', 'utf8');
|
||||
fs.writeFileSync('./release.min.user.js', head + data.replace('$$WUHU_DEV_VERSION$$', version), 'utf8');
|
||||
console.log('构建完成');
|
||||
@ -2,8 +2,10 @@
|
||||
"name": "wuhu-torn-helper",
|
||||
"version": "",
|
||||
"dependencies": {
|
||||
"uglify-js": "^3.16.1"
|
||||
},
|
||||
"scripts": {
|
||||
"uglifyjs": "uglifyjs wuhu-torn-helper.js -o release.min.user.js.js"
|
||||
"release": "npm run minify && node build.js",
|
||||
"minify": "uglifyjs wuhu-torn-helper.js -o release.min.user.js -m"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,17 +1,4 @@
|
||||
// ==UserScript==
|
||||
// @lastmodified 202206172337
|
||||
// @name 芜湖助手
|
||||
// @namespace WOOH
|
||||
// @version 0.3.36
|
||||
// @description 托恩,起飞!
|
||||
// @author Woohoo[2687093] Sabrina_Devil[2696209]
|
||||
// @match https://www.torn.com/*
|
||||
// @grant GM_xmlhttpRequest
|
||||
// @grant unsafeWindow
|
||||
// @connect *
|
||||
// ==/UserScript==
|
||||
|
||||
(async function () {
|
||||
!async function () {
|
||||
'use strict';
|
||||
const start_timestamp = Date.now();
|
||||
// unsafewindow副本
|
||||
@ -23,7 +10,7 @@
|
||||
// 防止脚本重复运行
|
||||
if (window.WHTRANS) return;
|
||||
window.WHTRANS = true;
|
||||
const version = '0.3.36';
|
||||
const version = '$$WUHU_DEV_VERSION$$';
|
||||
const changelist = [
|
||||
{
|
||||
todo: true,
|
||||
@ -10298,4 +10285,4 @@ z-index:100001;
|
||||
}
|
||||
|
||||
$zhongNode.initTimer.innerHTML = `助手加载时间 ${Date.now() - start_timestamp}ms`;
|
||||
}());
|
||||
}();
|
||||
Loading…
x
Reference in New Issue
Block a user