WebUI: Increase focus delay for password field cursor
This commit is contained in:
parent
828b3204b8
commit
9fd527f465
|
@ -1,6 +1,6 @@
|
||||||
/*!
|
/*!
|
||||||
* Deluge.LoginWindow.js
|
* Deluge.LoginWindow.js
|
||||||
*
|
*
|
||||||
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
|
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Deluge.LoginWindow = Ext.extend(Ext.Window, {
|
Deluge.LoginWindow = Ext.extend(Ext.Window, {
|
||||||
|
|
||||||
firstShow: true,
|
firstShow: true,
|
||||||
bodyStyle: 'padding: 10px 5px;',
|
bodyStyle: 'padding: 10px 5px;',
|
||||||
buttonAlign: 'center',
|
buttonAlign: 'center',
|
||||||
|
@ -45,17 +45,17 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, {
|
||||||
title: _('Login'),
|
title: _('Login'),
|
||||||
width: 300,
|
width: 300,
|
||||||
height: 120,
|
height: 120,
|
||||||
|
|
||||||
initComponent: function() {
|
initComponent: function() {
|
||||||
Deluge.LoginWindow.superclass.initComponent.call(this);
|
Deluge.LoginWindow.superclass.initComponent.call(this);
|
||||||
this.on('show', this.onShow, this);
|
this.on('show', this.onShow, this);
|
||||||
|
|
||||||
this.addButton({
|
this.addButton({
|
||||||
text: _('Login'),
|
text: _('Login'),
|
||||||
handler: this.onLogin,
|
handler: this.onLogin,
|
||||||
scope: this
|
scope: this
|
||||||
});
|
});
|
||||||
|
|
||||||
this.form = this.add({
|
this.form = this.add({
|
||||||
xtype: 'form',
|
xtype: 'form',
|
||||||
baseCls: 'x-plain',
|
baseCls: 'x-plain',
|
||||||
|
@ -74,7 +74,7 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, {
|
||||||
});
|
});
|
||||||
this.passwordField.on('specialkey', this.onSpecialKey, this);
|
this.passwordField.on('specialkey', this.onSpecialKey, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
logout: function() {
|
logout: function() {
|
||||||
deluge.events.fire('logout');
|
deluge.events.fire('logout');
|
||||||
deluge.client.auth.delete_session({
|
deluge.client.auth.delete_session({
|
||||||
|
@ -84,17 +84,17 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, {
|
||||||
scope: this
|
scope: this
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
show: function(skipCheck) {
|
show: function(skipCheck) {
|
||||||
if (this.firstShow) {
|
if (this.firstShow) {
|
||||||
deluge.client.on('error', this.onClientError, this);
|
deluge.client.on('error', this.onClientError, this);
|
||||||
this.firstShow = false;
|
this.firstShow = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skipCheck) {
|
if (skipCheck) {
|
||||||
return Deluge.LoginWindow.superclass.show.call(this);
|
return Deluge.LoginWindow.superclass.show.call(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
deluge.client.auth.check_session({
|
deluge.client.auth.check_session({
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
if (result) {
|
if (result) {
|
||||||
|
@ -109,11 +109,11 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, {
|
||||||
scope: this
|
scope: this
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onSpecialKey: function(field, e) {
|
onSpecialKey: function(field, e) {
|
||||||
if (e.getKey() == 13) this.onLogin();
|
if (e.getKey() == 13) this.onLogin();
|
||||||
},
|
},
|
||||||
|
|
||||||
onLogin: function() {
|
onLogin: function() {
|
||||||
var passwordField = this.passwordField;
|
var passwordField = this.passwordField;
|
||||||
deluge.client.auth.login(passwordField.getValue(), {
|
deluge.client.auth.login(passwordField.getValue(), {
|
||||||
|
@ -139,15 +139,15 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, {
|
||||||
scope: this
|
scope: this
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onClientError: function(errorObj, response, requestOptions) {
|
onClientError: function(errorObj, response, requestOptions) {
|
||||||
if (errorObj.error.code == 1) {
|
if (errorObj.error.code == 1) {
|
||||||
deluge.events.fire('logout');
|
deluge.events.fire('logout');
|
||||||
this.show(true);
|
this.show(true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onShow: function() {
|
onShow: function() {
|
||||||
this.passwordField.focus(true, 100);
|
this.passwordField.focus(true, 300);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue