<html>
<head>
<title>Dots and Boxes Game - RJM Programming - August, 2022</title>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=0.1, maximum-scale=8, user-scalable=yes" >
<style>
.custom-alert {
display: inline-block;
/* visibility: visible; */
background-color: rgba(102,102,102,0.8);
color: #fff;
text-align: enter;
margin: 5% auto;
padding: 12px 28px;
opacity: 0.9;
z-index: 200;
}
/* Thanks to https://medium.com/thirty-9/3-tips-for-using-subtle-css-gradients-f5691e453602 */
body {
background-image: linear-gradient(to right bottom, #ffffff, #fcfafc, #f9f6f8, #f8f1f3, #f6ecec);
}
#names {
background-image: linear-gradient(to right bottom, #eeeeee, #ebe9eb, #e8e5e7, #e7e0e2, #e5dbdb);
}
select {
background-image: linear-gradient(to right bottom, white, yellow, pink, silver, lightgray);
}
/* Thanks to https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_glowing_text */
@-webkit-keyframes glow {
from {
box-shadow: 0 0 3px #fff, 0 0 5px #fff, 0 0 37px #e60073, 0 0 9px #e60073, 0 0 11px #e60073, 0 0 13px #e60073, 0 0 15px #e60073;
}
to {
box-shadow: 0 0 24px #fff, 0 0 6px #ff4da6, 0 0 8px #ff4da6, 0 0 10px #ff4da6, 0 0 12px #ff4da6, 0 0 14px #ff4da6, 0 0 16px #ff4da6;
}
}
@-webkit-keyframes wglow {
from {
box-shadow: 0 0 3px #fff, 0 0 5px #fff, 0 0 37px #7300e6, 0 0 9px #7300e6, 0 0 11px #7300e6, 0 0 13px #7300e6, 0 0 15px #7300e6;
}
to {
box-shadow: 0 0 24px #fff, 0 0 6px #ff4da6, 0 0 8px #a64dff, 0 0 10px #a64dff, 0 0 12px #a64dff, 0 0 14px #a64dff, 0 0 16px #a64dff;
}
}
textarea {
font-family: Courier New;
font-size: 20px;
opacity: 0.9;
z-index: 9;
color: transparent;
visibility: hidden;
padding: 0 0 0 0;
margin: 0 0 0 0;
/* text-shadow: -1px 1px 1px #952dff; */
-webkit-animation: glow 1s linear infinite alternate;
-moz-animation: glow 1s linear infinite alternate;
animation: glow 1s linear infinite alternate;
}
#wunderlay {
font-family: Courier New;
font-size: 20px;
opacity: 0.3;
z-index: 11;
padding: 0 0 0 0;
margin: 0 0 0 0;
-webkit-animation: glow 1s linear infinite alternate;
-moz-animation: glow 1s linear infinite alternate;
animation: glow 1s linear infinite alternate;
}
#underlay {
font-family: Courier New;
font-size: 20px;
opacity: 0.3;
z-index: 1;
padding: 0 0 0 0;
margin: 0 0 0 0;
color: transparent;
}
div.underlay {
font-family: Courier New;
font-size: 20px;
opacity: 0.3;
z-index: 2;
padding: 0 0 0 0;
margin: 0 0 0 0;
color: transparent;
}
span {
padding: 0 0 0 0;
margin: 0 0 0 0;
}
span.eventmode {
font-family: Courier New;
}
span.wunderlay {
font-family: Courier New;
font-size: 16px;
background-color: #f0f0f0;
cursor: pointer;
color: transparent;
border: 2px dashed rgba(0,0,0,0.5);
}
span.wunderlay:hover {
background: linear-gradient(45deg, #fff722, #ff26f9),linear-gradient(142deg, transparent, white),linear-gradient(108deg, red, transparent);
}
</style>
</head>
<body data-onclick='bc(event);' title='' onload="sdodit(); setTimeout(mytaow, 2000); if (('' + navigator.platform.toUpperCase()).indexOf('MAC') >= 0) { document.getElementById('names').title+=' Append with spaces to try using MAMP HTTP://localhost:8888/macos_say_record.php supervision of macOS say text to audio commentary.'; }">
<h1>Dots and Boxes <select style='display:none;' id=cmode onchange="cmodeit(this);"><option value="" id=cmodeopt></option><option value=click>Click</option><option value=selection>Selection</option></select> Game <select style='display:none;' onchange="restart(this);" id=sdod><option id=sdodd value="hard">Hard</option><option style="display:none;" value="easy">Easy</option><option value="easier">Easier</option><option value="easiest">Easiest</option><option value="hard">Hard</option></select> <span id=curbit>for</span> <select id=numsel onchange='nparrange(this);'><option id=optone value=1>1 player</option><option value=2>2 players</option><option value=3>3 players</option><option value=4>4 players</option><option value=5>5 players</option></select> <br> <span id=smore><input type=text onblur="nameslist=this.value.replace(/\~/g,' '); anames[0]=nameslist.split(',')[0].trim(); var qwe=testtwo('Your go ' + anames[curplayer], this.title.replace('Comma separate as required.',''), this.value); document.getElementById('smore').innerHTML=qwe;" id=names placeholder='Name(s)' value='' title='Comma separate as required.'></input></span></h1>
<h3>RJM Programming - August, 2022 ... Score <span id=score>0/0</span> ... <span id=blurb>Try<span class=eventmode id=seventmode> click </span>below near a square border to infill a border line and eventually complete a square</span></h3>
<h4 id=myh4>Thanks to <a target=_blank title='https://www.wikihow.com/Play-Dots-and-Boxes' href='//www.wikihow.com/Play-Dots-and-Boxes'>How to Play - Dots and Boxes</a></h4>
<!--table border=10 cellpadding=5>
<tr><th colspan=3>Clipboard ...</tr>
<tr><td><button onclick="pasteinto('after');">Append Below ...</button></td><td><button onclick="pasteinto('before');">Prepend Below ...</button><td><button onclick="pasteinto('cursor');">At Cursor ...</button></td></tr>
</table><br><br-->
<script type='text/javascript'>
var xx=0, yy=0;
var brbr='';
var sbs=[];
var changeu=false;
var bcols=['#0000ff','#00ff00','#ff0000','#ffff00','#ff00ff','#00ffff','#777777','#000077','#007700','#770000','#777700','#770077','#007777'];
var numplayers=1;
var curplayer=0;
var ascores=[0], agoes=[0], anames=['Player 1'], fnames=['<font color="' + bcols[0] + '">Player 1</font>'];
var backwardsallowed=(location.search.split('?easiest')[1] ? false : true);
var updownallowed=(location.search.split('?easi')[1] ? false : true);
var diagonalsallowed=(location.search.split('?easier')[1] ? false : backwardsallowed);
var findingnemo='';
var nameslist='';
var zdebye='';
var zzdebye='';
var sparecurplayer=0;
var lastzdebye='';
var goutstris='';
var delayis=0;
var sofar=';';
var caretPos=0;
var setsoftwo=[];
var score=0, goes=0, subscore=0;
var letters=['s','o','s','o','s','o','s','o','s','o','s','o','s','o','s','o','s','o','s','o','s','o','s','o','s','o'];
var ebye='', ibye=0, jbye=0, debye='', aletter=' ';
var wdebye='';
var zwdebye='';
var zzwdebye='';
var documentURL=document.URL + '#clicks=y';
var gsetn=[8,1,1,3,11,1,2,1,8,0,0,3,1,5,7,1,0,5,3,5,3,1,1,0,1,0];
if (documentURL.replace('?','&').indexOf('&eas') != -1 && eval('' + letters.length) == 26) {
// A-9, B-2, C-2, D-4, E-12, F-2, G-3, H-2, I-9, J-1, K-1, L-4, M-2, N-6, O-8, P-2, Q-1, R-6, S-4, T-6, U-4, V-2, W-2, X-1, Y-2, Z-1
var gkbye=eval('' + letters.length);
for (var gibye=0; gibye<gkbye; gibye++) {
for (var gjbye=1; gjbye<=gsetn[gibye]; gjbye++) {
letters.push(letters[gibye]);
}
}
}
var ijcnt=0;
for (ibye=0; ibye<20; ibye++) {
for (jbye=0; jbye<100; jbye++) {
aletter=letters[Math.floor(Math.random() * letters.length)];
ebye+=aletter;
debye+=aletter;
wdebye+='<span class=wunderlay placeholder="so" onmouseover="sback(this);" onclick="didclick(event,this);" title="" id=span' + ijcnt + ' data-idea=' + aletter + '> </span>';
ijcnt++;
}
ebye+=String.fromCharCode(10);
debye+='<br>';
wdebye+='<br>';
}
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPod|Opera Mini|IEMobile/i)) {
brbr='<br><br>';
}
document.write(brbr + "<table><tr><td><textarea id=mytao class=editor rows=20 cols=100>" + ebye + "</textarea></td></TR><TR><td id=emailsms style=display:none;vertical-align:top;> <a target=_blank href='mailto:?subject=My%20Selection%20...&body=' id=aemail title=Email>📧</a> <a target=_blank onmouseover=\"if (smsee.length == 0 && origsmsurl.indexOf('sms:&') != -1) { smsee=prompt('Please enter SMS number to send to.', ''); if (smsee == null) { smsee=''; } else { origsmsurl=origsmsurl.replace('sms:&','sms:' + smsee + '&'); asmsurl=asmsurl.replace('sms:&','sms:' + smsee + '&'); this.href=asmsurl; } }\" ontouchstart=\"if (smsee.length == 0 && origsmsurl.indexOf('sms:&') != -1) { smsee=prompt('Please enter SMS number to send to.', ''); if (smsee == null) { smsee=''; } else { origsmsurl=origsmsurl.replace('sms:&','sms:' + smsee + '&'); asmsurl=asmsurl.replace('sms:&','sms:' + smsee + '&'); this.href=asmsurl; } }\" href='sms:&body=My%20Selection%20...' id=asms title=SMS>📟</a></td></tr></table>");
var origemailurl='mailto:?subject=My%20Selection%20...&body=';
var origsmsurl='sms:&body=My%20Selection%20...';
var smsee='';
var aemailurl=origemailurl;
var asmsurl=origsmsurl;
var sofar = '';
var sofarbefore='', sofarafter='';
var mltrans='';
var trysay=false;
var lastwhat='';
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
if ((location.search.split('selection=')[1] ? decodeURIComponent(location.search.split('selection=')[1].split('&')[0]) : '') == '') {
documentURL+='#clicks=y';
}
}
function sb(inho) {
sbs.push(inho);
return inho;
}
function sbord() {
if (sbs.length > 0) {
for (var isbs=0; isbs<sbs.length; isbs++) {
sbs[isbs].style.outline='2px solid ' + bcols[curplayer];
sbs[isbs].background=''; //'url("data:image/svg+xml;utf8,<svg xmlns=' + "'" + 'http://www.w3.org/2000/svg' + "'" + ' width=' + "'" + '96' + "'" + ' height=' + "'" + '48' + "'" + ' viewport=' + "'" + '0 0 100 100' + "'" + '><text y=' + "'" + '0%' + "'" + '>S</text><text y=' + "'" + '50%' + "'" + '>O</text></svg>") no-repeat coontain';
sbs[isbs].cursor='pointer'; //'url("data:image/svg+xml;utf8,<svg xmlns=' + "'" + 'http://www.w3.org/2000/svg' + "'" + ' width=' + "'" + '96' + "'" + ' height=' + "'" + '48' + "'" + ' viewport=' + "'" + '0 0 100 100' + "'" + '><text y=' + "'" + '0%' + "'" + '>S</text><text y=' + "'" + '50%' + "'" + '>O</text></svg>") 16 0, progress';
}
}
sbs=[];
}
function showIt(what) {
var ris=null;
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
if (document.getElementById('custom-alert-1')) {
document.getElementById('custom-alert-1').innerHTML=what;
document.getElementById('custom-alert-1').style.opacity='0.95';
document.getElementById('custom-alert-1').style.display='inline-block'; // inline
//document.getElementById('custom-alert-1').style.visibility='visible';
document.getElementById('custom-alert-1').scrollIntoView();
} else if (what == '') {
ris=document.getElementById('underlay').getBoundingClientRect();
//alert(eval(eval(ris.left + ris.right) / 2));
document.body.innerHTML+="<div id='custom-alert-1' class='custom-alert' style='position:fixed; left: 50%; transform: translate(-50%, -50%); top:50%; display: none;'>" + what + "</div>";
} else {
ris=document.getElementById('underlay').getBoundingClientRect();
document.body.innerHTML+="<div id='custom-alert-1' class='custom-alert' style='position:fixed; left: 50%; transform: translate(-50%, -50%); top:50%; display: inline-block;'>" + what + "</div>";
}
setTimeout(hideIt, 10000);
}
}
function hideIt() {
document.getElementById('custom-alert-1').style.display='none';
//document.getElementById('custom-alert-1').style.visibility='hidden';
}
function cmodeit(sio) {
if (sio.value == 'selection') {
if (nameslist != '') {
location.href=document.URL.split('?')[0].split('#')[0] + '?' + document.getElementById('sdod').value + '=y&selection=y#nameslist=' + decodeURIComponent(nameslist);
} else {
location.href=document.URL.split('?')[0].split('#')[0] + '?' + document.getElementById('sdod').value + '=y&selection=y';
}
} else if (sio.value == 'click') {
documentURL+='#clicks=y';
lonl();
}
}
function lonl() {
document.getElementById('wunderlay').innerHTML=wdebye;
if (documentURL.indexOf('clicks=') != -1) {
document.getElementById('cmodeopt').innerHTML='Click';
//document.getElementById('wunderlay').innerHTML=wdebye;
document.getElementById('wunderlay').style.display='block';
document.getElementById('wunderlay').style.opacity='1.0';
document.getElementById('underlay').style.display='none';
document.getElementById('seventmode').innerHTML=document.getElementById('seventmode').innerHTML.replace(' highlight ', ' click ');
document.getElementById('styleothers').innerHTML='<style> ' + document.head.innerHTML.split('<style>')[1].split('</style>')[0].replace(/Courier\ New/g,'Courier').replace(/ glow\ 1s/g,' wglow 1s').replace(/black/g,'transparent').replace('#f0fJUNK0f0;', '#f0f0f0; text-shadow: -1px 1px 1px #952dff; ') + ' </style>';
} else {
document.getElementById('cmodeopt').innerHTML='Selection';
}
showIt('');
}
function sdodit() {
if (!backwardsallowed) {
//document.getElementById('sdodd').value='easiest';
//document.getElementById('sdodd').innerHTML='Easiest';
document.getElementById('sdod').value='easiest';
} else if (!updownallowed && !diagonalsallowed) {
document.getElementById('sdod').value='easier';
} else if (eval('' + letters.length) > 26) {
document.getElementById('sdod').value='easy';
}
var myblurb=document.getElementById('blurb').innerHTML; // Forwards, backwards, up, down, diagonal 4 letters or more highlight below
var sio=document.getElementById('sdod');
if (sio.value == 'easiest') {
myblurb=myblurb.replace(' letters', ' more common set of letters');
myblurb=myblurb.replace(', diagonally', '');
myblurb=myblurb.replace(', up, down', '');
myblurb=myblurb.replace(', backwards', '');
}
if (sio.value == 'easier') {
myblurb=myblurb.replace(' letters', ' more common set of letters');
myblurb=myblurb.replace(', diagonally', '');
myblurb=myblurb.replace(', up, down', '');
myblurb=myblurb.replace('Forwards 3', 'Forwards, backwards 3');
}
if (sio.value == 'easy') {
myblurb=myblurb.replace(' letters', ' more common set of letters');
myblurb=myblurb.replace('Forwards 3', 'Forwards, backwards, up, down, diagonal 3');
myblurb=myblurb.replace('Forwards, backwards 3', 'Forwards, backwards, up, down, diagonal 3');
}
document.getElementById('blurb').innerHTML=myblurb;
if (('' + location.hash).indexOf('nameslist=') != -1) {
document.getElementById('smore').value=decodeURIComponent(('' + location.hash).split('nameslist=')[1].split('#')[0]);
nameslist=document.getElementById('smore').value.replace(/\~/g,' ');
anames[0]=nameslist.split(',')[0].trim();
fnames[0]='<font color="' + bcols[0] + '">' + nameslist.split(',')[0].trim() + '</font>';
var qwe=testtwo('Your go ' + anames[curplayer], document.getElementById('smore').title.replace('Comma separate as required.',''), document.getElementById('smore').value);
document.getElementById('smore').innerHTML=qwe;
} else {
document.getElementById('names').placeholder='Player1,Player2';
anames[0]='Player1';
fnames[0]='<font color="' + bcols[0] + '">Player1</font>';
anames.push('Player2');
fnames.push('<font color="' + bcols[1] + '">Player2</font>');
ascores.push(0);
agoes.push(0);
nameslist='Player1,Player2';
document.getElementById('numsel').value='2';
}
}
function bc(e) {
e = e || window.event;
e.preventDefault();
if (e.touches) {
if (e.touches[0].pageX) {
xx = e.touches[0].pageX;
yy = e.touches[0].pageY;
} else {
xx = e.touches[0].clientX;
yy = e.touches[0].clientY;
}
//console.log('pos3=' + pos3 + ',pos4=' + pos4);
} else if (e.clientX || e.clientY) {
xx = e.clientX;
yy = e.clientY;
} else {
xx = e.pageX;
yy = e.pageY;
}
}
function noc(inzx) {
var ihow=0;
var outzx=inzx;
var howevermany=eval('' + outzx.split('border-top').length);
if (howevermany > 2) {
for (ihow=2; ihow<howevermany; ihow++) {
outzx=outzx.replace('border-top', 'bordJUNKer-top');
}
}
howevermany=eval('' + outzx.split('border-bottom').length);
if (howevermany > 2) {
for (ihow=2; ihow<howevermany; ihow++) {
outzx=outzx.replace('border-bottom', 'bordJUNKer-bottom');
}
}
howevermany=eval('' + outzx.split('border-left').length);
if (howevermany > 2) {
for (ihow=2; ihow<howevermany; ihow++) {
outzx=outzx.replace('border-left', 'bordJUNKer-left');
}
}
howevermany=eval('' + outzx.split('border-right').length);
if (howevermany > 2) {
for (ihow=2; ihow<howevermany; ihow++) {
outzx=outzx.replace('border-right', 'bordJUNKer-right');
}
}
//if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
// alert('sbl=' + outzx.split('border-').length + ' ' + outzx);
//}
return outzx;
}
function didclick(e, spano) {
if (document.getElementById('names')) {
if (document.getElementById('names').value == '' && document.getElementById('names').placeholder.indexOf(',') != -1) {
document.getElementById('names').value=document.getElementById('names').placeholder;
//alert(1);
document.getElementById('numsel').value='' + document.getElementById('names').value.split(',').length;
//alert(document.getElementById('numsel').value);
nparrange(document.getElementById('numsel'));
//alert(11);
document.getElementById('smore').innerHTML=notify('Your go ' + anames[curplayer]);
}
}
console.log('1');
if (spano.innerHTML.toLowerCase() == 's' || spano.innerHTML.toLowerCase() == 'o') { return true; }
console.log('2');
var rtis=spano.getBoundingClientRect();
console.log('3');
e = e || window.event;
e.preventDefault();
if (e.touches) {
if (e.touches[0].pageX) {
xx = e.touches[0].pageX;
yy = e.touches[0].pageY;
} else {
xx = e.touches[0].clientX;
yy = e.touches[0].clientY;
}
//console.log('pos3=' + pos3 + ',pos4=' + pos4);
} else if (e.clientX || e.clientY) {
xx = e.clientX;
yy = e.clientY;
} else {
xx = e.pageX;
yy = e.pageY;
}
var topm=eval(yy - rtis.top);
var bottomm=eval(rtis.bottom - yy);
var leftm=eval(xx - rtis.left);
var rightm=eval(rtis.right - xx);
var sbl=eval('' + noc(spano.outerHTML).split('border-').length);
var sbc=eval('' + spano.outerHTML.split('background-color').length);
var thislet=' ';
var locsubscore=0;
var thisi=eval(spano.id.replace('span',''));
if (Math.min(topm, bottomm,leftm,rightm) == leftm || Math.min(topm, bottomm,leftm,rightm) == rightm) { // s
if (Math.min(topm, bottomm,leftm,rightm) == leftm) { // s
thislet='border-left:2px solid ' + bcols[curplayer]; //alert(56);
spano.style.borderLeft=thislet.split(':')[1];
//document.getElementById('myh4').style.fontSize='6px';
//document.getElementById('myh4').innerHTML='thisi=' + thisi + ' border-left and ' + eval(-1 + thisi) + ' is border-right ' + spano.outerHTML.replace(/\>/g,'>').replace(/\</g,'<');
if ((sbl == 4 && noc(spano.outerHTML).split('border-').length >= 4) && sbc == 1) {
//if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
//alert('' + sbl + ' 1:' + noc(spano.outerHTML).split('border-').length + ' ' + spano.outerHTML);
//}
spano.style.backgroundColor=bcols[curplayer];
//alert(1);
locsubscore++;
} //else if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i) && sbl == 4 && sbc == 1) {
//alert('1:' + spano.outerHTML.split('border-').length + ' ' + spano.outerHTML);
//}
if (eval(thisi % 100) >= 1) {
sbl=eval('' + noc(document.getElementById('span' + eval(-1 + thisi)).outerHTML).split('border-').length);
sbc=eval('' + document.getElementById('span' + eval(-1 + thisi)).outerHTML.split('background-color').length);
document.getElementById('span' + eval(-1 + thisi)).style.borderRight=thislet.split(':')[1];
if ((sbl == 4 && noc(document.getElementById('span' + eval(-1 + thisi)).outerHTML).split('border-').length >= 4) && sbc == 1) { //if (document.getElementById('span' + eval(-1 + thisi)).outerHTML.split('border-').length == 5 && document.getElementById('span' + eval(-1 + thisi)).outerHTML.split('background-color').length == 1) {
document.getElementById('span' + eval(-1 + thisi)).style.backgroundColor=bcols[curplayer];
locsubscore++;
}
}
} else {
thislet='border-right:2px solid ' + bcols[curplayer]; //alert(56);
spano.style.borderRight=thislet.split(':')[1];
//document.getElementById('myh4').style.fontSize='6px';
//document.getElementById('myh4').innerHTML='thisi=' + thisi + ' border-right and ' + eval(1 + thisi) + ' is border-left ' + spano.outerHTML.replace(/\>/g,'>').replace(/\</g,'<');
if ((sbl == 4 && noc(spano.outerHTML).split('border-').length >= 4) && sbc == 1) {
spano.style.backgroundColor=bcols[curplayer];
//alert(2);
//if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
//alert('' + sbl + ' 2:' + noc(spano.outerHTML).split('border-').length + ' ' + spano.outerHTML);
//}
locsubscore++;
} //else if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i) && sbl == 4 && sbc == 1) {
//alert('2:' + spano.outerHTML.split('border-').length + ' ' + spano.outerHTML);
//}
if (eval(thisi % 100) <= 98) {
sbl=eval('' + noc(document.getElementById('span' + eval(1 + thisi)).outerHTML).split('border-').length);
sbc=eval('' + document.getElementById('span' + eval(1 + thisi)).outerHTML.split('background-color').length);
document.getElementById('span' + eval(1 + thisi)).style.borderLeft=thislet.split(':')[1];
if ((sbl == 4 && noc(document.getElementById('span' + eval(1 + thisi)).outerHTML).split('border-').length >= 4) && sbc == 1) { //if (document.getElementById('span' + eval(1 + thisi)).outerHTML.split('border-').length == 5 && document.getElementById('span' + eval(1 + thisi)).outerHTML.split('background-color').length == 1) {
document.getElementById('span' + eval(1 + thisi)).style.backgroundColor=bcols[curplayer];
locsubscore++;
}
}
}
thislet=' '; //'S';
spano.innerHTML=thislet;
spano.style.color='rgb(128,0,128)'; //'#000000';
} else {
if (Math.min(topm, bottomm,leftm,rightm) == bottomm) { // s
thislet='border-bottom:2px solid ' + bcols[curplayer]; //alert(56);
spano.style.borderBottom=thislet.split(':')[1];
//document.getElementById('myh4').style.fontSize='6px';
//document.getElementById('myh4').innerHTML='thisi=' + thisi + ' border-bottom and ' + eval(100 + thisi) + ' is border-top ' + spano.outerHTML.replace(/\>/g,'>').replace(/\</g,'<');
if ((sbl == 4 && spano.outerHTML.split('border-').length >= 4) && sbc == 1) {
spano.style.backgroundColor=bcols[curplayer];
//alert(3);
//if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
//alert('' + sbl + ' 3:' + spano.outerHTML.split('border-').length + ' ' + spano.outerHTML);
//}
locsubscore++;
} //else if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i) && sbl == 4 && sbc == 1) {
//alert('3:' + spano.outerHTML.split('border-').length + ' ' + spano.outerHTML);
//}
if (eval(thisi / 100) <= 18) {
sbl=eval('' + noc(document.getElementById('span' + eval(100 + thisi)).outerHTML).split('border-').length);
sbc=eval('' + document.getElementById('span' + eval(100 + thisi)).outerHTML.split('background-color').length);
document.getElementById('span' + eval(100 + thisi)).style.borderTop=thislet.split(':')[1];
if ((sbl == 4 && noc(document.getElementById('span' + eval(100 + thisi)).outerHTML).split('border-').length >= 4) && sbc == 1) { //if (document.getElementById('span' + eval(100 + thisi)).outerHTML.split('border-').length == 5 && document.getElementById('span' + eval(100 + thisi)).outerHTML.split('background-color').length == 1) {
document.getElementById('span' + eval(100 + thisi)).style.backgroundColor=bcols[curplayer];
locsubscore++;
}
}
} else {
thislet='border-top:2px solid ' + bcols[curplayer]; //alert(56);
spano.style.borderTop=thislet.split(':')[1];
//document.getElementById('myh4').style.fontSize='6px';
//document.getElementById('myh4').innerHTML='thisi=' + thisi + ' border-top and ' + eval(-100 + thisi) + ' is border-bottom ' + spano.outerHTML.replace(/\>/g,'>').replace(/\</g,'<');
if ((sbl == 4 && noc(spano.outerHTML).split('border-').length >= 4) && sbc == 1) {
spano.style.backgroundColor=bcols[curplayer];
//alert(4);
//if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
//alert('' + sbl + ' 4:' + spano.outerHTML.split('border-').length + ' ' + spano.outerHTML);
//}
locsubscore++;
} //else if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i) && sbl == 4 && sbc == 1) {
//alert('4:' + spano.outerHTML.split('border-').length + ' ' + spano.outerHTML);
//}
if (eval(thisi / 100) >= 1) {
sbl=eval('' + noc(document.getElementById('span' + eval(-100 + thisi)).outerHTML).split('border-').length);
sbc=eval('' + document.getElementById('span' + eval(-100 + thisi)).outerHTML.split('background-color').length);
document.getElementById('span' + eval(-100 + thisi)).style.borderBottom=thislet.split(':')[1];
if ((sbl == 4 && noc(document.getElementById('span' + eval(-100 + thisi)).outerHTML).split('border-').length >= 4) && sbc == 1) { //if (document.getElementById('span' + eval(-100 + thisi)).outerHTML.split('border-').length == 5 && document.getElementById('span' + eval(-100 + thisi)).outerHTML.split('background-color').length == 1) {
document.getElementById('span' + eval(-100 + thisi)).style.backgroundColor=bcols[curplayer];
locsubscore++;
}
}
}
thislet=' '; //'O';
spano.innerHTML=thislet;
spano.style.color='#0000ff';
}
if (locsubscore > 0) {
//alert('locsubscore=' + locsubscore + ' yy=' + yy + ' rtis.top=' + rtis.top + ' rtis.y=' + rtis.y + ' rtis.bottom=' + rtis.bottom);
changeu=false;
subscore=locsubscore;
return cscore('pointer', locsubscore);
} else {
subscore=0;
changeu=true;
//alert('change');
return cscore('pointer', 0);
}
var newi=eval(spano.id.replace('span',''));
var documentgetSelectiontoString='', revsis='';
var wlen=0, ijh=0;
if (setsoftwo.length == 0) {
setsoftwo.push(newi);
document.getElementById('span' + newi).style.backgroundColor='yellow';
} else {
console.log('Newi=' + newi + ' and down=' + Math.abs(eval(newi % 100) - eval(setsoftwo[0] % 100)) + ' and across=' + Math.abs(Math.floor(newi / 100) - Math.floor(setsoftwo[0] / 100)) + ' via setsoftwo[0]=' + setsoftwo[0]);
if (Math.floor(newi / 100) == Math.floor(setsoftwo[0] / 100)) {
wlen=eval(1 + Math.abs(eval(setsoftwo[0] - newi)));
if (wlen == 3) { // >= 4) {
for (ijh=Math.min(setsoftwo[0], newi); ijh<=Math.max(setsoftwo[0], newi); ijh++) {
documentgetSelectiontoString+=document.getElementById('span' + ijh).innerHTML;
revsis=document.getElementById('span' + ijh).innerHTML + revsis;
document.getElementById('span' + ijh).style.backgroundColor='orange';
document.getElementById('span' + ijh).title=document.getElementById('span' + ijh).innerHTML;
document.getElementById('span' + ijh).style.cursor='progress';
}
subscore=eval(0 - eval('' + documentgetSelectiontoString.length));
findingnemo='';
if (!backwardsallowed) {
setTimeout(retry, 2000);
document.getElementById('nameif').title='';
} else {
setTimeout(retry, 8000);
document.getElementById('mytao').style.cursor='progress';
document.getElementById('nameif').title='../PHP/surprise.php?miZn=' + eval(1 + eval('' + documentgetSelectiontoString.length)) + '&maZx=' + eval(1 + eval('' + documentgetSelectiontoString.length)) + '&firstJUNKname=y&youllneverfindthis=y' + '&second=y&iswordthere=' + encodeURIComponent(revsis);
}
document.getElementById('nameif').src='../PHP/surprise.php?miZn=' + eval(1 + eval('' + documentgetSelectiontoString.length)) + '&maZx=' + eval(1 + eval('' + documentgetSelectiontoString.length)) + '&firstJUNKname=y&youllneverfindthis=y' + '&iswordthere=' + encodeURIComponent(documentgetSelectiontoString.toLowerCase());
setsoftwo=[];
} else {
document.getElementById('span' + ('' + setsoftwo[0]).replace('span','')).style.backgroundColor='#f0f0f0';
setsoftwo=[];
setsoftwo.push(newi);
document.getElementById('span' + newi).style.backgroundColor='yellow';
console.log('newi=' + newi + ' and down=' + Math.abs(eval(newi % 100) - eval(setsoftwo[0] % 100)) + ' and across=' + Math.abs(Math.floor(newi / 100) - Math.floor(setsoftwo[0] / 100)) + ' via setsoftwo[0]=' + setsoftwo[0]);
notify('Sorry, but too short.');
}
} else if (eval(newi % 100) == eval(setsoftwo[0] % 100)) {
if (updownallowed) {
console.log('up down');
wlen=eval(1 + Math.abs(eval(Math.floor(setsoftwo[0] / 100) - Math.floor(newi / 100))));
console.log('newi=' + newi + ' and wlen=' + wlen + ' via setsoftwo[0]=' + setsoftwo[0]);
if (wlen == 3) { // >= 4) {
for (ijh=Math.min(setsoftwo[0], newi); ijh<=Math.max(setsoftwo[0], newi); ijh+=100) {
documentgetSelectiontoString+=document.getElementById('span' + ijh).innerHTML;
revsis=document.getElementById('span' + ijh).innerHTML + revsis;
document.getElementById('span' + ijh).style.backgroundColor='orange';
document.getElementById('span' + ijh).title=document.getElementById('span' + ijh).innerHTML;
document.getElementById('span' + ijh).style.cursor='progress';
}
subscore=eval(0 - eval('' + documentgetSelectiontoString.length));
findingnemo='';
if (!backwardsallowed) {
setTimeout(retry, 2000);
document.getElementById('nameif').title='';
} else {
setTimeout(retry, 8000);
document.getElementById('mytao').style.cursor='progress';
document.getElementById('nameif').title='../PHP/surprise.php?miZn=' + eval(1 + eval('' + documentgetSelectiontoString.length)) + '&maZx=' + eval(1 + eval('' + documentgetSelectiontoString.length)) + '&firstJUNKname=y&youllneverfindthis=y' + '&second=y&iswordthere=' + encodeURIComponent(revsis);
}
document.getElementById('nameif').src='../PHP/surprise.php?miZn=' + eval(1 + eval('' + documentgetSelectiontoString.length)) + '&maZx=' + eval(1 + eval('' + documentgetSelectiontoString.length)) + '&firstJUNKname=y&youllneverfindthis=y' + '&iswordthere=' + encodeURIComponent(documentgetSelectiontoString.toLowerCase());
setsoftwo=[];
} else {
document.getElementById('span' + ('' + setsoftwo[0]).replace('span','')).style.backgroundColor='#f0f0f0';
setsoftwo=[];
setsoftwo.push(newi);
document.getElementById('span' + newi).style.backgroundColor='yellow';
console.log('newi=' + newi + ' and down=' + Math.abs(eval(newi % 100) - eval(setsoftwo[0] % 100)) + ' and across=' + Math.abs(Math.floor(newi / 100) - Math.floor(setsoftwo[0] / 100)) + ' via setsoftwo[0]=' + setsoftwo[0]);
notify('Sorry, need four or more letters.');
}
} else {
document.getElementById('span' + ('' + setsoftwo[0]).replace('span','')).style.backgroundColor='#f0f0f0';
setsoftwo=[];
setsoftwo.push(newi);
document.getElementById('span' + newi).style.backgroundColor='yellow';
console.log('newi=' + newi + ' and down=' + Math.abs(eval(newi % 100) - eval(setsoftwo[0] % 100)) + ' and across=' + Math.abs(Math.floor(newi / 100) - Math.floor(setsoftwo[0] / 100)) + ' via setsoftwo[0]=' + setsoftwo[0]);
notify('Sorry, no up or downs allowed.');
}
} else if (Math.abs(Math.floor(eval(newi / 100)) - Math.floor(eval(setsoftwo[0] / 100))) == Math.abs(eval(newi % 100) - eval(setsoftwo[0] % 100))) {
if (diagonalsallowed) {
console.log('diagonal');
wlen=eval(1 + Math.abs(eval(Math.floor(setsoftwo[0] / 100) - Math.floor(newi / 100))));
console.log('newi=' + newi + ' and wlen=' + wlen + ' via setsoftwo[0]=' + setsoftwo[0]);
if (wlen == 3) { // >= 4) {
for (ijh=Math.min(setsoftwo[0], newi); ijh<=Math.max(setsoftwo[0], newi); ijh+=eval(eval(Math.max(setsoftwo[0], newi) - Math.min(setsoftwo[0], newi)) / eval(-1 + wlen))) {
documentgetSelectiontoString+=document.getElementById('span' + ijh).innerHTML;
revsis=document.getElementById('span' + ijh).innerHTML + revsis;
document.getElementById('span' + ijh).style.backgroundColor='orange';
document.getElementById('span' + ijh).title=document.getElementById('span' + ijh).innerHTML;
document.getElementById('span' + ijh).style.cursor='progress';
}
subscore=eval(0 - eval('' + documentgetSelectiontoString.length));
findingnemo='';
if (!backwardsallowed) {
setTimeout(retry, 2000);
document.getElementById('nameif').title='';
} else {
setTimeout(retry, 8000);
document.getElementById('mytao').style.cursor='progress';
document.getElementById('nameif').title='../PHP/surprise.php?miZn=' + eval(1 + eval('' + documentgetSelectiontoString.length)) + '&maZx=' + eval(1 + eval('' + documentgetSelectiontoString.length)) + '&firstJUNKname=y&youllneverfindthis=y' + '&second=y&iswordthere=' + encodeURIComponent(revsis);
}
document.getElementById('nameif').src='../PHP/surprise.php?miZn=' + eval(1 + eval('' + documentgetSelectiontoString.length)) + '&maZx=' + eval(1 + eval('' + documentgetSelectiontoString.length)) + '&firstJUNKname=y&youllneverfindthis=y' + '&iswordthere=' + encodeURIComponent(documentgetSelectiontoString.toLowerCase());
setsoftwo=[];
} else {
document.getElementById('span' + ('' + setsoftwo[0]).replace('span','')).style.backgroundColor='#f0f0f0';
setsoftwo=[];
setsoftwo.push(newi);
document.getElementById('span' + newi).style.backgroundColor='yellow';
console.log('newi=' + newi + ' and down=' + Math.abs(eval(newi % 100) - eval(setsoftwo[0] % 100)) + ' and across=' + Math.abs(Math.floor(newi / 100) - Math.floor(setsoftwo[0] / 100)) + ' via setsoftwo[0]=' + setsoftwo[0]);
notify('Too short, sorry.');
}
} else {
document.getElementById('span' + ('' + setsoftwo[0]).replace('span','')).style.backgroundColor='#f0f0f0';
setsoftwo=[];
setsoftwo.push(newi);
document.getElementById('span' + newi).style.backgroundColor='yellow';
console.log('newi=' + newi + ' and down=' + Math.abs(eval(newi % 100) - eval(setsoftwo[0] % 100)) + ' and across=' + Math.abs(Math.floor(newi / 100) - Math.floor(setsoftwo[0] / 100)) + ' via setsoftwo[0]=' + setsoftwo[0]);
notify('Sorry, no diagonals allowed.');
}
} else {
document.getElementById('span' + ('' + setsoftwo[0]).replace('span','')).style.backgroundColor='#f0f0f0';
setsoftwo=[];
setsoftwo.push(newi);
document.getElementById('span' + newi).style.backgroundColor='yellow';
console.log('newi=' + newi + ' and down=' + Math.abs(eval(newi % 100) - eval(setsoftwo[0] % 100)) + ' and across=' + Math.abs(Math.floor(newi / 100) - Math.floor(setsoftwo[0] / 100)) + ' via setsoftwo[0]=' + setsoftwo[0]);
}
}
//alert('id=' + spano.id + ' ' + spano.innerHTML);
}
function testtwo(ablurb, btitle, xnameslist) {
if (btitle.trim() != '' && xnameslist.trim() != '' && xnameslist.replace(/\~/g,' ').trim() != xnameslist) {
trysay=true;
nameslist=nameslist.trim();
console.log('btitle=' + btitle + '* nameslist=' + nameslist + '*');
} //else if (btitle.trim() != '' && 1 == 2) {
//alert('nameslist=' + nameslist + '*');
//} else if (1 == 2) {
//alert('btitle=' + btitle + '*');
//}
if (nameslist.split(',').length > document.getElementById('numsel').value) {
if (document.getElementById('numsel').innerHTML.indexOf('>' + nameslist.split(',').length + ' ') == -1) {
document.getElementById('numsel').innerHTML='<option value="' + nameslist.split(',').length + '">' + nameslist.split(',').length + ' players</option>';
}
document.getElementById('numsel').value='' + nameslist.split(',').length;
nparrange(document.getElementById('numsel'));
} else if (nameslist.replace('Player 1','Player1').trim().split(' ').length > document.getElementById('numsel').value) {
if (document.getElementById('numsel').innerHTML.indexOf('>' + nameslist.split(',').length + ' ') == -1) {
document.getElementById('numsel').innerHTML='<option value="' + nameslist.split(',').length + '">' + nameslist.split(',').length + ' players</option>';
}
document.getElementById('numsel').value='' + nameslist.trim().split(' ').length;
nparrange(document.getElementById('numsel'));
} else if (trysay) {
notify('Your go ' + anames[curplayer]);
}
return ablurb.replace(' ' + anames[curplayer], ' ' + fnames[curplayer]).replace(' ' + anames[sparecurplayer], ' ' + fnames[sparecurplayer]);
}
function nparrange(sio) {
if (eval('' + sio.value) > eval('' + ascores.length) || 1 == 1) { //numplayers != eval('' + sio.value)) {
if (eval('' + sio.value) >= 2 && eval('' + ascores.length) >= 2) {
ascores=[ascores[0]];
agoes=[agoes[0]];
anames=[anames[0]];
fnames=[fnames[0]];
}
while (eval('' + sio.value) > eval('' + ascores.length)) {
ascores.push(0);
agoes.push(0);
if (nameslist.split(',').length >= ascores.length && nameslist.indexOf(',') != -1) {
fnames.push('<font color="' + bcols[anames.length] + '">' + nameslist.split(',')[eval(-1 + ascores.length)] + '</font>');
anames.push(nameslist.split(',')[eval(-1 + ascores.length)]);
anames[0]=nameslist.split(',')[0];
fnames[0]=('<font color="' + bcols[0] + '">' + nameslist.trim().split(',')[0] + '</font>');
document.getElementById('smore').innerHTML=notify('Your go ' + anames[curplayer]);
} else if (nameslist.trim().split(' ').length >= ascores.length && nameslist.indexOf(' ') != -1) {
fnames.push('<font color="' + bcols[anames.length] + '">' + nameslist.split(' ')[eval(-1 + ascores.length)] + '</font>');
anames.push(nameslist.trim().split(' ')[eval(-1 + ascores.length)]);
anames[0]=nameslist.trim().split(' ')[0];
fnames[0]=('<font color="' + bcols[0] + '">' + nameslist.trim().split(' ')[0] + '</font>');
document.getElementById('smore').innerHTML=notify('Your go ' + anames[curplayer]);
} else {
fnames.push('<font color="' + bcols[anames.length] + '">Player ' + ascores.length + '</font>');
anames.push('Player ' + ascores.length);
document.getElementById('smore').innerHTML='';
}
}
numplayers=eval('' + ascores.length);
document.getElementById('curbit').innerHTML='for <font color=green>' + eval(1 + eval('' + curplayer)) + '</font> of';
if (eval('' + ascores.length) > 1) {
var cscores='';
var cgoes='';
var betw='';
//if (eval(0 + eval('' + curplayer)) == 0) { betw='<font color=red>'; }
if (eval(1 + eval('' + curplayer)) >= eval('' + ascores.length)) { betw='<font color=red>'; }
for (var inp=0; inp<eval('' + ascores.length); inp++) {
if (eval('' + curplayer) == inp) {
cscores+=betw + mcs(inp,true,'<font color=green>' + ascores[inp] + '</font>');
cgoes+=betw + mcs(inp,false,'<font color=green>' + agoes[inp] + '</font>');
betw=':<font color=red>';
} else {
cscores+=mcs(inp,true,betw + ascores[inp] + betw.replace(':','').replace('<font color=red>', '</font>').replace('<font color=green>', '</font>'));
cgoes+=mcs(inp,false,betw + agoes[inp] + betw.replace(':','').replace('<font color=red>', '</font>').replace('<font color=green>', '</font>'));
//betw=':';
betw=(':' + betw.replace(':','')).replace('<font color=red>','').replace('<font color=green>','<font color=red>');
}
console.log('numplayers=' + numplayers + ' at ' + inp + ' vs curplayer=' + curplayer + ' ' + cscores + '/' + cgoes);
}
document.getElementById('score').innerHTML='' + cscores + '/' + cgoes;
//curplayer++;
//if (curplayer >= eval('' + ascores.length)) { curplayer=0; }
//scores=ascores[curplayer];
//goes=agoes[curplayer];
}
}
}
function restart(sio) {
var myblurb=document.getElementById('blurb').innerHTML; // Forwards, backwards, up, down, diagonal 4 letters or more highlight below
var setn=[8,1,1,3,11,1,2,1,8,0,0,3,1,5,7,1,0,5,3,5,3,1,1,0,1,0];
if (document.getElementById('cmode').value.indexOf('lick') != -1 && documentURL.indexOf('clicks=') == -1) {
documentURL+='#clicks=y';
}
if (nameslist != '') {
if (sio.value == 'hard') { location.href=document.URL + '#nameslist=' + encodeURIComponent(nameslist); } else if (documentURL.indexOf('#') != -1) { location.href=documentURL.replace('#', '?' + sio.value + '=y&') + '#nameslist=' + encodeURIComponent(nameslist); } else if (documentURL.indexOf('?') != -1) { location.href=documentURL.replace('?eas', '?aes').replace('?hard', '?drah').replace('?', '?' + sio.value + '=y&') + '#nameslist=' + encodeURIComponent(nameslist); } else { location.href=documentURL + '?' + sio.value + '=y' + '#nameslist=' + encodeURIComponent(nameslist); }
} else {
if (sio.value == 'hard') { location.href=document.URL; } else if (documentURL.indexOf('#') != -1) { location.href=documentURL.replace('#', '?' + sio.value + '=y&'); } else if (documentURL.indexOf('?') != -1) { location.href=documentURL.replace('?eas', '?aes').replace('?hard', '?drah').replace('?', '?' + sio.value + '=y&'); } else { location.href=documentURL + '?' + sio.value + '=y'; }
}
if (sio.value != 'hard' && eval('' + letters.length) == 26) {
myblurb=myblurb.replace(' letters', ' more common set of letters');
// A-9, B-2, C-2, D-4, E-12, F-2, G-3, H-2, I-9, J-1, K-1, L-4, M-2, N-6, O-8, P-2, Q-1, R-6, S-4, T-6, U-4, V-2, W-2, X-1, Y-2, Z-1
var kbye=eval('' + letters.length);
for (ibye=0; ibye<kbye; ibye++) {
for (jbye=1; jbye<=setn[ibye]; jbye++) {
letters.push(letters[ibye]);
}
}
}
if (sio.value == 'easiest') {
myblurb=myblurb.replace(', diagonally', '');
myblurb=myblurb.replace(', up, down', '');
myblurb=myblurb.replace(', backwards', '');
backwardsallowed=false;
updownallowed=false;
diagonalsallowed=false;
}
if (sio.value == 'easier') {
myblurb=myblurb.replace(', diagonally', '');
myblurb=myblurb.replace(', up, down', '');
myblurb=myblurb.replace('Forwards 3', 'Forwards, backwards 3');
backwardsallowed=true;
updownallowed=false;
diagonalsallowed=false;
}
if (sio.value == 'easy') {
myblurb=myblurb.replace('Forwards 3', 'Forwards, backwards, up, down, diagonal 3');
myblurb=myblurb.replace('Forwards, backwards 3', 'Forwards, backwards, up, down, diagonal 3');
backwardsallowed=true;
updownallowed=true;
diagonalsallowed=true;
}
document.getElementById('blurb').innerHTML=myblurb;
ebye='';
ibye=0;
jbye=0;
debye='';
aletter=' ';
var ijcnt=0;
for (ibye=0; ibye<20; ibye++) {
for (jbye=0; jbye<100; jbye++) {
aletter=letters[Math.floor(Math.random() * letters.length)];
ebye+=aletter;
debye+=aletter;
wdebye+='<span class=wunderlay placeholder="so" onmouseover="sback(this);" onclick="didclick(event,this);" title="" id=span' + ijcnt + ' data-idea=' + aletter + '> </span>';
ijcnt++;
}
ebye+=String.fromCharCode(10);
debye+='<br>';
wdebye+='<br>';
}
zdebye='';
zzdebye='';
lastzdebye='';
goutstris='';
delayis=0;
sofar=';';
document.getElementById('mytao').value=ebye;
var divs=document.getElementsByTagName('div');
for (kdivs=0; kdivs<divs.length; kdivs++) {
//divs[kdivs].innerHTML='';
}
document.getElementById('underlay').innerHTML=debye;
if (documentURL.indexOf('clicks=') != -1) {
var rectis=document.getElementById('mytao').getBoundingClientRect(); // document.getElementById('underlay').getBoundingClientRect();
//alert('' + document.getElementById('wunderlay').style.top);
document.getElementById('wunderlay').innerHTML=wdebye;
document.getElementById('underlay').style.display='none';
document.getElementById('wunderlay').style.display='block';
// document.getElementById('wunderlay').style.position='absolute';
// document.getElementById('wunderlay').style.top='' + rectis.top + 'px';
// document.getElementById('wunderlay').style.left='' + rectis.left + 'px';
// document.getElementById('wunderlay').style.width='' + rectis.width + 'px';
// document.getElementById('wunderlay').style.height='' + rectis.height + 'px';
//document.getElementById('underlay').style.display='none';
}
}
function sback(spo) {
//var rstis=spo.getBoundingClientRect();
//spo.style.backgroundImage='url("data:image/svg+xml;utf8,<svg xmlns=' + "'" + 'http://www.w3.org/2000/svg' + "'" + ' width=' + "'" + rstis.width + "'" + ' height=' + "'" + rstis.height + "'" + ' viewport=' + "'" + '0 0 100 100' + "'" + '><text y=' + "'" + '0%' + "'" + '>S</text><text y=' + "'" + '50%' + "'" + '>O</text></svg>");';
//spo.style.backgroundRepeat='no-repeat';
//spo.style.backgroundSize='contain';
//spo.style.cursor='url("data:image/svg+xml;utf8,<svg xmlns=' + "'" + 'http://www.w3.org/2000/svg' + "'" + ' width=' + "'" + rstis.width + "'" + ' height=' + "'" + rstis.height + "'" + ' viewport=' + "'" + '0 0 100 100' + "'" + '><text y=' + "'" + '0%' + "'" + '>S</text><text y=' + "'" + '50%' + "'" + '>O</text></svg>") 16 0, progress';
}
function mytaow() {
var rectis=document.getElementById('mytao').getBoundingClientRect();
document.getElementById('mytao').style.width='' + eval(20 + rectis.width) + 'px';
document.getElementById('underlay').style.position='absolute';
document.getElementById('underlay').style.top='' + rectis.top + 'px';
document.getElementById('underlay').style.left='' + rectis.left + 'px';
document.getElementById('underlay').style.width='' + eval(20 + rectis.width) + 'px';
document.getElementById('underlay').style.height='' + rectis.height + 'px';
document.getElementById('underlay').innerHTML=debye;
if (document.getElementById('wunderlay').innerHTML != '') {
document.getElementById('wunderlay').style.position='absolute';
document.getElementById('wunderlay').style.top='' + rectis.top + 'px';
document.getElementById('wunderlay').style.left='' + rectis.left + 'px';
document.getElementById('wunderlay').style.width='' + eval(20 + rectis.width) + 'px';
document.getElementById('wunderlay').style.height='' + rectis.height + 'px';
document.getElementById('wunderlay').innerHTML=wdebye;
document.getElementById('wunderlay').style.display='block';
}
}
function pasteinto(inmode) {
console.log('here at pasteinto');
sofar = document.querySelector(".editor").value;
//console.log('here at pasteinto sofar=' + sofar + ' with sofarbefore=*' + sofarbefore + '* and sofarafter=*' + sofarafter + '*');
switch (inmode) {
case 'before':
navigator.clipboard.readText().then(
(clipText) => document.querySelector(".editor").value = clipText + sofar);
break;
case 'after':
navigator.clipboard.readText().then(
(clipText) => document.querySelector(".editor").value += clipText);
break;
default:
console.log('at cursor');
navigator.clipboard.readText().then(
(clipText) => document.querySelector(".editor").value = sofarbefore + clipText + sofarafter);
break;
}
}
//document.getElementById('mytao').addEventListener('click', showposition); // click
document.querySelector(".editor").addEventListener('click', showposition); // click
document.querySelector(".editor").addEventListener('keyup', showpositionkp); // click
function consolelog(iyt) {
document.title=iyt;
}
function showposition(event) { // thanks to https://stackoverflow.com/questions/62310186/how-do-you-get-the-current-cursor-position-in-a-textarea-whenever-the-cursor-o
console.log('1:' + event.target.selectionStart);
if (document.querySelector(".editor").value != '') {
//onsole.log('yes, here');
sofarbefore=document.querySelector(".editor").value.substring(0, event.target.selectionStart);
sofarafter=document.querySelector(".editor").value.substring(event.target.selectionStart);
//console.log('sofarbefore=' + sofarbefore + ' and sofarafter=' + sofarafter);
}
}
function showpositionkp(event) { // thanks to https://stackoverflow.com/questions/62310186/how-do-you-get-the-current-cursor-position-in-a-textarea-whenever-the-cursor-o
console.log('2:' + event.target.selectionStart);
if (document.querySelector(".editor").value != '') {
//console.log('yes, here');
sofarbefore=document.querySelector(".editor").value.substring(0, event.target.selectionStart);
sofarafter=document.querySelector(".editor").value.substring(event.target.selectionStart);
//console.log('sofarbefore=' + sofarbefore + ' and sofarafter=' + sofarafter);
}
}
function retry() {
if (('' + document.getElementById('nameif').title).trim() != '') {
document.getElementById('nameif').src=document.getElementById('nameif').title;
document.getElementById('nameif').title='';
} else {
document.getElementById('mytao').style.cursor='pointer'; //cscore('pointer', subscore);
}
}
function mcs(indx, isscore, retv) {
if (anames[0].replace('Player 1','') != '') {
if (('' + anames[indx]).replace('undefined','') == '') { return retv; }
if (retv.indexOf('>') != -1) {
if (isscore) {
return retv.replace('>', ' title="' + anames[indx] + ' score">');
} else {
return retv.replace('>', ' title="' + anames[indx] + ' goes">');
}
} else {
if (isscore) {
return '<font color=black title="' + anames[indx] + ' score">' + retv + '</font>';
} else {
return '<font color=black title="' + anames[indx] + ' goes">' + retv + '</font>';
}
}
}
return retv;
}
function cscore(cursortype, ssc) {
var prescore='', spans=[];
var ispans=0;
sparecurplayer=curplayer;
if ((lastzdebye != zdebye && lastzdebye != zzdebye) || 9 == 9) {
if (ssc != 0 || 1 == 1) { goes++; }
if (ssc > 0) {
if (anames[0].replace('Player 1','').trim() != '') {
prescore='Well done' + findingnemo + ', ' + anames[curplayer] + '. ';
}
if (documentURL.indexOf('clicks=') != -1) {
spans=document.getElementsByTagName('span');
for (ispans=0; ispans<spans.length; ispans++) {
if (spans[ispans].innerHTML.length == 1 && ('' + spans[ispans].title) != '') {
spans[ispans].style.backgroundColor='lightgreen';
spans[ispans].title='';
}
}
}
score+=ssc;
if (zzdebye.indexOf('<font') != -1) { // && zdebye.indexOf('<font') == -1) {
zdebye=zzdebye;
}
if (zdebye.indexOf('<font') != -1 && documentURL.indexOf('clicks=') == -1) {
if (document.getElementById('underlay').innerHTML.replace(/\<br\>/g,'').indexOf('<') == -1) {
document.getElementById('others').innerHTML+=document.getElementById('underlay').outerHTML.split('>')[0].replace(' id=', ' class=').replace(/\ color\=\"red\"/g, ' color="black" style="background-color:lightgreen;"') + '>' + zdebye.replace(/\ color\=\"red\"/g, ' color="black" style="background-color:lightgreen;"') + '</div>';
} else {
document.getElementById('others').innerHTML+=document.getElementById('underlay').outerHTML.replace(' id=', ' class=').replace(/\ color\=\"red\"/g, ' color="black" style="background-color:lightgreen;"');
}
}
} else {
if (anames[0].replace('Player 1','').trim() != '') {
prescore='Bad luck, ' + anames[curplayer] + '. ';
}
if (documentURL.indexOf('clicks=') != -1) {
spans=document.getElementsByTagName('span');
for (ispans=0; ispans<spans.length; ispans++) {
if (spans[ispans].innerHTML.length == 1 && ('' + spans[ispans].title) != '') {
spans[ispans].style.backgroundColor='lightgray';
spans[ispans].title='';
}
}
}
if (zzdebye.indexOf('<font') != -1) { // && zdebye.indexOf('<font') == -1) {
zdebye=zzdebye;
//if (document.getElementById('underlay').innerHTML.replace(/\<br\>/g,'').indexOf('<') == -1) {
//alert(zdebye);
//}
}
if (zdebye.indexOf('<font') != -1 && documentURL.indexOf('clicks=') == -1) {
if (document.getElementById('underlay').innerHTML.replace(/\<br\>/g,'').indexOf('<') == -1) {
document.getElementById('others').innerHTML+=document.getElementById('underlay').outerHTML.split('>')[0].replace(' id=', ' class=').replace(/\ color\=\"red\"/g, ' color="black" style="background-color:orange;"') + '>' + zdebye.replace(/\ color\=\"red\"/g, ' color="black" style="background-color:orange;"') + '</div>';
} else {
document.getElementById('others').innerHTML+=document.getElementById('underlay').outerHTML.replace(' id=', ' class=').replace(/\ color\=\"red\"/g, ' color="black" style="background-color:orange;"');
}
}
}
if (eval('' + ascores.length) == 1 && anames[0].replace('Player 1','').trim() != '' && ssc != 0) {
document.getElementById('smore').innerHTML=notify(prescore + 'Your go ' + anames[curplayer]);
}
if (eval('' + ascores.length) > 1) {
if (ssc == 0) {
subscore=0;
lastzdebye=zdebye;
zzdebye='';
zdebye='';
// return 'pointer'; // ''
}
ascores[curplayer]=eval('' + score);
agoes[curplayer]=eval('' + goes);
var cscores='';
var cgoes='';
var betw='';
if (eval(1 + eval('' + curplayer)) >= eval('' + ascores.length)) { betw='<font color=green>'; }
//if (eval('' + curplayer) == eval('' + ascores.length)) { betw='<font color=green>'; }
for (var inp=0; inp<eval('' + ascores.length); inp++) {
if (eval('' + eval(1 + curplayer)) == inp) {
cscores+=betw + mcs(inp,true,'<font color=green>' + ascores[inp] + '</font>');
cgoes+=betw + mcs(inp,false,'<font color=green>' + agoes[inp] + '</font>');
betw=':<font color=red>';
if (eval(1 + inp) >= eval('' + ascores.length)) {
cscores=mcs(inp,true,'<font color=red>' + cscores.replace(':','</font>:'));
cgoes=mcs(inp,false,'<font color=red>' + cgoes.replace(':','</font>:'));
}
} else {
cscores+=mcs(inp,true,betw + ascores[inp] + betw.replace(':','').replace('<font color=red>', '</font>').replace('<font color=green>', '</font>'));
cgoes+=mcs(inp,false,betw + agoes[inp] + betw.replace(':','').replace('<font color=red>', '</font>').replace('<font color=green>', '</font>'));
betw=(':' + betw.replace(':','')).replace('<font color=red>','').replace('<font color=green>','<font color=red>');
}
}
document.getElementById('score').innerHTML='' + cscores + '/' + cgoes;
if (ssc == 0 && changeu) { curplayer++; }
changeu=false;
if (curplayer >= eval('' + ascores.length)) { curplayer=0; }
if (document.getElementById('smore').innerHTML != '' && document.getElementById('smore').innerHTML.replace(/\<font/g,'').replace(/\<\/font/g,'').indexOf('<') == -1) {
if (anames.length > curplayer) {
document.getElementById('smore').innerHTML=notify(prescore + 'Your go ' + anames[curplayer]);
} else if (nameslist.indexOf(',') != -1) {
anames=nameslist.split(',');
document.getElementById('smore').innerHTML=notify(prescore + 'Your go ' + anames[curplayer]);
} else if (nameslist.indexOf(' ') != -1) {
anames=nameslist.trim().split(' ');
document.getElementById('smore').innerHTML=notify(prescore + 'Your go ' + anames[curplayer]);
} else {
document.getElementById('smore').innerHTML=notify(prescore + 'Your go ' + anames[curplayer]);
}
}
document.getElementById('curbit').innerHTML='for <font color=green>' + eval(1 + eval('' + curplayer)) + '</font> of';
score=eval('' + ascores[curplayer]);
goes=eval('' + agoes[curplayer]);
if ((8 == 8 || subscore != 0) && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
if ('toastisgood' == 'toastisgood') {
notify('');
} else {
document.getElementById('score').scrollIntoView();
}
}
subscore=0;
} else {
ascores[curplayer]=score;
agoes[curplayer]=goes;
document.getElementById('score').innerHTML='' + mcs(0,true,'' + score) + '/' + mcs(0,false,'' + goes);
if ((8 == 8 || subscore != 0) && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
if ('toastisgood' == 'toastisgood') {
notify('');
} else {
document.getElementById('score').scrollIntoView();
}
}
}
subscore=0;
lastzdebye=zdebye;
}
zzdebye='';
zdebye='';
return cursortype;
}
function checkname(iois, iserror) {
var ifnd=-1, newname='';
var revsisc='', jrev=0;
console.log('checkname1');
if (iserror) {
if (iois.src.indexOf('second=') == -1 && iois.src.indexOf('iswordthere=') != -1) {
if (('' + iois.title).trim() != '') {
//document.getElementById('mytao').style.cursor='pointer';
document.body.title='';
iois.src=iois.title;
iois.title='';
} else {
//alert(1);
for (jrev=eval(-1 + eval('' + decodeURIComponent(iois.src.split('iswordthere=')[1].split('&')[0].split('#')[0]).length)); jrev>=0; jrev--) {
revsisc+=decodeURIComponent(iois.src.split('iswordthere=')[1].split('&')[0].split('#')[0]).substring(jrev, eval(1 + jrev));
}
//alert('Newname=' + revsisc);
document.body.title='';
iois.title='';
iois.src=iois.src.split('iswordthere=')[0] + 'second=y&iswordthere=' + encodeURIComponent(revsisc);
}
} else {
document.getElementById('mytao').style.cursor='pointer'; //cscore('pointer', subscore);
}
} else {
if (iois != null) {
ifnd=iois.src.indexOf('iswordthere=');
console.log('checkname2 ' + ifnd);
var aconto = (iois.contentWindow || iois.contentDocument);
if (aconto != null && ifnd != -1) {
console.log('checkname3 ' + ifnd);
if (aconto.document) { aconto = aconto.document; }
if (aconto.body != null) {
console.log('checkname4 ' + ifnd);
if (aconto.body.innerHTML.indexOf('</p>') != -1 && aconto.body.innerHTML.indexOf('></p>') == -1) {
document.body.title='';
iois.title='';
document.getElementById('mytao').style.cursor='pointer'; //cscore('pointer', Math.abs(subscore));
if (iois.src.indexOf('second=') != -1 && iois.src.indexOf('iswordthere=') != -1) {
findingnemo=' finding ' + aconto.body.innerHTML.split('</p>')[0].split('>')[eval(-1 + aconto.body.innerHTML.split('</p>')[0].split('>').length)];
console.log('findingnemo=' + findingnemo);
subscore=Math.abs(subscore);
}
subscore=Math.abs(subscore);
console.log('Found name ' + aconto.body.innerHTML.split('</p>')[0].split('>')[eval(-1 + aconto.body.innerHTML.split('</p>')[0].split('>').length)]);
} else if (aconto.body.innerHTML.indexOf('<') == -1 && aconto.body.innerHTML.trim() != '') {
document.body.title='';
iois.title='';
document.getElementById('mytao').style.cursor='pointer'; //cscore('pointer', Math.abs(subscore));
if (iois.src.indexOf('second=') != -1 && iois.src.indexOf('iswordthere=') != -1) {
findingnemo=' finding ' + aconto.body.innerHTML;
console.log('findingnemo=' + findingnemo);
subscore=Math.abs(subscore);
}
subscore=Math.abs(subscore);
console.log('Found name ' + aconto.body.innerHTML);
} else if (iois.src.indexOf('second=') == -1 && iois.src.indexOf('iswordthere=') != -1) {
if (('' + iois.title).trim() != '') {
//document.getElementById('mytao').style.cursor='pointer';
document.body.title='';
iois.src=iois.title;
iois.title='';
} else {
//alert(1);
for (jrev=eval(-1 + eval('' + decodeURIComponent(iois.src.split('iswordthere=')[1].split('&')[0].split('#')[0]).length)); jrev>=0; jrev--) {
revsisc+=decodeURIComponent(iois.src.split('iswordthere=')[1].split('&')[0].split('#')[0]).substring(jrev, eval(1 + jrev));
}
//alert('Newname=' + revsisc);
document.body.title='';
iois.title='';
iois.src=iois.src.split('iswordthere=')[0] + 'second=y&iswordthere=' + encodeURIComponent(revsisc);
}
} else {
document.getElementById('mytao').style.cursor='pointer'; //cscore('pointer', subscore);
}
} else {
console.log('checkname5 ' + ifnd);
//alert('WhY?');
document.getElementById('mytao').style.cursor='pointer'; //cscore('pointer', subscore);
}
} else if (ifnd != -1) {
console.log('checkname6 ' + ifnd);
ifnd=ifnd;
if (iois.src.indexOf('second=') == -1 && iois.src.indexOf('iswordthere=') != -1) {
//alert(11);
for (jrev=eval(-1 + eval('' + decodeURIComponent(iois.src.split('iswordthere=')[1].split('&')[0].split('#')[0]).length)); jrev>=0; jrev--) {
revsisc+=decodeURIComponent(iois.src.split('iswordthere=')[1].split('&')[0].split('#')[0]).substring(jrev, eval(1 + jrev));
}
//alert('newname=' + revsisc);
iois.src=iois.src.split('iswordthere=')[0] + 'second=y&iswordthere=' + encodeURIComponent(revsisc);
} else {
document.getElementById('mytao').style.cursor='pointer'; //cscore('pointer', subscore);
}
}
}
}
}
function dummymc(insis) {
return insis;
}
function getmltrans(instris) {
goutstris='';
outstris=instris;
var ebay=ebye, jb=0, kb=2;
while (outstris.indexOf(String.fromCharCode(10)) != -1) {
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
if (eval('' + instris.length) >= 46) {
return instris;
}
}
if (!updownallowed && !diagonalsallowed) {
return instris;
}
outstris=outstris.replace(/\ /g,'').replace(String.fromCharCode(10),'');
}
while (ebay.indexOf(String.fromCharCode(10)) != -1) {
ebay=ebay.replace(/\ /g,'').replace(String.fromCharCode(10),'');
}
var onepos=ebay.indexOf(outstris);
var linesare=instris.split(String.fromCharCode(10));
var xlinesare=ebye.split(String.fromCharCode(10));
var zlinesare=debye.split('<br>');
zdebye=debye;
zzdebye=debye;
if (eval('' + linesare.length) == 1 && eval('' + dummymc(outstris).length) == 3) { // >= 4) {
if (onepos != -1) {
zzdebye=zzdebye.replace(outstris, '<font color="red">' + outstris + '</font>');
//alert(zzdebye);
}
return outstris;
}
if (eval('' + linesare.length) != 3 && eval('' + linesare.length) > 1) {
notify('Sorry, but word is not the correct length.');
}
if (eval('' + linesare.length) == 3) {
var startpos=eval(onepos % 100);
var endpos=eval(eval(onepos + eval('' + outstris.length)) % 100);
if (endpos == 0 && startpos > 75) { endpos=100; }
console.log('outstris=' + outstris.replace(/\ /g,'*') + ' ... lines ' + linesare.length + ' ... startpos=' + startpos + ' ... endpos=' + endpos + ' ' + ebay.indexOf(outstris) + String.fromCharCode(10) + ebay);
var izero=Math.floor(onepos / 100);
if (startpos > endpos) {
if (eval(eval('' + startpos) - eval(-2 + eval('' + linesare.length))) == eval('' + endpos)) {
outstris=(xlinesare[izero] + ' ').substring(startpos, eval(1 + startpos));
if (startpos > 50) {
console.log(zlinesare[izero].substring(eval(-30 + startpos), eval(0 + startpos)) + '<font color=red>' + (xlinesare[izero] + ' ').substring(startpos, eval(1 + startpos)) + '</font>');
zdebye=zdebye.replace((xlinesare[izero] + ' ').substring(eval(-30 + startpos), eval(1 + startpos)), (xlinesare[izero] + ' ').substring(eval(-30 + startpos), eval(0 + startpos)) + '<font color="red">' + (xlinesare[izero] + ' ').substring(startpos, eval(1 + startpos)) + '</font>');
} else {
zdebye=zdebye.replace((xlinesare[izero] + ' ').substring(startpos, eval(30 + startpos)), '<font color="red">' + (xlinesare[izero] + ' ').substring(startpos, eval(1 + startpos)) + '</font>' + (xlinesare[izero] + ' ').substring(eval(1 + startpos), eval(30 + startpos)));
}
//alert('first character is ' + outstris + ' is startpos=' + startpos + ' in xlinesare[' + izero + ']=' + xlinesare[izero]);
izero++;
for (jb=izero; jb<xlinesare.length; jb++) {
if (kb <= eval('' + linesare.length)) {
startpos--;
outstris+=(xlinesare[jb] + ' ').substring(startpos, eval(1 + startpos));
if (startpos > 50) {
zdebye=zdebye.replace((xlinesare[jb] + ' ').substring(eval(-30 + startpos), eval(1 + startpos)), (xlinesare[jb] + ' ').substring(eval(-30 + startpos), eval(0 + startpos)) + '<font color="red">' + (xlinesare[jb] + ' ').substring(startpos, eval(1 + startpos)) + '</font>');
} else {
zdebye=zdebye.replace((xlinesare[jb] + ' ').substring(startpos, eval(30 + startpos)), '<font color="red">' + (xlinesare[jb] + ' ').substring(startpos, eval(1 + startpos)) + '</font>' + (xlinesare[jb] + ' ').substring(eval(1 + startpos), eval(30 + startpos)));
}
}
kb++;
}
goutstris=outstris;
delayis=500;
setTimeout(afterbit, delayis);
//alert('izero=' + izero + ' ' + outstris + ' left diagonal string potentially ' + linesare.length + ' long starting at ' + eval(onepos % 100) + ' and ending at ' + endpos);
} else {
outstris='';
}
} else {
if (eval(eval('' + endpos) - eval(0 + eval('' + linesare.length))) == eval('' + startpos)) {
outstris=(xlinesare[izero] + ' ').substring(startpos, eval(1 + startpos));
if (startpos > 50) {
console.log(zlinesare[izero].substring(eval(-30 + startpos), eval(0 + startpos)) + '<font color=red>' + (xlinesare[izero] + ' ').substring(startpos, eval(1 + startpos)) + '</font>');
zdebye=zdebye.replace((xlinesare[izero] + ' ').substring(eval(-30 + startpos), eval(1 + startpos)), (xlinesare[izero] + ' ').substring(eval(-30 + startpos), eval(0 + startpos)) + '<font color="red">' + (xlinesare[izero] + ' ').substring(startpos, eval(1 + startpos)) + '</font>');
} else {
zdebye=zdebye.replace((xlinesare[izero] + ' ').substring(startpos, eval(30 + startpos)), '<font color="red">' + (xlinesare[izero] + ' ').substring(startpos, eval(1 + startpos)) + '</font>' + (xlinesare[izero] + ' ').substring(eval(1 + startpos), eval(30 + startpos)));
}
izero++;
for (jb=izero; jb<xlinesare.length; jb++) {
if (kb <= eval('' + linesare.length)) {
startpos++;
outstris+=(xlinesare[jb] + ' ').substring(startpos, eval(1 + startpos));
if (startpos > 50) {
zdebye=zdebye.replace((xlinesare[jb] + ' ').substring(eval(-30 + startpos), eval(1 + startpos)), (xlinesare[jb] + ' ').substring(eval(-30 + startpos), eval(0 + startpos)) + '<font color=red>' + (xlinesare[jb] + ' ').substring(startpos, eval(1 + startpos)) + '</font>');
} else {
zdebye=zdebye.replace((xlinesare[jb] + ' ').substring(startpos, eval(30 + startpos)), '<font color=red>' + (xlinesare[jb] + ' ').substring(startpos, eval(1 + startpos)) + '</font>' + (xlinesare[jb] + ' ').substring(eval(1 + startpos), eval(30 + startpos)));
}
}
kb++;
}
goutstris=outstris;
delayis=500;
setTimeout(afterbit, delayis);
//alert(outstris + ' right diagonal string potentially ' + linesare.length + ' long starting at ' + eval(onepos % 100) + ' and ending at ' + endpos);
} else if (eval(-1 + endpos) == startpos || (startpos == 99 && endpos == 0)) {
console.log('Startpos=' + startpos);
outstris=(xlinesare[izero] + ' ').substring(startpos, eval(1 + startpos));
if (startpos > 50) {
console.log(zlinesare[izero].substring(eval(-30 + startpos), eval(0 + startpos)) + '<font color=red>' + (xlinesare[izero] + ' ').substring(startpos, eval(1 + startpos)) + '</font>');
zdebye=zdebye.replace((xlinesare[izero] + ' ').substring(eval(-30 + startpos), eval(1 + startpos)), (xlinesare[izero] + ' ').substring(eval(-30 + startpos), eval(0 + startpos)) + '<font color=red>' + (xlinesare[izero] + ' ').substring(startpos, eval(1 + startpos)) + '</font>');
} else {
zdebye=zdebye.replace((xlinesare[izero] + ' ').substring(startpos, eval(30 + startpos)), '<font color=red>' + (xlinesare[izero] + ' ').substring(startpos, eval(1 + startpos)) + '</font>' + (xlinesare[izero] + ' ').substring(eval(1 + startpos), eval(30 + startpos)));
}
izero++;
for (jb=izero; jb<xlinesare.length; jb++) {
if (kb <= eval('' + linesare.length)) {
outstris+=(xlinesare[jb] + ' ').substring(startpos, eval(1 + startpos));
if (startpos > 50) {
zdebye=zdebye.replace((xlinesare[jb] + ' ').substring(eval(-30 + startpos), eval(1 + startpos)), (xlinesare[jb] + ' ').substring(eval(-30 + startpos), eval(0 + startpos)) + '<font color=red>' + (xlinesare[jb] + ' ').substring(startpos, eval(1 + startpos)) + '</font>');
} else {
zdebye=zdebye.replace((xlinesare[jb] + ' ').substring(startpos, eval(30 + startpos)), '<font color=red>' + (xlinesare[jb] + ' ').substring(startpos, eval(1 + startpos)) + '</font>' + (xlinesare[jb] + ' ').substring(eval(1 + startpos), eval(30 + startpos)));
}
}
kb++;
}
goutstris=outstris;
delayis=500;
setTimeout(afterbit, delayis);
//alert('izero=' + izero + ' ' + outstris + ' up or down');
} else {
outstris='';
}
}
//alert('string potentially ' + linesare.length + ' long starting at ' + eval(onepos % 100) + ' and ending at ' + eval(eval(onepos + eval('' + outstris.length)) % 100));
}
return outstris;
}
function mc(insiss) {
var dt='';
if (insiss.indexOf(String.fromCharCode(10)) == -1) { // && eval('' + insiss.length) < 100) {
dt+=('no cr found ');
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
if (eval('' + insiss.length) >= 46) {
return ' ';
}
}
} else if (!updownallowed && !diagonalsallowed) {
dt+=(' ... oops ... ');
return ' ';
} else {
dt+=(' why when cr found ');
}
dt+=(' at end ... ' + eval('' + insiss.length) + ' ' + insiss.replace(String.fromCharCode(10),'*'));
console.log(dt); //document.getElementById('myh4').innerHTML=dt;
return insiss;
}
function afterbit() {
if (goutstris == '') { return ''; }
var revsis='';
var documentgetSelectiontoString=goutstris;
if (eval('' + mc(documentgetSelectiontoString).length) == 3) { // >= 4) {
goutstris='';
if (zdebye != '') {
document.getElementById('underlay').innerHTML=zdebye;
}
//document.getElementById('emailsms').style.display='table-cell';
document.getElementById('mytao').title=documentgetSelectiontoString;
aemailurl=origemailurl + encodeURIComponent(documentgetSelectiontoString);
document.getElementById('aemail').href=aemailurl;
asmsurl=origsmsurl + encodeURIComponent(String.fromCharCode(10) + documentgetSelectiontoString);
document.getElementById('asms').href=asmsurl;
for (var irev=eval(-1 + eval('' + documentgetSelectiontoString.length)); irev>=0; irev--) {
revsis+=documentgetSelectiontoString.substring(irev, eval(1 + irev));
}
console.log(documentgetSelectiontoString);
subscore=eval(0 - eval('' + documentgetSelectiontoString.length));
console.log('../PHP/surprise.php?min=' + eval(1 + eval('' + documentgetSelectiontoString.length)) + '&max=' + eval(1 + eval('' + documentgetSelectiontoString.length)) + '&firstJUNKname=y&youllneverfindthis=y' + '&iswordthere=' + documentgetSelectiontoString.toLowerCase());
if (!backwardsallowed) {
setTimeout(retry, 2000);
document.getElementById('nameif').title='';
} else {
setTimeout(retry, 8000);
document.getElementById('mytao').style.cursor='progress';
document.getElementById('nameif').title='../PHP/surprise.php?miZn=' + eval(1 + eval('' + documentgetSelectiontoString.length)) + '&maZx=' + eval(1 + eval('' + documentgetSelectiontoString.length)) + '&firstJUNKname=y&youllneverfindthis=y' + '&second=y&iswordthere=' + encodeURIComponent(revsis);
}
document.getElementById('nameif').src='../PHP/surprise.php?miZn=' + eval(1 + eval('' + documentgetSelectiontoString.length)) + '&maZx=' + eval(1 + eval('' + documentgetSelectiontoString.length)) + '&firstJUNKname=y&youllneverfindthis=y' + '&iswordthere=' + encodeURIComponent(documentgetSelectiontoString.toLowerCase());
} else {
document.getElementById('mytao').style.cursor='not-allowed';
document.body.title=notify('Already tried.');
}
return goutstris;
}
if (1 == 1) {
// addEventListener version
document.addEventListener('selectionchange', () => {
var revsis='';
var documentgetSelectiontoString=getmltrans(document.getSelection().toString());
if (eval('' + mc(documentgetSelectiontoString).length) == 3) { // >= 4) {
if (sofar.indexOf(';' + documentgetSelectiontoString + ';') == -1) {
sofar+=documentgetSelectiontoString + ';';
if (goutstris == '') {
//document.getElementById('emailsms').style.display='table-cell';
document.getElementById('mytao').title=documentgetSelectiontoString;
aemailurl=origemailurl + encodeURIComponent(documentgetSelectiontoString);
document.getElementById('aemail').href=aemailurl;
asmsurl=origsmsurl + encodeURIComponent(String.fromCharCode(10) + documentgetSelectiontoString);
document.getElementById('asms').href=asmsurl;
for (var irev=eval(-1 + eval('' + documentgetSelectiontoString.length)); irev>=0; irev--) {
revsis+=documentgetSelectiontoString.substring(irev, eval(1 + irev));
}
console.log(documentgetSelectiontoString);
subscore=eval(0 - eval('' + documentgetSelectiontoString.length));
console.log('../PHP/surprise.php?min=' + eval(1 + eval('' + documentgetSelectiontoString.length)) + '&max=' + eval(1 + eval('' + documentgetSelectiontoString.length)) + '&firstJUNKname=y&youllneverfindthis=y' + '&iswordthere=' + documentgetSelectiontoString.toLowerCase());
//setTimeout(retry, 8000);
//document.getElementById('mytao').style.cursor='progress';
findingnemo='';
if (!backwardsallowed) {
setTimeout(retry, 2000);
document.getElementById('nameif').title='';
} else {
setTimeout(retry, 8000);
document.getElementById('mytao').style.cursor='progress';
document.getElementById('nameif').title='../PHP/surprise.php?miZn=' + eval(1 + eval('' + documentgetSelectiontoString.length)) + '&maZx=' + eval(1 + eval('' + documentgetSelectiontoString.length)) + '&firstJUNKname=y&youllneverfindthis=y' + '&second=y&iswordthere=' + encodeURIComponent(revsis);
}
document.getElementById('nameif').src='../PHP/surprise.php?miZn=' + eval(1 + eval('' + documentgetSelectiontoString.length)) + '&maZx=' + eval(1 + eval('' + documentgetSelectiontoString.length)) + '&firstJUNKname=y&youllneverfindthis=y' + '&iswordthere=' + encodeURIComponent(documentgetSelectiontoString.toLowerCase());
}
} else {
goutstris='';
document.getElementById('mytao').style.cursor='not-allowed';
document.body.title=notify('Already tried.');
}
}
});
// addEventListener version
document.addEventListener('selectstart', () => {
document.getElementById('mytao').title='';
aemailurl=origemailurl;
asmsurl=origsmsurl;
document.getElementById('mytao').style.cursor='pointer'; //cscore('pointer', subscore);
document.body.title='';
console.log('Selection started '); // + document.getElementById('mytao').selectionStart + ' ' + document.getSelection() + '*' + document.getSelection().getRangeAt(0));
});
//document.getElementById('mytao').onfocus = function(event) {
// console.log('ss=' + event.target.selectionStart); //input.addEventListener('focus', caretController);
//}
}
if (window.self !== window.top) {
delayis=delayis;
} else {
const tx = document.getElementsByTagName("textarea"); // thanks to https://stackoverflow.com/questions/454202/creating-a-textarea-with-auto-resize
for (let i = 0; i < tx.length; i++) {
tx[i].setAttribute("style", "height:" + (tx[i].scrollHeight) + "px;overflow-y:hidden;");
tx[i].addEventListener("input", OnInput, false);
}
}
function lwn() {
lastwhat='';
}
function notify(what) {
//alert('anames[0]=' + anames[0] + ' and trysay=' + trysay);
if (what.trim() != '' && anames[0].replace('Player 1','').trim() != '') {
if (what.indexOf('orry') != -1 && what.indexOf(anames[curplayer]) == -1) {
if (what.indexOf('.') != -1) {
what=what.replace('.', ', ' + anames[curplayer] + '.');
} else {
what+=', ' + anames[curplayer];
}
}
if (what != lastwhat) {
lastwhat=what;
setTimeout(lwn, 8000);
document.getElementById('notif').src='./notifications_ideas.php?scheduledblurb=' + encodeURIComponent(what);
if (trysay) {
//alert('HTTP://localhost:8888/macos_say_record.php?andsoonclose=y&docronwork=say%20' + encodeURIComponent(what));
window.open('HTTP://localhost:8888/macos_say_record.php?andsoonclose=y&docronwork=say%20' + encodeURIComponent(what), 'sayif', 'top=50,left=50,width=500,height=500');
}
}
} else if (what == '') {
showIt('Score ' + document.getElementById('score').outerHTML.replace(/\ id\=/g, ' data-id=').replace(/\ on/g, ' data-on') + (' ' + (document.getElementById('smore').innerText || document.getElementById('smore').contentWindow || document.getElementById('smore').contentDocument)).replace(' undefined', ''));
}
//alert('what=' + what + ' to=' + what.replace(' ' + anames[curplayer], ' ' + fnames[curplayer]));
return what.replace(' ' + anames[curplayer], ' ' + fnames[curplayer]).replace(' ' + anames[sparecurplayer], ' ' + fnames[sparecurplayer]);
}
function OnInput() {
console.log('HeRE');
this.style.height = "auto";
this.style.height = (this.scrollHeight) + "px";
}
function caretController(myt) {
console.log('HerE');
caretPos = myt.selectionStart;
console.log('caret position:', caretPos);
}
setTimeout(lonl, 2000);
</script>
<iframe id=nameif title='' style=display:none; onload='checkname(this, false);' onerror='checkname(this, true);' src=></iframe>
<div id=underlay></div>
<div id=wunderlay style=display:none;></div>
<iframe id=notif style='display:none;' src=></iframe>
<iframe id=sayif name=sayif style='display:none;' src=></iframe>
<div id=others></div>
<div id=styleothers style=display:none;></div>
</body>
</html>