From 511ebba4f6d9285808dd434642e980fbebe8e399 Mon Sep 17 00:00:00 2001 From: Maximilian Mader Date: Thu, 27 Feb 2014 22:33:51 +0100 Subject: [PATCH] Fix scroll position when toggling fullscreen --- file/js/be.bastelstu.Chat.litcoffee | 45 +++++++++++++++-------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/file/js/be.bastelstu.Chat.litcoffee b/file/js/be.bastelstu.Chat.litcoffee index c420e86..d2dd7a2 100644 --- a/file/js/be.bastelstu.Chat.litcoffee +++ b/file/js/be.bastelstu.Chat.litcoffee @@ -119,32 +119,32 @@ Make the user leave the chat when **Tims Chat** is about to be unloaded. async: false suppressErrors: true undefined - + $(window).resize -> # TODO return if WCF.System.Mobile.UX._enabled - return unless $('html').hasClass 'fullscreen' - - do -> - verticalContentPadding = $('#content').innerHeight() - $('#content').height() - verticalSizeOfContentElements = do -> - height = 0 - $('#content > *:visible').each (k, v) -> height += $(v).outerHeight() - height - - freeSpace = $('body').height() - verticalContentPadding - verticalSizeOfContentElements - - $('.timsChatMessageContainer').height $('.timsChatMessageContainer').height() + freeSpace - do -> - verticalUserListContainerPadding = $('#timsChatUserListContainer').innerHeight() - $('#timsChatUserListContainer').height() - sidebarHeight = $('.sidebar > div').height() - - freeSpace = $('body').height() - verticalUserListContainerPadding - sidebarHeight - $('#timsChatUserList').height $('#timsChatUserList').height() + freeSpace - - - + if $('html').hasClass 'fullscreen' + do -> + verticalContentPadding = $('#content').innerHeight() - $('#content').height() + verticalSizeOfContentElements = do -> + height = 0 + $('#content > *:visible').each (k, v) -> height += $(v).outerHeight() + height + + freeSpace = $('body').height() - verticalContentPadding - verticalSizeOfContentElements + + $('.timsChatMessageContainer').height $('.timsChatMessageContainer').height() + freeSpace + do -> + verticalUserListContainerPadding = $('#timsChatUserListContainer').innerHeight() - $('#timsChatUserListContainer').height() + sidebarHeight = $('.sidebar > div').height() + + freeSpace = $('body').height() - verticalUserListContainerPadding - sidebarHeight + $('#timsChatUserList').height $('#timsChatUserList').height() + freeSpace + + if $('#timsChatAutoscroll').data 'status' + $('.timsChatMessageContainer.active').scrollTop $('.timsChatMessageContainer.active').prop 'scrollHeight' + Insert the appropriate smiley code into the input when a smiley is clicked. $('#smilies').on 'click', 'img', -> insertText " #{$(@).attr('alt')} " @@ -334,6 +334,7 @@ Toggle fullscreen mode. $('.timsChatMessageContainer').height messageContainerSize $('#timsChatUserList').height userListSize $('html').removeClass 'fullscreen' + do $(window).resize Toggle checkboxes.