From cd0f139598e0233626859d9d452b9032e4f97fbe Mon Sep 17 00:00:00 2001 From: dmzx Date: Mon, 5 Mar 2018 17:02:04 +0100 Subject: [PATCH] Version 2.0.3 --- adm/style/acp_mchat_globalsettings.html | 44 +-- adm/style/acp_mchat_globalusersettings.html | 2 +- .../acp_mchat_globalusersettings_content.html | 10 +- composer.json | 15 +- controller/acp_controller.php | 4 +- controller/ucp_controller.php | 4 +- core/mchat.php | 10 +- language/en/info_acp_mchat.php | 8 +- language/en/mchat_acp.php | 28 +- .../javascript/jquery.autogrow-textarea.js | 328 +++++++++--------- styles/all/template/mchat_script_data.html | 8 +- .../event/index_body_block_online_append.html | 2 +- .../overall_footer_copyright_append.html | 2 +- styles/prosilver/template/mchat_body.html | 2 +- styles/prosilver/template/mchat_messages.html | 10 +- styles/prosilver/template/ucp_mchat.html | 10 +- 16 files changed, 243 insertions(+), 244 deletions(-) diff --git a/adm/style/acp_mchat_globalsettings.html b/adm/style/acp_mchat_globalsettings.html index 8a9a2ea..882e15d 100644 --- a/adm/style/acp_mchat_globalsettings.html +++ b/adm/style/acp_mchat_globalsettings.html @@ -18,12 +18,12 @@ {% EVENT dmzx_mchat_acp_index_height_before %}
-

+

{{ lang('MCHAT_INDEX_HEIGHT_EXPLAIN') }}
 {{ lang('PIXEL') }}
-

+

{{ lang('MCHAT_MESSAGE_NUM_INDEX_EXPLAIN') }}
 {{ lang('MCHAT_ACP_MESSAGES') }}
@@ -45,12 +45,12 @@
-

+

{{ lang('MCHAT_CUSTOM_HEIGHT_EXPLAIN') }}
 {{ lang('PIXEL') }}
-

+

{{ lang('MCHAT_MESSAGE_NUM_CUSTOM_EXPLAIN') }}
 {{ lang('MCHAT_ACP_MESSAGES') }}
@@ -74,7 +74,7 @@ {% EVENT dmzx_mchat_acp_message_num_archive_before %}
-

+

{{ lang('MCHAT_MESSAGE_NUM_ARCHIVE_EXPLAIN') }}
 {{ lang('MCHAT_ACP_MESSAGES') }}
@@ -84,8 +84,8 @@
-
-
+
+
@@ -96,60 +96,60 @@ {% EVENT dmzx_mchat_acp_timeout_before %}
-

+

{{ lang('MCHAT_TIMEOUT_EXPLAIN') }}
 {{ lang('MCHAT_ACP_SECONDS') }}
-

+

{{ lang('MCHAT_REFRESH_EXPLAIN') }}
 {{ lang('MCHAT_ACP_SECONDS') }}
-

+

{{ lang('MCHAT_EDIT_DELETE_LIMIT_EXPLAIN') }}
 {{ lang('MCHAT_ACP_SECONDS') }}
-

+

{{ lang('MCHAT_LIVE_UPDATES_EXPLAIN') }}
-

+

{{ lang('MCHAT_FLOOD_TIME_EXPLAIN') }}
 {{ lang('MCHAT_ACP_SECONDS') }}
-

+

{{ lang('MCHAT_MAX_MESSAGE_LENGTH_EXPLAIN') }}
 {{ lang('MCHAT_ACP_CHARACTERS') }}
-

+

{{ lang('MCHAT_OVERRIDE_MIN_POST_CHARS_EXPLAIN') }}
-

+

{{ lang('MCHAT_OVERRIDE_SMILIE_LIMIT_EXPLAIN') }}
-

+

{{ lang('MCHAT_BBCODES_DISALLOWED_EXPLAIN') }}
-

+

{{ lang('MCHAT_RULES_EXPLAIN') }}
-

+

{{ lang('MCHAT_STATIC_MESSAGE_EXPLAIN') }}
@@ -198,7 +198,7 @@
-

+

{{ lang('MCHAT_POSTS_AUTH_CHECK_EXPLAIN') }}
@@ -215,7 +215,7 @@ {% EVENT dmzx_mchat_acp_whois_refresh_before %}
-

+

{{ lang('MCHAT_WHOIS_REFRESH_EXPLAIN') }}
 {{ lang('MCHAT_ACP_SECONDS') }}
@@ -235,12 +235,12 @@
-

+

{{ lang('MCHAT_PRUNE_GC_EXPLAIN') }}
 {{ lang('MCHAT_ACP_SECONDS') }}
-

+

{{ lang('MCHAT_PRUNE_NUM_EXPLAIN') }}
diff --git a/adm/style/acp_mchat_globalusersettings.html b/adm/style/acp_mchat_globalusersettings.html index db29e68..f803382 100644 --- a/adm/style/acp_mchat_globalusersettings.html +++ b/adm/style/acp_mchat_globalusersettings.html @@ -21,7 +21,7 @@
{{ lang('MCHAT_GLOBALUSERSETTINGS_OVERWRITE') }}
-

{{ lang('MCHAT_GLOBALUSERSETTINGS_OVERWRITE_EXPLAIN') }}
+

