Skip to content

Commit 90fa101

Browse files
author
AGentleWind2391
committed
更新[BoxJs TF]: 新增壁纸跟随系统适配
1 parent 80eaad4 commit 90fa101

3 files changed

Lines changed: 40 additions & 6 deletions

File tree

box/chavy.boxjs.html

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,10 +1886,21 @@ <h2 :class="version === ver.version ? 'primary--text' : undefined">v{{ver.versio
18861886
}
18871887
},
18881888
setWallpaper() {
1889-
const bgStyle = [
1890-
`background-image: linear-gradient(to bottom,rgba(0,0,0,.2) 0,transparent 76px), url(${this.box.usercfgs.bgimg})`
1891-
]
1892-
document.querySelector('#BG').setAttribute('style', bgStyle.join('; '))
1889+
let bgimg = ''
1890+
if (this.box.usercfgs.bgimg === "true") {
1891+
const darkbgimg = this.bgimgs.filter(bgimg => bgimg.name == "dark")[0].url
1892+
const lightbgimg = this.bgimgs.filter(bgimg => bgimg.name == "light")[0].url
1893+
this.isDarkMode ? bgimg = darkbgimg : bgimg = lightbgimg
1894+
const bgStyle = [
1895+
`background-image: linear-gradient(to bottom,rgba(0,0,0,.2) 0,transparent 76px), url(${bgimg})`
1896+
]
1897+
document.querySelector('#BG').setAttribute('style', bgStyle.join('; '))
1898+
} else {
1899+
const bgStyle = [
1900+
`background-image: linear-gradient(to bottom,rgba(0,0,0,.2) 0,transparent 76px), url(${this.box.usercfgs.bgimg})`
1901+
]
1902+
document.querySelector('#BG').setAttribute('style', bgStyle.join('; '))
1903+
}
18931904
},
18941905
clearWallpaper() {
18951906
document.querySelector('#BG').removeAttribute('style')

box/chavy.boxjs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const $ = new Env('BoxJs')
33
// 为 eval 准备的上下文环境
44
const $eval_env = {}
55

6-
$.version = '0.7.47'
6+
$.version = '0.7.48'
77
$.versionType = 'beta'
88

99
/**
@@ -304,7 +304,7 @@ function getSystemApps() {
304304
settings: [
305305
{ 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! 注意: 以逗号开头, 逗号分隔多个地址, 可加回车' },
306306
{ id: '@chavy_boxjs_userCfgs.httpapi_timeout', name: 'HTTP-API Timeout (Surge TF)', val: 20, type: 'number', persistentHint:true, desc: '如果脚本作者指定了超时时间, 会优先使用脚本指定的超时时间.' },
307-
{ 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: '逗号分隔名字和链接, 回车分隔多个地址' },
307+
{ 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: '逗号分隔名字和链接, 回车分隔多个地址' },
308308
{ id: '@chavy_boxjs_userCfgs.bgimg', name: '背景图片', val: '', type: 'text', placeholder: 'http://api.btstu.cn/sjbz/zsy.php', persistentHint:true, desc: '输入背景图标的在线链接' },
309309
{ id: '@chavy_boxjs_userCfgs.color_light_primary', name: '明亮色调', canvas: true, val: '#F7BB0E', type: 'colorpicker', desc: '' },
310310
{ id: '@chavy_boxjs_userCfgs.color_dark_primary', name: '暗黑色调', canvas: true, val: '#2196F3', type: 'colorpicker', desc: '' }

box/release/box.release.tf.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
{
22
"releases": [
3+
{
4+
"version": "0.7.48",
5+
"tags": ["beta"],
6+
"author": "@GideonSenku",
7+
"icon": "https://avatars3.githubusercontent.com/u/29748519",
8+
"repo": "https://github.com/chavyleung",
9+
"msg": "更新[BoxJs TF]: 新增壁纸跟随系统适配",
10+
"notes": [
11+
{
12+
"name": "新增",
13+
"descs": ["背景图片可跟随系统调整"]
14+
},
15+
{
16+
"name": "调整",
17+
"descs": ["背景清单图片默认`无`更改为`跟随系统`"]
18+
},
19+
{
20+
"name": "说明",
21+
"descs": ["背景图片清单中设置:跟随系统,true换行 light,图片url换行 dark,图片url换行",
22+
"如果不设置跟随系统,true,则默认跟随系统为无背景"]
23+
}
24+
]
25+
},
326
{
427
"version": "0.7.47",
528
"tags": ["beta"],

0 commit comments

Comments
 (0)