From 3c5daea67e44037592c8faf9401eac701de93232 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 13 Sep 2013 22:19:08 +0200 Subject: [PATCH 01/15] Add missing language items and improve some others see #55 --- acptemplate/chatSuspensionList.tpl | 2 +- .../command/AbstractSuspensionCommand.class.php | 2 +- .../command/AbstractUnsuspensionCommand.class.php | 2 +- .../command/commands/TemproomCommand.class.php | 2 +- language/de.xml | 12 +++++++++--- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/acptemplate/chatSuspensionList.tpl b/acptemplate/chatSuspensionList.tpl index b736365..c632484 100644 --- a/acptemplate/chatSuspensionList.tpl +++ b/acptemplate/chatSuspensionList.tpl @@ -135,7 +135,7 @@ {foreach from=$objects item=$suspension} - + {event name='rowButtons'} {#$suspension->suspensionID} diff --git a/file/lib/system/command/AbstractSuspensionCommand.class.php b/file/lib/system/command/AbstractSuspensionCommand.class.php index 8d15e7c..1c2551f 100644 --- a/file/lib/system/command/AbstractSuspensionCommand.class.php +++ b/file/lib/system/command/AbstractSuspensionCommand.class.php @@ -60,7 +60,7 @@ public function executeAction() { if ($suspension = suspension\Suspension::getSuspensionByUserRoomAndType($this->user, $room, static::SUSPENSION_TYPE)) { if ($suspension->expires >= $this->expires) { - throw new \wcf\system\exception\UserInputException('text', WCF::getLanguage()->get('wcf.chat.suspension.exists')); + throw new \wcf\system\exception\UserInputException('text', WCF::getLanguage()->get('chat.suspension.exists')); } $action = new suspension\SuspensionAction(array($suspension), 'revoke', array( diff --git a/file/lib/system/command/AbstractUnsuspensionCommand.class.php b/file/lib/system/command/AbstractUnsuspensionCommand.class.php index 7fa1082..3f18bb3 100644 --- a/file/lib/system/command/AbstractUnsuspensionCommand.class.php +++ b/file/lib/system/command/AbstractUnsuspensionCommand.class.php @@ -48,7 +48,7 @@ public function executeAction() { $action->executeAction(); } else { - throw new \wcf\system\exception\UserInputException('text', WCF::getLanguage()->get('wcf.chat.suspension.notExists')); + throw new \wcf\system\exception\UserInputException('text', WCF::getLanguage()->get('chat.suspension.notExists')); } } diff --git a/file/lib/system/command/commands/TemproomCommand.class.php b/file/lib/system/command/commands/TemproomCommand.class.php index 121e69e..1c1fd27 100644 --- a/file/lib/system/command/commands/TemproomCommand.class.php +++ b/file/lib/system/command/commands/TemproomCommand.class.php @@ -75,7 +75,7 @@ public function getType() { * @see \chat\system\command\ICommand::getMessage() */ public function getMessage() { - return $this->roomName; + return WCF::getLanguage()->getDynamicVariable('chat.message.temproom.success', array('roomName' => $this->roomName)); } /** diff --git a/language/de.xml b/language/de.xml index 6ab1255..8512df0 100644 --- a/language/de.xml +++ b/language/de.xml @@ -17,8 +17,10 @@ - - revokerUsername}]]> + + username}“ wirklich zurückziehen?]]> + + revokerUsername}“]]> @@ -86,7 +88,7 @@ - + @@ -107,6 +109,7 @@ getCommand()}“ wurde nicht gefunden.]]> getUsername()}“ wurde nicht gefunden.]]> + @@ -188,11 +191,14 @@ Probieren Sie den Chat neu zu laden From 6bcb12b2c8b1b4e8ff13ab26a6158ceeb8f75d9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 13 Sep 2013 22:35:30 +0200 Subject: [PATCH 02/15] Add TODO --- file/lib/data/suspension/SuspensionAction.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/file/lib/data/suspension/SuspensionAction.class.php b/file/lib/data/suspension/SuspensionAction.class.php index b0bf7e6..abdc935 100644 --- a/file/lib/data/suspension/SuspensionAction.class.php +++ b/file/lib/data/suspension/SuspensionAction.class.php @@ -30,6 +30,7 @@ public function validateRevoke() { * Revokes suspensions. */ public function revoke() { + // TODO: ignore revokes if suspension already is revoked if (!isset($this->parameters['revoker'])) { $this->parameters['revoker'] = null; } From 829c01f1d5457f5c7892281be41228bb7dd07d07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sun, 15 Sep 2013 15:25:32 +0200 Subject: [PATCH 03/15] Remove obsolete less --- file/style/be.bastelstu.chat.less | 8 -------- 1 file changed, 8 deletions(-) diff --git a/file/style/be.bastelstu.chat.less b/file/style/be.bastelstu.chat.less index 9b55623..5c8ccc2 100644 --- a/file/style/be.bastelstu.chat.less +++ b/file/style/be.bastelstu.chat.less @@ -109,14 +109,6 @@ &.small { display: block; } - - &.framed { - > .icon { - background-color: @wcfContentBackgroundColor; - border: 1px solid @wcfContainerBorderColor; - padding: 1px; - } - } } &.active { From a82d6bd6b5553682dfb923dd8fbdb73a19736919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sun, 15 Sep 2013 22:39:40 +0200 Subject: [PATCH 04/15] Clean up LESS a bit see #54 --- file/style/be.bastelstu.chat.less | 47 +++++++++---------------------- template/sidebar.tpl | 4 ++- 2 files changed, 16 insertions(+), 35 deletions(-) diff --git a/file/style/be.bastelstu.chat.less b/file/style/be.bastelstu.chat.less index 5c8ccc2..7504ec4 100644 --- a/file/style/be.bastelstu.chat.less +++ b/file/style/be.bastelstu.chat.less @@ -29,10 +29,6 @@ } #tplChat { - #main > div { - overflow: hidden; - } - #timsChatTopic { padding: @wcfGapTiny; .transition(height, .2s); @@ -45,10 +41,6 @@ border: 0px; padding: 0px; margin: 0px; - - ~ #timsChatMessageContainer { - margin-top: 0; - } } .jsTopicCloser { @@ -67,13 +59,13 @@ &.shown { opacity: 1; z-index: 130; - + ~ .timsChatMessageContainer { margin-left: 35px; border-top-left-radius: 0; } } - + > ul { text-align: right; @@ -84,7 +76,7 @@ } } } - + > li:last-child { > .userAvatar.framed { img, > canvas, > .icon { @@ -92,7 +84,7 @@ } } } - + > li { margin-bottom: -1px; background-color: @wcfContainerBackgroundColor; @@ -181,7 +173,7 @@ } &:nth-child(even) { - > .innerMessageContainer.bubble .innerMessage, .innerMessageContainer.right.bubble .innerMessage { + > .innerMessageContainer.bubble .innerMessage { background-color: @wcfContainerAccentBackgroundColor; &:after { @@ -213,7 +205,6 @@ float: right; } - .username { font-weight: bold; } @@ -400,13 +391,14 @@ #timsChatRoomList { > div { > div { - margin-top: @wcfGapMedium; text-align: center; } } } #smilies { + margin-top: @wcfGapMedium; + li { .transition(opacity, .2s); } @@ -416,14 +408,6 @@ opacity: .5; } } - - margin-top: @wcfGapMedium; - } - - @media only screen and (max-width: 800px) { - .timsChatMessage .text li > time, #smilies { - display: none !important; - } } #timsChatOptions { @@ -432,17 +416,6 @@ } } - #toggleRooms .ajaxLoad { - position: absolute; - right: 10px; - top: 7px; - display: none; - } - - #timsChatCopyright { - .textShadow(@wcfContentBackgroundColor); - } - #timsChatCopyrightDialog > div { background-position: right center; background-repeat: no-repeat; @@ -457,6 +430,12 @@ animation-timing-function: linear; border-color: @wcfInputHoverBorderColor; } + + @media only screen and (max-width: 800px) { + .timsChatMessage .text li > time, #smilies { + display: none !important; + } + } } html.fullscreen { diff --git a/template/sidebar.tpl b/template/sidebar.tpl index b41cf74..5d0e7be 100644 --- a/template/sidebar.tpl +++ b/template/sidebar.tpl @@ -19,7 +19,9 @@
-
+
+ +
From e1dc33511b396af72d8c5d70d6cdd35f9bb1d609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sun, 15 Sep 2013 22:44:50 +0200 Subject: [PATCH 05/15] Ignore errors when setting local storage for duplicate tab protection --- file/js/be.bastelstu.Chat.litcoffee | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/file/js/be.bastelstu.Chat.litcoffee b/file/js/be.bastelstu.Chat.litcoffee index aaf448b..4fa3a6e 100644 --- a/file/js/be.bastelstu.Chat.litcoffee +++ b/file/js/be.bastelstu.Chat.litcoffee @@ -315,11 +315,11 @@ Scroll down when autoscroll is being activated. Enable duplicate tab detection. - window.localStorage.setItem 'be.bastelstu.chat.session', chatSession - $(window).on 'storage', (event) -> - if event.originalEvent.key is 'be.bastelstu.chat.session' - if parseInt(event.originalEvent.newValue) isnt chatSession - showError WCF.Language.get 'chat.error.duplicateTab' + try + window.localStorage.setItem 'be.bastelstu.chat.session', chatSession + $(window).on 'storage', (event) -> + if event.originalEvent.key is 'be.bastelstu.chat.session' + showError WCF.Language.get 'chat.error.duplicateTab' if parseInt(event.originalEvent.newValue) isnt chatSession Ask for permissions to use Desktop notifications when notifications are activated. From cd926813bcbda8ec46c7723c76e92586c4389c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sun, 15 Sep 2013 22:46:14 +0200 Subject: [PATCH 06/15] Use unless + is instead of if + isnt --- 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 4fa3a6e..fe450d8 100644 --- a/file/js/be.bastelstu.Chat.litcoffee +++ b/file/js/be.bastelstu.Chat.litcoffee @@ -319,7 +319,7 @@ Enable duplicate tab detection. window.localStorage.setItem 'be.bastelstu.chat.session', chatSession $(window).on 'storage', (event) -> if event.originalEvent.key is 'be.bastelstu.chat.session' - showError WCF.Language.get 'chat.error.duplicateTab' if parseInt(event.originalEvent.newValue) isnt chatSession + showError WCF.Language.get 'chat.error.duplicateTab' unless parseInt(event.originalEvent.newValue) is chatSession Ask for permissions to use Desktop notifications when notifications are activated. From 14b453495cee82b3639e16d0118b90cf186d3bc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sun, 15 Sep 2013 22:53:53 +0200 Subject: [PATCH 07/15] Clean up CoffeeScript a bit --- file/js/be.bastelstu.Chat.litcoffee | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/file/js/be.bastelstu.Chat.litcoffee b/file/js/be.bastelstu.Chat.litcoffee index fe450d8..453850a 100644 --- a/file/js/be.bastelstu.Chat.litcoffee +++ b/file/js/be.bastelstu.Chat.litcoffee @@ -75,7 +75,7 @@ Initialize **Tims Chat**. Bind needed DOM events and initialize data structures. init = (roomID, config, titleTemplate, messageTemplate, userTemplate) -> return false if initialized initialized = true - + v.config = config v.titleTemplate = titleTemplate v.messageTemplate = messageTemplate @@ -93,8 +93,7 @@ When **Tims Chat** becomes focused mark the chat as active and remove the number When **Tims Chat** loses the focus mark the chat as inactive. - $(window).blur -> - isActive = false + $(window).blur -> isActive = false Make the user leave the chat when **Tims Chat** is about to be unloaded. @@ -113,13 +112,11 @@ Make the user leave the chat when **Tims Chat** is about to be unloaded. Insert the appropriate smiley code into the input when a smiley is clicked. - $('#smilies').on 'click', 'img', -> - insertText " #{$(@).attr('alt')} " + $('#smilies').on 'click', 'img', -> insertText " #{$(@).attr('alt')} " Handle private channel menu - $('#privateChannelsMenu').on 'click', '.privateChannel', -> - openPrivateChannel $(@).data 'privateChannelID' + $('#privateChannelsMenu').on 'click', '.privateChannel', -> openPrivateChannel $(@).data 'privateChannelID' 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. @@ -132,8 +129,7 @@ and afterwards sent to the server by an AJAX request. return false if text.length is 0 - unless openChannel is 0 - text = "/whisper #{userList.allTime[openChannel].username}, #{text}" + text = "/whisper #{userList.allTime[openChannel].username}, #{text}" unless openChannel is 0 # Free the fish! do freeTheFish if text.toLowerCase() is '/free the fish' @@ -222,8 +218,7 @@ Reset autocompleter to default status, when the input is `click`ed, as the posit Refresh the room list when the associated button is `click`ed. - $('#timsChatRoomList button').click -> - do refreshRoomList + $('#timsChatRoomList button').click -> do refreshRoomList Clear the chat by removing every single message once the clear button is `clicked`. @@ -261,7 +256,7 @@ Toggle fullscreen mode. # Force dropdowns to reorientate $('.dropdownMenu').data 'orientationX', '' - if $('#timsChatFullscreen').data 'status' + if $(@).data 'status' $('html').addClass 'fullscreen' else $('html').removeClass 'fullscreen' @@ -326,7 +321,7 @@ Ask for permissions to use Desktop notifications when notifications are activate if window.Notification? $('#timsChatNotify').click (event) -> return unless $(@).data 'status' - if window.Notification.permission isnt 'granted' + unless window.Notification.permission is 'granted' window.Notification.requestPermission (permission) -> window.Notification.permission ?= permission @@ -682,10 +677,10 @@ Shows an unrecoverable error with the given text. """).appendTo 'body' formSubmit = $("""
""").appendTo errorDialog + reloadButton = $("""""").appendTo formSubmit - reloadButton.on 'click', -> - do window.location.reload - + reloadButton.on 'click', -> do window.location.reload + $('#timsChatLoadingErrorDialog').wcfDialog closable: false title: WCF.Language.get 'wcf.global.error.title' @@ -743,6 +738,7 @@ Open private channel $('#timsChatMessageContainer0').after div $('.privateChannel').removeClass 'active' + if userID isnt 0 $('#timsChatTopic').removeClass 'hidden empty' $('#timsChatTopic > .topic').text WCF.Language.get 'chat.general.privateChannelTopic', {username: userList.allTime[userID].username} From 1162a42dbcf949707cf1490dd034a2fc1f34c724 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 25 Sep 2013 18:40:16 +0200 Subject: [PATCH 08/15] Add phpcpd check to travis.yml --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index f9a7c0b..94188c9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,9 @@ php: - 5.4 - 5.3 before_install: + - pear config-set auto_discover 1 - pear install pear/PHP_CodeSniffer + - pear install pear.phpunit.de/phpcpd - phpenv rehash before_script: - git clone --branch=master --depth=1 --quiet git://github.com/WoltLab/WCF.git WCF @@ -15,3 +17,4 @@ before_script: script: - find file -type f -name '*.php' |xargs -I file php -l file - phpcs -p --extensions=php --standard="`pwd`/WCF/CodeSniff/WCF" file + - phpcpd file \ No newline at end of file From 8b135278e5973c4436b2315b53a35a287319df6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 25 Sep 2013 18:50:43 +0200 Subject: [PATCH 09/15] Make phpcpd more verbose --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 94188c9..9d091f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,4 +17,4 @@ before_script: script: - find file -type f -name '*.php' |xargs -I file php -l file - phpcs -p --extensions=php --standard="`pwd`/WCF/CodeSniff/WCF" file - - phpcpd file \ No newline at end of file + - phpcpd --verbose --min-lines 10 file \ No newline at end of file From 7c8f4560e4b14b5b13580ebf3e596d8e2bd52a70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sun, 29 Sep 2013 16:34:53 +0200 Subject: [PATCH 10/15] Remove obsolete CHAT_LOG_ACTIVE option --- language/de.xml | 1 - option.xml | 5 ----- 2 files changed, 6 deletions(-) diff --git a/language/de.xml b/language/de.xml index 8512df0..0bfda11 100644 --- a/language/de.xml +++ b/language/de.xml @@ -93,7 +93,6 @@ -
diff --git a/option.xml b/option.xml index 9fac9ad..8dbebeb 100644 --- a/option.xml +++ b/option.xml @@ -56,11 +56,6 @@ gunmute:ungmute -