Code cleaning.

This commit is contained in:
Igor Barkov (iwork) 2020-06-23 12:13:55 +03:00
parent ad895265e0
commit 6a4dd6d17b
2 changed files with 70 additions and 60 deletions

View File

@ -1076,4 +1076,13 @@ table.allzeroes th, td {
padding: 0; padding: 0;
text-align: left; text-align: left;
vertical-align: top; vertical-align: top;
}
span.success {
font-weight: bold;
color: #008F00;
}
span.error {
font-weight: bold;
color: #8F0000;
} }

121
main.php
View File

@ -842,7 +842,7 @@ if (isset($_GET['del']) && $_GET['del'] == 1 && $_GET['efid'] > 0) {
if (isset($pl['id'])) { if (isset($pl['id'])) {
del_efs($user['id'], $pl['id'], $pl['type']); del_efs($user['id'], $pl['id'], $pl['type']);
} else { } else {
echo '<b style=\'color: Red;\'>Эффект не найден ...</b>'; echo "<span class='error'>Эффект не найден!</span>";
} }
} }
@ -853,7 +853,7 @@ if (isset($_GET['modif_bron'])) {
$cur = mysql_fetch_assoc(mysql_query("SELECT `id`, `free_bron`, `bron1`, `bron2`, `bron3`, `bron4` FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1")); $cur = mysql_fetch_assoc(mysql_query("SELECT `id`, `free_bron`, `bron1`, `bron2`, `bron3`, `bron4` FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1"));
if (isset($cur['id']) && $cur['free_bron'] > 0 && $cur[$brons] > 0) { if (isset($cur['id']) && $cur['free_bron'] > 0 && $cur[$brons] > 0) {
mysql_query("UPDATE `inventory` SET `free_bron` = (`free_bron`-1), `" . $brons . "` = (`" . $brons . "`+1) WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1"); mysql_query("UPDATE `inventory` SET `free_bron` = (`free_bron`-1), `" . $brons . "` = (`" . $brons . "`+1) WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1");
echo "<font color=green><b>Параметр брони увеличен!</b></font>"; echo "<span class='success'>Параметр брони увеличен!</span>";
} }
} }
@ -863,7 +863,7 @@ if (isset($_GET['modif_stat'])) {
$cur = mysql_fetch_assoc(mysql_query("SELECT `id`, `free_stat`, `gsila`, `glovk`, `ginta`, `gintel` FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1")); $cur = mysql_fetch_assoc(mysql_query("SELECT `id`, `free_stat`, `gsila`, `glovk`, `ginta`, `gintel` FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1"));
if (isset($cur['id']) && $cur['free_stat'] > 0 && $cur[$stats] > 0) { if (isset($cur['id']) && $cur['free_stat'] > 0 && $cur[$stats] > 0) {
mysql_query("UPDATE `inventory` SET `free_stat` = (`free_stat`-1), `" . $stats . "` = (`" . $stats . "`+1) WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1"); mysql_query("UPDATE `inventory` SET `free_stat` = (`free_stat`-1), `" . $stats . "` = (`" . $stats . "`+1) WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1");
echo "<font color=green><b>Параметр увеличен!</b></font>"; echo "<span class='success'>Параметр увеличен!</span>";
} }
} }
@ -873,7 +873,7 @@ if (isset($_GET['modif_mf'])) {
$cur = mysql_fetch_assoc(mysql_query("SELECT `id`, `free_mf`, `mfkrit`, `mfakrit`, `mfuvorot`, `mfauvorot` FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1")); $cur = mysql_fetch_assoc(mysql_query("SELECT `id`, `free_mf`, `mfkrit`, `mfakrit`, `mfuvorot`, `mfauvorot` FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1"));
if (isset($cur['id']) && $cur['free_mf'] > 0 && $cur[$mfs] > 0) { if (isset($cur['id']) && $cur['free_mf'] > 0 && $cur[$mfs] > 0) {
mysql_query("UPDATE `inventory` SET `free_mf` = (`free_mf`-1), `" . $mfs . "` = (`" . $mfs . "`+1) WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1"); mysql_query("UPDATE `inventory` SET `free_mf` = (`free_mf`-1), `" . $mfs . "` = (`" . $mfs . "`+1) WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1");
echo "<font color=green><b>Параметр увеличен!</b></font>"; echo "<span class='success'>Параметр увеличен!</span>";
} }
} }
@ -1069,11 +1069,11 @@ if (input::get('edit')) {
$('<div>Название комплекта :<br /><div style="font-size: smaller;"><b>может содеражать только буквы (англ / русс) и цифры.</b></div></div>').append(miDialog._oneInput({name: 'savecomplect'})), {width: 250}); $('<div>Название комплекта :<br /><div style="font-size: smaller;"><b>может содеражать только буквы (англ / русс) и цифры.</b></div></div>').append(miDialog._oneInput({name: 'savecomplect'})), {width: 250});
} }
var Hint3Name = ''; let Hint3Name = '';
function okno(title, script, name, coma, errk) { function okno(title, script, name, coma, errk) {
var errkom = ''; let errkom = '';
var com = ''; let com = '';
if (errk === 1) { if (errk === 1) {
errkom = 'Нельзя использовать символы: /\:*?"<>|+%<br>'; errkom = 'Нельзя использовать символы: /\:*?"<>|+%<br>';
com = coma com = coma
@ -1083,8 +1083,8 @@ if (input::get('edit')) {
com = coma com = coma
} }
document.getElementById("hint3").innerHTML = '<table width=100% cellspacing=1 cellpadding=0 bgcolor=CCC3AA><tr><td align=center><B>' + title + '</td><td width=20 align=right valign=top style="cursor: pointer" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>' + document.getElementById("hint3").innerHTML = '<table width=100% cellspacing=1 cellpadding=0 bgcolor=CCC3AA><tr><td align=center><B>' + title + '</td><td width=20 align=right valign=top style="cursor: pointer" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>' +
'<form action="' + script + '" method=POST><table width=100% cellspacing=0 cellpadding=2 bgcolor=FFF6DD><tr><INPUT TYPE=hidden name=sd4 value="6"><td colspan=2><font color=red>' + '<form action="' + script + '" method=POST><table width=100% cellspacing=0 cellpadding=2 bgcolor=FFF6DD><tr><INPUT TYPE=hidden name=sd4 value="6"><td colspan=2><span class="error">' +
errkom + '</font>введите название предмета</TD></TR><TR><TD width=50% align=right><INPUT TYPE=text NAME="' + name + '" value="' + com + '"></TD><TD width=50%><INPUT TYPE="submit" value=" »» "></TD></TR></TABLE></FORM></td></tr></table>'; errkom + '</span>введите название предмета</TD></TR><TR><TD width=50% align=right><INPUT TYPE=text NAME="' + name + '" value="' + com + '"></TD><TD width=50%><INPUT TYPE="submit" value=" »» "></TD></TR></TABLE></FORM></td></tr></table>';
document.getElementById("hint3").style.visibility = "visible"; document.getElementById("hint3").style.visibility = "visible";
document.getElementById("hint3").style.left = '100'; document.getElementById("hint3").style.left = '100';
document.getElementById("hint3").style.top = '100'; document.getElementById("hint3").style.top = '100';
@ -1092,16 +1092,19 @@ if (input::get('edit')) {
Hint3Name = name; Hint3Name = name;
} }
var delay = 30, TimerOn = -1, tkHP, maxHP, speed = 750, stLen = 185, redHP = 0.33, yellowHP = 0.66; const delay = 30;
let TimerOn = -1, tkHP, maxHP, speed = 750;
const stLen = 185, redHP = 0.33, yellowHP = 0.66;
function setHPlocal() { function setHPlocal() {
tkHP > maxHP && (tkHP = maxHP); tkHP > maxHP && (tkHP = maxHP);
var a = Math.round(tkHP) + "/" + maxHP, a = stLen - (a.length + 2) * 7, var a = Math.round(tkHP) + "/" + maxHP;
b = Math.round((a - 1) / maxHP * tkHP); a = stLen - (a.length + 2) * 7;
var b = Math.round((a - 1) / maxHP * tkHP);
a -= b; a -= b;
HP = document.getElementById("hp_value"); var HP = document.getElementById("hp_value");
HP1 = document.getElementById("HP1"); var HP1 = document.getElementById("HP1");
HP2 = document.getElementById("HP2"); var HP2 = document.getElementById("HP2");
if (HP) { if (HP) {
HP1.width = b, HP2.width = a, HP1.src = tkHP / maxHP < redHP ? "i/1red.gif" : tkHP / maxHP < yellowHP ? "i/1yellow.gif" : "i/1green.gif", HP.innerHTML = Math.round(tkHP) + "/" + maxHP; HP1.width = b, HP2.width = a, HP1.src = tkHP / maxHP < redHP ? "i/1red.gif" : tkHP / maxHP < yellowHP ? "i/1yellow.gif" : "i/1green.gif", HP.innerHTML = Math.round(tkHP) + "/" + maxHP;
} }
@ -1114,7 +1117,7 @@ if (input::get('edit')) {
$(document).ready(function () { $(document).ready(function () {
$('a').live('click', function () { $('a').live('click', function () {
if ($(this).attr('ajax') !== undefined) { if ($(this).attr('ajax') !== undefined) {
var ajaxModule = $(this).attr('ajax'); const ajaxModule = $(this).attr('ajax');
switch (ajaxModule) { switch (ajaxModule) {
case'mZeInventory': case'mZeInventory':
@ -1134,7 +1137,35 @@ if (input::get('edit')) {
}); });
}); });
</script> </script>
<style>
.jGrowl .jGrowl-notification, .jGrowl .jGrowl-closer {
border: 2px groove threedface;
background: #E6E6E6 !important;
}
.jGrowl .jGrowl-notification, .jGrowl div.jGrowl-closer {
margin: 10px;
}
.jGrowl div.jGrowl-notification {
min-height: 40px;
}
.jGrowl .jGrowl-notification, .jGrowl .jGrowl-closer {
background-color: #000;
opacity: .85;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=85)";
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=85);
zoom: 1;
width: 235px;
padding: 10px;
margin-top: 5px;
margin-bottom: 5px;
font-family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 1em;
text-align: left;
display: none;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
</style>
</HEAD> </HEAD>
<body> <body>
<div id=hint3 class=ahint></div> <div id=hint3 class=ahint></div>
@ -1390,39 +1421,6 @@ if (input::get('edit')) {
title="Вернуться"> title="Вернуться">
</div> </div>
<style>
.jGrowl .jGrowl-notification, .jGrowl .jGrowl-closer {
border: 2px groove threedface;
background: #E6E6E6 !important;
}
.jGrowl .jGrowl-notification, .jGrowl div.jGrowl-closer {
margin: 10px;
}
.jGrowl div.jGrowl-notification {
min-height: 40px;
}
.jGrowl .jGrowl-notification, .jGrowl .jGrowl-closer {
background-color: #000;
opacity: .85;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=85)";
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=85);
zoom: 1;
width: 235px;
padding: 10px;
margin-top: 5px;
margin-bottom: 5px;
font-family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 1em;
text-align: left;
display: none;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
</style>
<div id="jGrowl" class="top-right jGrowl"> <div id="jGrowl" class="top-right jGrowl">
<div class="jGrowl-notification"></div> <div class="jGrowl-notification"></div>
</div> </div>
@ -1597,7 +1595,7 @@ if (input::get('edit')) {
}); });
</script> </script>
<script> <script>
var Hint3Name = ''; let Hint3Name = '';
// Заголовок, название скрипта, имя поля с логином // Заголовок, название скрипта, имя поля с логином
function findlogin(title, script, name) { function findlogin(title, script, name) {
@ -1613,10 +1611,10 @@ if (input::get('edit')) {
// Заголовок, название скрипта, имя поля с шмоткой // Заголовок, название скрипта, имя поля с шмоткой
function okno(title, script, name) { function okno(title, script, name) {
var errkom = ''; const errkom = '';
document.getElementById("hint3").innerHTML = '<table width=100% cellspacing=1 cellpadding=0 bgcolor=CCC3AA><tr><td align=center><B>' + title + '</td><td width=20 align=right valign=top style="cursor: pointer" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>' + document.getElementById("hint3").innerHTML = '<table width=100% cellspacing=1 cellpadding=0 bgcolor=CCC3AA><tr><td align=center><B>' + title + '</td><td width=20 align=right valign=top style="cursor: pointer" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>' +
'<form action="' + script + '" method=POST><table width=100% cellspacing=0 cellpadding=2 bgcolor=FFF6DD><tr><INPUT TYPE=hidden name=sd4 value="6"><td colspan=2><font color=red>' + '<form action="' + script + '" method=POST><table width=100% cellspacing=0 cellpadding=2 bgcolor=FFF6DD><tr><INPUT TYPE=hidden name=sd4 value="6"><td colspan=2><span class="error">' +
errkom + '</font>введите название предмета</TD></TR><TR><TD width=50% align=right><INPUT TYPE=text NAME="' + name + '"></TD><TD width=50%><INPUT TYPE="submit" value=" »» "></TD></TR></TABLE></FORM></td></tr></table>'; errkom + '</span>введите название предмета</TD></TR><TR><TD width=50% align=right><INPUT TYPE=text NAME="' + name + '"></TD><TD width=50%><INPUT TYPE="submit" value=" »» "></TD></TR></TABLE></FORM></td></tr></table>';
document.getElementById("hint3").style.visibility = "visible"; document.getElementById("hint3").style.visibility = "visible";
document.getElementById("hint3").style.left = '100'; document.getElementById("hint3").style.left = '100';
document.getElementById("hint3").style.top = '100'; document.getElementById("hint3").style.top = '100';
@ -1629,7 +1627,9 @@ if (input::get('edit')) {
Hint3Name = ''; Hint3Name = '';
} }
var delay = 30, TimerOn = -1, tkHP, maxHP, speed = 750, stLen = 185, redHP = 0.33, yellowHP = 0.66; const delay = 30;
let TimerOn = -1, tkHP, maxHP, speed = 750;
const stLen = 185, redHP = 0.33, yellowHP = 0.66;
function setHP(a, b, c) { function setHP(a, b, c) {
tkHP = a; tkHP = a;
@ -1641,12 +1641,13 @@ if (input::get('edit')) {
function setHPlocal() { function setHPlocal() {
tkHP > maxHP && (tkHP = maxHP); tkHP > maxHP && (tkHP = maxHP);
var a = Math.round(tkHP) + "/" + maxHP, a = stLen - (a.length + 2) * 7, var a = Math.round(tkHP) + "/" + maxHP;
b = Math.round((a - 1) / maxHP * tkHP); a = stLen - (a.length + 2) * 7;
var b = Math.round((a - 1) / maxHP * tkHP);
a -= b; a -= b;
HP = document.getElementById("hp_value"); var HP = document.getElementById("hp_value");
HP1 = document.getElementById("HP1"); var HP1 = document.getElementById("HP1");
HP2 = document.getElementById("HP2"); var HP2 = document.getElementById("HP2");
if (HP) { if (HP) {
HP1.width = b, HP2.width = a, HP1.src = tkHP / maxHP < redHP ? "i/1red.gif" : tkHP / maxHP < yellowHP ? "i/1yellow.gif" : "i/1green.gif", HP.innerHTML = Math.round(tkHP) + "/" + maxHP; HP1.width = b, HP2.width = a, HP1.src = tkHP / maxHP < redHP ? "i/1red.gif" : tkHP / maxHP < yellowHP ? "i/1yellow.gif" : "i/1green.gif", HP.innerHTML = Math.round(tkHP) + "/" + maxHP;
} }