Version 2.0.0-RC4

This commit is contained in:
dmzx
2016-04-02 11:36:20 +02:00
parent 91dfd6d9fc
commit ca5bcaa947
20 changed files with 509 additions and 380 deletions

View File

@@ -94,17 +94,6 @@ jQuery(function($) {
};
$.extend(mChat, {
clear: function() {
if (mChat.cached('input').val() !== '') {
if (confirm(mChat.clearConfirm)) {
mChat.resetSession();
mChat.cached('input').val('').keyup().trigger('autogrow');
}
setTimeout(function() {
mChat.cached('input').focus();
}, 1);
}
},
sound: function(file) {
if (!mChat.pageIsUnloading && !Cookies.get('mchat_no_sound')) {
var audio = mChat.cached('sound-' + file).get(0);
@@ -189,6 +178,9 @@ jQuery(function($) {
});
},
refresh: function(message) {
if (mChat.isPaused && !message) {
return false;
}
var $messages = mChat.cached('messages').children();
var data = {
message_last_id: mChat.messageIds.length ? mChat.messageIds.max() : 0
@@ -371,9 +363,6 @@ jQuery(function($) {
clearInterval(mChat.whoisInterval);
mChat.whoisInterval = setInterval(mChat.whois, mChat.whoisRefresh);
}
if (mChat.pause) {
mChat.cached('input').one('keypress', mChat.endSession);
}
mChat.cached('status-ok').show();
mChat.cached('status-load', 'status-error', 'status-paused').hide();
mChat.cached('refresh-text').html(mChat.refreshYes);
@@ -396,6 +385,18 @@ jQuery(function($) {
mChat.cached('status-paused').show();
mChat.cached('refresh-text').html(mChat.refreshNo);
},
pauseStart: function() {
mChat.isPaused = true;
mChat.cached('refresh-text').html(mChat.refreshNo);
mChat.cached('status-load', 'status-ok', 'status-error').hide();
mChat.cached('status-paused').show();
},
pauseEnd: function() {
mChat.cached('refresh-text').html(mChat.refreshYes);
mChat.cached('status-load', 'status-error', 'status-paused').hide();
mChat.cached('status-ok').show();
mChat.isPaused = false;
},
mention: function() {
var $container = $(this).closest('.mchat-message');
var username = mChat.entityDecode($container.data('mchat-username'));
@@ -455,10 +456,12 @@ jQuery(function($) {
}).get();
mChat.hiddenFields = {};
$('#mchat-form').find('input[type=hidden]').each(function() {
mChat.cached('form').find('input[type=hidden]').each(function() {
mChat.hiddenFields[this.name] = this.value;
});
mChat.isPaused = false;
if (!mChat.archivePage) {
mChat.resetSession();
@@ -492,10 +495,8 @@ jQuery(function($) {
}
});
mChat.startRelativeTimeUpdate(mChat.cached('messages'));
if (mChat.cached('input').is('input')) {
$('#mchat-form').keypress(function(e) {
mChat.cached('form').keypress(function(e) {
if (e.which == 13) {
mChat.add();
e.preventDefault();
@@ -504,8 +505,21 @@ jQuery(function($) {
});
}
if (mChat.pause) {
mChat.cached('form').keyup(function(e) {
if (mChat.refreshInterval !== false) {
var val = mChat.cached('input').val();
if (mChat.isPaused && val === '') {
mChat.pauseEnd();
} else if (!mChat.isPaused && val !== '') {
mChat.pauseStart();
}
}
});
}
if (mChat.showCharCount) {
$('#mchat-form').keyup(function(e) {
mChat.cached('form').keyup(function(e) {
var count = mChat.inputMessageLength();
var $elem = mChat.cached('character-count');
$elem.html(mChat.charCount.format({current: count, max: mChat.mssgLngth})).css('visibility', count > 0 ? 'visible' : 'hidden');
@@ -515,12 +529,16 @@ jQuery(function($) {
});
}
mChat.cached('input').autoGrowInput({
minWidth: mChat.cached('input').width(),
maxWidth: mChat.cached('form').width() - (mChat.cached('input').outerWidth(true) - mChat.cached('input').width())
mChat.cached('form').one('keypress', function() {
mChat.cached('input').autoGrowInput({
minWidth: mChat.cached('input').width(),
maxWidth: mChat.cached('form').width() - (mChat.cached('input').outerWidth(true) - mChat.cached('input').width())
});
});
}
mChat.startRelativeTimeUpdate(mChat.cached('messages'));
$(window).on('beforeunload', function() {
mChat.pageIsUnloading = true;
});

View File

@@ -0,0 +1 @@
<!-- Leave empty -->

View File

@@ -24,16 +24,29 @@
<!-- ENDIF -->
<!-- EVENT dmzx_mchat_body_before -->
<!-- IF MCHAT_IS_COLLAPSIBLE -->
<a class="category<!-- IF S_MCHAT_HIDDEN --> hidden-category<!-- ENDIF --> mchat-category"></a>
<!-- ENDIF -->
<div class="forabg">
<a id="mChat"></a>
<div class="inner">
<ul class="topiclist">
<li class="header">
<!-- INCLUDE mchat_header.html -->
<!-- IF MCHAT_IS_COLLAPSIBLE -->
<a href="{U_MCHAT_COLLAPSE_URL}"
class="collapse-btn collapse-<!-- IF S_MCHAT_HIDDEN -->show<!-- ELSE -->hide<!-- ENDIF --> mchat-collapse"
data-hidden="{S_MCHAT_HIDDEN}"
data-ajax="phpbb_collapse"
data-overlay="true"
title="{L_MCHAT_COLLAPSE_TITLE}"></a>
<!-- ENDIF -->
</li>
</ul>
<div id="mchat-body" class="postbody">
<div id="mchat-body" class="postbody<!-- IF MCHAT_IS_COLLAPSIBLE --> collapsible<!-- ENDIF -->">
<!-- INCLUDE mchat_script_data.html -->
<!-- IF not MCHAT_SOUND_DISABLED -->

View File

@@ -13,7 +13,7 @@
<noscript><div class="error">{L_MCHAT_NOJAVASCRIPT}</div></noscript>
<!-- IF MCHAT_ALLOW_USE -->
<!-- IF MCHAT_INPUT_AREA -->
<input id="mchat-input" type="text" name="message" class="inputbox medium" />
<input id="mchat-input" type="text" name="message" class="inputbox medium" autocomplete="off" />
<!-- ELSE -->
<textarea id="mchat-input" name="message" class="inputbox no-auto-resize" cols="32" rows="5"></textarea>
<!-- ENDIF -->
@@ -22,9 +22,6 @@
<div id="mchat-buttons">
<!-- IF MCHAT_ALLOW_USE -->
<input id="mchat-add" type="button" class="button2" data-mchat-action="add" value="{L_MCHAT_ADD}" />
<!-- IF MCHAT_USER_TIMEOUT or MCHAT_PAUSE_ON_INPUT -->
<input id="mchat-clear" type="button" class="button2" data-mchat-action="clear" value="{L_RESET}" />
<!-- ENDIF -->
<!-- IF MCHAT_ALLOW_SMILES and .smiley -->
<input type="button" class="button2" data-mchat-toggle="smilies" value="{L_MCHAT_SMILES}" />
<!-- ENDIF -->

View File

@@ -25,12 +25,12 @@
userTimeout : {MCHAT_USER_TIMEOUT},
mssgLngth : {MCHAT_MESSAGE_LNGTH},
editDeleteLimit : {MCHAT_EDIT_DELETE_LIMIT},
removeBBCodes : '{MCHAT_DISALLOWED_BBCODES}',
removeBBCodes : '{A_MCHAT_DISALLOWED_BBCODES}',
// Language
minutesAgo : {
<!-- BEGIN mchattime -->
{mchattime.KEY}: '{mchattime.LANG}'<!-- IF not mchattime.IS_LAST -->,<!-- ENDIF -->
{mchattime.KEY}: '{mchattime.A_LANG}'<!-- IF not mchattime.IS_LAST -->,<!-- ENDIF -->
<!-- END mchattime -->
},
newMessageAlert : '{LA_MCHAT_NEW_CHAT}',
@@ -40,13 +40,12 @@
noAccess : '{LA_NO_AUTH_OPERATION}',
flood : '{LA_MCHAT_FLOOD}',
delConfirm : '{LA_MCHAT_DELCONFIRM}',
clearConfirm : '{LA_MCHAT_RESET_QUESTION}',
sessOut : '{LA_MCHAT_SESSION_OUT}',
sessEnds : '{LA_MCHAT_SESSION_ENDS_JS}',
refreshYes : '{MCHAT_REFRESH_YES}',
refreshYes : '{A_MCHAT_REFRESH_YES}',
refreshNo : '{LA_MCHAT_REFRESH_NO}',
charCount : '<!-- IF MCHAT_MESSAGE_LNGTH -->{LA_MCHAT_CHARACTER_COUNT_LIMIT}<!-- ELSE -->{LA_MCHAT_CHARACTER_COUNT}<!-- ENDIF -->',
mssgLngthLong : '{MCHAT_MESS_LONG}',
mssgLngthLong : '{A_MCHAT_MESS_LONG}',
likes : '{LA_MCHAT_LIKES}'
};
// ]]>

View File

@@ -130,10 +130,14 @@
.mchat-text {
clear: both;
overflow: hidden;
padding: 0 5px 2px;
padding: 2px 5px;
font-size: 1.2em;
}
.mchat-text strong {
font-weight: bold !important;
}
.mchat-text li {
display: list-item !important;
list-style-type: inherit !important;
@@ -324,3 +328,19 @@
#mchat-panel #abbc3_buttons .abbc3_buttons_row {
margin: 0 auto !important;
}
/* Compatibility with Collapsible Categories extension */
.mchat-category {
display: none;
height: 0;
}
.mchat-collapse {
display: none;
line-height: 0;
}
.hidden-category + .forabg #mchat-body .topiclist.forums {
display: block;
}