{{curbak.name}}
v{{ver.versio
scrollY: {}, //记录每个界面的滚动值
overlay: { show: false, val: 60 },
snackbar: { show: false, color: 'primary', msg: '' },
- searchBar: { readonly: true, input: '' },
+ searchBar: { color: 'primary', readonly: true, input: '' },
searchDialog: { show: false },
versionsheet: { show: false },
updatesheet: { show: false },
@@ -1223,6 +1268,10 @@
v{{ver.versio
isSystemDarkMode() {
return window.matchMedia('(prefers-color-scheme: dark)').matches
},
+ // 是否透明主题
+ // isTransparent() {
+ // return this.box.usercfgs.isTransparent
+ // },
// 是否透明图标
isTransparentIcons() {
return this.box.usercfgs.isTransparentIcons
@@ -1260,25 +1309,58 @@
v{{ver.versio
},
// 样式
appViewStyle() {
- if (this.path !== '/') {
- return null
+ // if (this.path !== '/') {
+ // return null
+ // }
+ // 主题发生变化时给 设置背景色
+ if (this.isWallpaper) {
+ const bodyStyle = [
+ `background-color: ${this.isDarkMode ? '#121212' : '#fff'}`,
+ `background-image: linear-gradient(rgba(0,0,0,.2) 1%, rgba(255,255,255,0) 10%), url(${this.box.usercfgs.bgimg})`,
+ 'background-position: center',
+ 'background-size: cover',
+ 'background-repeat: no-repeat'
+ ]
+ // document.querySelector('body').removeAttribute('style')
+ document.querySelector('body').setAttribute('style', bodyStyle.join('; '))
+ } else {
+ const darkBg = 'background-color: #121212'
+ const lightBg = 'background: linear-gradient(rgba(0,0,0,.3) 1%, rgba(255,255,255,0) 10%)'
+ document.querySelector('body').setAttribute('style', this.isDarkMode ? darkBg : lightBg)
}
- const bgImg = this.box.usercfgs.bgimg
- const style = {
- 'background-image': `url(${bgImg})`,
- 'background-position': 'center',
- 'background-size': 'cover',
- 'background-repeat': 'no-repeat'
+ if (this.isWebApp) {
+ return { background: 'none' }
+ } else if (this.isWallpaper && !this.isTransparent) {
+ return { background: 'transparent' }
+ } else if (!this.isWallpaper && this.isTransparent) {
+ return { background: 'none' }
+ } else {
+ return
}
- return style
+ },
+ appBarBind() {
+ let app = !!this.box.usercfgs.isPinedSearchBar
+ let color = 'transparent'
+ const isEmptyLight = this.isWebApp && !this.isDarkMode && !this.isWallpaper
+ if (isEmptyLight) {
+ color = 'primary'
+ }
+ let flat = color === 'transparent'
+ return { app, color, flat, height: '68' }
+ },
+ searchBarBind() {
+ const color = this.isDarkMode ? null : 'primary'
+ return { color, height: '68' }
},
appIconFontStyle() {
const style = {
'font-size': '10px',
'max-width': '54px'
}
+
if (this.isWallpaper) {
style['color'] = '#fff'
+ style['text-shadow'] = 'black 0.1em 0.1em 0.2em'
}
return style
},
@@ -1473,6 +1555,14 @@
v{{ver.versio
}
}
},
+ 'ui.naviDrawer.show': {
+ handler(newval, oldval) {
+ // 获取贡献者列表
+ if (newval === true && !this.box.syscfgs.contributors) {
+ this.getContributors()
+ }
+ }
+ },
'box.usercfgs': {
deep: true,
handler(newval, oldval) {
@@ -1487,8 +1577,6 @@
v{{ver.versio
if (this.ui.editor) {
this.ui.editor._themeService.setTheme(this.isDarkMode ? 'vs-dark' : 'vs')
}
- // 主题发生变化时给 设置背景色
- document.querySelector('body').setAttribute('style', `background-color: ${this.isDarkMode ? '#121212' : '#fff'};`)
}
},
'box.usercfgs.color_dark_primary': {
@@ -1539,8 +1627,6 @@
v{{ver.versio
if (this.view === 'bak') {
await this.loadGlobalBak()
}
- // 获取贡献者列表
- this.getContributors()
this.getVersions()
this.loadTheme()
},
@@ -1926,8 +2012,9 @@
v{{ver.versio
// 获取仓库贡献者
getContributors() {
const url = 'https://api.github.com/repos/chavyleung/scripts/contributors'
+ this.box.syscfgs.contributors = []
axios.get(url).then((resp) => {
- this.box.syscfgs.contributors = []
+ if (!resp) return
resp.data.forEach((contributor) => {
if ([29748519, 39037656].includes(contributor.id)) return
const { login: id, login, html_url: repo, avatar_url: icon } = contributor
diff --git a/box/chavy.boxjs.js b/box/chavy.boxjs.js
index 5ef57fbb9..801f06632 100644
--- a/box/chavy.boxjs.js
+++ b/box/chavy.boxjs.js
@@ -1,6 +1,6 @@
const $ = new Env('BoxJs')
-$.version = '0.7.26'
+$.version = '0.7.27'
$.versionType = 'beta'
/**
@@ -37,6 +37,7 @@ $.html = $.name // `页面`类请求的响应体
// 页面源码地址
$.web = `https://cdn.jsdelivr.net/gh/chavyleung/scripts@${$.version}/box/chavy.boxjs.html?_=${new Date().getTime()}`
+
// 版本说明地址 (Release Note)
$.ver = 'https://gitee.com/chavyleung/scripts/raw/master/box/release/box.release.tf.json'
@@ -297,7 +298,7 @@ function getSystemApps() {
* 获取用户配置
*/
function getUserCfgs() {
- const defcfgs = { favapps: [], appsubs: [], httpapi: 'examplekey@127.0.0.1:6166' }
+ const defcfgs = { favapps: [], appsubs: [], isPinedSearchBar: true, httpapi: 'examplekey@127.0.0.1:6166' }
const usercfgs = Object.assign(defcfgs, $.getjson($.KEY_usercfgs, {}))
return usercfgs
}
diff --git a/box/release/box.release.tf.json b/box/release/box.release.tf.json
index 5877764ce..b26a70fa3 100644
--- a/box/release/box.release.tf.json
+++ b/box/release/box.release.tf.json
@@ -1,5 +1,26 @@
{
"releases": [
+ {
+ "version": "0.7.27",
+ "tags": ["beta"],
+ "author": "@chavyleung",
+ "icon": "https://avatars3.githubusercontent.com/u/29748519",
+ "repo": "https://github.com/chavyleung",
+ "notes": [
+ {
+ "name": "优化",
+ "descs": ["首页样式", "操作体验"]
+ },
+ {
+ "name": "首页",
+ "descs": ["顶栏透明", "可以隐藏顶栏", "顶栏可以固定或跟随滚动"]
+ },
+ {
+ "name": "悬浮按钮",
+ "descs": ["增加搜索入口"]
+ }
+ ]
+ },
{
"version": "0.7.26",
"tags": ["beta"],