diff --git a/bower.json b/bower.json index 7a1474a95..890d70029 100644 --- a/bower.json +++ b/bower.json @@ -17,16 +17,17 @@ "backbone.localStorage": "1.1.7", "strophe": "git@github.com:strophe/strophejs-bower.git#v1.1.3", "strophe.roster": "https://raw.github.com/strophe/strophejs-plugins/b1f364eb6e854ffe844c57add38e885cfeb9b498/roster/strophe.roster.js", - "strophe.vcard": "https://raw.github.com/strophe/strophejs-plugins/f5c9e16b463610d501591452cded0359f53aae48/vcard/strophe.vcard.js", - "strophe.disco": "https://raw.github.com/jcbrand/strophejs-plugins/75c8693992bc357c699b6d615eeb396e799f5c02/disco/strophe.disco.js", - "strophe.muc": "https://raw.github.com/strophe/strophejs-plugins/02310ad1b8da2962cd05b0f4bceaecca134efed4/muc/strophe.muc.js", + "strophe.vcard": "https://raw.github.com/strophe/strophejs-plugins/f5c9e16b463610d501591452cded0359f53aae48/vcard/strophe.vcard.js", + "strophe.disco": "https://raw.github.com/jcbrand/strophejs-plugins/75c8693992bc357c699b6d615eeb396e799f5c02/disco/strophe.disco.js", + "strophe.muc": "https://raw.github.com/strophe/strophejs-plugins/02310ad1b8da2962cd05b0f4bceaecca134efed4/muc/strophe.muc.js", "otr": "0.2.12", "crypto-js-evanvosberg": "~3.1.2", "almond": "~0.2.9", "requirejs-text": "~2.0.12", "requirejs-tpl-jcbrand": "*", "momentjs": "~2.6.0", - "jquery.browser": "~0.0.6" + "jquery.browser": "~0.0.6", + "backbone.overview": "*" }, "exportsOverride": {} } diff --git a/converse.js b/converse.js index 9eebba70d..974e417cb 100644 --- a/converse.js +++ b/converse.js @@ -3,7 +3,7 @@ * http://conversejs.org * * Copyright (c) 2012, Jan-Carel Brand - * Dual licensed under the MIT and GPL Licenses + * Licensed under the Mozilla Public License (MPL) */ // AMD/global registrations @@ -1339,6 +1339,7 @@ // the opposite of trim, i.e. restoring a trimmed chat box this.$el.insertAfter(converse.chatboxviews.get("controlbox").$el).show(); this.focus(); + converse.refreshWebkit(); this.model.trigger('grow', this.model); }, @@ -2512,17 +2513,11 @@ } }); - this.ChatBoxViews = Backbone.View.extend({ + this.ChatBoxViews = Backbone.Overview.extend({ initialize: function () { - var views = {}; - this.get = function (id) { return views[id]; }; - this.add = function (id, view) { views[id] = view; }; - this.getAll = function () { return views; }; - this.trimmed_chatboxes_view = new converse.TrimmedChatBoxesView({model: this.model}); this.render(); - this.model.on("add", this.onChatAdded, this); this.model.on("grow", function (item) { this.trimChats(this.get(item.get('id'))); @@ -2667,20 +2662,9 @@ } }); - this.TrimmedChatBoxesView = Backbone.View.extend({ + this.TrimmedChatBoxesView = Backbone.Overview.extend({ initialize: function () { - var views = {}; - this.get = function (id) { return views[id]; }; - this.add = function (id, view) { views[id] = view; }; - this.remove = function (id) { - var view = views[id]; - if (view) { - view.remove(); - delete views[id]; - } - }; - this.model.on("change:trimmed", function (item) { var view; if (item.get('trimmed')) { @@ -3125,15 +3109,11 @@ } }); - this.RosterView = Backbone.View.extend({ + this.RosterView = Backbone.Overview.extend({ tagName: 'dl', id: 'converse-roster', initialize: function () { - var views = {}; - this.get = function (id) { return views[id]; }; - this.add = function (id, view) { views[id] = view; }; - this.model.on("add", function (item) { this.addRosterItemView(item).render(item); if (!item.get('vcard_updated')) { @@ -3167,7 +3147,6 @@ }); } this.$el.hide().html(roster_markup); - this.model.fetch({add: true}); // Get the cached roster items from localstorage }, diff --git a/main.js b/main.js index bcdb32d73..c7db44bd5 100644 --- a/main.js +++ b/main.js @@ -8,6 +8,7 @@ config = { "underscore": "components/underscore/underscore", "backbone": "components/backbone/backbone", "backbone.localStorage": "components/backbone.localStorage/backbone.localStorage", + "backbone.overview": "components/backbone.overview/backbone.overview", "text": 'components/requirejs-text/text', "tpl": 'components/requirejs-tpl-jcbrand/tpl', "converse-templates": "src/templates", diff --git a/src/deps-full.js b/src/deps-full.js index e14c032fc..b1d733f86 100644 --- a/src/deps-full.js +++ b/src/deps-full.js @@ -3,6 +3,7 @@ define("converse-dependencies", [ "moment", "locales", "backbone.localStorage", + "backbone.overview", "jquery.tinysort", "jquery.browser", "strophe", diff --git a/src/deps-no-otr.js b/src/deps-no-otr.js index 0adbf313d..b84da6007 100644 --- a/src/deps-no-otr.js +++ b/src/deps-no-otr.js @@ -2,6 +2,7 @@ define("converse-dependencies", [ "moment", "locales", "backbone.localStorage", + "backbone.overview", "jquery.tinysort", "jquery.browser", "strophe",