JSFiddle - React, Tailwind, and code Playground

by electronoob

HTML

paste in the scanner information found in empire>reports>guild><br><br><br> make sure to select the fleets option and click get report...<br> and then copy and paste the info into this box.<br>

<a target="_blank" href="https://i.imgur.com/Qy6eLcv.png"><img src=https://i.imgur.com/Qy6eLcvb.png></a>
<a target="_blank" href="https://i.imgur.com/v1eMruG.png"><img src=https://i.imgur.com/v1eMruGb.png></a>


<textarea id=report class=report onfocus="this.select();">
enemy fleet report goes here.
</textarea>
<br>
<br> our guild base list goes here.<br>
<textarea id=bases class=bases onfocus="this.select();">
list of OUR bases go in here. (run an empire->reports->guild and put the list of our BASES.
</textarea>
<br><br> the result pops out below:<br>
<input type="button" onclick="gogogo('greater');" value="GREATER THAN">
<input value="601" id="maxfleetsize">
<input type="button" onclick="gogogo('less');" value="LESS THAN">
<div id=output class=output onfocus="this.select();"></div>
<div id=gals class=gals onfocus="this.select();"></div>

CSS

textarea {
  border: 11px inset #ccc;
  width: calc(100% - 22px);
  height: 200px;
}

div#output {
  border: 11px inset #faa;
  width: calc(100% - 22px);
}

.noshow {
  display: none;
}

JavaScript

window.gogogo = function(gtlt) {
  //report, bases
  let buffer = {};
  buffer.bases = document.getElementById("bases").value;
  buffer.report = document.getElementById("report").value;
  buffer.bases = buffer.bases.split("\n");
  buffer.report = buffer.report.split("\n");
  let sizes = {};
  sizes.bases = buffer.bases.length;
  sizes.report = buffer.report.length;
  let store = {};
  store.bases = [];
  store.report = [];
  store.basesByLocation = [];
  store.fleetsByLocation = [];
  store.matches = [];
  store.regions = [];
  let i;
  for (i = 0; i < sizes.bases; i++) {
    let str = buffer.bases[i];
    let tok = str.split("\t");
    let name = tok[0];
    let base = tok[1];
    let location = tok[2];
    let path = {};
    if (location) {
      path = location.split(":");
      let data = {
        location: location,
        path: path,
        owner: name
      };
      store.bases.push(data);
      if (!Array.isArray(store.basesByLocation[path[0] + path[1]])) {
        store.basesByLocation[path[0] + path[1]] = [];
      }
      store.basesByLocation[path[0] + path[1]].push(data);
      store.regions.push(path[0] + path[1]);
    }
  }
	store.regions = Array.from(new Set(store.regions));
  for (i = 0; i < sizes.report; i++) {
    let str = buffer.report[i];
    let tok = str.split("\t");
    let name = tok[0];
    let location = tok[1];
    let size = -1;
    let age = -1;
    if(tok.length === 5) {
      size = parseInt(String(tok[3]).replace(",", ""));
      age = tok[4];
    } 
    if(tok.length === 4) {
      size = parseInt(String(tok[2]).replace(",", ""));
      age = tok[3];
    }
 
    console.log(tok.length, size);

    let path = {};
    if (location) {
      path = location.split(":");
      let search = path[0] + path[1];
      let data = {
        location: location,
        path: path,
        owner: name,
        size: size,
        age: age
      };
      if (!Array.isArray(store.fleetsByLocation[path[0] + path[1]])) {
       ...