Уборка неиспользуемого.
This commit is contained in:
@@ -1,652 +0,0 @@
|
||||
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(); }
|
||||
}
|
||||
@@ -1,211 +0,0 @@
|
||||
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,'Используем "'+name+'" ','<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','Смена противника ','<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,'Используем "'+nm+'" ','<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();
|
||||
}
|
||||
637
js/interface.js1
637
js/interface.js1
@@ -1,637 +0,0 @@
|
||||
$(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
js/jimg.js
137
js/jimg.js
@@ -1,137 +0,0 @@
|
||||
/* 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
js/jquery-1.11.js
vendored
7181
js/jquery-1.11.js
vendored
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
1073
js/jquery.scroll2.js
1073
js/jquery.scroll2.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
1110
js/online.js.new.js
1110
js/online.js.new.js
File diff suppressed because it is too large
Load Diff
52
js/pci.js
52
js/pci.js
@@ -1,52 +0,0 @@
|
||||
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;
|
||||
}
|
||||
383
js/wSelect.js
383
js/wSelect.js
@@ -1,383 +0,0 @@
|
||||
(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);
|
||||
Reference in New Issue
Block a user