dev #41

Merged
lopar merged 29 commits from dev into master 2021-05-25 15:28:14 +00:00
2 changed files with 159 additions and 121 deletions
Showing only changes of commit fec3857435 - Show all commits

View File

@ -1,7 +1,8 @@
//------------------------------------------------------------- "use strict"
// Функция для определения координат указателя мыши // Функция для определения координат указателя мыши
function defPosition(event) { function defPosition(event) {
var x = y = 0; let x = 0;
let y = 0;
if (document.attachEvent != null) { // Internet Explorer & Opera if (document.attachEvent != null) { // Internet Explorer & Opera
x = window.event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft); 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); y = window.event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
@ -16,7 +17,6 @@ function defPosition(event) {
return {x:x, y:y}; return {x:x, y:y};
} }
var flagpop=0;
var clip = new ZeroClipboard.Client(); var clip = new ZeroClipboard.Client();
clip.setHandCursor( true ); clip.setHandCursor( true );
clip.setCSSEffects(true); clip.setCSSEffects(true);
@ -30,12 +30,14 @@ var flagpop=0;
* @return {boolean} * @return {boolean}
*/ */
function OpenMenu(evt,level){ function OpenMenu(evt,level){
let flagpop = 0
let login
let menu = document.getElementById("oMenu")
let html;
evt = evt || window.event; evt = evt || window.event;
evt.cancelBubble = true; evt.cancelBubble = true;
// Показываем собственное контекстное меню // Показываем собственное контекстное меню
var menu = document.getElementById("oMenu"); login = (evt.target || evt.srcElement).innerHTML;
var html = "";
login=(evt.target || evt.srcElement).innerHTML;
clip.setText(login); clip.setText(login);
@ -60,8 +62,8 @@ function OpenMenu(evt,level){
menu.style.left = defPosition(evt).x + "px"; menu.style.left = defPosition(evt).x + "px";
menu.style.display = ""; menu.style.display = "";
} }
if (flagpop==0){ if (flagpop === 0){
flagpop=1; flagpop = 1;
clip.glue( 'd_clip_button' ) clip.glue( 'd_clip_button' )
} }
else else

262
js/sl2.js
View File

@ -1,147 +1,183 @@
var Hint3Name = ''; var Hint3Name = '';
step=0; step = 0;
function errmess(s)
{ function errmess(s) {
messid.innerHTML='<B>'+s+'</B>'; messid.innerHTML = '<B>' + s + '</B>';
highlight(); highlight();
}
function highlight()
{
if (step) return(0);
step=10;
setTimeout(dohi,50);
} }
function dohi() function highlight() {
{ if (step) return (0);
var hx=new Array(0,1,2,3,4,5,6,7,8,9,"A","B","C","D","E","F"); step = 10;
setTimeout(dohi, 50);
step--;
messid.style.color="#"+hx[Math.floor(15-step/2)]+((step&1)?"F":"8")+"0000";
if (step>0) setTimeout(dohi,50);
} }
function fixspaces(s) function dohi() {
{ let hx = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, "A", "B", "C", "D", "E", "F"];
while (s.substr(s.length-1,s.length)==" ") s=s.substr(0,s.length-1);
while (s.substr(0,1)==" ") s=s.substr(1,s.length); step--;
return(s); messid.style.color = "#" + hx[Math.floor(15 - step / 2)] + ((step & 1) ? "F" : "8") + "0000";
if (step > 0) setTimeout(dohi, 50);
}
function fixspaces(s) {
while (s.substr(s.length - 1, s.length) == " ") s = s.substr(0, s.length - 1);
while (s.substr(0, 1) == " ") s = s.substr(1, s.length);
return (s);
} }
// Заголовок, название скрипта, имя поля с логином // Заголовок, название скрипта, имя поля с логином
function findlogin(title, script, name, defaultlogin) function findlogin(title, script, name1, defaultlogin) {
{ let hint3 = document.getElementById("hint3");
document.all("hint3").innerHTML = '<table border=0 width=100% cellspacing="1" cellpadding="0" bgcolor="#CCC3AA"><tr><td align=center><B>'+title+'</td><td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>'+ hint3.innerHTML = `
'<table border=0 width=100% cellspacing="0" cellpadding="2" bgcolor="#FFF6DD"><tr><form action="'+script+'" method=POST name=slform><td colspan=2>'+ <table border=0 width=100% cellspacing="1" cellpadding="0" bgcolor="#CCC3AA">
'Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)</TD></TR><TR><TD width=50% align=right><INPUT TYPE="text" NAME="'+name+'" value="'+defaultlogin+'"></TD><TD width=50%><INPUT type=image SRC="/i/b__ok.gif" WIDTH="25" HEIGHT="18" BORDER=0 ALT="" onclick="slform.'+name+'.value=fixspaces(slform.'+name+'.value);"></TD></TR></FORM></TABLE></td></tr></table>'; <tr>
document.all("hint3").style.visibility = "visible"; <td align=center>
document.all("hint3").style.left = 100; <B>${title}
document.all("hint3").style.top = 60; </td>
document.all(name).focus(); <td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();">
Hint3Name = name; <BIG>
<B>x
</td>
</tr>
<tr>
<td colspan=2>
<table border=0 width=100% cellspacing="0" cellpadding="2" bgcolor="#FFF6DD">
<tr>
<form action="${script}" method=POST name=slform>
<td colspan=2>Укажите логин персонажа:
<small>
<BR>(можно щелкнуть по логину в чате)
</TD>
</TR>
<TR>
<TD width=50% align=right>
<INPUT TYPE="text" NAME="${name1}" value="${defaultlogin}">
</TD>
<TD width=50%>
<INPUT type=image SRC="/i/b__ok.gif" WIDTH="25" HEIGHT="18" BORDER=0 ALT="" onclick="${slform.name1.value = fixspaces(slform.name1.value)}">
</TD>
</TR>
</FORM>
</TABLE>
</td>
</tr>
</table>
`;
/*document.all("hint3").innerHTML = '<table border=0 width=100% cellspacing="1" cellpadding="0" bgcolor="#CCC3AA"><tr><td align=center><B>' + title + '</td><td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>' +
'<table border=0 width=100% cellspacing="0" cellpadding="2" bgcolor="#FFF6DD"><tr><form action="' + script + '" method=POST name=slform><td colspan=2>' +
'Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)</TD></TR><TR><TD width=50% align=right><INPUT TYPE="text" NAME="' + name + '" value="' + defaultlogin + '"></TD><TD width=50%><INPUT type=image SRC="/i/b__ok.gif" WIDTH="25" HEIGHT="18" BORDER=0 ALT="" onclick="slform.' + name + '.value=fixspaces(slform.' + name + '.value)"></TD></TR></FORM></TABLE></td></tr></table>';
*/
hint3.style.visibility = "visible";
hint3.style.left = "100";
hint3.style.top = "60";
document.all(name1).focus();
Hint3Name = name1;
} }
// Для магии. Заголовок, название скрипта, название магии, номер вещицы в рюкзаке, логин по умолчанию, описание доп. поля // Для магии. Заголовок, название скрипта, название магии, номер вещицы в рюкзаке, логин по умолчанию, описание доп. поля
function magicklogin(title, script, magickname, n, defaultlogin, extparam) function magicklogin(title, script, magickname, n, defaultlogin, extparam) {
{ var s = '<table border=0 width=100% cellspacing="1" cellpadding="0" bgcolor="#CCC3AA"><tr><td align=center><B>' + title + '</td><td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>' +
var s = '<table border=0 width=100% cellspacing="1" cellpadding="0" bgcolor="#CCC3AA"><tr><td align=center><B>'+title+'</td><td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>'+ '<table border=0 width=100% cellspacing="0" cellpadding="2" bgcolor="#FFF6DD"><tr><form action="' + script + '" method=POST name=slform><input type=hidden name="use" value="' + magickname + '"><input type=hidden name="n" value="' + n + '"><td colspan=2>' +
'<table border=0 width=100% cellspacing="0" cellpadding="2" bgcolor="#FFF6DD"><tr><form action="'+script+'" method=POST name=slform><input type=hidden name="use" value="'+magickname+'"><input type=hidden name="n" value="'+n+'"><td colspan=2>'+ 'Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)</TD></TR><TR><TD width=50% align=right><INPUT TYPE="text" NAME="param" value="' + defaultlogin + '"></TD><TD width=50%><INPUT type=image SRC="/i/b__ok.gif" WIDTH="25" HEIGHT="18" BORDER=0 ALT="" onclick="slform.param.value=fixspaces(slform.param.value);"></TD></TR>';
'Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)</TD></TR><TR><TD width=50% align=right><INPUT TYPE="text" NAME="param" value="'+defaultlogin+'"></TD><TD width=50%><INPUT type=image SRC="/i/b__ok.gif" WIDTH="25" HEIGHT="18" BORDER=0 ALT="" onclick="slform.param.value=fixspaces(slform.param.value);"></TD></TR>'; if (extparam != null && extparam != '') {
if (extparam != null && extparam != '') { s = s + '<TR><td colspan=2>' + extparam + '<BR><INPUT TYPE="text" NAME="param2" size=20></TD></TR>';
s = s + '<TR><td colspan=2>'+extparam+'<BR><INPUT TYPE="text" NAME="param2" size=20></TD></TR>'; }
} s = s + '</FORM></TABLE></td></tr></table>';
s = s + '</FORM></TABLE></td></tr></table>'; document.all("hint3").innerHTML = s;
document.all("hint3").innerHTML = s; document.all("hint3").style.visibility = "visible";
document.all("hint3").style.visibility = "visible"; document.all("hint3").style.left = 100;
document.all("hint3").style.left = 100; document.all("hint3").style.top = document.body.scrollTop + 50;
document.all("hint3").style.top = document.body.scrollTop+50; document.all("param").focus();
document.all("param").focus(); Hint3Name = 'param';
Hint3Name = 'param';
} }
// Магия // Магия
function UseMagick(title, script, name, extparam, n, extparam2) { function UseMagick(title, script, name, extparam, n, extparam2) {
if ((extparam != null)&&(extparam != '')) { if ((extparam != null) && (extparam != '')) {
var t1='text',t2='text'; var t1 = 'text', t2 = 'text';
if (extparam.substr(0,1) == "!") if (extparam.substr(0, 1) == "!") {
{ t1 = 'password';
t1='password'; extparam = extparam.substr(1, extparam.length);
extparam=extparam.substr(1,extparam.length); }
} var s = '<table border=0 width=100% cellspacing="1" cellpadding="0" bgcolor="#CCC3AA"><tr><td align=center><B>' + title + '</td><td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>' +
var s = '<table border=0 width=100% cellspacing="1" cellpadding="0" bgcolor="#CCC3AA"><tr><td align=center><B>'+title+'</td><td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>'+ '<table border=0 width=100% cellspacing="0" cellpadding="2" bgcolor="#FFF6DD"><tr><form action="' + script + '" method=POST name=slform><input type=hidden name="use" value="' + name + '"><input type=hidden name="n" value="' + n + '"><td colspan=2><NOBR><SMALL>' +
'<table border=0 width=100% cellspacing="0" cellpadding="2" bgcolor="#FFF6DD"><tr><form action="'+script+'" method=POST name=slform><input type=hidden name="use" value="'+name+'"><input type=hidden name="n" value="'+n+'"><td colspan=2><NOBR><SMALL>'+ extparam + ':</NOBR></TD></TR><TR><TD width=100% align=left>&nbsp;&nbsp;<INPUT tabindex=1 size=30 TYPE="' + t1 + '" NAME="param" value=""></TD><TD width=10%><INPUT type=image SRC="/i/b__ok.gif" WIDTH="25" HEIGHT="18" BORDER=0 ALT="" tabindex=3></TD></TR>';
extparam + ':</NOBR></TD></TR><TR><TD width=100% align=left>&nbsp;&nbsp;<INPUT tabindex=1 size=30 TYPE="'+t1+'" NAME="param" value=""></TD><TD width=10%><INPUT type=image SRC="/i/b__ok.gif" WIDTH="25" HEIGHT="18" BORDER=0 ALT="" tabindex=3></TD></TR>'; if (extparam2 != null && extparam2 != '') {
if (extparam2 != null && extparam2 != '') { if (extparam2.substr(0, 1) == "!") {
if (extparam2.substr(0,1) == "!") t2 = 'password';
{ extparam2 = extparam2.substr(1, extparam2.length);
t2='password'; }
extparam2=extparam2.substr(1,extparam2.length); s = s + '<TR><td colspan=2><NOBR><SMALL>' + extparam2 + ':</NOBR><TR colspan=2><TD>&nbsp;&nbsp;<INPUT tabindex=2 TYPE="' + t2 + '" NAME="param2" size=30></TD></TR>';
} }
s = s + '<TR><td colspan=2><NOBR><SMALL>'+extparam2+':</NOBR><TR colspan=2><TD>&nbsp;&nbsp;<INPUT tabindex=2 TYPE="'+t2+'" NAME="param2" size=30></TD></TR>'; s = s + '</FORM></TABLE></td></tr></table>';
} document.all("hint3").innerHTML = s;
s = s + '</FORM></TABLE></td></tr></table>'; document.all("hint3").style.visibility = "visible";
document.all("hint3").innerHTML = s; document.all("hint3").style.left = 100;
document.all("hint3").style.visibility = "visible"; document.all("hint3").style.top = document.body.scrollTop + 50;
document.all("hint3").style.left = 100; document.all("param").focus();
document.all("hint3").style.top = document.body.scrollTop+50; Hint3Name = 'param';
document.all("param").focus(); } else {
Hint3Name = 'param'; if (confirm('Использовать сейчас?')) {
} else { location = script + '?use=' + name + '&n=' + n;
if (confirm('Использовать сейчас?')) { location=script+'?use='+name+'&n='+n; } }
} }
} }
// Закрывает окно ввода логина // Закрывает окно ввода логина
function closehint3() function closehint3() {
{ document.all("hint3").style.visibility = "hidden";
document.all("hint3").style.visibility="hidden"; Hint3Name = '';
Hint3Name='';
} }
// Для боевой магии. Заголовок, название магии, номер вещицы в рюкзаке // Для боевой магии. Заголовок, название магии, номер вещицы в рюкзаке
function Bmagicklogin(title, magickname, n) function Bmagicklogin(title, magickname, n) {
{ if (defend == false) {
if (defend==false) errmess("Блок не выбран.");
{ return false;
errmess("Блок не выбран."); }
return false;
}
document.all("hint3").innerHTML = '<table border=0 width=100% cellspacing="1" cellpadding="0" bgcolor="#CCC3AA"><tr><td align=center><B>'+title+'</td><td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>'+ document.all("hint3").innerHTML = '<table border=0 width=100% cellspacing="1" cellpadding="0" bgcolor="#CCC3AA"><tr><td align=center><B>' + title + '</td><td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>' +
'<table border=0 width=100% cellspacing="0" cellpadding="2" bgcolor="#FFF6DD"><tr><form name="bmagic" action="/battle.pl" method=POST onsubmit="bmagic.mdefend.value=defend;"><input type=hidden name="use" value="'+magickname+'"><input type=hidden name="n" value="'+n+'"><input type=hidden name="mdefend" value="'+defend+'"><input type=hidden name="enemy" value="'+enemy+'"><input type=hidden name="myid" value="'+myid+'"><td colspan=2>'+ '<table border=0 width=100% cellspacing="0" cellpadding="2" bgcolor="#FFF6DD"><tr><form name="bmagic" action="/battle.pl" method=POST onsubmit="bmagic.mdefend.value=defend;"><input type=hidden name="use" value="' + magickname + '"><input type=hidden name="n" value="' + n + '"><input type=hidden name="mdefend" value="' + defend + '"><input type=hidden name="enemy" value="' + enemy + '"><input type=hidden name="myid" value="' + myid + '"><td colspan=2>' +
'Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)</TD></TR><TR><TD width=50% align=right><INPUT TYPE="text" NAME="param"></TD><TD width=50%><INPUT type=image SRC="/i/b__ok.gif" WIDTH="25" HEIGHT="18" BORDER=0 ALT="" onclick="bmagic.param.value=fixspaces(bmagic.param.value);"></TD></TR></FORM></TABLE></td></tr></table>'; 'Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)</TD></TR><TR><TD width=50% align=right><INPUT TYPE="text" NAME="param"></TD><TD width=50%><INPUT type=image SRC="/i/b__ok.gif" WIDTH="25" HEIGHT="18" BORDER=0 ALT="" onclick="bmagic.param.value=fixspaces(bmagic.param.value);"></TD></TR></FORM></TABLE></td></tr></table>';
document.all("hint3").style.visibility = "visible"; document.all("hint3").style.visibility = "visible";
document.all("hint3").style.left = 100; document.all("hint3").style.left = 100;
document.all("hint3").style.top = 60; document.all("hint3").style.top = 60;
document.all("param").focus(); document.all("param").focus();
Hint3Name = 'param'; Hint3Name = 'param';
} }
// Магия // Магия
function BUseMagick(name, extparam, n) { function BUseMagick(name, extparam, n) {
if (defend==false) if (defend == false) {
{ errmess("Блок не выбран.");
errmess("Блок не выбран."); return false;
return false; }
}
if ((extparam != null)&&(extparam != '')) { if ((extparam != null) && (extparam != '')) {
var s = prompt(extparam+':', ''); var s = prompt(extparam + ':', '');
if ((s != null)&&(s != '')) { if ((s != null) && (s != '')) {
re = /\%/g; s=s.replace(re, "%25"); re = /\%/g;
re = /\+/g; s=s.replace(re, "%2B"); s = s.replace(re, "%25");
re = /\#/g; s=s.replace(re, "%23"); re = /\+/g;
re = /\?/g; s=s.replace(re, "%3F"); s = s.replace(re, "%2B");
re = /\&/g; s=s.replace(re, "%26"); re = /\#/g;
window.location.href='/battle.pl?use='+name+'&param='+s+'&n='+n+'&mdefend='+defend+'&enemy='+enemy+'&myid='+myid; s = s.replace(re, "%23");
re = /\?/g;
s = s.replace(re, "%3F");
re = /\&/g;
s = s.replace(re, "%26");
window.location.href = '/battle.pl?use=' + name + '&param=' + s + '&n=' + n + '&mdefend=' + defend + '&enemy=' + enemy + '&myid=' + myid;
} }
} else { } else {
if (confirm('Использовать сейчас?')) { location='/battle.pl?use='+name+'&n='+n+'&mdefend='+defend+'&enemy='+enemy+'&myid='+myid;} if (confirm('Использовать сейчас?')) {
} location = '/battle.pl?use=' + name + '&n=' + n + '&mdefend=' + defend + '&enemy=' + enemy + '&myid=' + myid;
}
}
} }