battles/buttons.php
Igor Barkov (iwork) 9c7fcda600 code clean
2021-08-26 19:15:47 +03:00

534 lines
25 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
use Battles\Template;
require_once "functions.php";
$header = $_GET['header'] ?? null;
$ch = $_GET['ch'] ?? null;
if ($header) {
exit;
} elseif ($ch != null) {
Template::header('buttons');
?>
<script src="js/ch.js"></script>
<script src="js/sl2.js"></script>
<script src="js/chat.js"></script>
<style>
a.hoversmile:hover {
background-color: gray;
}
.ssm-smile {
width: 400px;
height: 140px;
background-color: #f2f0f0;
text-align: center;
border: 2px groove black;
opacity: 0.8;
filter: opacity(80);
}
.ssm-smile-body {
padding: 5px;
overflow-y: scroll;
height: 110px;
}
span {
font-size: 10pt;
font-family: Verdana, Arial, Helvetica, Tahoma, sans-serif;
text-decoration: none;
font-weight: bold;
cursor: pointer;
}
.chheadpas, .chheadact {
text-align: center;
}
.chmtext {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
color: #8b8b8b;
font-size: 10px;
text-align: center;
text-decoration: none
}
.chheadpas {
cursor: pointer;
}
.chheadpas.chmtext:hover {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
color: #1b1b1b;
font-size: 10px;
text-align: center;
text-decoration: none;
}
.chmtext:visited {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
color: #1b1b1b;
font-size: 10px;
text-align: center;
text-decoration: none
}
.chheadpas:hover a {
color: #000000;
}
.chheadact:hover a {
color: #8b8b8b;
}
.chheadact a {
color: #000000;
}
.chheadact:hover a {
color: #000000;
}
.chheadact:hover a {
cursor: default;
}
.ssm-smile {
width: 400px;
height: 140px;
background-color: #f2f0f0;
text-align: center;
border: 2px groove black;
opacity: 0.8;
filter: opacity(80);
}
</style>
<script>
function S(name) {
const sData = top.frames['bottom'].window.document;
sData.F1.text.focus();
sData.F1.text.value = sData.F1.text.value + ':' + name + ': ';
}
let currenttab = 1;
const viewmask = [1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
function ctab(n) {
if (n === currenttab) return;
document.getElementById("wtab" + n).style.color = "#1b1b1b";
if (currenttab === 99) {
for (i = 2; i < 16; i++) {
val = document.getElementById("mask" + i).checked;
viewmask[i - 2] = val;
}
}
document.getElementById("ctab" + currenttab).className = "chheadpas";
document.getElementById("ctab" + n).className = "chheadact";
currenttab = n;
RedrawWindow();
}
function RedrawWindow() {
if (currenttab === 1) {
$('#mes').show();
$('#mes_private').hide();
$('#mes_klan').hide();
$('#mes_pal').hide();
$('#mes_trade').hide();
$('#mes_system').hide();
$('#mes_help').hide();
} else if (currenttab === 2) {
$('#mes').hide();
$('#mes_private').show();
$('#mes_klan').hide();
$('#mes_pal').hide();
$('#mes_trade').hide();
$('#mes_system').hide();
$('#mes_help').hide();
} else if (currenttab === 3) {
$('#mes').hide();
$('#mes_private').hide();
$('#mes_klan').show();
$('#mes_pal').hide();
$('#mes_trade').hide();
$('#mes_system').hide();
$('#mes_help').hide();
} else if (currenttab === 4) {
$('#mes').hide();
$('#mes_private').hide();
$('#mes_klan').hide();
$('#mes_pal').show();
$('#mes_trade').hide();
$('#mes_system').hide();
$('#mes_help').hide();
} else if (currenttab === 5) {
$('#mes').hide();
$('#mes_private').hide();
$('#mes_klan').hide();
$('#mes_pal').hide();
$('#mes_trade').hide();
$('#mes_system').show();
$('#mes_help').hide();
} else if (currenttab === 6) {
$('#mes').hide();
$('#mes_private').hide();
$('#mes_klan').hide();
$('#mes_pal').hide();
$('#mes_trade').hide();
$('#mes_system').hide();
$('#mes_help').show();
} else if (currenttab === 8) {
$('#mes').hide();
$('#mes_private').hide();
$('#mes_klan').hide();
$('#mes_pal').hide();
$('#mes_trade').show();
$('#mes_system').hide();
$('#mes_help').hide();
}
top.frames['chat'].window.scrollBy(0, 65000);
top.frames['chat'].window.scrollBy(0, 65000);
}
</script>
<div id="fixednew"
style="position: fixed; margin: -3px; padding: 0; z-index: 999; width: 100%; text-align: center; overflow: auto;">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td height="26">&nbsp;</a></td>
<td nowrap width="26" height="26"></td>
<td nowrap width=115 height="26" id="ctab1" class="chheadact" onclick="ctab(1); return false;">
<a href="#" id="wtab1" class="chmtext">Общий чат</a></td>
<td nowrap width=115 height="26" id="ctab8" class="chheadpas" onclick="ctab(8); return false;">
<a href="#" id="wtab8" onclick="ctab(8); return false;" class="chmtext">Торговый</a></td>
<td nowrap width=115 height="26" id="ctab5" class="chheadpas" onclick="ctab(5); return false;">
<a href="#" id="wtab5" onclick="ctab(5); return false;" class="chmtext">Системные</a>
</td>
<td height="26" width="100%">&nbsp;</a></td>
</tr>
</table>
</div>
<br style="margin: 0; padding: 0;"/><br/>
<div style="margin-top: 10px; margin-left: 3px; margin-bottom: 10px; display: block;" id="mes"></div>
<div style="margin-top: 10px; margin-left: 3px; margin-bottom: 10px; display: none;" id="mes_private"></div>
<div style="margin-top: 10px; margin-left: 3px; margin-bottom: 10px; display: none;" id="mes_klan"></div>
<div style="margin-top: 10px; margin-left: 3px; margin-bottom: 10px; display: none;" id="mes_pal"></div>
<div style="margin-top: 10px; margin-left: 3px; margin-bottom: 10px; display: none;" id="mes_trade"></div>
<div style="margin-top: 10px; margin-left: 3px; margin-bottom: 10px; display: none;" id="mes_system"></div>
<div style="margin-top: 10px; margin-left: 3px; margin-bottom: 10px; display: none;" id="mes_help"></div>
<div id="oMenu" style="position: absolute; border:1px solid #666; background-color:#CCC; display:none; "></div>
<div id="ClearMenu" style="position: absolute; border:1px solid #666; background-color: #e2e0e0; display: none;"></div>
<? } else { Template::header('buttons'); ?>
<script language="JavaScript" src="js/chat.js"></script>
<script language="JavaScript">
top.ChatTranslit = false;
const map_en = ['s`h', 'S`h', 'S`H', 's`Х', 'sh`', 'Sh`', 'SH`', "'o", 'yo', "'O", 'Yo', 'YO', 'zh', 'w', 'Zh', 'ZH', 'W', 'ch', 'Ch', 'CH', 'sh', 'Sh', 'SH', 'e`', 'E`', "'u", 'yu', "'U", 'Yu', "YU", "'a", 'ya', "'A", 'Ya', 'YA', 'a', 'A', 'b', 'B', 'v', 'V', 'g', 'G', 'd', 'D', 'e', 'E', 'z', 'Z', 'i', 'I', 'j', 'J', 'k', 'K', 'l', 'L', 'm', 'M', 'n', 'N', 'o', 'O', 'p', 'P', 'r', 'R', 's', 'S', 't', 'T', 'u', 'U', 'f', 'F', 'h', 'H', 'c', 'C', '`', 'y', 'Y', "'"];
const map_ru = ['сх', 'Сх', 'СХ', 'сХ', 'щ', 'Щ', 'Щ', 'ё', 'ё', 'Ё', 'Ё', 'Ё', 'ж', 'ж', 'Ж', 'Ж', 'Ж', 'ч', 'Ч', 'Ч', 'ш', 'Ш', 'Ш', 'э', 'Э', 'ю', 'ю', 'Ю', 'Ю', 'Ю', 'я', 'я', 'Я', 'Я', 'Я', 'а', 'А', 'б', 'Б', 'в', 'В', 'г', 'Г', 'д', 'Д', 'е', 'Е', 'з', 'З', 'и', 'И', 'й', 'Й', 'к', 'К', 'л', 'Л', 'м', 'М', 'н', 'Н', 'о', 'О', 'п', 'П', 'р', 'Р', 'с', 'С', 'т', 'Т', 'у', 'У', 'ф', 'Ф', 'х', 'Х', 'ц', 'Ц', 'ъ', 'ы', 'Ы', 'ь'];
function convert(str) {
for (let i = 0; i < map_en.length; ++i) while (str.indexOf(map_en[i]) >= 0) str = str.replace(map_en[i], map_ru[i]);
return str;
}
function defPosition2(event) {
const isIE11 = navigator.userAgent.match(/Trident\/7.0.*rv.*11\.0/);
let x = y = 0;
if (document.attachEvent != null || isIE11) {
x = window.event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
y = window.event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
if (window.event.clientY + 10 > document.body.clientHeight) {
y -= 6
} else {
y -= 2
}
} else if (!document.attachEvent && document.addEventListener) {
x = event.clientX + window.scrollX;
y = event.clientY + window.scrollY;
if (event.clientY + 10 > document.body.clientHeight) {
y -= 6
} else {
y -= 2
}
} else {
}
return {x: x, y: y};
}
function trns() {
let strarr;
strarr = document.F1.text.value.split(' ');
for (let k = 0; k < strarr.length; k++) {
if (strarr[k].indexOf("http://") < 0 && strarr[k].indexOf('@') < 0 && strarr[k].indexOf("www.") < 0 && !(strarr[k].charAt(0) == ":" && strarr[k].charAt(strarr[k].length - 1) == ":")) {
if ((k < strarr.length - 1) && (strarr[k] == "to" || strarr[k] == "private") && (strarr[k + 1].charAt(0) == "[")) {
while ((k < strarr.length - 1) && (strarr[k].charAt(strarr[k].length - 1) != "]")) k++;
} else {
strarr[k] = convert(strarr[k])
}
}
}
document.F1.text.value = strarr.join(' ');
}
function sw_filter() {
top.ChatOm = !top.ChatOm;
if (top.ChatOm) {
document.all('b___filter').src = b___filter_on.src;
document.all('b___filter').alt = b___filter_on.alt;
document.F1.om.value = '1';
} else {
document.all('b___filter').src = b___filter_off.src;
document.all('b___filter').alt = b___filter_off.alt;
document.F1.om.value = '';
}
}
function subm() {
t = top.frames['chat'].currenttab;
$('input[name="chtype"]:hidden').val(t);
}
var b___filter_on = new Image;
b___filter_on.src = "i/b___filter_on.gif";
b___filter_on.alt = "(включено) Показывать в чате только сообщения адресованные мне";
var b___filter_off = new Image;
b___filter_off.src = "i/b___filter_off.gif";
b___filter_off.alt = "(выключено) Показывать в чате только сообщения адресованные мне";
function IsIE(elem) {
ss = top.frames['chat'].document.getElementById('mes').offsetHeight;
if (ss > 0 && (ss - 140) > 0) {
ss -= 144;
}
elem.style.position = 'absolute';
elem.style.top = ss + 'px';
}
function smiles() {
if (document.all && document.all.item && !window.opera && !document.layers) {
const x = event.screenX - 150;
const y = event.screenY - 320;
const sFeatures = 'dialogLeft:' + x + 'px;dialogTop:' + y + 'px;dialogHeight:310px;dialogWidth:300px;help:no;status:no;unadorned:yes';
window.showModelessDialog("smiles.html", window, sFeatures);
} else {
const sm = ["horse", 60, 40, "hug", 48, 20, "laugh", 15, 15, "susel", 70, 34, "fingal", 22, 15, "eek", 15, 15, "flowers", 28, 29, "smoke", 20, 20, "hi", 31, 28, "bye", 15, 15,
"king", 21, 22, "king2", 28, 24, "boks2", 28, 21, "boks", 62, 28, "gent", 15, 21, "lady", 15, 19, "tongue", 15, 15, "smil", 16, 16, "rotate", 15, 15,
"ponder", 21, 15, "bow", 15, 21, "smile", 18, 18, "angel", 42, 23, "angel2", 26, 25, "hello", 25, 27, "dont", 26, 26, "idea", 26, 27, "mol", 27, 22, "super", 26, 28,
"beer", 15, 15, "drink", 19, 17, "baby", 15, 18, "tongue2", 15, 15, "sword", 49, 18, "agree", 37, 15, "loveya", 27, 15, "kiss", 15, 15, "kiss2", 15, 15, "kiss3", 15, 15, "kiss4", 37, 15, "rose", 15, 15, "love", 27, 28,
"love2", 55, 24, "inv", 80, 20, "confused", 15, 22, "yes", 15, 15, "no", 15, 15, "shuffle", 15, 20, "nono", 22, 19, "maniac", 70, 25, "privet", 27, 29, "ok", 22, 16, "ninja", 15, 15,
"pif", 46, 26, "smash", 30, 26, "alien", 13, 15, "pirate", 23, 19, "gun", 40, 18, "trup", 20, 20, "mdr", 56, 15, "sneeze", 15, 20, "mad", 15, 15, "friday", 57, 28, "cry", 16, 16, "grust", 15, 15, "rupor", 38, 18,
"fie", 15, 15, "nnn", 82, 16, "row", 36, 15, "red", 15, 15, "lick", 15, 15, "help", 23, 15, "wink", 15, 15, "jeer", 26, 16, "tease", 33, 19, "str", 35, 25, "kruger", 34, 27, "girl", 37, 26, "Knight1", 69, 37, "rev", 40, 25, "smile100", 44, 39, "smile118", 25, 25,
"smile149", 54, 37, "smile166", 46, 29, "smile237", 35, 35, "smile245", 50, 30, "smile28", 33, 34, "smile289", 46, 31, "smile314", 36, 29, "smile36", 50, 46, "smile39", 46, 48,
"smile44", 27, 26, "smile70", 50, 32];
function createMessage(body) {
const container = document.createElement('div');
let i = 0;
body = '';
while (i < sm.length) {
const s = sm[i++];
body += '<a class="hoversmile" href="javascript: void(0);" onClick="SSm(\'' + s + '\')"><IMG SRC=i/smiles/' + s + '.gif WIDTH=' + sm[i++] + ' HEIGHT=' + sm[i++] + ' BORDER=0 ALT="" ></a>';
}
container.innerHTML = '<div id="ssmsmilediv" class="ssm-smile"><div class="ssm-smile-body">' + body + '</div><input class="ssm-smile-ok" type="button" value="Закрыть"/></div>';
return container.firstChild;
}
function positionMessage(elem) {
const ua = navigator.userAgent.toLowerCase();
if (ua.indexOf("msie") != -1 && ua.indexOf("opera") == -1 && ua.indexOf("webtv") == -1) {
IsIE(elem);
} else {
elem.style.position = 'fixed';
elem.style.bottom = 0 + 'px';
}
elem.style.right = 2 + 'px';
}
function addCloseOnClick(messageElem) {
const input = messageElem.getElementsByTagName('INPUT')[0];
input.onclick = function () {
messageElem.parentNode.removeChild(messageElem);
}
}
function setupMessageButton(title, body) {
const messageElem = createMessage(title, body);
positionMessage(messageElem);
addCloseOnClick(messageElem);
top.frames['chat'].document.body.appendChild(messageElem);
}
try {
el = top.frames['chat'].document.getElementById('ssmsmilediv');
el.parentNode.removeChild(el);
} catch (err) {
}
setupMessageButton('Смайлики ;)', '');
}
}
function rslength() { // изменяет размер строки ввода текста
let size = document.body.clientWidth - (2 * 30) - 66 - 256 - 30;
if (size < 100) {
size = 100
}
document.F1.text.width = size;
document.all('T2').width = size;
}
function clearnew(evt) {
if (document.forms[0].text.value == '') {
menu = top.frames['chat'].document.getElementById("ClearMenu");
if (menu.style.display == "none") {
evt = evt || window.event;
evt.cancelBubble = true;
const html = '<p style="margin: 10px;"><input type="button" style="cursor: pointer;" onclick="clearfull();" value="Очистить весь чат" /><br style="margin-top: 5px;"> \
<input type="button" style="font-weight: bold; cursor: pointer;" onclick="clearpanel();" value="Очистить текущую вкладку" /><br style="margin-top: 5px;"> \
<input type="button" style="cursor: pointer;" value="Отменить" onclick="top.frames[\'chat\'].document.getElementById(\'ClearMenu\').style.display=\'none\';" /><br style="margin-top: 5px;"></p> \
';
if (html) {
menu.innerHTML = html;
menu.style.position = 'fixed';
menu.style.bottom = 0 + 'px';
menu.style.left = defPosition2(evt).x + "px";
menu.style.display = "";
}
} else {
menu.style.display = "none";
}
} else {
document.F1.text.value = '';
}
document.F1.text.focus();
}
window.onresize = rslength;
</script>
<form action="ch.php" target="refreshed" method="GET" name="F1" id="F1" onsubmit="subm(); top.NextRefreshChat();">
<input type="hidden" name="color" value="000000"/>
<input type="hidden" name="sys" value=""/>
<input type="hidden" name="om" value=""/>
<input type="hidden" name="lid" value=""/>
<input type="hidden" name="chtype" value="0"/>
<table width="100%" height="30" cellspacing="0" cellpadding="0">
<tr valign="top" style="background: url(i/buttons/beg_chat_03.gif) repeat-x top;">
<td width="9"><img src="i/buttons/bkf_l_r1_02.gif" width="9" height="30"></td>
<td width="30"><IMG SRC="i/buttons/b___.gif" WIDTH=30 HEIGHT=30 BORDER=0 ALT="Чат"></td>
<td valign="middle" id="T2">
<input class="sms_txt" type="text" id="ssmtext" name="text" maxlength="300" size="100"
style="width: 100%;" autocomplete="off" placeholder="Введите текст сообщения"/>
</TD>
<td nowrap id="T3">
<a href="javascript:void(0)" onclick="if(top.ChatTranslit) { trns(); } document.forms[0].submit()" title="Добавить текст в чат">
<IMG SRC="i/buttons/b___ok.gif" ALT="Добавить текст в чат">
</a>
<IMG SRC="i/buttons/1x1.gif" WIDTH="8" HEIGHT="1" BORDER=0 ALT="">
<a href="javascript:void(0)" onclick="clearnew(event);" title="Очистить строку ввода">
<IMG SRC="i/buttons/b___clear.gif" ALT="Очистить строку ввода">
</a>
<a href="javascript:void(0)" onclick="sw_filter();" title="(выключено) Показывать в чате только сообщения адресованные мне">
<IMG SRC="i/buttons/b___filter_off.gif" name="b___filter" ALT="(выключено) Показывать в чате только сообщения адресованные мне">
</a>
<a href="javascript:void(0)" onclick="smiles()" title="Смайлики">
<IMG SRC="i/buttons/1x1.gif" WIDTH="8" HEIGHT="1" BORDER=0 ALT="">
<IMG SRC="i/buttons/b___smile.gif" ALT="Смайлики">
</a>
</td>
<td width="19" id="T4"><img src="i/buttons/b___1.gif" width="16" height="30" alt=""/></td>
</TR>
</TABLE>
<script language="JavaScript">
const user = top.getCookie("ChatColor");
if ((user != null) && (user != "")) document.F1.color.value = user;
function smiles() {
if (document.all && document.all.item && !window.opera && !document.layers) {
const x = event.screenX - 150;
const y = event.screenY - 320;
const sFeatures = 'dialogLeft:' + x + 'px;dialogTop:' + y + 'px;dialogHeight:310px;dialogWidth:300px;help:no;status:no;unadorned:yes';
window.showModelessDialog("smiles.html?", window, sFeatures);
}
else {
const sm = ["horse", 60, 40, "hug", 48, 20, "laugh", 15, 15, "susel", 70, 34, "fingal", 22, 15, "eek", 15, 15, "flowers", 28, 29, "smoke", 20, 20, "hi", 31, 28, "bye", 15, 15,
"king", 21, 22, "king2", 28, 24, "boks2", 28, 21, "boks", 62, 28, "gent", 15, 21, "lady", 15, 19, "tongue", 15, 15, "smil", 16, 16, "rotate", 15, 15,
"ponder", 21, 15, "bow", 15, 21, "smile", 18, 18, "angel", 42, 23, "angel2", 26, 25, "hello", 25, 27, "dont", 26, 26, "idea", 26, 27, "mol", 27, 22, "super", 26, 28,
"beer", 15, 15, "drink", 19, 17, "baby", 15, 18, "tongue2", 15, 15, "sword", 49, 18, "agree", 37, 15, "loveya", 27, 15, "kiss", 15, 15, "kiss2", 15, 15, "kiss3", 15, 15, "kiss4", 37, 15, "rose", 15, 15, "love", 27, 28,
"love2", 55, 24, "inv", 80, 20, "confused", 15, 22, "yes", 15, 15, "no", 15, 15, "shuffle", 15, 20, "nono", 22, 19, "maniac", 70, 25, "privet", 27, 29, "ok", 22, 16, "ninja", 15, 15,
"pif", 46, 26, "smash", 30, 26, "alien", 13, 15, "pirate", 23, 19, "gun", 40, 18, "trup", 20, 20, "mdr", 56, 15, "sneeze", 15, 20, "mad", 15, 15, "friday", 57, 28, "cry", 16, 16, "grust", 15, 15, "rupor", 38, 18,
"fie", 15, 15, "nnn", 82, 16, "row", 36, 15, "red", 15, 15, "lick", 15, 15, "help", 23, 15, "wink", 15, 15, "jeer", 26, 16, "tease", 33, 19, "str", 35, 25, "kruger", 34, 27, "girl", 37, 26, "Knight1", 69, 37, "rev", 40, 25, "smile100", 44, 39, "smile118", 25, 25,
"smile149", 54, 37, "smile166", 46, 29, "smile237", 35, 35, "smile245", 50, 30, "smile28", 33, 34, "smile289", 46, 31, "smile314", 36, 29, "smile36", 50, 46, "smile39", 46, 48,
"smile44", 27, 26, "smile70", 50, 32];
function createMessage(body) {
const container = document.createElement('div');
let i = 0;
body = '';
while (i < sm.length) {
const s = sm[i++];
body += '<a class="hoversmile" href="javascript:void(0)" onClick="SSm(\'' + s + '\')"><IMG SRC=i/smiles/' + s + '.gif WIDTH=' + sm[i++] + ' HEIGHT=' + sm[i++] + ' BORDER=0 ALT="" ></a>';
}
container.innerHTML = '<div id="ssmsmilediv" class="ssm-smile"><div class="ssm-smile-body">' + body + '</div><input class="ssm-smile-ok" type="button" value="Закрыть"/></div>';
return container.firstChild;
}
function positionMessage(elem) {
const ua = navigator.userAgent.toLowerCase();
if (ua.indexOf("msie") != -1 && ua.indexOf("opera") == -1 && ua.indexOf("webtv") == -1) {
IsIE(elem);
}
else {
elem.style.position = 'fixed';
elem.style.bottom = 0 + 'px';
}
elem.style.right = 2 + 'px';
}
function addCloseOnClick(messageElem) {
const input = messageElem.getElementsByTagName('INPUT')[0];
input.onclick = function () {
messageElem.parentNode.removeChild(messageElem);
}
}
function setupMessageButton(title, body) {
const messageElem = createMessage(title, body);
positionMessage(messageElem);
addCloseOnClick(messageElem);
top.frames['chat'].document.body.appendChild(messageElem);
}
try {
el = top.frames['chat'].document.getElementById('ssmsmilediv');
el.parentNode.removeChild(el);
}
catch (err) {
}
setupMessageButton('Смайлики ;)', '');
}
}
</script>
</FORM>
<? } ?>