mirror of
https://github.com/ronggang/transmission-web-control.git
synced 2025-04-15 21:42:47 +00:00
commit
4e0c781669
|
@ -698,34 +698,44 @@
|
||||||
// 测试端口
|
// 测试端口
|
||||||
thisDialog.find('#system-config-test-port').click(function () {
|
thisDialog.find('#system-config-test-port').click(function () {
|
||||||
var button = $(this);
|
var button = $(this);
|
||||||
button.linkbutton({
|
var newPort = parseInt(thisDialog.find('#peer-port').val());
|
||||||
text: system.lang.dialog['system-config'].testing,
|
|
||||||
disabled: true
|
function buttonPortTestStatus(enabled) {
|
||||||
});
|
button.linkbutton({
|
||||||
|
text: system.lang.dialog['system-config'][enabled?'test-port':'testing'],
|
||||||
|
disabled: !enabled
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function labelPortOpenStatus(opened) {
|
||||||
|
if (opened) {
|
||||||
|
thisDialog.find('#system-config-port-is-open-true').fadeInAndOut();
|
||||||
|
} else {
|
||||||
|
thisDialog.find('#system-config-port-is-open-false').fadeInAndOut();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buttonPortTestStatus(false);
|
||||||
|
|
||||||
// 如果端口有变更,则先保存
|
// 如果端口有变更,则先保存
|
||||||
if (parseInt(thisDialog.find('#peer-port').val()) != system.serverConfig['peer-port']) {
|
if (newPort != system.serverConfig['peer-port']) {
|
||||||
transmission.exec({
|
transmission.exec({
|
||||||
method: 'session-set',
|
method: 'session-set',
|
||||||
arguments: {
|
arguments: {
|
||||||
'peer-port': true
|
'peer-port': newPort
|
||||||
}
|
}
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
if (data.result == 'success') {
|
if (data.result == 'success') {
|
||||||
|
system.serverConfig['peer-port'] = newPort;
|
||||||
transmission.exec({
|
transmission.exec({
|
||||||
method: 'port-test'
|
method: 'port-test'
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
if (data.result == 'success') {
|
if (data.result == 'success') {
|
||||||
if (data.arguments['port-is-open']) {
|
labelPortOpenStatus(data.arguments['port-is-open']==true);
|
||||||
thisDialog.find('#system-config-port-is-open-true').fadeInAndOut();
|
|
||||||
} else {
|
|
||||||
thisDialog.find('#system-config-port-is-open-false').fadeInAndOut();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
button.linkbutton({
|
buttonPortTestStatus(true);
|
||||||
text: system.lang.dialog['system-config']['test-port'],
|
|
||||||
disabled: false
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
buttonPortTestStatus(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -733,16 +743,9 @@
|
||||||
method: 'port-test'
|
method: 'port-test'
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
if (data.result == 'success') {
|
if (data.result == 'success') {
|
||||||
if (data.arguments['port-is-open']) {
|
labelPortOpenStatus(data.arguments['port-is-open']==true);
|
||||||
thisDialog.find('#system-config-port-is-open-true').fadeInAndOut();
|
|
||||||
} else {
|
|
||||||
thisDialog.find('#system-config-port-is-open-false').fadeInAndOut();
|
|
||||||
}
|
|
||||||
button.linkbutton({
|
|
||||||
text: system.lang.dialog['system-config']['test-port'],
|
|
||||||
disabled: false
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
buttonPortTestStatus(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user