{{ lang('MCHAT_GLOBALUSERSETTINGS_OVERWRITE_EXPLAIN') }}
diff --git a/adm/style/acp_mchat_globalusersettings_content.html b/adm/style/acp_mchat_globalusersettings_content.html index bbda870..16ccb08 100644 --- a/adm/style/acp_mchat_globalusersettings_content.html +++ b/adm/style/acp_mchat_globalusersettings_content.html @@ -15,7 +15,7 @@
-

{{ lang('MCHAT_STATS_INDEX_EXPLAIN') }}
+

{{ lang('MCHAT_STATS_INDEX_EXPLAIN') }}
@@ -36,7 +36,7 @@ {% EVENT dmzx_mchat_acp_message_top_before %}
-

{{ lang('MCHAT_MESSAGE_TOP_EXPLAIN') }}
+

{{ lang('MCHAT_MESSAGE_TOP_EXPLAIN') }}
@@ -78,14 +78,14 @@
-

{{ lang('MCHAT_PAUSE_ON_INPUT_EXPLAIN') }}
+

{{ lang('MCHAT_PAUSE_ON_INPUT_EXPLAIN') }}
-

{{ lang('MCHAT_DATE_FORMAT_EXPLAIN') }}
+

{{ lang('MCHAT_DATE_FORMAT_EXPLAIN') }}
-

{{ lang('MCHAT_RELATIVE_TIME_EXPLAIN') }}
+

