Commit fcdf309f authored by JC Brand's avatar JC Brand

Move dragresize-specific code out of converse-headline.js

parent 3b71de7e
...@@ -223,6 +223,24 @@ ...@@ -223,6 +223,24 @@
} }
}, },
HeadlinesBoxView: {
events: {
'mousedown .dragresize-top': 'onStartVerticalResize',
'mousedown .dragresize-left': 'onStartHorizontalResize',
'mousedown .dragresize-topleft': 'onStartDiagonalResize'
},
initialize: function () {
$(window).on('resize', _.debounce(this.setDimensions.bind(this), 100));
return this.__super__.initialize.apply(this, arguments);
},
render: function () {
$(window).on('resize', _.debounce(this.setWidth.bind(this), 100));
return this.__super__.render.apply(this, arguments);
}
},
ControlBoxView: { ControlBoxView: {
events: { events: {
'mousedown .dragresize-top': 'onStartVerticalResize', 'mousedown .dragresize-top': 'onStartVerticalResize',
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
// Copyright (c) 2012-2016, Jan-Carel Brand <jc@opkode.com> // Copyright (c) 2012-2016, Jan-Carel Brand <jc@opkode.com>
// Licensed under the Mozilla Public License (MPLv2) // Licensed under the Mozilla Public License (MPLv2)
// //
/*global define, window */ /*global define */
(function (root, factory) { (function (root, factory) {
define("converse-headline", [ define("converse-headline", [
...@@ -67,17 +67,10 @@ ...@@ -67,17 +67,10 @@
events: { events: {
'click .close-chatbox-button': 'close', 'click .close-chatbox-button': 'close',
'click .toggle-chatbox-button': 'minimize', 'click .toggle-chatbox-button': 'minimize',
'keypress textarea.chat-textarea': 'keyPressed', 'keypress textarea.chat-textarea': 'keyPressed'
'mousedown .dragresize-top': 'onStartVerticalResize',
'mousedown .dragresize-left': 'onStartHorizontalResize',
'mousedown .dragresize-topleft': 'onStartDiagonalResize'
}, },
initialize: function () { initialize: function () {
if (typeof this.setDimensions !== "undefined") {
// setDimensions is defined for dragresize
window.addEventListener('resize', _.debounce(this.setDimensions.bind(this), 100));
}
this.disable_mam = true; // Don't do MAM queries for this box this.disable_mam = true; // Don't do MAM queries for this box
this.model.messages.on('add', this.onMessageAdded, this); this.model.messages.on('add', this.onMessageAdded, this);
this.model.on('show', this.show, this); this.model.on('show', this.show, this);
...@@ -101,10 +94,6 @@ ...@@ -101,10 +94,6 @@
) )
) )
); );
if (typeof this.setWidth !== "undefined") {
// setWidth is defined for dragresize
window.addEventListener('resize', _.debounce(this.setWidth.bind(this), 100));
}
this.$content = this.$el.find('.chat-content'); this.$content = this.$el.find('.chat-content');
converse.emit('chatBoxOpened', this); converse.emit('chatBoxOpened', this);
utils.refreshWebkit(); utils.refreshWebkit();
......
...@@ -286,12 +286,11 @@ ...@@ -286,12 +286,11 @@
converse.onConnectStatusChanged converse.onConnectStatusChanged
); );
converse.chatboxviews.get('controlbox') converse.chatboxviews.get('controlbox')
.switchTab({target: that.$tabs.find('.current')}) .switchTab({'target': that.$tabs.find('.current')});
.giveFeedback(__('Now logging you in')); converse.giveFeedback(__('Now logging you in'));
} else { } else {
converse.chatboxviews.get('controlbox') converse.chatboxviews.get('controlbox').renderLoginPanel();
.renderLoginPanel() converse.giveFeedback(__('Registered successfully'));
.giveFeedback(__('Registered successfully'));
} }
that.reset(); that.reset();
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment