Browse Source

fix join-group-import-key inputs via slight rewriting of importSecretKeypress(), move last one to js/interface_common.js

readme-update
Simon Grim 9 years ago
parent
commit
77d51b77c2
  1. 12
      js/interface_common.js
  2. 17
      js/twister_user.js

12
js/interface_common.js

@ -2096,6 +2096,18 @@ function inputEnterActivator(event) {
.attr('disabled', elemEvent.val().trim() === ''); .attr('disabled', elemEvent.val().trim() === '');
} }
function importSecretKeypress(event) { // FIXME rename
var elemModule = $(event.target).closest('.module');
var elemEnter = elemModule.find('.import-secret-key');
var secretKey = elemModule.find('.secret-key-import').val();
var peerAlias = elemModule.find('.username-import').val().toLowerCase();
if (secretKey.length === 52 && peerAlias.length)
$.MAL.enableButton(elemEnter);
else
$.MAL.disableButton(elemEnter);
}
function setTextcompleteOnEventTarget(event) { function setTextcompleteOnEventTarget(event) {
// cursor has not set yet and we need to wait 100ms to skip global click event // cursor has not set yet and we need to wait 100ms to skip global click event
setTimeout(setTextcompleteOnElement, 100, event.target, setTimeout(setTextcompleteOnElement, 100, event.target,

17
js/twister_user.js

@ -174,19 +174,6 @@ function sendNewUserTransaction(username, cbFunc) {
}, {}); }, {});
} }
function importSecretKeypress() {
var secretKey = $(".secret-key-import").val();
var username = $(".username-import").val().toLowerCase();
var $importButton = $(".import-secret-key");
if( secretKey.length == 52 && username.length ) {
$.MAL.enableButton( $importButton );
} else {
$.MAL.disableButton( $importButton );
}
}
function importSecretKeyClick() { function importSecretKeyClick() {
var secretKey = $(".secret-key-import").val(); var secretKey = $(".secret-key-import").val();
var username = $(".username-import").val().toLowerCase(); var username = $(".username-import").val().toLowerCase();
@ -214,8 +201,8 @@ function interfaceCommonLoginHandlers() {
/* must specialize: $( ".create-user").bind( "click", function() { createUserClick( processCreateUser ); } ); */ /* must specialize: $( ".create-user").bind( "click", function() { createUserClick( processCreateUser ); } ); */
/* must specialize: $( ".login-created-user").bind( "click", loginCreatedUser ); */ /* must specialize: $( ".login-created-user").bind( "click", loginCreatedUser ); */
$( ".new-username" ).keyup( newUserNameKeypress ); $( ".new-username" ).keyup( newUserNameKeypress );
$( ".secret-key-import" ).keyup( importSecretKeypress ); $('.secret-key-import').on('input', importSecretKeypress);
$( ".username-import" ).keyup( importSecretKeypress ); $('.username-import').on('input', importSecretKeypress);
$( ".import-secret-key").bind( "click", importSecretKeyClick ); $( ".import-secret-key").bind( "click", importSecretKeyClick );
} }

Loading…
Cancel
Save