Skip to content

Commit 9784c55

Browse files
committed
Merge branch 'v2.0-beta' of https://github.com/antoor/antSword into v2.0-beta
2 parents 846bc27 + ce831f7 commit 9784c55

File tree

10 files changed

+811
-34
lines changed

10 files changed

+811
-34
lines changed

modules/menubar.js

+4
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ class Menubar {
5555
label: LANG['main']['aproxy'],
5656
accelerator: 'Shift+CmdOrCtrl+A',
5757
click: event.sender.send.bind(event.sender, 'menubar', 'settings-aproxy')
58+
}, {
59+
label: LANG['main']['display'],
60+
accelerator: 'Shift+CmdOrCtrl+D',
61+
click: event.sender.send.bind(event.sender, 'menubar', 'settings-display')
5862
}, {
5963
type: 'separator'
6064
}, {

source/language/en.js

+24-30
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module.exports = {
1616
settings: 'System setting',
1717
language: 'Language setting',
1818
aproxy: 'Proxy setting',
19+
display: 'Display setting',
1920
update: 'Check update',
2021
quit: 'Quit'
2122
},
@@ -486,39 +487,32 @@ module.exports = {
486487
success: 'Connect to proxy server successfully',
487488
error: 'Failed to connect to the proxy server'
488489
}
489-
}
490-
},
491-
aproxy: {
492-
title: 'Proxy Configuration',
493-
toolbar: {
494-
save: 'Save',
495-
test: 'Test Connection'
496490
},
497-
form: {
498-
label: 'Configuring proxy access to the Internet',
499-
mode:{
500-
noproxy: 'No Proxy',
501-
manualproxy: 'Set the proxy manually'
491+
display: {
492+
title: 'Display setting',
493+
success: 'Save display settings successfully!',
494+
error: 'Failed to save the display settings!',
495+
confirm: {
496+
content: 'Restart the application to take effect, whether to restart?',
497+
title: 'Change display settings'
502498
},
503-
proxy: {
504-
protocol: 'Protocol',
505-
server: 'Server',
506-
port: 'Port',
507-
username: 'Username',
508-
password: 'Password',
509-
authtip: 'Leave blank if no authentication'
499+
toolbar: {
500+
save: 'Save'
501+
},
502+
form:{
503+
shellmanager: {
504+
title: 'Shell Lists',
505+
hiddencolumns: {
506+
title: 'Hide selected columns',
507+
url: 'URL',
508+
ip: 'IP',
509+
addr: 'ADDR',
510+
note: 'NOTE',
511+
ctime: 'CTIME',
512+
utime: 'UTIME'
513+
}
514+
}
510515
}
511-
},
512-
success: 'Successfully save the Proxy Configuration!',
513-
error: 'Failed to save the Proxy Configuration!',
514-
confirm: {
515-
content: 'Restart the application?',
516-
title: 'Proxy Configuration'
517-
},
518-
prompt:{
519-
title: 'Input the target URL',
520-
success: 'Successfully connect to the proxy server',
521-
error: 'Failed to connect to the proxy server'
522516
}
523517
},
524518
plugin: {

source/language/zh.js

+27
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ module.exports = {
1717
settings: '系统设置',
1818
language: '语言设置',
1919
aproxy: '代理设置',
20+
display: '显示设置',
2021
update: '检查更新',
2122
quit: '退出程序'
2223
},
@@ -487,6 +488,32 @@ module.exports = {
487488
success: '连接到代理服务器成功',
488489
error: '连接到代理服务器失败'
489490
}
491+
},
492+
display: {
493+
title: '显示设置',
494+
success: '保存显示设置成功!',
495+
error: '保存显示设置失败!',
496+
confirm: {
497+
content: '重启应用生效,是否重启?',
498+
title: '更改显示设置'
499+
},
500+
toolbar: {
501+
save: '保存'
502+
},
503+
form:{
504+
shellmanager: {
505+
title: '数据管理',
506+
hiddencolumns: {
507+
title: '隐藏选中列',
508+
url: 'URL地址',
509+
ip: 'IP地址',
510+
addr: '物理位置',
511+
note: '网站备注',
512+
ctime: '创建时间',
513+
utime: '更新时间'
514+
}
515+
}
516+
}
490517
}
491518
},
492519
plugin: {

source/load.entry.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ window.addEventListener('load', () => {
8080
.then(() => loadCSS('ant-static://libs/layer/src/skin/layer.ext.css'))
8181
.then(() => loadCSS('ant-static://libs/laydate/need/laydate.css'))
8282
.then(() => loadCSS('ant-static://libs/laydate/skins/default/laydate.css'))
83-
.then(() => loadCSS('ant-static://libs/terminal/css/jquery.terminal.css'))
83+
.then(() => loadCSS('ant-static://libs/terminal/css/jquery.terminal-1.1.1.css'))
8484
.then(() => loadCSS('ant-static://libs/font-awesome/css/font-awesome.min.css'))
8585
.then(() => loadCSS('ant-static://libs/dhtmlx/codebase/dhtmlx.css'))
8686
.then(() => loadCSS('ant-static://libs/dhtmlx/skins/mytheme/dhtmlx.css'))
@@ -94,7 +94,7 @@ window.addEventListener('load', () => {
9494
.then(() => loadJS('ant-static://libs/toastr/toastr.js'))
9595
.then(() => loadJS('ant-static://libs/layer/src/layer.js'))
9696
.then(() => loadJS('ant-static://libs/laydate/laydate.js'))
97-
.then(() => loadJS('ant-static://libs/terminal/js/jquery.terminal-min.js'))
97+
.then(() => loadJS('ant-static://libs/terminal/js/jquery.terminal-min-1.1.1.js'))
9898
.then(() => loadJS('ant-static://libs/dhtmlx/codebase/dhtmlx.js'))
9999
.then(() => {
100100
/**

source/modules/settings/display.js

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/**
2+
* 设置中心::界面
3+
*/
4+
5+
const LANG = antSword['language']['settings']['display'];
6+
const LANG_T = antSword['language']['toastr'];
7+
8+
class Display {
9+
10+
constructor(sidebar) {
11+
sidebar.addItem({
12+
id: 'display',
13+
text: `<i class="fa fa-television"></i> ${LANG['title']}`
14+
});
15+
const cell = sidebar.cells('display');
16+
17+
const display_shellmanager_hiddencolumns = localStorage.hasOwnProperty('display_shellmanager_hiddencolumns') ? JSON.parse(localStorage.display_shellmanager_hiddencolumns):[];
18+
19+
const toolbar = cell.attachToolbar();
20+
toolbar.loadStruct([
21+
{ id: 'save', type: 'button', text: LANG['toolbar']['save'], icon: 'save' }
22+
]);
23+
// 表单
24+
const form = cell.attachForm([{
25+
type: 'block', name: 'shellmanager', list: [
26+
{type: "label", label: LANG['form']['shellmanager']['title']}
27+
]}
28+
]);
29+
30+
const LANG_HC = LANG['form']['shellmanager']['hiddencolumns'];
31+
// 数据管理隐藏列
32+
form.addItem(
33+
'shellmanager',
34+
{
35+
type: "fieldset", label: LANG_HC['title'], list:[
36+
{ type: "block", list: [
37+
{
38+
type: "checkbox", label: LANG_HC['url'], name: 'hidden_columns[0]', checked: display_shellmanager_hiddencolumns.indexOf(0) != -1 , position: "label-right", value: 1, disabled: true
39+
},
40+
{type: 'newcolumn', offset:20},
41+
{
42+
type: "checkbox", label: LANG_HC['ip'], name: 'hidden_columns[1]', checked: display_shellmanager_hiddencolumns.indexOf(1) != -1 , position: "label-right", value: 2
43+
},
44+
{type: 'newcolumn', offset:20},
45+
{
46+
type: "checkbox", label: LANG_HC['addr'], name: 'hidden_columns[2]', checked: display_shellmanager_hiddencolumns.indexOf(2) != -1 , position: "label-right", value: 3
47+
},
48+
{type: 'newcolumn', offset:20},
49+
{
50+
type: "checkbox", label: LANG_HC['note'], name: 'hidden_columns[3]', checked: display_shellmanager_hiddencolumns.indexOf(3) != -1 , position: "label-right", value: 4
51+
},
52+
{type: 'newcolumn', offset:20},
53+
{
54+
type: "checkbox", label: LANG_HC['ctime'], name: 'hidden_columns[4]', checked: display_shellmanager_hiddencolumns.indexOf(4) != -1 , position: "label-right", value: 5
55+
},
56+
{type: 'newcolumn', offset:20},
57+
{
58+
type: "checkbox", label: LANG_HC['utime'], name: 'hidden_columns[5]', checked: display_shellmanager_hiddencolumns.indexOf(5) != -1 , position: "label-right", value: 6
59+
}
60+
]}
61+
]
62+
}
63+
);
64+
65+
// 保存
66+
toolbar.attachEvent('onClick', (id) => {
67+
switch(id){
68+
case 'save':
69+
var _formvals = form.getValues();
70+
var _display_shellmanager_hiddencolumns = [];
71+
for (var i = 0; i < 6; i++) {
72+
var data = _formvals['hidden_columns['+i+']'];
73+
if (data) {
74+
_display_shellmanager_hiddencolumns.push(data-1);
75+
}
76+
}
77+
localStorage.setItem('display_shellmanager_hiddencolumns', JSON.stringify(_display_shellmanager_hiddencolumns));
78+
toastr.success(LANG['success'], LANG_T['success']);
79+
// 重启应用
80+
layer.confirm(LANG['confirm']['content'], {
81+
icon: 2, shift: 6,
82+
title: LANG['confirm']['title']
83+
}, (_) => {
84+
location.reload();
85+
});
86+
break;
87+
}
88+
});
89+
}
90+
91+
}
92+
93+
module.exports = Display;

source/modules/settings/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ const About = require('./about');
1010
// const Update = require('./update');
1111
const Language = require('./language');
1212
const AProxy = require('./aproxy');
13+
const Display = require('./display');
1314

1415
class Settings {
1516

1617
constructor() {
1718
antSword['menubar'].reg('settings', this.open.bind(this));
18-
['about', 'update', 'language', 'aproxy'].map((_) => {
19+
['about', 'update', 'language', 'aproxy', 'display'].map((_) => {
1920
antSword['menubar'].reg(`settings-${_}`, this.setActive.bind(this, _));
2021
});
2122
return this;
@@ -42,6 +43,7 @@ class Settings {
4243
this.language = new Language(sidebar);
4344
// this.update = new Update(sidebar);
4445
this.aproxy = new AProxy(sidebar);
46+
this.display = new Display(sidebar);
4547

4648
this.cell = cell;
4749
this.sidebar = sidebar;

source/modules/shellmanager/list/grid.js

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ class Grid {
3131
grid.setInitWidths("200,120,*,*,140,140");
3232
grid.setColAlign("left,left,left,left,center,center");
3333
grid.enableMultiselect(true);
34+
// 根据设置隐藏相应的列
35+
const dis_smhc = localStorage.hasOwnProperty('display_shellmanager_hiddencolumns') ? JSON.parse(localStorage.display_shellmanager_hiddencolumns):[];
36+
dis_smhc.map((_)=>{grid.setColumnHidden(_,true)});
3437

3538
// 隐藏右键菜单
3639
grid.attachEvent('onRowSelect', bmenu.hide);

source/modules/terminal/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,10 @@ class Terminal {
198198
greetings: banner,
199199
name: `terminal_${this.hash}`,
200200
prompt: this.parsePrompt(infoUser),
201+
numChars: 2048,
201202
exit: false,
202-
completion: (term, value, callback) => {
203+
// < 1.0.0 时使用3个参数 completion: (term, value, callback) => {}
204+
completion: (value, callback) => {
203205
callback(
204206
this.isWin ? [
205207
'dir', 'whoami', 'net', 'ipconfig', 'netstat', 'cls',

0 commit comments

Comments
 (0)