diff --git a/jstrr.js b/jstrr.js index a8d5aa9..c8eefdd 100644 --- a/jstrr.js +++ b/jstrr.js @@ -4,7 +4,7 @@ var ws; // for WebSocket Object var textlist = []; var nText = nText||4; - var nLine = nLine||2; + var nLine = nLine||3; var area = []; var team = {}, teamnames = new Set(), tmsel, nmsel, txsel; var mystate = {}; @@ -16,64 +16,6 @@ function setElementIDText(id, text) { document.getElementById(id).innerText = text; } - function xxx_fillText(text, column) { - var tx = text.replace(/\n/g, " ").replace(/\s+/, " "); - var array = [], pos=0, thisline=""; - var re = /(\S+\s+)/g; - var found = tx.split(" "); - console.log("found LEN="+found.length); - for (w of found) { - //console.log("tl="+w+", len="+w.length); - //console.log("thisllen="+thisline.length); - if (thisline.length + w.length < column) { - if (w.endsWith(".")) w += " "; - thisline += w+" "; - // console.log("THISLINE=["+thisline+"]"); - } else { - array.push(thisline.trim()); - //console.log("ArrayLen="+array.length); - //console.log("Array=["+array.join("/")+"]"); - thisline = ""; - } - } - if (thisline > "") array.push(thisline.trim()); - return array; - } - function xxx_loadTextToElement0(hash, elm1, elm2) { - let txt = hash.text, subtxt=""; - let array = txt.split("\n"), - b = 5, // number of buffer lines - number = Math.max(0, array.length-nLine-b); - let s; - let trial = 10; - if (!txt.match(/Article/)) trial = 1; - while (trial-- > 0 && !subtxt.match(/^(|\.\s+)[0-9A-Z]/)) { - s = Math.floor(Math.random()*number); - subtxt = array.slice(s, s+nLine+b).join("\n"); - // console.log("subtxt=["+subtxt+"]"); - } - if (txt[0] == "#") { // Maybe source of scripting languege - array = subtxt.split("\n"); - } else { - if (!subtxt.match(/^[0-9A-Z]/)) { - console.log("REP!!!!!!!! "+subtxt.substr(0, 10)); - subtxt.replace(/^.*?\. */, ""); - console.log("DONE: "+subtxt.substr(0, 10)); - } - array = fillText(subtxt, 40); - } - if (array.length > nLine) { - txt = ""; - for (let i=0; i