Skip to content

Commit f23ac8b

Browse files
committed
更新[BoxJs]: 新增内置应用"偏好设置", 新增控件: 拾色器
1 parent bff4cc9 commit f23ac8b

4 files changed

Lines changed: 72 additions & 22 deletions

File tree

‎Env.js‎

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ function Env(name, opts) {
3535

3636
runScript(script) {
3737
return new Promise((resolve) => {
38-
const httpapi = this.getdata('@chavy_boxjs_userCfgs.httpapi')
39-
console.log(httpapi)
38+
let httpapi = this.getdata('@chavy_boxjs_userCfgs.httpapi')
39+
httpapi = httpapi ? httpapi.replace(/\n/g, '').trim() : httpapi
4040
const [key, addr] = httpapi.split('@')
4141
const opts = {
4242
url: `http://${addr}/v1/scripting/evaluate`,
@@ -264,29 +264,28 @@ function Env(name, opts) {
264264
}
265265
}
266266
/**
267-
*
267+
*
268268
* 示例:$.time('yyyy-MM-dd qq HH:mm:ss.S')
269269
* :$.time('yyyyMMddHHmmssS')
270-
* y:年 M:月 d:日 q:季 H:时 m:分 s:秒 S:毫秒
270+
* y:年 M:月 d:日 q:季 H:时 m:分 s:秒 S:毫秒
271271
* 其中y可选0-4位占位符、S可选0-1位占位符,其余可选0-2位占位符
272272
* @param {*} fmt 格式化参数
273-
*
273+
*
274274
*/
275275
time(fmt) {
276276
let o = {
277-
"M+": new Date().getMonth() + 1,
278-
"d+": new Date().getDate(),
279-
"H+": new Date().getHours(),
280-
"m+": new Date().getMinutes(),
281-
"s+": new Date().getSeconds(),
282-
"q+": Math.floor((new Date().getMonth() + 3) / 3),
283-
"S": new Date().getMilliseconds()
277+
'M+': new Date().getMonth() + 1,
278+
'd+': new Date().getDate(),
279+
'H+': new Date().getHours(),
280+
'm+': new Date().getMinutes(),
281+
's+': new Date().getSeconds(),
282+
'q+': Math.floor((new Date().getMonth() + 3) / 3),
283+
'S': new Date().getMilliseconds()
284284
}
285-
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (new Date().getFullYear() + "").substr(4 - RegExp.$1.length))
286-
for (let k in o)
287-
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)))
285+
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (new Date().getFullYear() + '').substr(4 - RegExp.$1.length))
286+
for (let k in o) if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length))
288287
return fmt
289-
}
288+
}
290289

291290
/**
292291
* 系统通知

‎Env.min.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎box/release/box.release.json‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
{
22
"releases": [
3+
{
4+
"version": "0.6.9",
5+
"tags": ["beta"],
6+
"author": "@chavyleung",
7+
"icon": "https://avatars3.githubusercontent.com/u/29748519",
8+
"repo": "https://github.com/chavyleung",
9+
"notes": [
10+
{
11+
"name": "新增",
12+
"descs": ["内置应用: 偏好设置", "可以设置多个 http-api (设置完后在侧栏选择)", "可以分别设置暗黑、明亮主题下的主色调"]
13+
},
14+
{
15+
"name": "控件",
16+
"descs": ["拾色器: colorpicker"]
17+
},
18+
{
19+
"name": "注意",
20+
"descs": ["设置多个 http-api 时, 建议以逗号开头, 侧栏中选择空白的那个就是走 eval() 方案"]
21+
}
22+
]
23+
},
324
{
425
"version": "0.6.8",
526
"tags": ["beta"],

0 commit comments

Comments
 (0)