<html>
<head>
<title>Experimental Drag and Drop - RJM Programming - July, 2023 ... thanks to https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/setData</title>
<style>
th.source {
border: 1px solid transparent;
}
</style>
<script type=text/javascript>
var playerb='Black';
var playerw='White';
var clonedata='', clonedatatwo='', pos3=0, pos4=0, secs=0, score=0, tdid='', tdcheck=true;
var tdnum=location.search.split('tdnum=')[1] ? eval(location.search.split('tdnum=')[1].split('&')[0]) : 9;
var across=location.search.split('across=')[1] ? eval(location.search.split('across=')[1].split('&')[0]) : 3;
var twosubsfrom=['',''], twosubsto=['',''], onenewmove=[];
var trad='', idone='', idtwo='', gval='', idzero='';
var yesnod=true, iyesnod=0, previyesnod=0;
var amove='';
if (document.URL.indexOf('traditional=') != -1) {
trad=decodeURIComponent(document.URL.split('traditional=')[1].split('&')[0]);
}
if (document.URL.indexOf('move=') != -1) {
amove=decodeURIComponent(document.URL.split('move=')[1].split('&')[0]);
}
var movefrom=-1, moveto=-1, nextmove=-1, mirroring=false;
var dragh=false;
var sdone=false;
var sourceid='sou' + 'rce';
var shuffle=('' + location.hash + ' ' + location.search + ' ').split('shuffle=')[1] ? true : false;
var yourblurb=location.search.split('yourblurb=')[1] ? decodeURIComponent('' + location.hash + ' ' + location.search.split('yourblurb=')[1].split('&')[0]).replace(/\+/g,' ').replace(/\ \ \ /g,' + ') : '';
var sourcenum=location.search.split('sourcenum=')[1] ? Math.floor(eval(('' + location.search.split('sourcenum=')[1].split('&')[0]) + '.0')) : 1;
if ((document.URL.split('#')[0] + '&').indexOf('sourcenum=&') != -1 && sourcenum == 1) { sourcenum=0; }
var originalsn=sourcenum;
var originalsh=shuffle;
var origsnc='';
var bdone=false;
var lastbco=null;
var lastoh='', prevlastoh='', prevlastih='', prevtih='', lohfulloh='', newlohfulloh='';
var lastih='', loh='', lohoh='';
var lastevid='', bcklastid='';
var lastid='';
var prefx='th';
var itisthiscmove='', lastitisthiscmove=' ';
var fauxmove='';
if (document.URL.indexOf('draughts=') != -1) {
fauxmove=decodeURIComponent(document.URL.split('draughts=')[1].split('&')[0]);
if (fauxmove.trim() != '') {
itisthiscmove=fauxmove.substring(0,1).replace('w','B').replace('b','W').toLowerCase();
if (itisthiscmove == 'b') {
setTimeout(function(){ consolelog(playerb + ', it is your turn. '); }, 3000);
} else if (itisthiscmove == 'w') {
setTimeout(function(){ consolelog(playerw + ', it is your turn. '); }, 3000);
}
}
}
var cpa=['bK','wK','bQ','wQ','bR1','wR1','bR2','wR2','bB1','wB1','bB2','wB2','bK1','wK1','bK2','wK2','bP1','wP1','bP2','wP2','bP3','wP3','bP4','wP4','bP5','wP5','bP6','wP6','bP7','wP7','bP8','wP8'];
var staidmap=[4,60,3,59,0,56,7,63, 2,58,5,61, 1,57,6,62, 8,48,9,49,10,50,11,51,12,52,13,53,14,54,15,55];
if (document.URL.indexOf(deq('draughts')) != -1) {
cpa=['bB1','wB1','bB2','wB2','bB3','wB3','bB4','wB4','bB5','wB5','bB6','wB6','bB7','wB7','bB8','wB8','bB9','wB9','bBv','wBv','bBu','wBu','bBt','wBt'];
staidmap=[1,56,3,58,5,60,7,62,8,49,10,51,12,53,14,55,17,40,19,42,21,44,23,46];
}
var occupiedlist=',', qid='', qqid='';
var blackchecked=false, blackcheckmated=false;
var whitechecked=false, whitecheckmated=false;
var fouroh='', eightoh='', sixoh='', spanzero='', tdtte='';
var wwwtdtte='', wwtdtte='', wtdtte='', wsixoh='', spanfive='', ppt=false;
var domcmds=[];
var wastitle='';
var gev=null, hostid='', prelegal=true, cm='';
var lastmove='', waslastmove='';
var startboard='', endboard='';
var wstartsincheck=false, wendsincheck=false;
var bstartsincheck=false, bendsincheck=false;
var thissquare=-1;
var eightaround=[-1,-1,-1,-1,-1,-1,-1,-1,-1];
var isbad=false, iswrong=false;
function deq(inideais) {
if (document.URL.indexOf(inideais + '=') != -1) {
return inideais + '=';
} else if (document.URL.indexOf('=' + inideais) != -1) {
return '=' + inideais;
}
return "you'l" + "lnever#findth" + "is";
}
function anybw(asq, thebrd, bwenemy, alertallowed) {
thebrd+='&';
isbad=false;
iswrong=false;
var bwfriend=bwenemy.replace('w','!').replace('b','W').replace('!', 'b').toLowerCase();
var okfornow=true, startat=eval('' + asq), twos=[];
var startrow=Math.floor(eval(-1 + asq) / 8);
var startcol=Math.floor(eval(-1 + asq) % 8);
var lastcol=-1, lastrow=-1;
var kposa=[18,-18,17,-17,15,-15,6,-6,10,10];
var pposa=[9,7];
var kgposa=[9,8,7,-1,1,-7,-8,-9];
var ikposa=0;
if (asq == thissquare) {
asq=asq;
}
if (bwfriend == 'w') {
pposa=[-9,-7];
}
//alert('Checking ' + bwfriend + ' King at ' + asq);
// Horizontal check
startat=eval(-1 + asq);
while (startat >= 1 && startat <= 64 && startrow == Math.floor(eval(-1 + startat) / 8)) {
if (thebrd.indexOf('_' + startat + 'w') != -1) {
twos=thebrd.split('_' + startat + 'w');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
break;
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('Q') != -1 || twos[0].slice(-3).indexOf('R') != -1) {
isbad=true;
//alert(1);
return asq;
}
}
} else if (thebrd.indexOf('_' + startat + 'b') != -1) {
twos=thebrd.split('_' + startat + 'b');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
break;
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('Q') != -1 || twos[0].slice(-3).indexOf('R') != -1) {
isbad=true;
//alert(2);
return asq;
}
}
} else if (thebrd.indexOf('_' + startat + '&') != -1) {
twos=thebrd.split('_' + startat + '&');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
break;
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('Q') != -1 || twos[0].slice(-3).indexOf('R') != -1) {
isbad=true;
//alert(3);
return asq;
}
}
}
startat--;
}
startat=eval(1 + asq);
while (startat >= 1 && startat <= 64 && startrow == Math.floor(eval(-1 + startat) / 8)) {
if (thebrd.indexOf('_' + startat + 'w') != -1) {
twos=thebrd.split('_' + startat + 'w');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
break;
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('Q') != -1 || twos[0].slice(-3).indexOf('R') != -1) {
isbad=true;
//alert(11);
return asq;
}
}
} else if (thebrd.indexOf('_' + startat + 'b') != -1) {
twos=thebrd.split('_' + startat + 'b');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
break;
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('Q') != -1 || twos[0].slice(-3).indexOf('R') != -1) {
isbad=true;
//alert(12);
return asq;
}
}
} else if (thebrd.indexOf('_' + startat + '&') != -1) {
twos=thebrd.split('_' + startat + '&');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
break;
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('Q') != -1 || twos[0].slice(-3).indexOf('R') != -1) {
isbad=true;
//alert(13);
return asq;
}
}
}
startat++;
}
// Vertical check
startat=eval(-8 + asq);
while (startat >= 1 && startat <= 64 && startcol == Math.floor(eval(-1 + startat) % 8)) {
if (thebrd.indexOf('_' + startat + 'w') != -1) {
twos=thebrd.split('_' + startat + 'w');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
break;
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('Q') != -1 || twos[0].slice(-3).indexOf('R') != -1) {
isbad=true;
//alert(21);
return asq;
}
}
} else if (thebrd.indexOf('_' + startat + 'b') != -1) {
twos=thebrd.split('_' + startat + 'b');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
break;
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('Q') != -1 || twos[0].slice(-3).indexOf('R') != -1) {
isbad=true;
//alert(22);
return asq;
}
}
} else if (thebrd.indexOf('_' + startat + '&') != -1) {
twos=thebrd.split('_' + startat + '&');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
break;
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('Q') != -1 || twos[0].slice(-3).indexOf('R') != -1) {
isbad=true;
//alert(23);
return asq;
}
}
}
startat-=8;
}
startat=eval(8 + asq);
while (startat >= 1 && startat <= 64 && startcol == Math.floor(eval(-1 + startat) % 8)) {
if (thebrd.indexOf('_' + startat + 'w') != -1) {
twos=thebrd.split('_' + startat + 'w');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
break;
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('Q') != -1 || twos[0].slice(-3).indexOf('R') != -1) {
isbad=true;
//alert(24);
return asq;
}
}
} else if (thebrd.indexOf('_' + startat + 'b') != -1) {
twos=thebrd.split('_' + startat + 'b');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
break;
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('Q') != -1 || twos[0].slice(-3).indexOf('R') != -1) {
isbad=true;
//alert(25);
return asq;
}
}
} else if (thebrd.indexOf('_' + startat + '&') != -1) {
twos=thebrd.split('_' + startat + '&');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
break;
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('Q') != -1 || twos[0].slice(-3).indexOf('R') != -1) {
isbad=true;
//alert(26);
return asq;
}
}
}
startat+=8;
}
// Diagonal check
lastcol=Math.floor(eval(-1 + asq) % 8);
lastrow=Math.floor(eval(-1 + asq) / 8);
startat=eval(-9 + asq);
while (startat >= 1 && startat <= 64 && Math.abs(lastcol - Math.floor(eval(-1 + startat) % 8)) == 1 && Math.abs(lastrow - Math.floor(eval(-1 + startat) / 8)) == 1) {
if (thebrd.indexOf('_' + startat + 'w') != -1) {
twos=thebrd.split('_' + startat + 'w');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
break;
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('Q') != -1 || twos[0].slice(-3).indexOf('B') != -1) {
isbad=true;
//alert('31 ' + bwfriend + ' ' + twos[0].slice(-3) + ' ' + startat + ' ' + asq);
return asq;
}
}
} else if (thebrd.indexOf('_' + startat + 'b') != -1) {
twos=thebrd.split('_' + startat + 'b');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
break;
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('Q') != -1 || twos[0].slice(-3).indexOf('B') != -1) {
isbad=true;
//alert(32);
return asq;
}
}
} else if (thebrd.indexOf('_' + startat + '&') != -1) {
twos=thebrd.split('_' + startat + '&');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
break;
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('Q') != -1 || twos[0].slice(-3).indexOf('B') != -1) {
isbad=true;
//alert(33);
return asq;
}
}
}
lastcol=Math.floor(eval(-1 + startat) % 8);
lastrow=Math.floor(eval(-1 + startat) / 8);
startat-=9;
}
lastcol=Math.floor(eval(-1 + asq) % 8);
lastrow=Math.floor(eval(-1 + asq) / 8);
startat=eval(-7 + asq);
while (startat >= 1 && startat <= 64 && Math.abs(lastcol - Math.floor(eval(-1 + startat) % 8)) == 1 && Math.abs(lastrow - Math.floor(eval(-1 + startat) / 8)) == 1) { // && startcol == Math.floor(eval(-1 + startat) % 8)) {
if (thebrd.indexOf('_' + startat + 'w') != -1) {
twos=thebrd.split('_' + startat + 'w');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
break;
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('Q') != -1 || twos[0].slice(-3).indexOf('B') != -1) {
isbad=true;
//alert(41);
return asq;
}
}
} else if (thebrd.indexOf('_' + startat + 'b') != -1) {
twos=thebrd.split('_' + startat + 'b');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
break;
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('Q') != -1 || twos[0].slice(-3).indexOf('B') != -1) {
isbad=true;
//alert(42);
return asq;
}
}
} else if (thebrd.indexOf('_' + startat + '&') != -1) {
twos=thebrd.split('_' + startat + '&');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
break;
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('Q') != -1 || twos[0].slice(-3).indexOf('B') != -1) {
isbad=true;
//alert(43);
return asq;
}
}
}
lastcol=Math.floor(eval(-1 + startat) % 8);
lastrow=Math.floor(eval(-1 + startat) / 8);
startat-=7;
}
lastcol=Math.floor(eval(-1 + asq) % 8);
lastrow=Math.floor(eval(-1 + asq) / 8);
startat=eval(9 + asq);
while (startat >= 1 && startat <= 64 && Math.abs(lastcol - Math.floor(eval(-1 + startat) % 8)) == 1 && Math.abs(lastrow - Math.floor(eval(-1 + startat) / 8)) == 1) { // && startcol == Math.floor(eval(-1 + startat) % 8)) {
if (thebrd.indexOf('_' + startat + 'w') != -1) {
twos=thebrd.split('_' + startat + 'w');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
break;
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('Q') != -1 || twos[0].slice(-3).indexOf('B') != -1) {
isbad=true;
//alert(44);
return asq;
}
}
} else if (thebrd.indexOf('_' + startat + 'b') != -1) {
twos=thebrd.split('_' + startat + 'b');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
break;
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('Q') != -1 || twos[0].slice(-3).indexOf('B') != -1) {
isbad=true;
//alert(45);
return asq;
}
}
} else if (thebrd.indexOf('_' + startat + '&') != -1) {
twos=thebrd.split('_' + startat + '&');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
break;
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('Q') != -1 || twos[0].slice(-3).indexOf('B') != -1) {
isbad=true;
//alert(46);
return asq;
}
}
}
lastcol=Math.floor(eval(-1 + startat) % 8);
lastrow=Math.floor(eval(-1 + startat) / 8);
startat+=9;
}
lastcol=Math.floor(eval(-1 + asq) % 8);
lastrow=Math.floor(eval(-1 + asq) / 8);
startat=eval(7 + asq);
while (startat >= 1 && startat <= 64 && Math.abs(lastcol - Math.floor(eval(-1 + startat) % 8)) == 1 && Math.abs(lastrow - Math.floor(eval(-1 + startat) / 8)) == 1) { // && startcol == Math.floor(eval(-1 + startat) % 8)) {
//alert('checking square ' + startat);
if (thebrd.indexOf('_' + startat + 'w') != -1) {
twos=thebrd.split('_' + startat + 'w');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
break;
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('Q') != -1 || twos[0].slice(-3).indexOf('B') != -1) {
isbad=true;
//alert(51);
return asq;
}
}
} else if (thebrd.indexOf('_' + startat + 'b') != -1) {
twos=thebrd.split('_' + startat + 'b');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
break;
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('Q') != -1 || twos[0].slice(-3).indexOf('B') != -1) {
isbad=true;
//alert(52);
return asq;
}
}
} else if (thebrd.indexOf('_' + startat + '&') != -1) {
twos=thebrd.split('_' + startat + '&');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
break;
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('Q') != -1 || twos[0].slice(-3).indexOf('B') != -1) {
isbad=true;
//alert(53);
return asq;
}
}
}
lastcol=Math.floor(eval(-1 + startat) % 8);
lastrow=Math.floor(eval(-1 + startat) / 8);
startat+=7;
}
// Knight check
for (ikposa=0; ikposa<kposa.length; ikposa++) {
startat=eval(kposa[ikposa] + asq);
if (startat >= 1 && startat <= 64 && startrow != Math.floor(eval(-1 + startat) / 8) && startcol != Math.floor(eval(-1 + startat) % 8)) {
if (thebrd.indexOf('_' + startat + 'w') != -1) {
twos=thebrd.split('_' + startat + 'w');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
twos[0]=twos[0];
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('K1') != -1 || twos[0].slice(-3).indexOf('K2') != -1) {
isbad=true;
//alert(61);
return asq;
}
}
} else if (thebrd.indexOf('_' + startat + 'b') != -1) {
twos=thebrd.split('_' + startat + 'b');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
twos[0]=twos[0];
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('K1') != -1 || twos[0].slice(-3).indexOf('K2') != -1) {
isbad=true;
//alert(62);
return asq;
}
}
} else if (thebrd.indexOf('_' + startat + '&') != -1) {
twos=thebrd.split('_' + startat + '&');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
twos[0]=twos[0];
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('K1') != -1 || twos[0].slice(-3).indexOf('K2') != -1) {
isbad=true;
//alert(63);
return asq;
}
}
}
}
}
// Pawn check
for (ikposa=0; ikposa<pposa.length; ikposa++) {
startat=eval(pposa[ikposa] + asq);
if (startat >= 1 && startat <= 64 && startrow != Math.floor(eval(-1 + startat) / 8) && startcol != Math.floor(eval(-1 + startat) % 8)) {
if (thebrd.indexOf('_' + startat + 'w') != -1) {
twos=thebrd.split('_' + startat + 'w');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
twos[0]=twos[0];
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('P') != -1) {
isbad=true;
//alert(71);
return asq;
}
}
} else if (thebrd.indexOf('_' + startat + 'b') != -1) {
twos=thebrd.split('_' + startat + 'b');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
twos[0]=twos[0];
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('P') != -1) {
isbad=true;
//alert(72);
return asq;
}
}
} else if (thebrd.indexOf('_' + startat + '&') != -1) {
twos=thebrd.split('_' + startat + '&');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
twos[0]=twos[0];
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('P') != -1) {
isbad=true;
//alert(73);
return asq;
}
}
}
}
}
// King too near King check
for (ikgposa=0; ikgposa<kgposa.length; ikgposa++) {
startat=eval(kgposa[ikgposa] + asq);
//alert('startat=' + startat + ' and asq=' + asq + ' ' + thebrd);
if (startat >= 1 && startat <= 64) { // && startrow != Math.floor(eval(-1 + startat) / 8) && startcol != Math.floor(eval(-1 + startat) % 8)) {
if (thebrd.indexOf('_' + startat + 'w') != -1) {
twos=thebrd.split('_' + startat + 'w');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
twos[0]=twos[0];
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('K') != -1 && twos[0].slice(-3).indexOf('K1') == -1 && twos[0].slice(-3).indexOf('K2') == -1) {
iswrong=true;
if (alertallowed) { alert('Kings can not be this close together.'); }
//alert(91);
return asq;
}
}
} else if (thebrd.indexOf('_' + startat + 'b') != -1) {
twos=thebrd.split('_' + startat + 'b');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
twos[0]=twos[0];
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('K') != -1 && twos[0].slice(-3).indexOf('K1') == -1 && twos[0].slice(-3).indexOf('K2') == -1) {
iswrong=true;
if (alertallowed) { alert('Kings can not be this close together.'); }
//alert(92);
return asq;
}
}
} else if (thebrd.indexOf('_' + startat + '&') != -1) {
twos=thebrd.split('_' + startat + '&');
if (twos[0].slice(-3).indexOf(bwfriend) != -1) {
twos[0]=twos[0];
} else if (twos[0].slice(-3).indexOf(bwenemy) != -1) {
if (twos[0].slice(-3).indexOf('K') != -1 && twos[0].slice(-3).indexOf('K1') == -1 && twos[0].slice(-3).indexOf('K2') == -1) {
iswrong=true;
if (alertallowed) { alert('Kings can not be this close together.'); }
//alert(93);
return asq;
}
}
}
}
}
return asq;
}
function wrtincheck(thepiece, theboard) {
//if (theboard.length < 70) { alert('endboard=' + endboard); }
thissquare=-1;
eightaround=[-1,-1,-1,-1,-1,-1,-1,-1,-1];
if (theboard.indexOf(thepiece + '_') == -1 && theboard.indexOf(thepiece.replace('w','!').replace('b','W').replace('!', 'b').toLowerCase() + '_') != -1) {
if (thepiece.substring(0,1) == 'w') {
wstartsincheck=true;
wendsincheck=true;
alert('Checkmate! Congratulations, ' + playerb);
return true;
} else {
bstartsincheck=true;
bendsincheck=true;
alert('Checkmate! Congratulations, ' + playerw);
return true;
}
} else {
// Get this square and eight squares around
//alert('theboard=' + theboard + ' and thepiece=' + thepiece);
thissquare=eval('' + theboard.split(thepiece + '_')[1].split('b')[0].split('w')[0].split('&')[0]);
eightaround[0]=anybw(thissquare, theboard, thepiece.substring(0,1).replace('w','!').replace('b','W').replace('!', 'b').toLowerCase(), false);
if (isbad && thepiece.substring(0,1) == 'w') {
consolelog(playerw + ', your King is in check.');
}
if (isbad && thepiece.substring(0,1) == 'b') {
consolelog(playerb + ', your King is in check.');
}
if (1 == 7) {
if (eval(-9 + thissquare) >= 1 && eval(-9 + thissquare) <= 64) {
eightaround[1]=anybw(eval(-9 + thissquare), theboard, thepiece.substring(0,1).replace('w','!').replace('b','W').replace('!', 'b').toLowerCase(), false);
}
if (eval(-8 + thissquare) >= 1 && eval(-8 + thissquare) <= 64) {
eightaround[2]=anybw(eval(-8 + thissquare), theboard, thepiece.substring(0,1).replace('w','!').replace('b','W').replace('!', 'b').toLowerCase(), false);
}
if (eval(-7 + thissquare) >= 1 && eval(-7 + thissquare) <= 64) {
eightaround[3]=anybw(eval(-7 + thissquare), theboard, thepiece.substring(0,1).replace('w','!').replace('b','W').replace('!', 'b').toLowerCase(), false);
}
if (eval(-1 + thissquare) >= 1 && eval(-1 + thissquare) <= 64) {
eightaround[4]=anybw(eval(-1 + thissquare), theboard, thepiece.substring(0,1).replace('w','!').replace('b','W').replace('!', 'b').toLowerCase(), false);
}
if (eval(1 + thissquare) >= 1 && eval(1 + thissquare) <= 64) {
eightaround[5]=anybw(eval(1 + thissquare), theboard, thepiece.substring(0,1).replace('w','!').replace('b','W').replace('!', 'b').toLowerCase(), false);
}
if (eval(7 + thissquare) >= 1 && eval(7 + thissquare) <= 64) {
eightaround[6]=anybw(eval(7 + thissquare), theboard, thepiece.substring(0,1).replace('w','!').replace('b','W').replace('!', 'b').toLowerCase(), false);
}
if (eval(8 + thissquare) >= 1 && eval(8 + thissquare) <= 64) {
eightaround[7]=anybw(eval(8 + thissquare), theboard, thepiece.substring(0,1).replace('w','!').replace('b','W').replace('!', 'b').toLowerCase(), false);
}
if (eval(9 + thissquare) >= 1 && eval(9 + thissquare) <= 64) {
eightaround[8]=anybw(eval(9 + thissquare), theboard, thepiece.substring(0,1).replace('w','!').replace('b','W').replace('!', 'b').toLowerCase(), false);
}
}
}
}
function checkstartcheck() {
var mbits=amove.split('_'), ppbits=[], prerepbit='', repbit='', tdso=[], itdso=0;
if (document.getElementById('fshare')) {
if (document.getElementById('fshare').innerHTML.indexOf('_') != -1) {
if (tradmove(trad + '&move=' + amove).indexOf('_') != -1) {
startboard=tradmove(trad + '&move=' + amove);
} else {
startboard=document.getElementById('fshare').href.split('&')[0] + '&';
}
if (startboard.indexOf('_') == -1) { startboard=document.getElementById('fshare').innerHTML; }
if (eval('' + mbits.length) >= 3) {
if (startboard.indexOf('_' + mbits[2] + 'w') != -1) {
ppbits=startboard.split('_' + mbits[2] + 'w');
repbit='_' + mbits[2] + 'w';
while (ppbits[0].slice(-1) != 'w' && ppbits[0].slice(-1) != 'b') {
prerepbit=ppbits[0].slice(-1) + prerepbit;
ppbits[0]=ppbits[0].substring(0, eval(-1 + eval('' + ppbits[0].length)));
}
prerepbit=ppbits[0].slice(-1) + prerepbit;
startboard=startboard.replace(prerepbit + repbit, 'w');
} else if (startboard.indexOf('_' + mbits[2] + 'b') != -1) {
ppbits=startboard.split('_' + mbits[2] + 'b');
repbit='_' + mbits[2] + 'b';
while (ppbits[0].slice(-1) != 'w' && ppbits[0].slice(-1) != 'b') {
prerepbit=ppbits[0].slice(-1) + prerepbit;
ppbits[0]=ppbits[0].substring(0, eval(-1 + eval('' + ppbits[0].length)));
}
prerepbit=ppbits[0].slice(-1) + prerepbit;
startboard=startboard.replace(prerepbit + repbit, 'b');
} else if (startboard.indexOf('_' + mbits[2] + '&') != -1) {
ppbits=startboard.split('_' + mbits[2] + '&');
repbit='_' + mbits[2] + '&';
while (ppbits[0].slice(-1) != 'w' && ppbits[0].slice(-1) != 'b') {
prerepbit=ppbits[0].slice(-1) + prerepbit;
ppbits[0]=ppbits[0].substring(0, eval(-1 + eval('' + ppbits[0].length)));
}
prerepbit=ppbits[0].slice(-1) + prerepbit;
startboard=startboard.replace(prerepbit + repbit, '&');
}
}
}
} else {
startboard='';
if (tradmove(trad + '&move=' + amove).indexOf('_') != -1) {
startboard=tradmove(trad + '&move=' + amove);
} else {
tdso=document.getElementsByTagName('td');
for (itdso=0; itdso<tdso.length; itdso++) {
if (tdso[itdso].outerHTML.indexOf(' data-square="') != -1 && tdso[itdso].outerHTML.indexOf(' data-piece="') != -1) {
startboard+=tdso[itdso].outerHTML.split(' data-piece="')[1].split('"')[0] + '_' + tdso[itdso].outerHTML.split(' data-square="')[1].split('"')[0];
}
}
}
if (document.getElementById('fnodz')) {
document.getElementById('fnodz').innerHTML+='<a id=fshare href="mailto:?subject=Chess&body=' + startboard + '" style=display:none;>' + startboard + '</a>';
}
}
if (startboard == '') {
if (tradmove(trad + '&move=' + amove).indexOf('_') != -1) {
startboard=tradmove(trad + '&move=' + amove);
} else {
for (var iix=0; iix<cpa.length; iix++) {
startboard+=cpa[iix] + '_' + eval(1 + staidmap[iix]);
}
}
startboard+='&';
if (document.getElementById('fshare')) {
document.getElementById('fshare').href='mailto:?subject=Chess&body=' + startboard;
document.getElementById('fshare').innerHTML=startboard;
} else if (document.getElementById('fnodz')) {
document.getElementById('fnodz').innerHTML+='<a id=fshare href="mailto:?subject=Chess&body=' + startboard + '" style=display:none;>' + startboard + '</a>';
}
}
if (document.URL.indexOf(deq('draughts')) == -1) {
wstartsincheck=wrtincheck('wK', startboard);
bstartsincheck=wrtincheck('bK', startboard);
}
if (iswrong) {
alert('In a chess game the two Kings can not be this close');
}
}
function firstok(inm) {
if (document.URL.indexOf(deq('draughts')) != -1) { return inm; }
if (inm == 'bP1_9_17') { return inm; }
if (inm == 'bP1_9_25') { return inm; }
if (inm == 'bP2_10_18') { return inm; }
if (inm == 'bP2_10_26') { return inm; }
if (inm == 'bP3_11_19') { return inm; }
if (inm == 'bP3_11_27') { return inm; }
if (inm == 'bP4_12_20') { return inm; }
if (inm == 'bP4_12_28') { return inm; }
if (inm == 'bP5_13_21') { return inm; }
if (inm == 'bP5_13_29') { return inm; }
if (inm == 'bP6_14_22') { return inm; }
if (inm == 'bP6_14_30') { return inm; }
if (inm == 'bP7_15_23') { return inm; }
if (inm == 'bP7_15_31') { return inm; }
if (inm == 'bP8_16_24') { return inm; }
if (inm == 'bP8_16_32') { return inm; }
if (inm == 'bK1_2_17') { return inm; } //if (inm == 'bK1_3_20') { return inm; }
if (inm == 'bK1_2_20') { return inm; } // if (inm == 'bK1_3_22') { return inm; }
if (inm == 'bK2_7_22') { return inm; } // if (inm == 'bK2_6_23') { return inm; }
if (inm == 'bK2_7_24') { return inm; } // if (inm == 'bK2_6_25') { return inm; }
if (inm == 'wK1_58_41') { return inm; } // if (inm == 'wK1_59_42') { return inm; }
if (inm == 'wK1_58_43') { return inm; } // if (inm == 'wK1_59_44') { return inm; }
if (inm == 'wK2_63_48') { return inm; } // if (inm == 'wK2_62_45') { return inm; }
if (inm == 'wK2_63_46') { return inm; } // if (inm == 'wK2_62_47') { return inm; }
if (inm == 'wP1_49_41') { return inm; }
if (inm == 'wP1_49_33') { return inm; }
if (inm == 'wP2_50_42') { return inm; }
if (inm == 'wP2_50_34') { return inm; }
if (inm == 'wP3_51_43') { return inm; }
if (inm == 'wP3_51_35') { return inm; }
if (inm == 'wP4_52_44') { return inm; }
if (inm == 'wP4_52_36') { return inm; }
if (inm == 'wP5_53_45') { return inm; }
if (inm == 'wP5_53_37') { return inm; }
if (inm == 'wP6_54_46') { return inm; }
if (inm == 'wP6_54_38') { return inm; }
if (inm == 'wP7_55_47') { return inm; }
if (inm == 'wP7_55_39') { return inm; }
if (inm == 'wP8_56_48') { return inm; }
if (inm == 'wP8_56_40') { return inm; }
return '';
}
function tradmove(proposedtm) {
var outp=proposedtm, idoneoh='';
if (gval != '') { return gval; }
if (outp.indexOf('_') != -1 && outp.split('&')[0].indexOf('_') == -1) {
outp='';
for (var iix=0; iix<cpa.length; iix++) {
outp+=cpa[iix] + '_' + eval(1 + staidmap[iix]);
}
startboard=outp + '&';
endboard=outp + '&';
var mbits=amove.split('_'), ppbits=[], prerepbit='', repbit='';
if (eval('' + mbits.length) >= 3) {
if (2 == 12) {
lastmove=amove;
//amove='';
fixamove(lastmove);
consolelog('Chess piece ' + mbits[0] + ' moved from square ' + mbits[1] + ' to ' + mbits[2]);
} else {
if (amove != '') {
lastmove=firstok(amove);
if (lastmove != '') {
var tdsz=document.getElementsByTagName('td'), itdsz=0;
for (itdsz=0; itdsz<tdsz.length; itdsz++) {
if (tdsz[itdsz].outerHTML.indexOf(' data-square="' + mbits[1] + '"') != -1) {
idzero=tdsz[itdsz].id;
mbits[0]=mbits[0].substring(0,1).toLowerCase() + mbits[0].substring(1).substring(0,1).toUpperCase() + mbits[0].substring(2);
//alert(mbits[0] + ' ' + tdsz[itdsz].outerHTML);
if (tdsz[itdsz].outerHTML.indexOf(' data-piece="' + mbits[0] + '"') != -1) {
idone='' + tdsz[itdsz].outerHTML.split(' data-square="' + mbits[1] + '"')[1].split('>')[1].split(' id="')[1].split('"')[0];
idoneoh=document.getElementById(idone).outerHTML;
//alert('175 ' + idone);
//document.getElementById(idone).addEventListener("click", (ev) => { gev=ev; if (1 == 1) { setTimeout(delayedrefit, 500); } else { refit(ev); } });
//domcmds.push("document.getElementById('" + idone + "').click();");
} else {
idone='' + tdsz[itdsz].id;
//alert('176 ' + idone);
//tdsz[itdsz].click();
//document.getElementById(idone).addEventListener("click", (ev) => { gev=ev; if (1 == 1) { setTimeout(delayedrefit, 500); } else { refit(ev); } });
//domcmds.push("document.getElementById('" + idone + "').click();");
}
}
}
for (itdsz=0; itdsz<tdsz.length; itdsz++) {
if (tdsz[itdsz].outerHTML.indexOf(' data-square="' + mbits[2] + '"') != -1) {
if (tdsz[itdsz].outerHTML.indexOf(' data-piece="') != -1) {
//alert(276);
idtwo='' + tdsz[itdsz].outerHTML.split(' data-square="' + mbits[2] + '"')[1].split('>')[1].split(' id="')[1].split('"')[0];
//document.getElementById(idtwo).addEventListener("click", (ev) => { gev=ev; if (1 == 1) { setTimeout(delayedrefit, 500); } else { refit(ev); } });
domcmds.push("document.getElementById('" + idtwo + "').click();");
} else {
//alert(376);
idtwo='' + tdsz[itdsz].id;
if (idoneoh != '') {
document.getElementById(idzero).innerHTML='';
tdsz[itdsz].innerHTML=idoneoh;
if (amove != '') {
lastmove=amove;
document.getElementById('pstatus').setAttribute('data-decided', 'bw');
nextmove=eval('' + mbits[2]);
consolelog('Chess piece ' + mbits[0] + ' moved from square ' + mbits[1] + ' to square ' + mbits[2]);
//amove='';
fixamove(lastmove);
itisthiscmove=amove.substring(0,1).replace('b','!').replace('w','B').replace('!','W').toLowerCase();
}
}
//tdsz[itdsz].click();
//document.getElementById(idtwo).addEventListener("click", (ev) => { gev=ev; if (1 == 1) { setTimeout(delayedrefit, 500); } else { refit(ev); } });
//domcmds.push("document.getElementById('" + idone + "').click();");
}
}
}
}
}
}
}
gval=outp + '&' + proposedtm.split('&')[1];
return outp + '&' + proposedtm.split('&')[1];
}
gval=outp;
return outp;
}
function fixabw(thebname, thewname) {
if (document.getElementById('fshare')) {
//alert('HeRe');
var mbits=amove.split('_'), ppbits=[], prerepbit='', repbit='';
if (eval('' + mbits.length) >= 3) {
//if (endboard.indexOf((mbits[0] + '_' + mbits[1])) == -1) { alert('prepostOOPS'); }
//if (document.getElementById('fshare').href.indexOf((mbits[0] + '_' + mbits[1])) == -1) { alert('preOOPS'); }
//if (document.getElementById('fshare').innerHTML.indexOf((mbits[0] + '_' + mbits[1])) == -1) { alert('apreOOPS'); }
//if (document.getElementById('fshare').href.indexOf(encodeURIComponent(mbits[0] + '_' + mbits[1])) == -1) { alert('bpreOOPS'); }
//alert(document.getElementById('fshare').href);
if (document.getElementById('fshare').href.indexOf('_' + mbits[2] + 'w') != -1) { //|| document.getElementById('fshare').href.indexOf('_' + mbits[2] + 'b') != -1document.getElementById('fshare').href.indexOf('_' + mbits[2] + '&') != -1) {
ppbits=document.getElementById('fshare').href.split('_' + mbits[2] + 'w');
repbit='_' + mbits[2] + 'w';
while (ppbits[0].slice(-1) != 'w' && ppbits[0].slice(-1) != 'b') {
prerepbit=ppbits[0].slice(-1) + prerepbit;
ppbits[0]=ppbits[0].substring(0, eval(-1 + eval('' + ppbits[0].length)));
}
prerepbit=ppbits[0].slice(-1) + prerepbit;
document.getElementById('fshare').href=document.getElementById('fshare').href.replace(prerepbit + repbit, 'w');
} else if (document.getElementById('fshare').href.indexOf('_' + mbits[2] + 'b') != -1) { //|| document.getElementById('fshare').href.indexOf('_' + mbits[2] + 'b') != -1document.getElementById('fshare').href.indexOf('_' + mbits[2] + '&') != -1) {
ppbits=document.getElementById('fshare').href.split('_' + mbits[2] + 'b');
repbit='_' + mbits[2] + 'b';
while (ppbits[0].slice(-1) != 'w' && ppbits[0].slice(-1) != 'b') {
prerepbit=ppbits[0].slice(-1) + prerepbit;
ppbits[0]=ppbits[0].substring(0, eval(-1 + eval('' + ppbits[0].length)));
}
prerepbit=ppbits[0].slice(-1) + prerepbit;
document.getElementById('fshare').href=document.getElementById('fshare').href.replace(prerepbit + repbit, 'b');
} else if (document.getElementById('fshare').href.indexOf('_' + mbits[2] + '&') != -1) { //|| document.getElementById('fshare').href.indexOf('_' + mbits[2] + 'b') != -1document.getElementById('fshare').href.indexOf('_' + mbits[2] + '&') != -1) {
ppbits=document.getElementById('fshare').href.split('_' + mbits[2] + '&');
repbit='_' + mbits[2] + '&';
while (ppbits[0].slice(-1) != 'w' && ppbits[0].slice(-1) != 'b') {
prerepbit=ppbits[0].slice(-1) + prerepbit;
ppbits[0]=ppbits[0].substring(0, eval(-1 + eval('' + ppbits[0].length)));
}
prerepbit=ppbits[0].slice(-1) + prerepbit;
document.getElementById('fshare').href=document.getElementById('fshare').href.replace(prerepbit + repbit, '&');
}
//if (document.getElementById('fshare').href.indexOf((mbits[0] + '_' + mbits[1])) == -1) { alert('OOPS'); }
document.getElementById('fshare').href=document.getElementById('fshare').href.replace((mbits[0] + '_' + mbits[1]), (mbits[0] + '_' + mbits[2])).replace(/\+\(black\)\+\(black\)/g,'+(black)').replace(/\+\(white\)\+\(white\)/g,'+(white)').replace('wR_','wR1_');
if (startboard == '') {
startboard=document.getElementById('fshare').href; // new
//if (startboard.indexOf('bP2') == -1) { alert('OoPs'); }
//alert('sb=' + startboard);
}
}
if (decodeURIComponent(document.getElementById('fshare').href).indexOf('bname=' + encodeURIComponent(thebname)) == -1 && decodeURIComponent(document.getElementById('fshare').href).indexOf('bname=') != -1) {
document.getElementById('fshare').href=document.getElementById('fshare').href.replace(encodeURIComponent('bname='), encodeURIComponent('bname=' + encodeURIComponent(thebname) + '&x=x')).replace('wR_','wR1_');
}
if (decodeURIComponent(document.getElementById('fshare').href).indexOf('wname=' + encodeURIComponent(thewname)) == -1 && decodeURIComponent(document.getElementById('fshare').href).indexOf('wname=') != -1) {
document.getElementById('fshare').href=document.getElementById('fshare').href.replace(encodeURIComponent('wname='), encodeURIComponent('wname=' + encodeURIComponent(thewname) + '&x=x')).replace('wR_','wR1_');
}
if (startboard == '') {
if (tradmove(trad + '&move=' + amove).indexOf('_') != -1) {
startboard=tradmove(trad + '&move=' + amove);
} else {
for (var iix=0; iix<cpa.length; iix++) {
startboard+=cpa[iix] + '_' + eval(1 + staidmap[iix]);
}
}
startboard+='&';
if (document.getElementById('fshare')) {
document.getElementById('fshare').href='mailto:?subject=Chess&body=' + startboard;
document.getElementById('fshare').innerHTML=startboard;
} else if (document.getElementById('fnodz')) {
document.getElementById('fnodz').innerHTML+='<a id=fshare href="mailto:?subject=Chess&body=' + startboard + '" style=display:none;>' + startboard + '</a>';
}
endboard=startboard;
}
//alert('startboard=' + startboard);
if (endboard == '') {
if (tradmove(trad + '&move=' + amove).indexOf('_') != -1) {
endboard=tradmove(trad + '&move=' + amove);
//if (endboard.indexOf((mbits[0] + '_' + mbits[1])) == -1) { alert('qprepostOOPS'); } else { alert('good'); }
document.getElementById('fshare').innerHTML=endboard;
if (startboard == '') { startboard=endboard; }
}
}
if (document.getElementById('fshare')) {
if (endboard == '') {
endboard=document.getElementById('fshare').href.split('&')[0] + '&';
if (endboard.indexOf('_') == -1) { endboard=document.getElementById('fshare').innerHTML; }
if (startboard == '') { startboard=endboard; }
}
if (endboard.indexOf('_') == -1 && tradmove(trad + '&move=' + amove).indexOf('_') != -1) {
endboard=tradmove(trad + '&move=' + amove);
if (startboard == '') { startboard=endboard; }
}
//alert('Endboard=' + endboard);
if (document.URL.indexOf(deq('draughts')) == -1) {
wendsincheck=wrtincheck('wK', endboard);
if (iswrong) { alert('Kings can not be this close.'); return ' '; }
if (isbad) { return 'w'; }
bendsincheck=wrtincheck('bK', endboard);
if (iswrong) { alert('Kings can not be this close.'); return ' '; }
if (isbad) { return 'b'; }
}
startboard=endboard;
}
}
return '';
}
function fixamove(proposedmove) {
var subjbit='';
var atrue=true, btrue='';
var wasfs='';
if (document.getElementById('fshare')) {
wasfs=document.getElementById('fshare').href;
}
if (document.getElementById('fshare') && twosubsfrom[0] != '' && eval('' + onenewmove.length) == 1 && proposedmove == '') {
//alert('567 ' + wasfs);
proposedmove=onenewmove[0];
var washref=document.getElementById('fshare').href;
if (twosubsfrom[0] == 'bR1') {
washref=washref.replace('bR1_1', 'bR1_4');
washref=washref.replace('bK_5', 'bK_2');
proposedmove='bK_2_3';
endboard=washref.replace('bK_2','bK_3');
} else if (twosubsfrom[0] == 'bR2') {
washref=washref.replace('bR2_8', 'bR2_6');
washref=washref.replace('bK_5', 'bK_8');
proposedmove='bK_8_7';
endboard=washref.replace('bK_8','bK_7');
} else if (twosubsfrom[0] == 'wR1') {
washref=washref.replace('wR1_57', 'wR1_60');
washref=washref.replace('wK_61', 'wK_58');
proposedmove='bK_58_59';
endboard=washref.replace('wK_58','wK_59');
} else if (twosubsfrom[0] == 'wR2') {
washref=washref.replace('wR2_64', 'wR2_62');
washref=washref.replace('wK_61', 'wK_64');
proposedmove='bK_64_63';
endboard=washref.replace('wK_64','wK_63');
}
onenewmove=[];
document.getElementById('fshare').href=washref;
//endboard=washref;
btrue=fixabw(playerb, playerw);
if (btrue != '') {
if (btrue == 'w' && proposedmove.substring(0,1) == 'w') {
onenewmove=[];
atrue=false;
consolelog(playerw + ', your King is in check with this move.');
ouralert(playerw + ', your King is in check with this move.');
if (wasfs != '') {
document.getElementById('fshare').href=wasfs;
endboard=startboard;
}
return atrue;
} else if (btrue == 'b' && proposedmove.substring(0,1) == 'b') {
onenewmove=[];
atrue=false;
consolelog(playerb + ', your King is in check with this move.');
ouralert(playerb + ', your King is in check with this move.');
if (wasfs != '') {
document.getElementById('fshare').href=wasfs;
endboard=startboard;
}
return atrue;
} else if (btrue == 'w' && proposedmove.substring(0,1) == 'b') {
consolelog(playerw + ', your King has been put into check.');
setTimeout(function(){ ouralert(playerw + ', your King has been put into check.'); }, 1000);
} else if (btrue == 'b' && proposedmove.substring(0,1) == 'w') {
consolelog(playerb + ', your King has been put into check.');
setTimeout(function(){ ouralert(playerb + ', your King has been put into check.'); }, 1000);
} else if (btrue == ' ') {
onenewmove=[];
atrue=false;
consolelog('This move has caused Kings to be too close together.');
ouralert('This move has caused Kings to be too close together.');
if (wasfs != '') {
document.getElementById('fshare').href=wasfs;
endboard=startboard;
}
return atrue;
}
}
twosubsfrom[0]='';
twosubsto[0]='';
}
if (document.getElementById('fshare') && proposedmove.trim() != '') {
//if (5 == 5) { endboard=document.getElementById('fshare').innerHTML; if (document.getElementById('fshare').href.indexOf(endboard) != -1) { alert('ouch '); } }
//alert('HeRE ' + proposedmove + ' ' + endboard);
var mbits=proposedmove.split('_');
if (endboard == '') {
if (tradmove(trad + '&move=' + amove).indexOf('_') != -1) {
endboard=tradmove(trad + '&move=' + amove);
}
endboard=document.getElementById('fshare').href;
}
//alert('proposedmove=' + proposedmove);
endboard=endboard.replace(encodeURIComponent(mbits[0] + '_' + mbits[1]), encodeURIComponent(mbits[0] + '_' + mbits[2])).replace((mbits[0] + '_' + mbits[1]), (mbits[0] + '_' + mbits[2]));
//startboard=endboard;
//alert('EndBoard=' + endboard + ' ' + document.getElementById('fshare').href);
btrue=fixabw(playerb, playerw);
if (btrue != '') {
if (btrue == 'w' && proposedmove.substring(0,1) == 'w') {
onenewmove=[];
atrue=false;
consolelog(playerw + ', your King is in check with this move.');
setTimeout(function(){ ouralert(playerw + ', your King is in check with this move.'); itisthiscmove='w'; }, 5000);
if (wasfs != '') {
document.getElementById('fshare').href=wasfs;
endboard=startboard;
}
return atrue;
} else if (btrue == 'b' && proposedmove.substring(0,1) == 'b') {
onenewmove=[];
atrue=false;
consolelog(playerb + ', your King is in check with this move.');
setTimeout(function(){ ouralert(playerb + ', your King is in check with this move.'); itisthiscmove='b'; }, 5000);
if (wasfs != '') {
document.getElementById('fshare').href=wasfs;
endboard=startboard;
}
return atrue;
} else if (btrue == 'w' && proposedmove.substring(0,1) == 'b') {
consolelog(playerw + ', your King has been put into check.');
setTimeout(function(){ ouralert(playerw + ', your King has been put into check.'); }, 5000);
} else if (btrue == 'b' && proposedmove.substring(0,1) == 'w') {
consolelog(playerb + ', your King has been put into check.');
setTimeout(function(){ ouralert(playerb + ', your King has been put into check.'); }, 5000);
} else if (btrue == ' ' && proposedmove.substring(0,1) == 'w') {
onenewmove=[];
atrue=false;
consolelog('This move has caused Kings to be too close together.');
setTimeout(function(){ ouralert('This move has caused Kings to be too close together.'); itisthiscmove='w'; }, 5000);
if (wasfs != '') {
document.getElementById('fshare').href=wasfs;
endboard=startboard;
}
return atrue;
} else if (btrue == ' ' && proposedmove.substring(0,1) == 'b') {
onenewmove=[];
atrue=false;
consolelog('This move has caused Kings to be too close together.');
setTimeout(function(){ ouralert('This move has caused Kings to be too close together.'); itisthiscmove='b'; }, 5000);
if (wasfs != '') {
document.getElementById('fshare').href=wasfs;
endboard=startboard;
}
return atrue;
}
}
//alert(amove + ' vs ' + proposedmove + ' 78 ' + document.getElementById('fshare').href + ' ' + document.getElementById('pstatus').innerHTML);
if (amove == proposedmove && amove.substring(0,1) == 'w') {
setTimeout(function(){ document.getElementById('pstatus').innerHTML=document.getElementById('pstatus').innerHTML + ' Your next move ' + playerb; }, 2500);
} else if (amove == proposedmove && amove.substring(0,1) == 'b') {
setTimeout(function(){ document.getElementById('pstatus').innerHTML=document.getElementById('pstatus').innerHTML + ' Your next move ' + playerw; }, 2500);
}
document.getElementById('fshare').href=document.getElementById('fshare').href.replace(/\&$/g, encodeURIComponent('&move='));
if (amove == proposedmove) {
var wrd1='youllneverfindthis';
var wrd2='';
var mmbits=amove.split('_');
if (document.getElementById('fshare').href.indexOf('_' + mmbits[2] + 'w') != -1) {
wrd1=(document.getElementById('fshare').href.split('_' + mmbits[2] + 'w')[0].slice(-3) + '_' + mmbits[2]).replace(/^[0-9]/g,'');
} else if (document.getElementById('fshare').href.indexOf('_' + mmbits[2] + 'b') != -1) {
wrd1=(document.getElementById('fshare').href.split('_' + mmbits[2] + 'b')[0].slice(-3) + '_' + mmbits[2]).replace(/^[0-9]/g,'');
} else if ((document.getElementById('fshare').href + '&').indexOf('_' + mmbits[2] + '&') != -1) {
wrd1=((document.getElementById('fshare').href + '&').split('_' + mmbits[2] + '&')[0].slice(-3) + '_' + mmbits[2]).replace(/^[0-9]/g,'');
}
//if (document.getElementById('fshare').href.indexOf(mmbits[0] + '_' + mmbits[1]) == -1) {
//if (document.getElementById('fshare').href.indexOf(mmbits[0] + '_' + mmbits[2]) != -1) {
// alert('oh');
//}
// alert('oops');
//}
document.getElementById('fshare').href=document.getElementById('fshare').href.replace(wrd1,wrd2).replace(mmbits[0] + '_' + mmbits[1], mmbits[0] + '_' + mmbits[2]);
endboard=document.getElementById('fshare').href;
//} else {
//alert(89);
// document.getElementById('fshare').href=document.getElementById('fshare').innerHTML; // new idea
}
if (amove != proposedmove && decodeURIComponent(document.getElementById('fshare').href).indexOf('move=' + proposedmove) == -1 && decodeURIComponent(document.getElementById('fshare').href).indexOf('move=') != -1) {
//alert('178');
if (document.getElementById('fshare').href.indexOf(encodeURIComponent('&move=')) == -1) {
document.getElementById('fshare').href=document.getElementById('fshare').href.replace('&move=',encodeURIComponent('&wmoveas=')) + encodeURIComponent('&move=');
}
document.getElementById('fshare').href=document.getElementById('fshare').href.replace('&move=',encodeURIComponent('&wmoveas=')).replace(encodeURIComponent('move='), encodeURIComponent('move=' + proposedmove + '&x=x'));
if (document.getElementById('fshare').href.indexOf('body=') != -1 && document.getElementById('fshare').href.indexOf('body=' + encodeURIComponent(document.URL.split('?')[0])) == -1) {
document.getElementById('fshare').href=document.getElementById('fshare').href.replace('body=', 'body=' + encodeURIComponent(document.URL.split('?')[0] + '?wname=' + encodeURIComponent(playerw) + '&bname=' + encodeURIComponent(playerb) + '&traditional='));
}
//alert(document.getElementById('fshare').href);
subjbit=document.getElementById('fshare').href.split('&body=')[1];
//if (eval('' + mbits.length) >= 3) {
// subjbit=subjbit.replace(encodeURIComponent(mbits[0] + '_' + mbits[1]), encodeURIComponent(mbits[0] + '_' + mbits[2]));
//}
if (proposedmove.substring(0,1) == 'w') {
if (playerb.indexOf('[') != -1 && playerb.indexOf('[]') == -1) {
if (playerb.split('[')[1].split(']')[0].indexOf('@') != -1) {
document.getElementById('fshare').href='mailto:' + playerb.split('[')[1].split(']')[0] + '?subject=Chess%20Game&body=' + subjbit.replace(/\ /g,encodeURIComponent('+'));
//alert(document.getElementById('fshare').href);
//if (document.getElementById('fshare').href.indexOf('bP2') == -1) { alert('OoPs1'); }
checkxx(document.getElementById('fshare')).click();
setTimeout(function(){ alert('Email readied for ' + playerb.split('[')[1].split(']')[0]); }, 15000);
} else {
document.getElementById('fshare').href='sms:' + playerb.split('[')[1].split(']')[0] + '&body=' + subjbit.replace(/\ /g,encodeURIComponent('+'));
//alert(document.getElementById('fshare').href);
//if (document.getElementById('fshare').href.indexOf('bP2') == -1) { alert('OoPs2'); }
checkxx(document.getElementById('fshare')).click();
setTimeout(function(){ alert('SMS readied for ' + playerb.split('[')[1].split(']')[0]); }, 15000);
}
}
} else if (proposedmove.substring(0,1) == 'b') {
if (playerw.indexOf('[') != -1 && playerw.indexOf('[]') == -1) {
if (playerw.split('[')[1].split(']')[0].indexOf('@') != -1) {
document.getElementById('fshare').href='mailto:' + playerw.split('[')[1].split(']')[0] + '?subject=Chess%20Game&body=' + subjbit.replace(/\ /g,encodeURIComponent('+'));
//alert(document.getElementById('fshare').href);
//if (document.getElementById('fshare').href.indexOf('bP2') == -1) { alert('OoPs3'); }
checkxx(document.getElementById('fshare')).click();
setTimeout(function(){ alert('Email readied for ' + playerw.split('[')[1].split(']')[0]); }, 15000);
} else {
document.getElementById('fshare').href='sms:' + playerw.split('[')[1].split(']')[0] + '&body=' + subjbit.replace(/\ /g,encodeURIComponent('+'));
//alert(document.getElementById('fshare').href);
//if (document.getElementById('fshare').href.indexOf('bP2') == -1) { alert('OoPs4'); }
checkxx(document.getElementById('fshare')).click();
setTimeout(function(){ alert('SMS readied for ' + playerw.split('[')[1].split(']')[0]); }, 15000);
}
}
}
}
}
return atrue;
}
function checkxx(ina) {
var inas=ina.href.split('&x=x'), opiece='', ineas='';
var inase=ina.href.split(encodeURIComponent('&x=x'));
if (inas.length != 1) {
opiece=(amove + ina.href.split('&x=x')[eval(-1 + ina.href.split('&x=x').length)].split('&')[0]).split('_')[0];
if (opiece != '') {
//alert(65);
if (inas[0].indexOf(opiece) == -1) {
//alert(165);
var tos=document.getElementById('mytable').innerHTML.split(' data-piece="' + opiece + '"');
if (tos.length != 1) {
//alert(265);
var newsq=tos[0].split(' data-square="')[eval(-1 + tos[0].split(' data-square="').length)].split('"')[0];
//alert(ina.href);
ina.href=ina.href.replace(encodeURIComponent('traditional='), encodeURIComponent('traditional=' + opiece + '_' + newsq)).replace('traditional=', 'traditional=' + opiece + '_' + newsq);
}
}
}
inas=ina.href.split(('&x=x'));
ineas=(ina.href.replace(inas[0],'')).split(('&wname='))[0].split(('&bname='))[0].split(('&move='))[0];
if (ineas != '') { ina.href=ina.href.replace(ineas, '&x.x'); }
if (ina.href.split('body=')[1].indexOf((document.URL.replace('https:','http:').split('?')[0] + '?traditional=')) > 0) {
ina.href=ina.href.replace((document.URL.replace('https:','http:').split('?')[0] + '?traditional='), '');
}
} else if (inase.length != 1) {
opiece=(amove + ina.href.split(encodeURIComponent('&x=x'))[eval(-1 + ina.href.split(encodeURIComponent('&x=x')).length)].split(encodeURIComponent('&'))[0]).split('_')[0];
if (opiece != '') {
//alert('465 ' + opiece);
if (inase[0].indexOf(opiece) == -1) {
//alert(1165);
var tos=document.getElementById('mytable').innerHTML.split(' data-piece="' + opiece + '"');
if (tos.length != 1) {
//alert(1265);
var newsq=tos[0].split(' data-square="')[eval(-1 + tos[0].split(' data-square="').length)].split('"')[0];
ina.href=ina.href.replace(encodeURIComponent('traditional='), encodeURIComponent('traditional=' + opiece + '_' + newsq)).replace('traditional=', 'traditional=' + opiece + '_' + newsq);
//alert(ina.href);
}
}
}
inase=ina.href.split(encodeURIComponent('&x='));
ineas=(ina.href.replace(inase[0],'')).split(encodeURIComponent('&wname='))[0].split(encodeURIComponent('&bname='))[0].split(encodeURIComponent('&move='))[0];
if (ineas != '') { ina.href=ina.href.replace(ineas, encodeURIComponent('&x=x')); }
if (ina.href.split('body=')[1].indexOf(encodeURIComponent(document.URL.replace('https:','http:').split('?')[0] + '?traditional=')) > 0) {
ina.href=ina.href.replace(encodeURIComponent(document.URL.replace('https:','http:').split('?')[0] + '?traditional='), '');
}
}
if (document.URL.indexOf(deq('draughts')) != -1) {
ina.href=ina.href.replace(/move/g, 'draughts').replace(/Chess/g, 'Draughts');
}
return ina;
}
function consolelog(what) {
if (document.URL.indexOf('/chess') != -1) {
if (what.indexOf('Chess piece ') != -1) {
if (what.indexOf(' from square ') != -1) {
if (what.indexOf(' square ') != -1) {
lastmove=what.split('Chess piece ')[1].split(' ')[0] + '_' + what.split('Chess piece ')[1].split(' from square ')[1].split(' ')[0] + '_' + what.split('Chess piece ')[1].split(' from square ')[1].split(' square ')[1].split(' ')[0];
}
}
}
if (document.getElementById('pstatus')) {
if (document.getElementById('pstatus').innerHTML.indexOf(' ... Your next move ') != -1) {
document.getElementById('pstatus').innerHTML=('Move just made by ' + document.getElementById('pstatus').innerHTML.split('Your next move ')[eval(-1 + document.getElementById('pstatus').innerHTML.split('Your next move ').length)] + ' ... ' + what).replace(/\ \(black\)\ \(black\)/g,' (black)').replace(/\ \(white\)\ \(white\)/g,' (white)');
} else {
document.getElementById('pstatus').innerHTML+=(' ... ' + what.split(' ... ')[0] + ' ... ').replace(/\ \(black\)\ \(black\)/g,' (black)').replace(/\ \(white\)\ \(white\)/g,' (white)');
}
}
}
if (document.URL.indexOf(deq('draughts')) != -1) {
document.getElementById('pstatus').innerHTML=document.getElementById('pstatus').innerHTML.replace(/Chess\ /g, 'Draughts ');
console.log(what.replace(/Chess\ /g, 'Draughts '));
} else {
console.log(what);
}
}
function ouralert(what) {
if (document.URL.indexOf('/chess') != -1) {
if (document.getElementById('pstatus')) {
if (document.getElementById('pstatus').innerHTML.indexOf(' ... ') != -1) {
if (document.getElementById('pstatus').innerHTML.indexOf(' ... Your next move ') != -1) {
document.getElementById('pstatus').innerHTML='Move just made by ' + document.getElementById('pstatus').innerHTML.split('Your next move ')[eval(-1 + document.getElementById('pstatus').innerHTML.split('Your next move ').length)] + ' ... ' + what;
} else {
document.getElementById('pstatus').innerHTML+=' ... ' + what.split(' ... ')[0] + ' ... ';
}
}
}
}
if (document.URL.indexOf(deq('draughts')) != -1) { return alert(what.replace(/Chess\ /g, 'Draughts ')); }
return alert(what);
}
function rerefit() {
document.title=wastitle;
}
function delayedrefit() {
refit(gev);
}
function refit(ev) {
var waspl=prelegal;
prelegal=true;
if (wastitle == '') { wastitle=document.title; }
//document.title=itisthiscmove + ' ' + ev.target.id + ' at refit';
//if (ev.target.id == 'mytable') { document.title='mytable'; return true; }
//alert(15643);
if (lastitisthiscmove != itisthiscmove && ev.target.id != 'mytable') {
//alert(5643);
ppt=false;
//document.title=itisthiscmove + ' ' + ev.target.id + ' 1 at refit';
if (itisthiscmove != '' && itisthiscmove != (ev.target.outerHTML.split(' data-piece="')[1]).substring(0,1)) {
if (waspl) { ouralert('It is not your turn.'); }
} else {
lastitisthiscmove=(itisthiscmove + ev.target.outerHTML.split(' data-piece="')[1]).substring(0,1);
itisthiscmove=lastitisthiscmove;
if (itisthiscmove == 'b') {
consolelog('Your next move ' + playerb + ' ... ');
} else {
consolelog('Your next move ' + playerw + ' ... ');
}
//ouralert('no1 ' + lastitisthiscmove + ' ' + itisthiscmove + ' ' + ev.target.id);
if (ev.target.outerHTML.indexOf(' data-piece="') != -1) {
if (ev.target.outerHTML.split(' data-piece="')[1].substring(0,1) == (itisthiscmove + ev.target.outerHTML.split(' data-piece="')[1].substring(0,1)).substring(0,1)) {
//document.title=itisthiscmove + ' ' + ev.target.id + ' 1.0 at refit';
lohfulloh=ev.target.outerHTML;
newlohfulloh=ev.target.outerHTML;
hostid=bigv(newlohfulloh).split(' id="')[1].split('"')[0];
lastid=ev.target.id;
}
}
}
} else if (newlohfulloh != ev.target.outerHTML && ev.target.id != 'mytable') {
//ouralert('yes0 ' + lastitisthiscmove + ' ' + itisthiscmove + ' ' + ev.target.id);
lohfulloh=newlohfulloh;
//document.title=itisthiscmove + ' ' + ev.target.id + ' 2 at refit';
lastoh=newlohfulloh; //ev.target.outerHTML;
lastih='>' + newlohfulloh.split('</')[0].split('>')[eval(-1 + newlohfulloh.split('</')[0].split('>').length)] + '<'; //'>' + ev.target.innerHTML + '<';
console.log('yes ' + lastitisthiscmove + ' ' + itisthiscmove + ' ' + ev.target.id);
if (lohfulloh != '') {
console.log("lohfulloh=" + lohfulloh);
//ouralert('yes2 ' + lastitisthiscmove + ' ' + itisthiscmove + ' ' + ev.target.id);
if (lohfulloh.indexOf(' data-piece="') != -1) {
//ouralert('yes3 ' + lastitisthiscmove + ' ' + itisthiscmove + ' ' + ev.target.id);
if (ev.target.outerHTML.indexOf(' data-piece="') != -1 && ev.target.outerHTML != lohfulloh) {
//ouralert('yes4 ' + lastitisthiscmove + ' ' + itisthiscmove + ' ' + ev.target.id);
if (ev.target.outerHTML.split(' data-piece="')[1].substring(0,1) != lohfulloh.split(' data-piece="')[1].substring(0,1)) {
//ouralert('yes5 ' + lastitisthiscmove + ' ' + itisthiscmove + ' ' + ev.target.id);
console.log('Potential piece take');
ppt=true;
}
}
}
}
lastid=ev.target.id;
bcklastid=lastid;
loh=ev.target.id;
lohoh=bigv(ev.target.outerHTML.split('>')[0] + '></' + ev.target.outerHTML.substring(1).split(' ')[0].split('>')[0] + '>');
console.log("Drop 3");
if (newlohfulloh.indexOf(' data-piece="' + itisthiscmove + 'R') != -1 && ev.target.outerHTML.indexOf(' data-piece="' + itisthiscmove + 'K') != -1) {
if (mightbecastling(ev.target.outerHTML.split(' data-piece="')[1].split('"')[0], newlohfulloh.split(' data-piece="')[1].split('"')[0], ev.target.outerHTML, newlohfulloh) == 1) {
prelegal=false;
}
} else if (newlohfulloh.indexOf(' data-piece="' + itisthiscmove + 'K') != -1 && ev.target.outerHTML.indexOf(' data-piece="' + itisthiscmove + 'R') != -1) {
if (mightbecastling(ev.target.outerHTML.split(' data-piece="')[1].split('"')[0], newlohfulloh.split(' data-piece="')[1].split('"')[0], ev.target.outerHTML, newlohfulloh) == 1) {
prelegal=false;
}
}
if (!prelegal) {
//ouralert('Illegal move ... please start again');
lastitisthiscmove = itisthiscmove + ' ';
//ouralert(lastitisthiscmove + '!');
hostid='';
} else if (islegal()) {
//alert(5645);
if (hostid != '') {
document.getElementById(hostid).innerHTML='';
} else {
document.getElementById('mytable').innerHTML=document.getElementById('mytable').innerHTML.replace(newlohfulloh, '');
}
gev=ev;
setTimeout(gevit,1500); //ev.target.innerHTML=newlohfulloh;
//itisthiscmove=itisthiscmove.replace('w','B').replace('b','W').toLowerCase();
lastitisthiscmove = itisthiscmove + ' ';
hostid='';
} else {
if (waspl) { ouralert('Illegal move ... please start again'); }
lastitisthiscmove = itisthiscmove + ' ';
hostid='';
}
// }
}
setTimeout(rerefit, 3000);
}
function gevit() {
gev.target.innerHTML=newlohfulloh;
if (document.getElementById(newlohfulloh.split(' id="')[1].split('"')[0])) {
adddrop(newlohfulloh.split(' id="')[1].split('"')[0]);
}
//ouralert('' + gev.target.id + '=' + newlohfulloh);
newlohfulloh='';
lastitisthiscmove = itisthiscmove + ' ';
}
function dodoms() {
var stopit=false;
if (document.getElementById('span4') && fouroh == '') { fouroh=document.getElementById('span4').outerHTML; }
if (document.getElementById('span5') && wsixoh == '') { wsixoh=document.getElementById('span5').outerHTML; }
if (document.getElementById('span6') && sixoh == '') { sixoh=document.getElementById('span6').outerHTML; }
if (document.getElementById('span0') && spanzero == '') { spanzero=document.getElementById('span0').outerHTML; }
if (document.getElementById('span1') && spanfive == '') { spanfive=document.getElementById('span1').outerHTML; }
if (document.getElementById('td22') && tdtte == '') { tdtte=document.getElementById('td22').outerHTML.split('>')[0] + '></td>'; }
if (document.getElementById('td211') && wtdtte == '') { wtdtte=document.getElementById('td211').outerHTML.split('>')[0] + '></td>'; }
if (document.getElementById('td193') && wwtdtte == '') { wwtdtte=document.getElementById('td193').outerHTML.split('>')[0] + '></td>'; }
if (document.getElementById('td11') && wwwtdtte == '') { wwwtdtte=document.getElementById('td11').outerHTML.split('>')[0] + '></td>'; }
if (nextmove != -1) {
var tds=document.getElementsByTagName('td');
for (var itds=0; itds<tds.length; itds++) {
if (tds[itds].outerHTML.indexOf(' data-square="' + nextmove + '"') != -1) {
if (tds[itds].innerHTML.indexOf('</span>') != -1) {
document.getElementById(tds[itds].innerHTML.split(' id="')[1].split('"')[0]).click();
} else {
tds[itds].click();
}
}
}
nextmove=-1;
}
if (document.getElementById('pstatus')) {
if (document.getElementById('pblack')) {
if (('' + document.getElementById('pblack').innerText) != '') {
playerb=document.getElementById('pblack').innerText;
}
}
if (document.getElementById('pwhite')) {
if (('' + document.getElementById('pwhite').innerText) != '') {
playerw=document.getElementById('pwhite').innerText;
}
}
if (eval('' + ('' + document.getElementById('pstatus').getAttribute('data-decided')).replace(/^null$/g,'').replace(/^undefined$/g,'').length) == 2) {
if (document.getElementById('pblack')) {
document.getElementById('pblack').style.display='none';
}
if (document.getElementById('pwhite')) {
document.getElementById('pwhite').style.display='none';
}
if (document.getElementById('pvs')) {
document.getElementById('pvs').style.display='none';
}
if (playerb != 'Black' && playerb.indexOf('(black)') == -1) {
playerb+=' (black)';
}
if (playerw != 'White' && playerw.indexOf('(white)') == -1) {
playerw+=' (white)';
}
fixabw(playerb, playerw);
document.getElementById('pstatus').setAttribute('data-decided', document.getElementById('pstatus').getAttribute('data-decided') + ' ');
}
if (eval('' + ('' + document.getElementById('pstatus').getAttribute('data-decided')).replace(/^null$/g,'').replace(/^undefined$/g,'').length) == 3) {
if (document.getElementById('pstatus').innerText == '') {
document.getElementById('pstatus').innerHTML='Welcome to the Chess Game between ' + playerb + ' (black) and ' + playerw + ' (white).';
}
document.getElementById('pstatus').setAttribute('data-decided', document.getElementById('pstatus').getAttribute('data-decided') + ' ');
}
if (eval('' + ('' + document.getElementById('pstatus').getAttribute('data-decided')).replace(/^null$/g,'').replace(/^undefined$/g,'').length) == 4) {
if (itisthiscmove != '') {
if (itisthiscmove == 'b') {
document.getElementById('pstatus').setAttribute('data-decided', document.getElementById('pstatus').getAttribute('data-decided') + ' ');
if (playerb.indexOf(']') == -1) { document.getElementById('pstatus').innerHTML='Your first move ' + playerb + ' ... '; }
} else {
document.getElementById('pstatus').setAttribute('data-decided', document.getElementById('pstatus').getAttribute('data-decided') + ' ');
if (playerw.indexOf(']') == -1) { document.getElementById('pstatus').innerHTML='Your first move ' + playerw + ' ... '; }
}
} else if (lastoh.indexOf(' data-piece="') != -1) {
if (lastoh.indexOf(' data-piece="b') != -1) {
document.getElementById('pstatus').setAttribute('data-decided', document.getElementById('pstatus').getAttribute('data-decided') + ' ');
if (playerb.indexOf(']') == -1) { document.getElementById('pstatus').innerHTML='Your first move ' + playerb + ' ... '; }
} else {
document.getElementById('pstatus').setAttribute('data-decided', document.getElementById('pstatus').getAttribute('data-decided') + ' ');
if (playerw.indexOf(']') == -1) { document.getElementById('pstatus').innerHTML='Your first move ' + playerw + ' ... '; }
}
}
}
if (eval('' + ('' + document.getElementById('pstatus').getAttribute('data-decided')).replace(/^null$/g,'').replace(/^undefined$/g,'').length) == 5) {
}
}
for (var ikj=0; ikj<domcmds.length; ikj++) {
if (!stopit && domcmds[ikj] != '') {
stopit=true;
//if (prompt(domcmds[ikj], domcmds[ikj])) {
//if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
// var huh=prompt(domcmds[ikj], domcmds[ikj]);
//}
if (document.URL.indexOf('/chess') != -1) {
eval(domcmds[ikj]);
//rejig();
}
//}
domcmds[ikj]='';
}
}
//domcmds=[];
setTimeout(dodoms, 1000);
}
function innards(inele) {
var outele=inele;
if (inele.indexOf('<span') > 0) {
outele='<span' + inele.split('</span>')[0].split('<span')[eval(-1 + inele.split('</span>')[0].split('<span').length)] + '</span>';
}
//ouralert('innards:' + outele);
return outele;
}
function adddrop(inelid) {
document.getElementById(inelid).addEventListener("drop", (ev) => {
console.log("Drop 1");
if (lohfulloh != '') {
console.log("lohfulloh=" + lohfulloh);
if (lohfulloh.indexOf(' data-piece="') != -1) {
if (ev.target.outerHTML.indexOf(' data-piece="') != -1 && ev.target.outerHTML != lohfulloh) {
if (ev.target.outerHTML.split(' data-piece="')[1].substring(0,1) != lohfulloh.split(' data-piece="')[1].substring(0,1)) {
console.log('Potential piece take');
ppt=true;
}
}
}
}
loh=ev.target.id;
lohoh=bigv(ev.target.outerHTML.split('>')[0] + '></' + ev.target.outerHTML.substring(1).split(' ')[0].split('>')[0] + '>');
//if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
// document.title='ev.preventDefault(); //1';
//}
ev.preventDefault();
// Get the data, which is the id of the source element
const data = ev.dataTransfer.getData("text");
const source = document.getElementById(data);
console.log('' + ev.target.id);
if (!document.getElementById('callback')) {
lastevid=ev.target.id;
//ouralert(lastevid);
//ev.target.setAttribute('draggable', true);
if (lastoh == '') {
//ouralert('suspicious ' + document.getElementById(sourceid).outerHTML);
lastoh=ev.target.outerHTML;
lastih='>' + ev.target.innerHTML + '<';
lastid=ev.target.id;
} else if (prefx == 'span') {
if (lastid.indexOf(' ') != -1) {
lastid=lastid.trim();
} else {
lastid=ev.target.id;
}
}
if (document.URL.indexOf('/chess') != -1) {
setTimeout(lastohit, 1000);
if (('' + ev.target.style.backgroundColor).indexOf(',0.6') != -1 || ('' + ev.target.style.backgroundColor).indexOf(',0.5') != -1) {
//ouralert('564 ' + ev.target.getAttribute('data-square'));
ev.target.style.filter='invert(1)';
ev.target.style.backgroundColor='rgba(255,255,255,0.6)';
}
}
if (('' + ev.target.id).substring(0,2) == 'td' && secs > 0 && document.URL.indexOf('/planet_') == -1) {
score+=eval(ev.target.innerHTML.substring(0,1));
}
} else if (document.getElementById('callback')) {
secs++;
if (('' + ev.target.getAttribute('data-answer')) == ('' + document.getElementById('source').getAttribute('data-answer')) || ('' + ev.target.getAttribute('data-answer')) == ('' + document.getElementById(sourceid).getAttribute('data-answer'))) {
score++;
document.getElementById('score').innerHTML='Score: ' + score + '/' + secs + '';
} else {
document.getElementById('score').innerHTML='Score: ' + score + '/' + secs + '';
if (document.getElementById('source').outerHTML.indexOf('<ta' + 'ble') == 0) {
ouralert(('Correct answer was ' + document.getElementById(sourceid).getAttribute('data-answer')).replace('null',''));
} else {
ouralert(('Correct answer was ' + document.getElementById('source').getAttribute('data-answer')).replace('null',''));
}
}
location.href=document.getElementById('callback').value + '?score=' + score + '&secs=' + secs;
}
if (1 == 2) {
clonedatatwo=document.getElementById(sourceid).outerHTML;
document.getElementById('mytable').innerHTML=document.getElementById('mytable').innerHTML.replace(clonedatatwo, '');
ev.target.innerHTML=ev.target.innerHTML.substring(0,1) + clonedatatwo;
} else if (secs > 0 && (9 == 9 || ('' + ev.target.id).substring(0,2) == 'td')) {
if (source) { source.style.cursor='progress'; }
clonedatatwo=document.getElementById(sourceid).outerHTML;
andlater();
//document.getElementById('mytable').innerHTML=document.getElementById('mytable').innerHTML.replace(clonedatatwo, '');
//ev.target.innerHTML=ev.target.innerHTML.substring(0,1) + clonedatatwo;
//document.getElementById('target').appendChild(source);
if (('' + ev.target.id).substring(0,2) != 'td') {
document.getElementById('target').insertAdjacentHTML('beforeend', clonedatatwo);
} else {
if (source) { source.style.cursor='progress'; }
ev.target.insertAdjacentHTML('beforeend', clonedatatwo);
}
} else {
try {
ev.target.appendChild(source);
} catch(ers) { }
}
if (ev.touches) {
if (ev.touches[0].pageX) {
pos3 = ev.touches[0].pageX;
pos4 = ev.touches[0].pageY;
} else {
pos3 = ev.touches[0].clientX;
pos4 = ev.touches[0].clientY;
}
console.log('pos3 = ' + pos3 + ',pos4 = ' + pos4);
} else if (ev.clientX || ev.clientY) {
pos3 = ev.clientX;
pos4 = ev.clientY;
console.log('pos3 = ' + pos3 + ' ,pos4 = ' + pos4);
} else {
pos3 = ev.pageX;
pos4 = ev.pageY;
console.log('pos3 = ' + pos3 + ', pos4 = ' + pos4);
}
});
}
function bigv(inspan) {
var outspan=inspan;
if (inspan.trim().indexOf('<span') == 0 && document.getElementById('target').innerHTML.indexOf(inspan.split('>')[0]) != -1) {
outspan='<' + document.getElementById('target').innerHTML.split(inspan.split('>')[0])[0].split('<')[eval(-1 + document.getElementById('target').innerHTML.split(inspan.split('>')[0])[0].split('<').length)];
outspan+='</' + outspan.substring(1).split(' ')[0].split('>')[0] + '>';
//ouralert('Found ' + outspan);
} //else {
//ouralert('did not find ' + inspan);
//}
return outspan;
}
function bigabb(infind) {
var prefxz='';
var outfind=infind;
var lastchr=infind.slice(-1);
var firstlk=infind.split(lastchr)[0];
var vbits=document.getElementById('target').innerHTML.split(firstlk);
if (eval('' + vbits.length) > 1) {
prefxz='<' + document.getElementById('target').innerHTML.split(firstlk)[0].split('<')[eval(-1 + document.getElementById('target').innerHTML.split(firstlk)[0].split('<').length)];
outfind=prefxz + firstlk + vbits[1].split(lastchr)[0] + lastchr;
}
return outfind;
}
function abb(infind) {
var outfind=infind;
var lastchr=infind.slice(-1);
var firstlk=infind.split(lastchr)[0];
var vbits=document.getElementById('target').innerHTML.split(firstlk);
if (eval('' + vbits.length) > 1) {
outfind=firstlk + vbits[1].split(lastchr)[0] + lastchr;
}
return outfind;
}
function epy(thething, thelook) {
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
var theid=document.getElementById('mytable').innerHTML.split(thething)[0].split(' id="')[eval(-1 + document.getElementById('mytable').innerHTML.split(thething)[0].split(' id="').length)].split('"')[0];
var thenid='t' + document.getElementById('mytable').innerHTML.split(thelook.split('>')[0])[0].split(' id="t')[eval(-1 + document.getElementById('mytable').innerHTML.split(thelook.split('>')[0])[0].split(' id="t').length)].split('"')[0];
var ithing=innards(thething), thenum=-1, thetds=[], jnum=0, ijk=0;
if (thelook.indexOf(' data-square="') != -1) {
thenum=eval(thelook.split(' data-square="')[1].split('"')[0]);
thetds=document.getElementsByTagName('td');
for (ijk=0; ijk<thetds.length; ijk++) {
if (thetds[ijk].outerHTML.indexOf(' class="black"') != -1 || thetds[ijk].outerHTML.indexOf(' class="white"') != -1) { jnum++; }
if (jnum == thenum || thetds[ijk].outerHTML.indexOf(thelook.split('>')[0]) != -1) {
//ouralert(thenid + ' vs ' + thetds[ijk].id);
thenid=thetds[ijk].id;
if (thetds[ijk].outerHTML.indexOf(thelook.split('>')[0]) != -1) { jnum=-999; }
}
}
}
//ouralert("document.getElementById('" + theid + "').innerHTML=''; " + "document.getElementById('" + thenid + "').innerHTML='" + ithing + "'; ");
domcmds.push("document.getElementById('" + theid + "').innerHTML=''; ");
domcmds.push("document.getElementById('" + thenid + "').innerHTML='" + ithing + "'; ");
}
return thething;
}
function mightbecastling(pthispiece, potherpiece, pthisoh, potheroh) { // thanks to https://www.chessable.com/blog/how-to-castle-in-chess/
var pretval=0, delone='', deltwo='';
var bigih=document.getElementById('target').innerHTML;
var inpthisoh=pthisoh;
var inpotheroh=potheroh;
twosubsfrom[0]='';
if (inpthisoh.indexOf(' data-square="') == -1) {
inpthisoh='<td' + bigih.split(pthisoh)[0].split('<td')[eval(-1 + bigih.split(pthisoh)[0].split('<td').length)];
}
if (inpotheroh.indexOf(' data-square="') == -1) {
inpotheroh='<td' + bigih.split(potheroh)[0].split('<td')[eval(-1 + bigih.split(potheroh)[0].split('<td').length)];
}
if (pthispiece.substring(0,1) != potherpiece.substring(0,1)) { return -5; }
if ((pthispiece.substring(1).substring(0,1) == 'K' && eval('' + pthispiece.length) == 2) && (potherpiece.substring(1).substring(0,1) == 'R' && eval('' + potherpiece.length) == 3)) {
if (pthispiece.substring(0,1) == 'w' && inpthisoh.indexOf(' data-square="61"') != -1 && (inpotheroh.indexOf(' data-square="64"') != -1 || inpotheroh.indexOf(' data-square="57"') != -1)) {
pretval=1;
if (inpotheroh.indexOf(' data-square="57"') != -1 && (bigih.indexOf(abb(' data-square="58">') + '</') == -1 || bigih.indexOf(abb(' data-square="59">') + '</') == -1 || bigih.indexOf(abb(' data-square="60">') + '</') == -1)) {
pretval=-1;
} else if (inpotheroh.indexOf(' data-square="57"') != -1) { //newish
//document.getElementById('target').innerHTML=document.getElementById('target').innerHTML.replace(pthisoh,'').replace(potheroh,'');
//document.getElementById('target').innerHTML=document.getElementById('target').innerHTML.replace(abb(' data-square="60">') + '</', abb(' data-square="60">') + potheroh + '</').replace(abb(' data-square="59">') + '</', abb(' data-square="59">') + pthisoh + '</');
twosubsfrom[0] = 'wR1';
if (wwtdtte != '') { lohoh=wwtdtte; } //rmtwowk
//ouralert('About to Castle ' + lastoh + ' +++ ' + pthisoh + ' --- ' + innards(pthisoh));
bigih=bigih.replace(epy(pthisoh,' data-square="60">'),'').replace(epy(potheroh,' data-square="59">'),'');
if (bigih.indexOf(lohoh.split('</')[0]) != -1) { lohoh=''; } //else { ouralert('found'); }
//bigih=bigih.replace(abb(' data-square="59">') + '</span>', abb(' data-square="59">') + innards(potheroh) + '</span></td>' + bigv(lohoh).split('</td>')[0]);
bigih=bigih.replace(abb(' data-square="59">') + '</', abb(' data-square="59">') + innards(potheroh) + '</');
// + lohoh);
//ouralert('About to Castle1 the rook ' + abb(' data-square="60">') + innards(potheroh) + '</');
bigih=bigih.replace(bigabb(' data-square="60">') + '</', bigabb(' data-square="60">') + innards(pthisoh) + '</'); // + lohoh.split('</td>')[0]);
//ouralert('About to Castle2 ' + innards(potheroh));
if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
document.getElementById('target').innerHTML=bigih;
}
//ouralert('About to Castle22 ' + innards(potheroh));
//ouralert('About to Castle223');
if (wwtdtte != '') {
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
domcmds.push("document.getElementById('td202').innerHTML='" + wsixoh + "'; ");
domcmds.push("document.getElementById('td203').innerHTML='" + spanfive + "'; ");
domcmds.push("document.getElementById('tr8').innerHTML='" + wwtdtte + "' + document.getElementById('tr8').innerHTML; itisthiscmove='b'; consolelog('Your next move ' + playerb + ' ... '); adddrop('" + lohoh.split(' id="')[1].split('"')[0] + "'); ");
}
}
if (lohoh != '') {
adddrop(lohoh.split(' id="')[1].split('"')[0]);
lohoh='';
}
}
if (inpotheroh.indexOf(' data-square="64"') != -1 && (bigih.indexOf(abb(' data-square="62">') + '</') == -1 || bigih.indexOf(abb(' data-square="63">') + '</') == -1)) {
//ouralert(bigih.split(' data-square="62"')[1].substring(0,40) + '*62');
//ouralert(bigih.split(' data-square="63"')[1].substring(0,40) + '*63');
pretval=-1;
} else if (inpotheroh.indexOf(' data-square="64"') != -1) { //new
twosubsfrom[0] = 'wR2';
//ouralert('About to Castle ' + lastoh);
bigih=bigih.replace(epy(pthisoh,' data-square="63">'),'').replace(epy(potheroh,' data-square="62">'),'');
//ouralert('About to Castle1 the rook ' + abb(' data-square="62">') + innards(potheroh) + '</');
bigih=bigih.replace(abb(' data-square="62">') + '</', abb(' data-square="62">') + innards(potheroh) + '</');
//ouralert('About to Castle12 the king ' + abb(' data-square="63">') + innards(pthisoh) + '</ ... ' + bigih.split(' data-square="63"')[1] + ' +++ ' + lohoh);
if (bigih.indexOf(lohoh.split('</')[0]) != -1) { lohoh=''; }
bigih=bigih.replace(abb(' data-square="63">') + '</td>', abb(' data-square="63">') + innards(pthisoh) + '</td>' + lohoh);
//ouralert('About to Castle2');
if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
document.getElementById('target').innerHTML=bigih;
}
//ouralert('About to Castle22');
if (lohoh != '') {
adddrop(lohoh.split(' id="')[1].split('"')[0]);
lohoh='';
}
}
}
if (pthispiece.substring(0,1) == 'b' && inpthisoh.indexOf(' data-square="5"') != -1 && (inpotheroh.indexOf(' data-square="8"') != -1 || inpotheroh.indexOf(' data-square="1"') != -1)) {
pretval=1;
if (inpotheroh.indexOf(' data-square="8"') != -1 && (bigih.indexOf(abb(' data-square="6">') + '</') == -1 || bigih.indexOf(abb(' data-square="7">') + '</') == -1)) {
pretval=-1;
} else if (inpotheroh.indexOf(' data-square="8"') != -1) { // new
//document.getElementById('target').innerHTML=document.getElementById('target').innerHTML.replace(pthisoh,'').replace(potheroh,'');
//document.getElementById('target').innerHTML=document.getElementById('target').innerHTML.replace(abb(' data-square="6">') + '</', abb(' data-square="6">') + pthisoh + '</').replace(abb(' data-square="7">') + '</', abb(' data-square="7">') + potheroh + '</');
twosubsfrom[0] = 'bR2';
//if (eightoh != '') { lohoh=eightoh; }
//ouralert('About to Castle ' + lastoh + ' +++ ' + pthisoh + ' --- ' + innards(pthisoh));
bigih=bigih.replace(epy(pthisoh, ' data-square="7">'),'').replace(epy(potheroh, ' data-square="6">'),'');
//ouralert('About to Castle1 the rook ' + abb(' data-square="6">') + innards(potheroh) + '</');
bigih=bigih.replace(abb(' data-square="6">') + '</', abb(' data-square="6">') + innards(potheroh) + '</');
//ouralert('About to Castle12 the king ' + abb(' data-square="7">') + innards(pthisoh) + '</ ... ' + bigih.split(' data-square="7"')[1] + ' +++ ' + lohoh);
if (bigih.indexOf(lohoh.split('</')[0]) != -1) { lohoh=''; } //else { ouralert('found'); }
//if (bigih.indexOf(abb(' data-square="7">') + '</') == -1) {
// ouralert('Not found ' + bigabb(' data-square="7">') + '</');
//} else {
// ouralert(' ... ' + bigv(lohoh));
//}
//bigih=bigih.replace(abb(' data-square="7">') + '</span>', abb(' data-square="7">') + innards(pthisoh) + '</span></td>' + bigv(lohoh).split('</td>')[0]);
bigih=bigih.replace(abb(' data-square="7">') + '</', abb(' data-square="7">') + innards(pthisoh) + '</');
// + lohoh);
//ouralert('About to Castle2 ' + innards(pthisoh));
if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
document.getElementById('target').innerHTML=bigih;
}
if (eightoh != '') {
if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
//domcmds.push("document.getElementById('td23').innerHTML='" + innards(potheroh) + "'; ");
//domcmds.push("document.getElementById('td31').innerHTML='" + innards(pthisoh) + "'; ");
//domcmds.push("document.getElementById('td32').innerHTML=''; ");
eightoh=eightoh;
} else {
document.getElementById('tr1').innerHTML+=eightoh;
document.getElementById('td31').innerHTML=innards(pthisoh);
domcmds.push("document.getElementById('td31').innerHTML='" + innards(pthisoh) + "'; ");
}
}
//ouralert('About to Castle22 ' + innards(pthisoh));
//document.getElementById('td31').innerHTML=innards(pthisoh);
//ouralert('About to Castle223');
if (lohoh != '') {
adddrop(lohoh.split(' id="')[1].split('"')[0]);
lohoh='';
}
}
if (inpotheroh.indexOf(' data-square="1"') != -1 && (bigih.indexOf(abb(' data-square="4">') + '</') == -1 || bigih.indexOf(abb(' data-square="2">') + '</') == -1 || bigih.indexOf(abb(' data-square="3">') + '</') == -1)) {
pretval=-1;
} else if (inpotheroh.indexOf(' data-square="1"') != -1) { //newer
//document.getElementById('target').innerHTML=document.getElementById('target').innerHTML.replace(pthisoh,'').replace(potheroh,'');
//document.getElementById('target').innerHTML=document.getElementById('target').innerHTML.replace(abb(' data-square="3">') + '</', abb(' data-square="3">') + pthisoh + '</').replace(abb(' data-square="4">') + '</', abb(' data-square="4">') + potheroh + '</');
twosubsfrom[0] = 'bR1';
if (wwwtdtte != '') { lohoh=wwwtdtte; } //rmtwowk4
//ouralert('About to Castle ' + lastoh + ' +++ ' + pthisoh + ' --- ' + innards(pthisoh));
bigih=bigih.replace(epy(pthisoh,' data-square="4">'),'').replace(epy(potheroh,' data-square="3">'),'');
if (bigih.indexOf(lohoh.split('</')[0]) != -1) { lohoh=''; } //else { ouralert('found'); }
//bigih=bigih.replace(abb(' data-square="3">') + '</span>', abb(' data-square="3">') + innards(potheroh) + '</span></td>' + bigv(lohoh).split('</td>')[0]);
bigih=bigih.replace(abb(' data-square="3">') + '</', abb(' data-square="3">') + innards(potheroh) + '</');
// + lohoh);
//ouralert('About to Castle1 the rook ' + abb(' data-square="4">') + innards(potheroh) + '</');
bigih=bigih.replace(bigabb(' data-square="4">') + '</', bigabb(' data-square="4">') + innards(pthisoh) + '</'); // + lohoh.split('</td>')[0]);
//ouralert('About to Castle2 ' + innards(potheroh));
if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
document.getElementById('target').innerHTML=bigih;
}
//ouralert('About to Castle22 ' + innards(potheroh));
//ouralert('About to Castle223');
if (wwwtdtte != '') {
if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
domcmds.push("document.getElementById('td13').innerHTML='" + fouroh + "'; ");
domcmds.push("document.getElementById('td21').innerHTML='" + spanzero + "'; ");
domcmds.push("document.getElementById('tr1').innerHTML='" + wwwtdtte + "' + document.getElementById('tr1').innerHTML; itisthiscmove='w'; consolelog('Your next move ' + playerw + ' ... '); adddrop('" + lohoh.split(' id="')[1].split('"')[0] + "'); ");
}
}
if (lohoh != '') {
adddrop(lohoh.split(' id="')[1].split('"')[0]);
lohoh='';
}
}
}
} else if ((potherpiece.substring(1).substring(0,1) == 'K' && eval('' + potherpiece.length) == 2) && (pthispiece.substring(1).substring(0,1) == 'R' && eval('' + pthispiece.length) == 3)) {
if (potherpiece.substring(0,1) == 'w' && inpotheroh.indexOf(' data-square="61"') != -1 && (inpthisoh.indexOf(' data-square="64"') != -1 || inpthisoh.indexOf(' data-square="57"') != -1)) {
pretval=1;
if (inpthisoh.indexOf(' data-square="57"') != -1 && (bigih.indexOf(abb(' data-square="58">') + '</') == -1 || bigih.indexOf(abb(' data-square="59">') + '</') == -1 || bigih.indexOf(abb(' data-square="60">') + '</') == -1)) {
pretval=-1;
} else if (inpthisoh.indexOf(' data-square="57"') != -1) { // new
//document.getElementById('target').innerHTML=document.getElementById('target').innerHTML.replace(pthisoh,'').replace(potheroh,'');
//document.getElementById('target').innerHTML=document.getElementById('target').innerHTML.replace(abb(' data-square="60">') + '</', abb(' data-square="60">') + pthisoh + '</').replace(abb(' data-square="59">') + trim().replace(/\ /g,'_') + '^');
if (gdefv.indexOf('?') == -1) {
gdefv=gdefv.replace(/\^/g, '').replace(/\%3f/g, '?');
//alert('gdefv=' + gdefv);
scmok=true;
movesallowed=true;
gmovesallowed=true;
five=5;
gfive=5;
document.getElementById('myimg').click(); //scmove();
} else {
setTimeout(dountilnoquestion, 1000);
}
} else {
//alert('curgdefv=' + curgdefv);
document.getElementById('placegeo').value=' ';
//alert('111:' + '/PHP/fgc/index.php?placegeo=' + encodeURIComponent(curgdefv.replace(/\ /g,'_')));
//document.getElementById('wif').src='/PHP/fgc/index.php?placegeo=' + encodeURIComponent(curgdefv.replace(/\ \(/g,', ').replace(/\)$/g,'')).replace(/\%20/g,'_');
document.getElementById('wif').src='/PHP/fgc/index.php?placegeo=' + encodeURIComponent(curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-')[eval(-1 + curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-').length)].split('{')[0].trim().replace(/\ /g,'_'));
//alert('111:' + '/PHP/fgc/index.php?tzexact=&tznickname=' + encodeURIComponent(curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-')[eval(-1 + curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-').length)].split('{')[0].trim().replace(/\ /g,'_')));
// document.getElementById('wiftwo').src='/PHP/fgc/index.php?tzexact=&tznickname=' + encodeURIComponent(curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-')[eval(-1 + curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-').length)].split('{')[0].trim().replace(/\ /g,'_'));
}
}
}
function woit(what) {
if (what.trim() != '') {
//alert(what + ' ... ' + bigback);
if (bigback.indexOf(what + ':') != -1 || bigback.indexOf(what.replace(/\ /g,'_') + ':') != -1) {
if (wobi) {
if (!wobi.closed) { wobi.close(); }
}
wobi=window.open('', '_blank', 'top=50,left=50,width=900,height=800');
if (bigback.indexOf(what + ':') != -1) {
wobi.document.write(bigback.split(what + ':')[1].split('</div>')[0] + '</div>');
} else {
wobi.document.write(bigback.split(what.replace(/\ /g,'_') + ':')[1].split('</div>')[0] + '</div>');
}
setTimeout(function(){ wobi.document.title=what + ' ... Wikipedia images ... thanks'; }, 6000);
}
}
}
function coordittwo(xiois) {
var xxaconto = (xiois.contentWindow || xiois.contentDocument);
if (xxaconto != null) {
if (xxaconto.document) { xxaconto = xxaconto.document; }
var xxacontobodyouterHTML=xxaconto.body.outerHTML.replace(/\"\;/g,'"');
//alert(xxacontobodyouterHTML);
if (xxacontobodyouterHTML.indexOf('.style.background="URL(') != -1) {
//alert('URL(' + xxacontobodyouterHTML.split('.style.background="URL(')[1].split('"')[0] + '');
//alert('"' + xxacontobodyouterHTML.split('.style.backgroundRepeat="')[1].split('"')[0] + '"');
//alert('"' + xxacontobodyouterHTML.split('.style.backgroundPosition="')[1].split('"')[0] + '"');
if (bigback.indexOf(xiois.src.split('tznickname=')[1].split('&')[0].split('#')[0] + ':') == -1) {
if (document.getElementById('span' + xiois.src.split('tznickname=')[1].split('&')[0].split('#')[0])) {
document.getElementById('span' + xiois.src.split('tznickname=')[1].split('&')[0].split('#')[0].replace(/\ /g,'_')).style.cursor='pointer';
document.getElementById('span' + xiois.src.split('tznickname=')[1].split('&')[0].split('#')[0].replace(/\ /g,'_')).title='Wikipedia images available for ' + xiois.src.split('tznickname=')[1].split('&')[0].split('#')[0].replace(/\_/g,' ') + ' clicking here now.';
}
bigback+=xiois.src.split('tznickname=')[1].split('&')[0].split('#')[0] + ':' + document.getElementById('ourcanvas').outerHTML.replace('<canvas','<div title="Images for ' + xiois.src.split('tznickname=')[1].split('&')[0].split('#')[0].replace(/\_/g,' ') + ' thanks to Wikipedia at https://wikipedia.org" ').replace('</canvas>','</div>').replace(':none;',':block;background:' + 'URL(' + xxacontobodyouterHTML.split('.style.background="URL(')[1].split('"')[0] + ';background-repeat:no-repeat;background-position:' + xxacontobodyouterHTML.split('.style.backgroundPosition="')[1].split('"')[0]);
}
}
wiftwoavailable=true;
if (nextwiftwo.split('#')[0] != '') {
if (nextwiftwo.split('#')[0].indexOf('dopg=') != -1) {
document.getElementById('placegeo').value=' ';
override=nextwiftwo.split('#')[0].replace('dopg=y&','').split('tznickname=')[1].split('&')[0].split('#')[0];
//alert('2:' + '/PHP/fgc/index.php?placegeo=' + encodeURIComponent(override.replace(/\ \(/g,', ').replace(/\)$/g,'')).replace(/\%20/g,'_'));
document.getElementById('wif').src='/PHP/fgc/index.php?placegeo=' + encodeURIComponent(override.replace(/\ \(/g,', ').replace(/\)$/g,'')).replace(/\%20/g,'_');
}
xiois.src=nextwiftwo.split('#')[0].replace('dopg=y&','');
nextwiftwo=nextwiftwo.replace(nextwiftwo.split('#')[0] + '#', '');
wiftwoavailable=false;
}
}
}
function coordit(xiois) {
var thisoverride=override;
override='';
xaconto = (xiois.contentWindow || xiois.contentDocument);
//alert(11);
if (xaconto != null) {
//alert('111 ' + xiois.src);
try {
if (xaconto.document) { xaconto = xaconto.document; }
//alert('1111 ' + xaconto.body.innerHTML);
if (xaconto.body.innerHTML.indexOf('>Coordinates') != -1) {
var subpart=xaconto.body.innerHTML.split('>Coordinates')[1];
latdeg=-999;
longdeg=-999;
latmin=0;
longmin=0;
latsec=0;
longsec=0;
sparelat='';
sparelong='';
if (subpart.indexOf('"latitude"') != -1 && subpart.indexOf('"longitude"') != -1) {
latdeg=subpart.split('"latitude"')[1].split('>')[1].split("°")[0].split('<')[0];
sparelat=subpart.split('"latitude"')[1].split('>')[1].split('<')[0].slice(-1);
latmin=subpart.split('"latitude"')[1].split('>')[1].split('<')[0].substring(eval(1 + eval('' + latdeg.length))).split("′")[0].split(sparelat)[0].split('<')[0];
if (sparelat == 'S') { latdeg=eval(eval(eval(-1 * latmin) / 60) - latdeg); } else { latdeg+=eval(eval('' + latmin) / 60) }
longdeg=subpart.split('"longitude"')[1].split('>')[1].split("°")[0].split('<')[0];
sparelong=subpart.split('"longitude"')[1].split('>')[1].split('<')[0].slice(-1);
longmin=subpart.split('"longitude"')[1].split('>')[1].split('<')[0].substring(eval(1 + eval('' + longdeg.length))).split("′")[0].split(sparelong)[0].split('<')[0];
if (sparelong == 'W') { longdeg=eval(eval(eval(-1 * longmin) / 60) - longdeg); } else { longdeg+=eval(eval('' + longmin) / 60) }
if (gdefv.indexOf(curgdefv + '?') != -1) {
gdefv=gdefv.replace(curgdefv + '?', curgdefv + ('|' + longdeg).replace('|-','|_') + + ('|' + latdeg).replace('|-','|_') + '^');
dountilnoquestion();
}
return true;
} else if (('' + document.getElementById('placegeo').value).trim().indexOf(',') != -1) {
//alert(document.getElementById('placegeo').value);
if (eval('' + document.getElementById('placegeo').title.split(',').length) >= 3) {
isotwo+=curgdefv + document.getElementById('placegeo').title.split(',')[eval(-3 + document.getElementById('placegeo').title.split(',').length)];
if (thisoverride != '') { alert(isotwo + ' ... regarding ' + thisoverride); }
setTimeout(newhashit, 5000);
}
latdeg=document.getElementById('placegeo').value.split(',')[eval(-2 + document.getElementById('placegeo').value.split(',').length)];
longdeg=document.getElementById('placegeo').value.split(',')[eval(-1 + document.getElementById('placegeo').value.split(',').length)];
//alert('' + longdeg);
if (gdefv.indexOf(curgdefv + '?') != -1) {
gdefv=gdefv.replace(curgdefv + '?', curgdefv + ('|' + longdeg).replace('|-','|_') + ('|' + latdeg).replace('|-','|_') + '^');
if (gdefv.indexOf('?') == -1) {
gdefv=gdefv.replace(/\^/g, '').replace(/\%3f/g, '?');
//document.title=gdefv;
//alert('gdefv=' + gdefv);
scmok=true;
movesallowed=true;
gmovesallowed=true;
five=5;
gfive=5;
document.getElementById('myimg').click(); //scmove();
return '';
} else {
setTimeout(dountilnoquestion, 1000);
}
//dountilnoquestion();
}
return true;
}
} else {
if (('' + document.getElementById('placegeo').value).trim().indexOf(',') != -1) {
//alert(document.getElementById('placegeo').value);
//alert(document.getElementById('placegeo').value);
if (eval('' + document.getElementById('placegeo').title.split(',').length) >= 3) {
isotwo+=curgdefv + document.getElementById('placegeo').title.split(',')[eval(-3 + document.getElementById('placegeo').title.split(',').length)];
if (thisoverride != '') { alert(isotwo + ' ... Regarding ' + thisoverride); }
setTimeout(newhashit, 5000);
}
latdeg=document.getElementById('placegeo').value.split(',')[eval(-2 + document.getElementById('placegeo').value.split(',').length)];
longdeg=document.getElementById('placegeo').value.split(',')[eval(-1 + document.getElementById('placegeo').value.split(',').length)];
//alert('7:' + longdeg + ' ' + document.getElementById('placegeo').value);
//alert('77:' + latdeg + ' gdefv=' + gdefv + ' and curgdefv?=' + curgdefv + '?');
// 77:-23.70000 gdefv=Alice Springs?-Sydney? and curgdefv?=Alice Springs?
// 77:-33.86778 gdefv=Alice Springs|133.87000|_23.70000^-Sydney? and curgdefv?=Sydney?
if (gdefv.indexOf(curgdefv + '?') != -1) {
//alert('r:' + document.getElementById('placegeo').value);
gdefv=gdefv.replace(curgdefv + '?', curgdefv + ('|' + longdeg).replace('|-','|_') + ('|' + latdeg).replace('|-','|_') + '^');
if (gdefv.indexOf('?') == -1) {
gdefv=gdefv.replace(/\^/g, '').replace(/\%3f/g, '?');
//document.title=gdefv;
//alert('gdefv =' + gdefv);
scmok=true;
movesallowed=true;
gmovesallowed=true;
five=5;
gfive=5;
document.getElementById('myimg').click(); //scmove();
return '';
} else {
dountilnoquestion(); //setTimeout(dountilnoquestion, 1000);
}
// dountilnoquestion();
}
} else {
if (gdefv.indexOf(curgdefv + '?') != -1) {
//alert('q:' + document.getElementById('placegeo').value);
gdefv=gdefv.replace(curgdefv + '?', curgdefv + caret.trim());
if (gdefv.indexOf('?') == -1) {
gdefv=gdefv.replace(/\^/g, '').replace(/\%3f/g, '?');
//document.title=gdefv;
//alert('gdefv= ' + gdefv);
scmok=true;
movesallowed=true;
gmovesallowed=true;
five=5;
gfive=5;
document.getElementById('myimg').click(); //scmove();
return '';
} else {
dountilnoquestion(); //setTimeout(dountilnoquestion, 1000);
}
//
}
}
//gextras='';
//if (window.opener) {
// window.opener.putgextras(gextras);
//} else if (window.parent) {
// parent.putgextras(gextras);
//}
}
} catch(hgjg) { }
}
return true;
}
function iuo(newtooldmaybe) {
var outmel=newtooldmaybe, pref='', suff='';
var flds=[];
//alert('0:' + outmel);
if (outmel.trim() != '') {
if (outmel != outmel.replace(/^\ /g, '')) {
while (outmel != outmel.replace(/^\ /g, '')) {
outmel=outmel.replace(/^\ /g, '');
pref+=' ';
}
}
//alert('00:' + outmel);
if (outmel != outmel.replace(/\ $/g, '')) {
while (outmel != outmel.replace(/\ $/g, '')) {
outmel=outmel.replace(/\ $/g, '');
suff+=' ';
}
}
//alert('000:' + outmel);
if (outmel.indexOf('|') != -1) {
//alert('10:' + outmel);
outmel=outmel.replace(/\|\_/g, '|-').replace(/^\_/g, '-'); //.replace(/\ /g,'_');
//alert('110:' + outmel);
flds=outmel.replace('[', '').replace(']', '').split('|');
if (eval('' + flds.length) == 2 || (eval('' + flds.length) == 3 && flds[eval(-1 + flds.length)].trim() == '')) {
if (outmel.indexOf('.') == -1) {
//if (outmel.trim() != '') { alert(newtooldmaybe + ' Vs ' + pref + flds[0] + ',' + flds[1] + suff); }
return pref + flds[0] + ',' + flds[1] + suff;
} else {
//if (outmel.trim() != '') { alert(outmel); alert(newtooldmaybe + ' vS ' + pref + '[' + flds[0] + ',' + flds[1] + ']' + suff); }
return pref + '[' + flds[0] + ',' + flds[1] + ']' + suff;
}
} else if (eval('' + flds.length) >= 3) {
//if (outmel.trim() != '') { alert(outmel); alert(newtooldmaybe + ' VS ' + pref + '[' + flds[eval(-2 + flds.length)] + ',' + flds[eval(-1 + flds.length)] + ',' + outmel.replace('|' + flds[eval(-2 + flds.length)] + '|' + flds[eval(-1 + flds.length)], '').replace('[','').replace(']','') + ']' + suff); }
return pref + '[' + flds[eval(-2 + flds.length)] + ',' + flds[eval(-1 + flds.length)] + ',' + outmel.replace('|' + flds[eval(-2 + flds.length)] + '|' + flds[eval(-1 + flds.length)], '').replace('[','').replace(']','') + ']' + suff;
}
}
// Budgewoi33.2329° S, 151.5516° E
}
//if (outmel.trim() != '') { alert(newtooldmaybe + ' vs ' + pref + outmel + suff); }
return pref + outmel + suff;
}
function toiuo(meldaccordingly) {
var minus=String.fromCharCode(9), haveseencapital=false, outmel=meldaccordingly, pref='', suff='', icom=0, degfixes=[], ideg=0, xtlat='', xtlong='', nums='', ijk=0, xtplace='', tobechanged='', comfixes=[];
if (outmel.trim() != '') {
if (outmel != outmel.replace(/^\ /g, '')) {
while (outmel != outmel.replace(/^\ /g, '')) {
outmel=outmel.replace(/^\ /g, '');
pref+=' ';
}
}
if (outmel != outmel.replace(/\ $/g, '')) {
while (outmel != outmel.replace(/\ $/g, '')) {
outmel=outmel.replace(/\ $/g, '');
suff+=' ';
}
}
degfixes=outmel.split('[');
if (eval('' + degfixes.length) > 1) {
for (ideg=1; ideg<degfixes.length; ideg++) {
xtlat='';
xtlong='';
xtplace='';
tobechanged='[' + degfixes[ideg].split(']')[0] + ']';
comfixes=degfixes[ideg].split(']')[0].split(',');
if (eval('' + comfixes.length) >= 2) {
if (eval('' + comfixes.length) == 2) {
xtlong='' + comfixes[0];
xtlat='' + comfixes[1];
//outmel=outmel.replace('' + tobechanged + '', '[' + xtplace.replace(/\-/g,'%2d') + '|' + xtlong.replace('-','_') + '|' + xtlat.replace('-','_') + ']');
outmel=outmel.replace('' + tobechanged + '', '' + xtplace.replace(/\-/g,'%2d') + '|' + xtlong.replace('-','_') + '|' + xtlat.replace('-','_') + '');
} else {
xtlong='' + comfixes[0];
xtlat='' + comfixes[1];
xtplace=degfixes[ideg].split(']')[0].replace(xtlong + ',' + xtlat + ',', '');
//outmel=outmel.replace('' + tobechanged + '', '[' + xtplace.replace(/\-/g,'%2d') + '|' + xtlong.replace('-','_') + '|' + xtlat.replace('-','_') + ']');
outmel=outmel.replace('' + tobechanged + '', '' + xtplace.replace(/\-/g,'%2d') + '|' + xtlong.replace('-','_') + '|' + xtlat.replace('-','_') + '');
}
}
}
}
degfixes=outmel.split(String.fromCodePoint(176));
if (eval('' + degfixes.length) > 1) {
alert('' + degfixes.length + ' ' + outmel);
for (ideg=1; ideg<degfixes.length; ideg+=2) {
xtlat='';
xtlong='';
xtplace='';
nums='';
tobechanged=String.fromCodePoint(176) + degfixes[eval(0 + ideg)] + String.fromCodePoint(176);
if (eval('' + degfixes.length) <= eval(1 + ideg)) {
degfixes.push(' ');
}
switch (degfixes[eval(1 + ideg)].substring(0,2).trim().split(',')[0].split('-')[0].split('|')[0].split('_')[0]) {
case 'E':
tobechanged+=degfixes[eval(1 + ideg)].split('E')[0] + 'E';
for (ijk=0; ijk<degfixes[eval(0 + ideg)].length; ijk++) {
if (degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) == '.' || degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) == '-' || (degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) >= '0' && degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) <= '9')) { nums+=degfixes[eval(0 + ideg)].substring(ijk).substring(0,1); }
}
xtlong='' + nums.replace(/^\-/g,'');
break;
case 'W':
tobechanged+=degfixes[eval(1 + ideg)].split('W')[0] + 'W';
for (ijk=0; ijk<degfixes[eval(0 + ideg)].length; ijk++) {
if (degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) == '.' || degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) == '-' || (degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) >= '0' && degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) <= '9')) { nums+=degfixes[eval(0 + ideg)].substring(ijk).substring(0,1); }
}
xtlong='_' + nums.replace(/^\-/g,'');
break;
case 'S':
tobechanged+=degfixes[eval(1 + ideg)].split('S')[0] + 'S';
for (ijk=0; ijk<degfixes[eval(0 + ideg)].length; ijk++) {
if (degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) == '.' || degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) == '-' || (degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) >= '0' && degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) <= '9')) { nums+=degfixes[eval(0 + ideg)].substring(ijk).substring(0,1); }
}
xtlat='_' + nums.replace(/^\-/g,'');
break;
case 'N':
tobechanged+=degfixes[eval(1 + ideg)].split('N')[0] + 'N';
for (ijk=0; ijk<degfixes[eval(0 + ideg)].length; ijk++) {
if (degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) == '.' || degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) == '-' || (degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) >= '0' && degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) <= '9')) { nums+=degfixes[eval(0 + ideg)].substring(ijk).substring(0,1); }
}
xtlat='' + nums.replace(/^\-/g,'');
break;
default:
break;
}
//alert('1:' + tobechanged + ' to ' + xtplace + '|' + xtlong + '|' + xtlat);
nums='';
haveseencapital=false;
minus='-';
if (degfixes[eval(-1 + ideg)].indexOf('}') != -1) { minus=String.fromCharCode(9); }
// Budgewoi33.2329° S, 151.5516° E{ydney}-{yes}Budge-Xwoi31.2329° S, 149.5516° E{elbourne}
//if (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1).toUpperCase() && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1).toLowerCase()) {
// haveseencapital;
// minus='-';
//}
switch (degfixes[eval(0 + ideg)].substring(0,2).trim().split(',')[0].split('-')[0].split('|')[0].split('_')[0]) {
case 'E':
ijk=eval(-1 + degfixes[eval(0 + ideg)].length);
while (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '.' || (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) >= '0' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) <= '9')) {
nums=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + nums;
tobechanged=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + tobechanged;
ijk--;
}
xtlong='' + nums.replace(/^\-/g,'');
while (ijk >= 0 && (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == ',' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == ' ' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '-' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '[' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '|' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == ';')) {
tobechanged=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + tobechanged;
ijk--;
}
while (ijk >= 0 && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != minus && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != '}' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != '[' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != '|' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != ';') {
xtplace=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + xtplace;
tobechanged=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + tobechanged;
ijk--;
}
//if (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '}') { xtplace=',' + xtplace; }
break;
case 'W':
ijk=eval(-1 + degfixes[eval(-1 + ideg)].length);
while (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '.' || (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) >= '0' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) <= '9')) {
nums=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + nums;
tobechanged=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + tobechanged;
ijk--;
}
xtlong='_' + nums.replace(/^\-/g,'');
while (ijk >= 0 && (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == ',' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == ' ' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '-' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '[' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '|' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == ';')) {
tobechanged=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + tobechanged;
ijk--;
}
while (ijk >= 0 && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != minus && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != '}' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != '[' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != '|' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != ';') {
xtplace=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + xtplace;
tobechanged=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + tobechanged;
ijk--;
}
//if (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '}') { xtplace=',' + xtplace; }
break;
case 'S':
ijk=eval(-1 + degfixes[eval(-1 + ideg)].length);
while (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '.' || (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) >= '0' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) <= '9')) {
nums=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + nums;
tobechanged=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + tobechanged;
ijk--;
//alert('2s:' + tobechanged + ' to ' + xtplace + '|' + xtlong + '|' + xtlat);
}
xtlat='_' + nums.replace(/^\-/g,'');
while (ijk >= 0 && (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == ',' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == ' ' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '-' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '[' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '|' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == ';')) {
tobechanged=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + tobechanged;
ijk--;
//alert('3s:' + tobechanged + ' to ' + xtplace + '|' + xtlong + '|' + xtlat);
}
while (ijk >= 0 && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != minus && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != '}' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != '[' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != '|' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != ';') {
xtplace=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + xtplace;
tobechanged=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + tobechanged;
ijk--;
//alert('4s:' + tobechanged + ' to ' + xtplace + '|' + xtlong + '|' + xtlat);
}
//alert('5s:' + tobechanged + ' to ' + xtplace + '|' + xtlong + '|' + xtlat);
//if (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '}') { xtplace=',' + xtplace; }
break;
case 'N':
ijk=eval(-1 + degfixes[eval(-1 + ideg)].length);
while (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '.' || (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) >= '0' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) <= '9')) {
nums=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + nums;
tobechanged=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + tobechanged;
ijk--;
}
xtlat='' + nums.replace(/^\-/g,'');
while (ijk >= 0 && (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == ',' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == ' ' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '-' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '[' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '|' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == ';')) {
tobechanged=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + tobechanged;
ijk--;
}
while (ijk >= 0 && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != minus && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != '}' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != '[' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != '|' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != ';') {
xtplace=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + xtplace;
tobechanged=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + tobechanged;
ijk--;
}
//if (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '}') { xtplace=',' + xtplace; }
break;
default:
break;
}
if (xtlong != '' && xtlat != '') {
if (xtplace.trim() != '') {
//alert('9:' + tobechanged + ' to ' + xtplace.replace(/\-/g,'%2d') + '|' + xtlong + '|' + xtlat);
outmel=outmel.replace('[' + tobechanged + ']', xtplace.replace(/\-/g,'%2d') + '|' + xtlong + '|' + xtlat);
outmel=outmel.replace('' + tobechanged + '', xtplace.replace(/\-/g,'%2d') + '|' + xtlong + '|' + xtlat);
} else {
//alert(938);
outmel=outmel.replace('[' + tobechanged + ']', ('[' + xtplace.replace(/\-/g,'%2d')).replace('[,',',[') + '|' + xtlong + '|' + xtlat + ']');
outmel=outmel.replace('' + tobechanged + '', ('[' + xtplace.replace(/\-/g,'%2d')).replace('[,',',[') + '|' + xtlong + '|' + xtlat + ']');
}
}
xtlat='';
xtlong='';
xtplace='';
nums='';
tobechanged='';
}
}
// 151.5516,-33.2329,Budgewoi{ydney}-{yes}149.5516,-31.2329,Budge-Xwoi{elbourne}
degfixes=outmel.split(',');
var youtmel=outmel, wasmel='', thisfld='';
var atstart=0, itstart=-1, degihj='', repl='';
if (eval('' + degfixes.length) > 3) {
if (outmel.indexOf('--') != -1) {
outmel=outmel.replace(/\-\-/g,'-_');
degfixes=outmel.split(',');
youtmel=outmel;
//alert('YoutMel=' + youtmel);
}
if (outmel.indexOf(',-') != -1) {
outmel=outmel.replace(/\,\-/g,',_');
degfixes=outmel.split(',');
youtmel=outmel;
}
if (outmel.toLowerCase().indexOf(' to -') != -1) {
outmel=outmel.replace(/\ to\ \-/g,' to _').replace(/\ TO\ \-/g,' to _');
degfixes=outmel.split(',');
youtmel=outmel;
}
if (outmel.toLowerCase().indexOf(' from -') != -1) {
outmel=outmel.replace(/\ from\ \-/g,' from _').replace(/\ FROM\ \-/g,' from _');
degfixes=outmel.split(',');
youtmel=outmel;
}
if ((outmel.trim() + ' ').substring(0,1) == '-') {
outmel=outmel.replace('-','_');
degfixes=outmel.split(',');
youtmel=outmel;
}
//alert('Youtmel=' + youtmel + ' ' + meldaccordingly);
for (var ihj=0; ihj<degfixes.length; ihj++) {
if (atstart == 0) {
if (degfixes[ihj].trim() != '') {
if (degfixes[ihj].indexOf('{') == -1 && degfixes[ihj].indexOf('[') == -1 && degfixes[ihj].indexOf('}') == -1 && degfixes[ihj].indexOf(']') == -1) {
if (degfixes[ihj].slice(-1) >= '0' && degfixes[ihj].slice(-1) <= '9') {
itstart=ihj;
atstart++;
//alert('found ' + degfixes[ihj]);
}
}
}
} else if (atstart == 1) {
if (degfixes[ihj].trim() != '') {
if (degfixes[ihj].indexOf('{') == -1 && degfixes[ihj].indexOf('[') == -1 && degfixes[ihj].indexOf('}') == -1 && degfixes[ihj].indexOf(']') == -1) {
if (degfixes[ihj].slice(-1) >= '0' && degfixes[ihj].slice(-1) <= '9') {
atstart++;
} else {
atstart=0;
itstart=-1;
}
} else {
atstart=0;
itstart=-1;
}
} else {
atstart=0;
itstart=-1;
}
} else if (atstart == 2) {
wasmel=youtmel;
if (repl == '' && youtmel.indexOf(degfixes[itstart].replace(/\-/g,'%2d')) != -1) {
repl=degfixes[itstart]; //.replace(/\-/g,'%2d');
} else if (repl == '') {
repl=degfixes[itstart];
}
thisfld=degfixes[ihj];
thisfld=thisfld.split('{')[0].split('_')[0].split('0')[0].split('1')[0].split('2')[0].split('3')[0].split('4')[0].split('5')[0].split('6')[0].split('7')[0].split('8')[0].split('9')[0].split(' to ')[0].split(' TO ')[0].split(' from ')[0].split(' FROM ')[0].replace(/\-$/g,'').replace(/\-/g,'%2d');
if (thisfld.indexOf('%2d') != -1) {
youtmel=youtmel.replace(thisfld.replace(/\%2d/g,'-'), thisfld);
}
//thisfld=thisfld.split('-')[0];
repl=repl.split('}')[eval(-1 + repl.split('}').length)];
repl=repl.split('-')[eval(-1 + repl.split('-').length)];
//alert('thisfld=' + thisfld + ' and repl=' + repl);
//alert('repl=' + repl + ',' + degfixes[eval(-1 + ihj)] + ', replaced by ' + thisfld.split('{')[0].replace(/\-/g,'%2d').split('-')[0] + ' via ' + degfixes[ihj]);
degihj=degfixes[ihj].split('}')[eval(-1 + degfixes[ihj].split('}').length)];
degihj=degfixes[ihj].split('-')[eval(-1 + degfixes[ihj].split('-').length)];
if ((degfixes[ihj] + ' ').toUpperCase().substring(0,1) >= 'A' && (degfixes[ihj] + ' ').toUpperCase().substring(0,1) <= 'Z') {
//alert(' change ' + degfixes[itstart] + ',' + degfixes[eval(-1 + ihj)] + ',' + degfixes[ihj].split('{')[0].replace(/\-/g,'%2d').split('-')[0] + ' in ' + outmel);
youtmel=youtmel.replace(repl + ',' + degfixes[eval(-1 + ihj)] + ',' + thisfld.split('{')[0].split('-')[0], thisfld.split('{')[0].replace(/\-/g,'%2d').split('-')[0] + '|' + repl.replace('-','_') + '|' + degfixes[eval(-1 + ihj)].replace('-','_'))
} else {
youtmel=youtmel.replace(repl + ',' + degfixes[eval(-1 + ihj)], '||' + repl.replace('-','_') + '|' + thisfld.replace('-','_'))
}
//if (wasmel == youtmel) {
//alert('Oops change ' + repl + ',' + degfixes[eval(-1 + ihj)] + ',' + degfixes[ihj].split('{')[0].replace(/\-/g,'%2d').split('-')[0] + ' IN ' + youtmel);
//} else {
//alert('youtmel=' + youtmel + ' via ' + thisfld.split('{')[0].replace(/\-/g,'%2d').split('-')[0] + '|' + repl.replace('-','_') + '|' + degfixes[eval(-1 + ihj)].replace('-','_'));
//}
repl='';
atstart=0;
itstart=-1;
if (degihj.trim() != '') {
degihj=degihj.split('}')[eval(-1 + degihj.split('}').length)];
//alert(degihj);
if (degihj.indexOf('{') == -1 && degihj.indexOf('[') == -1 && degihj.indexOf('}') == -1 && degihj.indexOf(']') == -1) {
if (degihj.slice(-1) >= '0' && degihj.slice(-1) <= '9') {
itstart=ihj;
atstart++;
repl=degihj;
//alert('Found ' + degihj);
} else {
degihj='';
}
} else {
degihj='';
}
} else {
degihj='';
}
}
}
if (youtmel != outmel) { outmel=youtmel; }
//alert(outmel);
}
}
//if (outmel.trim() != '') { alert(pref + outmel + suff); }
return pref + outmel + suff;
}
function retyour(propis) {
if (!realtz) {
return eventualyourtzlist;
}
return yourtzlist;
}
function yourtzlistindexOf(proposedplace) {
if (yourtzlist.indexOf(proposedplace) != -1) {
realtz=true;
var xproposedplace=proposedplace.replace('/','').replace('<','');
var idx=yourtzlist.toUpperCase().indexOf('/' + xproposedplace.toUpperCase() + '<');
if (idx != -1) {
var idxtwo=eval(eval('' + yourtzlist.substring(eval(-30 + idx)).toUpperCase().indexOf('>')) + idx - 29);
if (bigback.indexOf(xproposedplace + ':') == -1 && bigback.indexOf(xproposedplace.replace(/\ /g,'_') + ':') == -1 && nextwiftwo.indexOf(encodeURIComponent(xproposedplace)) == -1) {
if (wiftwoavailable) {
wiftwoavailable=false;
//alert('3:' + '/PHP/fgc/index.php?tzexact=' + encodeURIComponent(yourtzlist.substring(idxtwo).split('<')[0]) + '&tznickname=' + encodeURIComponent(xproposedplace.replace(/\ /g,'_')));
document.getElementById('wiftwo').src='/PHP/fgc/index.php?tzexact=' + encodeURIComponent(yourtzlist.substring(idxtwo).split('<')[0]) + '&tznickname=' + encodeURIComponent(xproposedplace.replace(/\ /g,'_'));
//alert(document.getElementById('wiftwo').src);
} else {
nextwiftwo+='/PHP/fgc/index.php?tzexact=' + encodeURIComponent(yourtzlist.substring(idxtwo).split('<')[0]) + '&tznickname=' + encodeURIComponent(xproposedplace.replace(/\ /g,'_')) + '#';
}
}
}
return yourtzlist.indexOf(proposedplace);
} else if (eventualyourtzlist.indexOf(proposedplace) != -1) {
realtz=false;
return eventualyourtzlist.indexOf(proposedplace);
} else {
realtz=true;
}
return yourtzlist.indexOf(proposedplace);
}
function plotalert(inanno) {
if (inanno.trim() != '') {
var arrp=plotanno.indexOf(inanno);
if (arrp >= 0) {
var defplace=plotplace[arrp].replace(/\ /g,'_').split(',_')[0];
var ddef='' + defplace + '{' + inanno + '}';
var makechanges=prompt('Change as needed.' + String.fromCharCode(10) + String.fromCharCode(10) + ddef, ddef);
if (makechanges == null) { makechanges=''; }
if (makechanges.trim() != '' && makechanges != ddef) {
if (makechanges.indexOf('{') != -1) {
plotanno[arrp]=makechanges.split('{')[1].split('}')[0];
plotplace[arrp]=plotplace[arrp].replace(defplace.replace(/\_/g,' '), makechanges.split('{')[0]);
} else {
plotanno[arrp]='';
plotplace[arrp]=makechanges;
}
}
} else {
alert(inanno);
}
}
return null;
}
function legsalert(inanno, ddef) {
//alert(ddef);
if (ddef.trim() != '') {
ddef='' + ddef.replace(/\`/g, '"');
var arrp=legsanno.indexOf(ddef);
//alert('' + arrp + ' ' + ddef);
if (arrp >= 0) {
var makechanges=prompt(inanno, ddef);
if (makechanges == null) { makechanges=''; }
if (makechanges != '' && makechanges != ddef) {
legsanno[arrp]=makechanges.trim();
}
} else {
alert(inanno);
}
}
return null;
}
function newhashit() {
var newh='#', legi=0, interim='', thedelim='';
if (document.getElementById('sdurl')) {
var washash='';
if (document.getElementById('sdurl').value.indexOf('#') != -1) {
washash='#' + document.getElementById('sdurl').value.split('#')[1];
}
for (var ii=0; ii<plotplace.length; ii++) {
thedelim='-';
//alert('cseplocans=' + cseplocans + ' and plotplace[ii]=' + plotplace[ii].split(', ')[0])
if (cseplocans.indexOf(',' + plotplace[ii].split(', ')[0]) != -1) {
thedelim=',';
}
//alert('argstuff=' + argstuff + ' and plotplace[ii]=' + plotplace[ii].split(', ')[0]);
//if (argstuff.indexOf(encodeURIComponent(',' + plotplace[ii].split(', ')[0].replace(/\ /g,'_'))) != -1) {
// thedelim=',';
//alert('Argstuff=' + argstuff + ' and plotplace[ii]=' + plotplace[ii].split(', ')[0]);
//}
if ((plotplace[ii] + ' ').toUpperCase().substring(0,1) >= 'A' && (plotplace[ii] + ' ').toUpperCase().substring(0,1) <= 'Z') {
if (newh == '#') {
if (plotanno[ii].trim() != '') {
newh+=encodeURIComponent(plotplace[ii].replace(/\ /g,'_').split(',_')[0] + '{' + plotanno[ii] + '}');
} else if (legc.indexOf(',' + eval(-1 + ii) + '.' + eval(0 + ii) + ',') != -1) {
legi=legs.indexOf('' + eval(-1 + ii) + '.' + eval(0 + ii) + '');
if (legi == -1) {
newh+=encodeURIComponent(thedelim) + encodeURIComponent(plotplace[ii].replace(/\ /g,'_').split(',_')[0]);
} else if (legsanno[legi].trim() != '') {
newh+=encodeURIComponent(thedelim + '{' + legsanno[legi] + '}') + encodeURIComponent(plotplace[ii].replace(/\ /g,'_').split(',_')[0]);
} else {
newh+=encodeURIComponent(thedelim) + encodeURIComponent(plotplace[ii].replace(/\ /g,'_').split(',_')[0]);
}
} else {
newh+=encodeURIComponent(',') + encodeURIComponent(plotplace[ii].replace(/\ /g,'_').split(',_')[0]);
}
} else if (plotplace[ii].trim() != '') {
interim=encodeURIComponent(plotplace[ii].replace(/\ /g,'_').split(',_')[0]);
if (plotanno[ii].trim() != '') {
interim=encodeURIComponent(plotplace[ii].replace(/\ /g,'_').split(',_')[0] + '{' + plotanno[ii] + '}');
}
if (legc.indexOf(',' + eval(-1 + ii) + '.' + eval(0 + ii) + ',') != -1) {
legi=legs.indexOf('' + eval(-1 + ii) + '.' + eval(0 + ii) + '');
if (legi == -1) {
newh+=encodeURIComponent(thedelim) + interim;
} else if (legsanno[legi].trim() != '') {
newh+=encodeURIComponent(thedelim + '{' + legsanno[legi] + '}') + interim;
} else {
newh+=encodeURIComponent(thedelim) + interim;
}
} else {
newh+=encodeURIComponent(',') + interim;
}
}
}
}
//alert(argstuff + ' and isotwo=' + isotwo);
var its=isotwo.split(',');
// ?nontz=Chiang_Mai%7C98.99861%7C18.79528%7CMM and isotwo=Chiang MaiTH
for (var jits=0; jits<its.length; jits++) {
if (eval('' + its[jits].length) > 2) {
if (argstuff.indexOf(its[jits].substring(0, eval(-2 + its[jits].length)).replace(/\ /g,'_') + '%7C') != -1) {
//alert('found ' + its[jits].substring(0, eval(-2 + its[jits].length)));
var thingos=argstuff.split(its[jits].substring(0, eval(-2 + its[jits].length)).replace(/\ /g,'_') + '%7C')[1].split(',')[0].split('%7C');
//alert(thingos[eval(-1 + thingos.length)].toUpperCase() + ' versus ' + its[jits].slice(-2));
//alert(thingos[eval(-1 + thingos.length)].toUpperCase() + ' vs ' + its[jits].slice(-2));
if (thingos[eval(-1 + thingos.length)].toUpperCase() != its[jits].slice(-2)) {
argstuff=argstuff.replace(thingos[eval(-3 + thingos.length)] + '%7C' + thingos[eval(-2 + thingos.length)] + '%7C' + thingos[eval(-1 + thingos.length)], thingos[eval(-3 + thingos.length)] + '%7C' + thingos[eval(-2 + thingos.length)] + '%7C' + its[jits].slice(-2));
}
if (1 == 6) {
for (var ijk=0; ijk<iso_country_codes.length; ijk+=2) {
if (iso_country_codes[ijk].toUpperCase() == its[jits].slice(-2)) {
argstuff=argstuff.replace(its[jits].substring(0, eval(-2 + its[jits].length)).replace(/\ /g,'_') + '%7C', its[jits].substring(0, eval(-2 + its[jits].length)).replace(/\ /g,'_') + encodeURIComponent(', ' + iso_country_codes[ijk]) + '%7C');
}
}
}
//alert(argstuff + ' aNd isotwo=' + isotwo);
}
}
}
var ssargstuff=argstuff;
if (prefixingstuff.trim() != '') {
if (ssargstuff == '') {
ssargstuff='?nontz=' + encodeURIComponent(nomc(prefixingstuff));
} else if (ssargstuff.indexOf('nontz=') != -1 && ssargstuff.indexOf(encodeURIComponent(nomc(prefixingstuff))) == -1) {
ssargstuff=ssargstuff.replace('nontz=', 'nontz=' + encodeURIComponent(nomc(prefixingstuff)));
}
} else if (5 == 7) {
if (dstylestuff.trim() != '') {
if (ssargstuff == '') {
ssargstuff='?nontz=' + encodeURIComponent(dstylestuff);
} else if (ssargstuff.indexOf('nontz=') != -1) {
ssargstuff=ssargstuff.replace('nontz=', 'nontz=' + encodeURIComponent(nomc(dstylestuff)));
}
}
if (dscriptstuff.trim() != '') {
if (ssargstuff == '') {
ssargstuff='?nontz=' + encodeURIComponent(dscriptstuff);
} else if (ssargstuff.indexOf('nontz=') != -1) {
ssargstuff=ssargstuff.replace('nontz=', 'nontz=' + encodeURIComponent(nomc(dscriptstuff)));
}
}
//alert('ssargstuff = ' + ssargstuff);
}
gnewh=newh;
//alert('before:' + document.getElementById('sdurl').value);
if (newh != lasthcalc && newh != '#' && newh != washash) {
//alert('using ssargstuff=' + ssargstuff);
document.getElementById('sdurl').value=(document.getElementById('sdurl').value.split('#')[0].split('?')[0] + thecssarg + ((argstuff + '#') == '#' ? argstuff + '#' : '#' + argstuff.substring(1) + '&') + newh.substring(1).replace(/^\%2C/g,'')).replace('', '&');
lasthcalc=newh;
} else if (document.getElementById('sdurl').value.indexOf('?') == -1 && argstuff.indexOf('?') == 0) {
//alert('Using ssargstuff=' + ssargstuff);
document.getElementById('sdurl').value=(document.getElementById('sdurl').value.split('#')[0].split('?')[0] + thecssarg + ((argstuff + '#') == '#' ? argstuff + '#' : '#' + argstuff.substring(1) + '&') + ('#' + newh.substring(1).replace(/^\%2C/g,'')).replace(/^\#$/g, '')).replace('', '&');
if (newh.replace('#','') != '') { lasthcalc=newh; }
}
}
if (prefixingstuff != '' && argstuff.indexOf('nontz=') != -1) {
if (argstuff.indexOf(encodeURIComponent(prefixingstuff)) == -1) {
argstuff=argstuff.replace('nontz=', 'nontz=' + encodeURIComponent(prefixingstuff));
}
}
//alert('thecssarg=' + thecssarg + ' and argstuff=' + argstuff + ' and after:' + document.getElementById('sdurl').value);
}
function myFunction(opening) {
if (opening) {
document.body.style.backgroundColor='lightgreen';
if (!playing && restart) {
//document.title='Restarting video play at ' + document.URL + ' at ' + ('' + new Date()) + '.';
if (firstopn && eval('' + plotplace.length) > 0) {
if (plotplace[eval(-1 + plotplace.length)].trim() != '') {
lastdtplace='' + plotplace[eval(-1 + plotplace.length)];
document.title='' + plotplace[eval(-1 + plotplace.length)] + ' ... ';
}
}
movesallowed=gmovesallowed; five=gfive; //document.getElementById('main-video').play();
playing=true;
} else {
//alert('2:' + document.title);
movesallowed=gmovesallowed; five=gfive; //document.getElementById('main-video').play();
document.title=(document.title + ' ... ').split(' ... ')[0] + ' ... ' + 'Welcome back to Earth Scanner at ' + ('' + new Date()) + '.';
}
restart=false;
} else {
document.body.style.backgroundColor='yellow';
if (playing) {
movesallowed=false; five=0; // document.getElementById('main-video').pause();
playing=false;
restart=true;
document.title=(document.title + ' ... ').split(' ... ')[0] + ' ... ' + 'Paused Earth Scanner at ' + ('' + new Date()) + '.';
} else {
//alert('0:' + document.title);
movesallowed=false; five=0; // document.getElementById('main-video').pause();
document.title=(document.title + ' ... ').split(' ... ')[0] + ' ... ' + 'You left Earth Scanner at ' + ('' + new Date()) + '.';
}
}
//alert(0);
firstopn=false;
}
function myCloseFunction() {
if (document.visibilityState === "hidden") {
if (playing) {
movesallowed=false; five=0; // document.getElementById('main-video').pause();
playing=false;
restart=true;
document.title=(document.title + ' ... ').split(' ... ')[0] + ' ... ' + 'Paused Earth Scanner at ' + ('' + new Date()) + '.';
} else {
//alert('1:' + document.title);
movesallowed=false; five=0; // document.getElementById('main-video').pause();
document.title=(document.title + ' ... ').split(' ... ')[0] + ' ... ' + 'You Left Earth Scanner at ' + ('' + new Date()) + '.';
}
document.body.style.backgroundColor='yellow';
} else {
myFunction(true);
}
}
function orflag(thisincc) {
var thiscc='';
if (eval('' + thisincc.length) >= 2) {
thiscc=thisincc.substring(0,2);
if (eval('' + thisincc.length) > 2) {
if (ocprefix == ' ') {
ocprefix='<div id=yourcanvas>';
ocsuffix='</div>';
//alert(965);
//} else {
// ocprefix='';
// ocsuffix='';
//fivethousand=35000;
//alert(456);
document.getElementById('tzi').src=document.getElementById('tzi').src.split('?')[0] + '?y=y&tzexact=' + encodeURIComponent(thisincc.substring(2)) + '&tznickname=' + encodeURIComponent(thisincc.substring(2));
} //else {
//alert(location.hash);
//}
}
} else {
return '';
}
var ccchar='', ccsuff='';
var lri='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var dri=['127462','127463','127464','127465','127466','127467','127468','127469','127470','127471','127472','127473','127474','127475','127476','127477','127478','127479','127480','127481','127482','127483','127484','127485','127486','127487'];
for (var iccsuff=0; iccsuff<thiscc.length; iccsuff++) {
ccchar=thiscc.substring(iccsuff, eval(1 + eval('' + iccsuff))).toUpperCase();
ccsuff+=String.fromCodePoint(eval('' + dri[eval('' + lri.indexOf(ccchar))])); //'' + dri[eval('' + lri.indexOf(ccchar))] + ';';
}
return ccsuff;
}
function clockit(hoursoffgmt) {
// 1 o'clock is 🕐
// 2 o'clock is 🕑
// 12 o'clock is 🕛
// 2:30 is 🕝
// 11:30 is 🕦
// 12:30 is 🕧
var along='Saturday,Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday';
var gmtdatetimeis='' + new Date().toUTCString();
var daybit='';
var ampm=' am';
if (gmtdatetimeis.indexOf('day') != -1) {
ampm+=', ' + gmtdatetimeis.split('day')[0].split(' ')[eval(-1 + gmtdatetimeis.split('day')[0].split(' ').length)] + 'day';
} else if (gmtdatetimeis.indexOf(',') != -1) {
ampm+=', ' + (gmtdatetimeis.split(',')[0].split(' ')[eval(-1 + gmtdatetimeis.split(',')[0].split(' ').length)] + '').replace(/^Sat$/g,'Saturday').replace(/^Sun$/g,'Sunday').replace(/^Mon$/g,'Monday').replace(/^Tue$/g,'Tuesday').replace(/^Wed$/g,'Wednesday').replace(/^Thu$/g,'Thursday').replace(/^Fri$/g,'Friday');
}
if (ampm.length > 3) { daybit=ampm.substring(5); }
var minis=eval('' + gmtdatetimeis.split(':')[1]);
var hris=eval(('' + gmtdatetimeis.split(':')[0]).split(' ')[eval(-1 + ('' + gmtdatetimeis.split(':')[0]).split(' ').length)]);
if (('' + hoursoffgmt).indexOf('-') != -1 && eval(eval('' + hoursoffgmt.replace('+','')) + hris) < 0.0) {
ampm=ampm.replace('am', 'pm');
if (daybit != '') { ampm=ampm.replace(daybit, along.split(',' + daybit)[0].split(',')[eval(-1 + along.split(',' + daybit)[0].split(',').length)]); }
} else if (('' + hoursoffgmt).indexOf('-') == -1 && eval(eval('' + hoursoffgmt.replace('+','')) + hris) >= 24) {
if (daybit != '') { ampm=ampm.replace(daybit, along.split(daybit + ',')[1].split(',')[0]); }
} else if (('' + hoursoffgmt).indexOf('-') == -1 && eval(eval('' + hoursoffgmt.replace('+','')) + hris) >= 12) {
ampm=ampm.replace('am', 'pm');
}
hris+=eval(eval(24 + eval('' + hoursoffgmt.replace('+','').split('.')[0])) % 24);
if (('' + hoursoffgmt.replace('+','')).indexOf('.5') != -1) {
if (('' + hoursoffgmt.replace('+','')).indexOf('-') != -1 && minis >= 30) {
minis-=30;
} else if (('' + hoursoffgmt.replace('+','')).indexOf('-') != -1) {
hris--;
if (hris < 24) { hris=23; ampm=ampm.replace('am', 'pm'); if (daybit != '') { ampm=ampm.replace(daybit, along.split(',' + daybit)[0].split(',')[eval(-1 + along.split(',' + daybit)[0].split(',').length)]); } }
minis+=30;
} else if (('' + hoursoffgmt.replace('+','')).indexOf('-') == -1 && minis < 30) {
minis+=30;
} else if (('' + hoursoffgmt.replace('+','')).indexOf('-') != -1) {
hris++;
if (hris > 24) { hris=24; ampm=ampm.replace('pm', 'am'); if (daybit != '') { ampm=ampm.replace(daybit, along.split(daybit + ',')[1].split(',')[0]); } }
minis-=30;
}
} else if (('' + hoursoffgmt.replace('+','')).indexOf('.25') != -1) {
if (('' + hoursoffgmt.replace('+','')).indexOf('-') != -1 && minis >= 15) {
minis-=15;
} else if (('' + hoursoffgmt.replace('+','')).indexOf('-') != -1) {
hris--;
if (hris < 24) { hris=23; ampm=ampm.replace('am', 'pm'); if (daybit != '') { ampm=ampm.replace(daybit, along.split(',' + daybit)[0].split(',')[eval(-1 + along.split(',' + daybit)[0].split(',').length)]); } }
minis+=15;
} else if (('' + hoursoffgmt.replace('+','')).indexOf('-') == -1 && minis < 45) {
minis+=15;
} else if (('' + hoursoffgmt.replace('+','')).indexOf('-') != -1) {
hris++;
if (hris > 24) { hris=24; ampm=ampm.replace('pm', 'am'); if (daybit != '') { ampm=ampm.replace(daybit, along.split(daybit + ',')[1].split(',')[0]); } }
minis-=15;
}
} else if (('' + hoursoffgmt.replace('+','')).indexOf('.75') != -1) {
if (('' + hoursoffgmt.replace('+','')).indexOf('-') != -1 && minis >= 45) {
minis-=45;
} else if (('' + hoursoffgmt.replace('+','')).indexOf('-') != -1) {
hris--;
if (hris < 24) { hris=23; ampm=ampm.replace('am', 'pm'); if (daybit != '') { ampm=ampm.replace(daybit, along.split(',' + daybit)[0].split(',')[eval(-1 + along.split(',' + daybit)[0].split(',').length)]); } }
minis+=45;
} else if (('' + hoursoffgmt.replace('+','')).indexOf('-') == -1 && minis < 15) {
minis+=45;
} else if (('' + hoursoffgmt.replace('+','')).indexOf('-') != -1) {
hris++;
if (hris > 24) { hris=24; ampm=ampm.replace('pm', 'am'); if (daybit != '') { ampm=ampm.replace(daybit, along.split(daybit + ',')[1].split(',')[0]); } }
minis-=45;
}
}
//alert('' + hoursoffgmt + ' ' + hris + ' ' + minis + ' ' + gmtdatetimeis);
if (minis > 45 && eval(hris % 12) == 0) {
return ' ' + String.fromCodePoint(128336) + ampm;
} else if (eval(hris % 12) == 0 && minis <= 15) {
return ' ' + String.fromCodePoint(128347) + ampm;
} else if (eval(hris % 12) == 0) {
return ' ' + String.fromCodePoint(128359) + ampm;
} else if (minis >= 45) {
return ' ' + String.fromCodePoint(eval(eval(hris % 12) + 128336)) + ampm;
} else if (minis <= 15) {
return ' ' + String.fromCodePoint(eval(eval(hris % 12) + 128335)) + ampm;
} else {
return ' ' + String.fromCodePoint(eval(eval(hris % 12) + 128347)) + ampm;
}
return '';
}
function retnearest(tolong, tolat) {
//alert(1);
var diff, date0, date1, utcDate, tzDate, udate, utzdate;
//alert(0);
gmtemj='|' + clockit('0');
var datetime_str='';
var sofardist=-12, ntolong=tolong, ntolat=tolat, thisfardist=0, extratz='', extratztime='', extraemj=''; // thisplace='', thiscc='', thiscn=''
var iplacesarr=yourtzlist.split(' data-geo="');
for (var jk=1; jk<iplacesarr.length; jk++) {
thisfardist=eval(Math.abs(tolong - eval(iplacesarr[jk].split(',')[1])) * Math.abs(tolong - eval(iplacesarr[jk].split(',')[1])) + Math.abs(tolat - eval(iplacesarr[jk].split(',')[0])) * Math.abs(tolat - eval(iplacesarr[jk].split(',')[0])));
if (sofardist < 0) {
sofardist=thisfardist;
ntolong=eval('' + iplacesarr[jk].split(',')[1]);
ntolat=eval('' + iplacesarr[jk].split(',')[0]);
thiscc=iplacesarr[jk].split(',')[3];
thisplace=iplacesarr[jk].split('>')[1].split('<')[0];
extratz=',' + thisplace; //.split('/')[eval(-1 + iplacesarr[jk].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' ');
date0=new Date().toLocaleString("en-US", { timeZone: thisplace.replace('GMT','UTC') });
extratztime=('|' + date0);
gmttztime=extratztime;
udate=new Date();
utcDate = new Date(udate.toLocaleString('en-US', { timeZone: 'UTC' }));
thisplace=iplacesarr[jk].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/')[eval(-1 + iplacesarr[jk].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' ');
//alert(0);
gmtemj='|' + clockit('0');
//alert(gmtemj);
} else if (thisfardist < sofardist) {
sofardist=thisfardist;
ntolong=eval('' + iplacesarr[jk].split(',')[1]);
ntolat=eval('' + iplacesarr[jk].split(',')[0]);
thiscc=iplacesarr[jk].split(',')[3];
thisplace=iplacesarr[jk].split('>')[1].split('<')[0];
utzdate=new Date();
tzDate = new Date(utzdate.toLocaleString('en-US', { timeZone: thisplace.replace('GMT','UTC') }));
extratz='|' + thisplace; //.split('/')[eval(-1 + iplacesarr[jk].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' ');
date1=new Date().toLocaleString("en-US", { timeZone: thisplace.replace('GMT','UTC') });
extratztime=('|' + date1);
thisplace=thisplace.replace('GMT','Europe/London').split('/')[eval(-1 + iplacesarr[jk].split('>')[1].split('<')[0].replace('GMT','Europe/London').split('/').length)].replace(/\_/g,' ');
diff = Math.abs(tzDate.getTime() - utcDate.getTime()) / 3600000;
if (diff > 0 && (eval('' + utcDate.getDay()) == 0 && eval('' + tzDate.getDay()) == 6 || eval('' + utcDate.getDay()) > eval('' + tzDate.getDay()))) {
diff=-diff;
}
extraemj='|' + clockit('' + diff);
}
}
if (thiscc != '') {
if (thefirst) {
thefirst=false;
//document.title='' + diff + ' ... ' + extratztime + extraemj + ' ... ' + diff;
//if (diff > 0 && tzDate > utcDate) {
//alert('not okay: ' + tzDate + tzDate.getDay() + ' - ' + utcDate + utcDate.getDay());
//} else {
//alert('okay: ' + tzDate + tzDate.getDay() + ' - ' + utcDate + utcDate.getDay());
//}
}
for (var ijk=0; ijk<iso_country_codes.length; ijk+=2) {
if (iso_country_codes[ijk].toUpperCase() == thiscc) {
thisplace+=', ' + iso_country_codes[eval(1 + ijk)];
}
}
}
//alert('' + ntolong + '|' + ntolat + '|' + thiscc + '|' + thisplace + extratz + extratztime + extraemj + gmttztime + gmtemj);
return '' + ntolong + '|' + ntolat + '|' + thiscc + '|' + thisplace + extratz + extratztime + extraemj + gmttztime + gmtemj;
}
function newprompt(inpt, indt) {
var aredows=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
var dowsare=['saturday','Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','sunday'];
var urlidea='', thisdtis='', maxdtis='', mindtis='', maxplace='', minplace='', xday='', xdate='', xiis=-1, jnrec=0, jxrec=0;
inpt=inpt.replace(inpt.split(String.fromCharCode(10))[0], inpt.split(String.fromCharCode(10))[0] + ' ( ie. ' + nckname + ' ... add space to show all on map ) ');
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
inpt=inpt.replace('add space to', 'add space at start to');
}
reta=prompt(inpt, inpt);
if (reta == null) {
reta='';
return null;
} else if (reta != null) {
if (reta.trim() != '' && reta.trim() != inpt.trim() && (reta + 'x').substring(0,1) != ' ') {
reta+='youllneverfindthis';
document.getElementById('myimg').click(); // ourprompt(gevent, reta, '');
} else if ((reta.trim() != '' && reta.trim() == inpt.trim() && reta != inpt) || (reta + 'x').substring(0,1) == ' ') {
//alert(1);
urlidea='//www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php#onclick=y&wouldlikeyoutoseekpermission=y&width=556&height=347&country=Places&popularity=&aregeographicals=y&title=Longitude%20' + encodeURIComponent(nckname.replace(String.fromCharCode(10),' ').replace(String.fromCharCode(10),' ').trim()) + '%20Places&lines=y&label=%5B%27Lat%27%2C&value=%27Lon%27%2C+%27Name%27%5D&data='; //%2C%5B-35.447%7C148.828%7C%7EBendora+Reservoir+Bendora+Dam%7E%2C1%5D%2C%5B-35.56541%7C148.83108%7C%7ECorin+Reservoir+Corin+';
if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
urlidea='//www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php#onclick=y&wouldlikeyoutoseekpermission=y&width=' + eval(0.66 * eval('' + screen.width)) + '&height=' + Math.round(eval(eval('' + eval(0.66 * eval('' + screen.width))) * 347 / 556)) + '&country=Places&popularity=&aregeographicals=y&title=Longitude%20' + encodeURIComponent(nckname.replace(String.fromCharCode(10),' ').replace(String.fromCharCode(10),' ').trim()) + '%20Places&lines=y&label=%5B%27Lat%27%2C&value=%27Lon%27%2C+%27Name%27%5D&data='; //%2C%5B-35.447%7C148.828%7C%7EBendora+Reservoir+Bendora+Dam%7E%2C1%5D%2C%5B-35.56541%7C148.83108%7C%7ECorin+Reservoir+Corin+';
}
//alert(urlidea);
var recsarej=inpt.split(String.fromCharCode(10));
for (var jrec=1; jrec<recsarej.length; jrec++) {
if (recsarej[jrec] != recsarej[eval(-1 + jrec)] && recsarej[jrec].trim().indexOf('Meridian') != 0 && recsarej[jrec].trim().indexOf(',') != -1) {
if (recsarej[jrec].split(recsarej[jrec].split(' ')[1] + ' ')[1].indexOf(' am') != -1) {
thisdtis=recsarej[jrec].split(recsarej[jrec].split(' ')[1] + ' ')[1].replace(', ', ', 0').replace(', 010', ', 10').replace(', 011', ', 11').replace(', 012', ', 12').replace(' am', '').replace(',','');
} else if (recsarej[jrec].split(recsarej[jrec].split(' ')[1] + ' ')[1].indexOf(' pm') != -1) {
thisdtis=recsarej[jrec].split(recsarej[jrec].split(' ')[1] + ' ')[1].replace(', 1:', ', 13:').replace(', 2:', ', 14:').replace(', 3:', ', 15:').replace(', 4:', ', 16:').replace(', 5:', ', 17:').replace(', 6:', ', 18:').replace(', 7:', ', 19:').replace(', 8:', ', 20:').replace(', 9:', ', 21:').replace(', 10:', ', 22:').replace(', 11:', ', 23:').replace(', 0:', ', 12:').replace(' pm', '').replace(',','');
} else {
thisdtis=recsarej[jrec].split(recsarej[jrec].split(' ')[1])[1].replace(',','');
}
if (maxdtis == '') {
maxdtis=thisdtis.trim();
mindtis=thisdtis.trim();
maxplace=recsarej[jrec].split(' ')[0];
minplace=recsarej[jrec].split(' ')[0];
jnrec=jrec;
jxrec=jrec;
} else if (thisdtis.trim() > maxdtis.trim()) {
maxdtis=thisdtis.trim();
maxplace=recsarej[jrec].split(' ')[0];
jxrec=jrec;
} else if (thisdtis.trim() < mindtis.trim()) {
mindtis=thisdtis.trim();
minplace=recsarej[jrec].split(' ')[0];
jnrec=jrec;
}
urlidea+=('' + encodeURIComponent(',[' + recsarej[jrec].split(' ')[1].replace(',','|') + '|~' + recsarej[jrec].split(' ')[0] + ' ' + recsarej[jrec].split(recsarej[jrec].split(' ')[1])[1].replace(',','') + '~,1]')).replace(/\~/g,'%7E');
}
}
xday=aredows[eval('' + (new Date()).getDay())];
xiis=dowsare.indexOf(xday);
xdate=('0' + (new Date()).getDate()).slice(-2);
if (maxdtis.trim() == '') {
urlidea=urlidea;
} else if (maxdtis == mindtis) {
if (maxdtis.trim().indexOf(xdate) == 0) {
urlidea=urlidea.replace('%20Places&', '%20Places' + encodeURIComponent(' all have time ' + xday + ' ' + maxdtis) + '&') + ('' + encodeURIComponent(',[' + recsarej[jxrec].split(' ')[1].replace(',','|') + '|~' + recsarej[jxrec].split(' ')[0] + ' ' + recsarej[jxrec].split(recsarej[jxrec].split(' ')[1])[1].replace(',','') + '~,1]')).replace(/\~/g,'%7E');
} else if (xiis > 0 && maxdtis.trim().indexOf(('0' + eval(-1 + eval('' + xdate))).slice(-2)) == 0) {
urlidea=urlidea.replace('%20Places&', '%20Places' + encodeURIComponent(' all have time ' + dowsare[eval(-1 + xiis)].substring(0,1).toUpperCase() + dowsare[eval(-1 + xiis)].substring(1).toLowerCase() + ' ' + maxdtis) + '&') + ('' + encodeURIComponent(',[' + recsarej[jxrec].split(' ')[1].replace(',','|') + '|~' + recsarej[jxrec].split(' ')[0] + ' ' + recsarej[jxrec].split(recsarej[jxrec].split(' ')[1])[1].replace(',','') + '~,1]')).replace(/\~/g,'%7E');
} else if (xiis > 0 && maxdtis.trim().indexOf(('0' + eval(1 + eval('' + xdate))).slice(-2)) == 0) {
urlidea=urlidea.replace('%20Places&', '%20Places' + encodeURIComponent(' all have time ' + dowsare[eval(1 + xiis)].substring(0,1).toUpperCase() + dowsare[eval(1 + xiis)].substring(1).toLowerCase() + ' ' + maxdtis) + '&') + ('' + encodeURIComponent(',[' + recsarej[jxrec].split(' ')[1].replace(',','|') + '|~' + recsarej[jxrec].split(' ')[0] + ' ' + recsarej[jxrec].split(recsarej[jxrec].split(' ')[1])[1].replace(',','') + '~,1]')).replace(/\~/g,'%7E');
} else {
urlidea=urlidea.replace('%20Places&', '%20Places' + encodeURIComponent(' all have time ' + maxdtis) + '&') + ('' + encodeURIComponent(',[' + recsarej[jxrec].split(' ')[1].replace(',','|') + '|~' + recsarej[jxrec].split(' ')[0] + ' ' + recsarej[jxrec].split(recsarej[jxrec].split(' ')[1])[1].replace(',','') + '~,1]')).replace(/\~/g,'%7E');
}
} else {
if (maxdtis.trim() == '') {
maxdtis='';
} else {
if (maxdtis.trim().indexOf(xdate) == 0) {
maxdtis=xday + ' ' + maxdtis;
} else if (xiis > 0 && maxdtis.trim().indexOf(('0' + eval(-1 + eval('' + xdate))).slice(-2)) == 0) {
maxdtis=dowsare[eval(-1 + xiis)].substring(0,1).toUpperCase() + dowsare[eval(-1 + xiis)].substring(1).toLowerCase() + ' ' + maxdtis;
} else if (xiis > 0 && maxdtis.trim().indexOf(('0' + eval(1 + eval('' + xdate))).slice(-2)) == 0) {
maxdtis=dowsare[eval(1 + xiis)].substring(0,1).toUpperCase() + dowsare[eval(1 + xiis)].substring(1).toLowerCase() + ' ' + maxdtis;
} else {
maxdtis=maxdtis;
}
}
if (mindtis.trim() == '') {
mindtis='';
} else {
if (mindtis.trim().indexOf(xdate) == 0) {
mindtis=xday + ' ' + mindtis;
} else if (xiis > 0 && mindtis.trim().indexOf(('0' + eval(-1 + eval('' + xdate))).slice(-2)) == 0) {
mindtis=dowsare[eval(-1 + xiis)].substring(0,1).toUpperCase() + dowsare[eval(-1 + xiis)].substring(1).toLowerCase() + ' ' + mindtis;
} else if (xiis > 0 && mindtis.trim().indexOf(('0' + eval(1 + eval('' + xdate))).slice(-2)) == 0) {
mindtis=dowsare[eval(1 + xiis)].substring(0,1).toUpperCase() + dowsare[eval(1 + xiis)].substring(1).toLowerCase() + ' ' + mindtis;
} else {
mindtis=mindtis;
}
}
urlidea=urlidea.replace('%20Places&', '%20Places' + encodeURIComponent(' have times ranging from ' + minplace + ' ' + mindtis + ' to ' + maxplace + ' ' + maxdtis) + '&');
}
//document.title='' + nckname + ' ' + urlidea.length;
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
//alert(346);
window.open(urlidea, '_blank'); //, 'top=100,left=100,width=800,height=800');
} else {
top.window.open(urlidea, '_blank'); //, 'top=100,left=100,width=800,height=800');
}
//if (urlidea.indexOf('Greenwich') != -1) {
//var qwt=prompt(urlidea, urlidea);
//}
}
}
return reta.replace(/youllneverfindthis$/g, '');
}
function newerlatprompt(inpt, indt) {
var aredows=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
var dowsare=['saturday','Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','sunday'];
var fromu='', tou='';
var urlidea='', thisdtis='', maxdtis='', mindtis='', maxplace='', minplace='', xday='', xdate='', xiis=-1, jnrec=0, jxrec=0;
inpt=inpt.replace(inpt.split(String.fromCharCode(10))[0], inpt.split(String.fromCharCode(10))[0] + ' ( ie. ' + nckname + ' ... add space to show all on map ) ');
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
inpt=inpt.replace('add space to', 'add space at start to');
}
reta=prompt(inpt, inpt);
//alert(reta);
if (reta == null) {
reta='';
return null;
} else if (reta != null) {
if (reta.trim() != '' && reta.trim() != inpt.trim() && (reta + 'x').substring(0,1) != ' ') {
//alert(0);
reta+='youllneverfindthis';
document.getElementById('myimg').click(); // ourprompt(gevent, reta, '');
} else if ((reta.trim() != '' && reta.trim() == inpt.trim() && reta != inpt) || (reta + 'x').substring(0,1) == ' ') {
//alert(1);
urlidea='//www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php#onclick=y&wouldlikeyoutoseekpermission=Y&width=556&height=347&country=Places&popularity=&aregeographicals=y&title=Latitude%20' + encodeURIComponent(nckname.replace(String.fromCharCode(10),' ').replace(String.fromCharCode(10),' ').trim()) + '%20Places&lines=y&label=%5B%27Lat%27%2C&value=%27Lon%27%2C+%27Name%27%5D&data='; //%2C%5B-35.447%7C148.828%7C%7EBendora+Reservoir+Bendora+Dam%7E%2C1%5D%2C%5B-35.56541%7C148.83108%7C%7ECorin+Reservoir+Corin+';
if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
urlidea='//www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php#onclick=y&wouldlikeyoutoseekpermission=Y&width=' + eval(0.66 * eval('' + screen.width)) + '&height=' + Math.round(eval(eval('' + eval(0.66 * eval('' + screen.width))) * 347 / 556)) + '&country=Places&popularity=&aregeographicals=y&title=Latitude%20' + encodeURIComponent(nckname.replace(String.fromCharCode(10),' ').replace(String.fromCharCode(10),' ').trim()) + '%20Places&lines=y&label=%5B%27Lat%27%2C&value=%27Lon%27%2C+%27Name%27%5D&data='; //%2C%5B-35.447%7C148.828%7C%7EBendora+Reservoir+Bendora+Dam%7E%2C1%5D%2C%5B-35.56541%7C148.83108%7C%7ECorin+Reservoir+Corin+';
}
//alert(urlidea);
var recsarej=inpt.split(String.fromCharCode(10));
for (var jrec=1; jrec<recsarej.length; jrec++) {
if (recsarej[jrec] != recsarej[eval(-1 + jrec)] && recsarej[jrec].trim().indexOf('Meridian') != 0 && recsarej[jrec].trim().indexOf(',') != -1) {
if (recsarej[jrec].split(recsarej[jrec].split(' ')[1] + ' ')[1].indexOf(' am') != -1) {
thisdtis=recsarej[jrec].split(recsarej[jrec].split(' ')[1] + ' ')[1].replace(', ', ', 0').replace(', 010', ', 10').replace(', 011', ', 11').replace(', 012', ', 12').replace(' am', '').replace(',','');
} else if (recsarej[jrec].split(recsarej[jrec].split(' ')[1] + ' ')[1].indexOf(' pm') != -1) {
thisdtis=recsarej[jrec].split(recsarej[jrec].split(' ')[1] + ' ')[1].replace(', 1:', ', 13:').replace(', 2:', ', 14:').replace(', 3:', ', 15:').replace(', 4:', ', 16:').replace(', 5:', ', 17:').replace(', 6:', ', 18:').replace(', 7:', ', 19:').replace(', 8:', ', 20:').replace(', 9:', ', 21:').replace(', 10:', ', 22:').replace(', 11:', ', 23:').replace(', 0:', ', 12:').replace(' pm', '').replace(',','');
} else {
thisdtis=recsarej[jrec].split(recsarej[jrec].split(' ')[1])[1].replace(',','');
}
if (maxdtis == '') {
maxdtis=thisdtis.trim();
mindtis=thisdtis.trim();
maxplace=recsarej[jrec].split(' ')[0];
minplace=recsarej[jrec].split(' ')[0];
jnrec=jrec;
jxrec=jrec;
} else if (thisdtis.trim() > maxdtis.trim()) {
maxdtis=thisdtis.trim();
maxplace=recsarej[jrec].split(' ')[0];
jxrec=jrec;
} else if (thisdtis.trim() < mindtis.trim()) {
mindtis=thisdtis.trim();
minplace=recsarej[jrec].split(' ')[0];
jnrec=jrec;
}
urlidea+=('' + encodeURIComponent(',[' + recsarej[jrec].split(' ')[1].replace(',','|') + '|~' + recsarej[jrec].split(' ')[0] + ' ' + recsarej[jrec].split(recsarej[jrec].split(' ')[1])[1].replace(',','') + '~,1]')).replace(/\~/g,'%7E');
}
}
xday=aredows[eval('' + (new Date()).getDay())];
xiis=dowsare.indexOf(xday);
xdate=('0' + (new Date()).getDate()).slice(-2);
if (maxdtis.trim() == '') {
urlidea=urlidea;
} else if (maxdtis == mindtis) {
if (maxdtis.trim().indexOf(xdate) == 0) {
urlidea=urlidea.replace('%20Places&', '%20Places' + encodeURIComponent(' all have time ' + xday + ' ' + maxdtis) + '&') + ('' + encodeURIComponent(',[' + recsarej[jxrec].split(' ')[1].replace(',','|') + '|~' + recsarej[jxrec].split(' ')[0] + ' ' + recsarej[jxrec].split(recsarej[jxrec].split(' ')[1])[1].replace(',','') + '~,1]')).replace(/\~/g,'%7E');
} else if (xiis > 0 && maxdtis.trim().indexOf(('0' + eval(-1 + eval('' + xdate))).slice(-2)) == 0) {
urlidea=urlidea.replace('%20Places&', '%20Places' + encodeURIComponent(' all have time ' + dowsare[eval(-1 + xiis)].substring(0,1).toUpperCase() + dowsare[eval(-1 + xiis)].substring(1).toLowerCase() + ' ' + maxdtis) + '&') + ('' + encodeURIComponent(',[' + recsarej[jxrec].split(' ')[1].replace(',','|') + '|~' + recsarej[jxrec].split(' ')[0] + ' ' + recsarej[jxrec].split(recsarej[jxrec].split(' ')[1])[1].replace(',','') + '~,1]')).replace(/\~/g,'%7E');
} else if (xiis > 0 && maxdtis.trim().indexOf(('0' + eval(1 + eval('' + xdate))).slice(-2)) == 0) {
urlidea=urlidea.replace('%20Places&', '%20Places' + encodeURIComponent(' all have time ' + dowsare[eval(1 + xiis)].substring(0,1).toUpperCase() + dowsare[eval(1 + xiis)].substring(1).toLowerCase() + ' ' + maxdtis) + '&') + ('' + encodeURIComponent(',[' + recsarej[jxrec].split(' ')[1].replace(',','|') + '|~' + recsarej[jxrec].split(' ')[0] + ' ' + recsarej[jxrec].split(recsarej[jxrec].split(' ')[1])[1].replace(',','') + '~,1]')).replace(/\~/g,'%7E');
} else {
urlidea=urlidea.replace('%20Places&', '%20Places' + encodeURIComponent(' all have time ' + maxdtis) + '&') + ('' + encodeURIComponent(',[' + recsarej[jxrec].split(' ')[1].replace(',','|') + '|~' + recsarej[jxrec].split(' ')[0] + ' ' + recsarej[jxrec].split(recsarej[jxrec].split(' ')[1])[1].replace(',','') + '~,1]')).replace(/\~/g,'%7E');
}
} else {
if (maxdtis.trim() == '') {
maxdtis='';
} else {
if (maxdtis.trim().indexOf(xdate) == 0) {
maxdtis=xday + ' ' + maxdtis;
} else if (xiis > 0 && maxdtis.trim().indexOf(('0' + eval(-1 + eval('' + xdate))).slice(-2)) == 0) {
maxdtis=dowsare[eval(-1 + xiis)].substring(0,1).toUpperCase() + dowsare[eval(-1 + xiis)].substring(1).toLowerCase() + ' ' + maxdtis;
} else if (xiis > 0 && maxdtis.trim().indexOf(('0' + eval(1 + eval('' + xdate))).slice(-2)) == 0) {
maxdtis=dowsare[eval(1 + xiis)].substring(0,1).toUpperCase() + dowsare[eval(1 + xiis)].substring(1).toLowerCase() + ' ' + maxdtis;
} else {
maxdtis=maxdtis;
}
}
if (mindtis.trim() == '') {
mindtis='';
} else {
if (mindtis.trim().indexOf(xdate) == 0) {
mindtis=xday + ' ' + mindtis;
} else if (xiis > 0 && mindtis.trim().indexOf(('0' + eval(-1 + eval('' + xdate))).slice(-2)) == 0) {
mindtis=dowsare[eval(-1 + xiis)].substring(0,1).toUpperCase() + dowsare[eval(-1 + xiis)].substring(1).toLowerCase() + ' ' + mindtis;
} else if (xiis > 0 && mindtis.trim().indexOf(('0' + eval(1 + eval('' + xdate))).slice(-2)) == 0) {
mindtis=dowsare[eval(1 + xiis)].substring(0,1).toUpperCase() + dowsare[eval(1 + xiis)].substring(1).toLowerCase() + ' ' + mindtis;
} else {
mindtis=mindtis;
}
}
urlidea=urlidea.replace('%20Places&', '%20Places' + encodeURIComponent(' have times ranging from ' + minplace + ' ' + mindtis + ' to ' + maxplace + ' ' + maxdtis) + '&');
}
//document.title='' + nckname + ' ' + urlidea.length;
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
//alert(246);
window.open(urlidea, '_blank'); //, 'top=100,left=100,width=800,height=800');
} else {
top.window.open(urlidea + fromu + tou, '_blank'); //, 'top=100,left=100,width=800,height=800');
}
//if (urlidea.indexOf('Greenwich') != -1) {
//var qwt=prompt(urlidea, urlidea);
//}
}
}
return reta.replace(/youllneverfindthis$/g, '');
}
function ocm(islong,sthis,intenlong,smlt,lglt) {
gevent=sthis;
var kzero=0, kclass='along', kprefix=',', ksuffix='', iso_two='';
var mten=-10, startat=1;
var wasvl='';
var alertbit="";
if (islong) {
alertbit=" var ap=newprompt('" + intenlong + "'.replace(/\~/g,String.fromCharCode(10)),'" + intenlong + "'.replace(/\~/g,String.fromCharCode(10))); ";
} else {
kzero=1; // 1
kclass='alat';
kprefix='"';
ksuffix='';
alertbit=" var ap=newerlatprompt('" + intenlong + "'.replace(/\~/g,String.fromCharCode(10)),'" + intenlong + "'.replace(/\~/g,String.fromCharCode(10))); ";
}
var ijk=1, kcnt=0, tzp='', datetime_str='', xkcnt='';
var findsare=yourtzlist.split((kprefix + intenlong + ksuffix).replace(/^0/g,'00').replace(/0$/g,''));
if (nckname == ' ') {
nckname='';
document.body.oncontextmenu=function(evt){ evt.stopPropagation(); if (nckname == '') { alert('Right click on Latitudes will show Timezone Place current times of relevance'); } };
}
if (intenlong == 0) { findsare=yourtzlist.split(',+0"'); } else if (intenlong < 0) { mten=10; }
var findsaretwo=yourtzlist.split((kprefix + eval(mten + intenlong) + ksuffix).replace(/^0/g,'00').replace(/0$/g,''));
if (('' + intenlong).indexOf('.') != -1 && kzero == 1) {
findsaretwo=yourtzlist.split((kprefix + ('' + intenlong).split('.')[0].substring(0,eval(-1 + ('' + intenlong).split('.')[0].length)) + ksuffix).replace(/^0/g,'00').replace(/0$/g,''));
}
for (ijk=1; ijk<findsare.length; ijk++) {
if ((intenlong == 0 || (findsare[ijk].substring(0,1) >= '0' && findsare[ijk].substring(0,1) <= '4' && findsare[ijk].substring(1).substring(0,1) < '0')) && findsare[ijk].indexOf('>') != -1 && findsare[ijk].indexOf('<') != -1) {
tzp=findsare[ijk].split('>')[1].split('<')[0];
if (tzp.indexOf('/') != -1) {
console.log(tzp);
datetime_str = new Date().toLocaleString("en-AU", { timeZone: tzp });
console.log(datetime_str);
if (eval('' + yourtzlist.split(tzp)[1].split('data-geo="')[1].split(',')[kzero]) >= eval('' + smlt) && eval('' + yourtzlist.split(tzp)[1].split('data-geo="')[1].split(',')[kzero]) <= eval('' + lglt)) {
wasvl=xkcnt;
if (!islong) {
iso_two=yourtzlist.split(tzp)[1].split('data-geo="')[1].split(',')[3] + ' ';
}
xkcnt='~' + tzp + ' ' + yourtzlist.split(tzp)[1].split('data-geo="')[1].split(',')[0] + ',' + yourtzlist.split(tzp)[1].split('data-geo="')[1].split(',')[1] + ' ' + iso_two + datetime_str + ' ' + wasvl;
} else {
if (!islong) {
iso_two=yourtzlist.split(tzp)[1].split('data-geo="')[1].split(',')[3] + ' ';
}
xkcnt+='~' + tzp + ' ' + yourtzlist.split(tzp)[1].split('data-geo="')[1].split(',')[0] + ',' + yourtzlist.split(tzp)[1].split('data-geo="')[1].split(',')[1] + ' ' + iso_two + datetime_str + ' ';
kcnt++;
}
if (eval('' + findsaretwo.length) > ijk) {
startat++;
if (findsaretwo[ijk].substring(0,1) >= '6' && findsaretwo[ijk].substring(0,1) <= '9' && findsaretwo[ijk].substring(1).substring(0,1) < '0' && findsaretwo[ijk].indexOf('>') != -1 && findsaretwo[ijk].indexOf('<') != -1) {
tzp=findsaretwo[ijk].split('>')[1].split('<')[0];
if (tzp.indexOf('/') != -1) {
datetime_str = new Date().toLocaleString("en-AU", { timeZone: tzp });
if (eval('' + yourtzlist.split(tzp)[1].split('data-geo="')[1].split(',')[kzero]) >= eval('' + smlt) && eval('' + yourtzlist.split(tzp)[1].split('data-geo="')[1].split(',')[kzero]) <= eval('' + lglt)) {
wasvl=xkcnt;
if (!islong) {
iso_two=yourtzlist.split(tzp)[1].split('data-geo="')[1].split(',')[3] + ' ';
}
xkcnt='~' + tzp + ' ' + yourtzlist.split(tzp)[1].split('data-geo="')[1].split(',')[0] + ',' + yourtzlist.split(tzp)[1].split('data-geo="')[1].split(',')[1] + ' ' + iso_two + datetime_str + ' ' + wasvl;
} else {
if (!islong) {
iso_two=yourtzlist.split(tzp)[1].split('data-geo="')[1].split(',')[3] + ' ';
}
xkcnt+='~' + tzp + ' ' + yourtzlist.split(tzp)[1].split('data-geo="')[1].split(',')[0] + ',' + yourtzlist.split(tzp)[1].split('data-geo="')[1].split(',')[1] + ' ' + iso_two + datetime_str + ' ';
}
kcnt++;
}
}
}
}
}
}
for (ijk=startat; ijk<findsaretwo.length; ijk++) {
if (findsaretwo[ijk].substring(0,1) >= '6' && findsaretwo[ijk].substring(0,1) <= '9' && findsaretwo[ijk].substring(1).substring(0,1) < '0' && findsaretwo[ijk].indexOf('>') != -1 && findsaretwo[ijk].indexOf('<') != -1) {
tzp=findsaretwo[ijk].split('>')[1].split('<')[0];
if (tzp.indexOf('/') != -1) {
datetime_str = new Date().toLocaleString("en-AU", { timeZone: tzp });
if (eval('' + yourtzlist.split(tzp)[1].split('data-geo="')[1].split(',')[kzero]) >= eval('' + smlt) && eval('' + yourtzlist.split(tzp)[1].split('data-geo="')[1].split(',')[kzero]) <= eval('' + lglt)) {
if (!islong) {
iso_two=yourtzlist.split(tzp)[1].split('data-geo="')[1].split(',')[3] + ' ';
}
wasvl=xkcnt;
xkcnt='~' + tzp + ' ' + yourtzlist.split(tzp)[1].split('data-geo="')[1].split(',')[0] + ',' + yourtzlist.split(tzp)[1].split('data-geo="')[1].split(',')[1] + ' ' + iso_two + datetime_str + ' ' + wasvl;
} else {
if (!islong) {
iso_two=yourtzlist.split(tzp)[1].split('data-geo="')[1].split(',')[3] + ' ';
}
xkcnt+='~' + tzp + ' ' + yourtzlist.split(tzp)[1].split('data-geo="')[1].split(',')[0] + ',' + yourtzlist.split(tzp)[1].split('data-geo="')[1].split(',')[1] + ' ' + iso_two + datetime_str + ' ';
}
kcnt++;
}
}
}
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
return ' class=' + kclass + ' ontouchend=" nckname=event.target.innerText; event.stopPropagation(); ' + alertbit.replace(/\'\.replace/g, "" + xkcnt + "'.replace") + ' " ';
}
return ' class=' + kclass + ' oncontextmenu=" nckname=event.target.innerText; event.stopPropagation(); ' + alertbit.replace(/\'\.replace/g, "" + xkcnt + "'.replace") + ' " ';
}
function checkll(smlong, lglat, lglong, smlat) {
setTimeout(function(){ prevf='' + smlong + ',' + lglat + ',' + lglong + ',' + smlat; }, fivethousand);
for (var am=-180; am<=180; am+=10) {
if (am >= smlong && am <= lglong) {
if (eval((am + 180) % 180) == 0) {
bmeridian+='<span ' + ocm(true,event,am,smlat,lglat) + ' onclick="event.stopPropagation(); if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { alert(this.title); }" title="At prompt window, prefixing, and persevering, CSS map image styling available (and able to be turned off via nocssplease and special decimal entity number parts for emojis eg. pin:128204; (versus ' + String.fromCodePoint(128205) + ') compass:127993; (versus ' + String.fromCodePoint(129517) + ') eg. filter:sepia(74%); Or you can specify <st' + 'yle></st' + 'yle> non-persevering or <st' + 'yle></ST' + 'YLE> persevering CSS of your own (or use a URL ending with .css (or persevering .CSS)) to begin with and/or <sc' + 'ript></sc' + 'ript> non-persevering or <sc' + 'ript></SC' + 'RIPT> persevering Javascript of your own (or use a URL ending with .js (or persevering .JS)) to begin with" style="z-index:675;position:' + posval + ';left:' + eval(eval(am - smlong) / eval(lglong - smlong) * eval(screenwidth)) + 'px;top:90px;"> ' + (('' + am).replace('-','') + (('' + am).substring(0,1) == '-' ? 'W' : 'E')).replace(/^0E$/g,' Greenwich<br> Meridian').replace(/^180E/g,' International<br> Date<br> Line').replace(/^180W/g,'International<br> Date<br> Line').replace('E','°E').replace('W','°W') + '</span><hr class=mydm title="Meridian ' + am + '" style="z-index:675;position:' + posval + ';left:' + eval(eval(am - smlong) / eval(lglong - smlong) * eval(screenwidth)) + 'px;top:0px;height:' + screenheight + 'px;width:1px;background-color:rgba(255,0,0,0.5);"></hr>';
} else {
bmeridian+='<span ' + ocm(true,event,am,smlat,lglat) + ' onclick="event.stopPropagation(); if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { alert(this.title); }" title="At prompt window, prefixing, and persevering, CSS map image styling available (and able to be turned off via nocssplease and special decimal entity number parts for emojis eg. pin:128204; (versus ' + String.fromCodePoint(128205) + ') compass:127993; (versus ' + String.fromCodePoint(129517) + ') eg. filter:sepia(74%); Or you can specify <st' + 'yle></st' + 'yle> non-persevering or <st' + 'yle></ST' + 'YLE> persevering CSS of your own (or use a URL ending with .css (or persevering .CSS)) to begin with and/or <sc' + 'ript></sc' + 'ript> non-persevering or <sc' + 'ript></SC' + 'RIPT> persevering Javascript of your own (or use a URL ending with .js (or persevering .JS)) to begin with" style="z-index:675;position:' + posval + ';left:' + eval(eval(am - smlong) / eval(lglong - smlong) * eval(screenwidth)) + 'px;top:90px;"> ' + (('' + am).replace('-','') + (('' + am).substring(0,1) == '-' ? 'W' : 'E')).replace(/^0E$/g,' Greenwich<br> Meridian').replace(/^180E/g,' International<br> Date<br> Line').replace(/^180W/g,'International<br> Date<br> Line').replace('E','°E').replace('W','°W') + '</span><hr class=mydm title="Meridian ' + am + '" style="z-index:675;position:' + posval + ';left:' + eval(eval(am - smlong) / eval(lglong - smlong) * eval(screenwidth)) + 'px;top:0px;height:' + screenheight + 'px;width:1px;background-color:rgba(0,0,255,0.5);"></hr>';
}
}
}
}
function bmeranalyze(whatb) {
if (whatb.indexOf('<div id="') != -1 && bmeridian.indexOf('<div id="') != -1) {
var whatid=whatb.split('<div id="')[1].split('"')[0];
var bids=bmeridian.split('<div id="' + whatid + '"');
if (eval('' + bids.length) > 1) {
var underthis=bids[1].split('</div>')[0];
var plonkthis=whatb.split('<div id="' + whatid + '"')[1].split('</div>')[0];
console.log('7:' + underthis + ' + ' + plonkthis.replace(plonkthis.split('>')[0] + '>',''));
bmeridian=bmeridian.replace(underthis, underthis + plonkthis.replace(plonkthis.split('>')[0] + '>', ''));
return bmeridian;
}
}
bmeridian+=whatb;
console.log('8:' + whatb);
return bmeridian;
}
function panno(bec, idx) {
if (plotanno[idx] != bec.replace(/\`/g, '"')) {
plotanno[idx]=bec.replace(/\`/g, '"').replace(/\{/g, '[').replace(/\}/g, ']');
newhashit();
//alert(plotanno[idx]);
}
}
function lganno(bec, idx) {
if (legsanno[idx] != bec.replace(/\`/g, '"')) {
legsanno[idx]=bec.replace(/\`/g, '"').replace(/\{/g, '[').replace(/\}/g, ']');
newhashit();
//alert(legsanno[idx]);
}
}
function doplotplace(ipl, maybeg) {
var jpl=0, detbegin='', detend='', nearend='', textras='', legend='', prelegend='', ileg=0, lpart='';
var thisclock='', nonclock='', aclocl='', thatplace='', utzdate=null, tzDate=null, xdiff=0, xdate1=null;
if (!reveal) {
detbegin='<details onclick="reveal=!reveal;"><summary></summary>';
detend='</details>';
} else {
detbegin='<details open onclick="reveal=!reveal;"><summary>';
detend='</summary></details>';
}
if (plotcc[ipl].trim() && plottz[ipl].trim() != '') { // && plotplace[ipl].indexOf(':') == -1) {
//alert(plotplace[ipl]);
//alert(plotct[ipl]);
//alert(plotemj[ipl]);
if (maybeg == 'g') {
for (ileg=kleg; ileg<legs.length; ileg++) {
if (('~' + legs[ileg] + '~').indexOf('~' + ipl + '.') != -1) {
jpl=eval(('~' + legs[ileg] + '~').split('~' + ipl + '.')[1].split('~')[0]);
if (pleasenolist.indexOf('|' + plotplace[ipl].split(', ')[0].split(',_')[0] + '|') == -1 && pleasenolist.indexOf('|' + ipl + '|') == -1) {
lpart='<details onclick="event.stopPropagation();" title="Annotations for Leg from ' + plotplace[ipl].replace(/\_/g,' ') + ' ' + orflag(plotcc[ipl]) + ' to ' + plotplace[jpl].replace(/\_/g,' ') + ' ' + orflag(plotcc[jpl]) + ' ..."><summary class=lanno> --> ' + plotplace[jpl].replace(/\_/g,' ') + ' ' + orflag(plotcc[jpl]) + '</summary><textarea class=txleg onclick="event.stopPropagation();" rows=9 cols=40 onblur="lganno(this.value,' + ileg + ');">' + legsanno[ileg].replace(/\"/g,'`') + '</textarea></details>';
if (legend.indexOf(lpart.split('<summary')[0]) == -1) { legend+=lpart; }
}
}
if (('~' + legs[ileg] + '~').indexOf('.' + ipl + '~') != -1) {
jpl=eval(('~' + legs[ileg] + '~').split('.' + ipl + '~')[0].split('~')[1]);
if (pleasenolist.indexOf('|' + plotplace[jpl].split(', ')[0].split(',_')[0] + '|') == -1 && pleasenolist.indexOf('|' + jpl + '|') == -1) {
lpart='<details onclick="event.stopPropagation();" title="Annotations for Leg from ' + plotplace[jpl].replace(/\_/g,' ') + ' ' + orflag(plotcc[jpl]) + ' to ' + plotplace[ipl].replace(/\_/g,' ') + ' ' + orflag(plotcc[ipl]) + ' ..."><summary class=lanno>' + plotplace[jpl].replace(/\_/g,' ') + ' ' + orflag(plotcc[jpl]) + ' --></summary><textarea class=txleg onclick="event.stopPropagation();" rows=9 cols=40 onblur="lganno(this.value,' + ileg + ');">' + legsanno[ileg].replace(/\"/g,'`') + '</textarea></details>';
if (prelegend.indexOf(lpart.split('<summary')[0]) == -1) { prelegend+=lpart; }
}
}
}
if (bmeridian.indexOf(' id="div' + plotlong[ipl] + plotlat[ipl] + '"') != -1) {
textras=bmeridian.split(' id="div' + plotlong[ipl] + plotlat[ipl] + '"')[1].split('>')[0].replace(/\"$/g, String.fromCharCode(10) + plotanno[ipl].replace(/\"/g,'`') + '"');
} else {
textras=' title="' + plotanno[ipl].replace(/\"/g,'`') + '"';
}
nearend='<div id="div' + plotlong[ipl] + plotlat[ipl] + '"' + textras + '>' + prelegend + '<details onclick="event.stopPropagation();" title="Annotations for ' + plotplace[ipl].replace(/\_/g,' ') + ' ' + orflag(plotcc[ipl]) + ' ..."><summary class=panno>🖋</summary><textarea class=txplc onclick="event.stopPropagation();" rows=9 cols=40 onblur="panno(this.value,' + ipl + ');">' + plotanno[ipl].replace(/\"/g,'`') + '</textarea></details>' + legend + '</div>';
thatplace=plottz[ipl];
utzdate=new Date();
tzDate = new Date(utzdate.toLocaleString('en-US', { timeZone: thatplace.replace('GMT','UTC').replace(/\ /g,'_') }));
xdiff = Math.abs(tzDate.getTime() - gutcDate.getTime()) / 3600000;
xdate1=new Date().toLocaleString("en-US", { timeZone: thatplace.replace('GMT','UTC').replace(/\ /g,'_') });
if (xdiff > 0 && (eval('' + utzdate.getDay()) == 0 && eval('' + tzDate.getDay()) == 6 || eval('' + utzdate.getDay()) > eval('' + tzDate.getDay()))) {
xdiff=-xdiff;
}
xextraemj=',' + clockit('' + xdiff);
plotct[ipl]=('' + xdate1);
plotemj[ipl]=(clockit('' + xdiff));
}
if (plotemj[ipl].indexOf('pm') != -1) {
aclock=plotemj[ipl].split('pm')[0];
nonclock=plotemj[ipl].split(aclock)[1];
thisclock='<span class=pm>' + aclock + '</span>';
return plotplace[ipl] + ' ' + orflag(plotcc[ipl]) + detbegin + '<br>' + plotct[ipl] + '<br>' + thisclock + nonclock + nearend + detend;
}
return plotplace[ipl] + ' ' + orflag(plotcc[ipl]) + detbegin + '<br>' + plotct[ipl] + '<br>' + plotemj[ipl] + nearend + detend;
}
return plotplace[ipl];
}
function great_circle_bearing(talis, gnolis, latis, longis) {
// Let ‘R’ be the radius of Earth,
// ‘L’ be the longitude,
// ‘θ’ be latitude,
// ‘β‘ be Bearing.
// Bearing from point A to B, can be calculated as,
// β = atan2(X,Y),
// where, X and Y are two quantities and can be calculated as:
// X = cos θb * sin ∆L
// Y = cos θa * sin θb – sin θa * cos θb * cos ∆L
var ourbrg=eval(eval(360.0 + eval(eval(eval(180.0 / Math.PI) * Math.atan2(
eval(eval('' + Math.cos(eval(Math.PI / 180.0) * eval('' + latis))) *
eval('' + Math.sin(eval(Math.PI / 180.0) * eval(eval('' + longis) - eval('' + gnolis))))),
eval(eval('' + Math.cos(eval(Math.PI / 180.0) * eval('' + talis))) *
eval('' + Math.sin(eval(Math.PI / 180.0) * eval('' + latis)))) -
eval(eval('' + Math.sin(eval(Math.PI / 180.0) * eval('' + talis))) *
eval('' + Math.cos(eval(Math.PI / 180.0) * eval('' + latis))) *
eval('' + Math.cos(eval(Math.PI / 180.0) * eval(eval('' + longis) - eval('' + gnolis)))))
)))) % 360.0);
return '' + ourbrg;
}
function great_circle_distance(talis, gnolis, latis, longis) {
var ourdist=0.0;
var rgnol=eval((gnolis) * Math.PI / 180.0);
var rtal=eval((talis) * Math.PI / 180.0);
var rlong=eval((longis) * Math.PI / 180.0);
var rlat=eval((latis) * Math.PI / 180.0);
var deltalong = Math.abs(eval(((gnolis)-(longis)) * Math.PI / 180.0));
var acof = eval(Math.sin(rtal) * Math.sin(rlat)) + (Math.cos(rtal) * Math.cos(rlat) * Math.cos(deltalong)); // via //en.wikipedia.org/wiki/Great-circle_distance ... thanks
ourdist = eval(Math.round((Math.acos(acof) * 6371000.0) + 0.00001) * 100) / 100;
return '' + ourdist;
}
function plotleg(thisleg, smlong, lglat, lglong, smlat) {
var brgtoset=0.0, disttoset=0.0, gbrgtoset=0.0, gdisttoset=0.0, legi=-1, plusbit='', clabit='', isok=true;
legi=legs.indexOf(thisleg);
var ij=eval('' + plotplace.length);
if (('' + thisleg).indexOf('.') != -1) {
if (ij <= eval('' + ('' + thisleg).split('.')[0])) { if (legi >= 0) { kleg=eval(1 + legi); } isok=false; }
if (ij <= eval('' + ('' + thisleg).split('.')[1])) { if (legi >= 0) { kleg=eval(1 + legi); } isok=false; }
}
if (isok && ('' + thisleg).indexOf('.') != -1 && pleasenolist.indexOf('|' + plotplace[eval('' + (thisleg + '.0').replace(/^\./g,'0.').split('.')[0])].split(', ')[0].split(',_')[0] + '|') == -1 && pleasenolist.indexOf('|' + eval('' + (thisleg + '.0').replace(/^\./g,'0.').split('.')[0]) + '|') == -1) {
if (legi >= 0) {
plusbit=String.fromCharCode(10) + legsanno[legi].replace(/\"/g, '`');
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
plusbit+=String.fromCharCode(10);
}
}
console.log('thisleg=' + thisleg + ' and plotplace.length=' + plotplace.length);
if (1 == 1) {
disttoset=Math.sqrt((eval(0 + eval(eval('' + plotlong[eval(thisleg.split('.')[0])]) - smlong) / eval(lglong - smlong) * eval(screenwidth)) - eval(0 + eval(eval('' + plotlong[eval(thisleg.split('.')[1])]) - smlong) / eval(lglong - smlong) * eval(screenwidth))) * (eval(0 + eval(eval('' + plotlong[eval(thisleg.split('.')[0])]) - smlong) / eval(lglong - smlong) * eval(screenwidth)) - eval(0 + eval(eval('' + plotlong[eval(thisleg.split('.')[1])]) - smlong) / eval(lglong - smlong) * eval(screenwidth))) + (eval(0 + eval(eval(lglat - eval('' + plotlat[eval(thisleg.split('.')[0])])) / eval(lglat - smlat) * eval(screenheight))) - eval(0 + eval(eval(lglat - eval('' + plotlat[eval(thisleg.split('.')[1])])) / eval(lglat - smlat) * eval(screenheight)))) * (eval(0 + eval(eval(lglat - eval('' + plotlat[eval(thisleg.split('.')[0])])) / eval(lglat - smlat) * eval(screenheight))) - eval(0 + eval(eval(lglat - eval('' + plotlat[eval(thisleg.split('.')[1])])) / eval(lglat - smlat) * eval(screenheight)))));
}
gdisttoset=great_circle_distance(plotlat[eval(thisleg.split('.')[0])], plotlong[eval(thisleg.split('.')[0])], plotlat[eval(thisleg.split('.')[1])], plotlong[eval(thisleg.split('.')[1])]);
var meanlong=eval(0 + eval(eval('' + plotlong[eval(thisleg.split('.')[0])]) - smlong) / eval(lglong - smlong) * eval(screenwidth));
var meanlat=eval(0 + eval(eval(lglat - eval('' + plotlat[eval(thisleg.split('.')[0])])) / eval(lglat - smlat) * eval(screenheight)));
gbrgtoset=great_circle_bearing(plotlat[eval(thisleg.split('.')[0])], plotlong[eval(thisleg.split('.')[0])], plotlat[eval(thisleg.split('.')[1])], plotlong[eval(thisleg.split('.')[1])]);
brgtoset=Math.atan2(eval(0 + eval(eval(lglat - eval('' + plotlat[eval(thisleg.split('.')[1])])) / eval(lglat - smlat) * eval(screenheight))) - meanlat, eval(0 + eval(eval('' + plotlong[eval(thisleg.split('.')[1])]) - smlong) / eval(lglong - smlong) * eval(screenwidth)) - meanlong) * 180 / Math.PI;
if (brgtoset <= 180.0) { clabit=' class=hrright '; } else { clabit=' class=hrleft '; }
meanlong+=eval(0 + eval(eval('' + plotlong[eval(thisleg.split('.')[1])]) - smlong) / eval(lglong - smlong) * eval(screenwidth))
meanlong/=2.0;
meanlat+=eval(0 + eval(eval(lglat - eval('' + plotlat[eval(thisleg.split('.')[1])])) / eval(lglat - smlat) * eval(screenheight)));
meanlat/=2.0;
console.log(thisleg + ' ' + brgtoset + ' ' + thisleg + ' ... ' + plotlat[eval(thisleg.split('.')[0])] + ',' + plotlong[eval(thisleg.split('.')[0])] + ' to ' + plotlat[eval(thisleg.split('.')[1])] + ',' + plotlong[eval(thisleg.split('.')[1])]);
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
if (plusbit == '') {
//alert(298);
bmeridian+='<hr' + clabit + ' onclick="event.stopPropagation(); canlooknow=false; clearwo(); wo=window.open(' + "'//www.google.com/maps/dir/" + encodeURIComponent(plotplace[eval(thisleg.split('.')[0])]) + '/' + encodeURIComponent(plotplace[eval(thisleg.split('.')[1])]) + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; alert(this.title); " ondblclick="event.stopPropagation(); canlooknow=false; clearwo(); wo=window.open(' + "'//www.google.com/maps/dir/" + plotlat[eval(thisleg.split('.')[0])] + ',' + plotlong[eval(thisleg.split('.')[0])] + '/' + plotlat[eval(thisleg.split('.')[1])] + ',' + plotlong[eval(thisleg.split('.')[1])] + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; alert(this.title); " title="' + plusbit + '' + plotplace[eval(thisleg.split('.')[0])] + ' to ' + plotplace[eval(thisleg.split('.')[1])] + ' has the crow flying (' + gbrgtoset + ' degrees setting off at versus on Mercator Projection ...) ' + eval(eval(brgtoset + 450) % 360) + ' degrees for ' + eval(gdisttoset / 1000.0) + ' kilometers. Click (for placename) or double click (for geographicals) to open a Google Directions window." data-class=leg style="transform:rotate(' + eval(eval('' + brgtoset) - 0) + 'deg);z-index:975;opacity:0.3;position:' + posval + ';top:' +
meanlat +
'px;left:' +
eval(meanlong - disttoset / 2) +
'px;background-color:rgba(255,0,0,0.5);width:' + disttoset + 'px;height:6px;"></hr><span onclick="event.stopPropagation(); canlooknow=false; clearwo(); wo=window.open(' + "'//www.google.com/maps/dir/" + encodeURIComponent(plotplace[eval(thisleg.split('.')[0])]) + '/' + encodeURIComponent(plotplace[eval(thisleg.split('.')[1])]) + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; " ondblclick="event.stopPropagation(); canlooknow=false; clearwo(); gleg=glegit(this); wo=windowopen(' + "'//www.google.com/maps/dir/" + plotlat[eval(thisleg.split('.')[0])] + ',' + plotlong[eval(thisleg.split('.')[0])] + '/' + plotlat[eval(thisleg.split('.')[1])] + ',' + plotlong[eval(thisleg.split('.')[1])] + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; " title="' + plusbit + '' + plotplace[eval(thisleg.split('.')[0])] + ' to ' + plotplace[eval(thisleg.split('.')[1])] + ' has the crow flying (' + gbrgtoset + ' degrees setting off at versus on Mercator Projection ...) ' + eval(eval(360 - brgtoset) % 360) + ' degrees for ' + eval(gdisttoset / 1000.0) + ' kilometers. Click (for placename) or double click (for geographicals) to open a Google Directions window. ' + '" data-class=leg style="cursor:pointer;font-size:6px;z-index:976;margin-top:6px;margin-left:-6px;position:' + posval + ';top:' + meanlat + 'px;left:' + meanlong + 'px;" data-oncontextmenu="event.stopPropagation(); woit(' + "'" + plotplace[eval(thisleg.split('.')[1])].split(', ')[0] + "'" + ');" data-tleg="' + thisleg + '">' + thecompass + '</span>';
} else {
//alert('98 ' + plusbit);
bmeridian+='<hr' + clabit + ' onclick="event.stopPropagation(); canlooknow=false; clearwo(); wo=window.open(' + "'//www.google.com/maps/dir/" + encodeURIComponent(plotplace[eval(thisleg.split('.')[0])]) + '/' + encodeURIComponent(plotplace[eval(thisleg.split('.')[1])]) + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; ' + " legsalert(this.title + String.fromCharCode(10) + this.getAttribute('data-titlemore'), this.getAttribute('data-anno')" + '); " ondblclick="event.stopPropagation(); canlooknow=false; clearwo(); wo=window.open(' + "'//www.google.com/maps/dir/" + plotlat[eval(thisleg.split('.')[0])] + ',' + plotlong[eval(thisleg.split('.')[0])] + '/' + plotlat[eval(thisleg.split('.')[1])] + ',' + plotlong[eval(thisleg.split('.')[1])] + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; " data-anno="' + legsanno[legi].replace(/\"/g, '`') + '" title="' + plusbit + '" data-titlemore="' + plotplace[eval(thisleg.split('.')[0])] + ' to ' + plotplace[eval(thisleg.split('.')[1])] + ' has the crow flying (' + gbrgtoset + ' degrees setting off at versus on Mercator Projection ...) ' + eval(eval(brgtoset + 450) % 360) + ' degrees for ' + eval(gdisttoset / 1000.0) + ' kilometers. Click (for placename) or double click (for geographicals) to open a Google Directions window." data-class=leg style="transform:rotate(' + eval(eval('' + brgtoset) - 0) + 'deg);z-index:975;opacity:0.3;position:' + posval + ';top:' +
meanlat +
'px;left:' +
eval(meanlong - disttoset / 2) +
'px;background-color:rgba(255,0,0,0.5);width:' + disttoset + 'px;height:6px;"></hr><span onclick="event.stopPropagation(); canlooknow=false; clearwo(); wo=window.open(' + "'//www.google.com/maps/dir/" + encodeURIComponent(plotplace[eval(thisleg.split('.')[0])]) + '/' + encodeURIComponent(plotplace[eval(thisleg.split('.')[1])]) + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; " ondblclick="event.stopPropagation(); canlooknow=false; clearwo(); gleg=glegit(this); wo=windowopen(' + "'//www.google.com/maps/dir/" + plotlat[eval(thisleg.split('.')[0])] + ',' + plotlong[eval(thisleg.split('.')[0])] + '/' + plotlat[eval(thisleg.split('.')[1])] + ',' + plotlong[eval(thisleg.split('.')[1])] + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; " title="' + plusbit + '' + plotplace[eval(thisleg.split('.')[0])] + ' to ' + plotplace[eval(thisleg.split('.')[1])] + ' has the crow flying (' + gbrgtoset + ' degrees setting off at versus on Mercator Projection ...) ' + eval(eval(360 - brgtoset) % 360) + ' degrees for ' + eval(gdisttoset / 1000.0) + ' kilometers. Click (for placename) or double click (for geographicals) to open a Google Directions window. ' + '" data-class=leg style="cursor:pointer;font-size:6px;z-index:976;margin-top:6px;margin-left:-6px;position:' + posval + ';top:' + meanlat + 'px;left:' + meanlong + 'px;" data-oncontextmenu="event.stopPropagation(); woit(' + "'" + plotplace[eval(thisleg.split('.')[1])].split(', ')[0] + "'" + ');" data-tleg="' + thisleg + '">' + thecompass + '</span>';
}
} else {
bmeridian+='<hr' + clabit + ' onclick="event.stopPropagation(); canlooknow=false; clearwo(); wo=window.open(' + "'//www.google.com/maps/dir/" + encodeURIComponent(plotplace[eval(thisleg.split('.')[0])]) + '/' + encodeURIComponent(plotplace[eval(thisleg.split('.')[1])]) + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; ' + " legsalert(this.title + String.fromCharCode(10) + this.getAttribute('data-titlemore'), this.getAttribute('data-anno')" + '); " ondblclick="event.stopPropagation(); canlooknow=false; clearwo(); wo=window.open(' + "'//www.google.com/maps/dir/" + plotlat[eval(thisleg.split('.')[0])] + ',' + plotlong[eval(thisleg.split('.')[0])] + '/' + plotlat[eval(thisleg.split('.')[1])] + ',' + plotlong[eval(thisleg.split('.')[1])] + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; " data-anno="' + legsanno[legi].replace(/\"/g, '`') + '" title="' + plotplace[eval(thisleg.split('.')[0])] + ' to ' + plotplace[eval(thisleg.split('.')[1])] + ' has the crow flying (' + gbrgtoset + ' degrees setting off at versus on Mercator Projection ...) ' + eval(eval(brgtoset + 450) % 360) + ' degrees for ' + eval(gdisttoset / 1000.0) + ' kilometers. Click (for placename) or double click (for geographicals) to open a Google Directions window. ' + plusbit + '" data-titlemore="' + plotplace[eval(thisleg.split('.')[0])] + ' to ' + plotplace[eval(thisleg.split('.')[1])] + ' has the crow flying (' + gbrgtoset + ' degrees setting off at versus on Mercator Projection ...) ' + eval(eval(brgtoset + 450) % 360) + ' degrees for ' + eval(gdisttoset / 1000.0) + ' kilometers. Click (for placename) or double click (for geographicals) to open a Google Directions window." data-class=leg style="transform:rotate(' + eval(eval('' + brgtoset) - 0) + 'deg);z-index:975;opacity:0.3;position:' + posval + ';top:' +
meanlat +
'px;left:' +
eval(meanlong - disttoset / 2) +
'px;background-color:rgba(255,0,0,0.5);width:' + disttoset + 'px;height:6px;"></hr><span onclick="event.stopPropagation(); canlooknow=false; clearwo(); wo=window.open(' + "'//www.google.com/maps/dir/" + encodeURIComponent(plotplace[eval(thisleg.split('.')[0])]) + '/' + encodeURIComponent(plotplace[eval(thisleg.split('.')[1])]) + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; " ondblclick="event.stopPropagation(); canlooknow=false; clearwo(); gleg=glegit(this); wo=windowopen(' + "'//www.google.com/maps/dir/" + plotlat[eval(thisleg.split('.')[0])] + ',' + plotlong[eval(thisleg.split('.')[0])] + '/' + plotlat[eval(thisleg.split('.')[1])] + ',' + plotlong[eval(thisleg.split('.')[1])] + "#In a minute we will start moving the map again','_blank','top=50,left=50,width=1000,height=900')" + '; canlooknow=true; " title="' + plotplace[eval(thisleg.split('.')[0])] + ' to ' + plotplace[eval(thisleg.split('.')[1])] + ' has the crow flying (' + gbrgtoset + ' degrees setting off at versus on Mercator Projection ...) ' + eval(eval(360 - brgtoset) % 360) + ' degrees for ' + eval(gdisttoset / 1000.0) + ' kilometers. Click (for placename) or double click (for geographicals) to open a Google Directions window. ' + plusbit + '" class=leg style="cursor:pointer;font-size:6px;z-index:976;margin-top:6px;margin-left:-6px;position:' + posval + ';top:' + meanlat + 'px;left:' + meanlong + 'px;" data-oncontextmenu="event.stopPropagation(); woit(' + "'" + plotplace[eval(thisleg.split('.')[1])].split(', ')[0] + "'" + ');" data-tleg="' + thisleg + '">' + thecompass + '</span>';
}
if (ofive == fivethousand) {
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
fivethousand*=2;
} else {
fivethousand*=10;
}
setTimeout(callintoplay, 5000);
}
}
}
function clearwo() {
if (wo) {
if (wo.closed) {
wo=null;
} else {
wo.close();
wo=null;
}
}
if (wo == null) {
setTimeout(moback, 16000);
}
}
function moback() {
woclosed=true;
if (wo != null) {
if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
movesallowed=false;
gmovesallowed=false;
five=0;
gfive=0;
}
woclosed=wo.closed;
console.log('ma