<html>
<head>
<title>Word Find Game - RJM Programming - July, 2022</title>
<style>
 textarea {
    font-family: Courier New;
    font-size: 20px;
    opacity: 0.9;
    z-index: 9;
    padding: 0 0 0 0;
    margin: 0 0 0 0;
    
 }
 
 #underlay {
    font-family: Courier New;
    font-size: 20px;
    opacity: 0.3;
    z-index: 1;
    padding: 0 0 0 0;
    margin: 0 0 0 0;
 }
 
 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;
 }
</style>
</head>
<body title='' onload='setTimeout(mytaow, 2000);'>
<h1>Word Find Game <select onchange="restart(this);"><option value="hard">Hard</option><option value="easy">Easy</option><option value="easier">Easier</option><option value="easiest">Easiest</option></select> <span id=curbit>for</span> <select id=numsel onchange='nparrange(this);'><option 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></h1>
<h3>RJM Programming - August, 2022 ... Score <span id=score>0/0</span> ... <span id=blurb>Forwards, backwards, up, down, diagonal 4 letters or more highlight below</span></h3>
<h4 id=myh4>Thanks to <a target=_blank title='https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API' href='//developer.mozilla.org/en-US/docs/Web/API/Selection_API'>Selection API</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 numplayers=1;
 var curplayer=0;
 var ascores=[0], agoes=[0];
 var backwardsallowed=true;
 var updownallowed=true;
 var diagonalsallowed=true;
 var zdebye='';
 var zzdebye='';
 var lastzdebye='';
 var goutstris='';
 var delayis=0;
 var sofar=';';
 var score=0, goes=0, subscore=0;
 var letters=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];
 var ebye='', ibye=0, jbye=0, debye='', aletter=' ';
 for (ibye=0; ibye<20; ibye++) {
 for (jbye=0; jbye<100; jbye++) {
 aletter=letters[Math.floor(Math.random() * letters.length)];
 ebye+=aletter;
 debye+=aletter;
 } 
 ebye+=String.fromCharCode(10);
 debye+='<br>';
 } 
 document.write("<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='';
 
 function nparrange(sio) {
   if (eval('' + sio.value) > eval('' + ascores.length)) {
     while (eval('' + sio.value) > eval('' + ascores.length)) {
       ascores.push(0);
       agoes.push(0);
     }
     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 + '<font color=green>' + ascores[inp] + '</font>';
       cgoes+=betw + '<font color=green>' + agoes[inp] + '</font>';
       betw=':<font color=red>';
     } else {
       cscores+=betw + ascores[inp] + betw.replace(':','').replace('<font color=red>', '</font>').replace('<font color=green>', '</font>');
       cgoes+=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 (sio.value == 'hard') { location.href=document.URL; }
   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(', diagonal', '');
     myblurb=myblurb.replace(', up, down', '');
     myblurb=myblurb.replace(', backwards', '');
     backwardsallowed=false;
     updownallowed=false;
     diagonalsallowed=false;
   }
   if (sio.value == 'easier') {
     myblurb=myblurb.replace(', diagonal', '');
     myblurb=myblurb.replace(', up, down', '');
     myblurb=myblurb.replace('Forwards 4', 'Forwards, backwards 4');
     backwardsallowed=true;
     updownallowed=false;
     diagonalsallowed=false;
   }
   if (sio.value == 'easy') {
     myblurb=myblurb.replace('Forwards 4', 'Forwards, backwards, up, down, diagonal 4');
     myblurb=myblurb.replace('Forwards, backwards 4', 'Forwards, backwards, up, down, diagonal 4');
     backwardsallowed=true;
     updownallowed=true;
     diagonalsallowed=true;
   }
 document.getElementById('blurb').innerHTML=myblurb;
 ebye='';
 ibye=0;
 jbye=0;
 debye='';
 aletter=' ';
 for (ibye=0; ibye<20; ibye++) {
 for (jbye=0; jbye<100; jbye++) {
 aletter=letters[Math.floor(Math.random() * letters.length)];
 ebye+=aletter;
 debye+=aletter;
 } 
 ebye+=String.fromCharCode(10);
 debye+='<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;
 }
 
 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;   
 }
 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 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(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(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=cscore('pointer', subscore);
   }
 }
 
 function cscore(cursortype, ssc) {
   if (lastzdebye != zdebye && lastzdebye != zzdebye) {
   if (ssc != 0) { goes++; }
   if (ssc > 0) { 
     score+=ssc; 
    if (zzdebye.indexOf('<font') != -1) { // && zdebye.indexOf('<font') == -1) {
    zdebye=zzdebye;
    }
    if (zdebye.indexOf('<font') != -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 (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) {
    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) {
   if (ssc == 0) { return ''; }
   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 + '<font color=green>' + ascores[inp] + '</font>';
       cgoes+=betw + '<font color=green>' + agoes[inp] + '</font>';
       betw=':<font color=red>';
       if (eval(1 + inp) >= eval('' + ascores.length)) { cscores='<font color=red>' + cscores.replace(':','</font>:');  cgoes='<font color=red>' + cgoes.replace(':','</font>:');  }
     } else {
       cscores+=betw + ascores[inp] + betw.replace(':','').replace('<font color=red>', '</font>').replace('<font color=green>', '</font>');
       cgoes+=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;
   curplayer++;
   if (curplayer >= eval('' + ascores.length)) { curplayer=0;  }
   document.getElementById('curbit').innerHTML='for <font color=green>' + eval(1 + eval('' + curplayer)) + '</font> of';
   score=eval('' + ascores[curplayer]);
   goes=eval('' + agoes[curplayer]);
   } else {
   ascores[curplayer]=score;
   agoes[curplayer]=goes;
   document.getElementById('score').innerHTML='' + score + '/' + goes;
   }
   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=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=cscore('pointer', 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=cscore('pointer', 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=cscore('pointer', subscore);
          }
       } else {
  console.log('checkname5 ' + ifnd);
          //alert('WhY?');
   document.getElementById('mytao').style.cursor=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=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) >= 4) { 
    if (onepos != -1) {
      zzdebye=zzdebye.replace(outstris, '<font color="red">' + outstris + '</font>');
      //alert(zzdebye);
    }
    return outstris; 
  }
  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) >= 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='Already tried.';
  }
  return goutstris;
}
 
// addEventListener version
document.addEventListener('selectionchange', () => {
  var revsis='';
  var documentgetSelectiontoString=getmltrans(document.getSelection().toString());
  if (eval('' + mc(documentgetSelectiontoString).length) >= 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';
  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='Already tried.';
  }
  }
});
// addEventListener version
document.addEventListener('selectstart', () => {
  document.getElementById('mytao').title='';
  aemailurl=origemailurl;
  asmsurl=origsmsurl;
  document.getElementById('mytao').style.cursor=cscore('pointer', subscore);
  document.body.title='';
  console.log('Selection started');
});
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 OnInput() {
  this.style.height = "auto";
  this.style.height = (this.scrollHeight) + "px";
}
</script>
<iframe id=nameif title='' style=display:none; onload='checkname(this, false);' onerror='checkname(this, true);' src=></iframe>
<div id=underlay></div>
<div id=others></div>
</body>
</html>