From 9aa4b87de1e78e599d5d5090c8da3317bbcd450e Mon Sep 17 00:00:00 2001 From: Darren Date: Sat, 26 Oct 2013 14:00:33 +0100 Subject: [PATCH] Application HTML as a template to delay HTML parsing/painting --- client/assets/src/index.html.tmpl | 68 ++++++++++++++------------ client/assets/src/views/application.js | 9 +++- 2 files changed, 44 insertions(+), 33 deletions(-) diff --git a/client/assets/src/index.html.tmpl b/client/assets/src/index.html.tmpl index a094052..964d533 100644 --- a/client/assets/src/index.html.tmpl +++ b/client/assets/src/index.html.tmpl @@ -16,44 +16,43 @@ -
-
-
-
    -
  • -
  • KiwiIRC
  • -
-
- -
-
-
-
- -
-
- -
+ diff --git a/client/assets/src/views/application.js b/client/assets/src/views/application.js index be2ebbe..82563d9 100644 --- a/client/assets/src/views/application.js +++ b/client/assets/src/views/application.js @@ -2,9 +2,11 @@ _kiwi.view.Application = Backbone.View.extend({ initialize: function () { var that = this; + this.$el.append($('#tmpl_application').html().trim()); + $(window).resize(function() { that.doLayout.apply(that); }); this.$el.find('.toolbar').resize(function() { that.doLayout.apply(that); }); - $('#kiwi .controlbox').resize(function() { that.doLayout.apply(that); }); + this.$el.find('.controlbox').resize(function() { that.doLayout.apply(that); }); // Change the theme when the config is changed _kiwi.global.settings.on('change:theme', this.updateTheme, this); @@ -16,6 +18,7 @@ _kiwi.view.Application = Backbone.View.extend({ _kiwi.global.settings.on('change:show_timestamps', this.displayTimestamps, this); this.displayTimestamps(_kiwi.global.settings.get('show_timestamps')); + this.$el.appendTo($('body')); this.doLayout(); $(document).keydown(this.setKeyFocus); @@ -117,6 +120,10 @@ _kiwi.view.Application = Backbone.View.extend({ var el_controlbox = $('#kiwi .controlbox'); var el_resize_handle = $('#kiwi .memberlists_resize_handle'); + if (!el_kiwi.is(':visible')) { + return; + } + var css_heights = { top: el_toolbar.outerHeight(true), bottom: el_controlbox.outerHeight(true) -- 2.25.1