You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
session-desktop/js/views/connecting_to_server_dialog...

48 lines
1.1 KiB
JavaScript

/* global Whisper, i18n, QRCode, lokiPublicChatAPI */
// eslint-disable-next-line func-names
(function() {
'use strict';
window.Whisper = window.Whisper || {};
Whisper.ConnectingToServerDialogView = Whisper.View.extend({
templateName: 'connecting-to-server-template',
className: 'loki-dialog connecting-to-server modal',
initialize(options = {}) {
console.log(`Add server init: ${options}`);
this.title = i18n('loading');
this.cancelText = options.cancelText || i18n('cancel');
this.render();
this.$('.connecting-to-server').bind('keyup', event => this.onKeyup(event));
const serverAPI = lokiPublicChatAPI.findOrCreateServer(
options.serverUrl
);
},
events: {
'click .cancel': 'close',
},
render_attributes() {
return {
title: this.title,
cancel: this.cancelText,
};
},
close() {
this.remove();
},
onKeyup(event) {
switch (event.key) {
case 'Escape':
case 'Esc':
this.close();
break;
default:
break;
}
},
});
})();