Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
antSword
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
HuangJunbo
antSword
Commits
93bb1ab7
Commit
93bb1ab7
authored
Mar 21, 2016
by
antoor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化UI组建自适应显示
优化UI组建自适应,在调整窗口大小的时候不刷新就能调整UI尺寸
parent
596e261a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
21 deletions
+13
-21
CHANGELOG.md
CHANGELOG.md
+3
-0
app.js
app.js
+4
-18
app.entry.jsx
source/app.entry.jsx
+6
-3
No files found.
CHANGELOG.md
View file @
93bb1ab7
...
@@ -4,6 +4,9 @@
...
@@ -4,6 +4,9 @@
## 2016/03
## 2016/03
### /21
1.
优化UI组建自适应,在调整窗口大小的时候不刷新就能调整UI尺寸
### /15
### /15
1.
修复了部分XSS遗留问题(主要在语言模板以及文件管理上还有虚拟终端等,其他地方可能还存在
1.
修复了部分XSS遗留问题(主要在语言模板以及文件管理上还有虚拟终端等,其他地方可能还存在
...
...
app.js
View file @
93bb1ab7
...
@@ -29,26 +29,12 @@ app
...
@@ -29,26 +29,12 @@ app
});
});
mainWindow
.
loadURL
(
`file:\/\/
${
__dirname
}
/views/index.html`
);
mainWindow
.
loadURL
(
`file:\/\/
${
__dirname
}
/views/index.html`
);
// 是否重新加载刷新UI
// 调整部分UI
// 获取初始化窗口大小
let
winSize
=
mainWindow
.
getSize
();
const
reloadUI
=
()
=>
{
const
reloadUI
=
()
=>
{
// 判断调整大小是否已经超过界限
// 判断标准:取调整后的长(宽)与之前的长(宽)绝对值,>= 10就提示调整,最后保存调整后的长宽值
let
_winSize
=
mainWindow
.
getSize
();
if
(
Math
.
abs
(
_winSize
[
0
]
-
winSize
[
0
])
<
10
&&
Math
.
abs
(
_winSize
[
1
]
-
winSize
[
1
])
<
10
)
{
return
;
};
winSize
=
_winSize
;
mainWindow
.
webContents
.
executeJavaScript
(
`
mainWindow
.
webContents
.
executeJavaScript
(
`
layer.confirm(
setTimeout(() => {
'窗口已经调整,是否重启应用刷新UI?',
antSword.modules.shellmanager.category.cell.setWidth(222);
{
}, 500);
title: '重启应用',
btn: ['好的','不必']
},
location.reload.bind(location)
);
`
);
`
);
}
}
mainWindow
mainWindow
...
...
source/app.entry.jsx
View file @
93bb1ab7
...
@@ -17,7 +17,8 @@ import CacheManager from './base/cachemanager';
...
@@ -17,7 +17,8 @@ import CacheManager from './base/cachemanager';
const
antSword
=
window
.
antSword
=
{
const
antSword
=
window
.
antSword
=
{
noxss
:
(
html
)
=>
{
noxss
:
(
html
)
=>
{
return
String
(
html
).
replace
(
/&/g
,
"&"
).
replace
(
/>/g
,
">"
).
replace
(
/</g
,
"<"
).
replace
(
/"/g
,
"""
);
return
String
(
html
).
replace
(
/&/g
,
"&"
).
replace
(
/>/g
,
">"
).
replace
(
/</g
,
"<"
).
replace
(
/"/g
,
"""
);
}
},
modules
:
{}
};
};
// 加载模板代码
// 加载模板代码
...
@@ -36,14 +37,16 @@ antSword['CacheManager'] = CacheManager;
...
@@ -36,14 +37,16 @@ antSword['CacheManager'] = CacheManager;
antSword
[
'menubar'
]
=
new
Menubar
();
antSword
[
'menubar'
]
=
new
Menubar
();
// 加载模块列表
// 加载模块列表
antSword
[
'tabbar'
]
=
new
dhtmlXTabBar
(
document
.
getElementById
(
'container'
));
// antSword['tabbar'] = new dhtmlXTabBar(document.getElementById('container'));
// 更新:使用document.body作为容器,可自动适应UI
antSword
[
'tabbar'
]
=
new
dhtmlXTabBar
(
document
.
body
);
[
[
'shellmanager'
,
'shellmanager'
,
'settings'
,
'settings'
,
'plugin'
'plugin'
].
map
((
_
)
=>
{
].
map
((
_
)
=>
{
let
_module
=
require
(
`./modules/
${
_
}
/index`
);
let
_module
=
require
(
`./modules/
${
_
}
/index`
);
new
_module
.
default
();
antSword
[
'modules'
][
_
]
=
new
_module
.
default
();
});
});
// 移除加载界面&&设置标题
// 移除加载界面&&设置标题
$
(
'#loading'
).
remove
();
$
(
'#loading'
).
remove
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment