Merge pull request 'Исправил чат.' (#40) from fix/chat into dev

Reviewed-on: new-combats.com/game#40
This commit is contained in:
Ivor Barhansky 2023-01-23 11:46:55 +00:00
commit a9ab7257e8

View File

@ -64,7 +64,7 @@ var chat = {
this.ignoreList.nms[this.ignoreList.x] = login; this.ignoreList.nms[this.ignoreList.x] = login;
if ($('#ignr_alu').attr('id') != undefined) { if ($('#ignr_alu').attr('id') != undefined) {
$('#ignr_alu').html(`${$('#ignr_alu').html()}<div id="ignr_u_${this.ignoreList.x}"> <b>${login}</b> <a target="_blank" href="https://new-combats.com/info/${login}"><img src="https://${top.c.img}/i/inf_capitalcity.gif" onMouseOver="top.hi(this,\'<b>Инф. о ${login}</b>\',event,5,-2,2,2,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a> <small><a href="javascript:void(0)" onclick="chat.ignorUn(${this.ignoreList.x})">Clear</a></small> </div>`); $('#ignr_alu').html(`${$('#ignr_alu').html()}<div id="ignr_u_${this.ignoreList.x}"> <b>${login}</b> <a target="_blank" href="https://new-combats.com/info/${login}"><img src="https://${c.img}/i/inf_capitalcity.gif" onMouseOver="top.hi(this,\'<b>Инф. о ${login}</b>\',event,5,-2,2,2,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a> <small><a href="javascript:void(0)" onclick="chat.ignorUn(${this.ignoreList.x})">Clear</a></small> </div>`);
} }
return return
}, },
@ -128,7 +128,7 @@ var chat = {
var j = 1; var j = 1;
while (j <= this.ignoreList.x) { while (j <= this.ignoreList.x) {
if (this.ignoreList[this.ignoreList.nms[j]] != undefined) { if (this.ignoreList[this.ignoreList.nms[j]] != undefined) {
date += `<div id="ignr_u_${j}"> <b>${this.ignoreList.nms[j]}</b> <a target="_blank" href="https://new-combats.com/info/${this.ignoreList.nms[j]}"><img src="https://${top.c.img}/i/inf_capitalcity.gif" onMouseOver="top.hi(this,\'<b>Инф. о ${this.ignoreList.nms[j]}</b>\',event,5,-2,2,2,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a> <small><a href="javascript:void(0)" onclick="chat.ignorUn(${j})">Clear</a></small> </div>`; date += `<div id="ignr_u_${j}"> <b>${this.ignoreList.nms[j]}</b> <a target="_blank" href="https://new-combats.com/info/${this.ignoreList.nms[j]}"><img src="https://${c.img}/i/inf_capitalcity.gif" onMouseOver="top.hi(this,\'<b>Инф. о ${this.ignoreList.nms[j]}</b>\',event,5,-2,2,2,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a> <small><a href="javascript:void(0)" onclick="chat.ignorUn(${j})">Clear</a></small> </div>`;
} }
j++; j++;
} }
@ -308,7 +308,7 @@ var chat = {
this.testTimer(true); this.testTimer(true);
}, },
reMoney: function () { reMoney: function () {
$('#moneyGM').html(`${top.c.money} кр.`); $('#moneyGM').html(`${c.money} кр.`);
}, },
testTimer: function (n) { testTimer: function (n) {
clearTimeout(this.t); clearTimeout(this.t);
@ -389,7 +389,7 @@ var chat = {
// тут // тут
function rtData (count) { function rtData (count) {
return rt = `<img height="15" src="https://${top.c.img}/i/align/align${data[count]}.gif">${rt}`; return rt = `<img height="15" src="https://${c.img}/i/align/align${data[count]}.gif">${rt}`;
} }
if(data[4]!=0) if(data[4]!=0)
@ -414,9 +414,9 @@ var chat = {
rt = `<img style="padding-right:3px;" onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'Персонаж сейчас в ${data[6]}\',event,3,1,1,2,\'\')" src="https://${c.img}/i/city_ico/${data[6]}.gif" width="17" height="15">${rt}`; rt = `<img style="padding-right:3px;" onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'Персонаж сейчас в ${data[6]}\',event,3,1,1,2,\'\')" src="https://${c.img}/i/city_ico/${data[6]}.gif" width="17" height="15">${rt}`;
} }
} }
rt += `[${data[2]}]<a href="https://${c.url}/info/${data[0]}" target="_blank"><img style="vertical-align:baseline" width="12" height="11" src="https://${top.c.img}/i/inf_${data[5]}.gif" title="Инф. о ${data[1]}" /></a>`; rt += `[${data[2]}]<a href="https://${c.url}/info/${data[0]}" target="_blank"><img style="vertical-align:baseline" width="12" height="11" src="https://${c.img}/i/inf_${data[5]}.gif" title="Инф. о ${data[1]}" /></a>`;
if (data[11] > top.c.time) { if (data[11] > c.time) {
rt += ` <img id="img_molch${data[1]}" width="24" height="15" style="cursor:help" src="https://${c.img}/i/sleep2.gif" onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'На персонажа наложено заклятие молчания.<br>Будет молчать еще <span id=\\\'molch${data[0]}\\\'>${this.timeOut(data[11])}</span>\',event,3,1,1,2,\'\');chat.justRefMolch(${data[0]})">`; rt += ` <img id="img_molch${data[1]}" width="24" height="15" style="cursor:help" src="https://${c.img}/i/sleep2.gif" onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'На персонажа наложено заклятие молчания.<br>Будет молчать еще <span id=\\\'molch${data[0]}\\\'>${this.timeOut(data[11])}</span>\',event,3,1,1,2,\'\');chat.justRefMolch(${data[0]})">`;
this.addRefMolch(data[0], data[11]); this.addRefMolch(data[0], data[11]);
} }
@ -488,7 +488,7 @@ var chat = {
else { else {
$(`#msg_${id}`).remove(); $(`#msg_${id}`).remove();
$(`#msg_${id}_sys`).remove(); $(`#msg_${id}_sys`).remove();
if (top.c.admin > 0) { if (c.admin > 0) {
await fetch(`online.php?jack=${c.rnd}&cas${((new Date().getTime()) + Math.random())}`, { await fetch(`online.php?jack=${c.rnd}&cas${((new Date().getTime()) + Math.random())}`, {
method: "POST", method: "POST",
delMsg: id delMsg: id
@ -500,7 +500,7 @@ var chat = {
if ($('#textmsg').val() == '') { if ($('#textmsg').val() == '') {
if (confirm('Очистить окно чата?')) { if (confirm('Очистить окно чата?')) {
if (top.des == 1) { if (top.des == 1) {
$(`#canal${top.cb_date[top.cb_select]}`).html(''); $(`#canal${cb_date[cb_select]}`).html('');
$('#textmsg').focus(); $('#textmsg').focus();
return return
} }
@ -564,7 +564,7 @@ var chat = {
else if (data[0] != undefined && top.document.getElementById(`msg_${data[0]}`) == undefined) { else if (data[0] != undefined && top.document.getElementById(`msg_${data[0]}`) == undefined) {
var msg = ''; var msg = '';
if (data[0] != 0) { if (data[0] != 0) {
if (top.c.admin > 0) { if (c.admin > 0) {
if (data[12] == 1) { if (data[12] == 1) {
msg += '<small style="color:red;text-decoration:blink"> <b>un</b>active </small>'; msg += '<small style="color:red;text-decoration:blink"> <b>un</b>active </small>';
} }
@ -588,10 +588,10 @@ var chat = {
while (i != -1) { while (i != -1) {
if (arr[i] != undefined) { if (arr[i] != undefined) {
vl = this.trim(arr[i]); vl = this.trim(arr[i]);
if (vl.toLowerCase() == top.c.login.toLowerCase()) { if (vl.toLowerCase() == c.login.toLowerCase()) {
forYou++; forYou++;
} }
if (vl.toLowerCase() == top.c.login.toLowerCase()) { if (vl.toLowerCase() == c.login.toLowerCase()) {
vl = this.trim(data[3]); vl = this.trim(data[3]);
} }
if (i > 0) { if (i > 0) {
@ -601,7 +601,7 @@ var chat = {
if (data[3] != '') { if (data[3] != '') {
to += `<span style="cursor:pointer" onclick="chat.addto(\'${vl}\',\'private\');" oncontextmenu="top.infoMenu(\'${this.trim(arr[i])}\',event,\'chat\'); return false;">${this.trim(arr[i])}</span>`; to += `<span style="cursor:pointer" onclick="chat.addto(\'${vl}\',\'private\');" oncontextmenu="top.infoMenu(\'${this.trim(arr[i])}\',event,\'chat\'); return false;">${this.trim(arr[i])}</span>`;
if (this.trim(arr[i].toLowerCase()) != top.c.login.toLowerCase()) { if (this.trim(arr[i].toLowerCase()) != c.login.toLowerCase()) {
to2 += this.trim(arr[i]); to2 += this.trim(arr[i]);
} else { } else {
if (data[2] == 2) to2 += this.trim(arr[i]); if (data[2] == 2) to2 += this.trim(arr[i]);
@ -637,7 +637,7 @@ var chat = {
msg += ` <span style="color:${data[6]}">to [${to2}]</span>`; msg += ` <span style="color:${data[6]}">to [${to2}]</span>`;
} }
} else if (data[2] == 3) { } else if (data[2] == 3) {
if (this.trim(data[3].toLowerCase()) == top.c.login.toLowerCase()) { if (this.trim(data[3].toLowerCase()) == c.login.toLowerCase()) {
forYou++; forYou++;
} }
if (data[3] != '') { if (data[3] != '') {
@ -767,7 +767,7 @@ var chat = {
msg = `<font style="cursor:help" color="green" onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'Это глобальное сообщение, оно может быть отправлено из любой локации<br>Отключить отображение подобных сообщений можно в настройках чата.\',event,3,1,1,3,\'\')"> <b>G</b> </font>${msg}`; msg = `<font style="cursor:help" color="green" onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'Это глобальное сообщение, оно может быть отправлено из любой локации<br>Отключить отображение подобных сообщений можно в настройках чата.\',event,3,1,1,3,\'\')"> <b>G</b> </font>${msg}`;
} }
var msg22 = '<span '; var msg22 = '<span ';
if(top.c.admin > 0) { if(c.admin > 0) {
msg22 += `oncontextmenu="chat.deleteMessage(${data[0]}); msg22 += `oncontextmenu="chat.deleteMessage(${data[0]});
return false;" `; return false;" `;
} }
@ -800,13 +800,13 @@ var chat = {
msg = `<span class="m0c1" id="msg_${data[0]}">${msg}<br></span>`; msg = `<span class="m0c1" id="msg_${data[0]}">${msg}<br></span>`;
if (forYou > 0 && this.sound > 0 && this.trim(data[3].toLowerCase()) != top.c.login.toLowerCase()) { if (forYou > 0 && this.sound > 0 && this.trim(data[3].toLowerCase()) != c.login.toLowerCase()) {
this.sendSound(1); this.sendSound(1);
} }
if(msg_see == 1) if(msg_see == 1)
{ {
if(this.trim(data[3].toLowerCase()) == top.c.login.toLowerCase() || forYou == 1 || this.filter == 0) if(this.trim(data[3].toLowerCase()) == c.login.toLowerCase() || forYou == 1 || this.filter == 0)
{ {
if( data[9] > 0 ) this.sendSound(data[9]); if( data[9] > 0 ) this.sendSound(data[9]);
if( data[15] != undefined && data[15] != 0 ) { if( data[15] != undefined && data[15] != 0 ) {
@ -881,9 +881,9 @@ var chat = {
if (j < 3 && this.isNumber(top.sml[smid]) != true && (top.sml[smid] != undefined || imsml[0] == '%usersmile%')) { if (j < 3 && this.isNumber(top.sml[smid]) != true && (top.sml[smid] != undefined || imsml[0] == '%usersmile%')) {
// тут // тут
if (imsml[0] == '%usersmile%') { if (imsml[0] == '%usersmile%') {
txt = txt.replace(`\:%usersmile%-${imsml[1]}\:`, `<img src="https://${top.c.img}/i/smile/${(imsml[1].toLowerCase())}.gif" title="Именной смайлик">`); txt = txt.replace(`\:%usersmile%-${imsml[1]}\:`, `<img src="https://${c.img}/i/smile/${(imsml[1].toLowerCase())}.gif" title="Именной смайлик">`);
} else { } else {
txt = txt.replace(`\:${txr[i]}\:`, `<img src="https://${top.c.img}/i/smile/${(txr[i].toLowerCase())}.gif" style="cursor:pointer" width="${top.sml[smid+1]}" height="${top.sml[smid+2]}" onclick="chat.addSmile(\'${(txr[i].toLowerCase())}\')">`); txt = txt.replace(`\:${txr[i]}\:`, `<img src="https://${c.img}/i/smile/${(txr[i].toLowerCase())}.gif" style="cursor:pointer" width="${top.sml[smid+1]}" height="${top.sml[smid+2]}" onclick="chat.addSmile(\'${(txr[i].toLowerCase())}\')">`);
} }
j++; j++;
} }