From 92ed075076b3b48d9a067bda5ae9f83c44d1b42d Mon Sep 17 00:00:00 2001 From: Maximilian Mader Date: Sat, 8 Feb 2014 03:21:25 +0100 Subject: [PATCH 01/11] Rewrite frontend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With this commit pretty much the whole frontend has been rewritten. This should hopefully fix most of the issues in “exotic” styles. The changes include: - Overall cleanup - Better adaption to the WCF design - Reworked private channels menu - Reworked sidebar (may change later, currently the heights of the elements are hardcoded and not dynamic) - Working user action menu - Fixed auto scrolling - Better visual notifications - This software does not contain any easter eggs - No penguins were harmed in the production of this software Todo: - Fullscreen mode - Some language variables --- file/js/be.bastelstu.Chat.litcoffee | 293 ++++++---- file/style/be.bastelstu.chat.less | 813 ++++++++++++++-------------- template/__copyright.tpl | 4 +- template/chat.tpl | 210 ++++--- template/message.tpl | 40 +- template/sidebar.tpl | 46 +- template/userListUser.tpl | 2 +- template/userListUserMenu.tpl | 8 + 8 files changed, 762 insertions(+), 654 deletions(-) create mode 100644 template/userListUserMenu.tpl diff --git a/file/js/be.bastelstu.Chat.litcoffee b/file/js/be.bastelstu.Chat.litcoffee index ece9177..888528d 100644 --- a/file/js/be.bastelstu.Chat.litcoffee +++ b/file/js/be.bastelstu.Chat.litcoffee @@ -6,7 +6,7 @@ everything that happens in the GUI of **Tims Chat**. ### Copyright Information # @author Tim Düsterhus - # @copyright 2010-2013 Tim Düsterhus + # @copyright 2010-2014 Tim Düsterhus # @license Creative Commons Attribution-NonCommercial-ShareAlike # @package be.bastelstu.chat ### @@ -25,7 +25,7 @@ enabling EMCAScript 5 strict mode and overwriting console to prepend the name of window.console.warn "[be.bastelstu.Chat] #{message}" error: (message) -> window.console.error "[be.bastelstu.Chat] #{message}" - + Continue with defining the needed variables. All variables are local to our closure and will be exposed by a function if necessary. @@ -73,7 +73,7 @@ exposed by a function if necessary. Initialize **Tims Chat**. Bind needed DOM events and initialize data structures. initialized = false - init = (roomID, config, titleTemplate, messageTemplate, userTemplate) -> + init = (roomID, config, titleTemplate, messageTemplate, userTemplate, userMenuTemplate) -> return false if initialized initialized = true @@ -81,6 +81,7 @@ Initialize **Tims Chat**. Bind needed DOM events and initialize data structures. v.titleTemplate = titleTemplate v.messageTemplate = messageTemplate v.userTemplate = userTemplate + v.userMenuTemplate = userMenuTemplate console.log 'Initializing' @@ -117,7 +118,8 @@ Insert the appropriate smiley code into the input when a smiley is clicked. Handle private channel menu - $('#privateChannelsMenu').on 'click', '.privateChannel', -> openPrivateChannel $(@).data 'privateChannelID' + $('#timsChatMessageTabMenu > .tabMenu').on 'click', '.timsChatMessageTabMenuAnchor', -> + openPrivateChannel $(@).data 'userID' Handle submitting the form. The message will be validated by some basic checks, passed to the `submit` eventlisteners and afterwards sent to the server by an AJAX request. @@ -217,9 +219,24 @@ Reset autocompleter to default status, when the input is `click`ed, as the posit value: null caret: null +Bind user menu functions + + $('#dropdownMenuContainer').on 'click', '.jsTimsChatUserMenuWhisper', -> + command = "/whisper #{userList.current[$(@).parents('ul').data 'userID'].username}, " + return if $('#timsChatInput').val().match(new RegExp WCF.String.escapeRegExp("^#{command}"), 'i') + + insertText command, prepend: yes + + $('#dropdownMenuContainer').on 'click', '.jsTimsChatUserMenuQuery', -> openPrivateChannel $(@).parents('ul').data 'userID' + $('#dropdownMenuContainer').on 'click', '.jsTimsChatUserMenuBan', -> + command = "/ban #{userList.current[$(@).parents('ul').data 'userID'].username}, " + return if $('#timsChatInput').val().match(new RegExp WCF.String.escapeRegExp("^#{command}"), 'i') + + insertText command, prepend: yes + Refresh the room list when the associated button is `click`ed. - $('#timsChatRoomList button').click -> do refreshRoomList + $('#timsChatRoomListReloadButton').click -> do refreshRoomList Clear the chat by removing every single message once the clear button is `clicked`. @@ -247,9 +264,9 @@ Mark smilies as disabled when they are disabled. $('#timsChatSmilies').click (event) -> if $(@).data 'status' - $('#smilies').removeClass 'disabled' + $('#smilies').removeClass 'invisible' else - $('#smilies').addClass 'disabled' + $('#smilies').addClass 'invisible' Toggle fullscreen mode. @@ -272,12 +289,12 @@ Toggle checkboxes. Hide topic container. - $('.jsTopicCloser').on 'click', -> - if $('.timsChatMessageContainer.active').data('userID') is 0 - $('#timsChatTopic').addClass 'hidden' - else - closePrivateChannel $('.timsChatMessageContainer.active').data('userID') - + $('#timsChatTopicCloser').on 'click', -> $('#timsChatTopic').addClass 'invisible' + +Close private channels + + $('#timsChatMessageTabMenu').on 'click', '.jsChannelCloser', -> closePrivateChannel $(@).parent().data 'userID' + Visibly mark the message once the associated checkbox is checked. $(document).on 'click', '.timsChatMessage :checkbox', (event) -> @@ -289,27 +306,20 @@ Visibly mark the message once the associated checkbox is checked. Scroll down when autoscroll is being activated. $('#timsChatAutoscroll').click (event) -> - if $('#timsChatAutoscroll').data 'status' + if $(@).data 'status' $('.timsChatMessageContainer.active').scrollTop $('.timsChatMessageContainer.active').prop 'scrollHeight' + + scrollUpNotifications = off + $("#timsChatMessageTabMenu > .tabMenu > ul > li.ui-state-active").removeClass 'notify' + $(".timsChatMessageContainer.active").removeClass 'notify' + else + scrollUpNotifications = on + +Bind scroll event on predefined message containers $('.timsChatMessageContainer.active').on 'scroll', (event) -> - event.stopPropagation(); - - element = $ @ - scrollTop = element.scrollTop() - scrollHeight = element.prop 'scrollHeight' - height = element.height() - - if scrollTop < scrollHeight - height - 25 - if $('#timsChatAutoscroll').data('status') is 1 - scrollUpNotifications = on - do $('#timsChatAutoscroll').click - - if scrollTop > scrollHeight - height - 10 - if $('#timsChatAutoscroll').data('status') is 0 - scrollUpNotifications = off - $(@).removeClass 'notification' - do $('#timsChatAutoscroll').click + do event.stopPropagation + handleScroll event Enable duplicate tab detection. @@ -384,35 +394,85 @@ Free the fish. freeTheFish = -> return if $.wcfIsset 'fish' console.warn 'Freeing the fish' - fish = $ """
#{WCF.String.escapeHTML('><((((\u00B0>')}
""" + fish = $ """
""" + fish.direction = 'right' fish.css position: 'fixed' top: '50%' left: '50%' - color: 'black' - textShadow: '1px 1px white' - zIndex: 9999 - + zIndex: 0x7FFFFFFF + textShadow: '1px 1px rgb(0, 0, 0)' + fish.appendTo $ 'body' - pe.fish = new WCF.PeriodicalExecuter -> - left = Math.random() * 100 - 50 - top = Math.random() * 100 - 50 - fish = $ '#fish' + + fish.colors = ['78C5D6', '459ba8', '79C267', 'C5D647', 'F5D63D', 'F28C33', 'E868A2', 'BF62A6'] + fish.colorIndex = 0 + + fish.texts = + right: '><((((\u00B0>' + left: '<\u00B0))))><' + fish.fishes = {} + +Pre build fishes, this allows for faster animation + + $.each fish.texts, (key, value) -> + fish.fishes[key] = [] + index = 0 - left *= -1 unless fish.width() < (fish.position().left + left) < ($(window).width() - fish.width()) - top *= -1 unless fish.height() < (fish.position().top + top) < ($(window).height() - fish.height()) - - if left > 0 - fish.text '><((((\u00B0>' if left > 0 - else if left < 0 - fish.text '<\u00B0))))><' + while index < value.length + html = $ '' + i = 0 + $(value.split '').each (key, value) -> + $("#{value}").css + color: '#' + fish.colors[(i++ + index) % fish.colors.length] + textShadow: '1px 1px rgb(0, 0, 0)' + .appendTo html + fish.fishes[key][index++] = html + return + + fish.find('> span').replaceWith fish.fishes[fish.direction][0] + + fish.updateRainbowText = (key, value) -> + key = key || fish.direction + return unless fish.fishes[key]? || not fish.texts[key]? + value = value || fish.colorIndex++ % fish.texts[key].length + + fish.find('> span').replaceWith fish.fishes[key][value] + + fish.pePos = new WCF.PeriodicalExecuter -> + loops = 0 + loop + ++loops + + left = Math.random() * 300 - 150 + top = Math.random() * 300 - 150 + + if (fish.position().top + top) > 0 and (fish.position().left + left + fish.width()) < $(window).width() and (fish.position().top + top + fish.height()) < $(window).height() and (fish.position().left + left) > 0 + break + else if loops is 10 + console.log 'Magicarp used Splash for the 10th time in a row - it fainted!' + fish.css + 'top': '50%' + 'left': '50%' + break + + if left > 0 and fish.text() isnt '><((((\u00B0>' + fish.direction = 'right' + fish.updateRainbowText null, fish.colorIndex % fish.texts.right.length + else if left < 0 and fish.text() isnt '<\u00B0))))><' + fish.direction = 'left' + fish.updateRainbowText null, fish.colorIndex % fish.texts.left.length fish.animate top: (fish.position().top + top) left: (fish.position().left + left) , 1e3 - , 1.5e3 + , 1.2e3 + + fish.peColor = new WCF.PeriodicalExecuter -> + do fish.updateRainbowText + , .125e3 Fetch new messages from the server and pass them to `handleMessages`. The userlist will be passed to `handleUsers`. `remainingFailures` will be decreased on failure and message loading will be entirely disabled once it reaches zero. @@ -446,15 +506,13 @@ Prevent loading messages in parallel. Insert the given messages into the chat stream. handleMessages = (messages) -> - $('.timsChatMessageContainer.active').trigger 'scroll' - for message in messages message.isInPrivateChannel = (String(message.type) is v.config.messageTypes.WHISPER) and ($.wcfIsset("timsChatMessageContainer#{message.receiver}") or $.wcfIsset("timsChatMessageContainer#{message.sender}")) events.newMessage.fire message createNewMessage = yes - if $('.timsChatMessage:last-child .text').is('ul') and lastMessage isnt null and lastMessage.type in [ 0, 7 ] + if $('.timsChatMessage:last-child .timsChatText').is('ul') and lastMessage isnt null and lastMessage.type in [ v.config.messageTypes.NORMAL, v.config.messageTypes.WHISPER ] if lastMessage.type is message.type and lastMessage.sender is message.sender and lastMessage.receiver is message.receiver and lastMessage.isInPrivateChannel is message.isInPrivateChannel createNewMessage = no @@ -490,11 +548,34 @@ Insert the given messages into the chat stream. else messageContainerID = 0 - $("#timsChatMessageContainer#{messageContainerID} .timsChatMessage:last-child .text").append $(output).find('.text li:last-child') + $("#timsChatMessageContainer#{messageContainerID} .timsChatMessage:last-child .timsChatText").append $(output).find('.timsChatText li:last-child') lastMessage = message + $('.timsChatMessageContainer.active').scrollTop $('.timsChatMessageContainer.active').prop('scrollHeight') if $('#timsChatAutoscroll').data('status') is 1 +Handles scroll event of message containers + + handleScroll = (event) -> + element = $ event.target + + if element.hasClass 'active' + scrollTop = element.scrollTop() + scrollHeight = element.prop 'scrollHeight' + height = element.innerHeight() + + if scrollTop < scrollHeight - height - 25 + if $('#timsChatAutoscroll').data('status') is 1 + scrollUpNotifications = on + do $('#timsChatAutoscroll').click + + if scrollTop > scrollHeight - height - 10 + if $('#timsChatAutoscroll').data('status') is 0 + scrollUpNotifications = off + $("#timsChatMessageTabMenu > .tabMenu > ul > li.ui-state-active").removeClass 'notify' + $(".timsChatMessageContainer.active").removeClass 'notify' + do $('#timsChatAutoscroll').click + Rebuild the userlist based on the given `users`. handleUsers = (users) -> @@ -545,14 +626,7 @@ Build HTML of the user and insert it into the list, if the users was not found i li.append v.userTemplate.fetch user - menu = $ '
    ' - unless user.userID is WCF.User.userID - menu.append $("
  • #{WCF.Language.get('chat.general.query')}
  • ").click -> openPrivateChannel user.userID - menu.append $ "
  • #{WCF.Language.get('chat.general.kick')}
  • " - menu.append $ "
  • #{WCF.Language.get('chat.general.ban')}
  • " - menu.append $ """
  • #{WCF.Language.get('chat.general.profile')}
  • """ - - events.userMenu.fire user, menu + menu = $(v.userMenuTemplate.fetch user) if menu.find('li').length li.append menu @@ -560,7 +634,6 @@ Build HTML of the user and insert it into the list, if the users was not found i li.addClass 'dropdown' li.appendTo $ '#timsChatUserList > ul' - foundUsers[id] = true Remove all users that left the chat. @@ -578,12 +651,17 @@ Insert the given `text` into the input. If `options.append` is true the given `t the existing text. If `options.submit` is true the message will be sent to the server afterwards. insertText = (text, options = { }) -> + options.append = false if options.prepend? and options.prepend and not options.append? + options = $.extend + prepend: false append: true submit: false , options + text = text + $('#timsChatInput').val() if options.prepend text = $('#timsChatInput').val() + text if options.append + $('#timsChatInput').val text do $('#timsChatInput').keyup @@ -595,19 +673,21 @@ the existing text. If `options.submit` is true the message will be sent to the s Send out notifications for the given `message`. The number of unread messages will be prepended to `document.title` and if available desktop notifications will be sent. notify = (message) -> - if scrollUpNotifications - $('.timsChatMessageContainer.active').addClass 'notification' + return if message.sender is WCF.User.userID - if message.isInPrivateChannel - if message.sender is WCF.User.userID - privateChannelID = message.receiver - else - privateChannelID = message.sender + if scrollUpNotifications + $("#timsChatMessageTabMenu > .tabMenu > ul > li.ui-state-active").addClass 'notify' + $(".timsChatMessageContainer.active").addClass 'notify' - if $('.timsChatMessageContainer.active').data('userID') isnt privateChannelID - $("#privateChannel#{privateChannelID}").addClass 'notify' + if message.isInPrivateChannel + id = if message.sender is WCF.User.userID then message.receiver else message.sender + + if $('.timsChatMessageContainer.active').data('userID') isnt id + $("#timsChatMessageTabMenuAnchor#{id}").parent().addClass 'notify' + $("#timsChatMessageContainer#{id}").addClass 'notify' else if $('.timsChatMessageContainer.active').data('userID') isnt 0 - $("#privateChannel0").addClass 'notify' + $("#timsChatMessageTabMenuAnchor0").parent().addClass 'notify' + $("#timsChatMessageContainer0").addClass 'notify' return if isActive or $('#timsChatNotify').data('status') is 0 @@ -645,8 +725,9 @@ Fetch the roomlist from the server and update it in the GUI. for room in data.returnValues li = $ '
  • ' + li.addClass('timsChatRoom').data('roomID', room.roomID) li.addClass 'active' if room.active - $("""#{WCF.String.escapeHTML(room.title)} #{WCF.String.formatNumeric room.userCount}""").addClass('timsChatRoom').data('roomID', room.roomID).appendTo li + $("""#{WCF.String.escapeHTML(room.title)} #{WCF.String.formatNumeric room.userCount}""").appendTo li $('#timsChatRoomList ul').append li if window.history?.replaceState? @@ -702,7 +783,7 @@ Joins a room. success: (data) -> loading = false - $('#timsChatTopic').removeClass 'hidden' + $('#timsChatTopic').removeClass 'invisible' currentRoom = data.returnValues currentRoom.roomID = roomID @@ -734,66 +815,72 @@ Open private channel div = $ '
    ' div.attr 'id', "timsChatMessageContainer#{userID}" div.data 'userID', userID + div.addClass 'tabMenuContent' div.addClass 'timsChatMessageContainer' - div.addClass 'marginTop' div.addClass 'container' - div.wrapInner '
    + +
    +
    +
    +
    + {lang}chat.general.message{/lang} +
    +
    + + +
    +
    +
    + +
    + + {if MODULE_SMILEY && $smileyCategories|count} + {include file='messageFormSmilies' wysiwygSelector=''} + {/if} + +
    + + + {lang}chat.general.smilies{/lang} + - *}
  • - - + +
    + {include file='footer' sandbox=false} diff --git a/template/message.tpl b/template/message.tpl index 4b8f11d..548a2e3 100644 --- a/template/message.tpl +++ b/template/message.tpl @@ -1,12 +1,12 @@ {literal} - {if $message.type == $messageTypes.LEAVE || $message.type == $messageTypes.JOIN} -
    - + {if $message.type == $messageTypes.JOIN || $message.type == $messageTypes.LEAVE} +
    +
    {/if} -
    -
    -
    +
    +
    +
    {if $message.type != $messageTypes.INFORMATION} {if $message.type == $messageTypes.NORMAL || $message.type == $messageTypes.WHISPER || $message.type == $messageTypes.ATTACHMENT} {@$message.avatar[32]} @@ -18,46 +18,38 @@ {/if}
    {if $message.type == $messageTypes.ATTACHMENT} - + {/if}
    -
    - - {if ($message.type == $messageTypes.WHISPER && $message.sender == WCF.User.userID) || $message.type != $messageTypes.WHISPER} +
    + {@$message.formattedUsername} - {else} - {$message.additionalData.receiverUsername} - {/if} - {if $message.type == $messageTypes.WHISPER} - - {if ($message.type == $messageTypes.WHISPER && $message.sender == WCF.User.userID) || $message.type != $messageTypes.WHISPER} - {$message.additionalData.receiverUsername} - {else} - {@$message.formattedUsername} + {if $message.type == $messageTypes.WHISPER} + + {$message.additionalData.receiverUsername} {/if} - {/if} {if $message.type == $messageTypes.NORMAL || $message.type == $messageTypes.WHISPER || $message.type == $messageTypes.ATTACHMENT} {if $message.type == $messageTypes.ATTACHMENT}{lang}chat.message.{$messageTypes.ATTACHMENT}{/lang}{/if} -
      +
      • {if $message.isFollowUp} {/if} {@$message.formattedMessage}
      {elseif $message.type == $messageTypes.INFORMATION} -
      {@$message.formattedMessage}
      +
      {@$message.formattedMessage}
      {else} - {@$message.formattedMessage} + {@$message.formattedMessage} {/if}
    - +
    diff --git a/template/sidebar.tpl b/template/sidebar.tpl index 5d0e7be..95a720f 100644 --- a/template/sidebar.tpl +++ b/template/sidebar.tpl @@ -1,29 +1,19 @@ -
    - - -
    -
    - -
    - -
    - -
    -
    -
    \ No newline at end of file +
    + +
    + {lang}chat.general.rooms{/lang} +
    +
      + +
    +
    + +
    diff --git a/template/userListUser.tpl b/template/userListUser.tpl index 0f7b53f..a514824 100644 --- a/template/userListUser.tpl +++ b/template/userListUser.tpl @@ -1 +1 @@ -{literal}{@$avatar['24']}{$username}{/literal} +{literal}{@$avatar['24']}{$username}{/literal} diff --git a/template/userListUserMenu.tpl b/template/userListUserMenu.tpl new file mode 100644 index 0000000..4668d32 --- /dev/null +++ b/template/userListUserMenu.tpl @@ -0,0 +1,8 @@ +{literal} + +{/literal} From c56ce9ccdccb1b6207b0ff4026c54db32a00bcd1 Mon Sep 17 00:00:00 2001 From: Maximilian Mader Date: Sat, 8 Feb 2014 16:31:57 +0100 Subject: [PATCH 02/11] Bump version number --- package.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.xml b/package.xml index f5a4388..3a325f9 100644 --- a/package.xml +++ b/package.xml @@ -6,7 +6,7 @@ 1 - 3.0.0 Alpha 90 + 3.0.0 Alpha 100 2011-11-26 ]]> From dcc475c828a2adeda316175480d183678a00e72b Mon Sep 17 00:00:00 2001 From: Maximilian Mader Date: Mon, 10 Feb 2014 00:43:18 +0100 Subject: [PATCH 03/11] Fix message types being treated as strings --- template/chat.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/chat.tpl b/template/chat.tpl index 6b73530..07f64a1 100644 --- a/template/chat.tpl +++ b/template/chat.tpl @@ -53,7 +53,7 @@ reloadTime: {@CHAT_RELOADTIME}, messageURL: '{link application="chat" controller="NewMessages"}{/link}', installedCommands: [ {implode from=$commands item='command'}'{$command|encodeJS}'{/implode} ], - messageTypes: { {implode from=$messageTypes key='name' item='messageType'}'{$name|substr:5|encodeJS}': '{$messageType|encodeJS}'{/implode} } + messageTypes: { {implode from=$messageTypes key='name' item='messageType'}'{$name|substr:5|encodeJS}': {$messageType}{/implode} } }; {event name='beforeInit'} From 2dd8c4777833652688a350090e33a4437b9c0e92 Mon Sep 17 00:00:00 2001 From: Maximilian Mader Date: Mon, 10 Feb 2014 00:57:01 +0100 Subject: [PATCH 04/11] =?UTF-8?q?Fix=20leftover=20of=20=E2=80=9Cstringy?= =?UTF-8?q?=E2=80=9C=20message=20types?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- file/js/be.bastelstu.Chat.litcoffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/file/js/be.bastelstu.Chat.litcoffee b/file/js/be.bastelstu.Chat.litcoffee index 888528d..de0df93 100644 --- a/file/js/be.bastelstu.Chat.litcoffee +++ b/file/js/be.bastelstu.Chat.litcoffee @@ -507,7 +507,7 @@ Insert the given messages into the chat stream. handleMessages = (messages) -> for message in messages - message.isInPrivateChannel = (String(message.type) is v.config.messageTypes.WHISPER) and ($.wcfIsset("timsChatMessageContainer#{message.receiver}") or $.wcfIsset("timsChatMessageContainer#{message.sender}")) + message.isInPrivateChannel = (message.type is v.config.messageTypes.WHISPER) and ($.wcfIsset("timsChatMessageContainer#{message.receiver}") or $.wcfIsset("timsChatMessageContainer#{message.sender}")) events.newMessage.fire message From c32bd4bbef1f99bf625124ff29f6b9500a0a9c65 Mon Sep 17 00:00:00 2001 From: Maximilian Mader Date: Sun, 23 Feb 2014 01:17:15 +0100 Subject: [PATCH 05/11] 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; + } } From 4e641fdfa19b13aa2c3cfae2a6ad62959be50b7b Mon Sep 17 00:00:00 2001 From: Maximilian Mader Date: Thu, 27 Feb 2014 15:40:34 +0100 Subject: [PATCH 06/11] Adjust sidebar height in fullscreen mode --- file/js/be.bastelstu.Chat.litcoffee | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/file/js/be.bastelstu.Chat.litcoffee b/file/js/be.bastelstu.Chat.litcoffee index 80c298d..244d620 100644 --- a/file/js/be.bastelstu.Chat.litcoffee +++ b/file/js/be.bastelstu.Chat.litcoffee @@ -46,6 +46,7 @@ exposed by a function if necessary. openChannel = 0 messageContainerSize = 0 + userListSize = 0 remainingFailures = 3 @@ -80,6 +81,7 @@ Initialize **Tims Chat**. Bind needed DOM events and initialize data structures. initialized = true messageContainerSize = $('.timsChatMessageContainer').height() + userListSize = $('#timsChatUserList').height() v.config = config v.titleTemplate = titleTemplate @@ -122,15 +124,24 @@ Make the user leave the chat when **Tims Chat** is about to be unloaded. return unless $('html').hasClass 'fullscreen' - verticalContentPadding = $('#content').innerHeight() - $('#content').height() - verticalSizeOfContentElements = do -> - height = 0 - $('#content > *:visible').each (k, v) -> height += $(v).outerHeight() - height + do -> + verticalContentPadding = $('#content').innerHeight() - $('#content').height() + verticalSizeOfContentElements = do -> + height = 0 + $('#content > *:visible').each (k, v) -> height += $(v).outerHeight() + height - freeSpace = $('body').height() - verticalContentPadding - verticalSizeOfContentElements + 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 + - $('.timsChatMessageContainer').height $('.timsChatMessageContainer').height() + freeSpace Insert the appropriate smiley code into the input when a smiley is clicked. @@ -299,6 +310,7 @@ Toggle fullscreen mode. do $(window).resize else $('.timsChatMessageContainer').height messageContainerSize + $('#timsChatUserList').height userListSize $('html').removeClass 'fullscreen' Toggle checkboxes. From dc2e75cf722b06f2ba9d837696d8b51ef4adeb45 Mon Sep 17 00:00:00 2001 From: Maximilian Mader Date: Thu, 27 Feb 2014 16:14:11 +0100 Subject: [PATCH 07/11] Fix private channels in fullscreen mode --- file/js/be.bastelstu.Chat.litcoffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/file/js/be.bastelstu.Chat.litcoffee b/file/js/be.bastelstu.Chat.litcoffee index 244d620..199185e 100644 --- a/file/js/be.bastelstu.Chat.litcoffee +++ b/file/js/be.bastelstu.Chat.litcoffee @@ -861,6 +861,7 @@ Open private channel handleScroll event $('#timsChatMessageContainer0').after div + $('.timsChatMessageContainer').height $('.timsChatMessageContainer').height() if userID isnt 0 $('#timsChatTopic').removeClass 'empty' @@ -903,6 +904,7 @@ Open private channel $('#timsChatMessageTabMenu').wcfTabs 'select', $("#timsChatMessageTabMenuAnchor#{userID}").parent().index() do WCF.DOMNodeInsertedHandler.execute + do $(window).resize openChannel = userID From fcf80a637ed70d7441d4d2b9e9864b55003bafdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 27 Feb 2014 16:46:12 +0100 Subject: [PATCH 08/11] Fix typo in __copyright.tpl --- template/__copyright.tpl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/template/__copyright.tpl b/template/__copyright.tpl index 7a8ea44..2fb7b4d 100644 --- a/template/__copyright.tpl +++ b/template/__copyright.tpl @@ -6,7 +6,7 @@
    {lang}chat.general.copyright.leader{/lang}
    @@ -14,8 +14,8 @@
    {lang}chat.general.copyright.developer{/lang}
    @@ -35,13 +35,13 @@
    {lang}chat.general.copyright.thanks{/lang}
    From 168e1a9d286b68cfcf94c240a4a04443357a41b7 Mon Sep 17 00:00:00 2001 From: Maximilian Mader Date: Thu, 27 Feb 2014 18:55:53 +0100 Subject: [PATCH 09/11] Update language variables --- acptemplate/__messageLogTable.tpl | 2 +- acptemplate/chatSuspensionList.tpl | 8 +- acptemplate/messageLog.tpl | 4 +- file/acp/be.bastelstu.chat.update.php | 2 +- file/js/be.bastelstu.Chat.litcoffee | 4 +- file/lib/data/message/Message.class.php | 2 +- .../command/commands/InfoCommand.class.php | 4 +- language/de.xml | 76 ++++++++++--------- template/__copyright.tpl | 12 +-- template/chat.tpl | 54 ++++++------- template/message.tpl | 2 +- template/sidebar.tpl | 6 +- template/userListUserMenu.tpl | 8 +- 13 files changed, 94 insertions(+), 90 deletions(-) diff --git a/acptemplate/__messageLogTable.tpl b/acptemplate/__messageLogTable.tpl index f12c738..157f124 100644 --- a/acptemplate/__messageLogTable.tpl +++ b/acptemplate/__messageLogTable.tpl @@ -3,7 +3,7 @@ {lang}wcf.global.objectID{/lang} - {lang}chat.general.time{/lang} + {lang}chat.global.time{/lang} {lang}wcf.user.username{/lang} {lang}chat.acp.log.message{/lang} diff --git a/acptemplate/chatSuspensionList.tpl b/acptemplate/chatSuspensionList.tpl index c632484..e7330f3 100644 --- a/acptemplate/chatSuspensionList.tpl +++ b/acptemplate/chatSuspensionList.tpl @@ -66,7 +66,7 @@
    -
    +
    {foreach from=$rooms item='roomBit'} @@ -38,7 +38,7 @@
    -
    +
    {if $errorField == 'date'} diff --git a/file/acp/be.bastelstu.chat.update.php b/file/acp/be.bastelstu.chat.update.php index c7e59c8..df8725b 100644 --- a/file/acp/be.bastelstu.chat.update.php +++ b/file/acp/be.bastelstu.chat.update.php @@ -41,7 +41,7 @@ public function execute() { 'roomID' => $room->roomID, 'time' => TIME_NOW, 'type' => \chat\data\message\Message::TYPE_INFORMATION, - 'message' => \wcf\system\WCF::getLanguage()->get('chat.general.information.chatUpdate') + 'message' => \wcf\system\WCF::getLanguage()->get('chat.global.information.chatUpdate') ) )); $messageAction->executeAction(); diff --git a/file/js/be.bastelstu.Chat.litcoffee b/file/js/be.bastelstu.Chat.litcoffee index 199185e..f23518f 100644 --- a/file/js/be.bastelstu.Chat.litcoffee +++ b/file/js/be.bastelstu.Chat.litcoffee @@ -730,7 +730,7 @@ Send out notifications for the given `message`. The number of unread messages wi document.title = v.titleTemplate.fetch $.extend {}, currentRoom, newMessageCount: ++newMessageCount - title = WCF.Language.get 'chat.general.notify.title' + title = WCF.Language.get 'chat.global.notify.title' content = "#{message.username}#{message.separator} #{message.message}" if window.Notification?.permission is 'granted' @@ -865,7 +865,7 @@ Open private channel if userID isnt 0 $('#timsChatTopic').removeClass 'empty' - $('#timsChatTopic > .topic').html WCF.Language.get 'chat.general.privateChannelTopic', {username: userList.allTime[userID].username} + $('#timsChatTopic > .topic').html WCF.Language.get 'chat.global.privateChannelTopic', {username: userList.allTime[userID].username} $('#timsChatMessageTabMenu').removeClass 'singleTab' unless $.wcfIsset "timsChatMessageTabMenuAnchor#{userID}" diff --git a/file/lib/data/message/Message.class.php b/file/lib/data/message/Message.class.php index 634f2d0..0c4a5b5 100644 --- a/file/lib/data/message/Message.class.php +++ b/file/lib/data/message/Message.class.php @@ -120,7 +120,7 @@ public function getFormattedMessage($type = 'text/html') { */ public function getUsername($colored = false) { $username = $this->username; - if ($this->type == self::TYPE_INFORMATION) return WCF::getLanguage()->get('chat.general.information'); + if ($this->type == self::TYPE_INFORMATION) return WCF::getLanguage()->get('chat.global.information'); if ($colored) { $username = \chat\util\ChatUtil::gradient($username, $this->color1, $this->color2); diff --git a/file/lib/system/command/commands/InfoCommand.class.php b/file/lib/system/command/commands/InfoCommand.class.php index 3fca8b0..66bae76 100644 --- a/file/lib/system/command/commands/InfoCommand.class.php +++ b/file/lib/system/command/commands/InfoCommand.class.php @@ -39,7 +39,7 @@ public function __construct(\chat\system\command\CommandHandler $commandHandler) // Room $room = \chat\data\room\RoomCache::getInstance()->getRoom($this->user->chatRoomID); if ($room !== null && $room->canEnter()) { - $this->lines[WCF::getLanguage()->get('chat.general.room')] = $room->getTitle(); + $this->lines[WCF::getLanguage()->get('chat.global.room')] = $room->getTitle(); } // Suspensions @@ -50,7 +50,7 @@ public function __construct(\chat\system\command\CommandHandler $commandHandler) if (!$typeSuspension->isVisible()) continue; $dateTime = DateUtil::getDateTimeByTimestamp($typeSuspension->expires); - $name = WCF::getLanguage()->getDynamicVariable('chat.general.information.suspension', array( + $name = WCF::getLanguage()->getDynamicVariable('chat.global.information.suspension', array( 'suspension' => $typeSuspension, 'room' => \chat\data\room\RoomCache::getInstance()->getRoom($typeSuspension->roomID) )); diff --git a/language/de.xml b/language/de.xml index a1c849d..89ab04a 100644 --- a/language/de.xml +++ b/language/de.xml @@ -7,7 +7,6 @@ - @@ -101,6 +100,8 @@ + + @@ -135,46 +136,49 @@ Probieren Sie, den Chat neu zu laden + 3.0.0 Alpha 110 2011-11-26 ]]> From 2a0dd00875072e6600864dd31ab8645b00bb35b4 Mon Sep 17 00:00:00 2001 From: Maximilian Mader Date: Thu, 27 Feb 2014 19:13:42 +0100 Subject: [PATCH 11/11] Fix sidebar padding in fullscreen mode and update some language variables --- file/style/be.bastelstu.chat.less | 5 ++++- language/de.xml | 3 ++- template/message.tpl | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/file/style/be.bastelstu.chat.less b/file/style/be.bastelstu.chat.less index 44a2487..3f6b896 100644 --- a/file/style/be.bastelstu.chat.less +++ b/file/style/be.bastelstu.chat.less @@ -495,8 +495,11 @@ html.fullscreen { } .sidebar, #main, #content { - padding-top: 0; padding-bottom: 0; + } + + #main, #content { + padding-top: 0; border-top: none; border-bottom: none; border-radius: 0; diff --git a/language/de.xml b/language/de.xml index 89ab04a..7e3cf30 100644 --- a/language/de.xml +++ b/language/de.xml @@ -164,13 +164,14 @@ Probieren Sie, den Chat neu zu laden