From 2f0b0f7a1b99501518a4cf3c3f14359d990a20c8 Mon Sep 17 00:00:00 2001 From: lilia Date: Sun, 24 Aug 2014 21:03:20 -0700 Subject: [PATCH] Get overflow scrolls working Had to resort to a resize event handler. A bit slow at times, but it works. --- js/popup.js | 17 +++++++++++++++++ js/views/conversation_view.js | 1 + stylesheets/index.css | 23 +++++++++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/js/popup.js b/js/popup.js index ec4b3445..fd6dc5ad 100644 --- a/js/popup.js +++ b/js/popup.js @@ -20,6 +20,23 @@ new Whisper.ConversationListView({el: $('#contacts')}); new Whisper.Header({el: $('#header')}); Whisper.Threads.fetch({reset: true}); +function resizer(e) { + var windowheight = window.innerHeight; + var form = $('.send-message-area').outerHeight(); + var gutter_offset = $('#gutter').offset().top; + var contacts_offset = $('#contacts').offset().top; + if (window.innerWidth < 480) { + $('#gutter').css('height', windowheight - gutter_offset - form); + $('#contacts').css('height', windowheight - contacts_offset - form); + } else { + $('#gutter').css('height', windowheight - gutter_offset); + $('#contacts').css('height', windowheight - contacts_offset); + } + $('.discussion').css('height', windowheight - gutter_offset - form); +} +window.addEventListener('resize', resizer, false); +resizer(); + textsecure.registerOnLoadFunction(function() { if (textsecure.storage.getUnencrypted("number_id") === undefined) { extension.navigator.tabs.create("options.html"); diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index 1847cfa5..600ff26c 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -30,6 +30,7 @@ var Whisper = Whisper || {}; render: function() { this.$el.show().insertAfter($('#gutter')); + resizer(); return this; } }); diff --git a/stylesheets/index.css b/stylesheets/index.css index c768ab42..241c59d1 100644 --- a/stylesheets/index.css +++ b/stylesheets/index.css @@ -3,3 +3,26 @@ } #listener, #log { display: none; } + +.gutter { + padding-bottom: 0; + overflow: hidden; +} + +#contacts { + overflow-y: scroll; +} +#contacts::-webkit-scrollbar { + display: none; +} + +.conversation { + margin: 0; + padding: 0; +} + +ul.discussion { + margin: 0; + padding: 10px; + box-sizing: border-box; +}