The chat module has been removed

This commit is contained in:
Sergei Solovev 2024-03-14 06:46:07 +03:00
parent 2333543727
commit 11d3af2954
15 changed files with 5 additions and 1094 deletions

View file

@ -279,19 +279,6 @@ CREATE TABLE `cashback` (
-- --------------------------------------------------------
--
-- Структура таблицы `chat`
--
CREATE TABLE `chat` (
`id` int(11) NOT NULL,
`userid` int(11) NOT NULL,
`date` datetime NOT NULL,
`msg` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Структура таблицы `control`
--
@ -1533,12 +1520,6 @@ ALTER TABLE `boost_rating`
ALTER TABLE `cashback`
ADD PRIMARY KEY (`id`);
--
-- Индексы таблицы `chat`
--
ALTER TABLE `chat`
ADD PRIMARY KEY (`id`);
--
-- Индексы таблицы `control`
--
@ -1995,11 +1976,6 @@ ALTER TABLE `boost_rating`
ALTER TABLE `cashback`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT для таблицы `chat`
--
ALTER TABLE `chat`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT для таблицы `control`
--
ALTER TABLE `control`

View file

@ -26,7 +26,6 @@ $aRoute = array(
'api_v1',
'check',
'monitoring',
'chat',
'jobs',
'partners',
);

View file

@ -1,10 +0,0 @@
<?php
if (!DEFINED('EGP'))
exit(header('Refresh: 0; URL=http://' . $_SERVER['HTTP_HOST'] . '/404'));
// Проверка на авторизацию
sys::noauth();
$title = 'Онлайн чат';
include(SEC . 'chat/chats.php');

View file

@ -1,113 +0,0 @@
<?php
if (!DEFINED('EGP'))
exit(header('Refresh: 0; URL=http://' . $_SERVER['HTTP_HOST'] . '/404'));
if (isset($section)) {
switch ($section) {
case 'send':
if (empty($_POST['text']))
sys::outjs(array('e' => 'Необходимо написать сообщение'));
$msg = $_POST['text'];
$sql->query('INSERT INTO `chat` (`userid`, `date`, `msg`) VALUES ("' . $user['id'] . '", NOW(), "' . mysqli_real_escape_string($sql->sql_id, $msg) . '");');
sys::outjs(array('s' => ''));
case 'dialog':
$q_Msgs = $sql->query('SELECT `chat`.`id`, `userid`, `msg`, `chat`.`date`, `login`, `group` FROM `chat` INNER JOIN `users` ON `chat`.`userid` = `users`.`id` ORDER BY `chat`.`date` ASC LIMIT 30');
while ($msg = $sql->get($q_Msgs)) {
$html->get('messages_all', 'sections/chat');
if ($msg['group'] == 'admin')
$group = '<span style="color: #f94747">Администратор</span>';
else if ($msg['group'] == 'support')
$group = '<span style="color: #00ff8a">Тех. Поддержка</span>';
else if ($msg['group'] == 'user')
$group = '<span>Клиент</span>';
$name = $msg['login'] . ' (' . $group . ')';
$html->set('id', $msg['id']);
$html->set('userid', $msg['userid']);
$html->set('name', $name);
$html->set('time', $time);
$html->set('date', $msg['date']);
$html->set('msg', $msg['msg']);
$html->set('login', $msg['login']);
$html->unit('me', $user['id'] == $userid, 1);
for ($i = 1; $i <= 32; $i++)
$html->set('emoji_' . $i, '<span class="emoji" data-value="emoji_' . $i . '"></span>');
global $cfg;
$file = 'upload/avatars/' . $resp['uid'] . '.';
$link = $cfg['http'] . 'upload/avatars/' . $resp['uid'] . '.';
if (file_exists(ROOT . $file . 'jpg'))
$html->set('ava', '/upload/avatars/' . $resp['uid'] . '.jpg');
elseif (file_exists(ROOT . $file . 'png'))
$html->set('ava', '/upload/avatars/' . $resp['uid'] . '.png');
elseif (file_exists(ROOT . $file . 'gif'))
$html->set('ava', '/upload/avatars/' . $resp['uid'] . '.gif');
else
$html->set('ava', $cfg['http'] . 'template/images/avatar.png');
$html->pack('dialog');
}
sys::out(isset($html->arr['dialog']) ? $html->arr['dialog'] : '');
case 'delete':
if ($user['group'] != 'admin')
sys::outjs(array('e' => 'Недостаточно прав'));
if (!isset($url['id']))
sys::outjs(array('e' => 'Отсутствует идентификатор'));
if ($go)
$sql->query('DELETE FROM `chat` WHERE `userid`="' . $url['id'] . '";');
else
$sql->query('DELETE FROM `chat` WHERE `id`="' . $url['id'] . '";');
sys::outjs(array('s' => ''));
}
}
$html->nav($title);
$q_Msgs = $sql->query('SELECT `chat`.`id`, `userid`, `msg`, `chat`.`date`, `login`, `group` FROM `chat` INNER JOIN `users` ON `chat`.`userid` = `users`.`id` ORDER BY `chat`.`date` ASC LIMIT 30');
while ($msg = $sql->get($q_Msgs)) {
$html->get('messages_all', 'sections/chat');
if ($msg['group'] == 'admin')
$group = '<span style="color: #f94747">Администратор</span>';
else if ($msg['group'] == 'support')
$group = '<span style="color: #00ff8a">Тех. Поддержка</span>';
else if ($msg['group'] == 'user')
$group = '<span>Клиент</span>';
$name = $msg['login'] . ' (' . $group . ')';
$html->set('id', $msg['id']);
$html->set('userid', $msg['userid']);
$html->set('name', $name);
$html->set('time', $time);
$html->set('date', $msg['date']);
$html->set('msg', $msg['msg']);
$html->set('login', $msg['login']);
$html->unit('me', $user['id'] == $userid, 1);
for ($i = 1; $i <= 32; $i++)
$html->set('emoji_' . $i, '<span class="emoji" data-value="emoji_' . $i . '"></span>');
global $cfg;
$file = 'upload/avatars/' . $msg['uid'] . '.';
$link = $cfg['http'] . 'upload/avatars/' . $msg['uid'] . '.';
if (file_exists(ROOT . $file . 'jpg'))
$html->set('ava', '/upload/avatars/' . $msg['uid'] . '.jpg');
elseif (file_exists(ROOT . $file . 'png'))
$html->set('ava', '/upload/avatars/' . $msg['uid'] . '.png');
elseif (file_exists(ROOT . $file . 'gif'))
$html->set('ava', '/upload/avatars/' . $msg['uid'] . '.gif');
else
$html->set('ava', $cfg['http'] . 'template/images/avatar.png');
$html->pack('msg_all');
}
$html->get('dialog', 'sections/chat');
$html->set('chats', isset($html->arr['msg_all']) ? $html->arr['msg_all'] : '');
$html->pack('main');

View file

@ -1,37 +0,0 @@
<?php
if (!DEFINED('EGP'))
exit(header('Refresh: 0; URL=http://' . $_SERVER['HTTP_HOST'] . '/404'));
if (!$section || !in_array($section, array('dialog')))
sys::back($cfg['http']);
$q_Msgs = $sql->query('SELECT * FROM (SELECT `id`, `userid`, `msg`, `date` FROM `chat` ORDER BY `date` DESC LIMIT 30) t ORDER BY `date` ASC;');
while ($msg = $sql->get($q_Msgs)) {
if ($user['group'] == 'admin')
$group = '<span style="color: #f94747">Администратор</span>';
//elseif ()
// $group = '<span style="color: #03aa46">(Клиент, серверов: 1 шт.)</span>';
else
$group = '<span>Клиент</span>';
$name = $user['login'] . ' (' . $group . ')'; // <span style="color: #f94747">(Администратор)</span>
// $time = '[date]';
$html->get('message', 'chatwin');
$html->set('id', $msg['id']);
$html->set('userid', $msg['userid']);
$html->set('name', $name);
$html->set('time', $time);
$html->set('date', $msg['date']);
$html->set('msg', $msg['msg']);
$html->unit('me', $user['id'] == $userid, 1);
for ($i = 1; $i <= 32; $i++)
$html->set('emoji_' . $i, '<span class="emoji" data-value="emoji_' . $i . '"></span>');
$html->pack('dialog');
}
sys::out(isset($html->arr['dialog']) ? $html->arr['dialog'] : '');

View file

@ -119,7 +119,9 @@
<a href="[home]services">Услуги</a>
<a href="[home]wiki">База знаний</a>
<a href="[home]contacts" class="right">Контактная информация</a>
|admin|<a href="[home]acp" class="right"><font color="red">ACP</font></a>|_admin|
|admin|
<a href="[home]acp" class="right"><span style="color: red; ">Панель администратора</span></a>
|_admin|
</div>
<div class="header">
<a href="[home]">
@ -143,7 +145,7 @@
|servers|
<a href="[home]servers" class="margin-right">Игровые сервера</a>
|_servers|
<a href="[home]help/section/open" class="margin-right">Тех. поддержка</a>
<a href="[home]help/section/open" class="margin-right">Поддержка</a>
</div>
<a href="[home]user/section/lk" class="margin-right">Личный кабинет</a>
<a href="[home]user/section/replenish" class="margin-right">Баланс: [balance] [cur]</a>
@ -170,14 +172,10 @@
<li><a href="[home]servers"><i class="fa fa-gamepad"></i> Игровые сервера</a></li>
|_servers|
|auth|
<li><a href="[home]help/section/open"><i class="fa fa-life-ring"></i> Тех. поддержка <i id="help_notice"
class="fa fa-paper-plane-o"></i></a>
<li><a href="[home]help/section/open"><i class="fa fa-life-ring"></i> Поддержка <i id="help_notice" class="fa fa-paper-plane-o"></i></a>
</li>
|_auth|
<li><a href="[home]monitoring"><i class="fa fa-desktop"></i> Мониторинг</a></li>
|auth|
<li><a href="[home]chat"><i class="fa fa-commenting-o"></i> Онлайн чат</a></li>
|_auth|
</ul>
<!-- other menu !-->
[other_menu]

View file

@ -1,30 +0,0 @@
<div class="chat-message clearfix">
<a href="/profile/id/[userid]"><img src="[ava]" alt="" width="32" height="32"></a>
<div class="chat-message-content clearfix">
<span |date|data-tooltip="Отредактировано [ndate]" |_date| class="chat-time"
style="margin-left: 5px">[date]</span>
<span class="chat-time">
|me|<span data-tooltip="Удалить"><i class="fa fa-close" onclick="minichat_msg_del([id], [userid])"
style="font-size: 12px;color: indianred;cursor: pointer;"></i></span>|_me|
|!me||adm|<span data-tooltip="Удалить"><i class="fa fa-close" onclick="minichat_msg_del([id], [userid])"
style="font-size: 12px;color: indianred;cursor: pointer;"></i></span>|_adm||_!me|
|me|<span data-tooltip="Редактировать"><i class="fa fa-edit"
style="font-size: 12px;color: gray;cursor: pointer;"
onclick="minichat_msg_edit([id], 'edit')"></i></span>|_me|
|!me|<span data-tooltip="Ответить"><i class="fa fa-comment" onclick="chat_reply('[login]')"
style="font-size: 12px;color: green;cursor: pointer;"></i></span>|_!me|
</span>
<h5>|me|<span><a href="/profile/id/[userid]" target="_blank">Я</a></span>|_me| |!me|[name]|_!me|</h5>
<p>[msg]</p>|date|<span style="font-size: 11px;color: gray;float: right;"
data-tooltip="Отредактировано">(ред.)</span>|_date|
|img|
<div class="help_data_foot">
Прикрепленные изображения:
<div>
[img]
</div>
</div>
|_img|
</div>
</div>
<hr>

View file

@ -1,265 +0,0 @@
.chat_main_head span.chat_sender > a {
display: none;
}
.chat_main_head:hover span.chat_sender > a {
display: initial;
}
.chat_data a {
text-decoration: underline;
}
.chat_data_foot {
padding: 5px 5px 0 5px;
font-size: 10px;
}
.chat_data_foot > div {
display: inline-block;
width: 100%;
margin: 5px 0;
}
.chat_data_foot > div > div {
width: 88px;
float: left;
margin-right: 5px;
}
.chat_data_foot > div > div > a .image {
position: relative;
height: 80px;
width: 80px;
border: 4px solid #fff;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
background-color: #fff;
float: left;
overflow: hidden;
background-size: contain !important;
background-repeat: no-repeat !important;
text-align: center;
}
.chat_msg {
position: relative;
display: block;
margin-bottom: 15px;
}
.chat_msg_ava {
height: 57px;
width: 57px;
border: 4px solid #fff;
box-shadow: 0px 0px 1px 1px #DDD;
overflow: hidden;
margin-top: 5px;
border-radius: 50%;
float: left;
}
.chat_msg > .chat_main {
margin-left: 80px;
}
.chat_msg > .chat_main {
padding-right: 5px;
display: block;
}
.chat_main_head {
padding: 0 5px;
line-height: 22px;
}
.chat_main_head > span.chat_sender {
color: #597da3;
font-size: 11px;
font-family: 'Roboto Medium';
}
.chat_date {
color: #888;
float: right;
font-size: 10px;
margin-top: 2px;
}
.chat_body {
position: relative;
}
.chat_msg > .chat_main .chat_body span.chat_sprite {
background: url(../images/chat_sprite.png) no-repeat 0px 0px;
width: 25px;
height: 17px;
display: block;
position: absolute;
left: -11px;
top: 8px;
}
.chat_data {
background: #fff;
border: 1px solid rgba(196, 196, 196, 0.47);
padding: 10px;
color: #000;
font-size: 12px;
z-index: 0;
display: block;
font-family: 'Exo 2', sans-serif;
font-style: italic;
font-weight: 300;
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
-moz-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
word-wrap: break-word;
}
.chat_msg_ava img {
width: 110%;
min-height: 112%;
margin-top: -3px;
margin-left: -2px;
}
#dialog {
height: 500px;
overflow-y: scroll;
}
.emoji {
display: inline-block;
background: url(../images/emoji.png) no-repeat 0px 0px;
height: 16px;
width: 16px;
}
.emoji_1 {
background-position: 0px 0px;
}
.emoji_2 {
background-position: 0px -17px;
}
.emoji_3 {
background-position: 0px -34px;
}
.emoji_4 {
background-position: 0px -51px;
}
.emoji_5 {
background-position: 0px -68px;
}
.emoji_6 {
background-position: 0px -85px;
}
.emoji_7 {
background-position: 0px -102px;
}
.emoji_8 {
background-position: 0px -119px;
}
.emoji_9 {
background-position: 0px -136px;
}
.emoji_10 {
background-position: 0px -153px;
}
.emoji_11 {
background-position: 0px -170px;
}
.emoji_12 {
background-position: 0px -187px;
}
.emoji_13 {
background-position: 0px -204px;
}
.emoji_14 {
background-position: 0px -221px;
}
.emoji_15 {
background-position: 0px -238px;
}
.emoji_16 {
background-position: 0px -255px;
}
.emoji_17 {
background-position: 0px -272px;
}
.emoji_18 {
background-position: 0px -289px;
}
.emoji_19 {
background-position: 0px -306px;
}
.emoji_20 {
background-position: 0px -323px;
}
.emoji_21 {
background-position: 0px -340px;
}
.emoji_22 {
background-position: 0px -357px;
}
.emoji_23 {
background-position: 0px -374px;
}
.emoji_24 {
background-position: 0px -391px;
}
.emoji_25 {
background-position: 0px -408px;
}
.emoji_26 {
background-position: 0px -425px;
}
.emoji_27 {
background-position: 0px -442px;
}
.emoji_28 {
background-position: 0px -459px;
}
.emoji_29 {
background-position: 0px -476px;
}
.emoji_30 {
background-position: 0px -493px;
}
.emoji_31 {
background-position: 0px -510px;
}
.emoji_32 {
background-position: 0px -527px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

View file

@ -1,508 +0,0 @@
$('#send').ajaxForm({
dataType: 'json',
success: function (data) {
$.each(data, function (i, val) {
if (i == 'e')
bootbox.dialog('<h3 class="red">Ошибка</h3>' + val,
[{
"label": "OK",
"class": "btn-small btn-primary",
}]
);
if (i == 's') {
chat_sound('send');
$('#text').val('');
$('#login').val('')
document.getElementById("text").removeAttribute("style");
$('#img-input').html('');
$('#uploaded-files').html('');
$('#uploaded-files').css('display', 'none');
$('#frm').html($('#frm').html());
;
chat_dialog(false);
}
});
loading(0);
return false;
}
});
function chat_readers(go) {
$.get(home + 'chat/section/read/id/1',
function (readers) {
$('#chat_readers').html(readers);
$('#chat_readers_modal').html(readers);
if (!go)
setTimeout(function () {
chat_readers(false)
}, 3000);
});
}
function chat_writers(now) {
write = '';
if (now)
write = '/write/1';
$.get(home + 'chat/section/write/id/1' + write,
function (writers) {
$('#chat_writers').html(writers);
if (!now)
setTimeout(function () {
chat_writers(false)
}, 3000);
});
}
function chat_msg_send() {
if ($('#text').val() == '') {
chat_sound('err');
return false;
}
loading(1);
return true;
}
function chat_msg_edit(id, type) {
if (type == 'edit') {
$.get(home + 'chat/section/edit/id/' + id, function (data) {
bootbox.dialog('<h3 class="green">Выбранное сообщение</h3><div id="msg_edit_id" class="informer blue" style="height: 100px;overflow: scroll;">' + data + '</div><div style="padding: 10px;"><div onclick="bbcode(\'[spoiler]\', \'[/spoiler]\', \'edit\')" class="btn btn-short btn-gray right">Спойлер</div><div onclick="bbcode(\'[code]\', \'[/code]\', \'edit\')" class="btn btn-short btn-gray right">Подсветка</div><div onclick="bbcode(\'[quote]\', \'[/quote]\', \'edit\')" class="btn btn-short btn-gray right">Цитата</div><div onclick="bbcode(\'[url=http://\', \']Название[/url]\', \'edit\')" class="btn btn-short btn-gray right">Ссылка</div></div><div class="space"><div class="input_pad"><textarea id="edit" rows="4" type="text" placeholder="Введите текст" style="resize: auth;">' + data + '</textarea></div>',
[{
"label": "Продолжить",
callback: function () {
chat_msg_edit(id, 'edit_go')
},
}, {
"label": "Закрыть",
}]
);
});
} else {
$.ajax({
type: 'POST',
url: home + 'chat/section/edit/go',
data: 'edit=' + $('#edit').val() + '&id=' + id,
dataType: 'json',
success: function (data) {
$.each(data, function (i, val) {
if (i == 'e')
bootbox.dialog('<h3 class="red">Внимание!</h3>' + val,
[{
"label": "OK",
}]
);
if (i == 's') {
chat_dialog(false);
loading(0)
}
});
}
});
}
}
function chat_msg_del(id, user) {
bootbox.dialog('<h3 class="red">Выберите операцию</h3>',
[{
"label": "Удалить выбранное сообщение",
"class": "btn-small btn-primary",
callback: function () {
$('#msg_' + id).css('display', 'none');
chat_msg_del_go(id, '?id=1')
}
}, {
"label": "Удалить все отправленное сообщение",
"class": "btn-small btn-primary",
callback: function () {
$('.user_' + user).css('display', 'none');
chat_msg_del_go(user, '?user=1')
}
}, {
"label": "Отмена",
"class": "btn-small btn-primary"
}]
);
return false;
}
function chat_msg_del_go(id, type) {
$.getJSON(home + 'chat/section/delete/id/' + id + '/go/' + type, function (data) {
$.each(data, function (i, val) {
if (i == 'e')
bootbox.dialog('<h3 class="red">Ошибка</h3>' + val,
[{
"label": "OK",
"class": "btn-small btn-primary",
}]
);
if (i == 's')
chat_dialog(false);
});
});
return false;
}
function chat_dialog(go) {
var dialog_form = document.getElementById('dialog');
$.get(home + 'chat/section/dialog', function (data) {
$('#dialog').html(data)
$('.spoiler').click(function () {
$(this).parent().children('div.spoiler_main').toggle(0);
});
$('pre code').each(function (i, block) {
hljs.highlightBlock(block);
});
});
notice_load(true);
if (chat_scroll_ativate)
setTimeout(function () {
dialog_form.scrollTop = dialog_form.scrollHeight;
}, 300);
if (chat_notice_ativate)
chat_dialog_info();
if (go) {
spoilers = $('.spoiler_main');
update = true;
for (var i = 0; i < spoilers.length; i++) {
if (spoilers[i].style.display == 'block') {
setTimeout(function () {
chat_dialog(true)
}, 4000);
return false;
}
}
setTimeout(function () {
chat_dialog(true)
}, 4000);
}
}
function notice_load(go) {
$.get(home + 'chat/section/notice/check', function (data) {
if (data == 0)
document.getElementById('notice_chat').className = 'notice_chat__check';
else
document.getElementById('notice_chat').className = '';
if (go)
notice_load(go);
});
}
function chat_dialog_info(go) {
$.get(home + 'chat/section/dialog/go', function (data) {
if (data != chat_dialog_id && data != '') {
chat_dialog_id = data;
chat_sound('notice')
}
});
}
function reply_chat(login) {
$('#login').val(login);
$('#text').val(login + ', ' + $('#text').val());
return false;
}
function chat_scroll_change() {
if (chat_scroll_ativate) {
chat_scroll_ativate = false;
$('#chat_scroll').html('включить скроллинг');
} else {
chat_scroll_ativate = true;
$('#chat_scroll').html('отключить скроллинг');
}
}
function chat_notice_change() {
if (chat_notice_ativate) {
chat_notice_ativate = false;
$('#chat_notice').html('включить уведомления');
} else {
chat_notice_ativate = true;
$('#chat_notice').html('отключить уведомления');
}
}
function chat_sound_change() {
if (chat_sound_ativate) {
chat_sound_ativate = false;
$('#chat_sound').html('включить звуки');
} else {
chat_sound_ativate = true;
$('#chat_sound').html('отключить звуки');
}
}
function chat_emoji(emoji) {
form = document.getElementById('text');
begin = form.value.substr(0, form.selectionStart);
end = form.value.substr(form.selectionEnd);
var text = form.firstChild;
form.value = begin + '[emoji_' + emoji + ']' + end;
selPos = '[emoji_' + emoji + ']'.length + begin.length;
form.setSelectionRange(begin.length, selPos);
return false;
}
function chat_sound(track) {
if (!chat_sound_ativate)
return false;
var audio = new Audio();
audio.preload = 'auto';
audio.src = '/template/sections/chat/sound/chat_' + track + '.wav';
audio.play();
}
function clearFileUpload(id) {
fileField = document.getElementById(id);
parentNod = fileField.parentNode;
tmpForm = document.createElement("form");
parentNod.replaceChild(tmpForm, fileField);
tmpForm.appendChild(fileField);
tmpForm.reset();
parentNod.replaceChild(fileField, tmpForm);
}
function bbcode(bbbegin, bbend, eID) {
form = document.getElementById(eID);
begin = form.value.substr(0, form.selectionStart);
end = form.value.substr(form.selectionEnd);
sel = form.value.substr(form.selectionStart, form.selectionEnd - form.selectionStart);
var text = form.firstChild;
form.value = begin + bbbegin + sel + bbend + end;
selPos = bbbegin.length + begin.length + sel.length + bbend.length;
form.setSelectionRange(begin.length, selPos);
return false;
}
jQuery.event.props.push('dataTransfer');
var maxFiles = 8;
var dataArray = [];
$('#uploaded-files').hide();
$('#drop-files').on('drop', function (e) {
var files = e.dataTransfer.files;
if (files.length <= maxFiles) {
for (i = 0; i < files.length; i++) {
if (files[i].size < (1024 * 1024 * 1))
loadInView(files[i]);
else
bootbox.dialog('<h3 class="green">Внимание!</h3>Слишком большой файл. Максимально 1024Kb.',
[{
"label": "Хорошо"
}]
);
}
} else {
bootbox.dialog('<h3 class="green">Внимание!</h3>Нельзя загружать больше ' + maxFiles + ' изображений.',
[{
"label": "Хорошо"
}]
);
files.length = 0;
}
return false;
});
$('#img').on('change', function () {
var files = $(this)[0].files;
if (files.length <= maxFiles) {
for (i = 0; i < files.length; i++) {
if (files[i].size < (1024 * 1024 * 1))
loadInView(files[i]);
else
bootbox.dialog('<h3 class="green">Внимание!</h3>Слишком большой файл. Максимально 1024Kb.',
[{
"label": "Хорошо"
}]
);
}
} else {
// swal('Внимание!', 'Нельзя загружать больше '+maxFiles+' изображений.', 'warning');
bootbox.dialog('<h3 class="green">Внимание!</h3>Нельзя загружать больше ' + maxFiles + ' изображений.',
[{
"label": "Хорошо"
}]
);
files.length = 0;
}
clearFileUpload('img');
});
var upload = 0;
var files = 0;
function loadInView(file) {
if (files < 0)
files = 0;
$('#uploaded-holder').css('display', 'inline-block');
if (!file.type.match('image.*')) {
$('#drop-files p').html('Файл не является изображением.');
return false;
}
files = files + 1;
if (files <= maxFiles)
$('#upload-button').css({'display': 'block'});
else {
bootbox.dialog('<h3 class="green">Внимание!</h3>Нельзя загружать больше ' + maxFiles + ' изображений.',
[{
"label": "Хорошо"
}]
);
files = files - 1;
return false;
}
var fileReader = new FileReader();
fileReader.onload = (function (file) {
return function (e) {
dataArray.push({name: file.name, value: this.result, check: null, sel: null});
addImage((dataArray.length - 1));
};
})(file);
fileReader.readAsDataURL(file);
return false;
}
function delImage(id) {
$(this).empty();
dataArray.splice(id, 1);
$('#dropped-files > .img-block').remove();
addImage(-1);
return false;
}
function addImage(ind) {
if (ind < 0) {
start = 0;
end = dataArray.length;
files = files - 1;
} else {
start = ind;
end = ind + 1;
}
if (dataArray.length == 0) {
$('#upload-button').hide();
$('#uploaded-holder').hide();
}
for (i = start; i < end; i++)
if ($('#dropped-files > .img-block').length <= maxFiles)
$('#dropped-files').append('<div class="img-block" id="img-' + i + '"><div class="image" style="background: url(' + dataArray[i].value + '); background-size: contain;"></div><a href="#" onclick="return delImage(\'' + i + '\')" class="drop-button">Удалить</a></div>');
return false;
}
function restartFiles(go) {
$('#loading-bar .loading-color').css({'width': '0%'});
$('#loading').css({'display': 'none'});
$('#loading-content').html(' ');
$('#upload-button').hide();
$('#dropped-files > .img-block').remove();
$('#uploaded-holder').hide();
dataArray.length = 0;
if (go != 1)
files = upload;
return false;
}
$('#dropped-files #upload-button .delete').click(restartFiles);
$('#upload-button .upload').click(function () {
$("#loading").show();
var totalPercent = 100 / dataArray.length;
var x = 0;
$('#loading-content').html('Загружен ' + dataArray[0].name);
$.each(dataArray, function (index, file) {
upload = upload + 1;
$.post(home + 'chat/section/upload', dataArray[index], function (data) {
var fileName = dataArray[index].name;
++x;
$('#loading-bar .loading-color').css({'width': totalPercent * (x) + '%'});
if (totalPercent * (x) == 100) {
$('#loading-content').html('Загрузка завершена.');
setTimeout(restartFiles(1), 1000);
} else if (totalPercent * (x) < 100)
$('#loading-content').html('Загружается ' + fileName);
var dataSplit = data.split(':');
if (dataSplit[1] == 'ok') {
$('#uploaded-files').append('<div class="img-block"><div class="image" style="background: url(' + home + 'upload/' + dataSplit[0] + '); background-size: contain;"></div><a target="_blank" href="' + home + 'upload/' + dataSplit[0] + '" class="success-button">Загружено</a></div>');
$('#img-input').append('<input name="img[]" value="' + dataSplit[0] + '" type="hidden"></div>');
} else
$('#uploaded-files').append(data);
});
if (upload == maxFiles)
$('#upload_block').hide();
});
$('#uploaded-files').show();
return false;
});
$('#drop-files').on('dragenter', function () {
$(this).css({'border-color': '#74b084'});
return false;
});
$('#drop-files').on('drop', function () {
$(this).css({'border-color': '#dcdcdc'});
files = files - 1;
return false;
});

View file

@ -1,78 +0,0 @@
<h4 class="hblock_content">Онлайн чат</h4>
<div class="block_content help_dialog">
<div id="dialog">[dialog]</div>
<form method="POST" action="[home]chat/section/send" id="send">
<table class="table_pad form">
<tr>
<td colspan="2">
<textarea rows="4" id="text" name="text"></textarea>
</td>
</tr>
<tr>
<td colspan="2">
Настройки:
<a class="pointer btn btn-short" id="chat_scroll" onclick="chat_scroll_change()"
style="margin-top: 1px;">отключить скроллинг </a>
<a class="pointer btn btn-short" id="chat_notice" onclick="chat_notice_change()"
style="margin-top: 1px;">отключить уведомления </a>
<a class="pointer btn btn-short" id="chat_sound" onclick="chat_sound_change()"
style="margin-top: 1px;">отключить звуки</a>
</td>
</tr>
<tr>
<td>
<span class="emoji emoji_1 pointer" data-value="emoji_1" onclick="chat_emoji('1')"></span>
<span class="emoji emoji_2 pointer" onclick="chat_emoji('2')"></span>
<span class="emoji emoji_3 pointer" onclick="chat_emoji('3')"></span>
<span class="emoji emoji_4 pointer" onclick="chat_emoji('4')"></span>
<span class="emoji emoji_5 pointer" onclick="chat_emoji('5')"></span>
<span class="emoji emoji_6 pointer" onclick="chat_emoji('6')"></span>
<span class="emoji emoji_7 pointer" onclick="chat_emoji('7')"></span>
<span class="emoji emoji_8 pointer" onclick="chat_emoji('8')"></span>
<span class="emoji emoji_9 pointer" onclick="chat_emoji('9')"></span>
<span class="emoji emoji_10 pointer" onclick="chat_emoji('10')"></span>
<span class="emoji emoji_11 pointer" onclick="chat_emoji('11')"></span>
<span class="emoji emoji_12 pointer" onclick="chat_emoji('12')"></span>
<span class="emoji emoji_13 pointer" onclick="chat_emoji('13')"></span>
<span class="emoji emoji_14 pointer" onclick="chat_emoji('14')"></span>
<span class="emoji emoji_15 pointer" onclick="chat_emoji('15')"></span>
<span class="emoji emoji_16 pointer" onclick="chat_emoji('16')"></span>
<span class="emoji emoji_17 pointer" onclick="chat_emoji('17')"></span>
<span class="emoji emoji_18 pointer" onclick="chat_emoji('18')"></span>
<span class="emoji emoji_19 pointer" onclick="chat_emoji('19')"></span>
<span class="emoji emoji_20 pointer" onclick="chat_emoji('20')"></span>
<span class="emoji emoji_21 pointer" onclick="chat_emoji('21')"></span>
<span class="emoji emoji_22 pointer" onclick="chat_emoji('22')"></span>
<span class="emoji emoji_23 pointer" onclick="chat_emoji('23')"></span>
<span class="emoji emoji_24 pointer" onclick="chat_emoji('24')"></span>
<span class="emoji emoji_25 pointer" onclick="chat_emoji('25')"></span>
<span class="emoji emoji_26 pointer" onclick="chat_emoji('26')"></span>
<span class="emoji emoji_27 pointer" onclick="chat_emoji('27')"></span>
<span class="emoji emoji_28 pointer" onclick="chat_emoji('28')"></span>
<span class="emoji emoji_29 pointer" onclick="chat_emoji('29')"></span>
<span class="emoji emoji_30 pointer" onclick="chat_emoji('30')"></span>
<span class="emoji emoji_31 pointer" onclick="chat_emoji('31')"></span>
<span class="emoji emoji_32 pointer" onclick="chat_emoji('32')"></span>
</td>
<td width="5%">
<button class="btn btn-success right" onclick="return chat_msg_send()">Отправить</button>
</td>
</tr>
</table>
</form>
</div>
<link rel="stylesheet" type="text/css" href="[css]help.css" media="screen">
<link rel="stylesheet" href="[css]chat.css">
<script type="text/javascript" src="[js]chat.js"></script>
<script>
var chat_sound_ativate = true;
var chat_notice_ativate = true;
var chat_scroll_ativate = true;
var chat_dialog_id = '[id]';
$(document).ready(function () {
chat_dialog(true)
});
</script>

View file

@ -1,21 +0,0 @@
<div class="help_msg">
<div class="help_msg_ava">
<img src="[ava]">
</div>
<div class="help_main">
<div class="help_main_head">
<span class="help_sender">
|me|Я|_me| |!me|[name]|_!me|
|!me|<a href="/acp/users/id/[userid]" onclick="([id], [userid])">Профиль</a>|_!me|
|!me|<a href="#" onclick="chat_msg_del([id], [userid])">(<u>удалить соощение)</u></a>|_!me|
</span>
<span class="help_date">[date]</span>
</div>
<div class="help_body">
<span class="help_sprite"></span>
<div class="help_data">
<div>[msg]</div>
</div>
</div>
</div>
</div>