Anton Shestakov <av6@dwimlabs.net>, Mon, 21 Mar 2016 19:57:24 +0800
messages: new ui element and related things
js/index.js
Permissions: -rw-r--r--
// Generated by CoffeeScript 1.10.0 window.X = new Tram.XMPPInterface(); X.on('connecting', function() { return $('[data-msg^="a/"]').addClass('uk-hidden'); X.on('authfail', function() { return $('[data-msg="a/fail"]').removeClass('uk-hidden'); X.on('disconnected', function() { $('[data-step="login"]').removeClass('uk-hidden'); return $('[data-step="main"]').addClass('uk-hidden'); X.on('connected attached', function() { $('[data-step="login"]').addClass('uk-hidden'); return $('[data-step="main"]').removeClass('uk-hidden'); $('button[data-disconnect]').on('click', function() { return X.disconnect('Logged out'); $form = $('[data-form="connect"]'); $form.find('input').on('keydown', function(e) { if ((!this.required || this.value !== '') && e.keyCode === 13) { index = $form.find('input').index(this); $next = $form.find('input').eq(index + 1); if ($next.length !== 0) { return $form.find('button').trigger('click'); $form.find('button').on('click', function(e) { Tram.validation.unsetError($('#username, #password')); ok &= Tram.validation.validateRequired($('#username'), true); ok &= Tram.validation.validateRequired($('#password')); return X.connect($('#username').val().trim(), $('#password').val()); //# sourceMappingURL=index.js.map