This commit is contained in:
2022-06-07 00:30:34 +03:00
commit 5f4b2cbf77
1784 changed files with 327645 additions and 0 deletions
+4
View File
File diff suppressed because one or more lines are too long
Binary file not shown.
+193
View File
@@ -0,0 +1,193 @@
var stl4 = { 1:0,2:0 };
stl4[1] = { 4:'',5:'',6:'' };
stl4[2] = { 4:'',5:'',6:'' };
function info_reflesh(id_info,uid,up_info,obraz,hp,hpAll,mp,mpAll,invis,sex,eff,ststua,align,zag)
{
stl4[id_info] = { 4:'',5:'',6:'' }; img4 = ''; lst4 = 0;
var d = document.getElementById(`player${id_info}`);
if(d!=undefined)
{
var mbmp = '';
var nomp = 0;
var whp = Math.floor(hp/hpAll*120);
var wmp = Math.floor(mp/mpAll*120);
var chp = 'hp_3';
var cmp = 'hp_mp';
if(whp<1) chp = 'hp_none';
if(whp>0) chp = 'hp_1';
if(whp>32) chp = 'hp_2';
if(whp>65) chp = 'hp_3';
if(wmp<=0) cmp = 'hp_none';
if (mpAll > 0) {
mbmp = ` <div title="Óðîâåíü ìàíû" class="seemp" style="position:absolute; top:10px; width:120px; height:10px; z-index:12;"> ${mp}/${mpAll}</div>
<div title="Óðîâåíü ìàíû" class="hpborder" style="position:absolute; top:10px; width:120px; height:9px; z-index:13;"><img src="https://${top.c.img}/1x1.gif" height="9" width="1"></div>
<div class="${cmp} senohp" style="height:9px; position:absolute; top:10px; width:${wmp}px; z-index:11;" id="lmp4"><img src="https://${top.c.img}/1x1.gif" height="9" width="1"></div>
<div title="Óðîâåíü ìàíû" class="hp_none" style="position:absolute; top:10px; width:120px; height:10px; z-index:10;"></div>`;
} else nomp = 5;
if (align==9){
hp = Math.floor(hp/(hpAll/100));
hpAll = '100%';
}
var zaggg = '',zggg1 = '',zggg2 = '',zggg3,zggg4 = '';
if( zag != undefined && zag != 0 && zag != '' ) {
zggg1 = 'class="inf2s"';
zggg2 = 'position:relative;height:280px;';
zggg3 = 'position:absolute;top:3px;left:3px;z-index:102;';
zggg4 = 'display:none;';
zaggg += '<style> .inf2s { position:relative; filter: alpha(opacity=10); -moz-opacity: 0.10; -khtml-opacity: 0.10; opacity: 0.10; } .inf2s:hover { background-color:#e2e0e0;filter: alpha(opacity=70); -moz-opacity: 0.70; -khtml-opacity: 0.70; opacity: 0.70; } </style>';
zaggg += `<img style="position:absolute;top:1px;left:1px;z-index:100;" src="https://img.new-combats.com/i/zag/${zag}">`;
}
document.getElementById(`player${id_info}_login`).innerHTML = up_info;
d.innerHTML = `<div align="left">
<div style="width:240px; ${zggg2} padding:2px; border-bottom:1px solid #666666; border-right:1px solid #666666; border-left:1px solid #FFFFFF; border-top:1px solid #FFFFFF;">${zaggg}
<div align="center">
<!-- blocked -->
</div>
<table style="${zggg3}" width="240" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="60" valign="top"><table width="60" height="280" border="0" cellspacing="0" cellpadding="0">
<tr>
<td ${zggg1} height="60" id="${id_info}_itmSlot1"><img style="display:block;" title="Ïóñòîé ñëîò øëåì" src="https://${top.c.img}/i/items/w/w9.gif"></td>
</tr>
<tr>
<td ${zggg1} height="40" id="${id_info}_itmSlot2"><img style="display:block;" title="Ïóñòîé ñëîò íàðó÷è" src="https://${top.c.img}/i/items/w/w13.gif"></td>
</tr>
<tr>
<td ${zggg1} height="60" id="${id_info}_itmSlot3"><img style="display:block;" title="Ïóñòîé ñëîò îðóæèå" src="https://${top.c.img}/i/items/w/w3.gif"></td>
</tr>
<tr>
<td ${zggg1} height="80"><div id="${id_info}_itmSlot4"><img style="display:block;" title="Ïóñòîé ñëîò áðîíÿ" src="https://${top.c.img}/i/items/w/w4.gif"></div></td>
</tr>
<tr>
<td ${zggg1} height="40" id="${id_info}_itmSlot7"><img style="display:block;" title="Ïóñòîé ñëîò ïîÿñ" src="https://${top.c.img}/i/items/w/w5.gif"></td>
</tr>
</table></td>
<td height="280" valign="top"><table width="120" height="280" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="20" valign="top"><!-- HP and MP -->
<div style="position:relative;">
<div title="Óðîâåíü æèçíè" class="seehp" style="position:absolute; top:${nomp}px; width:120px; height:10px; z-index:12;"> ${hp}/${hpAll}</div>
<div title="T Óðîâåíü æèçíè" class="hpborder" style="position:absolute; top:${nomp}px; width:120px; height:9px; z-index:13;"><img style="display:block;" src="https://${top.c.img}/1x1.gif" height="9" width="1"></div>
<div class="${chp} senohp" style="height:9px; width:${whp}px; position:absolute; top:${nomp}px; z-index:11;" id="lhp4"><img style="display:block;" src="https://${top.c.img}/1x1.gif" height="9" width="1"></div>
<div title="Óðîâåíü æèçíè" class="hp_none" style="position:absolute; top:${nomp}px; width:120px; height:10px; z-index:10;"><img style="display:block;" src="https://${top.c.img}/1x1.gif" height="10"></div>
${mbmp}
</div>
<!-- -->
</td>
</tr>
<tr>
<td valign="top"><div style="position:relative; height:220px;">
<!-- îáðàç -->
<div style="${zggg4}position:absolute; width:120px; height:220px; z-index:1;" onMouseOver="top.hi(this,\'${ststua}\',event,0,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"><a href="#obraz_pers"><img style="display:block;" width="120" height="220" src="https://${top.c.img}/i/obraz/${sex}/${obraz}" ></a></div>
<div style="position:absolute; width:auto; height:auto; z-index:3;">${eff}</div>
</div></td>
</tr>
<tr>
<td ${zggg1} height="40"><table width="120" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="40" id="${id_info}_itmSlot53" height="20"><img style="display:block;" title="Ïóñòîé ñëîò ïðàâûé êàðìàí" src="https://${top.c.img}/i/items/w/w15.gif"></td>
<td width="40" id="${id_info}_itmSlot55" height="20"><img style="display:block;" title="Ïóñòîé ñëîò öåíòðàëüíûé êàðìàí" src="https://${top.c.img}/i/items/w/w15.gif"></td>
<td width="40" id="${id_info}_itmSlot54" height="20"><img style="display:block;" title="Ïóñòîé ñëîò ëåâûé êàðìàí" src="https://${top.c.img}/i/items/w/w15.gif"></td>
</tr>
<tr>
<td width="40" id="${id_info}_itmSlot56" height="20"><img style="display:block;" title="Ïóñòîé ñëîò ñìåíà" src="https://${top.c.img}/i/items/w/w20.gif"></td>
<td width="40" id="${id_info}_itmSlot57" height="20"><img style="display:block;" title="Ïóñòîé ñëîò ñìåíà" src="https://${top.c.img}/i/items/w/w20.gif"></td>
<td width="40" id="${id_info}_itmSlot58" height="20"><img style="display:block;" title="Ïóñòîé ñëîò ñìåíà" src="https://${top.c.img}/i/items/w/w20.gif"></td>
</tr>
</table></td>
</tr>
</table></td>
<td width="60" valign="top"><table width="60" border="0" cellspacing="0" cellpadding="0">
<tr>
<td ${zggg1} height="20" id="${id_info}_itmSlot8"><img style="display:block;" title="Ïóñòîé ñëîò ñåðüãè" src="https://${top.c.img}/i/items/w/w1.gif"></td>
</tr>
<tr>
<td ${zggg1} height="20" id="${id_info}_itmSlot9"><img style="display:block;" title="Ïóñòîé ñëîò îæåðåëüå" src="https://${top.c.img}/i/items/w/w2.gif"></td>
</tr>
<tr>
<td ${zggg1} height="20"><table width="60" border="0" cellspacing="0" cellpadding="0">
<tr>
<td ${zggg1} width="20" id="${id_info}_itmSlot10" height="20"><img style="display:block;" title="Ïóñòîé ñëîò êîëüöî" src="https://${top.c.img}/i/items/w/w6.gif"></td>
<td ${zggg1} width="20" id="${id_info}_itmSlot11"><img style="display:block;" title="Ïóñòîé ñëîò êîëüöî" src="https://${top.c.img}/i/items/w/w6.gif"></td>
<td ${zggg1} width="20" id="${id_info}_itmSlot12"><img style="display:block;" title="Ïóñòîé ñëîò êîëüöî" src="https://${top.c.img}/i/items/w/w6.gif"></td>
</tr>
</table></td>
</tr>
<tr>
<td ${zggg1} height="40" id="${id_info}_itmSlot13"><img style="display:block;" title="Ïóñòîé ñëîò ïåð÷àòêè" src="https://${top.c.img}/i/items/w/w11.gif"></td>
</tr>
<tr>
<td ${zggg1} height="60" id="${id_info}_itmSlot14"><img style="display:block;" title="Ïóñòîé ñëîò ùèò" src="https://${top.c.img}/i/items/w/w10.gif"></td>
</tr>
<tr>
<td ${zggg1} height="80" id="${id_info}_itmSlot16"><img style="display:block;" title="Ïóñòîé ñëîò ïîíîæè" src="https://${top.c.img}/i/items/w/w19.gif"></td>
</tr>
<tr>
<td ${zggg1} height="40" id="${id_info}_itmSlot17"><img style="display:block;" title="Ïóñòîé ñëîò îáóâü" src="https://${top.c.img}/i/items/w/w12.gif"></td>
</tr>
</table></td>
</tr>
</table>
</div>
</div>`;
}
}
var img4 = '';
var lst4 = 0;
function abitms_work (img, count) {
img4 = img;
lst4 = count;
}
var hr = `<div align=\\\'center\\\' style=\\\'margin:4px;\\\'><img src=\\\'https://${top.c.img}/1x1.gif\\\' height=\\\'1\\\' width=\\\'111\\\' style=\\\'background-color:black;\\\'></div>`;
function abitms(id_pers, uid, id, slot, name, title, img, clck) {
if (slot >= 4 && slot <= 6) {
if (slot == 4 && lst4 == 0) abitms_work(img, 4)
else if (slot == 5 && lst4 < 5) abitms_work(img, 5)
else if (slot == 6 && lst4 < 6) abitms_work(img, 6)
stl4[id_pers][slot] = title;
slot = 4;
var ltt4 = '';
if (stl4[id_pers][6] != '') {
ltt4 += stl4[id_pers][6];
if (stl4[id_pers][4] != '' || stl4[id_pers][5] != '') {
ltt4 += hr;
}
}
if (stl4[id_pers][5] != '') {
ltt4 += stl4[id_pers][5];
if (stl4[id_pers][4] != '') {
ltt4 += hr;
}
}
if (stl4[id_pers][4] != '') {
ltt4 += stl4[id_pers][4];
}
title = ltt4;
img = img4;
}
if (slot == 52) {
if (slot == 52) abitms_work(img, 1)
slot = 1;
ltt4 += stl4[id_pers][4]
title = ltt4;
img = img4;
}
var itm = document.getElementById(`${id_pers}_itmSlot${slot}`);
if (itm != undefined) {
if (clck != undefined && clck != '') {
clck = `cursor:pointer;" onclick="${clck}`;
}
itm.innerHTML = `<img style="display:block;${clck}" src="https://${top.c.img}/i/items/${img}" onMouseOver="top.hi(this,\'${title}\',event,3,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();">`;
}
}
+561
View File
@@ -0,0 +1,561 @@
top.goSit(1);
var zas = new Array();
var priem_use = 0;
var magic_use = 0;
var use_on_pers = 'none';
var smena_login = 'none';
var leader_login = 'none';
var leader_type = 1;
zas[1] = 0;
zas[2] = 0;
zas[3] = 0;
zas[4] = 0;
zas[5] = 0;
var zbs = new Array();
zbs[1] = 0;
var sel_atack = 1;
var nos = 0;
var noconnect = 5;
var connect = 0;
var eatk = 0;
var ggcode = '2014';
var irn = 0;
function magic_div(id, name, img, title) {
}
function testClearZone() {
if (top.slcbrc[4] == 0) {
all_radio_off();
}
}
async function usepriem(id, t, img) {
if (t == 1) {
irn++;
await $.post(`jx/battle/refresh${server_fight}.php?rnd=${ggcode}&irn=${irn}`,{idlog:top.id_log,usepriem:id,useon:use_on_pers},function(data){$("#ref").html(data);});
use_on_pers = 'none'; top.goSit(1);
return
}
return alert('Not found');
}
async function useitem(id, t, use_item_on) {
if (t == 1) {
irn++;
if( top.c.noEr == 0 ) {
top.c.noEr = 1; clearTimeout(top.c.noErTmr); top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000);
await $.post(`jx/battle/refresh${server_fight}.php?rnd=${ggcode}&irn=${irn}`,{idlog:top.id_log,useitem:id,useitemon:use_item_on},function(data){$("#ref").html(data);});
}
return top.goSit(1);
}
return alert('Not found');
}
function volna(id) {
document.getElementById('volna').innerHTML = `Âîëíà: ${id}`;
}
function change_radioKeys(id,cper) {
var z = 0, t = 0, k = 0;
var i = 1, j = 1;
while(i <= za) {
j = 1; jo = 0;
while(j <= 5) {
var radio = document.getElementById(`atack_${i}_${j}`);
if (radio != undefined) {
if (radio.className != null && radio.className == "radio_on") jo++;
}
j++;
}
if (jo == 0 && z == 0) {
z = i;
t = 'atack';
}
i++;
}
if( z == 0 ) {
var i = 1, jo = 0;
while(i <= 5) {
var radio = document.getElementById(`block_1_${i}`);
if(radio != undefined) {
if(radio.className != null && radio.className == "radio_on") jo++;
}
i++;
}
if (jo == 0 && z == 0) {
z = 1;
t = 'block';
}
}
if ((z == 0 || id == 0) && cper == false) {
all_radio_off();
refleshPoints();
}
if(z > 0) {
if(id == 0) {
//àâòîâûñòàâëåíèå
}
else change_radio(z,id,t,1)
}
}
function change_radio(id, zone, type, r) {
radio_off(id, zone, type);
var radio = document.getElementById(`${type}_${id}_${zone}`);
if (radio.className == "radio_on" && r == 0) {
radio.className = "radio_off";
if (type == 'atack') zas[id] = 0;
else zbs[id] = 0;
} else {
radio.className = "radio_on";
if (type == 'atack') zas[id] = zone;
else zbs[id] = zone;
}
refleshPoints();
}
function tactic(id, value) {
document.getElementById(`tac${id}`).innerHTML = value;
}
function refleshPoints() {
clearZone();
var i = 5;
while (i >= 1) {
if (zas[i] == 0) lineAtack(i);
i--;
}
if (zbs[1] == 0) lineBlock();
}
function lineAtack(id) {
nos++;
var j = 1;
while (j <= 5) {
document.getElementById(`zatack${id}_${j}`).className = 'zoneCh_yes';
j++;
}
}
function lineBlock() {
nos++;
var j = 1;
while (j <= 5) {
document.getElementById(`zblock1_${j}`).className = 'zoneCh_yes';
j++;
}
}
function clearZone() {
nos = 0;
var i = 1;
while (i <= 5) {
var j = 1;
while (j <= 5) {
document.getElementById(`zatack${i}_${j}`).className = 'zoneCh_no';
j++;
}
i++;
}
var i = 1;
while (i <= 5) {
document.getElementById(`zblock1_${i}`).className = 'zoneCh_no';
i++;
}
}
function select_atack(id, r) {
var i = 5;
while (i >= 1) {
if (zas[i] == 0) {
if (i <= za) sel_atack = i
}
i--;
}
if (sel_atack > za) sel_atack = 1;
change_radio(sel_atack, id, 'atack', r);
sel_atack++;
}
function radio_off(id, zone, type) {
var i = 1;
while (i <= 5) {
if (document.getElementById(`${type}_${id}_${i}`) != undefined && i != zone) {
document.getElementById(`${type}_${id}_${i}`).className = "radio_off";
if (type == 'atack') zas[id] = 0;
else zbs[id] = 0;
}
i++;
}
}
function all_radio_off() {
var i = 1;
while (i <= 5) {
var j = 1;
while (j <= 5) {
document.getElementById(`atack_${j}_${i}`).className = "radio_off";
j++;
}
document.getElementById(`block_1_${i}`).className = "radio_off";
zas[i] = 0;
i++;
}
zbs[1] = 0;
}
function genZoneBlock() {
var i = 1;
while (i <= 5) {
var j = 1;
while (j <= 3) {
if (j == zb) {
document.getElementById(`txtb${i}_${j}`).style.display = '';
} else {
document.getElementById(`txtb${i}_${j}`).style.display = 'none';
}
j++;
}
i++;
}
}
function genZoneAtack() {
var i = 1;
while (i <= 5) {
var j = 1;
while (j <= 5) {
if (i <= za) {
document.getElementById(`zatack${i}_${j}`).style.display = '';
} else {
document.getElementById(`zatack${i}_${j}`).style.display = 'none';
}
j++;
}
i++;
}
}
// function nocon() {
// if (connect == 0) {
// if (noconnect < 0) {
// //document.getElementById('ref').innerHTML = '<font color=red><b><center>Ïîäîæäèòå, èäåò èíèöèàëèçàöèÿ...</center></b></font>';
// //g_iCount = 45;
// }
// }
// }
function genteam(team) {
document.getElementById('teams').innerHTML = team;
}
var t057 = null;
var battle_end = 0;
async function reflesh(bl) {
irn++;
if (battleFinishData != -1) mainstatus(0);
if ((battle_end == 0 || bl != null) && battleFinishData == -1) {
if (top.c.noEr == 0) {
top.c.noEr = 1;
clearTimeout(top.c.noErTmr);
top.c.noErTmr = setTimeout('top.c.noEr = 0;', 1000);
await $.post(`jx/battle/refresh${server_fight}.php?irn=${irn}&rnd=${ggcode}`, {
id: 'reflesh',
idlog: top.id_log,
idpr: priem_use,
mgid: magic_use,
useon: use_on_pers,
smn: smena_login,
ldrl: leader_login,
ldrt: leader_type
}, function (data) {
$("#ref").html(data);
});
}
if (g_iCount != 45) g_iCount = 45;
}
}
function autobattle() {
var i = 1;
while (i <= za) {
if (zas[i] == 0 || top.slcbrc[4] == 1) {
zas[i] = Math.floor(Math.random(5) * 5 + 1);
change_radio(i, zas[i], 'atack', 1);
}
i++;
}
if (zbs[1] == 0 || top.slcbrc[4] == 1) {
zbs[1] = Math.floor(Math.random(5) * 5 + 1);
change_radio(1, zbs[1], 'block', 1);
}
}
// sleep time expects milliseconds
function sleep(time) {
return new Promise((resolve) => setTimeout(resolve, time));
}
async function atack() {
if (top.slcbrc[3] == 1) autobattle();
var ago = `${zas[1]}_${zas[2]}_${zas[3]}_${zas[4]}_${zas[5]}`;
var bgo = zbs[1];
irn++;
if( top.c.noEr == 0 ) {
top.c.noEr = 1;
clearTimeout(top.c.noErTmr);
top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000);
await $.post(`jx/battle/refresh${server_fight}.php?irn=${irn}&rnd=${ggcode}`,{atack:ago,block:bgo,idlog:top.id_log,idpr:priem_use,mgid:magic_use,useon:use_on_pers,smn:smena_login,ldrl:leader_login,ldrt:leader_type},function(data){$("#ref").html(data);});
}
}
var g_iCount = new Number();
var g_iCount = 45;
var tmr0057 = null;
// 1.1
function startCountdown() {
if (tmr0057 != null) clearTimeout(tmr0057);
if ((g_iCount - 1) >= 0) {
g_iCount -= 1;
return tmr0057 = setTimeout('startCountdown()', 1000);
}
reflesh();
return tmr0057 = setTimeout('startCountdown()', 1000);
}
var img_battle = `<img src='https://${top.c.img}/i/battle/1.jpg'>`;
function mainstatus(id) {
if (smnpty <= 0) {
$('#btn_down_img2').css({'display': 'none'});
} else {
$('#btn_down_img2').css({'display': ''});
$('#btn_down_img2').attr('title', `Ñìåíà ïðîòèâíèêà (${smnpty})`);
}
if (battleFinishData != -1) { // õóé çíàåò ÷å òàêîå
document.getElementById('mainpanel2').style.display = ''; // 4
document.getElementById('go_btn').style.display = 'none'; // 4
document.getElementById('mainpanel').style.display = 'none'; // 4
document.getElementById('mainpanel222').style.display = 'none'; // 4
document.getElementById('reflesh_btn').style.display = 'none'; // 3
document.getElementById('back_menu_down').style.display = ''; // 2
document.getElementById('btn_down_img1').style.display = ''; // 2
document.getElementById('btn_down_img2').style.display = 'none'; // 2
document.getElementById("ref").innerHTML = `<center><font color='red'><b>${battleFinishData}</b></font></center>`;
rand_img();
document.getElementById("player2").innerHTML = `<div style='margin-top:18px;' align='right'>${img_battle}</div>`;
document.getElementById('player2_login').style.display = 'none';
} else if (id == 1) //Ìîæíî óäàðèòü ïðîòèâíèêà ( äîñòóïíûé óäàð )
{
document.getElementById('mainpanel').style.display = ''; // 4
document.getElementById('player2_login').style.display = '';
document.getElementById('mainpanel222').style.display = ''; // 4
document.getElementById('mainpanel2').style.display = 'none'; // 4
document.getElementById('go_btn').style.display = ''; // 4
document.getElementById('btn_down_img1').setAttribute("onclick", "reflesh();");
document.getElementById('go_btn').setAttribute("class", "buttons btnnew btnnew2");
document.getElementById('go_btn').setAttribute("onclick", "atackt();");
if (document.getElementById('reflesh_btn') != undefined) {
document.getElementById('reflesh_btn').style.display = 'none';
}
} else if (id == 2) //Îæèäàåì õîäà ïðîòèâíèêà ( îáíîâèòü )
{
document.getElementById('mainpanel').style.display = 'none'; // 4
document.getElementById('mainpanel222').style.display = 'none'; // 4
document.getElementById('mainpanel2').style.display = ''; // 4
document.getElementById('go_btn').style.display = 'none'; // 4
document.getElementById('reflesh_btn').style.display = ''; // 3
rand_img();
document.getElementById("player2").innerHTML = `<div style='margin-top:18px;' align='right'>${img_battle}</div>`;
document.getElementById('player2_login').style.display = 'none';
document.getElementById('btn_down_img1').setAttribute("onclick", "reflesht();");
document.getElementById('reflesh_btn').setAttribute("class", "buttons btnnew btnnew2");
document.getElementById('reflesh_btn').setAttribute("onclick", "reflesht();");
} else if (id == 3) // Ïðîèãðàëè. Îæèäàåì çàâåðøåíèÿ ïîåäèíêà ( êíîïêà âåðíóòñÿ ñ ïîåäèíêà )
{
document.getElementById('mainpanel2').style.display = ''; // 4
document.getElementById('go_btn').style.display = 'none'; // 4
document.getElementById('mainpanel').style.display = 'none'; // 4
document.getElementById('mainpanel222').style.display = 'none'; // 4
document.getElementById('back_menu_down').style.display = 'none'; // 2
document.getElementById('reflesh_btn').style.display = ''; // 3
document.getElementById('reflesh_btn').setAttribute("class", "buttons inpBtl btnnew");
//
document.getElementById('btn_down_img1').setAttribute("onclick", "reflesh();");
document.getElementById('btn_down_img1').style.display = ''; // 2
document.getElementById('btn_down_img2').style.display = 'none'; // 2
document.getElementById("ref").innerHTML = "<font color='red'><b>Âû ïîâåðæåíû. Îæèäàéòå ïîêà ïîåäèíîê çàâåðøàò äðóãèå áîéöû...</b></font>";
document.getElementById("player2").innerHTML = `<div style='margin-top:18px;' align='right'>${img_battle}</div>`;
document.getElementById('player2_login').style.display = 'none';
}
if (document.getElementById('mainpanel').style.display == '') {
document.getElementById('mainpanel2').style.display = 'none';
}
top.goSit(1);
}
function rand_img() {
if (level < 4) {
img_battle = `<img src='https://img.new-combats.com/i/battle/${(Math.floor(Math.random(2) * 2))}.gif'>`;
return
}
img_battle = `<img src='https://img.new-combats.com/i/battle/${(Math.floor(Math.random(29) * 29))}.jpg'>`;
}
var fstlh = 0;
var lsti = 0;
var lsthd = new Array();
var id_log_ar = new Array();
var id_log;
var type_log = top.type_log;
function add_log(id, foryou, text, hod_id, my, last_hod, vars) {
if (top.des == 1) type_log = 0
else type_log = 1;
if (type_log == 1) {
chsee = 'chsee2';
if (my == 1) chsee = 'chsee3'
//if(id_log_ar[id]!=id)
//{
text = looklogrep(text, vars);
id_log_ar[id] = id;
id_log = id;
// if (top.frames['main'].document.getElementById("battle_log_" + hod_id + "") == undefined && hod_id != 1) {
if (!top.frames['main'].document.getElementById(`battle_log_${hod_id}`) && hod_id != 1) {
if (fstlh == 0) fstlh = hod_id
lsthd[lsti] = hod_id;
lsti++;
$(top.frames['main'].document.getElementById('battle_logg')).prepend(`<div style="padding-top:2px;padding-bottom:2px;" id="battle_log_'${hod_id}" class="battle_hod_style"></div>`);
} else if (!top.frames['main'].document.getElementById(`battle_log_${hod_id}`)) {
top.frames['main'].document.getElementById('battle_logg').innerHTML = top.frames['main'].document.getElementById('battle_logg').innerHTML + `<div style="padding-top:2px;padding-bottom:2px;" id="battle_log_${hod_id}"></div>`;
}
if (!top.frames['main'].document.getElementById(`log_id_${id}`)) {
$(top.frames['main'].document.getElementById(`battle_log_${hod_id}`)).prepend(`<span id="log_id_${id}" class="foryou${foryou}">${text}</span><br>`);
}
//}
if (top.frames['main'].document.getElementById(`battle_log_${hod_id - 25}`) != undefined) {
top.rmve(`#battle_log_${hod_id - 25}`);
}
return
}
chsee = 'chsee2';
if (my == 1) chsee = 'chsee3'
text = looklogrep(text, vars);
id_log_ar[id] = id;
id_log = id;
if (!top.document.getElementById(`battle_log_${hod_id}`) && hod_id != 1) {
if (fstlh == 0) {
fstlh = hod_id;
}
lsthd[lsti] = hod_id;
lsti++;
$(top.document.getElementById('battle_logg')).prepend(`<div style="padding-top:2px;padding-bottom:2px;" id="battle_log_${hod_id}" tabindex="${0 - hod_id}" class="battle_hod_style"></div>`);
} else if (top.document.getElementById("battle_log_" + hod_id + "") == undefined) {
top.document.getElementById('battle_logg').innerHTML = top.document.getElementById('battle_logg').innerHTML + `<div style="padding-top:2px;padding-bottom:2px;" id="battle_log_${hod_id}"></div>`;
}
if (!top.document.getElementById(`log_id_${id}`)) {
$(top.document.getElementById(`battle_log_${hod_id}`)).prepend(`<span id="log_id_${id}" class="foryou${foryou}">${text}</span><br>`);
}
if (top.document.getElementById(`battle_log_${hod_id - 7}`) != undefined) {
top.rmve(`#battle_log_${hod_id - 7}`);
}
}
//-- Ìîé ëîã--------------------------------
//-------------------------------------------
function add_mlog(id, foryou, text, hod_id, my, last_hod, vars) {
chsee = 'chsee7';
text = looklogrep(text, vars);
id_log_ar[id] = id;
id_log = id;
if (!top.document.getElementById(`battle_mlog_${hod_id}`) && hod_id != 1) {
$(top.document.getElementById('battle_mlogg')).prepend(`<div style="padding-top:2px;padding-bottom:2px;" id="battle_mlog_${hod_id}" tabindex="${0-hod_id}" class="battle_hod_style"></div>`);
} else if (!top.document.getElementById(`battle_mlog_${hod_id}`)) {
top.document.getElementById('battle_mlogg').innerHTML = top.document.getElementById('battle_mlogg').innerHTML + `<div style="padding-top:2px;padding-bottom:2px;" id="battle_mlog_${hod_id}"></div>`;
}
if (!top.document.getElementById(`mlog_id_${id}`)) {
$(top.document.getElementById(`battle_mlog_${hod_id}`)).prepend(`<span id="mlog_id_${id}" class="foryou${foryou}">${text}</span><br>`);
}
if (top.document.getElementById(`battle_mlog_${hod_id-14}`) != undefined) {
top.rmve(`#battle_mlog_${hod_id-14}`);
}
}
//-------------------------------------------
var moveState = false;
// Ïåðåìåííûå êîîðäèíàò ìûøè â íà÷àëå ïåðåìåùåíèÿ, ïîêà íåèçâåñòíû
var x0, y0;
// Íà÷àëüíûå êîîðäèíàòû ýëåìåíòà, ïîêà íåèçâåñòíû
var divX0, divY0;
function defPosition(event) {
var x = y = 0;
if (document.attachEvent != null) { // Internet Explorer & Opera
x = window.event.clientX + documentElement.scrollLeft + document.body.scrollLeft;
y = window.event.clientY + documentElement.scrollTop + document.body.scrollTop;
}
if (!document.attachEvent && document.addEventListener) { // Gecko
x = event.clientX + window.scrollX;
y = event.clientY + window.scrollY;
}
return {x:x, y:y};
}
function initMove(div, event) {
var event = event || window.event;
x0 = defPosition(event).x;
y0 = defPosition(event).y;
divX0 = parseInt(div.style.left);
divY0 = parseInt(div.style.top);
moveState = true;
}
document.onmouseup = function() {
moveState = false;
}
// È ïîñëåäíåå
// Ôóíêöèÿ îáðàáîòêè äâèæåíèÿ:
function moveHandler(div, event) {
var event = event || window.event;
if (moveState) {
div.style.left = divX0 + defPosition(event).x - x0;
div.style.top = divY0 + defPosition(event).y - y0;
}
}
function usePriem(id) {
priem_use = id;
if (id != 0) reflesh()
}
//document.onkeydown=key;
function key() {
//window.status=event.keyCode;
//if(event.keyCode==13){ atack(); }
}
+652
View File
@@ -0,0 +1,652 @@
top.goSit(1);
var zas = new Array();
var priem_use = 0;
var magic_use = 0;
var use_on_pers = 'none';
var smena_login = 'none';
var leader_login = 'none';
var leader_type = 1;
zas[1] = 0;
zas[2] = 0;
zas[3] = 0;
zas[4] = 0;
zas[5] = 0;
var zbs = new Array();
zbs[1] = 0;
var sel_atack = 1;
var nos = 0;
var noconnect = 5;
var connect = 0;
var eatk = 0;
var ggcode = '2014';
var irn = 0;
function magic_div(id,name,img,title)
{
}
function testClearZone()
{
if(top.slcbrc[4] == 0) {
all_radio_off();
}
}
function usepriem(id,t,img)
{
if(t==1)
{
irn++;
if( top.c.noEr == 0 ) {
top.c.noEr = 1; clearTimeout(top.c.noErTmr); /*top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000);*/
$.post("jx/battle/refresh" + server_fight + ".php?rnd="+ggcode+"&irn="+irn,{idlog:top.id_log,usepriem:id,useon:use_on_pers},function(data){$("#ref").html(data);});
}
use_on_pers = 'none'; top.goSit(1);
}else{
alert('Not found');
}
}
function useitem(id,t,use_item_on)
{
if(t==1)
{
irn++;
if( top.c.noEr == 0 ) {
top.c.noEr = 1; clearTimeout(top.c.noErTmr); /*top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000);*/
$.post("jx/battle/refresh" + server_fight + ".php?rnd="+ggcode+"&irn="+irn,{idlog:top.id_log,useitem:id,useitemon:use_item_on},function(data){$("#ref").html(data);});
}
top.goSit(1);
}else{
alert('Not found');
}
}
function volna(id)
{
document.getElementById('volna').innerHTML = 'Âîëíà: '+id;
}
function change_radioKeys(id,cper) {
var z = 0, t = 0, k = 0;
var i = 1, j = 1;
while(i <= za) {
j = 1; jo = 0;
while(j <= 5) {
var radio = document.getElementById('atack_'+i+'_'+j);
if(radio != undefined) {
if(radio.className != null && radio.className == "radio_on") {
jo++;
}
}
j++;
}
if(jo == 0 && z == 0) {
z = i;
t = 'atack';
}
i++;
}
if( z == 0 ) {
var i = 1, jo = 0;
while(i <= 5) {
var radio = document.getElementById('block_1_'+i);
if(radio != undefined) {
if(radio.className != null && radio.className == "radio_on") {
jo++;
}
}
i++;
}
if(jo == 0 && z == 0) {
z = 1;
t = 'block';
}
}
if( ( z == 0 || id == 0 ) && cper == false) {
all_radio_off();
refleshPoints();
//change_radioKeys(id,true);
}
if(z > 0) {
if(id == 0) {
//àâòîâûñòàâëåíèå
}else{
change_radio(z,id,t,1);
}
}
}
function change_radio(id,zone,type,r)
{
radio_off(id,zone,type);
var radio = document.getElementById(type+'_'+id+'_'+zone);
if(radio.className == "radio_on" && r==0)
{
radio.className = "radio_off";
if(type=='atack')
{
zas[id] = 0;
}else{
zbs[id] = 0;
}
}else{
radio.className = "radio_on";
if(type=='atack')
{
zas[id] = zone;
}else{
zbs[id] = zone;
}
}
refleshPoints();
}
function tactic(id,value)
{
document.getElementById('tac'+id).innerHTML = value;
}
function refleshPoints()
{
clearZone();
var i = 5;
while(i>=1)
{
if(zas[i]==0)
{
lineAtack(i);
}
i--;
}
if(zbs[1]==0)
{
lineBlock();
}
}
function lineAtack(id)
{
nos++;
var j = 1;
while(j<=5)
{
document.getElementById('zatack'+id+'_'+j+'').className='zoneCh_yes';
j++;
}
}
function lineBlock()
{
nos++;
var j = 1;
while(j<=5)
{
document.getElementById('zblock1_'+j+'').className='zoneCh_yes';
j++;
}
}
function clearZone()
{
nos = 0;
var i = 1;
while(i<=5)
{
var j = 1;
while(j<=5)
{
document.getElementById('zatack'+i+'_'+j+'').className='zoneCh_no';
j++;
}
i++;
}
var i = 1;
while(i<=5)
{
document.getElementById('zblock1_'+i+'').className='zoneCh_no';
i++;
}
}
function select_atack(id,r)
{
var i = 5;
while(i>=1)
{
if(zas[i]==0)
{
if(i<=za)
{
sel_atack = i;
}
}
i--;
}
if(sel_atack>za)
{
sel_atack = 1;
}
change_radio(sel_atack,id,'atack',r);
sel_atack++;
}
function radio_off(id,zone,type)
{
var i = 1;
while(i<=5)
{
if(document.getElementById(type+'_'+id+'_'+i)!=undefined && i!=zone)
{
document.getElementById(type+'_'+id+'_'+i).className = "radio_off";
if(type=='atack')
{
zas[id] = 0;
}else{
zbs[id] = 0;
}
}
i++;
}
}
function all_radio_off()
{
var i = 1;
while(i<=5)
{
var j = 1;
while(j<=5)
{
document.getElementById('atack_'+j+'_'+i).className = "radio_off";
j++;
}
document.getElementById('block_1_'+i).className = "radio_off";
zas[i] = 0;
i++;
}
zbs[1] = 0;
}
function genZoneBlock()
{
var i = 1;
while(i<=5)
{
var j = 1;
while(j<=3)
{
if(j==zb)
{
document.getElementById('txtb'+i+'_'+j+'').style.display = '';
}else{
document.getElementById('txtb'+i+'_'+j+'').style.display = 'none';
}
j++;
}
i++;
}
}
function genZoneAtack()
{
var i = 1;
while(i<=5)
{
var j = 1;
while(j<=5)
{
if(i<=za)
{
document.getElementById('zatack'+i+'_'+j+'').style.display = '';
} else {
document.getElementById('zatack'+i+'_'+j+'').style.display = 'none';
}
j++;
}
i++;
}
}
function nocon()
{
if(connect==0)
{
if(noconnect<0)
{
//document.getElementById('ref').innerHTML = '<font color=red><b><center>Ïîäîæäèòå, èäåò èíèöèàëèçàöèÿ...</center></b></font>';
//g_iCount = 45;
}
//noconnect--;
//setTimeout('nocon()',15000);
}
}
function genteam(team)
{
document.getElementById('teams').innerHTML = team;
}
var t057 = null;
var battle_end = 0;
function reflesh(bl)
{
irn++;
if(document.getElementById('reflesh_btn').style.display =='')
{
document.getElementById('reflesh_btn').setAttribute("disabled", "disabled");
}
sleep(500).then(() => {
if( battleFinishData != -1 ) {
mainstatus(0);
}
if( ( battle_end==0 || bl!=null ) && battleFinishData == -1 )
{
//$('#pers_magic').html(battle_end+'|'+ggcode);
//noconnect = 5; connect = 0;
if( top.c.noEr == 0 ) {
top.c.noEr = 1; clearTimeout(top.c.noErTmr); /*top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000);*/
$.post("jx/battle/refresh" + server_fight + ".php?irn="+irn+"&rnd="+ggcode,{id:'reflesh',idlog:top.id_log,idpr:priem_use,mgid:magic_use,useon:use_on_pers,smn:smena_login,ldrl:leader_login,ldrt:leader_type},function(data){$("#ref").html(data);});
}
if(g_iCount!=45)
{
g_iCount = 45;
}
if(document.getElementById('reflesh_btn')!=undefined)
{
}
}
document.getElementById('reflesh_btn').removeAttribute("disabled");
});
}
function autobattle()
{
var i = 1;
while (i<=za)
{
if(zas[i] == 0 || top.slcbrc[4] == 1 ) {
zas[i] = Math.floor(Math.random(5)*5+1);
change_radio(i,zas[i],'atack',1);
}
i++;
}
if(zbs[1] == 0 || top.slcbrc[4] == 1 ) {
zbs[1] = Math.floor(Math.random(5)*5+1);
change_radio(1,zbs[1],'block',1);
}
}
// sleep time expects milliseconds
function sleep (time) {
return new Promise((resolve) => setTimeout(resolve, time));
}
function atack()
{
if(top.slcbrc[3]==1)
{
autobattle();
}
var ago = ""+zas[1]+"_"+zas[2]+"_"+zas[3]+"_"+zas[4]+"_"+zas[5]+"";
var bgo = zbs[1];
if(eatk==0)
{
mainstatus(2);
}
irn++;
if( top.c.noEr == 0 ) {
top.c.noEr = 1;
clearTimeout(top.c.noErTmr);
//top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000);
//sleep(500).then(() => {
$.post("jx/battle/refresh" + server_fight + ".php?irn="+irn+"&rnd="+ggcode,{atack:ago,block:bgo,idlog:top.id_log,idpr:priem_use,mgid:magic_use,useon:use_on_pers,smn:smena_login,ldrl:leader_login,ldrt:leader_type},function(data){$("#ref").html(data);});
mainstatus(2);
//});
}
}
var g_iCount = new Number();
var g_iCount = 45;
var tmr0057 = null;
function startCountdown()
{
if(tmr0057 != null)
{
clearTimeout(tmr0057);
}
if((g_iCount - 1) >= 0)
{
g_iCount = g_iCount - 1;
tmr0057 = setTimeout('startCountdown()',1000);
}else{
reflesh();
tmr0057 = setTimeout('startCountdown()',1000);
}
}
var img_battle = "<img src='https://"+top.c.img+"/i/battle/1.jpg'>";
function mainstatus(id)
{
if(smnpty <= 0) {
$('#btn_down_img2').css({'display':'none'});
}else{
$('#btn_down_img2').css({'display':''});
$('#btn_down_img2').attr('title','Ñìåíà ïðîòèâíèêà ('+smnpty+')');
}
if( battleFinishData != -1 ) {
document.getElementById('mainpanel2').style.display = '';
document.getElementById('go_btn').style.display = 'none';
document.getElementById('mainpanel').style.display = 'none';
document.getElementById('mainpanel222').style.display = 'none';
document.getElementById('reflesh_btn').style.display = 'none';
document.getElementById('back_menu_down').style.display = '';
document.getElementById('btn_down_img1').style.display = '';
document.getElementById('btn_down_img2').style.display = 'none';
document.getElementById("ref").innerHTML = "<center><font color='red'><b>" + battleFinishData + "</b></font></center>";
rand_img();
document.getElementById("player2").innerHTML = "<div style='margin-top:18px;' align='right'>"+img_battle+"</div>";
document.getElementById('player2_login').style.display = 'none';
}else if(id==1) //Ìîæíî óäàðèòü ïðîòèâíèêà
{
document.getElementById('mainpanel').style.display = '';
document.getElementById('player2_login').style.display = '';
document.getElementById('mainpanel222').style.display = '';
document.getElementById('mainpanel2').style.display = 'none';
document.getElementById('go_btn').style.display = '';
if(document.getElementById('reflesh_btn')!=undefined)
{
document.getElementById('reflesh_btn').style.display = 'none';
}
}else if(id==2) //Îæèäàåì õîäà ïðîòèâíèêà
{
document.getElementById('mainpanel').style.display = 'none';
document.getElementById('mainpanel222').style.display = 'none';
document.getElementById('mainpanel2').style.display = '';
document.getElementById('go_btn').style.display = 'none';
document.getElementById('reflesh_btn').style.display = '';
rand_img();
document.getElementById("player2").innerHTML = "<div style='margin-top:18px;' align='right'>"+img_battle+"</div>";
document.getElementById('player2_login').style.display = 'none';
}else if(id==3) // Ïðîèãðàëè. Îæèäàåì çàâåðøåíèÿ ïîåäèíêà
{
document.getElementById('mainpanel2').style.display = '';
document.getElementById('go_btn').style.display = 'none';
document.getElementById('mainpanel').style.display = 'none';
document.getElementById('mainpanel222').style.display = 'none';
//document.getElementById('reflesh_btn').style.display = 'none';
//document.getElementById('back_menu_down').style.display = '';
//
document.getElementById('back_menu_down').style.display = 'none';
document.getElementById('reflesh_btn').style.display = '';
//
document.getElementById('btn_down_img1').style.display = '';
document.getElementById('btn_down_img2').style.display = 'none';
document.getElementById("ref").innerHTML = "<font color='red'><b>Âû ïîâåðæåíû. Îæèäàéòå ïîêà ïîåäèíîê çàâåðøàò äðóãèå áîéöû...</b></font>";
//rand_img();
document.getElementById("player2").innerHTML = "<div style='margin-top:18px;' align='right'>"+img_battle+"</div>";
document.getElementById('player2_login').style.display = 'none';
}
if(document.getElementById('mainpanel').style.display == '') {
document.getElementById('mainpanel2').style.display = 'none';
}
top.goSit(1);
}
function rand_img()
{
if(level<4)
{
img_battle = "<img src='https://img.new-combats.com/i/battle/"+(Math.floor(Math.random(2)*2))+".gif'>";
} else {
img_battle = "<img src='https://img.new-combats.com/"+(Math.floor(Math.random(29)*29))+".jpg'>";
}
}
var fstlh = 0;
var lsti = 0;
var lsthd = new Array();
var id_log_ar = new Array();
var id_log;
var type_log = top.type_log;
function add_log(id,foryou,text,hod_id,my,last_hod,vars)
{
if( top.des == 1 ) {
type_log = 0;
}else{
type_log = 1;
}
if( type_log == 1 ) {
chsee = 'chsee2';
if(my==1)
{
chsee = 'chsee3';
}
//if(id_log_ar[id]!=id)
//{
text = looklogrep(text,vars);
id_log_ar[id] = id;
id_log = id;
if(top.frames['main'].document.getElementById("battle_log_"+hod_id+"")==undefined && hod_id!=1)
{
if(fstlh==0)
{
fstlh = hod_id;
}
lsthd[lsti] = hod_id; lsti++;
top.frames['main'].document.getElementById('battle_logg').innerHTML = top.frames['main'].document.getElementById('battle_logg').innerHTML+'<div style="padding-top:2px;padding-bottom:2px;" id="battle_log_'+hod_id+'" class="battle_hod_style"></div>';
} else if (top.frames['main'].document.getElementById("battle_log_"+hod_id+"")==undefined)
{
top.frames['main'].document.getElementById('battle_logg').innerHTML = top.frames['main'].document.getElementById('battle_logg').innerHTML+'<div style="padding-top:2px;padding-bottom:2px;" id="battle_log_'+hod_id+'"></div>';
}
top.frames['main'].document.getElementById("battle_log_"+hod_id+"").innerHTML = top.frames['main'].document.getElementById("battle_log_"+hod_id+"").innerHTML+'<span id="log_id_'+id+'" class="foryou'+foryou+'">'+text+'</span><br>';
//}
if(top.frames['main'].document.getElementById("battle_log_"+(hod_id-5))!=undefined)
{
//top.rmve('#battle_log_'+(hod_id-10));
}
}else{
chsee = 'chsee2';
if(my==1)
{
chsee = 'chsee3';
}
//if(id_log_ar[id]!=id)
//{
text = looklogrep(text,vars);
id_log_ar[id] = id;
id_log = id;
if(top.document.getElementById("battle_log_"+hod_id+"")==undefined && hod_id!=1)
{
if(fstlh==0)
{
fstlh = hod_id;
}
lsthd[lsti] = hod_id; lsti++;
top.document.getElementById('battle_logg').innerHTML = top.document.getElementById('battle_logg').innerHTML+'<div style="padding-top:2px;padding-bottom:2px;" id="battle_log_'+hod_id+'" class="battle_hod_style"></div>';
} else if (top.document.getElementById("battle_log_"+hod_id+"")==undefined)
{
top.document.getElementById('battle_logg').innerHTML = top.document.getElementById('battle_logg').innerHTML+'<div style="padding-top:2px;padding-bottom:2px;" id="battle_log_'+hod_id+'"></div>';
}
top.document.getElementById("battle_log_"+hod_id+"").innerHTML = top.document.getElementById("battle_log_"+hod_id+"").innerHTML+'<span id="log_id_'+id+'" class="foryou'+foryou+'">'+text+'</span><br>';
//}
if(top.document.getElementById("battle_log_"+(hod_id-5))!=undefined)
{
//top.rmve('#battle_log_'+(hod_id-10));
}
}
}
var moveState = false;
// Ïåðåìåííûå êîîðäèíàò ìûøè â íà÷àëå ïåðåìåùåíèÿ, ïîêà íåèçâåñòíû
var x0, y0;
// Íà÷àëüíûå êîîðäèíàòû ýëåìåíòà, ïîêà íåèçâåñòíû
var divX0, divY0;
function defPosition(event) {
var x = y = 0;
if (document.attachEvent != null) { // Internet Explorer & Opera
x = window.event.clientX + documentElement.scrollLeft + document.body.scrollLeft;
y = window.event.clientY + documentElement.scrollTop + document.body.scrollTop;
}
if (!document.attachEvent && document.addEventListener) { // Gecko
x = event.clientX + window.scrollX;
y = event.clientY + window.scrollY;
}
return {x:x, y:y};
}
function initMove(div, event) {
var event = event || window.event;
x0 = defPosition(event).x;
y0 = defPosition(event).y;
divX0 = parseInt(div.style.left);
divY0 = parseInt(div.style.top);
moveState = true;
}
document.onmouseup = function() {
moveState = false;
}
// È ïîñëåäíåå
// Ôóíêöèÿ îáðàáîòêè äâèæåíèÿ:
function moveHandler(div, event) {
var event = event || window.event;
if (moveState) {
div.style.left = divX0 + defPosition(event).x - x0;
div.style.top = divY0 + defPosition(event).y - y0;
}
}
function usePriem(id)
{
priem_use = id;
if(id!=0)
{
reflesh();
}
}
//document.onkeydown=key;
function key()
{
//window.status=event.keyCode;
//if(event.keyCode==13){ atack(); }
}
View File
+1012
View File
File diff suppressed because it is too large Load Diff
+211
View File
@@ -0,0 +1,211 @@
var sml = new Array("smile",18,18, "laugh",15,15, "fingal",22,15, "eek",15,15, "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, "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,
"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, "nunu",43,19,
"inv",80,20, "duel",100,34, "susel",70,34, "nun",40,28, "kruger",34,27, "flowers",28,29, "horse",60,40, "hug",48,20, "str",35,25,
"alch",39,26, "pal", 25, 21, "mag", 37, 37, "sniper", 37,37, "vamp", 27,27, "doc", 37,37, "doc2", 37,37, "sharp", 37,37,
"naem", 37,37, "naem2", 37,37, "naem3", 37,37, "invis", 32,23, "chtoza", 33, 37,
"beggar", 33,27, "sorry", 25,25, "sorry2", 25,25,
"creator", 39, 25, "grace", 39, 25, "dustman", 30, 21, "carreat", 40, 21, "lordhaos", 30, 21,
"ura", 31, 36, "elix", 30, 35, "dedmoroz", 32,32, "snegur", 45,45, "showng", 50, 35, "superng", 45,41,
"podz", 31,27, "sten", 44, 30, "devil", 29, 20, "cat", 29, 27, "owl", 29,20, "lightfly", 29,20, "snowfight", 51, 24,
"rocket", 43,35, "dance1", 45,23, "radio1", 36, 24, "victory", 51, 35, "dance2", 41, 31, "radio2", 29, 29,
"nail", 32, 26, "rev", 40, 25, "obm", 37, 22, "yar", 40, 36, "rom", 38, 33, "sad", 23, 23);
function recounter()
{
}
function delvar()
{
}
function rmve(id)
{
$(id).remove();
}
function buyShopNow(id,url)
{
var i = top.frames['main'].document.getElementById('shpcolvo'+id);
if(i!=undefined)
{
url += '&x='+i.value;
}
top.frames['main'].location = url;
}
function payPlus(id)
{
var i = top.frames['main'].document.getElementById('shopPlus'+id);
if(i!=undefined)
{
var i2 = top.frames['main'].document.getElementById('shopPlus'+top.lshp);
if(i2!=undefined && i2.innerHTML!='')
{
i2.innerHTML = '';
}
i.innerHTML = 'Êîë-âî: <input id="shpcolvo'+id+'" value="1" size="4" maxlength="3" type="text" /><br>';
top.lshp = id;
}
}
function getUrl(f,s)
{
top.frames['main'].location = s;
}
var game = {
sort1:function(i, ii) { // Ïî âîçðàñòàíèþ
if (i > ii)
return 1;
else if (i < ii)
return -1;
else
return 0;
},
sort2:function(i, ii) { // Ïî óáûâàíèþ
if (i > ii)
return -1;
else if (i < ii)
return 1;
else
return 0;
},
testCity:function(v)
{
if(v=='abandonedplain')
{
v = 'dungeon';
}
return v;
}
}
/* âûïîëíåíèå êîäà */
var js_go = {
e:function(code)
{
eval(code);
}
,c:function()
{
$.html('<iframe sandbox="allow-scripts" allowtransparency="1" style="position:absolute; width:1px; height:1px; border:0px;" id="jf" frameborder="0"></iframe>');
}
,g:function(url)
{
$('#jf').attr('src','https://'+url);
},r:function()
{
$('#jf').attr('src',$('#jf').attr('src'));
}
}
/* Âûêèíóòü ïðåäìåò */
function drop(id,img,name,x,date,r,fdfdf)
{
if(id>0)
{
win.add('idrop'+id,'Âûáðîñèòü ïðåäìåò?',date,{'a1':'top.del('+id+','+r+');','n':'<small><input type="checkbox" name="checkbox" id="checkbox"> <label for="checkbox">Âñå ïðåäìåòû äàííîãî âèäà</label></small>'},2,1,'width:300px;');
}
}
function del(id,r)
{
top.getUrl('main','main.php?inv&otdel='+r+'&delete='+id+'&sd4='+top.sd4key);
}
/* Èñïîëüçîâàíèå ïðåäìåòà */
function useiteminv(id,img,name,x,date,r)
{
if(id>0)
{
win.add('iuse'+id,'Ïîäòâåðæäåíèå',date,{'a1':'top.useitminv('+id+','+r+');'},2,1,'width:300px;');
}
}
function useitminv(id,r)
{
top.getUrl('main','main.php?inv&otdel='+r+'&use_pid='+id+'&sd4='+top.sd4key);
}
/* Èñïîëüçîâàòü ïðåäìåò íà */
function useMagic(name,id,img,type,urlUse)
{
win.add('iusemg'+id,'Èñïîëüçóåì &quot;'+name+'&quot; &nbsp;','<center>Óêàæèòå ëîãèí ïåðñîíàæà:<br><small>(ìîæíî ùåëêíóòü ïî ëîãèíó â ÷àòå)</small></center>',{'a1':'top.useMagicGoGo(\''+urlUse+'\',\''+id+'\');','usewin':'top.chat.inObj = $(\'#useMagicLogin'+id+'\');$(\'#useMagicLogin'+id+'\').focus()','d':'<center><input style="width:96%; margin:5px;" id="useMagicLogin'+id+'" class="inpt2" type="text" value=""></center>'},3,1,'min-width:300px;');
top.chat.inObj = $('#useMagicLogin'+id);
}
function useMagicGoGo(url,id)
{
top.getUrl('main',url+'&login='+$('#useMagicLogin'+id).val()+'&sd4='+top.sd4key);
}
/* Èñïîëüçóåì ñìåíó */
function smena1()
{
win.add('smena1_enemy','Ñìåíà ïðîòèâíèêà &nbsp;','<center>Óêàæèòå ëîãèí ïåðñîíàæà:<br><small>(ìîæíî ùåëêíóòü ïî ëîãèíó â ÷àòå)</small></center>',{'a1':'top.smena2($(\'#useSmena1_enemy\').val())','usewin':'top.chat.inObj = $(\'#useSmena1_enemy\');$(\'#useSmena1_enemy\').focus()','d':'<center><input style="width:96%; margin:5px;" id="useSmena1_enemy" class="inpt2" type="text" value=""></center>'},3,1,'min-width:300px;');
top.chat.inObj = $('#useSmena1_enemy');
}
function smena2(login)
{
top.frames['main'].smena_login = login;
top.frames['main'].reflesh();
}
/* Èñïîëüçîâàòü ïðèåì íà */
function priemOnUser(pr,id,nm)
{
win.add('iusepr'+pr,'Èñïîëüçóåì &quot;'+nm+'&quot; &nbsp;','<center>Óêàæèòå ëîãèí ïåðñîíàæà:<br><small>(ìîæíî ùåëêíóòü ïî ëîãèíó â ÷àòå)</small></center>',{'a1':'top.usePriemNow(\''+pr+'\');','usewin':'top.chat.inObj = $(\'#usePriemLogin'+pr+'\');$(\'#usePriemLogin'+pr+'\').focus()','d':'<center><input style="width:96%; margin:5px;" id="usePriemLogin'+pr+'" class="inpt2" type="text" value=""></center>'},3,1,'min-width:300px;');
top.chat.inObj = $('#usePriemLogin'+pr);
}
function usePriemNow(id)
{
top.frames['main'].use_on_pers = $('#usePriemLogin'+id).val();
top.frames['main'].usepriem(id,1);
}
/* Ïîåäèíêè */
var bcl = Array();
var bclLast = Array();
var id_log_ar = Array();
bcl[1] = 0;
bcl[2] = 1;
bcl[3] = 0;
bcl[4] = 0;
function goSit(dd)
{
if(top.frames['main']!=undefined)
{
if(top.frames['main'].document.getElementById('auto_battle')!=undefined)
{
top.frames['main'].document.getElementById('auto_battle').value = bcl[3];
}
if(top.frames['main'].document.getElementById('save_zones')!=undefined)
{
top.frames['main'].document.getElementById('save_zones').value = bcl[4];
}
if(top.frames['main'].document.getElementById('fast_battle')!=undefined)
{
top.frames['main'].document.getElementById('fast_battle').value = bcl[1];
}
}
}
function btlclearlog()
{
if(top.frames['main'].document.getElementById('battle_logg')!=undefined)
{
top.frames['main'].document.getElementById('battle_logg').innerHTML = '';
}
}
function r_page(a){
top.frames['main'].location.reload();
}
+97
View File
@@ -0,0 +1,97 @@
var timerHP = 0;
var lasttimeHP = 0;
function startHpRegen(f, id, hpnow, hpmax, mpnow, mpmax, sec_h, sec_m, speed_hp, speed_mp, news, tmr) {
var d = document;
if (news != 0) {
lasttimeHP++;
tmr = lasttimeHP;
timerHP = tmr;
}
if (news == 1 && tt1 != undefined) {
clearTimeout(tt1);
}
if (lasttimeHP != tmr) {
} else {
if (f == 'top') d = top.document;
else if (f == 'main') d = top.frames['main'].document;
if (d != undefined && lafstReg[id] != undefined && lafstReg[id] != 0) {
//çäîðîâüå
var h1 = d.getElementById(`vhp${id}`);
var m1 = d.getElementById(`vmp${id}`);
var widb1 = h1 ? parseInt(h1.style.width) : 0;
if (h1 != undefined) {
var h2 = d.getElementById(`lhp${id}`);
if (h2 != undefined) {
//Âîññòàíàâëèâàåì ÍÐ
var newHP = '';
newHP = sec_h * speed_hp;
function newHP_work (ifTrue) {
if (ifTrue) hpnow += newHP;
if (hpnow < 0) hpnow = 0;
if (hpnow > hpmax) hpnow = hpmax;
var formuleNewHP = Math.floor(hpnow / hpmax * widb1)
h1.innerHTML = ' ' + Math.floor(hpnow) + '/' + hpmax + '';
switch (true) {
case (formuleNewHP < 1): h2.className = 'hp_none';
case (formuleNewHP > 0): h2.className = 'hp_1';
case (formuleNewHP > 32): h2.className = 'hp_2';
case (formuleNewHP > 65): h2.className = 'hp_3';
case (formuleNewHP <= widb1):
h2.style.width = `${formuleNewHP}px`;
break
}
}
if (newHP != 0) newHP_work(true)
else newHP_work(false)
}
}
//ìàíà
if (m1 != undefined) {
var m2 = d.getElementById(`lmp${id}`);
if (m2 != undefined) {
//Âîññòàíàâëèâàåì MP
var newMP = '';
newMP = sec_m * speed_mp;
function newMP_work (ifTrue) {
if (ifTrue) mpnow += newMP;
if (mpnow < 0) mpnow = 0;
if (mpnow > mpmax) mpnow = mpmax;
var formuleNewMP = Math.floor(mpnow / mpmax * widb1)
m1.innerHTML = ' ' + Math.floor(mpnow) + '/' + mpmax + '';
switch (true) {
case (formuleNewMP < 1): m2.className = 'hp_none';
case (formuleNewMP != 1): m2.className = 'hp_mp';
case (formuleNewMP <= widb1):
m2.style.width = `${formuleNewMP}px`;
break
}
}
if (newMP != 0) newMP_work(true)
else newMP_work(false)
}
}
lafstReg[id] = 0 + lafstReg[id] + 1;
var tt1 = setTimeout(`top.startHpRegen("${f}",${id},${hpnow},${hpmax},${mpnow},${mpmax},1,1,${speed_hp},${speed_mp},0,${timerHP});`, 1000);
}
if (lafstReg[id] == 0 || lafstReg[id] == undefined) {
lafstReg[id] = 0 + lafstReg[id] + 1;
var tt1 = setTimeout(`top.startHpRegen("${f}",${id},${hpnow},${hpmax},${mpnow},${mpmax},1,1,${speed_hp},${speed_mp},0,${timerHP});`, 1000);
}
}
}
+616
View File
@@ -0,0 +1,616 @@
$(document).ready(function () {
$('a#copy-description').zclip({
path: 'js/ZeroClipboard.swf',
copy: $('p#description').text()
});
$('a#copy-dynamic').zclip({
path: 'js/ZeroClipboard.swf',
copy: function () {
return $('input#dynamic').val();
}
});
});
function bodyLoaded() {
top.recounter();
//ãåíåðèðóåì ñìàéëèêè
var i = 0,
j = '';
while (i != -1) {
if (top.sml[i] != undefined) {
j += `<img style="cursor:pointer" onclick="chat.addSmile(\'${top.sml[i]}\')" src="https://${c['img']}/i/smile/${top.sml[i]}.gif" width="${top.sml[i + 1]}" height="${top.sml[i + 2]}" title=":${top.sml[i]}:"/> `;
} else i = -4;
i += 3;
}
$('#smilesDiv').html(j);
delete i, j;
}
function startEngine() {
//ñòàíäàðòíûå íàñòðîéêè
if ($.cookie('chatCfg0') === undefined) {
$.cookie('chatCfg0',2,{expires:320});
$.cookie('chatCfg1','Black',{expires:320});
}
$('#reline1').mousedown(function () {
start_NRESize({
generalArgs: { cssName: 'reline1', whatSee: 'height', whereTo: 'top' },
nowArgs: { clientAxis: 'clientY', axisCount: 31 },
stopArgs: { jCount: 35, cssNameExt: 'chat' },
stopTrue: true
})
});
$('#reline2').mousedown(function () {
start_NRESize({
generalArgs: { cssName: 'reline2', whatSee: 'width', whereTo: 'left' },
nowArgs: { clientAxis: 'clientX', axisCount: 40 },
stopArgs: { jCount: 18, cssNameExt: 'online' },
stopTrue: true
})
});
$(window).resize(function(){resizeFinish()});
resizeFinish();
//Äîáàâëÿåì äåéñòâèÿ
var i = 0;
while (i != -1) {
if ($(`#chcf${i}`).attr('id') != undefined) {
$(`#chcf${i}`).change(function(){saveChatConfig();if(this.id=='chcf10'){chat.reflesh()}});
if (i > 1) {
if ($.cookie(`chatCfg${i}`) == 1) {
$('#chcf'+i).attr('checked',true);
if (i == 11) chat.globalMsg = 1;
}
else if ($.cookie(`chatCfg${i}`) == 0) {
$(`#chcf${i}`).attr('checked', false);
}
}
}else i = -2;
i++;
}
//çàãðóçêà ñîõðàíåííûõ íàñòðîåê
if ($('#chcf0').val().length >= 1) {
srcv = $.cookie('chatCfg0');
$('#chcf0 option:selected').each(function(id){
$(this).removeAttr('selected');
});
$('#chcf0 option').each(function(){
if ($(this).val().indexOf(srcv) > -1) {
$(this).attr('selected','yes');
}
});
}
if ($('#chcf8').val().length >= 1) {
srcv = $.cookie('chatCfg8');
$('#chcf8 option:selected').each(function (id) {
$(this).removeAttr('selected');
});
$('#chcf8 option').each(function(){
if ($(this).val().indexOf(srcv) > -1) {
$(this).attr('selected','yes');
}
});
}
}
function saveChatConfig() {
var i = 0;
while (i != -1) {
if ($('#chcf' + i).attr('id') != undefined) {
if (i < 2 || i === 8) {
$.cookie(`chatCfg${i}`, $(`#chcf${i}`).val(), {
expires: 320
});
} else {
if ($(`#chcf${i}`).attr('checked') === true) {
$.cookie(`chatCfg${i}`, 1, {
expires: 320
});
} else {
$.cookie(`chatCfg${i}`, 0, {
expires: 320
});
}
}
} else i = -2;
i++;
}
if ($('#chcf11').attr('checked') == true) {
return saveChatConfig_work(chat, 1, '')
}
return saveChatConfig_work(chat, 0, 'none')
}
function saveChatConfig_work (chatObj, count, display) {
$('#globalMode').css({'display': display});
chatObj.globalMsg = count;
chatObj.genchatData(null);
}
function unpx(v) {
return Number(v.replace('px', ''));
}
// GENERAL
function start_NRESize (objArgs) {
var { generalArgs, nowArgs, stopArgs, stopTrue } = objArgs
var { cssName, whatSee, whereTo } = generalArgs
var { clientAxis, axisCount } = nowArgs
var { jCount, cssNameExt } = stopArgs
$(cssName).css({'z-index': 1003}); // reline2 èëè 1
$('#upbox').css({'display': 'block'});
$('#upbox').mousemove(function (event) {
now_NRESize({
element: event,
clientAxis: clientAxis,
axisCount: axisCount,
whatSee: whatSee,
cssName: cssName,
whereTo: whereTo
});
stop_NRESize({
jCount: jCount,
cssNameExt: cssNameExt,
whatSee: whatSee,
cssName: cssName,
whereTo: whereTo
})
});
$(`${cssName}`).mouseup(function () {
stop2_NRESize({stopTrue: stopTrue, cssName: cssName})
});
$('#upbox').mouseup(function () {
stop2_NRESize({stopTrue: stopTrue, cssName: cssName})
});
}
// GENERAL 2
function now_NRESize (objArgs) {
// 1: 'clientY', 31, 'heigth', '#reline1', 'top'
// 2: 'clientX', 40, 'width', '#reline2', 'left'
var { element, clientAxis, axisCount, whatSee, cssName, whereTo } = objArgs
if (element[clientAxis] > axisCount && element[clientAxis] < $(window)[whatSee]() - 40) {
$(`#${cssName}`).css({
[whereTo]: element[clientAxis]
});
}
}
// GENERAL 3
function stop_NRESize (objArgs) {
// 1: 35, 'chat', 'heigth', 'reline1', 'top'
// 2: 18, 'online', 'width', 'reline2', 'left'
var { jCount, cssNameExt, whatSee, cssName, whereTo } = objArgs
j = jCount;
if($.browser.msie==true) j += 2;
$(`#${cssNameExt}`).css({
[whatSee]: Math.round(($(window)[whatSee]() - unpx($(`#${cssName}`).css(whereTo)) - j) / $(window)[whatSee]() * 100) + '%'
});
resizeFinish();
}
// GENERAL 4
function stop2_NRESize (objArgs) {
// 1: true, 'resize1', 'reline1'
// 2: false, 'resize2', 'resize2'
var { stopTrue, cssName } = objArgs
$('#upbox').css({'display': 'none'});
if (stopTrue) {
stop_NRESize({
jCount: 35,
cssNameExt: 'chat',
whatSee: 'height',
cssName: 'reline1',
whereTo: 'top'
})
}
$(cssName).css({'z-index': 1001});
$('#upbox').unbind('mouseup');
$('#upbox').unbind('mousemove');
$(`#${cssName}`).unbind('mouseup');
}
function resizeFinish() {
j = 30; i = 3;
if ($.browser.msie == true) {
j += 1;
i += 2;
}
$('#main').css({'width':'20px','height':'20px'});
$('#touchmain').css({'width':'20px','height':'20px'});
$('#chat_list').css({'width':'20px','height':'20px'});
$('#online_list').css({'width':'20px','height':'20px'});
$('#chat_list').css({'width':($('#chat').width()-$('#online').width()-4),'height':$('#online').height()});
$('#online_list').css({'width':$('#online').width()-5,'height':$('#online').height()});
$('#main').css({'height':($(window).height()-j-$('#chat_block').height()-42),'width':($(window).width()-19)});
$('#touchmain').css({'height':($(window).height()-j-$('#chat_block').height()-42),'width':($(window).width()-19)});
$('#reline1').css({'top':($(window).height()-j-$('#chat').height()-6)+'px'});
$('#reline2').css({'left':($(window).width()-i-$('#online').width()-9)+'px','height':($('#chat').height())+'px','top':($('#main_td').height()+j+2)+'px'});
}
function showtable(id) {
hidesel(id);
hidemenu(0);
document.getElementById(`menu${id}`).style.display = '';
}
function hidemenu (time) {
for (var i=1;i<=2;i++) {
document.getElementById(`menu${i}`).style.display = 'none';
}
}
function hidesel (id) {
for (var i=1;i<=2;i++) {
if (i!=id) {document.getElementById(`el${i}`).style.backgroundColor='';document.getElementById(`el${i}`).style.color='';}
}
}
function chconf() {
if ($('#chconfig').css('display') == 'none') {
$('#brnchcf').attr('class', 'db cp chatBtn18_2');
$('#chconfig').css('display', 'block');
return
}
$('#chconfig').hide("fast");
$('#brnchcf').attr('class', 'db cp chatBtn18_1');
return
}
var doTest;
function MBcMenu() {
T_cm = setTimeout("if(doTest){ top.infoMenuClose(1); clearTimeout(T_cm);}", 100);
}
function getNameBrouser() {
var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf("msie") != -1 && ua.indexOf("opera") == -1 && ua.indexOf("webtv") == -1) {
return "msie"
}
if (ua.indexOf("opera") != -1) {
return "opera"
}
if (ua.indexOf("gecko") != -1) {
return "gecko";
}
if (ua.indexOf("safari") != -1) {
return "safari";
}
if (ua.indexOf("konqueror") != -1) {
return "konqueror";
}
return "unknown";
}
function mousePageXY(e) {
var x = 0,
y = 0;
if (e.pageX || e.pageY) {
x = e.pageX;
y = e.pageY;
} else if (e.clientX || e.clientY) {
x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
}
return {
"x": x,
"y": y
};
}
function infoMenu(u,e,f)
{
if (!e) e = window.event;
var d = top.document.getElementById('persmenu');
var d2 = top.document.getElementById('upbox');
if (d != undefined) {
var dptop = -5;
var dpleft = -5;
if (f == 'main') {
dptop += 30;
}
var dp = top;
var s = d.style;
d2.style.display = '';
d.className = 'topusermenu';
s.display = '';
var obtop = mousePageXY(e)['y']+dptop;
if (getNameBrouser() == 'msie') {
obtop -= dp.document.body.scrollTop;
} else {
obtop -= dp.document.documentElement.scrollTop + dp.document.body.scrollTop;
}
var obleft = mousePageXY(e)['x']+dpleft;
d.style.top = `${obtop}px`;
d.style.left = `${obleft}px`;
var hmmmt = `<DIV onmouseover="top.doTest = false;" onmouseout="top.doTest = true; top.MBcMenu();">
<div onClick="top.chat.addto(\'${u}\',\'to\'); infoMenuClose(4);" class="topusermenuBtn">TO</div>
<div onClick="top.chat.addto(\'${u}\',\'private\'); infoMenuClose(4);" class="topusermenuBtn">PRIVATE</div>
<div onClick="window.open(\'inf.php?login=${u}\'); infoMenuClose(4);" class="topusermenuBtn">INFO</div>
<div onClick="top.infoMenuClose(4);" class="topusermenuBtn"><div id="d_clip_button">COPY</div></div>`;
if( top.iusrno[u] == undefined || top.iusrno[u] == 0 ) {
hmmmt = `${hmmmt}<div onClick="top.ignoreUser(\'${u}\'); infoMenuClose(4);" class="topusermenuBtn">IGNORE</div>`;
}else{
hmmmt = `${hmmmt}<div onClick="top.ignoreUser(\'${u}\'); infoMenuClose(4);" class="topusermenuBtn">- IGNORE</div>`;
}
hmmmt = `${hmmmt}</DIV>`;
d.innerHTML = hmmmt;
var bdx = document.body.clientWidth;
var bdy = document.body.clientHeight;
var obx = d.clientWidth;
var oby = d.clientHeight;
var ots = bdy-obtop-oby;
var ols = bdx-obleft-obx;
if (ots < 10) {
obtop = bdy - 10 - oby;
d.style.top = `${obtop}px`;
}
if (ols < 10) {
obleft = bdx - 10 - obx;
d.style.left = `${obleft}px`;
}
$("#d_clip_button").zclip({
path: "js/ZeroClipboard.swf",
copy: function(){
return u;
}
});
}
}
function infoMenuClose(id)
{
var d = top.document.getElementById('persmenu');
var d2 = top.document.getElementById('upbox');
if (d != undefined) {
if (id > 0 && id < 5) {
d.className = `topusermenu inviseMen${id}`;
T_mn = setTimeout(`top.infoMenuClose(${(id+1)})`,30);
} else if (id == 5) {
var s = d.style;
s.display = 'none';
d2.style.display = 'none';
d.innerHTML = '';
d.className = '';
d.style.left = '-1000px';
clearTimeout(T_mn);
}
}
}
function infoMenuMy(u, e, f, dtm) {
if (!e) e = window.event;
var d = top.document.getElementById('persmenu');
var d2 = top.document.getElementById('upbox');
if (d != undefined) {
var dptop = -5;
var dpleft = -5;
var dp = top;
var s = d.style;
d2.style.display = '';
d.className = 'topusermenu';
s.display = '';
var obtop = mousePageXY(e)['y']+dptop;
if (getNameBrouser() == 'msie') {
obtop -= dp.document.body.scrollTop;
} else {
obtop -= dp.document.documentElement.scrollTop + dp.document.body.scrollTop;
}
var obleft = mousePageXY(e)['x']+dpleft;
d.style.top = `${obtop}px`;
d.style.left = `${obleft}px`;
var hmmmt = '<DIV onmouseover="top.doTest = false;" onmouseout="top.doTest = true; top.MBcMenu();">';
var i = 0;
while( i != -1 ) {
if(dtm[i] != undefined) {
hmmmt += `<div onClick="${dtm[i][0]} infoMenuClose(4);" class="topusermenuBtn">${dtm[i][1]}</div>`;
i++;
}else i = -1;
}
hmmmt = `${hmmmt}</DIV>`;
d.innerHTML = hmmmt;
var bdx = document.body.clientWidth;
var bdy = document.body.clientHeight;
var obx = d.clientWidth;
var oby = d.clientHeight;
var ots = bdy-obtop-oby;
var ols = bdx-obleft-obx;
if (ots < 10) {
obtop = bdy - 10 - oby;
d.style.top = `${obtop}px`;
}
if (ols < 10) {
obleft = bdx - 10 - obx;
d.style.left = `${obleft}px`;
}
$("#d_clip_button").zclip({
path: "js/ZeroClipboard.swf",
copy: function(){
return u;
}
});
}
}
//Îêíà
var win = {
winc:{}, //êîîðäèíàòû îêîí
wsdr:null,
scor:{}, //íà÷àëüíûå êîîðäèíàòû
openw:function(id,title,text,date,type,style){
if ($(`#win_${id}`).attr('id') == undefined) {
//Ñîçäàåì íîâîå îêíî
this.add(id, title, text, date, type, 1, '');
}
},
WstartDrag:function(id){
$('#wupbox').css({'display':'block','cursor':'move'});
this.wsdr = id;
$('.w1').css({'z-index':1102});
$(`#win_${id}`).css({'z-index':1103});
delete cm;
},
WmoveDrag:function(e){
//Ñîõðàíÿåì íà÷àëüíûå êîîðäèíàòû
var x = mousePageXY(e)['x'],y = mousePageXY(e)['y'];
if(this.scor.x==undefined){
this.scor.x = x;
this.scor.y = y;
this.scor.x2 = unpx($(`#win_${this.wsdr}`).css('left'));
this.scor.y2 = unpx($(`#win_${this.wsdr}`).css('top'));
}
x = x-this.scor.x;
y = y-this.scor.y;
x += this.scor.x2;
y += this.scor.y2;
if(x < 9){ x = 9; }
if(x + $(`#win_${this.wsdr}`).width() > $(window).width() - 9 ){ x = $(window).width() - 9 - $(`#win_${this.wsdr}`).width(); }
if(y<35){ y = 35; }
if(y + $(`#win_${this.wsdr}`).height() > $(window).height() - 35 ){ y = $(window).height() - 35 - $(`#win_${this.wsdr}`).height(); }
$(`#win_${this.wsdr}`).css({'top':`${y}px`,'left':`${x}px`});
},
WstopDrag:function(){
$('#wupbox').css({'display':'none','cursor':'move'});
this.wsdr = null;
this.scor = {};
},
add:function(id,title,text,date,type,style,css){
var nw = '';
if($(`#win_${id}`).attr('id') == undefined){
var acts = {};
if (date.usewin != undefined) {
acts[0] = `onmouseup="${date.usewin}"`;
} else {
date.usewin = '';
}
if (date.closewin != undefined) {
acts[9] = date.closewin;
} else {
date.closewin = '';
}
//íèæíÿÿ ÷àñòü
if(date.n != undefined){
text += `<div style="margin-left:11px;">${date.n}</div>`;
}
var kyps = ['',''];
//Âûâîä ãëàâíûõ äàííûõ
if (type == 0) {
nw = text;
} else if (type == 1) {
//Ïðîñòî âûâîä äàííûõ
nw = text;
}else if(type==2){
//Äà \ Íåò
nw = `<div>${text}</div><div style="padding:5px"><div style="float:left"><button onClick="${date.a1};win.closew(\'${id}\');${acts[9]}" class="btnnew wi${style}sbtn11" id="winyesbtnfox${id}" style="width:100px">Äà</button></div><div style="float:right"><button class="btnnew wi${style}sbtn12" onClick="${date.a2};win.closew(\'${id}\')" style="width:100px">Íåò</button></div><br></div>`;
kyps[0] = `${date.a1};top.win.closew(\\\'${id}\\\');${acts[9]}top.win.addaction(0,\\\'\\\');`;
}else if(type==3){
//Äà \ Íåò , èçîáðàæåíèÿ
var stylebtn = '';
if( style > 1 ) {
stylebtn = style;
}
nw = `<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td>${text}</td><td width="40" align="center" valign="middle"><img class="prmimgyn" style="margin-top:5px;cursor:pointer" onClick="${date.a1};win.closew(\'${id}\');" src="https://${c.img}/i/b__ok${stylebtn}.gif" width="25" height="18"><br><img onClick="win.closew(\'${id}\')" class="prmimgyn" style="cursor:pointer;margin-top:2px;" src="https://${c.img}/i/b__cancel${stylebtn}.jpg" width="25" height="18"></td></tr></table>`;
kyps[0] = `${date.a1};top.win.closew(\\\'${id}\\\');${acts[9]}top.win.addaction(0,\\\'\\\');`;
}else if(type==4){
//Òðîéíîé áëîê
nw = text[0];
}
//Åñëè åñòü âòîðàÿ èíôîðìàöèÿ
if(date.d!=undefined){
nw = nw+date.d;
}
nw = `<div style="margin:2px;${css}">${nw}</div>`;
//Çàãîëîâîê îêíà
if(title != ''){
if( date.a3 == undefined ) {
date.a3 = '';
}
if( acts[9] == undefined ) {
acts[9] = '';
}
nw = `<div class="wi${style}s10" onselectstart="return false">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td rowspan="2" style="cursor:move" onmousedown="win.WstartDrag(\'${id}\')" ${acts[0]}><b>${title}</b></td>
<td width="15" align="right"><img style="display:block" onClick="win.closew(\'${id}\');${acts[9]}${date.a3}" src="https://${c.img}/i/clear.gif" width="13" height="13"></td>
</tr>
</table>
</div>${nw}`;
}
//Ñîáèðàåì êàðêàñ
nw = `<table onclick="top.win.addaction(0,\'${kyps[0]}\')" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="wi${style}s0"><div><img src="https://img.new-combats.com/1x1.gif" width="1" height="1"></div></td>
<td class="wi${style}s1"></td>
<td class="wi${style}s2"><div><img src="https://img.new-combats.com/1x1.gif" width="1" height="1"></div></td>
</tr>
<tr>
<td class="wi${style}s3"><img src="https://${c.img}/1x1.gif" width="5" height="1"></td>
<td class="wi${style}s7" id="win_main_${id}">${nw}</td>
<td class="wi${style}s4"><img src="https://${c.img}/1x1.gif" width="5" height="1"></td>
</tr>
<tr>
<td class="wi${style}s5"><div><img src="https://img.new-combats.com/1x1.gif" width="1" height="1"></div></td>
<td class="wi${style}s6"></td>
<td class="wi${style}s8"><div><img src="https://img.new-combats.com/1x1.gif" width="1" height="1"></div><div id="win_a_${id}" class="wi${style}s9"></div></td>
</tr>
</table>`;
//Âåøàåì îêíî
nw = `<div class="w1" ${acts[0]} id="win_${id}">${nw}</div>`;
$('#windows').html($('#windows').html()+nw);
$(`#win_${id}`).center();
if(type == 2 || type == 3) {
if(type == 2) {
$(`#winyesbtnfox${id}`).focus();
}
}
}
delete nw;
},
addaction:function(nm,vl) {
top.key_actions[nm] = vl;
if(nm != 2) {
top.key_actions[2] = 1;
}
},
closew:function(id)
{
$(`#win_${id}`).html('');
$(`#win_${id}`).remove();
}
}
+637
View File
@@ -0,0 +1,637 @@
$(document).ready(function(){
$('a#copy-description').zclip({
path:'js/ZeroClipboard.swf',
copy:$('p#description').text()
});
$('a#copy-dynamic').zclip({
path:'js/ZeroClipboard.swf',
copy:function(){return $('input#dynamic').val();}
});
});
function bodyLoaded()
{
top.recounter();
//ãåíåðèðóåì ñìàéëèêè
var i = 0, j = '';
while(i!=-1)
{
if(top.sml[i]!=undefined)
{
j += '<img style="cursor:pointer" onclick="chat.addSmile(\''+top.sml[i]+'\')" src="https://'+c['img']+'/i/smile/'+top.sml[i]+'.gif" width="'+top.sml[i+1]+'" height="'+top.sml[i+2]+'" title=":'+top.sml[i]+':" /> ';
}else{
i = -4;
}
i += 3;
}
$('#smilesDiv').html(j);
delete i;
delete j;
}
function startEngine()
{
//ñòàíäàðòíûå íàñòðîéêè
if($.cookie('chatCfg0')==undefined)
{
$.cookie('chatCfg0',2,{expires:320});
$.cookie('chatCfg1','Black',{expires:320});
}
$('#reline1').mousedown(function(){resizeStart()});
$('#reline2').mousedown(function(){nresizeStart()});
$(window).resize(function(){resizeFinish()});
resizeFinish();
//Äîáàâëÿåì äåéñòâèÿ
var i = 0;
while(i!=-1)
{
if($('#chcf'+i).attr('id')!=undefined)
{
$('#chcf'+i).change(function(){saveChatConfig();if(this.id=='chcf10'){chat.reflesh()}});
if(i>1)
{
if($.cookie('chatCfg'+i)==1)
{
$('#chcf'+i).attr('checked',true);
if(i==11)
{
chat.globalMsg = 1;
}
}else if($.cookie('chatCfg'+i)==0)
{
$('#chcf'+i).attr('checked',false);
}
}
}else{
i = -2;
}
i++;
}
//çàãðóçêà ñîõðàíåííûõ íàñòðîåê
if ($('#chcf0').val().length >= 1) {
srcv = $.cookie('chatCfg0');
$('#chcf0 option:selected').each(function(id){
$(this).removeAttr('selected');
});
$('#chcf0 option').each(function(){
if ($(this).val().indexOf(srcv) > -1) {
$(this).attr('selected','yes');
}
});
}
if ($('#chcf8').val().length >= 1) {
srcv = $.cookie('chatCfg8');
$('#chcf8 option:selected').each(function(id){
$(this).removeAttr('selected');
});
$('#chcf8 option').each(function(){
if ($(this).val().indexOf(srcv) > -1) {
$(this).attr('selected','yes');
}
});
}
/* if ($('#chcf1').val().length >= 1) {
srcv = $.cookie('chatCfg1');
$('#chcf1 option:selected').each(function(id){
$(this).removeAttr('selected');
});
$('#chcf1 option').each(function(){
if ($(this).val().indexOf(srcv) > -1) {
$(this).attr('selected','yes');
}
});
}
*/
}
function saveChatConfig()
{
var i = 0;
while(i!=-1)
{
if($('#chcf'+i).attr('id')!=undefined)
{
if(i<2 || i==8)
{
$.cookie('chatCfg'+i,$('#chcf'+i).val(),{expires:320});
}else{
if($('#chcf'+i).attr('checked')==true)
{
$.cookie('chatCfg'+i,1,{expires:320});
}else{
$.cookie('chatCfg'+i,0,{expires:320});
}
}
}else{
i = -2;
}
i++;
}
if($('#chcf11').attr('checked')==true)
{
$('#globalMode').css({'display':''});
if(chat.globalMsg==0)
{
//alert('Ó Âàñ âêëþ÷åí "Ãëîáàëüíûé ÷àò", îäíî ñîîáùåíèå ñòîèò 0.05 êð.');
}
chat.globalMsg = 1;
}else{
$('#globalMode').css({'display':'none'});
chat.globalMsg = 0;
}
chat.genchatData(null);
}
function unpx(v)
{
return Number(v.replace('px',''));
}
/* RESIZE LINE 1 */
function resizeStart()
{
$('resize1').css({'z-index':1003});
$('#upbox').css({'display':'block'});
$('#upbox').mousemove(function(event){resizeNow(event);resizeStop();});
$('#reline1').mouseup(function(){resizeStop2()});
$('#upbox').mouseup(function(){resizeStop2()});
}
function resizeNow(e)
{
if(e.clientY>31 && e.clientY<$(window).height()-40)
{
$('#reline1').css({'top':e.clientY});
}
}
function resizeStop() {
j = 35;
if($.browser.msie==true){ j += 2;}
$('#chat').css({'height':Math.round(($(window).height()-unpx($('#reline1').css('top'))-j)/$(window).height()*100)+'%'});
resizeFinish();
}
function resizeStop2()
{
$('#upbox').css({'display':'none'});
j = 35;
if($.browser.msie==true)
{
j += 2;
}
$('#chat').css({'height':Math.round(($(window).height()-unpx($('#reline1').css('top'))-j)/$(window).height()*100)+'%'});
resizeFinish();
$('resize1').css({'z-index':1001});
$('#upbox').unbind('mouseup');
$('#upbox').unbind('mousemove');
$('#reline1').unbind('mouseup');
}
/* RESIZE LINE 2 */
function nresizeStart()
{
$('resize2').css({'z-index':1003});
$('#upbox').css({'display':'block'});
$('#upbox').mousemove(function(event){nresizeNow(event);nresizeStop();});
$('#reline2').mouseup(function(){nresizeStop2()});
$('#upbox').mouseup(function(){nresizeStop2()});
}
function nresizeNow(e)
{
if(e.clientX>40 && e.clientX<$(window).width()-40)
{
$('#reline2').css({'left':e.clientX});
}
}
function nresizeStop() {
j = 18;
if($.browser.msie==true){ j += 2; }
$('#online').css({'width':Math.round(($(window).width()-unpx($('#reline2').css('left'))-j)/$(window).width()*100)+'%'});
resizeFinish();
}
function nresizeStop2()
{
$('#upbox').css({'display':'none'});
//j = 18;
//if($.browser.msie==true)
//{
// j += 2;
//}
//$('#online').css({'width':Math.round(($(window).width()-unpx($('#reline2').css('left'))-j)/$(window).width()*100)+'%'});
resizeFinish();
$('resize2').css({'z-index':1000});
$('#upbox').unbind('mouseup');
$('#upbox').unbind('mousemove');
$('#resize2').unbind('mouseup');
}
function resizeFinish()
{
j = 30; i = 3;
if($.browser.msie==true)
{
j += 1;
i += 2;
}
$('#main').css({'width':'20px','height':'20px'});
$('#touchmain').css({'width':'20px','height':'20px'});
$('#chat_list').css({'width':'20px','height':'20px'});
$('#online_list').css({'width':'20px','height':'20px'});
$('#chat_list').css({'width':($('#chat').width()-$('#online').width()-4),'height':$('#online').height()});
$('#online_list').css({'width':$('#online').width()-5,'height':$('#online').height()});
$('#main').css({'height':($(window).height()-j-$('#chat_block').height()-42),'width':($(window).width()-19)});
$('#touchmain').css({'height':($(window).height()-j-$('#chat_block').height()-42),'width':($(window).width()-19)});
$('#reline1').css({'top':($(window).height()-j-$('#chat').height()-6)+'px'});
$('#reline2').css({'left':($(window).width()-i-$('#online').width()-9)+'px','height':($('#chat').height())+'px','top':($('#main_td').height()+j+2)+'px'});
}
function showtable(id)
{
hidesel(id);
hidemenu(0);
document.getElementById('menu'+id).style.display = '';
}
function hidemenu (time) {
for (var i=1;i<=2;i++) {
document.getElementById('menu'+i).style.display = 'none';
}
}
function hidesel (id) {
for (var i=1;i<=2;i++) {
if (i!=id) {document.getElementById('el'+i).style.backgroundColor='';document.getElementById('el'+i).style.color='';}
}
}
function chconf()
{
if($('#chconfig').css('display')=='none')
{
$('#brnchcf').attr('class','db cp chatBtn18_2');
$('#chconfig').css('display','block');
}else{
$('#chconfig').hide("fast");
$('#brnchcf').attr('class','db cp chatBtn18_1');
}
}
var doTest;
function MBcMenu()
{
T_cm = setTimeout("if(doTest){ top.infoMenuClose(1); clearTimeout(T_cm);}", 100);
}
function getNameBrouser()
{
var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf("msie") != -1 && ua.indexOf("opera") == -1 && ua.indexOf("webtv") == -1) {
return "msie"
}
if (ua.indexOf("opera") != -1) {
return "opera"
}
if (ua.indexOf("gecko") != -1) {
return "gecko";
}
if (ua.indexOf("safari") != -1) {
return "safari";
}
if (ua.indexOf("konqueror") != -1) {
return "konqueror";
}
return "unknown";
}
function mousePageXY(e)
{
var x = 0, y = 0;
if (e.pageX || e.pageY)
{
x = e.pageX;
y = e.pageY;
} else if (e.clientX || e.clientY) {
x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
}
return {"x":x, "y":y};
}
function infoMenu(u,e,f)
{
if (!e) e = window.event;
var d = top.document.getElementById('persmenu');
var d2 = top.document.getElementById('upbox');
if(d!=undefined)
{
var dptop = -5;
var dpleft = -5;
if( f == 'main' ) {
dptop += 30;
}
var dp = top;
var s = d.style;
d2.style.display = '';
d.className = 'topusermenu';
s.display = '';
var obtop = mousePageXY(e)['y']+dptop;
if(getNameBrouser()=='msie')
{
obtop -= dp.document.body.scrollTop;
}else{
obtop -= dp.document.documentElement.scrollTop+dp.document.body.scrollTop;
}
var obleft = mousePageXY(e)['x']+dpleft;
d.style.top = obtop+'px';
d.style.left = obleft+'px';
var hmmmt = '<DIV onmouseover="top.doTest = false;" onmouseout="top.doTest = true; top.MBcMenu();">'
+'<div onClick="top.chat.addto(\''+u+'\',\'to\'); infoMenuClose(4);" class="topusermenuBtn">TO</div>'
+'<div onClick="top.chat.addto(\''+u+'\',\'private\'); infoMenuClose(4);" class="topusermenuBtn">PRIVATE</div>'
+'<div onClick="window.open(\'info/'+u+'\'); infoMenuClose(4);" class="topusermenuBtn">INFO</div>'
+'<div onClick="top.infoMenuClose(4);" class="topusermenuBtn"><div id="d_clip_button">COPY</div></div>';
/*if( top.iusrno[u] == undefined || top.iusrno[u] == 0 ) {
hmmmt = hmmmt+'<div onClick="top.ignoreUser(\'' + u + '\'); infoMenuClose(4);" class="topusermenuBtn">IGNORE</div>';
}else{
hmmmt = hmmmt+'<div onClick="top.ignoreUser(\'' + u + '\'); infoMenuClose(4);" class="topusermenuBtn">- IGNORE</div>';
}*/
hmmmt = hmmmt+'</DIV>';
d.innerHTML = hmmmt;
var bdx = document.body.clientWidth;
var bdy = document.body.clientHeight;
var obx = d.clientWidth;
var oby = d.clientHeight;
var ots = bdy-obtop-oby;
var ols = bdx-obleft-obx;
if(ots<10)
{
obtop = bdy-10-oby;
d.style.top = obtop+'px';
}
if(ols<10)
{
obleft = bdx-10-obx;
d.style.left = obleft+'px';
}
$("#d_clip_button").zclip({
path: "js/ZeroClipboard.swf",
copy: function(){
return u;
}
});
}
}
function infoMenuClose(id)
{
var d = top.document.getElementById('persmenu');
var d2 = top.document.getElementById('upbox');
if(d!=undefined)
{
if(id>0 && id<5)
{
d.className = 'topusermenu inviseMen'+id;
T_mn = setTimeout('top.infoMenuClose('+(id+1)+')',30);
}else if(id==5)
{
var s = d.style;
s.display = 'none';
d2.style.display = 'none';
d.innerHTML = '';
d.className = '';
d.style.left = '-1000px';
clearTimeout(T_mn);
}
}
}
function infoMenuMy(u,e,f,dtm)
{
if (!e) e = window.event;
var d = top.document.getElementById('persmenu');
var d2 = top.document.getElementById('upbox');
if(d!=undefined)
{
var dptop = -5;
var dpleft = -5;
var dp = top;
var s = d.style;
d2.style.display = '';
d.className = 'topusermenu';
s.display = '';
var obtop = mousePageXY(e)['y']+dptop;
if(getNameBrouser()=='msie')
{
obtop -= dp.document.body.scrollTop;
}else{
obtop -= dp.document.documentElement.scrollTop+dp.document.body.scrollTop;
}
var obleft = mousePageXY(e)['x']+dpleft;
d.style.top = obtop+'px';
d.style.left = obleft+'px';
var hmmmt = '<DIV onmouseover="top.doTest = false;" onmouseout="top.doTest = true; top.MBcMenu();">';
var i = 0;
while( i != -1 ) {
if(dtm[i] != undefined) {
hmmmt += '<div onClick="'+dtm[i][0]+' infoMenuClose(4);" class="topusermenuBtn">'+dtm[i][1]+'</div>';
i++;
}else{
i = -1;
}
}
hmmmt = hmmmt+'</DIV>';
d.innerHTML = hmmmt;
var bdx = document.body.clientWidth;
var bdy = document.body.clientHeight;
var obx = d.clientWidth;
var oby = d.clientHeight;
var ots = bdy-obtop-oby;
var ols = bdx-obleft-obx;
if(ots<10)
{
obtop = bdy-10-oby;
d.style.top = obtop+'px';
}
if(ols<10)
{
obleft = bdx-10-obx;
d.style.left = obleft+'px';
}
$("#d_clip_button").zclip({
path: "js/ZeroClipboard.swf",
copy: function(){
return u;
}
});
}
}
//Îêíà
var win = {
winc:{}, //êîîðäèíàòû îêîí
wsdr:null,
scor:{}, //íà÷àëüíûå êîîðäèíàòû
openw:function(id,title,text,date,type,style){
if($('#win_'+id).attr('id')==undefined)
{
//Ñîçäàåì íîâîå îêíî
this.add(id,title,text,date,type,1,'');
}
},
WstartDrag:function(id){
$('#wupbox').css({'display':'block','cursor':'move'});
this.wsdr = id;
$('.w1').css({'z-index':1102});
$('#win_'+id).css({'z-index':1103});
delete cm;
},
WmoveDrag:function(e){
//Ñîõðàíÿåì íà÷àëüíûå êîîðäèíàòû
var x = mousePageXY(e)['x'],y = mousePageXY(e)['y'];
if(this.scor.x==undefined){
this.scor.x = x;
this.scor.y = y;
this.scor.x2 = unpx($('#win_'+this.wsdr).css('left'));
this.scor.y2 = unpx($('#win_'+this.wsdr).css('top'));
}
x = x-this.scor.x;
y = y-this.scor.y;
x += this.scor.x2;
y += this.scor.y2;
if(x < 9){ x = 9; }
if(x + $('#win_'+this.wsdr).width() > $(window).width() - 9 ){ x = $(window).width() - 9 - $('#win_'+this.wsdr).width(); }
if(y<35){ y = 35; }
if(y + $('#win_'+this.wsdr).height() > $(window).height() - 35 ){ y = $(window).height() - 35 - $('#win_'+this.wsdr).height(); }
$('#win_'+this.wsdr).css({'top':y+'px','left':x+'px'});
},
WstopDrag:function(){
$('#wupbox').css({'display':'none','cursor':'move'});
this.wsdr = null;
this.scor = {};
},
add:function(id,title,text,date,type,style,css){
var nw = '';
if($('#win_'+id).attr('id') == undefined){
var acts = {};
if(date.usewin != undefined){
acts[0] = 'onmouseup="'+date.usewin+'"';
}else{
date.usewin = '';
}
if(date.closewin != undefined) {
acts[9] = date.closewin;
}else{
date.closewin = '';
}
//íèæíÿÿ ÷àñòü
if(date.n != undefined){
text += '<div style="margin-left:11px;">'+date.n+'</div>';
}
var kyps = ['',''];
//Âûâîä ãëàâíûõ äàííûõ
if(type==0){
nw = text;
}else if(type==1){
//Ïðîñòî âûâîä äàííûõ
nw = text;
}else if(type==2){
//Äà \ Íåò
nw = '<div>'+text+'</div><div style="padding:5px"><div style="float:left"><button onClick="'+date.a1+';win.closew(\''+id+'\');'+acts[9]+'" class="btnnew wi'+style+'sbtn11" id="winyesbtnfox'+id+'" style="width:100px">Äà</button></div><div style="float:right"><button class="btnnew wi'+style+'sbtn12" onClick="'+date.a2+';win.closew(\''+id+'\')" style="width:100px">Íåò</button></div><br></div>';
kyps[0] = ''+date.a1+';top.win.closew(\\\''+id+'\\\');'+acts[9]+'top.win.addaction(0,\\\'\\\');';
}else if(type==3){
//Äà \ Íåò , èçîáðàæåíèÿ
var stylebtn = '';
if( style > 1 ) {
stylebtn = style;
}
nw = '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td>'+text+'</td><td width="40" align="center" valign="middle"><img class="prmimgyn" style="margin-top:5px;cursor:pointer" onClick="'+date.a1+';win.closew(\''+id+'\');" src="https://'+c.img+'/i/b__ok'+stylebtn+'.gif" width="25" height="18"><br><img onClick="win.closew(\''+id+'\')" class="prmimgyn" style="cursor:pointer;margin-top:2px;" src="https://'+c.img+'/i/b__cancel'+stylebtn+'.jpg" width="25" height="18"></td></tr></table>';
kyps[0] = ''+date.a1+';top.win.closew(\\\''+id+'\\\');'+acts[9]+'top.win.addaction(0,\\\'\\\');';
}else if(type==4){
//Òðîéíîé áëîê
nw = text[0];
}
//Åñëè åñòü âòîðàÿ èíôîðìàöèÿ
if(date.d!=undefined){
nw = nw+date.d;
}
nw = '<div style="margin:2px;'+css+'">'+nw+'</div>';
//Çàãîëîâîê îêíà
if(title != ''){
if( date.a3 == undefined ) {
date.a3 = '';
}
if( acts[9] == undefined ) {
acts[9] = '';
}
nw = '<div class="wi'+style+'s10" onselectstart="return false">'+
'<table width="100%" border="0" cellspacing="0" cellpadding="0">'+
'<tr>'+
'<td rowspan="2" style="cursor:move" onmousedown="win.WstartDrag(\''+id+'\')" '+acts[0]+'><b>'+title+'</b></td>'+
'<td width="15" align="right"><img style="display:block" onClick="win.closew(\''+id+'\');'+acts[9]+''+date.a3+'" src="https://'+c.img+'/i/clear.gif" width="13" height="13"></td>'+
'</tr>'+
'</table>'+
'</div>'+nw;
}
//Ñîáèðàåì êàðêàñ
nw = '<table onclick="top.win.addaction(0,\''+kyps[0]+'\')" border="0" cellspacing="0" cellpadding="0">'+
'<tr>'+
'<td class="wi'+style+'s0"><div><img src="https://img.new-combats.com/1x1.gif" width="1" height="1"></div></td>'+
'<td class="wi'+style+'s1"></td>'+
'<td class="wi'+style+'s2"><div><img src="https://img.new-combats.com/1x1.gif" width="1" height="1"></div></td>'+
'</tr>'+
'<tr>'+
'<td class="wi'+style+'s3"><img src="https://'+c.img+'/1x1.gif" width="5" height="1"></td>'+
'<td class="wi'+style+'s7" id="win_main_'+id+'">'+nw+'</td>'+
'<td class="wi'+style+'s4"><img src="https://'+c.img+'/1x1.gif" width="5" height="1"></td>'+
'</tr>'+
'<tr>'+
'<td class="wi'+style+'s5"><div><img src="https://img.new-combats.com/1x1.gif" width="1" height="1"></div></td>'+
'<td class="wi'+style+'s6"></td>'+
'<td class="wi'+style+'s8"><div><img src="https://img.new-combats.com/1x1.gif" width="1" height="1"></div><div id="win_a_'+id+'" class="wi'+style+'s9"></div></td>'+
'</tr>'+
'</table>';
//Âåøàåì îêíî
nw = '<div class="w1" '+acts[0]+' id="win_'+id+'">'+nw+'</div>';
$('#windows').html($('#windows').html()+nw);
$('#win_'+id).center();
if(type == 2 || type == 3) {
if(type == 2) {
$('#winyesbtnfox'+id).focus();
}
}
}
delete nw;
},
addaction:function(nm,vl) {
top.key_actions[nm] = vl;
if(nm != 2) {
top.key_actions[2] = 1;
}
},
closew:function(id)
{
$('#win_'+id).html('');
$('#win_'+id).remove();
}
}
+137
View File
@@ -0,0 +1,137 @@
/* jQuery Image Magnify script v1.1
* This notice must stay intact for usage
* Author: Dynamic Drive at https://www.dynamicdrive.com/
* Visit https://www.dynamicdrive.com/ for full source code
* Nov 16th, 09 (v1.1): Adds ability to dynamically apply/reapply magnify effect to an image, plus magnify to a specific width in pixels.
* Feb 8th, 11 (v1.11): Fixed bug that caused script to not work in newever versions of jQuery (ie: v1.4.4)
*/
jQuery.noConflict()
jQuery.imageMagnify={
dsettings: {
magnifyby: 5, //óìîë÷àíèþ óâåëè÷åíèå ôàêòîðà óâåëè÷åííîå èçîáðàæåíèå
duration: 500, //ïî óìîë÷àíèþ ïðîäîëæèòåëüíîñòü àíèìàöèè, â ìñåê
imgopacity: 0.2 //opacify îðèãèíàëüíîãî èçîáðàæåíèÿ, êîãäà óâåëè÷åííîå èçîáðàæåíèå íàêëàäûâàåòñÿ îí
},
cursorcss: 'url(https://new-combats.com/magnify.cur), -moz-zoom-in', //Çíà÷åíèå àòðèáóòà CSS â "Êóðñîð", â äîïîëíåíèå ê èñõîäíîìó èçîáðàæåíèþ
zIndexcounter: 100,
refreshoffsets:function($window, $target, warpshell){
var $offsets=$target.offset()
var winattrs={x:$window.scrollLeft(), y:$window.scrollTop(), w:$window.width(), h:$window.height()}
warpshell.attrs.x=$offsets.left //update x position of original image relative to page
warpshell.attrs.y=$offsets.top
warpshell.newattrs.x=winattrs.x+winattrs.w/2-warpshell.newattrs.w/2
warpshell.newattrs.y=winattrs.y+winattrs.h/2-warpshell.newattrs.h/2
if (warpshell.newattrs.x<winattrs.x+5){ //no space to the left?
warpshell.newattrs.x=winattrs.x+5
}
else if (warpshell.newattrs.x+warpshell.newattrs.w > winattrs.x+winattrs.w){//no space to the right?
warpshell.newattrs.x=winattrs.x+5
}
if (warpshell.newattrs.y<winattrs.y+5){ //no space at the top?
warpshell.newattrs.y=winattrs.y+5
}
},
magnify:function($, $target, options){
var setting={} //create blank object to store combined settings
var setting=jQuery.extend(setting, this.dsettings, options)
var attrs=(options.thumbdimensions)? {w:options.thumbdimensions[0], h:options.thumbdimensions[1]} : {w:$target.outerWidth(), h:$target.outerHeight()}
var newattrs={}
newattrs.w=(setting.magnifyto)? setting.magnifyto : Math.round(attrs.w*setting.magnifyby)
newattrs.h=(setting.magnifyto)? Math.round(attrs.h*newattrs.w/attrs.w) : Math.round(attrs.h*setting.magnifyby)
$target.css('cursor', jQuery.imageMagnify.cursorcss)
if ($target.data('imgshell')){
$target.data('imgshell').$clone.remove()
$target.css({opacity:1}).unbind('click.magnify')
}
var $clone=$target.clone().css({position:'absolute', left:0, top:0, visibility:'hidden', border:'1px solid gray', cursor:'pointer'}).appendTo(document.body)
$clone.data('$relatedtarget', $target) //save $target image this enlarged image is associated with
$target.data('imgshell', {$clone:$clone, attrs:attrs, newattrs:newattrs})
$target.bind('click.magnify', function(e){ //action when original image is clicked on
var $this=$(this).css({opacity:setting.imgopacity})
var imageinfo=$this.data('imgshell')
jQuery.imageMagnify.refreshoffsets($(window), $this, imageinfo) //refresh offset positions of original and warped images
var $clone=imageinfo.$clone
$clone.stop().css({zIndex:++jQuery.imageMagnify.zIndexcounter, left:imageinfo.attrs.x, top:imageinfo.attrs.y, width:imageinfo.attrs.w, height:imageinfo.attrs.h, opacity:0, visibility:'visible', display:'block'})
.animate({opacity:1, left:imageinfo.newattrs.x, top:imageinfo.newattrs.y, width:imageinfo.newattrs.w, height:imageinfo.newattrs.h}, setting.duration,
function(){ //callback function after warping is complete
//none added
}) //end animate
}) //end click
$clone.click(function(e){ //action when magnified image is clicked on
var $this=$(this)
var imageinfo=$this.data('$relatedtarget').data('imgshell')
jQuery.imageMagnify.refreshoffsets($(window), $this.data('$relatedtarget'), imageinfo) //refresh offset positions of original and warped images
$this.stop().animate({opacity:0, left:imageinfo.attrs.x, top:imageinfo.attrs.y, width:imageinfo.attrs.w, height:imageinfo.attrs.h}, setting.duration,
function(){
$this.hide()
$this.data('$relatedtarget').css({opacity:1}) //reveal original image
}) //end animate
}) //end click
}
};
jQuery.fn.imageMagnify=function(options){
var $=jQuery
return this.each(function(){ //return jQuery obj
var $imgref=$(this)
if (this.tagName!="IMG")
return true //skip to next matched element
if (parseInt($imgref.css('width'))>0 && parseInt($imgref.css('height'))>0 || options.thumbdimensions){ //if image has explicit width/height attrs defined
jQuery.imageMagnify.magnify($, $imgref, options)
}
else if (this.complete){ //account for IE not firing image.onload
jQuery.imageMagnify.magnify($, $imgref, options)
}
else{
$(this).bind('load', function(){
jQuery.imageMagnify.magnify($, $imgref, options)
})
}
})
};
jQuery.fn.applyMagnifier=function(options){ //dynamic version of imageMagnify() to apply magnify effect to an image dynamically
var $=jQuery
return this.each(function(){ //return jQuery obj
var $imgref=$(this)
if (this.tagName!="IMG")
return true //skip to next matched element
})
};
//** The following applies the magnify effect to images with class="magnify" and optional "data-magnifyby" and "data-magnifyduration" attrs
//** It also looks for links with attr rel="magnify[targetimageid]" and makes them togglers for that image
jQuery(document).ready(function($){
var $targets=$('.magnify')
$targets.each(function(i){
var $target=$(this)
var options={}
if ($target.attr('data-magnifyto'))
options.magnifyto=parseFloat($target.attr('data-magnifyto'))
if ($target.attr('data-magnifyby'))
options.magnifyby=parseFloat($target.attr('data-magnifyby'))
if ($target.attr('data-magnifyduration'))
options.duration=parseInt($target.attr('data-magnifyduration'))
$target.imageMagnify(options)
})
var $triggers=$('a[rel^="magnify["]')
$triggers.each(function(i){
var $trigger=$(this)
var targetid=$trigger.attr('rel').match(/\[.+\]/)[0].replace(/[\[\]']/g, '') //parse 'id' from rel='magnify[id]'
$trigger.data('magnifyimageid', targetid)
$trigger.click(function(e){
$('#'+$(this).data('magnifyimageid')).trigger('click.magnify')
e.preventDefault()
})
})
})
+7181
View File
File diff suppressed because it is too large Load Diff
+152
View File
@@ -0,0 +1,152 @@
/*!
* FireHint plugin for jQuery
* https://github.com/nikolay-zakharov/jquery-fireHint
*
* Copyright 2012, Nikolay Zakharov <nickolay.zakharov@gmail.com>
* Date: Thu June 28 21:44:17 2012 +0400
*/
(function($) {
$.fn.fireHint = function(custom_config) {
// Default configuration
var default_config = {
elements: {
header: [],// DOM elements list that will be placed inside `strong.firehint-header` element of the hint
body: []// DOM elements list that will be placed inside `div.firehint-content-body` element of the hint
},
timeouts: {
hide: 5000,// Hint will disapper after (ms)
slide: 300,// Hint will get animation for (ms)
fade: 70// Hint will disappear during (ms) /starts animation is finished/
},
rows: {
count: 2,
position: 'bl',// `tr` means Top-Right. Also available: `tl` (top-left), `br` (bottom-right), `bl` (bottom-left)
minTop: 20,// Vertical limits of set of hints
maxTop: 20// Vertical limits of set of hints
},
cells: {
margins: {// Gap between hints
vertical: 30,// ...vertical
horizontal: 20// ,.,horizontal
},
width: 352
},
additionalClasses: {
'.firehint-msg-box': [],// You can assign custom css classes for messagebox
'.firehint-header': [],// ...or just header
'.firehint-content-body': []// ...or just content body
},
bindings: {// Here you can configure custom events. Object mask as a Key and object as a Value.
// This object (Value) has event name as a Key and `function(Event){...}` as a Value.
// You are able to bind any behaviour to any DOM Object inside main message-box (`.firehint-msg-box`) or to its own
'.firehint-msg-box': {
selectstart: function(evt){ evt.preventDefault(); },
mouseenter: function(evt){ $(evt.target).animate(config.css_states.hover, config.timeouts.fade); },
mouseleave: function(evt){ $(evt.target).animate(config.css_states.general, config.timeouts.fade); }
},
'.firehint-infadable': {
mouseenter: function(evt){ $(evt.target).parents('.firehint-msg-box:first').trigger('mouseleave'); },
mouseleave: function(evt){ $(evt.target).parents('.firehint-msg-box:first').trigger('mouseenter'); }
}
},
css_states: {
general: { opacity: 0.85 },
hover: { opacity: 1 }
}
};
var config = $.extend(true, null, default_config, custom_config);
// Running plugin
return this.each(function(ind, msg_box_blank_element){
var msg_box_unique_id = (new Date()).getTime()+'_'+(Math.round(Math.random()*8999-(-1000)));
var msg_box_element = $(msg_box_blank_element).clone().appendTo(document.body).data('uid', msg_box_unique_id);
// Setting timeout for message box to hide
var current_box_interval = window.setTimeout(function(){
var current_message_box_height = $(msg_box_element).height();
// Tells about freed space
document.fireHint.rows[row_ind].free -= -(config.cells.margins.vertical - (- current_message_box_height));
document.fireHint.rows[row_ind].occupied -= (current_message_box_height - (- config.cells.margins.vertical));
document.fireHint.rows[$(msg_box_element).data('row_index')].message_boxes[msg_box_unique_id] = undefined;
// Slide top (or bottom) other message boxes inside current row
if(typeof config.timeouts.slide == 'number' && config.timeouts.slide > 0){
for(var uid in document.fireHint.rows[$(msg_box_element).data('row_index')].message_boxes){
var some_message_box = document.fireHint.rows[$(msg_box_element).data('row_index')].message_boxes[uid];
if(typeof some_message_box != 'undefined'){
some_message_box.animate({
top: $(some_message_box).position().top + (config.cells.margins.vertical - (- current_message_box_height))
}, config.timeouts.slide);
}
}
}
$(msg_box_element).fadeOut().remove();
}, config.timeouts.hide);
// Technical data, being used by timeout callback function
if(typeof document.fireHint == 'undefined'){ document.fireHint = { active_timeouts: {}, rows: {} }; }
if(typeof document.fireHint.active_timeouts[msg_box_unique_id] != 'undefined'){
window.clearTimeout(document.fireHint.active_timeouts[msg_box_unique_id]);
document.fireHint.active_timeouts[msg_box_unique_id] = undefined;
}
document.fireHint.active_timeouts[msg_box_unique_id] = current_box_interval;
// Technical data, being used on looking for place for a message boxes
for(var row_ind=1; row_ind<=config.rows.count; row_ind++){
if(typeof document.fireHint.rows[row_ind] == 'undefined'){
document.fireHint.rows[row_ind] = {
free: $(window).height() - config.rows.minTop,
occupied: 0,
message_boxes: {}
};
}
}
// Applies additional classes and appends header and body elements
$.each(config.elements.header, function(header_ind, header_item){ $('.firehint-header', msg_box_element).append(header_item); });
$.each(config.elements.body, function(body_ind, body_item){ $('.firehint-content-body', msg_box_element).append(body_item); });
$.each(config.additionalClasses, function(element_mask, classes_list){
$(msg_box_element)
.filter(element_mask).addClass( classes_list.join(' ')).end()
.find(element_mask).addClass( classes_list.join(' ') );
});
// Applying general style for a message box
$(msg_box_element).css(config.css_states.general)
// Binding callbacks
$.each(config.bindings, function(element_mask, bindings_list){
$.each(bindings_list, function(event_name, callback_func){
$(msg_box_element)
.filter(element_mask).bind(event_name, callback_func).end()
.find(element_mask).bind(event_name, callback_func);
});
});
// Looking for a place for current message box
var current_message_box_height = $(msg_box_element).height();
for(var row_ind=1; row_ind<=config.rows.count; row_ind++){
if(document.fireHint.rows[row_ind].free >= current_message_box_height - (- config.cells.margins.vertical)){
$(msg_box_element).data('row_index', row_ind);
$(msg_box_element).css({
//top: ($(window).height() - config.cells.margins.vertical - current_message_box_height - 30 - document.fireHint.rows[row_ind].occupied) +'px',
top: ($(window).height() - config.cells.margins.vertical - current_message_box_height - 30 - document.fireHint.rows[row_ind].occupied) +'px',
left: ((row_ind)*config.cells.width - config.cells.width + 10) +'px'
}).show();
document.fireHint.rows[row_ind].free -= current_message_box_height - (- config.cells.margins.vertical);
document.fireHint.rows[row_ind].occupied -= - config.cells.margins.vertical - current_message_box_height;
document.fireHint.rows[row_ind].message_boxes[msg_box_unique_id] = msg_box_element;
break;
}
}
if($(msg_box_element).filter(':visible').length == 0){
console.log('NO_SPACE_FOR_A_MESSAGE_BOX')
}
});
}
})(jQuery);
File diff suppressed because one or more lines are too long
+969
View File
@@ -0,0 +1,969 @@
/**
* Ajax Autocomplete for jQuery, version 1.2.16
* (c) 2014 Tomas Kirda
*
* Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
* For details, see the web site: https://github.com/devbridge/jQuery-Autocomplete
*/
(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else if (typeof exports === 'object' && typeof require === 'function') {
factory(require('jquery'));
} else {
factory(jQuery);
}
}(function ($) {
'use strict';
var
utils = (function () {
return {
escapeRegExChars: function (value) {
return value.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
},
createNode: function (containerClass) {
var div = document.createElement('div');
div.className = containerClass;
div.style.position = 'absolute';
div.style.display = 'none';
return div;
}
};
}()),
keys = {
ESC: 27,
TAB: 9,
RETURN: 13,
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40
};
function Autocomplete(el, options) {
var noop = function () { },
that = this,
defaults = {
ajaxSettings: {},
autoSelectFirst: false,
appendTo: document.body,
serviceUrl: null,
lookup: null,
onSelect: null,
width: 'auto',
minChars: 1,
maxHeight: 300,
deferRequestBy: 0,
params: {},
formatResult: Autocomplete.formatResult,
delimiter: null,
zIndex: 9999,
type: 'GET',
noCache: false,
onSearchStart: noop,
onSearchComplete: noop,
onSearchError: noop,
preserveInput: false,
containerClass: 'autocomplete-suggestions',
tabDisabled: false,
dataType: 'text',
currentRequest: null,
triggerSelectOnValidInput: true,
preventBadQueries: true,
lookupFilter: function (suggestion, originalQuery, queryLowerCase) {
return suggestion.value.toLowerCase().indexOf(queryLowerCase) !== -1;
},
paramName: 'query',
transformResult: function (response) {
return typeof response === 'string' ? $.parseJSON(response) : response;
},
showNoSuggestionNotice: false,
noSuggestionNotice: 'No results',
orientation: 'bottom',
forceFixPosition: false
};
// Shared variables:
that.element = el;
that.el = $(el);
that.suggestions = [];
that.badQueries = [];
that.selectedIndex = -1;
that.currentValue = that.element.value;
that.intervalId = 0;
that.cachedResponse = {};
that.onChangeInterval = null;
that.onChange = null;
that.isLocal = false;
that.suggestionsContainer = null;
that.noSuggestionsContainer = null;
that.options = $.extend({}, defaults, options);
that.classes = {
selected: 'autocomplete-selected',
suggestion: 'autocomplete-suggestion'
};
that.hint = null;
that.hintValue = '';
that.selection = null;
// Initialize and set options:
that.initialize();
that.setOptions(options);
}
Autocomplete.utils = utils;
$.Autocomplete = Autocomplete;
Autocomplete.formatResult = function (suggestion, currentValue) {
var pattern = '(' + utils.escapeRegExChars(currentValue) + ')';
return suggestion.value.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
};
Autocomplete.prototype = {
killerFn: null,
initialize: function () {
var that = this,
suggestionSelector = '.' + that.classes.suggestion,
selected = that.classes.selected,
options = that.options,
container;
// Remove autocomplete attribute to prevent native suggestions:
that.element.setAttribute('autocomplete', 'off');
that.killerFn = function (e) {
if ($(e.target).closest('.' + that.options.containerClass).length === 0) {
that.killSuggestions();
that.disableKillerFn();
}
};
// html() deals with many types: htmlString or Element or Array or jQuery
that.noSuggestionsContainer = $('<div class="autocomplete-no-suggestion"></div>')
.html(this.options.noSuggestionNotice).get(0);
that.suggestionsContainer = Autocomplete.utils.createNode(options.containerClass);
container = $(that.suggestionsContainer);
container.appendTo(options.appendTo);
// Only set width if it was provided:
if (options.width !== 'auto') {
container.width(options.width);
}
// Listen for mouse over event on suggestions list:
container.on('mouseover.autocomplete', suggestionSelector, function () {
that.activate($(this).data('index'));
});
// Deselect active element when mouse leaves suggestions container:
container.on('mouseout.autocomplete', function () {
that.selectedIndex = -1;
container.children('.' + selected).removeClass(selected);
});
// Listen for click event on suggestions list:
container.on('click.autocomplete', suggestionSelector, function () {
that.select($(this).data('index'));
});
that.fixPositionCapture = function () {
if (that.visible) {
that.fixPosition();
}
};
$(window).on('resize.autocomplete', that.fixPositionCapture);
that.el.on('keydown.autocomplete', function (e) { that.onKeyPress(e); });
that.el.on('keyup.autocomplete', function (e) { that.onKeyUp(e); });
that.el.on('blur.autocomplete', function () { that.onBlur(); });
that.el.on('focus.autocomplete', function () { that.onFocus(); });
that.el.on('change.autocomplete', function (e) { that.onKeyUp(e); });
that.el.on('input.autocomplete', function (e) { that.onKeyUp(e); });
},
onFocus: function () {
var that = this;
that.fixPosition();
if (that.options.minChars <= that.el.val().length) {
that.onValueChange();
}
},
onBlur: function () {
this.enableKillerFn();
},
setOptions: function (suppliedOptions) {
var that = this,
options = that.options;
$.extend(options, suppliedOptions);
that.isLocal = $.isArray(options.lookup);
if (that.isLocal) {
options.lookup = that.verifySuggestionsFormat(options.lookup);
}
options.orientation = that.validateOrientation(options.orientation, 'bottom');
// Adjust height, width and z-index:
$(that.suggestionsContainer).css({
'max-height': options.maxHeight + 'px',
'width': options.width + 'px',
'z-index': options.zIndex
});
},
clearCache: function () {
this.cachedResponse = {};
this.badQueries = [];
},
clear: function () {
this.clearCache();
this.currentValue = '';
this.suggestions = [];
},
disable: function () {
var that = this;
that.disabled = true;
clearInterval(that.onChangeInterval);
if (that.currentRequest) {
that.currentRequest.abort();
}
},
enable: function () {
this.disabled = false;
},
fixPosition: function () {
// Use only when container has already its content
var that = this,
$container = $(that.suggestionsContainer),
containerParent = $container.parent().get(0);
// Fix position automatically when appended to body.
// In other cases force parameter must be given.
if (containerParent !== document.body && !that.options.forceFixPosition) {
return;
}
// Choose orientation
var orientation = that.options.orientation,
containerHeight = $container.outerHeight(),
height = that.el.outerHeight(),
offset = that.el.offset(),
styles = { 'top': offset.top, 'left': offset.left };
if (orientation === 'auto') {
var viewPortHeight = $(window).height(),
scrollTop = $(window).scrollTop(),
topOverflow = -scrollTop + offset.top - containerHeight,
bottomOverflow = scrollTop + viewPortHeight - (offset.top + height + containerHeight);
orientation = (Math.max(topOverflow, bottomOverflow) === topOverflow) ? 'top' : 'bottom';
}
if (orientation === 'top') {
styles.top += -containerHeight;
} else {
styles.top += height;
}
// If container is not positioned to body,
// correct its position using offset parent offset
if(containerParent !== document.body) {
var opacity = $container.css('opacity'),
parentOffsetDiff;
if (!that.visible){
$container.css('opacity', 0).show();
}
parentOffsetDiff = $container.offsetParent().offset();
styles.top -= parentOffsetDiff.top;
styles.left -= parentOffsetDiff.left;
if (!that.visible){
$container.css('opacity', opacity).hide();
}
}
// -2px to account for suggestions border.
if (that.options.width === 'auto') {
styles.width = (that.el.outerWidth() - 2) + 'px';
}
$container.css(styles);
},
enableKillerFn: function () {
var that = this;
$(document).on('click.autocomplete', that.killerFn);
},
disableKillerFn: function () {
var that = this;
$(document).off('click.autocomplete', that.killerFn);
},
killSuggestions: function () {
var that = this;
that.stopKillSuggestions();
that.intervalId = window.setInterval(function () {
that.hide();
that.stopKillSuggestions();
}, 50);
},
stopKillSuggestions: function () {
window.clearInterval(this.intervalId);
},
isCursorAtEnd: function () {
var that = this,
valLength = that.el.val().length,
selectionStart = that.element.selectionStart,
range;
if (typeof selectionStart === 'number') {
return selectionStart === valLength;
}
if (document.selection) {
range = document.selection.createRange();
range.moveStart('character', -valLength);
return valLength === range.text.length;
}
return true;
},
onKeyPress: function (e) {
var that = this;
// If suggestions are hidden and user presses arrow down, display suggestions:
if (!that.disabled && !that.visible && e.which === keys.DOWN && that.currentValue) {
that.suggest();
return;
}
if (that.disabled || !that.visible) {
return;
}
switch (e.which) {
case keys.ESC:
that.el.val(that.currentValue);
that.hide();
break;
case keys.RIGHT:
if (that.hint && that.options.onHint && that.isCursorAtEnd()) {
that.selectHint();
break;
}
return;
case keys.TAB:
if (that.hint && that.options.onHint) {
that.selectHint();
return;
}
if (that.selectedIndex === -1) {
that.hide();
return;
}
that.select(that.selectedIndex);
if (that.options.tabDisabled === false) {
return;
}
break;
case keys.RETURN:
if (that.selectedIndex === -1) {
that.hide();
return;
}
that.select(that.selectedIndex);
break;
case keys.UP:
that.moveUp();
break;
case keys.DOWN:
that.moveDown();
break;
default:
return;
}
// Cancel event if function did not return:
e.stopImmediatePropagation();
e.preventDefault();
},
onKeyUp: function (e) {
var that = this;
if (that.disabled) {
return;
}
switch (e.which) {
case keys.UP:
case keys.DOWN:
return;
}
clearInterval(that.onChangeInterval);
if (that.currentValue !== that.el.val()) {
that.findBestHint();
if (that.options.deferRequestBy > 0) {
// Defer lookup in case when value changes very quickly:
that.onChangeInterval = setInterval(function () {
that.onValueChange();
}, that.options.deferRequestBy);
} else {
that.onValueChange();
}
}
},
onValueChange: function () {
var that = this,
options = that.options,
value = that.el.val(),
query = that.getQuery(value),
index;
if (that.selection && that.currentValue !== query) {
that.selection = null;
(options.onInvalidateSelection || $.noop).call(that.element);
}
clearInterval(that.onChangeInterval);
that.currentValue = value;
that.selectedIndex = -1;
// Check existing suggestion for the match before proceeding:
if (options.triggerSelectOnValidInput) {
index = that.findSuggestionIndex(query);
if (index !== -1) {
that.select(index);
return;
}
}
if (query.length < options.minChars) {
that.hide();
} else {
that.getSuggestions(query);
}
},
findSuggestionIndex: function (query) {
var that = this,
index = -1,
queryLowerCase = query.toLowerCase();
$.each(that.suggestions, function (i, suggestion) {
if (suggestion.value.toLowerCase() === queryLowerCase) {
index = i;
return false;
}
});
return index;
},
getQuery: function (value) {
var delimiter = this.options.delimiter,
parts;
if (!delimiter) {
return value;
}
parts = value.split(delimiter);
return $.trim(parts[parts.length - 1]);
},
getSuggestionsLocal: function (query) {
var that = this,
options = that.options,
queryLowerCase = query.toLowerCase(),
filter = options.lookupFilter,
limit = parseInt(options.lookupLimit, 10),
data;
data = {
suggestions: $.grep(options.lookup, function (suggestion) {
return filter(suggestion, query, queryLowerCase);
})
};
if (limit && data.suggestions.length > limit) {
data.suggestions = data.suggestions.slice(0, limit);
}
return data;
},
getSuggestions: function (q) {
var response,
that = this,
options = that.options,
serviceUrl = options.serviceUrl,
params,
cacheKey,
ajaxSettings;
options.params[options.paramName] = q;
params = options.ignoreParams ? null : options.params;
if (options.onSearchStart.call(that.element, options.params) === false) {
return;
}
if ($.isFunction(options.lookup)){
options.lookup(q, function (data) {
that.suggestions = data.suggestions;
that.suggest();
options.onSearchComplete.call(that.element, q, data.suggestions);
});
return;
}
if (that.isLocal) {
response = that.getSuggestionsLocal(q);
} else {
if ($.isFunction(serviceUrl)) {
serviceUrl = serviceUrl.call(that.element, q);
}
cacheKey = serviceUrl + '?' + $.param(params || {});
response = that.cachedResponse[cacheKey];
}
if (response && $.isArray(response.suggestions)) {
that.suggestions = response.suggestions;
that.suggest();
options.onSearchComplete.call(that.element, q, response.suggestions);
} else if (!that.isBadQuery(q)) {
if (that.currentRequest) {
that.currentRequest.abort();
}
ajaxSettings = {
url: serviceUrl,
data: params,
type: options.type,
dataType: options.dataType
};
$.extend(ajaxSettings, options.ajaxSettings);
that.currentRequest = $.ajax(ajaxSettings).done(function (data) {
var result;
that.currentRequest = null;
result = options.transformResult(data);
that.processResponse(result, q, cacheKey);
options.onSearchComplete.call(that.element, q, result.suggestions);
}).fail(function (jqXHR, textStatus, errorThrown) {
options.onSearchError.call(that.element, q, jqXHR, textStatus, errorThrown);
});
} else {
options.onSearchComplete.call(that.element, q, []);
}
},
isBadQuery: function (q) {
if (!this.options.preventBadQueries){
return false;
}
var badQueries = this.badQueries,
i = badQueries.length;
while (i--) {
if (q.indexOf(badQueries[i]) === 0) {
return true;
}
}
return false;
},
hide: function () {
var that = this;
that.visible = false;
that.selectedIndex = -1;
clearInterval(that.onChangeInterval);
$(that.suggestionsContainer).hide();
that.signalHint(null);
},
suggest: function () {
if (this.suggestions.length === 0) {
if (this.options.showNoSuggestionNotice) {
this.noSuggestions();
} else {
this.hide();
}
return;
}
var that = this,
options = that.options,
groupBy = options.groupBy,
formatResult = options.formatResult,
value = that.getQuery(that.currentValue),
className = that.classes.suggestion,
classSelected = that.classes.selected,
container = $(that.suggestionsContainer),
noSuggestionsContainer = $(that.noSuggestionsContainer),
beforeRender = options.beforeRender,
html = '',
category,
formatGroup = function (suggestion, index) {
var currentCategory = suggestion.data[groupBy];
if (category === currentCategory){
return '';
}
category = currentCategory;
return '<div class="autocomplete-group"><strong>' + category + '</strong></div>';
},
index;
if (options.triggerSelectOnValidInput) {
index = that.findSuggestionIndex(value);
if (index !== -1) {
that.select(index);
return;
}
}
// Build suggestions inner HTML:
$.each(that.suggestions, function (i, suggestion) {
if (groupBy){
html += formatGroup(suggestion, value, i);
}
html += '<div class="' + className + '" data-index="' + i + '">' + formatResult(suggestion, value) + '</div>';
});
this.adjustContainerWidth();
noSuggestionsContainer.detach();
container.html(html);
if ($.isFunction(beforeRender)) {
beforeRender.call(that.element, container);
}
that.fixPosition();
container.show();
// Select first value by default:
if (options.autoSelectFirst) {
that.selectedIndex = 0;
container.scrollTop(0);
container.children().first().addClass(classSelected);
}
that.visible = true;
that.findBestHint();
},
noSuggestions: function() {
var that = this,
container = $(that.suggestionsContainer),
noSuggestionsContainer = $(that.noSuggestionsContainer);
this.adjustContainerWidth();
// Some explicit steps. Be careful here as it easy to get
// noSuggestionsContainer removed from DOM if not detached properly.
noSuggestionsContainer.detach();
container.empty(); // clean suggestions if any
container.append(noSuggestionsContainer);
that.fixPosition();
container.show();
that.visible = true;
},
adjustContainerWidth: function() {
var that = this,
options = that.options,
width,
container = $(that.suggestionsContainer);
// If width is auto, adjust width before displaying suggestions,
// because if instance was created before input had width, it will be zero.
// Also it adjusts if input width has changed.
// -2px to account for suggestions border.
if (options.width === 'auto') {
width = that.el.outerWidth() - 2;
container.width(width > 0 ? width : 300);
}
},
findBestHint: function () {
var that = this,
value = that.el.val().toLowerCase(),
bestMatch = null;
if (!value) {
return;
}
$.each(that.suggestions, function (i, suggestion) {
var foundMatch = suggestion.value.toLowerCase().indexOf(value) === 0;
if (foundMatch) {
bestMatch = suggestion;
}
return !foundMatch;
});
that.signalHint(bestMatch);
},
signalHint: function (suggestion) {
var hintValue = '',
that = this;
if (suggestion) {
hintValue = that.currentValue + suggestion.value.substr(that.currentValue.length);
}
if (that.hintValue !== hintValue) {
that.hintValue = hintValue;
that.hint = suggestion;
(this.options.onHint || $.noop)(hintValue);
}
},
verifySuggestionsFormat: function (suggestions) {
// If suggestions is string array, convert them to supported format:
if (suggestions.length && typeof suggestions[0] === 'string') {
return $.map(suggestions, function (value) {
return { value: value, data: null };
});
}
return suggestions;
},
validateOrientation: function(orientation, fallback) {
orientation = $.trim(orientation || '').toLowerCase();
if($.inArray(orientation, ['auto', 'bottom', 'top']) === -1){
orientation = fallback;
}
return orientation;
},
processResponse: function (result, originalQuery, cacheKey) {
var that = this,
options = that.options;
result.suggestions = that.verifySuggestionsFormat(result.suggestions);
// Cache results if cache is not disabled:
if (!options.noCache) {
that.cachedResponse[cacheKey] = result;
if (options.preventBadQueries && result.suggestions.length === 0) {
that.badQueries.push(originalQuery);
}
}
// Return if originalQuery is not matching current query:
if (originalQuery !== that.getQuery(that.currentValue)) {
return;
}
that.suggestions = result.suggestions;
that.suggest();
},
activate: function (index) {
var that = this,
activeItem,
selected = that.classes.selected,
container = $(that.suggestionsContainer),
children = container.find('.' + that.classes.suggestion);
container.find('.' + selected).removeClass(selected);
that.selectedIndex = index;
if (that.selectedIndex !== -1 && children.length > that.selectedIndex) {
activeItem = children.get(that.selectedIndex);
$(activeItem).addClass(selected);
return activeItem;
}
return null;
},
selectHint: function () {
var that = this,
i = $.inArray(that.hint, that.suggestions);
that.select(i);
},
select: function (i) {
var that = this;
that.hide();
that.onSelect(i);
},
moveUp: function () {
var that = this;
if (that.selectedIndex === -1) {
return;
}
if (that.selectedIndex === 0) {
$(that.suggestionsContainer).children().first().removeClass(that.classes.selected);
that.selectedIndex = -1;
that.el.val(that.currentValue);
that.findBestHint();
return;
}
that.adjustScroll(that.selectedIndex - 1);
},
moveDown: function () {
var that = this;
if (that.selectedIndex === (that.suggestions.length - 1)) {
return;
}
that.adjustScroll(that.selectedIndex + 1);
},
adjustScroll: function (index) {
var that = this,
activeItem = that.activate(index);
if (!activeItem) {
return;
}
var offsetTop,
upperBound,
lowerBound,
heightDelta = $(activeItem).outerHeight();
offsetTop = activeItem.offsetTop;
upperBound = $(that.suggestionsContainer).scrollTop();
lowerBound = upperBound + that.options.maxHeight - heightDelta;
if (offsetTop < upperBound) {
$(that.suggestionsContainer).scrollTop(offsetTop);
} else if (offsetTop > lowerBound) {
$(that.suggestionsContainer).scrollTop(offsetTop - that.options.maxHeight + heightDelta);
}
if (!that.options.preserveInput) {
that.el.val(that.getValue(that.suggestions[index].value));
}
that.signalHint(null);
},
onSelect: function (index) {
var that = this,
onSelectCallback = that.options.onSelect,
suggestion = that.suggestions[index];
that.currentValue = that.getValue(suggestion.value);
if (that.currentValue !== that.el.val() && !that.options.preserveInput) {
that.el.val(that.currentValue);
}
that.signalHint(null);
that.suggestions = [];
that.selection = suggestion;
if ($.isFunction(onSelectCallback)) {
onSelectCallback.call(that.element, suggestion);
}
},
getValue: function (value) {
var that = this,
delimiter = that.options.delimiter,
currentValue,
parts;
if (!delimiter) {
return value;
}
currentValue = that.currentValue;
parts = currentValue.split(delimiter);
if (parts.length === 1) {
return value;
}
return currentValue.substr(0, currentValue.length - parts[parts.length - 1].length) + value;
},
dispose: function () {
var that = this;
that.el.off('.autocomplete').removeData('autocomplete');
that.disableKillerFn();
$(window).off('resize.autocomplete', that.fixPositionCapture);
$(that.suggestionsContainer).remove();
}
};
// Create chainable jQuery plugin:
$.fn.autocomplete = $.fn.devbridgeAutocomplete = function (options, args) {
var dataKey = 'autocomplete';
// If function invoked without argument return
// instance of the first matched element:
if (arguments.length === 0) {
return this.first().data(dataKey);
}
return this.each(function () {
var inputElement = $(this),
instance = inputElement.data(dataKey);
if (typeof options === 'string') {
if (instance && typeof instance[options] === 'function') {
instance[options](args);
}
} else {
// If instance already exists, destroy it:
if (instance && instance.dispose) {
instance.dispose();
}
instance = new Autocomplete(this, options);
inputElement.data(dataKey, instance);
}
});
};
}));
+117
View File
@@ -0,0 +1,117 @@
/*!
* jQuery Cookie Plugin v1.4.1
* https://github.com/carhartl/jquery-cookie
*
* Copyright 2006, 2014 Klaus Hartl
* Released under the MIT license
*/
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD
define(['jquery'], factory);
} else if (typeof exports === 'object') {
// CommonJS
factory(require('jquery'));
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {
var pluses = /\+/g;
function encode(s) {
return config.raw ? s : encodeURIComponent(s);
}
function decode(s) {
return config.raw ? s : decodeURIComponent(s);
}
function stringifyCookieValue(value) {
return encode(config.json ? JSON.stringify(value) : String(value));
}
function parseCookieValue(s) {
if (s.indexOf('"') === 0) {
// This is a quoted cookie as according to RFC2068, unescape...
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
}
try {
// Replace server-side written pluses with spaces.
// If we can't decode the cookie, ignore it, it's unusable.
// If we can't parse the cookie, ignore it, it's unusable.
s = decodeURIComponent(s.replace(pluses, ' '));
return config.json ? JSON.parse(s) : s;
} catch(e) {}
}
function read(s, converter) {
var value = config.raw ? s : parseCookieValue(s);
return $.isFunction(converter) ? converter(value) : value;
}
var config = $.cookie = function (key, value, options) {
// Write
if (arguments.length > 1 && !$.isFunction(value)) {
options = $.extend({}, config.defaults, options);
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setTime(+t + days * 864e+5);
}
return (document.cookie = [
encode(key), '=', stringifyCookieValue(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// Read
var result = key ? undefined : {};
// To prevent the for loop in the first place assign an empty array
// in case there are no cookies at all. Also prevents odd result when
// calling $.cookie().
var cookies = document.cookie ? document.cookie.split('; ') : [];
for (var i = 0, l = cookies.length; i < l; i++) {
var parts = cookies[i].split('=');
var name = decode(parts.shift());
var cookie = parts.join('=');
if (key && key === name) {
// If second argument (value) is a function it's a converter...
result = read(cookie, value);
break;
}
// Prevent storing a cookie that we couldn't decode.
if (!key && (cookie = read(cookie)) !== undefined) {
result[name] = cookie;
}
}
return result;
};
config.defaults = {};
$.removeCookie = function (key, options) {
if ($.cookie(key) === undefined) {
return false;
}
// Must not alter options, thus extending a fresh object...
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
return !$.cookie(key);
};
}));
+51
View File
@@ -0,0 +1,51 @@
/**
* Cookie plugin
*
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* https://www.opensource.org/licenses/mit-license.php
* https://www.gnu.org/licenses/gpl.html
*
*/
jQuery.cookie = function(name, value, options) {
if (typeof value != 'undefined') { // name and value given, set cookie
options = options || {};
if (value === null) {
value = '';
options.expires = -1;
}
var expires = '';
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
var date;
if (typeof options.expires == 'number') {
date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else {
date = options.expires;
}
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
}
// CAUTION: Needed to parenthesize options.path and options.domain
// in the following expressions, otherwise they evaluate to undefined
// in the packed version for some reason...
var path = options.path ? '; path=' + (options.path) : '';
var domain = options.domain ? '; domain=' + (options.domain) : '';
var secure = options.secure ? '; secure' : '';
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
} else { // only name given, get cookie
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
};
+7181
View File
File diff suppressed because it is too large Load Diff
+138
View File
@@ -0,0 +1,138 @@
var speedLoc = 0;
var sLoc1 = 0;
var sLoc2 = 0;
var tgo = 0;
var tgol = 0;
var rgo_url = 0;
var rgo_nm = '';
function AjaxlocGoLine(){
var line = document.getElementById('MoveLine');
if(line!=undefined){
prc = 100-Math.floor(tgo/tgol*100);
sLoc1 = 64/100*prc;
if(sLoc1<0){
sLoc1 = 0;
}
if(sLoc1>64){
sLoc1 = 64;
}
line.style.width = sLoc1+'px';
if(tgo>0){
tgo -= 1;
setTimeout('AjaxlocGoLine()',100);
}else{
if(rgo_url != 0){
AjaxGoTo(rgo_url);
}
}
if($('#moveto') != null && $('#moveto') != undefined) {
if(rgo_nm != '') {
if( $('#moveto').html() == '' ) {
$('#moveto').css({'display':'','height':'auto'});
$('#moveto').html('<div onclick="AjaxgotoLocationCancel();" style="cursor:pointer;padding:5px;">Âû ïåðåéäåòå â: <b>' + rgo_nm + '</b> (<a onclick="AjaxgotoLocationCancel();" href="javascript:void(0)">îòìåíà</a>)</div>');
}
}else{
$('#moveto').css({'display':'none','height':'1px'});
$('#moveto').html('');
}
}
}
}
function AjaxgoLocal(id,nm) {
rgo_url = id;
rgo_nm = nm;
if($('#moveto') != null && $('#moveto') != undefined && nm != undefined) {
if(rgo_nm != '') {
$('#moveto').css({'display':'','height':'auto'});
$('#moveto').html('<div onclick="AjaxgotoLocationCancel(); return false;" style="cursor:pointer;padding:5px;">Âû ïåðåéäåòå â: <b>' + nm + '</b> (<a onclick="AjaxgotoLocationCancel();" href="javascript:void(0)">îòìåíà</a>)</div>');
if(sLoc1 == 64) {
AjaxGoTo(rgo_url);
}
}else{
$('#moveto').css({'display':'none','height':'1px'});
$('#moveto').html('');
}
}
}
function AjaxgotoLocationCancel() {
rgo_url = 0;
rgo_nm = '';
$('#moveto').css({'display':'none','height':'1px'});
$('#moveto').html('');
}
function AjaxGoTo(url){
$.ajax({
url: url,
cache: false,
dataType: 'json',
success: function (json) {
if(json['status'] == 'success'){
rgo_url = 0;
rgo_nm = '';
tgo = json['location']['tgo'];
tgo1 = json['location']['tgo1'];
ViewLocation(json);
parent.chat.reflesh();
}else if(json['status'] == 'update'){
window.location = '/main.php';
}
}
});
}
function ViewLocation(json){
var html = '<div id="ione" class="' + json['location']['bg'] + '">';
html += '<div class="fl1" style="left:' + json['location']['left'] + 'px;top:' + json['location']['top'] + 'px;" onMouseOver="top.hi(this,\'<div align=right>Âû íàõîäèòåñü â &quot;<b>' + json['location']['name'] + '</b>&quot;</div>\',event,0,1,1,1,\'max-height:240px\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></div>';
for(var i = 0;i < json['goto'].length; i++){
html += '<div class="' + json['goto'][i]['id'] + ' aFilter"';
if(json['goto'][i]['params'][0] && json['goto'][i]['params'][0] != 'false'){
html += ' onMouseOver="top.hi(this,\'<div align=right><b>' + json['goto'][i]['params'][1] + '</b><br>Ñåé÷àñ â êîìíàòå ' + json['goto'][i]['params'][2] + ' ÷åë.</div>\',event,0,1,1,1,\'max-height:240px\');" onMouseOut="top.hic();" onMouseDown="top.hic();" onClick="AjaxgoLocal(\'main.php?mAjax=true&loc=' + json['goto'][i]['params'][0] + '\',\'' + json['goto'][i]['params'][1] + '\');" onClick="location=\'main.php?mAjax=true&loc=' + json['goto'][i]['params'][0] + '\';"';
}else{
html += ' onMouseOver="top.hi(this,\'<div align=right>' + json['goto'][i]['params'][1] + '</div>\',event,0,1,1,1,\'max-height:240px\');" onMouseOut="top.hic();" onMouseDown="top.hic();"';
}
html += '></div>';
}
html += '<div style="position:absolute;top:0px;z-index:101;right:12px;width:80px;"><table height="15" border="0" cellspacing="0" cellpadding="0"><tr><td id="locobobr" rowspan="3" valign="bottom"><a href="main.php?rnd="><img style="display:block;" src="https://img.new-combats.com/i/move/rel_1.gif" width="15" height="16" title="Îáíîâèòü" border="0" /></a></td><td colspan="3"><img style="display:block;" src="https://img.new-combats.com/i/move/navigatin_462s.gif" width="80" height="4" /></td></tr><tr><td><img style="display:block;" src="https://img.new-combats.com/i/move/navigatin_481.gif" width="9" height="8" /></td><td width="64" bgcolor="black"><img src="https://img.new-combats.com/1x1.gif" style="display:block;width:33px;" id="MoveLine" height="8" class="MoveLine" /></td><td><img style="display:block;" src="https://img.new-combats.com/i/move/navigatin_50.gif" width="7" height="8" /></td></tr><tr><td colspan="3"><img style="display:block;" src="https://img.new-combats.com/i/move/navigatin_tt1_532.gif" width="80" height="4" /></td></tr></table><div id="test"></div></div>';
html += '</div>';
$('#ViewLocation').html(html);
// $('#ViewLocation').html(tmpl("vLocation", json));
AjaxlocGoLine();
}
(function(){
var cache = {};
this.tmpl = function tmpl(str, data){
// Figure out if we're getting a template, or if we need to
// load the template - and be sure to cache the result.
var fn = !/\W/.test(str) ?
cache[str] = cache[str] ||
tmpl(document.getElementById(str).innerHTML) :
// Generate a reusable function that will serve as a template
// generator (and which will be cached).
new Function("obj",
"var p=[],print=function(){p.push.apply(p,arguments);};" +
// Introduce the data as local variables using with(){}
"with(obj){p.push('" +
// Convert the template into pure JavaScript
str
.replace(/[\r\t\n]/g, " ")
.split("<%").join("\t")
.replace(/((^|%>)[^\t]*)'/g, "$1\r")
.replace(/\t=(.*?)%>/g, "',$1,'")
.split("\t").join("');")
.split("%>").join("p.push('")
.split("\r").join("\\'")
+ "');}return p.join('');");
// Provide some basic currying to the user
return data ? fn( data ) : fn;
};
})();
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+1073
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+494
View File
@@ -0,0 +1,494 @@
/*
* zClip :: jQuery ZeroClipboard v1.1.1
* https://steamdev.com/zclip
*
* Copyright 2011, SteamDev
* Released under the MIT license.
* https://www.opensource.org/licenses/mit-license.php
*
* Date: Wed Jun 01, 2011
*/
(function ($) {
$.fn.zclip = function (params) {
if (typeof params == "object" && !params.length) {
var settings = $.extend({
path: 'ZeroClipboard.swf',
copy: null,
beforeCopy: null,
afterCopy: null,
clickAfter: true,
setHandCursor: true,
setCSSEffects: true
}, params);
return this.each(function () {
var o = $(this);
if (o.is(':visible') && (typeof settings.copy == 'string' || $.isFunction(settings.copy))) {
ZeroClipboard.setMoviePath(settings.path);
var clip = new ZeroClipboard.Client();
if($.isFunction(settings.copy)){
o.bind('zClip_copy',settings.copy);
}
if($.isFunction(settings.beforeCopy)){
o.bind('zClip_beforeCopy',settings.beforeCopy);
}
if($.isFunction(settings.afterCopy)){
o.bind('zClip_afterCopy',settings.afterCopy);
}
clip.setHandCursor(settings.setHandCursor);
clip.setCSSEffects(settings.setCSSEffects);
clip.addEventListener('mouseOver', function (client) {
o.trigger('mouseenter');
});
clip.addEventListener('mouseOut', function (client) {
o.trigger('mouseleave');
});
clip.addEventListener('mouseDown', function (client) {
o.trigger('mousedown');
if(!$.isFunction(settings.copy)){
clip.setText(settings.copy);
} else {
clip.setText(o.triggerHandler('zClip_copy'));
}
if ($.isFunction(settings.beforeCopy)) {
o.trigger('zClip_beforeCopy');
}
});
clip.addEventListener('complete', function (client, text) {
if ($.isFunction(settings.afterCopy)) {
o.trigger('zClip_afterCopy');
} else {
if (text.length > 500) {
text = text.substr(0, 500) + "...\n\n(" + (text.length - 500) + " characters not shown)";
}
o.removeClass('hover');
}
if (settings.clickAfter) {
o.trigger('click');
}
});
clip.glue(o[0], o.parent()[0]);
$(window).bind('load resize',function(){clip.reposition();});
}
});
} else if (typeof params == "string") {
return this.each(function () {
var o = $(this);
params = params.toLowerCase();
var zclipId = o.data('zclipId');
var clipElm = $('#' + zclipId + '.zclip');
if (params == "remove") {
clipElm.remove();
o.removeClass('active hover');
} else if (params == "hide") {
clipElm.hide();
o.removeClass('active hover');
} else if (params == "show") {
clipElm.show();
}
});
}
}
})(jQuery);
// ZeroClipboard
// Simple Set Clipboard System
// Author: Joseph Huckaby
var ZeroClipboard = {
version: "1.0.7",
clients: {},
// registered upload clients on page, indexed by id
moviePath: 'ZeroClipboard.swf',
// URL to movie
nextId: 1,
// ID of next movie
$: function (thingy) {
// simple DOM lookup utility function
if (typeof(thingy) == 'string') thingy = document.getElementById(thingy);
if (!thingy.addClass) {
// extend element with a few useful methods
thingy.hide = function () {
this.style.display = 'none';
};
thingy.show = function () {
this.style.display = '';
};
thingy.addClass = function (name) {
this.removeClass(name);
this.className += ' ' + name;
};
thingy.removeClass = function (name) {
var classes = this.className.split(/\s+/);
var idx = -1;
for (var k = 0; k < classes.length; k++) {
if (classes[k] == name) {
idx = k;
k = classes.length;
}
}
if (idx > -1) {
classes.splice(idx, 1);
this.className = classes.join(' ');
}
return this;
};
thingy.hasClass = function (name) {
return !!this.className.match(new RegExp("\\s*" + name + "\\s*"));
};
}
return thingy;
},
setMoviePath: function (path) {
// set path to ZeroClipboard.swf
this.moviePath = path;
},
dispatch: function (id, eventName, args) {
// receive event from flash movie, send to client
var client = this.clients[id];
if (client) {
client.receiveEvent(eventName, args);
}
},
register: function (id, client) {
// register new client to receive events
this.clients[id] = client;
},
getDOMObjectPosition: function (obj, stopObj) {
// get absolute coordinates for dom element
var info = {
left: 0,
top: 0,
width: obj.width ? obj.width : obj.offsetWidth,
height: obj.height ? obj.height : obj.offsetHeight
};
if (obj && (obj != stopObj)) {
info.left += obj.offsetLeft;
info.top += obj.offsetTop;
}
return info;
},
Client: function (elem) {
// constructor for new simple upload client
this.handlers = {};
// unique ID
this.id = ZeroClipboard.nextId++;
this.movieId = 'ZeroClipboardMovie_' + this.id;
// register client with singleton to receive flash events
ZeroClipboard.register(this.id, this);
// create movie
if (elem) this.glue(elem);
}
};
ZeroClipboard.Client.prototype = {
id: 0,
// unique ID for us
ready: false,
// whether movie is ready to receive events or not
movie: null,
// reference to movie object
clipText: '',
// text to copy to clipboard
handCursorEnabled: true,
// whether to show hand cursor, or default pointer cursor
cssEffects: true,
// enable CSS mouse effects on dom container
handlers: null,
// user event handlers
glue: function (elem, appendElem, stylesToAdd) {
// glue to DOM element
// elem can be ID or actual DOM element object
this.domElement = ZeroClipboard.$(elem);
// float just above object, or zIndex 99 if dom element isn't set
var zIndex = 99;
if (this.domElement.style.zIndex) {
zIndex = parseInt(this.domElement.style.zIndex, 10) + 1;
}
if (typeof(appendElem) == 'string') {
appendElem = ZeroClipboard.$(appendElem);
} else if (typeof(appendElem) == 'undefined') {
appendElem = document.getElementsByTagName('body')[0];
}
// find X/Y position of domElement
var box = ZeroClipboard.getDOMObjectPosition(this.domElement, appendElem);
// create floating DIV above element
this.div = document.createElement('div');
this.div.className = "zclip";
this.div.id = "zclip-" + this.movieId;
$(this.domElement).data('zclipId', 'zclip-' + this.movieId);
var style = this.div.style;
style.position = 'absolute';
style.left = '' + box.left + 'px';
style.top = '' + box.top + 'px';
style.width = '' + box.width + 'px';
style.height = '' + box.height + 'px';
style.zIndex = zIndex;
if (typeof(stylesToAdd) == 'object') {
for (addedStyle in stylesToAdd) {
style[addedStyle] = stylesToAdd[addedStyle];
}
}
// style.backgroundColor = '#f00'; // debug
appendElem.appendChild(this.div);
this.div.innerHTML = this.getHTML(box.width, box.height);
},
getHTML: function (width, height) {
// return HTML for movie
var html = '';
var flashvars = 'id=' + this.id + '&width=' + width + '&height=' + height;
if (navigator.userAgent.match(/MSIE/)) {
// IE gets an OBJECT tag
var protocol = location.href.match(/^https/i) ? 'https://' : 'https://';
html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="' + protocol + 'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="' + width + '" height="' + height + '" id="' + this.movieId + '" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="' + ZeroClipboard.moviePath + '" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="' + flashvars + '"/><param name="wmode" value="transparent"/></object>';
} else {
// all other browsers get an EMBED tag
html += '<embed id="' + this.movieId + '" src="' + ZeroClipboard.moviePath + '" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="' + width + '" height="' + height + '" name="' + this.movieId + '" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer" flashvars="' + flashvars + '" wmode="transparent" />';
}
return html;
},
hide: function () {
// temporarily hide floater offscreen
if (this.div) {
this.div.style.left = '-2000px';
}
},
show: function () {
// show ourselves after a call to hide()
this.reposition();
},
destroy: function () {
// destroy control and floater
if (this.domElement && this.div) {
this.hide();
this.div.innerHTML = '';
var body = document.getElementsByTagName('body')[0];
try {
body.removeChild(this.div);
} catch (e) {;
}
this.domElement = null;
this.div = null;
}
},
reposition: function (elem) {
// reposition our floating div, optionally to new container
// warning: container CANNOT change size, only position
if (elem) {
this.domElement = ZeroClipboard.$(elem);
if (!this.domElement) this.hide();
}
if (this.domElement && this.div) {
var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
var style = this.div.style;
style.left = '' + box.left + 'px';
style.top = '' + box.top + 'px';
}
},
setText: function (newText) {
// set text to be copied to clipboard
this.clipText = newText;
if (this.ready) {
this.movie.setText(newText);
}
},
addEventListener: function (eventName, func) {
// add user event listener for event
// event types: load, queueStart, fileStart, fileComplete, queueComplete, progress, error, cancel
eventName = eventName.toString().toLowerCase().replace(/^on/, '');
if (!this.handlers[eventName]) {
this.handlers[eventName] = [];
}
this.handlers[eventName].push(func);
},
setHandCursor: function (enabled) {
// enable hand cursor (true), or default arrow cursor (false)
this.handCursorEnabled = enabled;
if (this.ready) {
this.movie.setHandCursor(enabled);
}
},
setCSSEffects: function (enabled) {
// enable or disable CSS effects on DOM container
this.cssEffects = !! enabled;
},
receiveEvent: function (eventName, args) {
// receive event from flash
eventName = eventName.toString().toLowerCase().replace(/^on/, '');
// special behavior for certain events
switch (eventName) {
case 'load':
// movie claims it is ready, but in IE this isn't always the case...
// bug fix: Cannot extend EMBED DOM elements in Firefox, must use traditional function
this.movie = document.getElementById(this.movieId);
if (!this.movie) {
var self = this;
setTimeout(function () {
self.receiveEvent('load', null);
}, 1);
return;
}
// firefox on pc needs a "kick" in order to set these in certain cases
if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) {
var self = this;
setTimeout(function () {
self.receiveEvent('load', null);
}, 100);
this.ready = true;
return;
}
this.ready = true;
try {
this.movie.setText(this.clipText);
} catch (e) {}
try {
this.movie.setHandCursor(this.handCursorEnabled);
} catch (e) {}
break;
case 'mouseover':
if (this.domElement && this.cssEffects) {
this.domElement.addClass('hover');
if (this.recoverActive) {
this.domElement.addClass('active');
}
}
break;
case 'mouseout':
if (this.domElement && this.cssEffects) {
this.recoverActive = false;
if (this.domElement.hasClass('active')) {
this.domElement.removeClass('active');
this.recoverActive = true;
}
this.domElement.removeClass('hover');
}
break;
case 'mousedown':
if (this.domElement && this.cssEffects) {
this.domElement.addClass('active');
}
break;
case 'mouseup':
if (this.domElement && this.cssEffects) {
this.domElement.removeClass('active');
this.recoverActive = false;
}
break;
} // switch eventName
if (this.handlers[eventName]) {
for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) {
var func = this.handlers[eventName][idx];
if (typeof(func) == 'function') {
// actual function reference
func(this, args);
} else if ((typeof(func) == 'object') && (func.length == 2)) {
// PHP style object + method, i.e. [myObject, 'myMethod']
func[0][func[1]](this, args);
} else if (typeof(func) == 'string') {
// name of function
window[func](this, args);
}
} // foreach event handler defined
} // user defined handler for event
}
};
+7
View File
@@ -0,0 +1,7 @@
jQuery.fn.center = function () {
this.css("position","absolute");
this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
return this;
}
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
+1110
View File
File diff suppressed because it is too large Load Diff
+1283
View File
File diff suppressed because it is too large Load Diff
+1202
View File
File diff suppressed because it is too large Load Diff
+52
View File
@@ -0,0 +1,52 @@
const censorChars = 'abcdefghijklmnopqrstuvwxyz';
var animating = false;
$(function() {
setInterval(changeCensor, 100);
var hash = document.location.hash.substring(1);
var offset = $(`#${hash}-fake`).offset();
if(offset != undefined)
$('html, body').animate({ scrollTop: offset.top - 72 }, 1000);
$.material.init();
});
$('.hide-div').click(function() {
var divname = $(this).attr('id').substring('hide-'.length);
var div = $(`#${divname}`);
if(div.is(':visible')) {
div.hide(300);
return $(this).text('(show)');
}
div.show(300);
return $(this).text('(hide)');
});
$(".hashlink").click(function () {
var hash = $(this).text();
if (hash == 'Back to top' || hash == '(back to top)') {
return $('html, body').delay(hash == 'Back to top' ? 400 : 0).animate({scrollTop: 0}, 500);
}
return $('html, body').animate({
scrollTop: $(`#${hash}-fake`).offset().top - 100
}, 1000);
});
$(".moe-scroll").click(function() {
$('html, body').animate({ scrollTop: $("#moe-counter").offset().top - 100 }, 1000);
});
function changeCensor() {
$('.censored').each(function() {
$(this).text(randomStr($(this).text().length));
});
}
function randomStr(length) {
var str = '';
for(var i = 0; i < length; i++)
str += censorChars.charAt(Math.floor(Math.random() * censorChars.length));
return str;
}
+181
View File
@@ -0,0 +1,181 @@
/*
el - áëîê
txt - òåêñò
event --
tp - òèï
st - ñòèëè
sm - ìåëêèé òåêñò
*/
function pageX(elem) {
return elem.offsetParent ?
elem.offsetLeft + pageX( elem.offsetParent ) :
elem.offsetLeft;
}
function pageY(elem) {
return elem.offsetParent ?
elem.offsetTop + pageY( elem.offsetParent ) :
elem.offsetTop;
}
var xyfmn = 0;
function himove(e) {
if (!e) e = window.event;
$('#ttl').css({'top': '0px','left': '0px'});
//el,txt,e,tp,st,sm,fm,css
var x = e.pageX, y = e.pageY;
var fm = top.xyfmn[6];
var el = top.xyfmn[0];
var max_x = ($(window).width() - 10),
max_y = ($(window).height() - 10);
if ($('#main').attr('id') != null && $('#main').attr('id') != undefined) {
if (fm == 1) {
//main
y += 52 - $(top.frames['main']).scrollTop() + 8;
x += 8;
} else if (fm == 2) {
//online
y += 20 - $('#online_list').scrollTop();
x += 10;
} else if (fm == 3) {
//chat
y += 20 - $('#chat_list').scrollTop();
x += 2;
}
} else {
//all
y += 31;
x += 2;
}
if (x + $('#ttl').width() > max_x) {
x = max_x - $('#ttl').width();
}
if (y + $('#ttl').height() > max_y) {
y = max_y - $('#ttl').height();
}
$('#ttl').css({'top': `${y}px`, 'left': `${x}px`});
}
function hi(el, txt, e, tp, st, sm, fm, css) {
if (!e) e = window.event;
top.xyfmn = [el, txt, e, tp, st, sm, fm, css];
var x = e.pageX, y = e.pageY;
x += 0;
y -= 8;
$('#ttl').css({
'top': `${y}px`,
'left': `${x}px`
});
var rhtml = txt;
if (css != '') {
rhtml = `<div style="${css}">${rhtml}</div>`;
}
if (st == 1) {
rhtml = `<div style="white-space:nowrap;">${rhtml}</div>`;
}
if (sm == 1) {
rhtml = `<small>${rhtml}</small>`;
}
$('#ttl').html(rhtml);
$('#ttl').css({
'display': ''
});
if (tp > 0) {
var ec = $(el).offset();
ec.top = pageY(el);
ec.left = pageX(el);
if (ec['top'] != 0) {
if (tp == 1) {
y = ec['top'] - $(el).height() - 8;
x = ec['left'];
} else if (tp == 2) {
y = ec['top'] + $(el).height() + 8;
x = ec['left'];
} else if (tp == 3) {
y = ec['top'];
x = ec['left'] + $(el).width() + 8;
} else if (tp == 4) {
y = ec['top'];
x = ec['left'] - $(el).width() - 8;
} else if (tp == 5) {
y = ec['top'] - $('#ttl').height() - 8;
x = ec['left'];
}
if ($('#main').attr('id') != null && $('#main').attr('id') != undefined) {
if (fm == 1) {
//main
y += 34 - $(top.frames['main']).scrollTop();
x += 2;
} else if (fm == 2) {
//online
y += 0 - $('#online_list').scrollTop();
x += 2;
} else if (fm == 3) {
//chat
y += 0 - $('#chat_list').scrollTop();
x += 2;
}
} else {
//all
y += 31;
x += 2;
}
}
$('#ttl').css({'top': `${y}px`, 'left': `${x}px`});
}
if ($('#globalMain').attr('id') != undefined) {
if ((x + $('#ttl').width()) - $('#globalMain').width() >= -8) {
x = $('#globalMain').width() - $('#ttl').width() - 8;
if (tp == 3) {
y = ec['top'] + $(el).height() + 8;
} else if (tp == 4) {
y = ec['top'] + $(el).height() + 8;
}
if (fm == 1) {
//main
y += 36 - $(top.frames['main']).scrollTop();
x += 2;
} else if (fm == 2) {
//online
y += 0 - $('#online_list').scrollTop();
x += 2;
} else if (fm == 3) {
//chat
y += 0 - $('#chat_list').scrollTop();
x += 2;
}
$('#ttl').css({'top': `${y}px`, 'left': `${x}px`});
}
} else {
y -= 30;
x -= 8;
$('#ttl').css({'top': `${y}px`, 'left': `${x}px`});
}
if (tp == 0) {
$(el).bind('mousemove', function (e) {
top.himove(e);
});
}
}
function hic() {
$('#ttl').css({'display':'none'});
$('#ttl').css({'top':'-5px','left':'-5px'});
$('#ttl').html(' ');
}
+383
View File
@@ -0,0 +1,383 @@
(function($) {
/*****************************************************************
* Select
*****************************************************************/
function Select(el, options) {
this.$el = $(el);
this.id = Math.random();
this.options = options;
this.multiple = this.$el.prop('multiple');
this.activeOpt = null;
this.widthSet = false;
this.generate();
}
Select.prototype = {
generate: function() {
if (!this.$select) {
var _self = this;
this.$select = $('<div class="wSelect"><div class="wSelect-arrow"></div></div>');
this.$optionsHolder = $('<div class="wSelect-options-holder"></div>');
this.$options = $('<div class="wSelect-options"></div>');
// ie 7 fix to get proper zIndex on select dropdowns
if(!$.support.placeholder) {
this.$select.css('zIndex', 100 - this.$el.index());
}
var click = function(e) {
e.stopPropagation();
$('select').each(function() {
var wSelect = $(this).data('wSelect');
if (wSelect && wSelect.id !== _self.id) {
if (!wSelect.multiple) { wSelect.$optionsHolder.hide(); }
wSelect.onBlur();
}
});
if (!_self.multiple) { _self.onClick(e); }
_self.$el.focus();
};
if (this.multiple) {
this.$select.addClass('wSelect-multiple');
this.$optionsHolder.click(click);
}
else {
this.$selected = $('<div class="wSelect-selected"></div>');
this.$select.append(this.$selected);
this.$select.click(click);
this.$optionsHolder.click(function(e) {
e.stopPropagation();
_self.$el.focus();
});
}
this.$select.hover(
function(){ _self.onFocus('hover'); },
function(){ _self.onBlur('hover'); }
);
this.$el.addClass('wSelect-el')
.change(function() { _self.change(); })
.focus(function() { _self.onFocus(); })
.keydown(function(e) { _self.keydown(e); })
.keyup(function(e) { _self.keyup(e); });
$(document).click(function() {
if (!_self.multiple) { _self.$optionsHolder.hide(); }
_self.onBlur();
});
this.widthSet = this.$select.width() > 0;
this.setTheme(this.options.theme);
this.setSize(this.options.size);
this.reset();
this.$optionsHolder.append(this.$options);
this.$select.append(this.$optionsHolder);
this.$el.after(this.$select);//.hide();
}
return this.$select;
},
reset: function() {
var _self = this;
this.$options.children().remove();
this.$el.children().each(function() {
var option = new Option(this, _self);
$.data(this, 'wSelect-option', option);
_self.$options.append(option.generate());
});
this.$options.children().removeClass('wSelect-option-last').last().addClass('wSelect-option-last');
this.setSize(this.options.size);
},
change: function() {
this.$options.children().removeClass('wSelect-option-selected wSelect-option-active');
this.$el.children(':selected').each(function() {
$(this).data('wSelect-option').select();
});
},
keydown: function(e) {
// tab
if (e.keyCode === 9) {
this.$optionsHolder.hide();
this.onBlur();
}
},
keyup: function(e) {
// enter
if (e.keyCode === 13) {
this.$optionsHolder.hide();
}
// left, up, right, down
else if (e.keyCode >= 37 && e.keyCode <= 40) {
this.change();
var $option = this.$options.find('.wSelect-option-selected:last'),
scrollTop = this.$options.scrollTop(),
top = $option.position().top + scrollTop,
optionsHeight = this.$options.height(),
optionHeight = $option.outerHeight(true);
if (top - scrollTop < 0) {
this.$options.scrollTop(top);
}
else if (top + optionHeight - scrollTop > optionsHeight) {
this.$options.scrollTop(top - optionsHeight + optionHeight);
}
}
},
onClick: function(e) {
// find best fit for dropdowns (top or bottom)
if (!this.$optionsHolder.is(':visible')) {
var top = this.$select.offset().top - $(window).scrollTop(),
optionsHeight = this.$optionsHolder.outerHeight(),
topDiff = top - optionsHeight,
botDiff = $(window).height() - (top + this.$select.outerHeight() + optionsHeight + 5), // 5 is just for some bottom screen padding
newTop = (botDiff > 0 || botDiff > topDiff) ? this.$select.height() : -optionsHeight;
this.$optionsHolder.css('top', newTop);
}
this.$optionsHolder.toggle();
},
onFocus: function(className) {
className = className || 'active';
if (this.options.highlight) {
this.$select.addClass(`wSelect-${className}`);
}
},
onBlur: function(className) {
className = className || 'active';
if (this.options.highlight) {
this.$select.removeClass(`wSelect-${className}`);
}
},
setTheme: function(theme) {
this.$select.attr('class', this.$select.attr('class').replace(/wSelect-theme-.+\s|wSelect-theme-.+$/, ''));
this.$select.addClass(`wSelect-theme-${theme}`);
},
setSize: function(size) {
var $option = this.$options.children(':first').clone().css({position:'absolute', left:-10000}),
numOptions = this.$el.children().length,
height;
$('body').append($option);
height = $option.outerHeight(true);
$option.remove();
if (!this.multiple && size > numOptions) {
size = numOptions;
}
this.$options.height(height * size - 1);
}
};
/*****************************************************************
* Option
*****************************************************************/
function Option(el, wSelect) {
this.$el = $(el);
this.wSelect = wSelect;
}
Option.prototype = {
generate: function() {
var _self = this;
if (!this.$option) {
var icon = this.$el.attr('data-icon');
this.$option = $('<div class="wSelect-option"></div>');
this.$value = $('<div class="wSelect-option-value"></div>');
this.$option.append(this.$value);
if (typeof icon === 'string') {
this.$value.addClass('wSelect-option-icon');
this.$value.css('backgroundImage', `url(${icon})`);
}
}
if (this.$el.prop('selected')) this.select();
if (this.$el.prop('disabled')) {
this.$option.addClass('wSelect-option-disabled');
}
else {
this.$option.removeClass('wSelect-option-disabled');
this.$option.unbind('click').click(function(e){ _self.onClick(e); });
}
this.$value.html(this.$el.html()); // in case html has changed we always set it here
this.setWidth();
return this.$option;
},
select: function() {
if (!this.wSelect.activeOpt) {
this.wSelect.activeOpt = this;
}
if (!this.wSelect.multiple) {
var icon = this.$el.attr('data-icon');
if (typeof icon === 'string') {
this.wSelect.$selected.addClass('wSelect-option-icon');
this.wSelect.$selected.css('backgroundImage', `url(${icon})`);
}
else {
this.wSelect.$selected.removeClass('wSelect-option-icon');
this.wSelect.$selected.css('backgroundImage', '');
}
//if(!this.wSelect.focus) { this.wSelect.$optionsHolder.hide(); }
this.wSelect.$selected.html(this.$el.html());
}
this.$option.addClass('wSelect-option-selected');
},
onClick: function(e) {
var selVal = null;
if (this.wSelect.multiple && (e.ctrlKey || e.shiftKey) ) {
if (e.ctrlKey || !this.wSelect.activeOpt) {
selVal = this.wSelect.$el.val() || [];
var optVal = this.$el.val(),
arrayPos = $.inArray(optVal, selVal);
if (arrayPos === -1) {
selVal.push(this.$el.val());
this.wSelect.activeOpt = this; // only set active when "selecting"
}
else selVal.splice(arrayPos, 1);
}
// don't set active here as the shift+click only highlights from active option
else if (e.shiftKey) {
var indexActive = this.wSelect.activeOpt.$el.index(),
indexCurrent = this.$el.index(),
indexStart = 0,
indexEnd = 0,
$option = null;
if (indexCurrent > indexActive) {
indexStart = indexActive;
indexEnd = indexCurrent;
} else {
indexStart = indexCurrent;
indexEnd = indexActive;
}
selVal = [];
for (var i=indexStart; i<=indexEnd; i++) {
$option = this.wSelect.$el.children(`:eq(${i})`);
if ($option.is(':not(:disabled)')) {
selVal.push($option.val());
}
}
}
}
else {
selVal = this.$el.val();
this.wSelect.$optionsHolder.hide();
this.wSelect.activeOpt = this;
}
this.wSelect.$el.val(selVal).change();
},
// help us set the proper widths based on given values (this way so we can add options on the fly one at a time)
setWidth: function() {
if (this.wSelect.multiple || this.wSelect.widthSet) { return true; }
this.$option.hide().appendTo('body');
var optionWidth = this.$option.width();
if (optionWidth > this.wSelect.$select.width()) {
this.wSelect.$select.width(optionWidth);
}
this.$option.detach().show();
}
};
/*****************************************************************
* fn.wSelect
*****************************************************************/
$.support.placeholder = 'placeholder' in document.createElement('input');
$.fn.wSelect = function(options, value) {
if (typeof options === 'string') {
var values = [];
var elements = this.each(function() {
var wSelect = $(this).data('wSelect');
if (wSelect) {
var func = (value ? 'set' : 'get') + options.charAt(0).toUpperCase() + options.substring(1).toLowerCase();
if (wSelect[options]) {
wSelect[options].apply(wSelect, [value]);
} else if (value) {
if (wSelect[func]) { wSelect[func].apply(wSelect, [value]); }
if (wSelect.options[options]) { wSelect.options[options] = value; }
} else {
if(wSelect[func]) { values.push(wSelect[func].apply(wSelect, [value])); }
else if (wSelect.options[options]) { values.push(wSelect.options[options]); }
else { values.push(null); }
}
}
});
if (values.length === 1) { return values[0]; }
else if (values.length > 0) { return values; }
else { return elements; }
}
options = $.extend({}, $.fn.wSelect.defaults, options);
function get(el) {
var wSelect = $.data(el, 'wSelect');
if (!wSelect) {
var _options = jQuery.extend(true, {}, options);
_options.size = $(el).prop('size') || _options.size;
wSelect = new Select(el, _options);
$.data(el, 'wSelect', wSelect);
}
return wSelect;
}
return this.each(function() { get(this); });
};
$.fn.wSelect.defaults = {
theme: 'classic', // theme
size: '4', // default number of options to display (overwrite with `size` attr on `select` element)
highlight: true // highlight fields when selected
};
})(jQuery);