From 85377d880a253047d42bc64f7a0aa4af029f366e Mon Sep 17 00:00:00 2001 From: Darren Date: Sun, 7 Oct 2012 16:36:35 +0100 Subject: [PATCH] Prototype leak fixes --- client_backbone/dev/applet_chanlist.js | 6 ++-- client_backbone/dev/model_panellist.js | 6 ++-- client_backbone/dev/model_server.js | 2 -- client_backbone/dev/view.js | 42 +++++++++----------------- 4 files changed, 21 insertions(+), 35 deletions(-) diff --git a/client_backbone/dev/applet_chanlist.js b/client_backbone/dev/applet_chanlist.js index 78ac676..8898a2c 100644 --- a/client_backbone/dev/applet_chanlist.js +++ b/client_backbone/dev/applet_chanlist.js @@ -40,9 +40,9 @@ }); } - //_.each(this.channels, function (chan) { - // tbody.append(chan.html); - //}); + _.each(this.channels, function (chan) { + tbody.append(chan.html); + }); table.append(tbody); } }); diff --git a/client_backbone/dev/model_panellist.js b/client_backbone/dev/model_panellist.js index 38f8691..f16df71 100755 --- a/client_backbone/dev/model_panellist.js +++ b/client_backbone/dev/model_panellist.js @@ -1,9 +1,6 @@ kiwi.model.PanelList = Backbone.Collection.extend({ model: kiwi.model.Panel, - // Holds the active panel - active: null, - comparator: function (chan) { return chan.get("name"); }, @@ -14,6 +11,9 @@ kiwi.model.PanelList = Backbone.Collection.extend({ this.add(new kiwi.model.Server({'name': kiwi.gateway.get('name')})); this.server = this.getByName(kiwi.gateway.get('name')); + // Holds the active panel + this.active = null; + // Keep a tab on the active panel this.bind('active', function (active_panel) { this.active = active_panel; diff --git a/client_backbone/dev/model_server.js b/client_backbone/dev/model_server.js index eb64e14..55e567f 100755 --- a/client_backbone/dev/model_server.js +++ b/client_backbone/dev/model_server.js @@ -2,8 +2,6 @@ kiwi.model.Server = kiwi.model.Panel.extend({ // Used to determine if this is a server panel server: true, - server_login: null, - initialize: function (attributes) { var name = "Server"; this.view = new kiwi.view.Panel({"model": this, "name": name}); diff --git a/client_backbone/dev/view.js b/client_backbone/dev/view.js index 1ee929b..8fb20be 100755 --- a/client_backbone/dev/view.js +++ b/client_backbone/dev/view.js @@ -35,10 +35,8 @@ kiwi.view.MemberList = Backbone.View.extend({ }); -kiwi.view.UserBox = Backbone.View.extend({ - // Member this userbox is relating to - member: {}, +kiwi.view.UserBox = Backbone.View.extend({ events: { 'click .query': 'queryClick', 'click .info': 'infoClick' @@ -236,12 +234,6 @@ kiwi.view.Panel = Backbone.View.extend({ "click .chan": "chanClick" }, - // none=0, action=1, activity=2, highlight=3 - alert_level: 0, - - // The container this panel is within - $container: null, - initialize: function (options) { this.initializePanel(options); }, @@ -259,6 +251,8 @@ kiwi.view.Panel = Backbone.View.extend({ this.$el.appendTo(this.$container); + this.alert_level = 0; + this.model.bind('msg', this.newMsg, this); this.msg_count = 0; @@ -442,9 +436,6 @@ kiwi.view.Channel = kiwi.view.Panel.extend({ // Model for this = kiwi.model.PanelList kiwi.view.Tabs = Backbone.View.extend({ - tabs_applets: null, - tabs_msg: null, - events: { 'click li': 'tabClick', 'click li img': 'partClick' @@ -601,15 +592,6 @@ kiwi.view.TopicBar = Backbone.View.extend({ kiwi.view.ControlBox = Backbone.View.extend({ - buffer: [], // Stores previously run commands - buffer_pos: 0, // The current position in the buffer - - // Hold tab autocomplete data - tabcomplete: {active: false, data: [], prefix: ''}, - - // Instance of InputPreProcessor - preprocessor: null, - events: { 'keydown input.inp': 'process', 'click .nick': 'showNickChange' @@ -618,9 +600,15 @@ kiwi.view.ControlBox = Backbone.View.extend({ initialize: function () { var that = this; + this.buffer = []; // Stores previously run commands + this.buffer_pos = 0; // The current position in the buffer + this.preprocessor = new InputPreProcessor(); this.preprocessor.recursive_depth = 5; + // Hold tab autocomplete data + this.tabcomplete = {active: false, data: [], prefix: ''}; + kiwi.gateway.bind('change:nick', function () { $('.nick', that.$el).text(this.get('nick')); }); @@ -787,11 +775,11 @@ kiwi.view.ControlBox = Backbone.View.extend({ kiwi.view.StatusMessage = Backbone.View.extend({ - /* Timer for hiding the message */ - tmr: null, - initialize: function () { this.$el.hide(); + + // Timer for hiding the message after X seconds + this.tmr = null; }, text: function (text, opt) { @@ -838,10 +826,10 @@ kiwi.view.ResizeHandler = Backbone.View.extend({ 'mouseup': 'stopDrag' }, - dragging: false, - starting_width: {}, - initialize: function () { + this.dragging = false; + this.starting_width = {}; + $(window).on('mousemove', $.proxy(this.onDrag, this)); }, -- 2.25.1