Skip to content

Commit 8e38fda

Browse files
committed
更新[BoxJs TF]: 新增可以设置多张壁纸
1 parent 1b1c1fb commit 8e38fda

3 files changed

Lines changed: 54 additions & 5 deletions

File tree

‎box/chavy.boxjs.html‎

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,20 @@
191191
</v-select>
192192
</v-list-item-content>
193193
</v-list-item>
194+
<v-list-item class="mt-4" v-show="box.usercfgs.bgimgs">
195+
<v-list-item-content>
196+
<v-select
197+
hide-details
198+
v-model="box.usercfgs.bgimg"
199+
:items="bgimgs"
200+
item-text="name"
201+
item-value="url"
202+
@change="saveUserCfgs"
203+
label="背景图片"
204+
>
205+
</v-select>
206+
</v-list-item-content>
207+
</v-list-item>
194208
<v-list-item class="mt-4">
195209
<v-switch
196210
dense
@@ -1183,6 +1197,22 @@ <h2 :class="version === ver.version ? 'primary--text' : undefined">v{{ver.versio
11831197
isWallpaper() {
11841198
return !!this.box.usercfgs.bgimg
11851199
},
1200+
// 是否存在多张壁纸
1201+
isMutiWallpaper() {
1202+
return this.bgimgs && this.bgimgs.length > 2
1203+
},
1204+
// 背景图片列表
1205+
bgimgs() {
1206+
const items = []
1207+
const bgimgs = this.box.usercfgs.bgimgs
1208+
if (bgimgs) {
1209+
bgimgs.split('\n').forEach((img) => {
1210+
const [name, url] = img.split(',')
1211+
items.push({ name, url })
1212+
})
1213+
}
1214+
return items
1215+
},
11861216
// 样式
11871217
appStyle() {
11881218
if (this.path !== '/') {
@@ -1598,7 +1628,7 @@ <h2 :class="version === ver.version ? 'primary--text' : undefined">v{{ver.versio
15981628
},
15991629
// 运行远程脚本
16001630
runScript(url, timeout) {
1601-
const opts = { url, timeout }
1631+
const opts = { url, timeout, isRemote: true }
16021632
axios.post('/api/runScript', opts)
16031633
},
16041634
// 运行文本脚本

‎box/chavy.boxjs.js‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const $ = new Env('BoxJs')
22

3-
$.version = '0.7.18'
3+
$.version = '0.7.19'
44
$.versionType = 'beta'
55

66
/**
@@ -249,12 +249,14 @@ function getSystemApps() {
249249
descs: ['可设置 http-api 地址 & 超时时间 (Surge TF)', '可设置明暗两种主题下的主色调'],
250250
keys: [
251251
'@chavy_boxjs_userCfgs.httpapi',
252+
'@chavy_boxjs_userCfgs.bgimg',
252253
'@chavy_boxjs_userCfgs.color_dark_primary',
253254
'@chavy_boxjs_userCfgs.color_light_primary'
254255
],
255256
settings: [
256-
{ id: '@chavy_boxjs_userCfgs.httpapis', name: 'HTTP-API (Surge TF)', val: '', type: 'textarea', placeholder: ',examplekey@127.0.0.1:6166', autoGrow: true, rows: 2, desc: '示例: ,examplekey@127.0.0.1:6166! 注意: 以逗号开头, 逗号分隔多个地址, 可加回车' },
257+
{ id: '@chavy_boxjs_userCfgs.httpapis', name: 'HTTP-API (Surge TF)', val: '', type: 'textarea', placeholder: ',examplekey@127.0.0.1:6166', autoGrow: true, rows: 2, persistentHint:true, desc: '示例: ,examplekey@127.0.0.1:6166! 注意: 以逗号开头, 逗号分隔多个地址, 可加回车' },
257258
{ id: '@chavy_boxjs_userCfgs.httpapi_timeout', name: 'HTTP-API Timeout (Surge TF)', val: 20, type: 'number', persistentHint:true, desc: '如果脚本作者指定了超时时间, 会优先使用脚本指定的超时时间.' },
259+
{ id: '@chavy_boxjs_userCfgs.bgimgs', name: '背景图片清单', val: '无背景,\n妹子,http://api.btstu.cn/sjbz/zsy.php', type: 'textarea', placeholder: '无, {回车} 妹子,图片地址', persistentHint:true, autoGrow: true, rows: 2, desc: '逗号分隔名字和链接, 回车分隔多个地址' },
258260
{ id: '@chavy_boxjs_userCfgs.bgimg', name: '背景图片', val: '', type: 'text', placeholder: 'http://api.btstu.cn/sjbz/zsy.php', persistentHint:true, desc: '输入背景图标的在线链接' },
259261
{ id: '@chavy_boxjs_userCfgs.color_light_primary', name: '明亮色调', canvas: true, val: '#F7BB0E', type: 'colorpicker', desc: '' },
260262
{ id: '@chavy_boxjs_userCfgs.color_dark_primary', name: '暗黑色调', canvas: true, val: '#2196F3', type: 'colorpicker', desc: '' }
@@ -502,7 +504,7 @@ async function apiRunScript() {
502504
}
503505
} else {
504506
// 对于手动执行的脚本, 把 $done 的时机交给脚本自主控制
505-
$.isSkipDone = false
507+
$.isSkipDone = true
506508
$request = undefined
507509
eval(opts.script)
508510
}
@@ -570,7 +572,7 @@ function upgradeUserData() {
570572
* ===================================
571573
*/
572574
function doneBox() {
573-
if ($.isSkipDone) {
575+
if ($.isSkipDone === true) {
574576
return
575577
}
576578
// 记录当前使用哪个域名访问

‎box/release/box.release.tf.json‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
{
22
"releases": [
3+
{
4+
"version": "0.7.19",
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": ["可以设置多张壁纸 (偏好设置)"]
13+
},
14+
{
15+
"name": "注意",
16+
"descs": ["设置多张壁纸后,在侧栏切换"]
17+
}
18+
]
19+
},
320
{
421
"version": "0.7.18",
522
"tags": ["beta"],

0 commit comments

Comments
 (0)