{{ lang('MCHAT_RELATIVE_TIME_EXPLAIN') }}
diff --git a/composer.json b/composer.json index 6d60f28..bbd90cd 100644 --- a/composer.json +++ b/composer.json @@ -3,13 +3,9 @@ "type": "phpbb-extension", "description": "mChat", "homepage": "https://www.phpbb.com/customise/db/extension/mchat_extension/", - "version": "2.0.2", - "time": "2017-10-22", - "keywords": [ - "phpbb", - "extension", - "mchat" - ], + "version": "2.0.3", + "time": "2017-12-31", + "keywords": ["phpbb", "extension", "mchat"], "license": "GPL-2.0", "authors": [ { @@ -32,8 +28,7 @@ ], "require": { "php": ">=5.3.3", - "composer/installers": "~1.0.0", - "phpbb/phpbb": ">=3.1.8-RC1" + "composer/installers": "~1.0" }, "require-dev": { "phpbb/epv": "dev-master" @@ -49,4 +44,4 @@ "filename": "version_check" } } -} \ No newline at end of file +} diff --git a/controller/acp_controller.php b/controller/acp_controller.php index b71ae12..443ee8a 100644 --- a/controller/acp_controller.php +++ b/controller/acp_controller.php @@ -214,7 +214,7 @@ class acp_controller } $template_data = array( - 'MCHAT_ERROR' => implode('
', $error), + 'MCHAT_ERROR' => implode('
', $error), 'MCHAT_VERSION' => $this->settings->cfg('mchat_version'), 'MCHAT_FOUNDER' => $is_founder, 'S_MCHAT_PRUNE_MODE_OPTIONS' => $this->get_prune_mode_options($this->settings->cfg('mchat_prune_mode')), @@ -343,7 +343,7 @@ class acp_controller $template_data = array_merge($template_data, array( 'MCHAT_POSTS_ENABLED_LANG' => $this->settings->get_enabled_post_notifications_lang(), - 'MCHAT_ERROR' => implode('
', $error), + 'MCHAT_ERROR' => implode('
', $error), 'MCHAT_VERSION' => $this->settings->cfg('mchat_version'), 'U_ACTION' => $u_action, )); diff --git a/controller/ucp_controller.php b/controller/ucp_controller.php index f1bd12c..fece87d 100644 --- a/controller/ucp_controller.php +++ b/controller/ucp_controller.php @@ -148,7 +148,7 @@ class ucp_controller $this->db->sql_query($sql); meta_refresh(3, $u_action); - $message = $this->user->lang('PROFILE_UPDATED') . '

' . $this->user->lang('RETURN_UCP', '', ''); + $message = $this->user->lang('PROFILE_UPDATED') . '

' . $this->user->lang('RETURN_UCP', '', ''); trigger_error($message); } @@ -178,7 +178,7 @@ class ucp_controller $template_data = array_merge($template_data, array( 'MCHAT_ALLOW_USE' => $this->auth->acl_get('u_mchat_use'), 'MCHAT_POSTS_ENABLED_LANG' => $this->settings->get_enabled_post_notifications_lang(), - 'ERROR' => sizeof($error) ? implode('
', $error) : '', + 'ERROR' => sizeof($error) ? implode('
', $error) : '', 'MCHAT_AUTH_COUNT' => $auth_count, 'S_UCP_ACTION' => $u_action, )); diff --git a/core/mchat.php b/core/mchat.php index 115686f..199ed93 100644 --- a/core/mchat.php +++ b/core/mchat.php @@ -290,7 +290,7 @@ class mchat // If the rules are defined in the language file use them, else just use the entry in the database $mchat_rules = $lang_rules ?: $this->settings->cfg('mchat_rules'); $mchat_rules = htmlspecialchars_decode($mchat_rules); - $mchat_rules = str_replace("\n", '
', $mchat_rules); + $mchat_rules = str_replace("\n", '
', $mchat_rules); $this->template->assign_var('MCHAT_RULES', $mchat_rules); @@ -585,7 +585,7 @@ class mchat * * @event dmzx.mchat.action_refresh_process_log_row * @var array response The data that is sent back to the user (still incomplete at this point) - * @var array log_row The log data + * @var array log_row The log data (read only) * @since 2.0.0-RC6 */ $vars = array( @@ -593,6 +593,8 @@ class mchat 'log_row', ); extract($this->dispatcher->trigger_event('dmzx.mchat.action_refresh_process_log_row', compact($vars))); + + unset($log_row); } } @@ -957,7 +959,7 @@ class mchat ); /** - * Event that allows adding global templte data for mChat + * Event that allows adding global template data for mChat * * @event dmzx.mchat.global_modify_template_data * @var array template_data The data that is about to be assigned to the template @@ -1582,6 +1584,6 @@ class mchat $this->template->set_filenames(array('body' => $template_file)); $content = $this->template->assign_display('body', '', true); - return trim(str_replace(array("\r", "\n"), '', $content)); + return trim($content); } } diff --git a/language/en/info_acp_mchat.php b/language/en/info_acp_mchat.php index 2a6da30..db0ba43 100644 --- a/language/en/info_acp_mchat.php +++ b/language/en/info_acp_mchat.php @@ -42,9 +42,9 @@ $lang = array_merge($lang, array( 'ACP_MCHAT_GLOBALUSERSETTINGS' => 'Global user settings', // Log entries (%1$s is replaced with the user name who triggered the event) - 'LOG_MCHAT_CONFIG_UPDATE' => 'mChat configuration updated
» %1$s', + 'LOG_MCHAT_CONFIG_UPDATE' => 'mChat configuration updated
» %1$s', 'LOG_MCHAT_TABLE_PRUNED' => 'mChat messages pruned: %2$d', - 'LOG_MCHAT_TABLE_PURGED' => 'mChat messages purged
» %1$s', - 'LOG_DELETED_MCHAT' => 'mChat message deleted
» %1$s', - 'LOG_EDITED_MCHAT' => 'mChat message edited
» %1$s', + 'LOG_MCHAT_TABLE_PURGED' => 'mChat messages purged
» %1$s', + 'LOG_DELETED_MCHAT' => 'mChat message deleted
» %1$s', + 'LOG_EDITED_MCHAT' => 'mChat message edited
» %1$s', )); diff --git a/language/en/mchat_acp.php b/language/en/mchat_acp.php index 7fb5514..46c5794 100644 --- a/language/en/mchat_acp.php +++ b/language/en/mchat_acp.php @@ -44,7 +44,7 @@ $lang = array_merge($lang, array( 'MCHAT_SETTINGS_PRUNE' => 'Pruning settings (adjustable for founders only)', 'MCHAT_SETTINGS_STATS' => 'Who is chatting settings', - 'MCHAT_GLOBALUSERSETTINGS_EXPLAIN' => 'Settings for which a user does not have permission to customise are applied as configured below.
New user accounts will have initial settings as configured below.

Go to the mChat in UCP tab of the user permissions section to adjust customisation permissions.
Go to the Preferences form in the user management section to see the status of each user’s settings.', + 'MCHAT_GLOBALUSERSETTINGS_EXPLAIN' => 'Settings for which a user does not have permission to customise are applied as configured below.
New user accounts will have initial settings as configured below.

Go to the mChat in UCP tab of the user permissions section to adjust customisation permissions.
Go to the Preferences form in the user management section to see the status of each user’s settings.', 'MCHAT_GLOBALUSERSETTINGS_OVERWRITE' => 'Overwrite settings for all users', 'MCHAT_GLOBALUSERSETTINGS_OVERWRITE_EXPLAIN' => 'Applies the settings as defined above to all user accounts.', 'MCHAT_GLOBALUSERSETTINGS_OVERWRITE_CONFIRM' => 'Confirm overwriting mChat settings for all users', @@ -62,17 +62,17 @@ $lang = array_merge($lang, array( 'MCHAT_ACP_GLOBALUSERSETTINGS_TITLE' => 'mChat Global user settings', 'MCHAT_VERSION' => 'Version', 'MCHAT_RULES' => 'Rules', - 'MCHAT_RULES_EXPLAIN' => 'Enter the rules here. HTML code is allowed. You are limited to 255 characters.
This message can be translated: edit the MCHAT_RULES_MESSAGE language key in /ext/dmzx/mchat/language/XX/mchat.php.', + 'MCHAT_RULES_EXPLAIN' => 'Enter the rules here. HTML code is allowed. Set to empty to disable the display.
This message can be translated: edit the MCHAT_RULES_MESSAGE language key in /ext/dmzx/mchat/language/XX/mchat.php.', 'MCHAT_CONFIG_SAVED' => 'mChat configuration has been updated', 'MCHAT_AVATARS' => 'Display avatars', 'MCHAT_AVATARS_EXPLAIN' => 'If set to yes, resized user avatars will be displayed', 'MCHAT_INDEX' => 'Display mChat on the index page', 'MCHAT_INDEX_HEIGHT' => 'Index page height', - 'MCHAT_INDEX_HEIGHT_EXPLAIN' => 'The height of the chat box in pixels on the index page.
You are limited from 50 to 1000. Default is 250.', + 'MCHAT_INDEX_HEIGHT_EXPLAIN' => 'The height of the chat box in pixels on the index page.
You are limited from 50 to 1000. Default is 250.', 'MCHAT_TOP_OF_FORUM' => 'Top', 'MCHAT_BOTTOM_OF_FORUM' => 'Bottom', 'MCHAT_REFRESH' => 'Refresh interval', - 'MCHAT_REFRESH_EXPLAIN' => 'Number of seconds before the chat refreshes.
You are limited from 5 to 60 seconds. Default is 10.', + 'MCHAT_REFRESH_EXPLAIN' => 'Number of seconds before the chat refreshes.
You are limited from 5 to 60 seconds. Default is 10.', 'MCHAT_LIVE_UPDATES' => 'Live updates of edited and deleted messages', 'MCHAT_LIVE_UPDATES_EXPLAIN' => 'When a user edits or deletes messages, the changes are updated live for all others, without them having to refresh the page. Disable this if you experience performance issues.', 'MCHAT_PRUNE' => 'Enable message pruning', @@ -90,26 +90,26 @@ $lang = array_merge($lang, array( 'MCHAT_MESSAGE_NUM_INDEX' => 'Initial number of messages to display on the index page', 'MCHAT_MESSAGE_NUM_INDEX_EXPLAIN' => 'You are limited from 5 to 50. Default is 10.', 'MCHAT_MESSAGE_NUM_ARCHIVE' => 'Number of messages to display on the archive page', - 'MCHAT_MESSAGE_NUM_ARCHIVE_EXPLAIN' => 'The maximum number of messages to show per page on the archive page.
You are limited from 10 to 100. Default is 25.', + 'MCHAT_MESSAGE_NUM_ARCHIVE_EXPLAIN' => 'The maximum number of messages to show per page on the archive page.
You are limited from 10 to 100. Default is 25.', 'MCHAT_ARCHIVE_SORT' => 'Message sorting', 'MCHAT_ARCHIVE_SORT_TOP_BOTTOM' => 'Always sort messages oldest to newest', 'MCHAT_ARCHIVE_SORT_BOTTOM_TOP' => 'Always sort messages newest to oldest', 'MCHAT_ARCHIVE_SORT_USER' => 'Sort messages depending on the user’s Location of new messages preference', 'MCHAT_FLOOD_TIME' => 'Flood time', - 'MCHAT_FLOOD_TIME_EXPLAIN' => 'The number of seconds a user must wait before posting another message in the chat.
You are limited from 0 to 60 seconds. Default is 0. Set to 0 to disable.', + 'MCHAT_FLOOD_TIME_EXPLAIN' => 'The number of seconds a user must wait before posting another message in the chat.
You are limited from 0 to 60 seconds. Default is 0. Set to 0 to disable.', 'MCHAT_EDIT_DELETE_LIMIT' => 'Time limit for editing and deleting messages', - 'MCHAT_EDIT_DELETE_LIMIT_EXPLAIN' => 'Messages older than the specified number of seconds cannot be edited or deleted by the author any more.
Users who have edit/delete permission as well as moderator permission are exempt from this time limit.
Set to 0 to allow unlimited editing and deleting.', + 'MCHAT_EDIT_DELETE_LIMIT_EXPLAIN' => 'Messages older than the specified number of seconds cannot be edited or deleted by the author any more.
Users who have edit/delete permission as well as moderator permission are exempt from this time limit.
Set to 0 to allow unlimited editing and deleting.', 'MCHAT_MAX_MESSAGE_LENGTH' => 'Maximum message length', - 'MCHAT_MAX_MESSAGE_LENGTH_EXPLAIN' => 'Maximum number of characters allowed per message posted.
You are limited from 0 to 1000. Default is 500. Set to 0 to disable.', + 'MCHAT_MAX_MESSAGE_LENGTH_EXPLAIN' => 'Maximum number of characters allowed per message posted.
You are limited from 0 to 1000. Default is 500. Set to 0 to disable.', 'MCHAT_CUSTOM_PAGE' => 'Enable custom page', 'MCHAT_CUSTOM_HEIGHT' => 'Custom page height', - 'MCHAT_CUSTOM_HEIGHT_EXPLAIN' => 'The height of the chat box in pixels on the custom page.
You are limited from 50 to 1000. Default is 350.', + 'MCHAT_CUSTOM_HEIGHT_EXPLAIN' => 'The height of the chat box in pixels on the custom page.
You are limited from 50 to 1000. Default is 350.', 'MCHAT_BBCODES_DISALLOWED' => 'Disallowed bbcodes', - 'MCHAT_BBCODES_DISALLOWED_EXPLAIN' => 'Here you can input the bbcodes that are not to be used in a message.
Separate bbcodes with a vertical bar, for example:
b|i|u|code|list|list=|flash|quote and/or a %1$scustom bbcode tag name%2$s', + 'MCHAT_BBCODES_DISALLOWED_EXPLAIN' => 'Here you can input the bbcodes that are not to be used in a message.
Separate bbcodes with a vertical bar, for example:
b|i|u|code|list|list=|flash|quote and/or a %1$scustom bbcode tag name%2$s', 'MCHAT_STATIC_MESSAGE' => 'Static message', - 'MCHAT_STATIC_MESSAGE_EXPLAIN' => 'Here you can define a static message to display to users of the chat. HTML code is allowed.
Set to empty to disable the display. You are limited to 255 characters.
This message can be translated: edit the MCHAT_STATIC_MESSAGE language key in /ext/dmzx/mchat/language/XX/mchat.php.', + 'MCHAT_STATIC_MESSAGE_EXPLAIN' => 'Here you can define a static message to display to users of the chat. HTML code is allowed. Set to empty to disable the display.
This message can be translated: edit the MCHAT_STATIC_MESSAGE language key in /ext/dmzx/mchat/language/XX/mchat.php.', 'MCHAT_TIMEOUT' => 'Session timeout', - 'MCHAT_TIMEOUT_EXPLAIN' => 'Set the number of seconds until a session in the chat ends.
Set to 0 for no timeout. Careful, the session of a user reading mChat will never expire!
You are limited to the %1$sforum config setting for sessions%2$s which is currently set to %3$d seconds', + 'MCHAT_TIMEOUT_EXPLAIN' => 'Set the number of seconds until a session in the chat ends.
Set to 0 for no timeout. Careful, the session of a user reading mChat will never expire!
You are limited to the %1$sforum config setting for sessions%2$s which is currently set to %3$d seconds', 'MCHAT_OVERRIDE_SMILIE_LIMIT' => 'Override smilie limit', 'MCHAT_OVERRIDE_SMILIE_LIMIT_EXPLAIN' => 'Set to yes to override the forums smilie limit setting for chat messages', 'MCHAT_OVERRIDE_MIN_POST_CHARS' => 'Override minimum characters limit', @@ -119,7 +119,7 @@ $lang = array_merge($lang, array( 'MCHAT_POSTS_AUTH_CHECK_EXPLAIN' => 'If set to yes, users who can not use mChat will not generate any post/login notification messages.', 'MCHAT_WHOIS_REFRESH' => 'Who is chatting refresh interval', - 'MCHAT_WHOIS_REFRESH_EXPLAIN' => 'Number of seconds before who is chatting refreshes.
You are limited from 10 to 300 seconds. Default is 60.', + 'MCHAT_WHOIS_REFRESH_EXPLAIN' => 'Number of seconds before who is chatting refreshes.
You are limited from 10 to 300 seconds. Default is 60.', 'MCHAT_SOUND' => 'Play sounds for new, edited and deleted messages', 'MCHAT_PURGE' => 'Delete all messages now', 'MCHAT_PURGE_CONFIRM' => 'Confirm deleting all messages', @@ -155,5 +155,5 @@ $lang = array_merge($lang, array( 'TOO_SMALL_MCHAT_WHOIS_REFRESH' => 'The whois refresh value is too small.', 'TOO_LARGE_MCHAT_WHOIS_REFRESH' => 'The whois refresh value is too large.', - 'MCHAT_30X_REMNANTS' => 'The installation has been aborted.
There are remnant modules from the mChat MOD for phpBB 3.0.x in the database. The mChat extension does not work correctly with these modules present.
You need to entirely uninstall the mChat MOD before being able to install the mChat extension. Specifically, the modules with the following IDs need to be deleted from the %1$smodules table: %2$s', + 'MCHAT_30X_REMNANTS' => 'The installation has been aborted.
There are remnant modules from the mChat MOD for phpBB 3.0.x in the database. The mChat extension does not work correctly with these modules present.
You need to entirely uninstall the mChat MOD before being able to install the mChat extension. Specifically, the modules with the following IDs need to be deleted from the %1$smodules table: %2$s', )); diff --git a/styles/all/template/javascript/jquery.autogrow-textarea.js b/styles/all/template/javascript/jquery.autogrow-textarea.js index c12e45a..8f11c7f 100644 --- a/styles/all/template/javascript/jquery.autogrow-textarea.js +++ b/styles/all/template/javascript/jquery.autogrow-textarea.js @@ -3,209 +3,209 @@ // Mofified by kasimi (c) 2016 ( function( factory ) { - // UMD wrapper - if ( typeof define === 'function' && define.amd ) { - // AMD - define( [ 'jquery' ], factory ); - } else if ( typeof exports !== 'undefined' ) { - // Node/CommonJS - module.exports = factory( require( 'jquery' ) ); - } else { - // Browser globals - factory( jQuery ); - } + // UMD wrapper + if ( typeof define === 'function' && define.amd ) { + // AMD + define( [ 'jquery' ], factory ); + } else if ( typeof exports !== 'undefined' ) { + // Node/CommonJS + module.exports = factory( require( 'jquery' ) ); + } else { + // Browser globals + factory( jQuery ); + } }( function( $ ) { - /* - * Auto-growing textareas; technique ripped from Facebook - */ - $.fn.autogrow = function(options) { + /* + * Auto-growing textareas; technique ripped from Facebook + */ + $.fn.autogrow = function(options) { - options = $.extend( { - vertical: true, - horizontal: false, - characterSlop: 0 - }, options); + options = $.extend( { + vertical: true, + horizontal: false, + characterSlop: 0 + }, options); - this.filter('textarea,input').each(function() { + this.filter('textarea,input').each(function() { - var $this = $(this), - borderBox = $this.css( 'box-sizing' ) === 'border-box', - // minHeight = borderBox ? $this.outerHeight() : $this.height(), - maxHeight = $this.attr( "maxHeight" ), - minWidth = typeof( $this.attr( "minWidth" ) ) == "undefined" ? 0 : $this.attr( "minWidth" ); + var $this = $(this), + borderBox = $this.css( 'box-sizing' ) === 'border-box', + // minHeight = borderBox ? $this.outerHeight() : $this.height(), + maxHeight = $this.attr( "maxHeight" ), + minWidth = typeof( $this.attr( "minWidth" ) ) == "undefined" ? 0 : $this.attr( "minWidth" ); - if( typeof( maxHeight ) == "undefined" ) maxHeight = 1000000; + if( typeof( maxHeight ) == "undefined" ) maxHeight = 1000000; - var shadow = $('
').css( { - position: 'absolute', - top: -10000, - left: -10000, - fontSize: $this.css('fontSize'), - fontFamily: $this.css('fontFamily'), - fontWeight: $this.css('fontWeight'), - lineHeight: $this.css('lineHeight'), - paddingLeft: $this.css('paddingLeft'), - paddingRight: $this.css('paddingRight'), - paddingTop: $this.css('paddingTop'), - paddingBottom: $this.css('paddingBottom'), - borderTop: $this.css('borderTop'), - borderBottom: $this.css('borderBottom'), - borderLeft: $this.css('borderLeft'), - borderRight: $this.css('borderRight'), + var shadow = $('
').css( { + position: 'absolute', + top: -10000, + left: -10000, + fontSize: $this.css('fontSize'), + fontFamily: $this.css('fontFamily'), + fontWeight: $this.css('fontWeight'), + lineHeight: $this.css('lineHeight'), + paddingLeft: $this.css('paddingLeft'), + paddingRight: $this.css('paddingRight'), + paddingTop: $this.css('paddingTop'), + paddingBottom: $this.css('paddingBottom'), + borderTop: $this.css('borderTop'), + borderBottom: $this.css('borderBottom'), + borderLeft: $this.css('borderLeft'), + borderRight: $this.css('borderRight'), whiteSpace: 'pre-wrap', - resize: 'none' - } ).appendTo(document.body); + resize: 'none' + } ).appendTo(document.body); - shadow.html( 'a' ); - var characterWidth = shadow.width(); - shadow.html( '' ); + shadow.html( 'a' ); + var characterWidth = shadow.width(); + shadow.html( '' ); var isTextarea = $this.is('textarea'); - var update = function( val ) { + var update = function( val ) { - var times = function(string, number) { - for (var i = 0, r = ''; i < number; i ++) r += string; - return r; - }; + var times = function(string, number) { + for (var i = 0, r = ''; i < number; i ++) r += string; + return r; + }; - if( typeof val === 'undefined' ) val = this.value; - if( val === '' && $(this).attr("placeholder") ) val = $(this).attr("placeholder"); + if( typeof val === 'undefined' ) val = this.value; + if( val === '' && $(this).attr("placeholder") ) val = $(this).attr("placeholder"); - if( options.vertical ) - val = val.replace(/&/g, '&') - .replace(//g, '>') - .replace(/\n$/, '
 ') - .replace(/\n/g, '
') - .replace(/ {2,}/g, function(space) { return times(' ', space.length -1) + ' '; }); - else - val = escapeHtml( val ); + if( options.vertical ) + val = val.replace(/&/g, '&') + .replace(//g, '>') + .replace(/\n$/, '
 ') + .replace(/\n/g, '
') + .replace(/ {2,}/g, function(space) { return times(' ', space.length -1) + ' '; }); + else + val = escapeHtml( val ); - //if( options.horizontal ) - // val = $.trim( val ); + //if( options.horizontal ) + // val = $.trim( val ); - // if( $(this).prop( 'tagName' ).toUpperCase() === 'INPUT' ) - // shadow.text(val).css( "width", "auto" ); - // else - shadow.html( val ).css( "width", "auto" ); // need to use html here otherwise no way to count spaces (with html we can use  ) + // if( $(this).prop( 'tagName' ).toUpperCase() === 'INPUT' ) + // shadow.text(val).css( "width", "auto" ); + // else + shadow.html( val ).css( "width", "auto" ); // need to use html here otherwise no way to count spaces (with html we can use  ) - if( options.horizontal ) - { - var slopWidth = options.characterSlop * characterWidth + 2; + if( options.horizontal ) + { + var slopWidth = options.characterSlop * characterWidth + 2; - var newWidth = Math.max( shadow.width() + slopWidth, minWidth ); - var maxWidth = options.maxWidth; - //if( typeof( maxWidth ) === "undefined" ) maxWidth = $this.parent().width() - 12; // not sure why we were doing this but seems like a bad idea. doesn't work with inline-block parents for one thing, since it is the text area that should be "pushing" them to be wider - if( maxWidth ) newWidth = Math.min( newWidth, maxWidth ); + var newWidth = Math.max( shadow.width() + slopWidth, minWidth ); + var maxWidth = options.maxWidth; + //if( typeof( maxWidth ) === "undefined" ) maxWidth = $this.parent().width() - 12; // not sure why we were doing this but seems like a bad idea. doesn't work with inline-block parents for one thing, since it is the text area that should be "pushing" them to be wider + if( maxWidth ) newWidth = Math.min( newWidth, maxWidth ); // Take scrollbar into account if (isTextarea && shadow.get(0).scrollHeight > shadow.height()) { newWidth += 20; } - $(this).css( "width", newWidth ); - } + $(this).css( "width", newWidth ); + } - if( options.vertical ) - { - var shadowWidth = $(this).width(); - if( ! borderBox ) shadowWidth = shadowWidth - parseInt($this.css('paddingLeft'),10) - parseInt($this.css('paddingRight'),10); - shadow.css( "width", shadowWidth ); - var shadowHeight = borderBox ? shadow.outerHeight() : shadow.height(); + if( options.vertical ) + { + var shadowWidth = $(this).width(); + if( ! borderBox ) shadowWidth = shadowWidth - parseInt($this.css('paddingLeft'),10) - parseInt($this.css('paddingRight'),10); + shadow.css( "width", shadowWidth ); + var shadowHeight = borderBox ? shadow.outerHeight() : shadow.height(); - $(this).css( "height", "auto" ); - minHeight = borderBox ? $this.outerHeight() : $this.height(); + $(this).css( "height", "auto" ); + minHeight = borderBox ? $this.outerHeight() : $this.height(); - var newHeight = Math.min( Math.max( shadowHeight, minHeight ), maxHeight ); - $(this).css( "height", newHeight ); - $(this).css( "overflow", newHeight == maxHeight ? "auto" : "hidden" ); - } - }; + var newHeight = Math.min( Math.max( shadowHeight, minHeight ), maxHeight ); + $(this).css( "height", newHeight ); + $(this).css( "overflow", newHeight == maxHeight ? "auto" : "hidden" ); + } + }; - $(this) - .change(function(){update.call( this );return true;}) - .keyup(function(){update.call( this );return true;}) - .keypress(function( event ) { - if( event.ctrlKey || event.metaKey ) return; + $(this) + .change(function(){update.call( this );return true;}) + .keyup(function(){update.call( this );return true;}) + .keypress(function( event ) { + if( event.ctrlKey || event.metaKey ) return; - var val = this.value; - var caretInfo = _getCaretInfo( this ); + var val = this.value; + var caretInfo = _getCaretInfo( this ); - var typedChar = event.which === 13 ? "\n" : String.fromCharCode( event.which ); - var valAfterKeypress = val.slice( 0, caretInfo.start ) + typedChar + val.slice( caretInfo.end ); - update.call( this, valAfterKeypress ); - return true; - }) - .bind( "update.autogrow", function(){ update.apply(this); } ) - .bind( "remove.autogrow", function() { - shadow.remove(); - } ); + var typedChar = event.which === 13 ? "\n" : String.fromCharCode( event.which ); + var valAfterKeypress = val.slice( 0, caretInfo.start ) + typedChar + val.slice( caretInfo.end ); + update.call( this, valAfterKeypress ); + return true; + }) + .bind( "update.autogrow", function(){ update.apply(this); } ) + .bind( "remove.autogrow", function() { + shadow.remove(); + } ); - update.apply(this); + update.apply(this); - }); + }); - return this; - }; + return this; + }; - // comes from https://github.com/madapaja/jquery.selection/blob/master/src/jquery.selection.js - var _getCaretInfo = function(element){ - var res = { - text: '', - start: 0, - end: 0 - }; + // comes from https://github.com/madapaja/jquery.selection/blob/master/src/jquery.selection.js + var _getCaretInfo = function(element){ + var res = { + text: '', + start: 0, + end: 0 + }; - if (!element.value) { - /* no value or empty string */ - return res; - } + if (!element.value) { + /* no value or empty string */ + return res; + } - try { - if (window.getSelection) { - /* except IE */ - res.start = element.selectionStart; - res.end = element.selectionEnd; - res.text = element.value.slice(res.start, res.end); - } else if (doc.selection) { - /* for IE */ - element.focus(); + try { + if (window.getSelection) { + /* except IE */ + res.start = element.selectionStart; + res.end = element.selectionEnd; + res.text = element.value.slice(res.start, res.end); + } else if (doc.selection) { + /* for IE */ + element.focus(); - var range = doc.selection.createRange(), - range2 = doc.body.createTextRange(); + var range = doc.selection.createRange(), + range2 = doc.body.createTextRange(); - res.text = range.text; + res.text = range.text; - try { - range2.moveToElementText(element); - range2.setEndPoint('StartToStart', range); - } catch (e) { - range2 = element.createTextRange(); - range2.setEndPoint('StartToStart', range); - } + try { + range2.moveToElementText(element); + range2.setEndPoint('StartToStart', range); + } catch (e) { + range2 = element.createTextRange(); + range2.setEndPoint('StartToStart', range); + } - res.start = element.value.length - range2.text.length; - res.end = res.start + range.text.length; - } - } catch (e) { - /* give up */ - } + res.start = element.value.length - range2.text.length; + res.end = res.start + range.text.length; + } + } catch (e) { + /* give up */ + } - return res; - }; + return res; + }; - var entityMap = { - "&": "&", - "<": "<", - ">": ">", - '"': '"', - "'": ''', - "/": '/', - " ": ' ' - }; + var entityMap = { + "&": "&", + "<": "<", + ">": ">", + '"': '"', + "'": ''', + "/": '/', + " ": ' ' + }; - function escapeHtml(string) { - return String(string).replace(/[&<>"'\/\ ]/g, function (s) { - return entityMap[s]; - } ); - } + function escapeHtml(string) { + return String(string).replace(/[&<>"'\/\ ]/g, function (s) { + return entityMap[s]; + } ); + } } ) ); diff --git a/styles/all/template/mchat_script_data.html b/styles/all/template/mchat_script_data.html index 4938b89..125e67f 100644 --- a/styles/all/template/mchat_script_data.html +++ b/styles/all/template/mchat_script_data.html @@ -39,9 +39,11 @@ // Language lang: { minutesAgo : { - {% for minute in 0..MCHAT_MINUTES_AGO_LIMIT-1 %} - {{ minute }}: '{{ lang('MCHAT_MINUTES_AGO', minute) | escape('js') }}'{{ loop.last ? '' : ',' }} - {% endfor %} + {% if MCHAT_RELATIVE_TIME %} + {% for minute in 0..MCHAT_MINUTES_AGO_LIMIT-1 %} + {{ minute }}: '{{ lang('MCHAT_MINUTES_AGO', minute) | escape('js') }}'{{ loop.last ? '' : ',' }} + {% endfor %} + {% endif %} }, err : '{{ lang('ERROR') | escape('js') }}', parserErr : '{{ lang('AJAX_ERROR_TEXT_PARSERERROR') | escape('js') }}', diff --git a/styles/prosilver/template/event/index_body_block_online_append.html b/styles/prosilver/template/event/index_body_block_online_append.html index 49fb4c0..cf81fd3 100644 --- a/styles/prosilver/template/event/index_body_block_online_append.html +++ b/styles/prosilver/template/event/index_body_block_online_append.html @@ -3,5 +3,5 @@

{{ lang('MCHAT_WHO_IS_CHATTING') }}

-

{{ MCHAT_USERS_TOTAL }} {{ MCHAT_ONLINE_EXPLAIN }}
{{ MCHAT_USERS_LIST }} +

{{ MCHAT_USERS_TOTAL }} {{ MCHAT_ONLINE_EXPLAIN }}
{{ MCHAT_USERS_LIST }} {% endif %} diff --git a/styles/prosilver/template/event/overall_footer_copyright_append.html b/styles/prosilver/template/event/overall_footer_copyright_append.html index 278d9be..6e2b640 100644 --- a/styles/prosilver/template/event/overall_footer_copyright_append.html +++ b/styles/prosilver/template/event/overall_footer_copyright_append.html @@ -1,4 +1,4 @@ {% if MCHAT_PAGE %} -
+
{{ MCHAT_DISPLAY_NAME }} © {{ lang('POST_BY_AUTHOR') }} {{ MCHAT_AUTHOR_HOMEPAGES }} {% endif %} diff --git a/styles/prosilver/template/mchat_body.html b/styles/prosilver/template/mchat_body.html index 267e567..3c896c1 100644 --- a/styles/prosilver/template/mchat_body.html +++ b/styles/prosilver/template/mchat_body.html @@ -7,7 +7,7 @@ {% EVENT dmzx_mchat_header_before %} {% if MCHAT_PAGE == 'custom' %} -

{{ lang('MCHAT_CUSTOM_PAGE') }}

+

{{ lang('MCHAT_CUSTOM_PAGE') }}

{% elseif MCHAT_PAGE == 'archive' %}

{{ lang('MCHAT_ARCHIVE_PAGE') }}

{% endif %} diff --git a/styles/prosilver/template/mchat_messages.html b/styles/prosilver/template/mchat_messages.html index 479ac0b..555e347 100644 --- a/styles/prosilver/template/mchat_messages.html +++ b/styles/prosilver/template/mchat_messages.html @@ -1,7 +1,7 @@ -{% EVENT dmzx_mchat_messages_before %} -{% EVENT dmzx_mchat_messages_define_icons %} +{%- EVENT dmzx_mchat_messages_before -%} +{%- EVENT dmzx_mchat_messages_define_icons -%} -{% for mchatrow in loops.mchatrow %} +{%- for mchatrow in loops.mchatrow -%}
  • {% if S_MCHAT_AVATARS %}
    @@ -24,6 +24,6 @@
  • -{% endfor %} +{%- endfor -%} -{% EVENT dmzx_mchat_messages_after %} +{%- EVENT dmzx_mchat_messages_after -%} diff --git a/styles/prosilver/template/ucp_mchat.html b/styles/prosilver/template/ucp_mchat.html index 238f754..c2dad38 100644 --- a/styles/prosilver/template/ucp_mchat.html +++ b/styles/prosilver/template/ucp_mchat.html @@ -38,7 +38,7 @@ {% endif %} {% if MCHAT_STATS_INDEX_AUTH %}
    -

    {{ lang('MCHAT_STATS_INDEX_EXPLAIN') }}
    +

    {{ lang('MCHAT_STATS_INDEX_EXPLAIN') }}
    @@ -63,7 +63,7 @@ {% if MCHAT_MESSAGE_TOP_AUTH %}
    -

    {{ lang('MCHAT_MESSAGE_TOP_EXPLAIN') }}
    +

    {{ lang('MCHAT_MESSAGE_TOP_EXPLAIN') }}
    @@ -117,7 +117,7 @@ {% endif %} {% if MCHAT_PAUSE_ON_INPUT_AUTH and MCHAT_ALLOW_USE %}
    -

    {{ lang('MCHAT_PAUSE_ON_INPUT_EXPLAIN') }}
    +

    {{ lang('MCHAT_PAUSE_ON_INPUT_EXPLAIN') }}
    @@ -126,7 +126,7 @@ {% endif %} {% if MCHAT_DATE_AUTH %}
    -

    {{ lang('MCHAT_DATE_FORMAT_EXPLAIN') }}
    +

    {{ lang('MCHAT_DATE_FORMAT_EXPLAIN') }}
    {{ lang('YES') }}