Version 2.1.2

This commit is contained in:
dmzx
2019-01-17 19:18:50 +01:00
parent 698db04f9e
commit 940161da23
26 changed files with 413 additions and 82 deletions

View File

@@ -3,9 +3,13 @@
"type": "phpbb-extension",
"description": "mChat",
"homepage": "https://www.phpbb.com/customise/db/extension/mchat_extension/",
"version": "2.1.1",
"time": "2018-09-01",
"keywords": ["phpbb", "extension", "mchat"],
"version": "2.1.2",
"time": "2018-12-25",
"keywords": [
"phpbb",
"extension",
"mchat"
],
"license": "GPL-2.0-only",
"authors": [
{
@@ -28,7 +32,8 @@
],
"require": {
"php": ">=5.4.7",
"composer/installers": "~1.0"
"composer/installers": "~1.0.0",
"phpbb/phpbb": ">=3.2.0"
},
"require-dev": {
"phpbb/epv": "dev-master"
@@ -44,4 +49,4 @@
"filename": "version_check"
}
}
}
}

View File

@@ -104,19 +104,48 @@ class log
}
/**
* @param string $log_type The log type, one of edit|del
* @param string $log_type The log type, one of edit|del or a custom type
* @param int $message_id The ID of the message to which this log entry belongs
* @return int The ID of the newly added log row
* @return int The ID of the newly added log row, or 0 if no log row was added
*/
public function add_log($log_type, $message_id)
{
$this->db->sql_query('INSERT INTO ' . $this->mchat_settings->get_table_mchat_log() . ' ' . $this->db->sql_build_array('INSERT', [
$log_row = [
'log_type' => $this->get_type_id($log_type),
'user_id' => (int) $this->user->data['user_id'],
'message_id' => (int) $message_id,
'log_ip' => $this->user->ip,
'log_time' => time(),
]));
];
$insert_log = true;
/**
* Event that allows adding log types
*
* @event dmzx.mchat.log_add_before
* @var string log_type The log type, one of edit|del or a custom type
* @var int message_id ID of the message to which this log entry belongs
* @var array log_row Array that is about to be added to the mchat_log table
* @var bool insert_log Whether or not to add the log_row
* @since 2.1.2
*/
$vars = [
'log_type',
'message_id',
'log_row',
'insert_log',
];
extract($this->dispatcher->trigger_event('dmzx.mchat.log_add_before', compact($vars)));
if (!$insert_log)
{
return 0;
}
$sql = 'INSERT INTO ' . $this->mchat_settings->get_table_mchat_log() . ' ' . $this->db->sql_build_array('INSERT', $log_row);
$this->db->sql_query($sql);
$log_id = (int) $this->db->sql_nextid();
@@ -171,12 +200,11 @@ class log
* Event that allows processing log messages
*
* @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 (read only)
* @since 2.0.0-RC6
* @changed 2.1.2 Removed response
*/
$vars = [
'response',
'log_row',
];
extract($this->dispatcher->trigger_event('dmzx.mchat.action_refresh_process_log_row', compact($vars)));

View File

@@ -571,6 +571,7 @@ class mchat
unset($logs['latest']);
$log_edit_del_ids = $logs;
unset($logs);
}
else
{
@@ -761,18 +762,17 @@ class mchat
$is_archive = $page == 'archive';
$jump_to_id = $is_archive ? $this->request->variable('jumpto', 0) : 0;
// If the static message is not empty in the language file, use it, else ise the static message in the database
// If the static message is not empty in the language file, use it, else use the static message in the database
$static_message = $this->lang->lang('MCHAT_STATIC_MESSAGE') ?: $this->mchat_settings->cfg('mchat_static_message');
$whois_refresh = $this->mchat_settings->cfg('mchat_whois_index') || $this->mchat_settings->cfg('mchat_navbar_link_count');
$template_data = [
'MCHAT_PAGE' => $page,
'MCHAT_CURRENT_URL' => '.' . $this->user->page['script_path'] . $this->user->page['page'],
'MCHAT_CURRENT_URL' => $this->mchat_settings->get_current_page(),
'MCHAT_ALLOW_SMILES' => $this->mchat_settings->cfg('allow_smilies') && $this->auth->acl_get('u_mchat_smilies'),
'MCHAT_MESSAGE_TOP' => $this->mchat_settings->cfg('mchat_message_top'),
'MCHAT_INDEX_HEIGHT' => $this->mchat_settings->cfg('mchat_index_height'),
'MCHAT_CUSTOM_HEIGHT' => $this->mchat_settings->cfg('mchat_custom_height'),
'MCHAT_LIVE_UPDATES' => $this->mchat_settings->cfg('mchat_live_updates'),
'MCHAT_LOCATION' => $this->mchat_settings->cfg('mchat_location'),
'MCHAT_CHARACTER_COUNT' => $this->mchat_settings->cfg('mchat_character_count'),
'MCHAT_SOUND' => $this->mchat_settings->cfg('mchat_sound'),
@@ -1096,7 +1096,7 @@ class mchat
'MCHAT_USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour'], $this->lang->lang('GUEST')),
'MCHAT_USERNAME_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour'], $this->lang->lang('GUEST')),
'MCHAT_WHOIS_USER' => $this->lang->lang('MCHAT_WHOIS_USER', $row['user_ip']),
'MCHAT_U_IP' => $this->helper->route('dmzx_mchat_page_whois_controller', ['ip' => $row['user_ip']]),
'MCHAT_U_IP' => $this->auth->acl_get('u_mchat_ip') ? $this->helper->route('dmzx_mchat_page_whois_controller', ['ip' => $row['user_ip']]) : false,
'MCHAT_U_PERMISSIONS' => append_sid($this->mchat_settings->url('adm/index', true), ['i' => 'permissions', 'mode' => 'setting_user_global', rawurlencode('user_id[0]') => $row['user_id']], true, $this->user->session_id),
'MCHAT_MESSAGE' => generate_text_for_display($row['message'], $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options']),
'MCHAT_TIME' => $minutes_ago === -1 ? $datetime : $this->lang->lang('MCHAT_MINUTES_AGO', $minutes_ago),

View File

@@ -168,10 +168,10 @@ class settings
'mchat_live_updates' => ['default' => 1],
'mchat_log_enabled' => ['default' => 1],
'mchat_max_input_height' => ['default' => 150, 'validation' => ['num', false, 0, 1000]],
'mchat_max_message_lngth' => ['default' => 500, 'validation' => ['num', false, 0, 1000]],
'mchat_max_message_lngth' => ['default' => 500],
'mchat_message_num_archive' => ['default' => 25, 'validation' => ['num', false, 10, 100]],
'mchat_message_num_custom' => ['default' => 10, 'validation' => ['num', false, 5, 50]],
'mchat_message_num_index' => ['default' => 10, 'validation' => ['num', false, 5, 50]],
'mchat_message_num_custom' => ['default' => 10],
'mchat_message_num_index' => ['default' => 10],
'mchat_navbar_link_count' => ['default' => 1],
'mchat_override_min_post_chars' => ['default' => 0],
'mchat_override_smilie_limit' => ['default' => 0],
@@ -185,7 +185,7 @@ class settings
'mchat_prune_gc' => ['default' => strtotime('1 day', 0)],
'mchat_prune_mode' => ['default' => 0],
'mchat_prune_num' => ['default' => 0],
'mchat_refresh' => ['default' => 10, 'validation' => ['num', false, 5, 60]],
'mchat_refresh' => ['default' => 10, 'validation' => ['num', false, 2, 3600]],
'mchat_timeout' => ['default' => 0, 'validation' => ['num', false, 0, (int) $this->cfg('session_length')]],
'mchat_whois_refresh' => ['default' => 60, 'validation' => ['num', false, 10, 300]],
];
@@ -479,6 +479,27 @@ class settings
return implode($this->lang->lang('COMMA_SEPARATOR'), $enabled_notifications_lang);
}
/**
* @return string
*/
public function get_current_page()
{
$page = $this->user->page['page_name'];
// Remove app.php if URL rewriting is enabled in the ACP
if ($this->config['enable_mod_rewrite'])
{
$app_php = 'app.' . $this->php_ext . '/';
if (($app_position = strpos($page, $app_php)) !== false)
{
$page = substr($page, $app_position + strlen($app_php));
}
}
return generate_board_url() . '/' . $page;
}
/**
* @param string $path
* @param bool $absolute_url

View File

@@ -66,31 +66,31 @@ $lang = array_merge($lang, [
'MCHAT_RULES_EXPLAIN' => 'Enter the rules here. HTML code is allowed. Set to empty to disable the display.<br>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_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.<br><em>You are limited from 50 to 1000. Default is 250.</em>',
'MCHAT_INDEX_HEIGHT_EXPLAIN' => '<em>You are limited from 50 to 1000. Default is 250.</em>',
'MCHAT_TOP_OF_FORUM' => 'Top',
'MCHAT_BOTTOM_OF_FORUM' => 'Bottom',
'MCHAT_REFRESH' => 'Refresh interval',
'MCHAT_REFRESH_EXPLAIN' => 'Number of seconds between refreshing messages.<br><em>You are limited from 5 to 60 seconds. Default is 10.</em>',
'MCHAT_REFRESH_EXPLAIN' => 'Number of seconds between refreshing messages.<br><em>You are limited from 2 to 3600 seconds. Default is 10.</em>',
'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',
'MCHAT_PRUNE_GC' => 'Message prune task interval',
'MCHAT_PRUNE_GC_EXPLAIN' => 'The time in seconds that needs to pass before the next message pruning is triggered. Note: this setting controls <em>when</em> messages are checked if they can be deleted. It does <em>not</em> control <em>which</em> messages are deleted. <em>Default is 86400 = 24 hours.</em>',
'MCHAT_PRUNE_GC_EXPLAIN' => 'The time that needs to pass before the next message pruning is triggered. Note: this setting controls <em>when</em> messages are checked if they can be deleted. It does <em>not</em> control <em>which</em> messages are deleted. <em>Default is 86400 seconds = 24 hours.</em>',
'MCHAT_PRUNE_NUM' => 'Messages to retain when pruning',
'MCHAT_PRUNE_NUM_EXPLAIN' => 'When using messages a fixed number of messages will be kept. When using hours, days or weeks all messages older than the specified time period at the time of pruning will be deleted.',
'MCHAT_PRUNE_NOW' => 'Prune messages now',
'MCHAT_PRUNE_NOW_CONFIRM' => 'Confirm pruning messages',
'MCHAT_PRUNED' => '%1$d mChat messages have been pruned',
'MCHAT_NAVBAR_LINK_COUNT' => 'Display number of active chat sessions in the navbar link',
'MCHAT_NAVBAR_LINK_COUNT' => 'Display number of active chat sessions in the navbar',
'MCHAT_MESSAGE_NUM_CUSTOM' => 'Initial number of messages to display on the mChat page',
'MCHAT_MESSAGE_NUM_CUSTOM_EXPLAIN' => '<em>You are limited from 5 to 50. Default is 10.</em>',
'MCHAT_MESSAGE_NUM_CUSTOM_EXPLAIN' => '<em>Default is 10.</em>',
'MCHAT_MESSAGE_NUM_INDEX' => 'Initial number of messages to display on the index page',
'MCHAT_MESSAGE_NUM_INDEX_EXPLAIN' => '<em>You are limited from 5 to 50. Default is 10.</em>',
'MCHAT_MESSAGE_NUM_INDEX_EXPLAIN' => '<em>Default is 10.</em>',
'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.<br><em>You are limited from 10 to 100. Default is 25.</em>',
'MCHAT_MESSAGE_NUM_ARCHIVE_EXPLAIN' => '<em>You are limited from 10 to 100. Default is 25.</em>',
'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',
@@ -100,22 +100,22 @@ $lang = array_merge($lang, [
'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.<br>Users who have <em>edit/delete permission as well as moderator permission are exempt</em> from this time limit.<br>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.<br><em>You are limited from 0 to 1000. Default is 500. Set to 0 to disable.</em>',
'MCHAT_MAX_MESSAGE_LENGTH_EXPLAIN' => 'Maximum number of characters allowed per message posted.<br><em>Default is 500. Set to 0 to disable.</em>',
'MCHAT_MAX_INPUT_HEIGHT' => 'Maximum input field height',
'MCHAT_MAX_INPUT_HEIGHT_EXPLAIN' => 'The input field will not expand beyond this number of pixels.<br><em>You are limited from 0 to 1000. Default is 150. Set to 0 to not allow multi-line messages.</em>',
'MCHAT_CUSTOM_PAGE' => 'Enable mChat page',
'MCHAT_CUSTOM_HEIGHT' => 'mChat page height',
'MCHAT_CUSTOM_HEIGHT_EXPLAIN' => 'The height of the chat box in pixels on the mChat page.<br><em>You are limited from 50 to 1000. Default is 350.</em>',
'MCHAT_BBCODES_DISALLOWED' => 'Disallowed bbcodes',
'MCHAT_BBCODES_DISALLOWED_EXPLAIN' => 'Here you can input the bbcodes that are <strong>not</strong> to be used in a message.<br>Separate bbcodes with a vertical bar, for example:<br>b|i|u|code|list|list=|flash|quote and/or a %1$scustom bbcode tag name%2$s',
'MCHAT_CUSTOM_HEIGHT_EXPLAIN' => '<em>You are limited from 50 to 1000. Default is 350.</em>',
'MCHAT_BBCODES_DISALLOWED' => 'Disallowed BBCdes',
'MCHAT_BBCODES_DISALLOWED_EXPLAIN' => 'Here you can input the BBCodes that are <strong>not</strong> to be used in a message.<br>Separate BBCodes with a vertical bar, for example:<br>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.<br>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. HTML code is allowed. Set to empty to disable the display.<br>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.<br>Set to 0 for no timeout. Careful, the session of a user reading mChat will never expire!<br><em>You are limited to the %1$sforum config setting for sessions%2$s which is currently set to %3$d seconds</em>',
'MCHAT_TIMEOUT_EXPLAIN' => 'Set the number of seconds until a session in the chat ends.<br>Set to 0 for no timeout. Careful, the session of a user reading mChat will never expire!<br><em>You are limited to the %1$sforum config setting for sessions%2$s which is currently set to %3$d seconds.</em>',
'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_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',
'MCHAT_OVERRIDE_MIN_POST_CHARS_EXPLAIN' => 'Set to yes to override the forums minimum characters setting for chat messages',
'MCHAT_OVERRIDE_MIN_POST_CHARS_EXPLAIN' => 'Set to yes to override the forums minimum characters setting for chat messages.',
'MCHAT_LOG_ENABLED' => 'Add entries to the admin log',
'MCHAT_LOG_ENABLED_EXPLAIN' => 'This affects message editing, deleting, pruning and purging.',
@@ -134,7 +134,7 @@ $lang = array_merge($lang, [
'MCHAT_DELETE_MESSAGES' => '%1$s and delete mChat messages',
// Error reporting
'TOO_LONG_MCHAT_BBCODE_DISALLOWED' => 'The disallowed bbcodes value is too long.',
'TOO_LONG_MCHAT_BBCODE_DISALLOWED' => 'The disallowed BBCodes value is too long.',
'TOO_SMALL_MCHAT_CUSTOM_HEIGHT' => 'The mChat page height value is too small.',
'TOO_LARGE_MCHAT_CUSTOM_HEIGHT' => 'The mChat page height value is too large.',
'TOO_LONG_MCHAT_DATE' => 'The date format you entered is too long.',
@@ -142,12 +142,7 @@ $lang = array_merge($lang, [
'TOO_LARGE_MCHAT_FLOOD_TIME' => 'The flood time value is too large.',
'TOO_SMALL_MCHAT_INDEX_HEIGHT' => 'The index height value is too small.',
'TOO_LARGE_MCHAT_INDEX_HEIGHT' => 'The index height value is too large.',
'TOO_LARGE_MCHAT_MAX_MESSAGE_LNGTH' => 'The max message length value is too large.',
'TOO_LARGE_MCHAT_MAX_INPUT_HEIGHT' => 'The max input height value is too large.',
'TOO_SMALL_MCHAT_MESSAGE_NUM_CUSTOM' => 'The number of messages to display on the mChat page is too small.',
'TOO_LARGE_MCHAT_MESSAGE_NUM_CUSTOM' => 'The number of messages to display on the mChat page is too large.',
'TOO_SMALL_MCHAT_MESSAGE_NUM_INDEX' => 'The number of messages to display on the index page is too small.',
'TOO_LARGE_MCHAT_MESSAGE_NUM_INDEX' => 'The number of messages to display on the index page is too large.',
'TOO_SMALL_MCHAT_MESSAGE_NUM_ARCHIVE' => 'The number of messages to display on the archive page is too small.',
'TOO_LARGE_MCHAT_MESSAGE_NUM_ARCHIVE' => 'The number of messages to display on the archive page is too large.',
'TOO_SMALL_MCHAT_REFRESH' => 'The refresh value is too small.',

View File

@@ -0,0 +1,30 @@
<?php
/**
*
* @package phpBB Extension - mChat
* @copyright (c) 2018 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
namespace dmzx\mchat\migrations;
use phpbb\db\migration\migration;
class mchat_2_1_2 extends migration
{
public static function depends_on()
{
return [
'\dmzx\mchat\migrations\mchat_2_1_1',
];
}
public function update_data()
{
return [
['config.update', ['mchat_version', '2.1.2']],
];
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1 @@
{% INCLUDECSS '@dmzx_mchat/mchat_cleansilver.css' %}

View File

@@ -0,0 +1,26 @@
/**
*
* mChat CSS for CleanSilver
*
* @package phpBB Extension - mChat
* @copyright (c) 2017 MannixMD
* @copyright (c) 2018 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
.mchat-panel-buttons .icon.fa.fa-smile-o {
padding: 3px;
}
.mchat-wrapper li.header dd {
width: 95px;
}
.mchat-wrapper li.header dd.lastpost {
width: 250px;
}
.mchat-button-is-down {
border-style: none;
}

View File

@@ -0,0 +1 @@
{% INCLUDECSS '@dmzx_mchat/mchat_hexagonreborn.css' %}

View File

@@ -0,0 +1,26 @@
/**
*
* mChat CSS for Hexagon Reborn
*
* @package phpBB Extension - mChat
* @copyright (c) 2017 MannixMD
* @copyright (c) 2018 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
.mchat-button-down {
line-height: 1.6;
}
.mchat-button-down .icon {
padding: 2px;
}
.mchat-button-is-down {
border-style: none;
}
.mchat-input-control button:hover .icon {
color: #de7300;
}

View File

@@ -0,0 +1 @@
{% INCLUDECSS '@dmzx_mchat/mchat_projectdurango.css' %}

View File

@@ -0,0 +1,78 @@
/**
*
* mChat CSS for Project Durango
*
* @package phpBB Extension - mChat
* @copyright (c) 2017 MannixMD
* @copyright (c) 2018 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
.mchat-panel-buttons .button {
border-color: #3a3a3a;
background: #3a3a3a;
}
.mchat-panel-buttons .button:hover {
background: #5dc21e;
border-color: #5dc21e;
}
.mchat-panel-button .button .icon {
color: #000;
}
.mchat-panel-buttons .icon {
color: #5dc21e;
}
.mchat-input-control button:hover .icon {
color: #5dc21e;
}
ul#mchat-messages {
background: #c2c2c2;
}
.mchat-messages-top .row {
border-bottom-color: #107c10;
border-bottom-width: 4px;
border-top-width: 0;
}
.mchat-text {
color: #3a3a3a;
}
ul.mchat-buttons .fa {
color: #107c10;
}
.mchat-wrapper .mchat-buttons li {
opacity: .5;
}
#mchat-main {
border-top: 4px solid #107c10;
}
#mchat-messages li.row:hover {
background: #c2c2c2;
}
.mchat-message-header {
color: #3a3a3a;
}
.mchat-button-add .icon {
color: #107c10;
}
#mchat-confirm textarea {
color: #f1f1f1;
}
#mchat-panel {
background-color: #6b6b6b;
}

View File

@@ -335,6 +335,9 @@ jQuery(function($) {
mChat.resetSession();
},
refresh: function(message) {
if (mChat.pageIsUnloading) {
return $.when();
}
var isAdd = typeof message !== 'undefined';
if (!isAdd) {
mChat.sessionLength += mChat.refreshTime;
@@ -348,7 +351,7 @@ jQuery(function($) {
}
var data = {
last: mChat.messageIds.length ? mChat.messageIds.max() : 0,
log: mChat.liveUpdates ? mChat.logId : undefined,
log: mChat.logId,
message: isAdd ? message : undefined
};
mChat.status('load');
@@ -597,7 +600,6 @@ jQuery(function($) {
},
updateCharCount: function() {
var count = mChat.cleanMessage(mChat.cached('input').val()).length;
var exceedCount = Math.max(mChat.mssgLngth - count, -999);
if (mChat.showCharCount) {
var charCount = mChat.lang.charCount.format({current: count, max: mChat.mssgLngth});
var $elem = mChat.cached('character-count').html(charCount).toggleClass('invisible', count === 0);
@@ -605,9 +607,12 @@ jQuery(function($) {
$elem.toggleClass('error', count > mChat.mssgLngth);
}
}
mChat.cached('exceed-character-count').text(exceedCount).toggleClass('hidden', exceedCount >= 0);
mChat.cached('input').parent().toggleClass('mchat-input-error', exceedCount < 0);
mChat.cached('add').toggleClass('hidden', exceedCount < 0);
if (mChat.mssgLngth) {
var exceedCount = mChat.mssgLngth - count;
mChat.cached('exceed-character-count').text(exceedCount).toggleClass('hidden', exceedCount >= 0);
mChat.cached('input').parent().toggleClass('mchat-input-error', exceedCount < 0);
mChat.cached('add').toggleClass('hidden', exceedCount < 0);
}
},
cleanMessage: function(message) {
if (!mChat.maxInputHeight) {
@@ -773,20 +778,38 @@ jQuery(function($) {
}
});
var toggleRememberColor = function() {
var $this = $(this);
var newColor = $this.data('color');
if (mChat.storage.get('color') === newColor) {
mChat.storage.remove('color');
} else {
mChat.storage.set('color', newColor);
mChat.cached('colour').find('.colour-palette a').removeClass('remember-color');
}
$this.toggleClass('remember-color');
};
var toggleRememberColorTimer = 0;
var isToggledRememberColor = false;
mChat.cached('colour').find('.colour-palette').on('click', 'a', function(e) {
if (e.ctrlKey || e.metaKey) {
if (isToggledRememberColor) {
e.preventDefault();
e.stopImmediatePropagation();
var $this = $(this);
var newColor = $this.data('color');
if (mChat.storage.get('color') === newColor) {
mChat.storage.remove('color');
} else {
mChat.storage.set('color', newColor);
mChat.cached('colour').find('.colour-palette a').removeClass('remember-color');
}
$this.toggleClass('remember-color');
isToggledRememberColor = false;
} else if (e.ctrlKey || e.metaKey) {
e.preventDefault();
e.stopImmediatePropagation();
toggleRememberColor.call(this);
}
}).on('mousedown touchstart', 'a', function() {
var that = this;
toggleRememberColorTimer = setTimeout(function() {
toggleRememberColor.call(that);
isToggledRememberColor = true;
}, 500);
}).on('mouseup touchend', 'a', function() {
clearTimeout(toggleRememberColorTimer);
});
var color = mChat.storage.get('color');
@@ -794,6 +817,10 @@ jQuery(function($) {
mChat.cached('colour').find('.colour-palette a[data-color="' + color + '"]').addClass('remember-color');
}
mChat.cached('colour').find('.colour-palette a').each(function() {
$(this).removeAttr('href');
});
if (mChat.maxInputHeight) {
mChat.cached('input').one('focus', function() {
autosize(this);
@@ -803,7 +830,8 @@ jQuery(function($) {
mChat.cached('form').submit(function(e) {
e.preventDefault();
}).keypress(function(e) {
if ((e.which === 10 || e.which === 13) && mChat.cached('input').is(e.target)) {
var isEnter = e.which === 10 || e.which === 13;
if (isEnter && mChat.cached('input').is(e.target)) {
var isCtrl = e.ctrlKey || e.metaKey;
if (!mChat.maxInputHeight || !isCtrl === !mChat.storage.get('no_enter')) {
e.preventDefault();
@@ -829,6 +857,9 @@ jQuery(function($) {
$(window).on('beforeunload', function() {
mChat.pageIsUnloading = true;
if (mChat.page !== 'archive') {
mChat.pauseSession();
}
});
$('#phpbb').on('click', '[data-mchat-action]', function(e) {

View File

@@ -23,7 +23,6 @@
playSound : {{ MCHAT_SOUND ? 'true' : 'false' }},
messageTop : {{ MCHAT_MESSAGE_TOP ? 'true' : 'false' }},
allowBBCodes : {{ S_BBCODE_ALLOWED ? 'true' : 'false' }},
liveUpdates : {{ MCHAT_LIVE_UPDATES ? 'true' : 'false' }},
relativeTime : {{ MCHAT_RELATIVE_TIME ? 'true' : 'false' }},
showCharCount : {{ MCHAT_CHARACTER_COUNT ? 'true' : 'false' }},
jumpTo : {{ MCHAT_JUMP_TO }},

View File

@@ -1,4 +1,5 @@
{% if MCHAT_PAGE %}
<br>
<span>{{ MCHAT_DISPLAY_NAME }} &copy; {{ lang('POST_BY_AUTHOR') }} {{ MCHAT_AUTHOR_HOMEPAGES }}</span>
<p class="footer-row mchat-copyright">
<span>{{ MCHAT_DISPLAY_NAME }} &copy; {{ lang('POST_BY_AUTHOR') }} {{ MCHAT_AUTHOR_HOMEPAGES }}</span>
</p>
{% endif %}

View File

@@ -9,7 +9,7 @@
<div class="mchat-input-container inputbox">
<textarea id="mchat-input" name="message" class="no-auto-resize {{ MCHAT_MAX_INPUT_HEIGHT ? 'mchat-multi-line' : 'mchat-single-line' }}" rows="1" autocomplete="off"></textarea>
<div class="mchat-input-control">
<button class="mchat-button-add" id="mchat-add" data-mchat-action="add" title="{{ lang('MCHAT_ADD') }}">
<button type="button" class="mchat-button-add" id="mchat-add" data-mchat-action="add" title="{{ lang('MCHAT_ADD') }}">
<i class="icon icon-lightgray fa fa-chevron-right fa-fw" aria-hidden="true"></i><span class="sr-only">{{ lang('MCHAT_ADD') }}</span>
</button>
{% if MCHAT_MAX_MESSAGE_LENGTH %}
@@ -22,13 +22,13 @@
<div class="mchat-panel-buttons">
{% EVENT dmzx_mchat_buttons_before %}
{% if MCHAT_ALLOW_SMILES and loops.smiley|length %}
<button class="button mchat-button-smilies mchat-button-down" data-mchat-action="toggle" data-mchat-element="smilies" title="{{ lang('MCHAT_SMILES') }}">
<button type="button" class="button mchat-button-smilies mchat-button-down" data-mchat-action="toggle" data-mchat-element="smilies" title="{{ lang('MCHAT_SMILES') }}">
<i class="icon fa fa-smile-o" aria-hidden="true"></i><span class="sr-only">{{ lang('MCHAT_SMILES') }}</span>
</button>
{% endif %}
{% EVENT dmzx_mchat_buttons_mid %}
{% if S_BBCODE_ALLOWED %}
<button class="button mchat-button-bbcodes mchat-button-down" data-mchat-action="toggle" data-mchat-element="bbcodes" title="{{ lang('MCHAT_BBCODES') }}">
<button type="button" class="button mchat-button-bbcodes mchat-button-down" data-mchat-action="toggle" data-mchat-element="bbcodes" title="{{ lang('MCHAT_BBCODES') }}">
<i class="icon fa fa-code fa-fw" aria-hidden="true"></i><span class="sr-only">{{ lang('MCHAT_BBCODES') }}</span>
</button>
{% endif %}

View File

@@ -22,9 +22,15 @@
.mchat-header .list-inner {
position: relative;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
align-items: center;
justify-content: left;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: left;
-ms-flex-pack: left;
justify-content: left;
}
.mchat-wrapper li.header dd {
@@ -38,7 +44,8 @@
}
#mchat-body * {
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
#mchat-main {
@@ -72,13 +79,29 @@
}
.mchat-message-flash {
animation-name: flash-message;
animation-duration: .4s;
animation-timing-function: ease-out;
-webkit-animation-name: flash-message;
animation-name: flash-message;
-webkit-animation-duration: .4s;
animation-duration: .4s;
-webkit-animation-timing-function: ease-out;
animation-timing-function: ease-out;
}
.mchat-message-flash:target {
animation-duration: 2s;
-webkit-animation-duration: 2s;
animation-duration: 2s;
}
@-webkit-keyframes flash-message {
0% {
background-color: #FFDC95;
}
100% {
background-color: transparent;
}
}
@keyframes flash-message {
@@ -149,6 +172,10 @@
display: unset;
}
.mchat-text .text-strong {
color: unset;
}
.mchat-notification-message .mchat-text {
font-style: italic;
}
@@ -228,6 +255,8 @@
}
.mchat-controls {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
margin: 5px 0;
}
@@ -237,7 +266,9 @@
}
.mchat-input-container {
flex: 1;
-webkit-box-flex: 1;
-ms-flex: 1;
flex: 1;
position: relative;
max-width: 100%;
border-radius: 4px;
@@ -270,9 +301,15 @@
.mchat-input-control {
position: absolute;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
justify-content: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
width: 30px;
height: 100%;
top: 0;
@@ -297,7 +334,9 @@
.mchat-status {
position: absolute;
top: calc(50% - 1px);
transform: translateY(-50%);
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
text-indent: 0;
}
@@ -320,6 +359,8 @@
}
.mchat-panel-buttons {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
margin-left: 5px;
}
@@ -354,6 +395,13 @@
display: none;
}
#mchat-bbcodes #colour_palette {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
#mchat-bbcodes #colour_palette label {
display: none;
}
@@ -362,8 +410,14 @@
margin: 0 auto 5px;
}
#mchat-bbcodes #colour_palette a {
cursor: pointer;
}
#mchat-bbcodes #colour_palette td a.remember-color {
box-shadow: 0 0 0 1px #F00;
position: relative;
-webkit-box-shadow: 0 0 2px 2px #F00;
box-shadow: 0 0 2px 2px #F00;
}
#mchat-smilies {
@@ -384,12 +438,14 @@
float: left;
}
.mchat-copyright {
position: relative;
top: 1px;
font-weight: bold;
font-size: 1.1em;
cursor: help;
.mchat-copyright.footer-row {
font-size: 10px;
line-height: 1.8;
margin: 0;
}
.footer-row + br {
display: none;
}
.mchat-static {
@@ -411,7 +467,10 @@
}
.mchat-controls {
flex-direction: column;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
}
.mchat-panel-buttons {

View File

@@ -0,0 +1,3 @@
{% if U_MCHAT_CUSTOM_PAGE or MCHAT_PAGE %}
{% INCLUDE '@dmzx_mchat/mchat_navlink.html' %}
{% endif %}

View File

@@ -0,0 +1,3 @@
{% if U_MCHAT_CUSTOM_PAGE or MCHAT_PAGE %}
{% INCLUDE '@dmzx_mchat/mchat_navlink.html' %}
{% endif %}

View File

@@ -0,0 +1 @@
{% INCLUDECSS '@dmzx_mchat/mchat_we_universal.css' %}

View File

@@ -0,0 +1 @@
{# empty #}

View File

@@ -0,0 +1,21 @@
/**
*
* mChat CSS for we_universal
*
* @package phpBB Extension - mChat
* @copyright (c) 2018 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
.mchat-nav {
float: right !important;
}
.mchat-nav::before {
content: none !important;
}
#mchat-panel .inputbox {
height: unset;
}