Commit 012cbfb6 authored by JC Brand's avatar JC Brand

Rename events.

Remove the "on" prefix. Events are listened to via "on" method, so it's
redundant.
parent bb411b61
...@@ -347,7 +347,7 @@ ...@@ -347,7 +347,7 @@
this.reconnect = function () { this.reconnect = function () {
converse.giveFeedback(__('Reconnecting'), 'error'); converse.giveFeedback(__('Reconnecting'), 'error');
converse.emit('onReconnect'); converse.emit('reconnect');
if (!converse.prebind) { if (!converse.prebind) {
this.connection.connect( this.connection.connect(
this.connection.jid, this.connection.jid,
...@@ -595,7 +595,7 @@ ...@@ -595,7 +595,7 @@
} }
} }
}, this)); }, this));
converse.emit('onReady'); converse.emit('ready');
}; };
// Backbone Models and Views // Backbone Models and Views
...@@ -938,7 +938,7 @@ ...@@ -938,7 +938,7 @@
) )
); );
this.renderToolbar().renderAvatar(); this.renderToolbar().renderAvatar();
converse.emit('onChatBoxOpened', this); converse.emit('chatBoxOpened', this);
setTimeout(function () { setTimeout(function () {
converse.refreshWebkit(); converse.refreshWebkit();
}, 50); }, 50);
...@@ -1116,7 +1116,7 @@ ...@@ -1116,7 +1116,7 @@
} else { } else {
this.sendMessage(message); this.sendMessage(message);
} }
converse.emit('onMessageSend', message); converse.emit('messageSend', message);
} }
this.$el.data('composing', false); this.$el.data('composing', false);
} else if (!this.model.get('chatroom')) { } else if (!this.model.get('chatroom')) {
...@@ -1260,7 +1260,7 @@ ...@@ -1260,7 +1260,7 @@
toggleCall: function (ev) { toggleCall: function (ev) {
ev.stopPropagation(); ev.stopPropagation();
converse.emit('onCallButtonClicked', { converse.emit('callButtonClicked', {
connection: converse.connection, connection: converse.connection,
model: this.model model: this.model
}); });
...@@ -1282,11 +1282,11 @@ ...@@ -1282,11 +1282,11 @@
this.$el.find('div.chat-event').remove(); this.$el.find('div.chat-event').remove();
} }
} }
converse.emit('onBuddyStatusChanged', item.attributes, item.get('chat_status')); converse.emit('buddyStatusChanged', item.attributes, item.get('chat_status'));
} }
if (_.has(item.changed, 'status')) { if (_.has(item.changed, 'status')) {
this.showStatusMessage(); this.showStatusMessage();
converse.emit('onBuddyStatusMessageChanged', item.attributes, item.get('status')); converse.emit('buddyStatusMessageChanged', item.attributes, item.get('status'));
} }
if (_.has(item.changed, 'image')) { if (_.has(item.changed, 'image')) {
this.renderAvatar(); this.renderAvatar();
...@@ -1321,7 +1321,7 @@ ...@@ -1321,7 +1321,7 @@
} else { } else {
this.model.trigger('hide'); this.model.trigger('hide');
} }
converse.emit('onChatBoxClosed', this); converse.emit('chatBoxClosed', this);
return this; return this;
}, },
...@@ -1330,7 +1330,7 @@ ...@@ -1330,7 +1330,7 @@
this.$el.insertAfter(converse.chatboxviews.get("controlbox").$el).show('fast', $.proxy(function () { this.$el.insertAfter(converse.chatboxviews.get("controlbox").$el).show('fast', $.proxy(function () {
converse.refreshWebkit(); converse.refreshWebkit();
this.focus(); this.focus();
converse.emit('onChatBoxMaximized', this); converse.emit('chatBoxMaximized', this);
}, this)); }, this));
}, },
...@@ -1341,7 +1341,7 @@ ...@@ -1341,7 +1341,7 @@
// Minimizes a chat box // Minimizes a chat box
this.model.minimize(); this.model.minimize();
this.$el.hide('fast', converse.refreshwebkit); this.$el.hide('fast', converse.refreshwebkit);
converse.emit('onChatBoxMinimized', this); converse.emit('chatBoxMinimized', this);
}, },
updateVCard: function () { updateVCard: function () {
...@@ -1441,7 +1441,7 @@ ...@@ -1441,7 +1441,7 @@
focus: function () { focus: function () {
this.$el.find('.chat-textarea').focus(); this.$el.find('.chat-textarea').focus();
converse.emit('onChatBoxFocused', this); converse.emit('chatBoxFocused', this);
return this; return this;
}, },
...@@ -1841,7 +1841,7 @@ ...@@ -1841,7 +1841,7 @@
hide: function (callback) { hide: function (callback) {
this.$el.hide('fast', function () { this.$el.hide('fast', function () {
converse.refreshWebkit(); converse.refreshWebkit();
converse.emit('onChatBoxClosed', this); converse.emit('chatBoxClosed', this);
converse.controlboxtoggle.show(function () { converse.controlboxtoggle.show(function () {
if (typeof callback === "function") { if (typeof callback === "function") {
callback(); callback();
...@@ -1855,7 +1855,7 @@ ...@@ -1855,7 +1855,7 @@
this.$el.show('fast', function () { this.$el.show('fast', function () {
converse.refreshWebkit(); converse.refreshWebkit();
}.bind(this)); }.bind(this));
converse.emit('onControlBoxOpened', this); converse.emit('controlBoxOpened', this);
}, this)); }, this));
return this; return this;
}, },
...@@ -2374,7 +2374,7 @@ ...@@ -2374,7 +2374,7 @@
}); });
if (display_sender === 'room') { if (display_sender === 'room') {
// We only emit an event if it's not our own message // We only emit an event if it's not our own message
converse.emit('onMessage', message); converse.emit('message', message);
} }
return true; return true;
}, },
...@@ -2489,7 +2489,7 @@ ...@@ -2489,7 +2489,7 @@
} }
chatbox.receiveMessage($message); chatbox.receiveMessage($message);
converse.roster.addResource(buddy_jid, resource); converse.roster.addResource(buddy_jid, resource);
converse.emit('onMessage', message); converse.emit('message', message);
return true; return true;
} }
}); });
...@@ -2663,7 +2663,7 @@ ...@@ -2663,7 +2663,7 @@
} }
this.remove(); this.remove();
this.model.destroy(); this.model.destroy();
converse.emit('onChatBoxClosed', this); converse.emit('chatBoxClosed', this);
return this; return this;
}, },
...@@ -3048,7 +3048,7 @@ ...@@ -3048,7 +3048,7 @@
}, },
rosterHandler: function (items) { rosterHandler: function (items) {
converse.emit('onRoster', items); converse.emit('roster', items);
this.cleanCache(items); this.cleanCache(items);
_.each(items, function (item, index, items) { _.each(items, function (item, index, items) {
if (this.isSelf(item.jid)) { return; } if (this.isSelf(item.jid)) { return; }
...@@ -3352,7 +3352,7 @@ ...@@ -3352,7 +3352,7 @@
if (!$count.is(':visible')) { if (!$count.is(':visible')) {
$count.show(); $count.show();
} }
converse.emit('onRosterViewUpdated'); converse.emit('rosterViewUpdated');
return this; return this;
}, },
...@@ -3383,10 +3383,10 @@ ...@@ -3383,10 +3383,10 @@
); );
} }
if (_.has(item.changed, 'status')) { if (_.has(item.changed, 'status')) {
converse.emit('onStatusChanged', this.get('status')); converse.emit('statusChanged', this.get('status'));
} }
if (_.has(item.changed, 'status_message')) { if (_.has(item.changed, 'status_message')) {
converse.emit('onStatusMessageChanged', this.get('status_message')); converse.emit('statusMessageChanged', this.get('status_message'));
} }
}, this)); }, this));
}, },
...@@ -3762,7 +3762,7 @@ ...@@ -3762,7 +3762,7 @@
} }
if (this.show_controlbox_by_default) { this.controlboxtoggle.showControlBox(); } if (this.show_controlbox_by_default) { this.controlboxtoggle.showControlBox(); }
this.registerGlobalEventHandlers(); this.registerGlobalEventHandlers();
converse.emit('onInitialized'); converse.emit('initialized');
}; };
return { return {
'initialize': function (settings, callback) { 'initialize': function (settings, callback) {
......
...@@ -9,6 +9,7 @@ Changelog ...@@ -9,6 +9,7 @@ Changelog
2. Configuration options for the chat toolbar have changed. 2. Configuration options for the chat toolbar have changed.
Please refer to the `relevant documentation <http://devbox:8890/docs/html/index.html#visible-toolbar-buttons>`_. Please refer to the `relevant documentation <http://devbox:8890/docs/html/index.html#visible-toolbar-buttons>`_.
* Events have been renamed to remove "on" prefix (which is redundant when used with 'on' method). [jcbrand]
* Simplified Chinese Translations [Lancelot] * Simplified Chinese Translations [Lancelot]
* No initial HTML markup is now needed in the document body for converse.js to work. [jcbrand] * No initial HTML markup is now needed in the document body for converse.js to work. [jcbrand]
* All date handling is now done with moment.js. [jcbrand] * All date handling is now done with moment.js. [jcbrand]
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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