Client: Scrollback setting implemented
authorDarren <darren@darrenwhitlen.com>
Mon, 5 Nov 2012 19:49:31 +0000 (19:49 +0000)
committerDarren <darren@darrenwhitlen.com>
Mon, 5 Nov 2012 19:49:31 +0000 (19:49 +0000)
client/assets/dev/model_panel.js
client/assets/dev/view.js

index 41a4641b4cf7492205b959837e2223f1087515f3..dc1ba6455ef19b76dd99d427df36474583655df9 100644 (file)
@@ -9,7 +9,8 @@ _kiwi.model.Panel = Backbone.Model.extend({
     },\r
 \r
     addMsg: function (nick, msg, type, opts) {\r
-        var message_obj, bs, d;\r
+        var message_obj, bs, d,\r
+            scrollback = (parseInt(_kiwi.global.settings.get('scrollback'), 10) || 250);\r
 \r
         opts = opts || {};\r
 \r
@@ -46,8 +47,8 @@ _kiwi.model.Panel = Backbone.Model.extend({
         bs.push(message_obj);\r
 \r
         // Keep the scrolback limited\r
-        if (bs.length > 250) {\r
-            bs.splice(250);\r
+        if (bs.length > scrollback) {\r
+            bs.splice(scrollback);\r
         }\r
         this.set({"scrollback": bs}, {silent: true});\r
 \r
index a5841a2a7bace2cef4a981ac7bba367c6d79ffd2..147e094c60153853912180180b527232770eb4a9 100644 (file)
@@ -343,7 +343,7 @@ _kiwi.view.Panel = Backbone.View.extend({
 \r
         // Make sure our DOM isn't getting too large (Acts as scrollback)\r
         this.msg_count++;\r
-        if (this.msg_count > 250) {\r
+        if (this.msg_count > (parseInt(_kiwi.global.settings.get('scrollback'), 10) || 250)) {\r
             $('.msg:first', this.$el).remove();\r
             this.msg_count--;\r
         }\r