From c32bd4bbef1f99bf625124ff29f6b9500a0a9c65 Mon Sep 17 00:00:00 2001 From: Maximilian Mader Date: Sun, 23 Feb 2014 01:17:15 +0100 Subject: [PATCH] Improve fullscreen --- file/js/be.bastelstu.Chat.litcoffee | 28 ++++++++++++++++++++++++++-- file/style/be.bastelstu.chat.less | 23 ++++++++++++++++++----- 2 files changed, 44 insertions(+), 7 deletions(-) diff --git a/file/js/be.bastelstu.Chat.litcoffee b/file/js/be.bastelstu.Chat.litcoffee index de0df93..80c298d 100644 --- a/file/js/be.bastelstu.Chat.litcoffee +++ b/file/js/be.bastelstu.Chat.litcoffee @@ -45,6 +45,8 @@ exposed by a function if necessary. lastMessage = null openChannel = 0 + messageContainerSize = 0 + remainingFailures = 3 events = @@ -77,6 +79,8 @@ Initialize **Tims Chat**. Bind needed DOM events and initialize data structures. return false if initialized initialized = true + messageContainerSize = $('.timsChatMessageContainer').height() + v.config = config v.titleTemplate = titleTemplate v.messageTemplate = messageTemplate @@ -111,7 +115,23 @@ 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' + + 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 + Insert the appropriate smiley code into the input when a smiley is clicked. $('#smilies').on 'click', 'img', -> insertText " #{$(@).attr('alt')} " @@ -276,7 +296,9 @@ Toggle fullscreen mode. if $(@).data 'status' $('html').addClass 'fullscreen' + do $(window).resize else + $('.timsChatMessageContainer').height messageContainerSize $('html').removeClass 'fullscreen' Toggle checkboxes. @@ -289,7 +311,9 @@ Toggle checkboxes. Hide topic container. - $('#timsChatTopicCloser').on 'click', -> $('#timsChatTopic').addClass 'invisible' + $('#timsChatTopicCloser').on 'click', -> + $('#timsChatTopic').addClass 'invisible' + do $(window).resize Close private channels diff --git a/file/style/be.bastelstu.chat.less b/file/style/be.bastelstu.chat.less index 57da109..44a2487 100644 --- a/file/style/be.bastelstu.chat.less +++ b/file/style/be.bastelstu.chat.less @@ -292,10 +292,8 @@ } } - &:not(:last-child) { - > .timsChatInnerMessageContainer { - margin-bottom: @wcfGapSmall; - } + > .timsChatInnerMessageContainer { + margin-bottom: @wcfGapSmall; } } } @@ -471,6 +469,11 @@ // TODO html.fullscreen { + html, body { + padding: 0; + margin: 0; + } + &, body, #tplChat #main, @@ -485,7 +488,17 @@ html.fullscreen { #top, #pageHeader, - #pageFooter { + #pageFooter, + #mainMenu, + #topMenu { display: none; } + + .sidebar, #main, #content { + padding-top: 0; + padding-bottom: 0; + border-top: none; + border-bottom: none; + border-radius: 0; + } }