<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Textarea Pointing - RJM Programming - December, 2017</title>
<script type='text/javascript'>

var focusto='motherboard';
var nextsuffix='2';
var firstoh='', x, y;
var dscriptih='<style> </style>';
var fontf='Arial';
var fonts='12px';
var fontc='#000000';
var fontw='normal';
var lastfontf='Arial';
var lastfonts='12px';
var lastfontc='#000000';
var lastfontw='normal';
var cmode=true;
var etosofar='';
var celem=null;
var ccontext=null;
var ccounter=0,cco=0;
var durl='';
var namefont='Arial_12px_normal';
var learnfont=false;
var learnfontmode='BOTH';
var pntwo='';
var cca=32;
var done=false;
var shouldmaintain=false;
var docurl=document.URL;
var sels='';
var iuc=false;
var dynamiccanvas=false;
var taipos=-1, tajpos=-1;
var local_font='';
var local_coords='';
var mousePosition = {x:0, y:0};
var cccmd='', ccmds=[];
var gotakeypress='';

function ccmdspush(what) {
cccmd+=' ' + what;
ccmds.push(what);
//document.title=what;
}


function plotit(charsare, tx, ty) {
var ico=0, css='#000000', lastcss='#000000', minx=0, maxx=0, miny=0, maxy=0;
var coordsare=[], xfactor=1.0, yfactor=1.0, twelve=12,cf='';
var xfontf=fontf;
var xfontw=fontw;
var xfonts=fonts;
if (dynamiccanvas && local_font != '') {
if (local_coords.indexOf(',') == -1) {
if (document.getElementById(focusto).outerHTML.indexOf('font-family:') != -1) xfontf=fmap((document.getElementById(focusto).outerHTML + ';').split('ont-family:')[1].split(';')[0]);
if (document.getElementById(focusto).outerHTML.indexOf('font-style:') != -1) xfontw=(document.getElementById(focusto).outerHTML + ';').split('ont-style:')[1].split(';')[0];
if (document.getElementById(focusto).outerHTML.indexOf('font-size:') != -1) xfonts=(document.getElementById(focusto).outerHTML + ';').split('ont-size:')[1].split(';')[0];
cf = xfontw.replace('normal','') + " " + xfonts + " " + xfontf;
twelve=eval(xfonts.split('p')[0]);
ccontext.font = cf;
ccontext.fillStyle='#000000'; //(charsare,tx,ty);
ccontext.fillText(charsare,eval(tx),eval(ty));
ccmdspush("ccontext.font = '" + cf + "'; ");
ccmdspush("ccontext.fillStyle='#000000'; ");
ccmdspush("ccontext.fillText(String.fromCharCode(" + charsare.charCodeAt() + ")," + eval(tx) + "," + eval(ty) + "); ");

//alert(cf + ' charsare=' + charsare + ' ' + tx + ',' + ty);
} else {
ty-=eval(document.getElementById('fonts').value.split('p')[0]);
coordsare=(' ' + local_coords).split(',');
//alert(coordsare.length);
var xx="";
for (ico=1; ico<coordsare.length; ico+=2) {
if (ico == 1) {
minx=Math.floor(Math.abs(eval(coordsare[-1 + ico])));
maxx=Math.floor(Math.abs(eval(coordsare[-1 + ico])));
miny=Math.floor(Math.abs(eval(coordsare[ico])));
maxy=Math.floor(Math.abs(eval(coordsare[ico])));
} else {
if (minx > Math.floor(Math.abs(eval(coordsare[-1 + ico])))) {
minx=Math.floor(Math.abs(eval(coordsare[-1 + ico])));
}
if (maxx < Math.floor(Math.abs(eval(coordsare[-1 + ico])))) {
maxx=Math.floor(Math.abs(eval(coordsare[-1 + ico])));
}
if (miny > Math.floor(Math.abs(eval(coordsare[ico])))) {
miny=Math.floor(Math.abs(eval(coordsare[ico])));
}
if (maxy < Math.floor(Math.abs(eval(coordsare[ico])))) {
maxy=Math.floor(Math.abs(eval(coordsare[ico])));
}
}
xx+=' ' + ico;
}
//alert(xx);
maxy+=miny;
maxx+=minx;
xfactor=eval(eval(0.0 + eval(eval(5) / eval(8)) * eval(document.getElementById('fonts').value.split('p')[0])) / eval(0.0 + maxx));
yfactor=eval(eval(0.0 + eval(document.getElementById('fonts').value.split('p')[0])) / eval(0.0 + maxy));
xx='';
for (ico=1; ico<coordsare.length; ico+=2) {
if (('' + coordsare[ico]).indexOf('.') != -1) {
css='#' + ('000' + ('' + eval(('' + coordsare[ico]).split('.')[1].substring(0,3)).toString(16))).slice(-2) + ('000' + ('' + eval(('' + coordsare[ico]).split('.')[1].substring(3,6)).toString(16))).slice(-2) + ('000' + ('' + eval(('' + coordsare[ico]).split('.')[1].substring(6,9)).toString(16))).slice(-2);
}
//alert('' + coordsare[-1 + ico] + ' ' + coordsare[ico] + ' ' + ' ' + xfactor + ' ' + yfactor + ' ' + local_coords + ' maxx=' + maxx + ' maxy=' + maxy + ' ' + eval(eval(tx) + Math.floor(xfactor * Math.abs(eval(coordsare[-1 + ico])))) + ' ' + eval(eval(ty) + Math.floor(yfactor * Math.abs(eval(coordsare[ico])))));
if (ico == 1) {
ccontext.beginPath();
ccontext.strokeStyle=css;
ccontext.moveTo(eval(eval(tx) + Math.floor(xfactor * Math.abs(eval(coordsare[-1 + ico])))),eval(eval(ty) + Math.floor(yfactor * Math.abs(eval(coordsare[ico])))));
ccmdspush("ccontext.beginPath(); ");
ccmdspush("ccontext.strokeStyle='" + css + "'; ");
ccmdspush("ccontext.moveTo(" + eval(eval(tx) + Math.floor(xfactor * Math.abs(eval(coordsare[-1 + ico]))))+ "," + eval(eval(ty) + Math.floor(yfactor * Math.abs(eval(coordsare[ico])))) + "); ");
xx+=' ' + " move to " + eval(eval(tx) + Math.floor(xfactor * Math.abs(eval(coordsare[-1 + ico]))))+ "," + eval(eval(ty) + Math.floor(yfactor * Math.abs(eval(coordsare[ico])))) + "); ";
} else if (('' + coordsare[ico]).indexOf('-') != -1 || ('' + coordsare[-1 + ico]).indexOf('-') != -1 || eval(('' + coordsare[-1 + ico])) < 0 || eval(('' + coordsare[ico])) < 0) {
ccontext.stroke();
ccontext.beginPath();
ccmdspush("ccontext.stroke(); ");
ccmdspush("ccontext.beginPath(); ");
if (css != lastcss) {
ccontext.strokeStyle=css;
ccmdspush("ccontext.strokeStyle='" + css + "'; ");
}


//alert('' + eval(eval(tx) + Math.floor(xfactor * Math.abs(eval(coordsare[-1 + ico])))) + ',' + eval(eval(ty) + Math.floor(yfactor * Math.abs(eval(coordsare[ico])))));
ccontext.moveTo(eval(eval(tx) + Math.floor(xfactor * Math.abs(eval(coordsare[-1 + ico])))),eval(eval(ty) + Math.floor(yfactor * Math.abs(eval(coordsare[ico])))));
ccmdspush("ccontext.moveTo(" + eval(eval(tx) + Math.floor(xfactor * Math.abs(eval(coordsare[-1 + ico]))))+ "," + eval(eval(ty) + Math.floor(yfactor * Math.abs(eval(coordsare[ico])))) + "); ");
xx+=' ' + " move to " + eval(eval(tx) + Math.floor(xfactor * Math.abs(eval(coordsare[-1 + ico]))))+ "," + eval(eval(ty) + Math.floor(yfactor * Math.abs(eval(coordsare[ico])))) + "); ";
} else {
if (css != lastcss) {
ccontext.strokeStyle=css;
ccmdspush("ccontext.strokeStyle='" + css + "'; ");
}
ccontext.lineTo(eval(eval(tx) + Math.floor(xfactor * Math.abs(eval(coordsare[-1 + ico])))),eval(eval(ty) + Math.floor(yfactor * Math.abs(eval(coordsare[ico])))));
ccmdspush("ccontext.lineTo(" + eval(eval(tx) + Math.floor(xfactor * Math.abs(eval(coordsare[-1 + ico]))))+ "," + eval(eval(ty) + Math.floor(yfactor * Math.abs(eval(coordsare[ico])))) + "); ");
xx+=' ' + " " + eval(eval(tx) + Math.floor(xfactor * Math.abs(eval(coordsare[-1 + ico]))))+ "," + eval(eval(ty) + Math.floor(yfactor * Math.abs(eval(coordsare[ico])))) + "); ";
}
}
//alert(xx);
ccontext.stroke();
ccontext.beginPath();
if (1 == 2) {
ccmds[-1 + ccmds.length]="ccontext.stroke(); ";
} else {
ccmdspush("ccontext.stroke(); ");
}
ccmdspush("ccontext.beginPath(); ");
//document.getElementById('bcanvas').click(); //?
}
}
}

function fmap(inff) {
if (learnfont) {
if (localStorage && inff.split('_')[0].split('-')[0] != inff) {
if (localStorage.getItem('fd_' + inff) != '') {
if (local_font == '') {
local_font=localStorage.getItem('fd_' + inff);
//alert(inff + '34:' + local_font);
local_font=decodeURIComponent(local_font);
if (local_font == null) local_font='';
}
dynamiccanvas=true;
if (taipos < 0) {
taipos=0;
tajpos=0;
}
return inff.split('_')[0].split('-')[0];
}
}
}
return inff;
}


function clone() {
var secondoh=firstoh.replace("z-index:1;","z-index:" + nextsuffix + ";").replace(" ", " class='mboard" + nextsuffix + "' ");
//secondoh=secondoh.replace(/300/g,"100");
secondoh=secondoh.replace("top:0px;","top:" + y + "px;");
secondoh=secondoh.replace("left:0px;","left:" + x + "px;");
secondoh=secondoh.replace(/motherboard/g,"motherboard" + nextsuffix);
secondoh=secondoh.replace("font-family:" + fmap(fontf) + ";","font-family:" + fmap(document.getElementById('fontf').value) + ";");
secondoh=secondoh.replace("font-size:" + fonts + ";","font-size:" + document.getElementById('fonts').value + ";");
secondoh=secondoh.replace("font-style:" + fontw + ";","font-style:" + document.getElementById('fontw').value + ";");
secondoh=secondoh.replace("color:" + fontc + ";","color:" + document.getElementById('fontc').value + ";");
secondoh=secondoh.replace("font-family:" + fmap(fontf) + ";","font-family:" + fmap(document.getElementById('fontf').value) + ";");
secondoh=secondoh.replace("font-size:" + fonts + ";","font-size:" + document.getElementById('fonts').value + ";");
secondoh=secondoh.replace("font-style:" + fontw + ";","font-style:" + document.getElementById('fontw').value + ";");
secondoh=secondoh.replace("color:" + fontc + ";","color:" + document.getElementById('fontc').value + ";");

secondoh=secondoh.replace("font-family:" + fmap(lastfontf) + ";","font-family:" + fmap(document.getElementById('fontf').value) + ";");
secondoh=secondoh.replace("font-size:" + lastfonts + ";","font-size:" + document.getElementById('fonts').value + ";");
secondoh=secondoh.replace("font-style:" + lastfontw + ";","font-style:" + document.getElementById('fontw').value + ";");
secondoh=secondoh.replace("color:" + lastfontc + ";","color:" + document.getElementById('fontc').value + ";");
secondoh=secondoh.replace("font-family:" + fmap(lastfontf) + ";","font-family:" + document.getElementById('fontf').value + ";");
secondoh=secondoh.replace("font-size:" + lastfonts + ";","font-size:" + document.getElementById('fonts').value + ";");
secondoh=secondoh.replace("font-style:" + lastfontw + ";","font-style:" + document.getElementById('fontw').value + ";");
secondoh=secondoh.replace("color:" + lastfontc + ";","color:" + document.getElementById('fontc').value + ";");

//alert("color:" + fontc + ";" + "," + "color:" + document.getElementById('fontc').value + ";" + " " + secondoh);
dscriptih=dscriptih.replace('</style>', ' .mboard' + nextsuffix + ' { width: calc(85% - ' + x + 'px); } </style>');
document.getElementById('dscript').innerHTML=dscriptih;
focusto="motherboard" + nextsuffix;
nextsuffix='' + eval(eval(nextsuffix) + 1);
return secondoh;
}

function clicksup(event) {
//alert('You clicked');
var thissuffix=nextsuffix;
var prevval='';
var prevo=null;
if (document.getElementById(focusto)) {
prevval=document.getElementById(focusto).value;
prevo=document.getElementById(focusto);
}
if (event.clientX || event.clientY) {
x = event.clientX;
y = event.clientY;
mousePosition.x = x;
mousePosition.y = y;
} else {
x = event.pageX;
y = event.pageY;
mousePosition.x = x;
mousePosition.y = y;
}
taipos=0;
tajpos=0;
if (1 == 1) {
//if (document.getElementById('d' + thissuffix)) alert(prevval + 'should be okay if prefixed by something');
document.getElementById('d' + thissuffix).innerHTML=clone() + "<div id='d" + eval(1 + eval(thissuffix)) + "'></div>";
} else {
document.getElementById('myform').innerHTML+=clone();
}
if (document.getElementById(focusto)) {
if (document.getElementById(focusto).title) {
document.getElementById(focusto).title=document.getElementById(focusto).title.replace("font-family:" + fmap(fontf) + ";","font-family:" + fmap(document.getElementById('fontf').value) + ";");
document.getElementById(focusto).title=document.getElementById(focusto).title.replace("font-size:" + fonts + ";","font-size:" + document.getElementById('fonts').value + ";");
document.getElementById(focusto).title=document.getElementById(focusto).title.replace("font-style:" + fontw + ";","font-style:" + document.getElementById('fontw').value + ";");
document.getElementById(focusto).title=document.getElementById(focusto).title.replace("color:" + fontc + ";","color:" + document.getElementById('fontc').value + ";");
document.getElementById(focusto).title=document.getElementById(focusto).title.replace("font-family:" + fmap(lastfontf) + ";","font-family:" + fmap(document.getElementById('fontf').value) + ";");
document.getElementById(focusto).title=document.getElementById(focusto).title.replace("font-size:" + lastfonts + ";","font-size:" + document.getElementById('fonts').value + ";");
document.getElementById(focusto).title=document.getElementById(focusto).title.replace("font-style:" + lastfontw + ";","font-style:" + document.getElementById('fontw').value + ";");
document.getElementById(focusto).title=document.getElementById(focusto).title.replace("color:" + lastfontc + ";","color:" + document.getElementById('fontc').value + ";");
ael(document.getElementById(focusto));
}
}
//alert(prevo.id + ' ... ' + prevval);
//prevo.value=prevval;
if (prevo != null) prevo.innerHTML=prevval;
dofocus();
//alert(document.getElementById('myform').innerHTML);
}

function dumclickmysup(event) {
}

function pbtas() {
document.getElementById('ccanvas').style.zIndex=-9;
document.getElementById('dcanvas').style.zIndex=-9;
document.getElementById('dcanvas').style.display='none';
document.getElementById('ccanvas').style.display='none';
document.getElementById('icanvas').style.display='none';
document.getElementById('jcanvas').style.display='none';
document.getElementById('kcanvas').style.display='none';
document.getElementById('lcanvas').style.display='none';
document.getElementById('mcanvas').style.display='none';
document.getElementById('ncanvas').style.display='none';
document.getElementById('nrotate').style.display='none';
document.getElementById('ndrotate').style.display='none';
document.getElementById('dddcanvas').style.display='none';
document.getElementById('bcanvas').value='Canvas';
}

function preotestcanvas() {
if (cco > 0) {
cco--;
}
if (cco > 0) setTimeout(preotestcanvas, 100);
}

function pretestcanvas() {
if (ccounter > 0) {
ccounter--;
}
if (ccounter > 0) setTimeout(pretestcanvas, 100);
}

function testcanvas(wcan,isc) {
if (ccounter == 0 && isc != 0) {
ccounter=10;
setTimeout(pretestcanvas, 100);
} else if (cco == 0 && isc == 0) {
cco=10; //20;
setTimeout(preotestcanvas, 100);
} else if (ccounter > 5 && isc != 0) {
//wcan.style.zIndex=-9;
//wcan.style.display='none';
pbtas();
} else if (cco > 5 && isc == 0) {
//wcan.style.zIndex=-9;
//wcan.style.display='none';
pbtas();
}
}

function ael(ota) {
var cevent='keypress';
if (navigator.userAgent.toLowerCase().indexOf('firefox') != -1 && 1 == 2) {
cevent='keydown';
ota.addEventListener('keypress', function(keyPressEvent){
var xbits=[];
if (keyUpEvent.shiftKey) {
iuc=true;
}
if (keyPressEvent.keyCode >= 32 && !keyPressEvent.shiftKey) {
iuc=false;
}
if (keyPressEvent.which !== 0) {
if (iuc && keyUpEvent.keyCode >= 32 && 1 == 1) {
gotakeypress=String.fromCharCode(keyPressEvent.keyCode).toUpperCase();
} else if (keyUpEvent.keyCode >= 32 && 1 == 1) {
gotakeypress=String.fromCharCode(keyPressEvent.keyCode).toLowerCase();
}
}
}, false);

}

ota.addEventListener(cevent, function(keyUpEvent){
//var divLog = document.querySelector('#log'),
// log = 'x:' + mousePosition.x + ' * y: ' + mousePosition.y,
// p = document.createElement('p').innerHTM = log;
// divLog.appendChild(p);
//var valuec = this.value + String.fromCharCode((keyUpEvent.which || keyUpEvent.keyCode));
var xbits=[];
if (keyUpEvent.shiftKey) {
iuc=true;
}
if ((keyUpEvent.which || keyUpEvent.keyCode) >= 32 && !keyUpEvent.shiftKey) {
iuc=false;
}
if (iuc && (keyUpEvent.which || keyUpEvent.keyCode) >= 32 && 1 == 1) {
if (taipos > 0) mousePosition.x += eval(eval(5) * eval(document.getElementById('fonts').value.split('p')[0]) / eval(8));
taipos++;
if (dynamiccanvas && local_font != '') {
//alert(0);
if (local_font.indexOf(".000000000" + ("000" + String.fromCharCode((keyUpEvent.which || keyUpEvent.keyCode)).toUpperCase().charCodeAt()).slice(-3) + ",") != -1) {
xbits=local_font.split(".000000000" + ("000" + String.fromCharCode((keyUpEvent.which || keyUpEvent.keyCode)).toUpperCase().charCodeAt()).slice(-3) + ",");
} else if (local_font.indexOf(".000000000" + ("000" + String.fromCharCode((keyUpEvent.which || keyUpEvent.keyCode)).toUpperCase().charCodeAt()).slice(-3) + ";") != -1) {
xbits=local_font.split(".000000000" + ("000" + String.fromCharCode((keyUpEvent.which || keyUpEvent.keyCode)).toUpperCase().charCodeAt()).slice(-3) + ";");
}
//alert(2);
local_coords="";
if (xbits.length > 1) {
local_coords=xbits[1].split(".0000000001")[0].split(".0000000000")[0].split(".0000000002")[0].split(".0000000003")[0].split(".0000000004")[0].split(".0000000005")[0].split(".0000000006")[0].split(".0000000007")[0].split(".0000000008")[0].split(".0000000009")[0].replace(/\;/g,',-');
//alert(4);
}
if (gotakeypress != '') {
plotit(gotakeypress, mousePosition.x, mousePosition.y);
} else {
plotit(String.fromCharCode((keyUpEvent.which || keyUpEvent.keyCode)).toUpperCase(), mousePosition.x, mousePosition.y);
}
}
//document.title=(gotakeypress + '-' + (keyUpEvent.which || keyUpEvent.keyCode) + ':' + local_coords + ' pos:(' + eval(taipos - taipos) + ',' + tajpos + ')Value:' + String.fromCharCode((keyUpEvent.which || keyUpEvent.keyCode)).toUpperCase() + 'x:' + mousePosition.x + 'y:' + mousePosition.y + ' ' + local_coords + ' ' + local_font);
} else if (iuc && (keyUpEvent.which || keyUpEvent.keyCode) >= 32) {
//document.title=('pos:(' + taipos + ',' + tajpos + ')Value:' + String.fromCharCode((keyUpEvent.which || keyUpEvent.keyCode)).toUpperCase() + 'x:' + mousePosition.x + 'y:' + mousePosition.y + ' ' + local_coords + ' ' + local_font);
taipos++;
} else if ((keyUpEvent.which || keyUpEvent.keyCode) >= 32 && 1 == 1) {
if (taipos > 0) mousePosition.x += eval(eval(5) * eval(document.getElementById('fonts').value.split('p')[0]) / eval(8));
taipos++;
if (dynamiccanvas && local_font != '') {
//alert(10 + ' ... ' + ".000000000" + ("000" + String.fromCharCode((keyUpEvent.which || keyUpEvent.keyCode)).toLowerCase().charCodeAt()).slice(-3));
if (local_font.indexOf(".000000000" + ("000" + String.fromCharCode((keyUpEvent.which || keyUpEvent.keyCode)).toLowerCase().charCodeAt()).slice(-3) + ",") != -1) {
xbits=local_font.split(".000000000" + ("000" + String.fromCharCode((keyUpEvent.which || keyUpEvent.keyCode)).toLowerCase().charCodeAt()).slice(-3) + ",");
} else if (local_font.indexOf(".000000000" + ("000" + String.fromCharCode((keyUpEvent.which || keyUpEvent.keyCode)).toLowerCase().charCodeAt()).slice(-3) + ";") != -1) {
xbits=local_font.split(".000000000" + ("000" + String.fromCharCode((keyUpEvent.which || keyUpEvent.keyCode)).toLowerCase().charCodeAt()).slice(-3) + ";");
}
//alert(110 + ' +++ ' + local_font);
local_coords="";
if (xbits.length > 1) {
local_coords=xbits[1].split(".0000000001")[0].split(".0000000000")[0].split(".0000000002")[0].split(".0000000003")[0].split(".0000000004")[0].split(".0000000005")[0].split(".0000000006")[0].split(".0000000007")[0].split(".0000000008")[0].split(".0000000009")[0].replace(/\;/g,',-');
}
if (gotakeypress != '') {
plotit(gotakeypress, mousePosition.x, mousePosition.y);
} else {
plotit(String.fromCharCode((keyUpEvent.which || keyUpEvent.keyCode)).toLowerCase(), mousePosition.x, mousePosition.y);
}
}
//document.title=(gotakeypress + '-' + (keyUpEvent.which || keyUpEvent.keyCode) + ':' + local_coords + ' pos:(' + eval(taipos - taipos) + ',' + tajpos + ')value:' + String.fromCharCode((keyUpEvent.which || keyUpEvent.keyCode)).toLowerCase() + 'x:' + mousePosition.x + 'y:' + mousePosition.y + ' ' + local_coords + ' ' + local_font);
} else if ((keyUpEvent.which || keyUpEvent.keyCode) >= 32) {
//document.title=('pos:(' + taipos + ',' + tajpos + ')value:' + String.fromCharCode((keyUpEvent.which || keyUpEvent.keyCode)).toLowerCase() + 'x:' + mousePosition.x + 'y:' + mousePosition.y + ' ' + local_coords + ' ' + local_font);
taipos++;
} else if ((keyUpEvent.which || keyUpEvent.keyCode) == 13 && 1 == 1) {
if (taipos > 0) mousePosition.x -= eval(eval(-1 + taipos) * eval(5) * eval(document.getElementById('fonts').value.split('p')[0]) / eval(8));
mousePosition.y += eval(document.getElementById('fonts').value.split('p')[0]);
tajpos=0; //++;
taipos=0;
} else if ((keyUpEvent.which || keyUpEvent.keyCode) == 13) {
tajpos++;
taipos=0;
}
gotakeypress='';
}, false);

}

function dofocus() {
var val='', value=[];
if (document.getElementById('dcanvas')) {
if (document.getElementById('dcanvas').innerHTML == '') {

// Thanks to https://stackoverflow.com/questions/7562503/getting-mouse-position-in-keyboard-event
document.addEventListener('mousemove', function(mouseMoveEvent){
if (mouseMoveEvent.pageX) {
//mousePosition.x = mouseMoveEvent.pageX;
//mousePosition.y = mouseMoveEvent.pageY;
taipos=taipos;
tajpos=tajpos;
} else {
//mousePosition.x = mouseMoveEvent.clientX;
//mousePosition.y = mouseMoveEvent.clientY;
taipos=taipos;
tajpos=tajpos;
}
}, false);


ael(document.getElementById(focusto));

//document.addEventListener('keydown', function(keyDownEvent){
// iuc=false;
//}, false);

if (window.localStorage) {
for (var iq in window.localStorage) {
val = localStorage.getItem(iq);
if (val) {
//value = val.split(","); //splitting string inside array to get name
//alert(iq);
if (iq.substring(0,3) == 'tp_') {
document.getElementById('ssaveas').innerHTML+='<option value="' + iq.substring(3) + '">Recall "' + iq.substring(3) + '"</option>';
}
}
}
}
var celem_style_width='' + eval(window.getComputedStyle(document.getElementById('ibody'), null).getPropertyValue("width").replace('px','').replace('%','').replace('vh','') * 0.85) + 'px';
var celem_style_width100='' + eval(window.getComputedStyle(document.getElementById('motherboard'), null).getPropertyValue("width").replace('px','').replace('%','').replace('vh','') * 1.00) + 'px';
var celem_width='' + eval(window.getComputedStyle(document.getElementById('ibody'), null).getPropertyValue("width").replace('px','').replace('%','').replace('vh','') * 0.85);
//celem_width='' + eval(window.getComputedStyle(document.getElementById('motherboard'), null).getPropertyValue("width").replace('px','').replace('%','').replace('vh','') * 1.00) + 'px'; //0.85);
var celem_style_height='' + eval(window.getComputedStyle(document.getElementById('motherboard'), null).getPropertyValue("height").replace('px','').replace('%','').replace('vh','')) + 'px';
var celem_height='' + eval(window.getComputedStyle(document.getElementById('motherboard'), null).getPropertyValue("height").replace('px','').replace('%','').replace('vh','')) + 'px';
document.getElementById('dcanvas').innerHTML="<canvas onfocus=\"testcanvas(this,0);\" onclick=\"testcanvas(this,1);\" title=\"Double click me to reveal textareas again\" id=ccanvas style=\"position:absolute;display:block;z-index:-9;top:1500px;left:0px;width:100%;height:100%;\"></canvas>";
document.getElementById('ddcanvas').innerHTML="<br><span id=dddcanvas style=display:none;>    Canvas Image:     </span><img onclick=\"var imgwo=window.open('','_blank','top=0,left=0,width=" + celem_width + ",height=" + celem_height + "'); imgwo.document.write('<html><b' + 'ody><img title=Canvas src=' + this.src + '></img></b' + 'ody></html>');\" title=\"Image of canvas to left in new window\" id=icanvas style='width:45px;display:none;border:1px solid green;background-color:white;' src=''></img><img onclick=\"var imgwo=window.open('','_blank','top=0,left=0,width=" + celem_width + ",height=" + celem_height + "'); imgwo.document.write('<html><b' + 'ody><img style=background-color:#000000; title=Canvas src=' + this.src + '></img></b' + 'ody></html>');\" title=\"Inverse image of canvas to left in new window\" id=jcanvas style='width:45px;display:none;border:1px solid green;background-color:#000000;' src=''></img><img onclick=\"var imgwo=window.open('','_blank','top=0,left=0,width=" + celem_width + ",height=" + celem_height + "'); imgwo.document.write('<html><b' + 'ody><img title=Canvas src=' + this.src + '></img></b' + 'ody></html>');\" title=\"Grayscale image of canvas to left in new window\" id=kcanvas style='width:45px;display:none;border:1px solid green;background-color:white;' src=''></img><img onclick=\"var imgwo=window.open('','_blank','top=0,left=0,width=" + celem_width + ",height=" + celem_height + "'); imgwo.document.write('<html><b' + 'ody><img title=Canvas src=' + this.src + '></img></b' + 'ody></html>');\" title=\"Flipped image of canvas to left in new window\" id=lcanvas style='width:45px;display:none;border:1px solid green;background-color:white;' src=''></img><img onclick=\"var imgwo=window.open('','_blank','top=0,left=0,width=" + celem_width + ",height=" + celem_height + "'); imgwo.document.write('<html><b' + 'ody><img title=Canvas src=' + this.src + '></img></b' + 'ody></html>');\" title=\"Flopped image of canvas to left in new window\" id=mcanvas style='width:45px;display:none;border:1px solid green;background-color:white;' src=''></img> <div id=ndrotate style=display:none;>Clockwise <input onchange=rotate(1); onblur=rotate(1); step=1 value=0 min=0 max=359 type=number id=nrotate style=width:40px;display:none;></input>°</div> <img onclick=\"var imgwo=window.open('','_blank','top=0,left=0,width=" + eval(2 * celem_width) + ",height=" + eval(2 * celem_height) + "'); imgwo.document.write('<html><b' + 'ody><img title=Canvas src=' + this.src + '></img></b' + 'ody></html>');\" title=\"Rotated image of canvas to left in new window\" id=ncanvas style='width:45px;display:none;border:1px solid green;background-color:white;' src=''></img><br><div id='dpixel' style='display:none;'><input style=display:none; type=button id=inraster value=Rasterize onclick=\" if (learnfont) { setTimeout(pib,4000); learnfont=false; } document.getElementById('ipixel').style.display='none'; document.getElementById('mysubmit').click(); document.getElementById('ipixel').style.top='0px'; document.getElementById('ipixel').style.zIndex='99'; document.getElementById('ipixel').style.display='block'; location.href='#ipixel'; \"</input><hr></div><br> ";
celem=document.getElementById('ccanvas');
ccontext=celem.getContext("2d");
celem.style.width=celem_style_width; //'' + eval(window.getComputedStyle(document.body, null).getPropertyValue("width").replace('px','').replace('%','').replace('vh','') * 0.85) + 'px';
celem.width=celem_style_width; //'' + eval(window.getComputedStyle(document.body, null).getPropertyValue("width").replace('px','').replace('%','').replace('vh','') * 0.85);
celem.style.height=celem_style_height; //'' + eval(window.getComputedStyle(document.getElementById('motherboard'), null).getPropertyValue("height").replace('px','').replace('%','').replace('vh','')) + 'px';
celem.height=celem_style_height; //'' + eval(window.getComputedStyle(document.getElementById('motherboard'), null).getPropertyValue("height").replace('px','').replace('%','').replace('vh',''));
//alert(document.getElementById('ibody').style.width + ' vs ' + celem_style_width + ' ' + celem_style_width100 + ' ' + eval(window.getComputedStyle(document.body, null).getPropertyValue("width").replace('px','').replace('%','').replace('vh','') * 0.85));
//alert('Canvas clear');
document.getElementById('dcanvas').style.width=celem_style_width;
document.getElementById('dcanvas').style.height=celem_style_height;
//document.getElementById('dpixel').style.width=celem_style_width; //'' + eval(window.getComputedStyle(document.body, null).getPropertyValue("width").replace('px','').replace('%','').replace('vh','') * 0.85) + 'px';
//document.getElementById('dpixel').style.height=celem_style_height; //'' + eval(window.getComputedStyle(document.getElementById('motherboard'), null).getPropertyValue("height").replace('px','').replace('%','').replace('vh','')) + 'px';
document.getElementById('ipixel').style.width=celem_style_width; //'' + eval(window.getComputedStyle(document.body, null).getPropertyValue("width").replace('px','').replace('%','').replace('vh','') * 0.85) + 'px';
document.getElementById('ipixel').style.height=celem_style_height; //'' + eval(window.getComputedStyle(document.getElementById('motherboard'), null).getPropertyValue("height").replace('px','').replace('%','').replace('vh','')) + 'px';
}
}
if (firstoh == '') {
if (document.getElementById('motherboard2')) {
document.getElementById('motherboard').value=document.getElementById('motherboard').innerHTML.replace(/\<\;/g,"<").replace(/\>\;/g,">");
document.getElementById('motherboard').innerHTML='';
firstoh="<textarea alt='font-family:Arial;font-size:12px;color:#000000;font-style:normal;' onclick='clicksup(event);' title='Base Textarea to type away on or click/touch to reposition text' style='font-family:Arial;font-size:12px;font-style:normal;color:#000000;border:0px solid yellow;border-right:1px solid red;z-index:1;position:absolute;background-color:transparent;top:0px;left:0px;height:100vh;' id='moth" + "erboard' name='moth" + "erboard' cols=300 rows=300>" + "</textarea>";
while (document.getElementById('motherboard' + nextsuffix)) {
document.getElementById('motherboard' + nextsuffix).value=document.getElementById('motherboard' + nextsuffix).innerHTML.replace(/\<\;/g,"<").replace(/\>\;/g,">");
document.getElementById('motherboard' + nextsuffix).innerHTML='';
focusto="motherboard" + nextsuffix;
nextsuffix='' + eval(eval(nextsuffix) + 1);
}
firstoh=document.getElementById(focusto).outerHTML;
document.getElementById('fontf').focus();
} else {
cmode=false;
if (document.getElementById(focusto)) {
firstoh=document.getElementById(focusto).outerHTML;
} else {
firstoh="<textarea alt='font-family:Arial;font-size:12px;color:#000000;font-style:normal;' onclick='clicksup(event);' title='Base Textarea to type away on or click/touch to reposition text' style='font-family:Arial;font-size:12px;font-style:normal;color:#000000;border:0px solid yellow;border-right:1px solid red;z-index:1;position:absolute;background-color:transparent;top:0px;left:0px;height:100vh;' id='moth" + "erboard' name='moth" + "erboard' cols=300 rows=300>" + "</textarea>";
}
//alert(firstoh);
if (document.getElementById(focusto)) {
document.getElementById(focusto).style.width='85%';
document.getElementById(focusto).style.height='100vh';
document.getElementById(focusto).focus();
}
}
}
}

function altit(tv,ti) {
if (document.getElementById(focusto)) {
//alert(43 + ' ' + ti);
if (document.getElementById(focusto).title) {
//alert(ti);
if (ti == 'fontf') {
document.getElementById(focusto).style.fontFamily=tv;
document.getElementById(focusto).title=document.getElementById(focusto).title.replace(/\:\ /g,':').replace("font-family:" + fmap(fontf) + ";","font-family:" + fmap(tv) + ";");
document.getElementById(focusto).title=document.getElementById(focusto).title.replace(/\:\ /g,':').replace("font-family:" + fmap(lastfontf) + ";","font-family:" + fmap(tv) + ";");
//alert(document.getElementById(focusto).title);
lastfontf=tv;
} else if (ti == 'fonts') {
document.getElementById(focusto).style.fontSize=tv;
document.getElementById(focusto).title=document.getElementById(focusto).title.replace(/\:\ /g,':').replace("font-size:" + fonts + ";","font-size:" + tv + ";");
document.getElementById(focusto).title=document.getElementById(focusto).title.replace(/\:\ /g,':').replace("font-size:" + lastfonts + ";","font-size:" + tv + ";");
//alert(fonts + ' ... ' + tv + ' +++ ' + document.getElementById(focusto).title);
lastfonts=tv;
} else if (ti == 'fontc') {
document.getElementById(focusto).style.color=tv;
document.getElementById(focusto).title=document.getElementById(focusto).title.replace(/\:\ /g,':').replace("color:" + fontc + ";","color:" + tv + ";");
document.getElementById(focusto).title=document.getElementById(focusto).title.replace(/\:\ /g,':').replace("color:" + lastfontc + ";","color:" + tv + ";");
//alert(document.getElementById(focusto).title);
lastfontc=tv;
} else if (ti == 'fontw') {
document.getElementById(focusto).style.fontStyle=tv;
document.getElementById(focusto).title=document.getElementById(focusto).title.replace(/\:\ /g,':').replace("font-style:" + fontw + ";","font-style:" + tv + ";");
document.getElementById(focusto).title=document.getElementById(focusto).title.replace(/\:\ /g,':').replace("font-style:" + lastfontw + ";","font-style:" + tv + ";");
//alert(document.getElementById(focusto).title);
lastfontw=tv;
document.getElementById('fontf').focus();
}
namefont=(lastfontf + '_' + lastfonts + '_' + lastfontw).replace(/\ /g,'_');
}
}
return tv;
}

function lotsforthefuture(oform) {
// Lots for later
// End of ... Lots for later
return true;
}

function updd(oi,oiv) {
//alert(oiv);
oi.innerHTML=oiv;
oi.value=oi.innerHTML;
oi.innerHTML=oiv;
}

function upd(oi,oiv) {
oi.innerHTML=oiv;
oi.value=oi.innerHTML;
oi.innerHTML='';
}

function htmlout(pcent) {
var newo='', tao=[], taoih=[], itas, ihis='', tdelim='', doemail=false, dopdf=false, dodownload=false, nump=0;
var xfontf='Arial', cf='',clines,cy=0,ic;
var xfonts='12px', lhplace='', ctas=[];
var xfontc='0~~0~~0';
var xfontw='normal', twelve=12;
var xred=0, xgreen=0, xblue=0;
document.getElementById('htmltp').value='';
if (pcent.indexOf('.000000%') == -1 && pcent.indexOf('.00000%') == -1 && document.getElementById('bcanvas').value != 'Canvas') {
//alert(65);
document.getElementById('bcanvas').click();
}
if (pcent.indexOf('.000000') != -1) {
if (newo == '') {
newo=pcent.split('%')[1];
pcent=pcent.replace('%' + newo, '%');
}
if (localStorage) {
if (localStorage.getItem('tp_' + newo)) {
//alert(newo);
var bih=decodeURIComponent(localStorage.getItem('tp_' + newo)); //.replace(/\<\;/g,'<').replace(/\>\;/g,'>');
//alert(bih);
document.getElementById('myform').innerHTML=bih;
if (document.getElementById('motherboard2')) {
document.getElementById('motherboard').value=document.getElementById('motherboard').innerHTML.replace(/\<\;/g,"<").replace(/\>\;/g,">");
document.getElementById('motherboard').innerHTML='';
firstoh="<textarea alt='font-family:Arial;font-size:12px;color:#000000;font-style:normal;' onclick='clicksup(event);' title='Base Textarea to type away on or click/touch to reposition text' style='font-family:Arial;font-size:12px;font-style:normal;color:#000000;border:0px solid yellow;border-right:1px solid red;z-index:1;position:absolute;background-color:transparent;top:0px;left:0px;height:100vh;' id='moth" + "erboard' name='moth" + "erboard' cols=300 rows=300>" + "</textarea>";
while (document.getElementById('motherboard' + nextsuffix)) {
document.getElementById('motherboard' + nextsuffix).value=document.getElementById('motherboard' + nextsuffix).innerHTML.replace(/\<\;/g,"<").replace(/\>\;/g,">");
document.getElementById('motherboard' + nextsuffix).innerHTML='';
focusto="motherboard" + nextsuffix;
nextsuffix='' + eval(eval(nextsuffix) + 1);
}
firstoh=document.getElementById(focusto).outerHTML;
document.getElementById('fontf').focus();
}
return '';
}
}
return '';
}



var tas=document.getElementsByTagName('textarea');
//alert(tas[eval(-1 + tas.length)].value + ' vs ' + tas[eval(-1 + tas.length)].innerHTML + ' ... ' + ctas[eval(-2 + tas.length)]);
for (itas=0;itas<(eval(0 + tas.length));itas++) {
ihis='';
if (tas[itas].value != '' && tas[itas].innerHTML != '') {
ihis=tas[itas].innerHTML;
tao.push(tas[itas]);
taoih.push(tas[itas].innerHTML);
//if (ctas.length > 0) alert(tas[itas].innerHTML + ' +++ ' + tas[itas].value);
tas[itas].innerHTML='';
} else if (tas[itas].innerHTML != '') {
ihis=tas[itas].innerHTML;
//if (ctas.length > 0) alert(tas[itas].innerHTML + ' ++.+ ' + tas[itas].value);
} else if (tas[itas].value != '') {
ihis=tas[itas].value;
//if (ctas.length > 0) alert(tas[itas].innerHTML + ' ++..+ ' + tas[itas].value);
} else if (ctas.length > eval(itas - 1) && itas > 0) {
//alert(itas + ' ... ' + ctas[eval(itas - 1)]);
if (ctas[eval(itas - 1)].indexOf('>') != -1) {
tao.push(tas[itas]);
ihis=ctas[eval(itas - 1)].split('>')[eval(-1 + ctas[eval(itas - 1)].split('>').length)];
taoih.push(ihis);
//alert(ihis);
}
}
//if (itas > 0) alert('ihis=' + ihis);
if (ihis != '') {
if (pcent.indexOf('.00000000') != -1) {
} else if (pcent.indexOf('.0000000') != -1) {
} else if (pcent.indexOf('.000000') != -1) {
if (newo == '') {
newo=pcent.split('%')[1];
pcent=pcent.replace('%' + newo, '%');
}
if (localStorage) {
if (localStorage.getItem('tp_' + newo)) {
//alert(newo);
var bih=decodeURIComponent(localStorage.getItem('tp_' + newo)); //.replace(/\<\;/g,'<').replace(/\>\;/g,'>');
//alert(bih);
document.body.innerHTML=bih;
return '';
}
}
return '';
} else if (pcent.indexOf('.00000') != -1) {
if (newo == '') {
newo=pcent.split('%')[1];
pcent=pcent.replace('%' + newo, '%');
}
} else if (pcent.indexOf('.0000') != -1) {
//document.title+=' ... ' + local_font;
//alert(cccmd + ' ' + local_font);
if (lhplace == '') {
//alert(14);
document.getElementById('icanvas').style.display='inline-block';
document.getElementById('dddcanvas').style.display='inline-block';
document.getElementById('dcanvas').style.position='absolute'
document.getElementById('dcanvas').style.top='0px';
document.getElementById('dcanvas').style.left='0px';
//alert(15);
//document.getElementById('dcanvas').style.width=celem.style.width;
//document.getElementById('dcanvas').style.height=celem.style.height;
document.getElementById('dcanvas').style.zIndex='20';
document.getElementById('dcanvas').style.display='block';
//alert(16);
celem.style.top='0px';
celem.style.left='0px';
//alert(17);
celem.width=eval(('' + celem.style.width).replace('px',''));
celem.height=eval(('' + celem.style.height).replace('px',''));
//alert(18);
celem.style.backgroundColor='#f0f0f0';
celem.style.border='1px solid red';
celem.style.zIndex='20';
celem.style.display='block';
//alert(19);
}
if (dynamiccanvas) {
if (nump < ccmds.length) {
if (ccmds.length > 1) {
//alert(cccmd + ' ' + local_font);
for (var jc=0; jc<ccmds.length; jc++) {
//alert(ccmds[jc]);
eval(ccmds[jc]);
nump=eval(1 + jc);
}
//ccmds=[];
}
}
} else {
if (tas[itas].outerHTML.indexOf('font-family:') != -1) xfontf=fmap((tas[itas].outerHTML + ';').split('ont-family:')[1].split(';')[0]);
if (tas[itas].outerHTML.indexOf('font-style:') != -1) xfontw=(tas[itas].outerHTML + ';').split('ont-style:')[1].split(';')[0];
if (tas[itas].outerHTML.indexOf('font-size:') != -1) xfonts=(tas[itas].outerHTML + ';').split('ont-size:')[1].split(';')[0];
cf = xfontw.replace('normal','') + " " + xfonts + " " + xfontf;
twelve=eval(xfonts.split('px')[0]);
ccontext.font = cf;
//alert(cf + ' ... ' + tas[itas].outerHTML);
if (tas[itas].outerHTML.indexOf(';color:#') != -1) {
//alert(celem.width + ' #' + tas[itas].outerHTML.split('olor:#')[1].split(';')[0]);
ccontext.fillStyle='#' + tas[itas].outerHTML.split(';color:#')[1].split(';')[0];
}
cy=eval(eval(tas[itas].style.top.replace('px','')) / 1 + 12);
clines=ihis.split(String.fromCharCode(10));
for (ic=0;ic<clines.length;ic++) {
//if (itas > 0) alert(clines[ic]);
ccontext.fillText(clines[ic],eval(eval(tas[itas].style.left.replace('px','')) / 1),cy);
cy+=twelve;
}
}
durl=celem.toDataURL('image/png'); //jpeg',0.7);
//alert(durl);
document.getElementById('icanvas').src=durl;
document.getElementById('icanvas').style.backgroundImage="URL('" + durl + "')";
setTimeout(inverse,2000);
lhplace='#ccanvas';
} else if (pcent.indexOf('.000') != -1) {
dopdf=true;
dodownload=false;
doemail=false;
if (document.getElementById('htmltp').value == "") document.getElementById('htmltp').value="new``";
// string family [, string style [, float size]]
// font-family:Arial;font-size:12px;color:#000000;font-style:normal; B I U nothing
if (tas[itas].outerHTML.indexOf('font-family:') != -1) xfontf=fmap((tas[itas].outerHTML + ';').split('ont-family:')[1].split(';')[0]);
if (tas[itas].outerHTML.indexOf('font-style:') != -1) xfontw=(tas[itas].outerHTML + ';').split('ont-style:')[1].split(';')[0];
if (tas[itas].outerHTML.indexOf('font-size:') != -1) xfonts=(tas[itas].outerHTML + ';').split('ont-size:')[1].split(';')[0];
document.getElementById('htmltp').value+=tdelim + xfontf + '~`' + xfontw.replace('normal','').replace('bold','B').replace('italic','I').replace('underline','U') + '~`' + xfonts;
tdelim='``';
if (tas[itas].outerHTML.indexOf('color:#') != -1) {
xred=eval(eval(eval(('' + tas[itas].outerHTML).split('olor:#')[1].substring(0,1)) * 16) + eval(('' + tas[itas].outerHTML).split('olor:#')[1].substring(1,2)));
xgreen=eval(eval(eval(('' + tas[itas].outerHTML).split('olor:#')[1].substring(2,3)) * 16) + eval(('' + tas[itas].outerHTML).split('olor:#')[1].substring(3,4)));
xblue=eval(eval(eval(('' + tas[itas].outerHTML).split('olor:#')[1].substring(4,5)) * 16) + eval(('' + tas[itas].outerHTML).split('olor:#')[1].substring(5,6)));
document.getElementById('htmltp').value+=tdelim + xred + '~~' + xgreen + '~~' + xblue;
tdelim='``';
}
document.getElementById('htmltp').value+=tdelim + eval(eval(tas[itas].style.left.replace('px','')) / 2) + '`~' + eval(eval(tas[itas].style.top.replace('px','')) / 2) + '`~' + ihis;
tdelim='``';
} else if (pcent.indexOf('.00') != -1) {
dopdf=true;
dodownload=true;
doemail=false;
if (document.getElementById('htmltp').value == "") document.getElementById('htmltp').value="New``";
// string family [, string style [, float size]]
// font-family:Arial;font-size:12px;color:#000000;font-style:normal; B I U nothing
if (tas[itas].outerHTML.indexOf('font-family:') != -1) xfontf=fmap((tas[itas].outerHTML + ';').split('ont-family:')[1].split(';')[0]);
if (tas[itas].outerHTML.indexOf('font-style:') != -1) xfontw=(tas[itas].outerHTML + ';').split('ont-style:')[1].split(';')[0];
if (tas[itas].outerHTML.indexOf('font-size:') != -1) xfonts=(tas[itas].outerHTML + ';').split('ont-size:')[1].split(';')[0];
document.getElementById('htmltp').value+=tdelim + xfontf + '~`' + xfontw.replace('normal','').replace('bold','B').replace('italic','I').replace('underline','U') + '~`' + xfonts;
tdelim='``';
if (tas[itas].outerHTML.indexOf('color:#') != -1) {
xred=eval(eval(eval(('' + tas[itas].outerHTML).split('olor:#')[1].substring(0,1)) * 16) + eval(('' + tas[itas].outerHTML).split('olor:#')[1].substring(1,2)));
xgreen=eval(eval(eval(('' + tas[itas].outerHTML).split('olor:#')[1].substring(2,3)) * 16) + eval(('' + tas[itas].outerHTML).split('olor:#')[1].substring(3,4)));
xblue=eval(eval(eval(('' + tas[itas].outerHTML).split('olor:#')[1].substring(4,5)) * 16) + eval(('' + tas[itas].outerHTML).split('olor:#')[1].substring(5,6)));
document.getElementById('htmltp').value+=tdelim + xred + '~~' + xgreen + '~~' + xblue;
tdelim='``';
}
document.getElementById('htmltp').value+=tdelim + eval(eval(tas[itas].style.left.replace('px','')) / 2) + '`~' + eval(eval(tas[itas].style.top.replace('px','')) / 2) + '`~' + ihis;
tdelim='``';
} else if (pcent.indexOf('.0') != -1) {
dopdf=true;
dodownload=true;
doemail=true;
if (document.getElementById('htmltp').value == "") document.getElementById('htmltp').value="New``";
// string family [, string style [, float size]]
// font-family:Arial;font-size:12px;color:#000000;font-style:normal; B I U nothing
if (tas[itas].outerHTML.indexOf('font-family:') != -1) xfontf=fmap((tas[itas].outerHTML + ';').split('ont-family:')[1].split(';')[0]);
if (tas[itas].outerHTML.indexOf('font-style:') != -1) xfontw=(tas[itas].outerHTML + ';').split('ont-style:')[1].split(';')[0];
if (tas[itas].outerHTML.indexOf('font-size:') != -1) xfonts=(tas[itas].outerHTML + ';').split('ont-size:')[1].split(';')[0];
document.getElementById('htmltp').value+=tdelim + xfontf + '~`' + xfontw.replace('normal','').replace('bold','B').replace('italic','I').replace('underline','U') + '~`' + xfonts;
tdelim='``';
if (tas[itas].outerHTML.indexOf('color:#') != -1) {
xred=eval(eval(eval(('' + tas[itas].outerHTML).split('olor:#')[1].substring(0,1)) * 16) + eval(('' + tas[itas].outerHTML).split('olor:#')[1].substring(1,2)));
xgreen=eval(eval(eval(('' + tas[itas].outerHTML).split('olor:#')[1].substring(2,3)) * 16) + eval(('' + tas[itas].outerHTML).split('olor:#')[1].substring(3,4)));
xblue=eval(eval(eval(('' + tas[itas].outerHTML).split('olor:#')[1].substring(4,5)) * 16) + eval(('' + tas[itas].outerHTML).split('olor:#')[1].substring(5,6)));
document.getElementById('htmltp').value+=tdelim + xred + '~~' + xgreen + '~~' + xblue;
tdelim='``';
}
document.getElementById('htmltp').value+=tdelim + eval(eval(tas[itas].style.left.replace('px','')) / 2) + '`~' + eval(eval(tas[itas].style.top.replace('px','')) / 2) + '`~' + ihis;
tdelim='``';
}
if (document.getElementById('htmltp').value != "") tdelim='``';
}
}
if (lhplace != '') {
location.href=lhplace;
return '';
}
// if (document.getElementById('htmltp').value != "") alert(document.getElementById('htmltp').value);
if (pcent.indexOf('.0000000%') != -1) return '';
pcent=pcent.replace('.00000000','').replace('.0000000','').replace('.000000','').replace('.00000','').replace('.0000','').replace('.000','').replace('.00','').replace('.0','');

var dbo=document.body.outerHTML;
var dhi=document.head.innerHTML;
if (pcent.trim() != '8' + '5%') {
dbo=dbo.replace('1' + '5%;','0%;display:none;');
while (dbo.indexOf('8' + '5%') != -1) {
dbo=dbo.replace('8' + '5%',pcent.trim());
}
while (dhi.indexOf('8' + '5%') != -1) {
dhi=dhi.replace('8' + '5%',pcent.trim());
}
}
var hcont='<!doctype html><html><head>' + dhi + '</head>' + dbo.replace(/clicksup\(/g,'dumc' + 'lickm' + 'ysup(').replace(/\<textarea /g,'<textarea onchange=upd(this,this.value); onfocus=ofc(this); ') + '</html>';
var pt='motherboard', edits='';
var nexti=1, esty;
while (document.getElementById(pt)) {
if (nexti >= 2) {
esty=document.body.outerHTML.split(' .mboard' + nexti + ' { ');
if (esty.length > 1) {
if (document.body.outerHTML.indexOf('" id="motherboard') != -1) {
hcont=hcont.replace('" id="motherboard' + nexti + '"', '' + esty[1].split(';')[0] + ';" id="motherboard' + nexti + '"');
} else {
hcont=hcont.replace("' id='motherboard" + nexti + "'", "" + esty[1].split(";")[0] + ";' id='motherboard" + nexti + "'");
}
}
}
edits+=',[' + nexti + ']' + document.getElementById(pt).value;
hcont=hcont.replace('>' + '</textarea>', '>' + document.getElementById(pt).value.replace(/\<\;/g,"<").replace(/\>\;/g,">") + ' ' + '</TEX' + 'TAREA>');
//alert(edits + ' ..' + nexti + '. ' + hcont.substring(hcont.indexOf('<bo' + 'dy ')));
nexti++;
pt='motherboard' + nexti;
}
if (pcent.trim() != '8' + '5%') {
hcont=hcont.replace('8' + '5%',pcent.trim());
while (hcont.indexOf('1px so' + 'lid') != -1) {
hcont=hcont.replace('1px so' + 'lid','0px so' + 'lid')
}
}
if (hcont.indexOf('</TEXT' + 'AREA>') != -1) {
while (hcont.indexOf('</TEXT' + 'AREA>') != -1) {
hcont=hcont.replace('</TEXT' + 'AREA>','</text' + 'area>')
}
//alert(edits + ' ... ' + hcont.substring(hcont.indexOf('<bo' + 'dy ')));
}
//if (cmode) alert(hcont);
if (dopdf || (pcent.trim() == '8' + '5%' && pcent != '8' + '5%')) {
var eto="";
if (dodownload) eto=" ";
if (doemail || (pcent.trim() == '8' + '5%' && pcent != '8' + '5%')) eto=prompt('Please enter email address to email Textarea Pointing webpage to (and consider adding a comma separated mention of your own email address for Reply To All purposes)',etosofar);
if (eto != null) {
if (eto.indexOf('@') != -1 || dopdf) {
etosofar=eto;
if (dopdf && !dodownload && !doemail) {
if (1 == 1) {
document.getElementById('femail').target='_blank';
setTimeout(andlater,2000);
} else {
document.getElementById('iemail').style.display='block';
location.href='#iemail';
}
}
document.getElementById('emailto').value=eto;
if (document.getElementById('htmltp').value == '') document.getElementById('htmltp').value=hcont.replace(/\+\=/g,'#@~#').replace(/\+\+/g,'#@!#').replace(/ \+ /g,'#@#');
document.getElementById('semail').click();
}
}
} else {
if (newo != '') {
if (localStorage) {
if (localStorage.getItem('tp_' + newo)) {
//document.title+=' remove ';
localStorage.removeItem('tp_' + newo);
}
//document.title+=' set ';
//alert(value);
var bbit='m' + hcont.split('<f' + 'orm')[1].split('>')[0] + '>';
//alert(newo + '=' + encodeURIComponent(hcont.split('<bo' + 'd')[1].replace(bbit,'').split('</b' + 'ody>')[0]));
localStorage.setItem('tp_' + newo, encodeURIComponent(hcont.split('<fo' + 'r')[1].replace(bbit,'').split('</f' + 'orm>')[0])); //.replace(/\</g,'<').replace(/\>/g,'>'));
document.getElementById('ssaveas').innerHTML+='<option value="' + newo + '">Recall "' + newo + '"</option>';
}
} else {
var wo=window.open('','_blank');
wo.document.write(hcont);
}
}
for (itas=0;itas<tao.length;itas++) {
//if (tao[itas].id == focusto) alert(tao[itas].innerHTML + ' ... ' + tao[itas].value);
tao[itas].innerHTML=taoih[itas].replace(/\<\;/g,"<").replace(/\>\;/g,">");
tao[itas].value=taoih[itas].replace(/\<\;/g,"<").replace(/\>\;/g,">");
}
}

function andlater() {
document.getElementById('femail').target='iemail';
}


function andlateragain() {
var pn=(location.search.split('fontmode=')[1] ? location.search.split('fontmode=')[1].split('&')[0] : '');
if (pn != '' || 1 == 1) {
if (pn != '') {
pntwo=(location.search.split('fontname=')[1] ? location.search.split('fontname=')[1].split('&')[0] : '');
if (pntwo != '') {
namefont=decodeURIComponent(pntwo);
if (namefont.trim() != namefont) {
docurl+='&blankify=y';
namefont=namefont.trim();
}
if (namefont.replace(/\+/g,'') != namefont) {
namefont=namefont.replace(/\+/g,'');
document.getElementById('fontf').value=namefont;
lastfontf=namefont;
}
}
}
if (document.getElementById('topsel')) {
document.getElementById('dtopsel').innerHTML="<select onchange=\" if (this.value == '') { learnfont=false; } else { learnfont=settolearn(this.value.replace('both','')); if (!learnfont) { this.value=''; } } \" title='Textarea Pointing or Font Learning (via Canvas or Textarea or both)' id=topsel><option value=>Pointing</option><option value=canvas>Font Learning via Canvas</option><option value=textarea>Font Learning via Textarea</option><option value=both>Font Learning via Both</option></select>".replace("value=" + pn + ">","value='" + pn + "' selected>");
}
if (document.getElementById('dlearn')) {
document.getElementById('dlearn').innerHTML="<a title='Learn a Font for future use?' id='alearn' onclick=\"learnfont=settolearn('');\" style='cursor:pointer;text-decoration:none;'>Font</a>";
}
if (pn != '') settolearn(pn);
}
}

function checkf(iois) {
if (learnfontmode == learnfontmode.toUpperCase()) {
if (iois != null) {
var aconto = (iois.contentWindow || iois.contentDocument);
if (aconto != null) {
try {
if (1 == 2) document.title+=' try ' + learnfontmode;
if (aconto.document) { aconto = aconto.document; learnfontmode=learnfontmode.toLowerCase(); // aconto = aconto.document; }
learnfontmode=learnfontmode.toLowerCase();
//alert(aconto.body.outerHTML);
if (aconto.body.outerHTML.indexOf('<body>') == -1) {
setTimeout(andlateragain,2000);
}
}
} catch(eee) { }
if (1 == 2) document.title+=' herE1 ' + learnfontmode;
} else {
if (1 == 2) document.title+=' here2 ' + learnfontmode;
}
} else {
if (1 == 2) document.title+=' here3 ' + learnfontmode;
}
}
learnfontmode=learnfontmode.toLowerCase();
}
function checkp(iois) {
if (iois != null) {
var aconto = (iois.contentWindow || iois.contentDocument);
if (aconto != null) {
try {
if (aconto.document) { aconto = aconto.document; }
document.getElementById('myform').action='../PHP/pixellate.php';
document.getElementById('myform').method='POST';
document.getElementById('myform').target='ipixel';
document.getElementById('d' + iois.id.substring(1)).style.display='block';
iois.src='';
} catch(eee) { }
}
}
}

function checki(iois) {
if (iois != null) {
var aconto = (iois.contentWindow || iois.contentDocument);
if (aconto != null) {
try {
if (aconto.document) { aconto = aconto.document; }
document.getElementById('d' + iois.id.substring(1)).style.display='block';
} catch(eee) { }
}
}
}

function ofc(ois) {
focusto=ois.id;
}

function newone(tv) {
htmlout('85.00000%' + tv);
}

function pickold(tv) {
htmlout('85.000000%' + tv);
}

function rotate(userinstigated) {
var img=document.getElementById("ncanvas"),imgi=document.getElementById("icanvas");
var wasw=celem.width, wash=celem.height;
celem.width=wasw;
celem.height=wash;
//alert('canvas clear');
ccontext.translate(wasw/2, wash/2);
var rad = 2 * Math.PI - eval(document.getElementById("nrotate").value) * Math.PI / 180;
ccontext.rotate(-rad);
ccontext.scale(1, 1);
ccontext.drawImage(imgi, -wasw/2, -wash/2, wasw, wash);
var huhi=celem.toDataURL('image/png');
img.src=huhi;
img.style.display='inline-block';
document.getElementById("nrotate").style.display='inline-block';
document.getElementById("ndrotate").style.display='inline-block';
celem.width=wasw;
celem.height=wash;
ccontext.drawImage(imgi,0,0);
if (userinstigated != 0) document.getElementById("ncanvas").click();
}

function flop() {
var img=document.getElementById("mcanvas"),imgi=document.getElementById("icanvas");
var wasw=celem.width, wash=celem.height;
celem.width=wasw;
celem.height=wash;
ccontext.translate(wasw/2, wash/2);
ccontext.scale(1, -1);
ccontext.drawImage(imgi, -wasw/2, -wash/2, wasw, wash);
var huhi=celem.toDataURL('image/png');
img.src=huhi;
img.style.display='inline-block';
celem.width=wasw;
celem.height=wash;
ccontext.drawImage(imgi,0,0);
}

function flip() {
var img=document.getElementById("lcanvas"),imgi=document.getElementById("icanvas");
var wasw=celem.width, wash=celem.height;
celem.width=wasw;
celem.height=wash;
ccontext.translate(wasw/2, wash/2);
ccontext.scale(-1, 1);
ccontext.drawImage(imgi, -wasw/2, -wash/2, wasw, wash);
var huhi=celem.toDataURL('image/png');
img.src=huhi;
img.style.display='inline-block';
celem.width=wasw;
celem.height=wash;
ccontext.drawImage(imgi,0,0);
}

function grayscale() { // thanks to https://www.w3schools.com/tags/canvas_getimagedata.asp
var n=0,img=document.getElementById("kcanvas"),imgi=document.getElementById("icanvas");
//ccontext.drawImage(img,0,0);
var imgData=ccontext.getImageData(0,0,celem.width,celem.height);
var i;
var data = imgData.data;
for (i = 0; i < data.length; i += 4) {
var bright = 0.34 * data[i] + 0.5 * data[i + 1] + 0.16 * data[i + 2];
data[i] = bright;
data[i + 1] = bright;
data[i + 2] = bright;
}
ccontext.putImageData(imgData,0,0);
var huhi=celem.toDataURL('image/png');
img.src=huhi;
img.style.display='inline-block';
// invert colors
//for (i=0;i<data.length;i+=4) {
// data[i]=eval(255 - data[i]);
// data[i+1]=eval(255 - data[i+1]);
// data[i+2]=eval(255 - data[i+2]);
// data[i+3]=eval(0); // - data[i+3]);
//}
//ccontext.putImageData(imgData,0,0);
ccontext.drawImage(imgi,0,0);
}

function pib() {
learnfont=true;
}

function retsigsig(incca) {
var retval='y', sofar='', wasv='', wasvp='';

if (learnfont && docurl.indexOf('blankify=') == -1) {
if (localStorage) {
if (localStorage.getItem('fd_' + namefont)) {
if (local_font != '') {
local_font=decodeURIComponent(localStorage.getItem('fd_' + namefont));
//alert('36:' + local_font);
}
sofar=decodeURIComponent(localStorage.getItem('fd_' + namefont));
if (sofar.indexOf('.000000000' + ('000' + ('' + incca)).slice(-3)) != -1) {
if ((sofar + ';').indexOf('.000000000' + ('000' + ('' + incca)).slice(-3) + ',') == -1) {
wasv='.000000000' + ('000' + ('' + incca)).slice(-3);
wasvp=(sofar + ';').split(wasv)[0].split(';')[eval(-1 + (sofar + ';').split(wasv)[0].split(';').length)];
//alert(document.getElementById("raster").value + ' .+. ;' + wasvp + wasv);
} else {
wasv='000000000' + ('000' + ('' + incca)).slice(-3) + (sofar + '.000000000').split('000000000' + ('000' + ('' + incca)).slice(-3))[1].split('.000000000')[0] + '.000000000';
//alert(wasv + ' +++ ' + sofar);
if (wasv.indexOf(';') != -1 && (wasv + '~').split(';')[eval(-1 + (wasv + '~').split(';').length)].indexOf(',') == -1) {
//alert('initial ' + wasv + ' ++ ' + sofar);
//alert('first ' + wasv + ' ++get rid of ' + ';' + (wasv + '~').split(';')[eval(-1 + (wasv + '~').split(';').length)].split('.')[0] + '.' + ' ...' + sofar);
wasv="." + ((wasv + '~').replace(';' + (wasv + '~').split(';')[eval(-1 + (wasv + '~').split(';').length)].split('.')[0] + '.','').replace('.000000000','').replace('000000000~','').replace('~',''));
//alert(wasv + ' ++get rid of ' + ';' + (wasv + '~').split(';')[eval(-1 + (wasv + '~').split(';').length)].split('.')[0] + '.' + ' ...' + sofar);
} else {
wasv="." + wasv.replace('.000000000','');
//alert(wasv + ' +!+ ' + sofar);
}
wasvp=(sofar + ';').split(wasv)[0].split(';')[eval(-1 + (sofar + ';').split(wasv)[0].split(';').length)];
//alert(wasvp + wasv + ' +=+ ' + sofar);
} }
}
if ((wasvp + wasv) == '') wasv='0';
if ((wasvp + wasv).indexOf(',') == -1) wasv+=',0';
//document.title=("-" + (wasvp + wasv).replace('.000000000' + ('000' + ('' + incca)).slice(-3),'').replace(/\;/g,',-') + ' should not contain ' + '.000000000' + ('000' + ('' + incca)).slice(-3));
//return 'y';
if (("-" + (wasvp + wasv).replace('.000000000' + ('000' + ('' + incca)).slice(-3),'').replace(/\;/g,',-')) != "-0,0") {
return "-" + (wasvp + wasv).replace('.000000000' + ('000' + ('' + incca)).slice(-3),'').replace(/\;/g,',-');
}
}
}

return retval;
}

function prerasterize() { // thanks to https://www.w3schools.com/tags/canvas_getimagedata.asp
var oursuffix='',notf=true, i, ii, jj, jcol=0, jrow=0, found=false, onerow=eval(4 * celem.width,celem.height), sofar='', wasv='', wasvp='';
var rasterc='', rasters=[];
var lastones=[0,0,0,0], interested=false, thisone=false, withlastone=false, cdelim='';
var offsetstotry=[eval(-4 - onerow),-onerow,eval(4 - onerow),-4,4,eval(onerow - 4),celem.width,eval(onerow + 4)];
if (1 == 2) {
var imgi=document.getElementById("icanvas");
var wasw=celem.width, wash=celem.height;
celem.width=wasw;
celem.height=wash;
ccontext.drawImage(imgi,0,0);
}
var imgData=null;
if (learnfont) {
if (localStorage) {
if (localStorage.getItem('fd_' + namefont)) {
sofar=decodeURIComponent(localStorage.getItem('fd_' + namefont));
if (local_font != '') {
local_font=sofar;
//alert('38:' + local_font);
}
if (docurl.indexOf('blankify=') != -1 && !done) sofar='';
//alert('?' + sofar);
done=true;
}
if (sofar == '') {
sofar=namefont + ':0.000000000127';
for (i = 0; i <= 32; i++) {
sofar+=';' + '0.000000000' + ('000' + ('' + i)).slice(-3);
}
}
if (sofar.indexOf('.000000000' + ('000' + ('' + cca)).slice(-3)) != -1) {
if ((sofar + ';').indexOf('.000000000' + ('000' + ('' + cca)).slice(-3) + ',') == -1) {
wasv='.000000000' + ('000' + ('' + cca)).slice(-3);
wasvp=(sofar + ';').split(wasv)[0].split(';')[eval(-1 + (sofar + ';').split(wasv)[0].split(';').length)];
//alert(document.getElementById("raster").value + ' .+. ;' + wasvp + wasv);
} else if (7 == 77) {
wasv='000000000' + ('000' + ('' + cca)).slice(-3) + (sofar + '.000000000').split('000000000' + ('000' + ('' + cca)).slice(-3))[1].split('.000000000')[0] + '.000000000';
//alert(wasv + ' 0+++ ' + sofar);
if (wasv.indexOf(';') != -1 && (wasv + '~').split(';')[eval(-1 + (wasv + '~').split(';').length)].indexOf(',') == -1) {
wasv="." + ((wasv + '~').replace(';' + (wasv + '~').split(';')[eval(-1 + (wasv + '~').split(';').length)].split('.')[0] + '.','').replace('~','')).replace('.000000000','');
//alert(wasv + ' 0++ ' + sofar);
} else {
wasv="." + wasv.replace('.000000000','');
//alert(wasv + ' 0+!+ ' + sofar);
}
wasvp=(sofar + ';').split(wasv)[0].split(';')[eval(-1 + (sofar + ';').split(wasv)[0].split(';').length)];
//alert(wasvp + wasv + ' 0+=+ ' + sofar);
} else {
wasv='000000000' + ('000' + ('' + cca)).slice(-3) + (sofar + '.000000000').split('000000000' + ('000' + ('' + cca)).slice(-3))[1].split('.000000000')[0] + '.000000000';
//alert(wasv + ' +++ ' + sofar);
if (wasv.indexOf(';') != -1 && (wasv + '~').split(';')[eval(-1 + (wasv + '~').split(';').length)].indexOf(',') == -1) {
wasv="." + ((wasv + '~').replace(';' + (wasv + '~').split(';')[eval(-1 + (wasv + '~').split(';').length)].split('.')[0] + '.','').replace('.000000000','').replace('000000000~','').replace('~',''));
//alert(wasv + ' ++ ' + sofar);
} else {
wasv="." + wasv.replace('.000000000','');
//alert(wasv + ' +!+ ' + sofar);
}
wasvp=(sofar + ';').split(wasv)[0].split(';')[eval(-1 + (sofar + ';').split(wasv)[0].split(';').length)];
//alert(wasvp + wasv + ' +=+ ' + sofar);
}
//alert(document.getElementById("raster").value + ' ... ;' + wasvp + wasv);
if (shouldmaintain) {
if ((wasvp + wasv).indexOf('.000000000' + ('000' + ('' + cca)).slice(-3)) != -1) {
oursuffix=(wasvp + wasv).split('.000000000' + ('000' + ('' + cca)).slice(-3))[1];
}
shouldmaintain=false;
}
sofar=sofar.replace(';' + wasvp + wasv, '');
}
localStorage.removeItem('fd_' + namefont);
}
rasters=document.getElementById("raster").value.split(",");
if (document.getElementById('rerasterize')) {
if (document.getElementById('rerasterize').value != "") {
//alert(document.getElementById("rerasterize").value);
rasters=document.getElementById('rerasterize').value.split(",");
} //else {
//alert(document.getElementById("raster").value);
//}
}
if (rasters.length == 0 || document.getElementById("raster").value == "") {
sofar+=';0.000000000' + ('000' + ('' + cca)).slice(-3) + oursuffix;
//alert(cca + ' ' + document.getElementById("raster").value + ' why? ' + sofar);
} else {
sofar+=(';' + Math.floor(Math.abs((eval(rasters[0])))) + '.000000000' + ('000' + ('' + cca)).slice(-3)).replace('NaN','0') + oursuffix;
for (i = 1; i < rasters.length; i++) {
if (eval(rasters[i]) < 0) {
if ((i % 2) == 1) {
sofar+=(';' + rasters[i]);
} else {
sofar+=(';' + Math.floor(Math.abs((eval(rasters[i]))))).replace('NaN','0');
}
} else {
if ((i % 2) == 1) {
sofar+=(',' + rasters[i]);
} else {
sofar+=(',' + Math.floor(Math.abs((eval(rasters[i]))))).replace('NaN','0');
}
}
}
//alert(sofar);
}
if (localStorage) {
//alert(';' + wasvp + wasv + ' ... ' + sofar);
if (local_font != '') {
local_font=sofar;
//alert('39:' + local_font);
}
localStorage.setItem('fd_' + namefont, encodeURIComponent(sofar));
return sofar;
}
} else {
imgData=ccontext.getImageData(0,0,celem.width,celem.height);
}
var data = imgData.data;

document.getElementById("width").value='' + celem.width;
document.getElementById("height").value='' + celem.height;

for (i = 0; i < data.length; i += 4) {
jcol=eval(i % onerow);
if (jcol == 0 && i != 0) {
jrow++; // row count
}
//if (i == 0) {
// alert('' + data[i] + ',' + data[i + 1] + ',' + data[i + 2] + ',' + data[i + 3]);
//}
thisone=(data[i] != 0 || data[i + 1] != 0 || data[i + 2] != 0 || data[i + 3] != 0);
if (!found && thisone) {
found=true;
lastones[0] = data[i];
lastones[1] = data[i + 1];
lastones[2] = data[i + 2];
lastones[3] = data[i + 3];
cdelim=data.length + '.' + onerow + ':';
}
if (thisone) {
withlastone=(data[i] != lastones[0] || data[i + 1] != lastones[1] || data[i + 2] != lastones[2] || data[i + 3] != lastones[3]);
if (withlastone) { // new thread
lastones[0] = data[i];
lastones[1] = data[i + 1];
lastones[2] = data[i + 2];
lastones[3] = data[i + 3];
rasterc+=cdelim + '' + eval(i / 4) + '.' + ('000' + ('' + data[i])).slice(-3) + ('000' + ('' + data[i + 1])).slice(-3) + ('000' + ('' + data[i + 2])).slice(-3) + ('000' + ('' + data[i + 3])).slice(-3);
data[i] = 0;
data[i + 1] = 0;
data[i + 2] = 0;
data[i + 3] = 0;
jj=i;
cdelim=';';
notf=false;
while (!notf) {
notf=true;
for (ii=0; ii<offsetstotry.length; ii++) {
if ((jj + offsetstotry[ii]) >= 0 && (jj + 4 + offsetstotry[ii]) < data.length) {
if (notf && data[jj + offsetstotry[ii]] == lastones[0] && data[jj + 1 + offsetstotry[ii]] == lastones[1] && data[jj + 2 + offsetstotry[ii]] == lastones[2] && data[jj + 3 + offsetstotry[ii]] == lastones[3]) {
notf=false;
jj+=offsetstotry[ii];
rasterc+=',' + eval(jj / 4);
//document.title=rasterc;
data[jj] = 0;
data[jj + 1] = 0;
data[jj + 2] = 0;
data[jj + 3] = 0;
}
}
}
}
}
}
}
if (learnfont) {
return rasterc;
}
//alert('rasterc=' + rasterc);
document.getElementById("raster").value=rasterc;
//rasterize();
return '';
}

function rasterize() { // thanks to https://www.w3schools.com/tags/canvas_getimagedata.asp
document.getElementById("dpixel").style.display='block';
document.getElementById("inraster").style.display='block';
}




function inverse() { // thanks to https://www.w3schools.com/tags/canvas_getimagedata.asp
prerasterize();
var n=0,img=document.getElementById("jcanvas"),imgi=document.getElementById("icanvas");
//ccontext.drawImage(img,0,0);
var imgData=ccontext.getImageData(0,0,celem.width,celem.height);
var i;
var data = imgData.data;
// invert colors
for (i=0;i<data.length;i+=4) {
data[i]=eval(255 - data[i]);
data[i+1]=eval(255 - data[i+1]);
data[i+2]=eval(255 - data[i+2]);
//data[i+3]=eval(15); //255); // - data[i+3]);
}
ccontext.putImageData(imgData,0,0);
var huhi=celem.toDataURL('image/png');
img.src=huhi;
img.style.display='inline-block';
// invert colors
//for (i=0;i<data.length;i+=4) {
// data[i]=eval(255 - data[i]);
// data[i+1]=eval(255 - data[i+1]);
// data[i+2]=eval(255 - data[i+2]);
// data[i+3]=eval(0); // - data[i+3]);
//}
//ccontext.putImageData(imgData,0,0);
ccontext.drawImage(imgi,0,0);
grayscale();
flip();
flop();
rotate(0);
setTimeout(rasterize,200);
}


function settolearn(nonforcedisblank) {
if (nonforcedisblank == '') {
namefont=prompt("Given it could slow down proceedings (and for now just allowing canvas mode), do you still want to monitor characters that go to make up your font name destination? If not, make the font name blank, or you can change that name here, and by adding (unused) spaces to that name you are telling me to clear any existing data for that font, and by adding (unused) plus sign to that name you are telling me to place that local font name into the Font Family field.", namefont);
learnfontmode='both';
if (namefont != null) {
if (namefont == "") {
namefont=(lastfontf + '_' + lastfonts + '_' + lastfontw).replace(/\ /g,'_');
learnfont=false;
} else {
if (namefont.trim() != namefont) {
docurl+='&blankify=y';
namefont=namefont.trim();
}
if (namefont.replace(/\+/g,'') != namefont) {
namefont=namefont.replace(/\+/g,'');
document.getElementById('fontf').value=namefont;
lastfontf=namefont;
}
learnfont=true;
showiframes("0");
}
} else {
namefont=(lastfontf + '_' + lastfonts + '_' + lastfontw).replace(/\ /g,'_');
learnfont=false;
}
} else if (nonforcedisblank == 'canvas') {
if (pntwo != '') {
namefont=pntwo;
pntwo='';
} else {
namefont=prompt("Given it could slow down proceedings, do you still want to monitor characters that go to make up your font name destination? If not, make the font name blank, or you can change that name here, and by adding (unused) plus sign to that name you are telling me to place that local font name into the Font Family field.", namefont);
}
learnfontmode='canvas';
if (namefont != null) {
if (namefont == "") {
namefont=(lastfontf + '_' + lastfonts + '_' + lastfontw).replace(/\ /g,'_');
learnfont=false;
} else {
if (namefont.trim() != namefont) {
docurl+='&blankify=y';
namefont=namefont.trim();
}
if (namefont.replace(/\+/g,'') != namefont) {
namefont=namefont.replace(/\+/g,'');
document.getElementById('fontf').value=namefont;
lastfontf=namefont;
}
learnfont=true;
showiframes("0");
}
} else {
namefont=(lastfontf + '_' + lastfonts + '_' + lastfontw).replace(/\ /g,'_');
learnfont=false;
}
} else {
if (pntwo != '') {
namefont=pntwo;
pntwo='';
} else {
namefont=prompt("Given it could slow down proceedings (and at the moment just allowing canvas mode), do you still want to monitor characters that go to make up your font name destination? If not, make the font name blank, or you can change that name here, and by adding (unused) spaces to that name you are telling me to clear any existing data for that font, and by adding (unused) plus sign to that name you are telling me to place that local font name into the Font Family field.", namefont);
}
learnfontmode='textarea';
if (namefont != null) {
if (namefont == "") {
namefont=(lastfontf + '_' + lastfonts + '_' + lastfontw).replace(/\ /g,'_');
learnfont=false;
} else {
if (namefont.trim() != namefont) {
docurl+='&blankify=y';
namefont=namefont.trim();
}
if (namefont.replace(/\+/g,'') != namefont) {
namefont=namefont.replace(/\+/g,'');
document.getElementById('fontf').value=namefont;
lastfontf=namefont;
}
learnfont=true;
showiframes("0");
}
} else {
namefont=(lastfontf + '_' + lastfonts + '_' + lastfontw).replace(/\ /g,'_');
learnfont=false;
}
}
return learnfont;
}
function processii() {
processi('#');
}

function processi(alet) {
//alert('Rasterization of ' + alet + ' resulted in ' + document.getElementById('raster').value);
cca=eval('' + alet.charCodeAt());
prerasterize();
if (1 == 2) document.getElementById('raster').value='';
if (alet == '9') {
showiframes("A");
} else if (alet == 'Z') {
showiframes("a");
} else if (alet == 'z') {
alet=' ';
showiframes(String.fromCharCode(alet.charCodeAt() + 1));
} else if (String.fromCharCode(alet.charCodeAt() + 1) == '0') {
showiframes("{");
} else if (alet == '{') {
showiframes("|");
//} else if (alet == '"') {
// showiframes('"');
} else if (alet == '|') {
showiframes("~");
} else if (alet == '~') {
alet='9';
showiframes(String.fromCharCode(alet.charCodeAt() + 1));
} else if (alet == '@') {
showiframes("@");
alert('Thanks for that. We have stored that font character set ready for later use.');
} else {
if (String.fromCharCode(alet.charCodeAt() + 1) == '"') {
showiframes('"');
} else if (String.fromCharCode(alet.charCodeAt() + 1) == '#') {
showiframes('#');
} else {
showiframes(String.fromCharCode(alet.charCodeAt() + 1));
}
}
}

function showiframes(aalet) {
var tabs="", extra_as='<input type=hidden id=rerasterize value=></input><input type=hidden id=refontnearest value=""></input>';
var rss=retsigsig('' + aalet.charCodeAt());

if (aalet == '0' && sels == '') {
var qqlet=aalet, thanks=false;
//sels='<br><select style="float:right;" onchange="showiframes(String.fromCharCode(this.value));"><option value="48">0</option></select><br>';
sels='<select style="float:right;" onchange="showiframes(String.fromCharCode(this.value));"><option value="48">0</option></select>';
while (!thanks) {
if (qqlet == '9') {
qqlet="A";
sels=sels.replace("</select>","<option value='" + qqlet.charCodeAt() + "'>" + qqlet + "</option></select>");
} else if (qqlet == 'Z') {
qqlet="a";
sels=sels.replace("</select>","<option value='" + qqlet.charCodeAt() + "'>" + qqlet + "</option></select>");
} else if (qqlet == 'z') {
qqlet=' ';
qqlet=String.fromCharCode(qqlet.charCodeAt() + 1);
sels=sels.replace("</select>","<option value='" + qqlet.charCodeAt() + "'>" + qqlet + "</option></select>");
} else if (String.fromCharCode(qqlet.charCodeAt() + 1) == '0') {
qqlet="{";
sels=sels.replace("</select>","<option value='" + qqlet.charCodeAt() + "'>" + qqlet + "</option></select>");
} else if (qqlet == '{') {
qqlet="|";
sels=sels.replace("</select>","<option value='" + qqlet.charCodeAt() + "'>" + qqlet + "</option></select>");
} else if (qqlet == '|') {
qqlet="~";
sels=sels.replace("</select>","<option value='" + qqlet.charCodeAt() + "'>" + qqlet + "</option></select>");
} else if (qqlet == '~') {
qqlet='9';
qqlet=String.fromCharCode(qqlet.charCodeAt() + 1);
sels=sels.replace("</select>","<option value='" + qqlet.charCodeAt() + "'>" + qqlet + "</option></select>");
} else if (qqlet == '@') {
qqlet="~";
sels=sels.replace("</select>","<option value='" + qqlet.charCodeAt() + "'>" + qqlet + "</option></select>");
thanks=true; // alert('Thanks for that. We have stored that font character set ready for later use.');
} else {
if (String.fromCharCode(qqlet.charCodeAt() + 1) == '"') {
qqlet='"';
sels=sels.replace("</select>","<option value='" + qqlet.charCodeAt() + "'>" + qqlet + "</option></select>");
} else if (String.fromCharCode(qqlet.charCodeAt() + 1) == "'") {
qqlet="'";
sels=sels.replace('</select>','<option value="' + qqlet.charCodeAt() + '">' + qqlet + '</option></select>');
} else if (String.fromCharCode(qqlet.charCodeAt() + 1) == '#') {
qqlet="#";
sels=sels.replace("</select>","<option value='" + qqlet.charCodeAt() + "'>" + qqlet + "</option></select>");
} else {
qqlet=String.fromCharCode(qqlet.charCodeAt() + 1);
sels=sels.replace("</select>","<option value='" + qqlet.charCodeAt() + "'>" + qqlet + "</option></select>");
}
}
}
}


if (rss.replace('-0,0','').indexOf(',') != -1) {
extra_as+='<a style="float:right;cursor:pointer;text-decoration:underline;" onclick=" shouldmaintain=false; document.getElementById(' + "'" + 'top_iframe' + "'" + ').src=' + "'" + './signature_signature.html?nocookies=y&letter=' + encodeURIComponent(aalet) + "';" + '">Clear</a><br>';
extra_as+='<a style="float:right;cursor:pointer;text-decoration:underline;" onclick=" shouldmaintain=true; this.style.textDecoration=' + "'" + 'none' + "'" + '; ">Retain</a><br>';
extra_as+='<input style="float:right;width:60px;" title="This colour can superceed the last [black is #000000] colour via clicks you make at the top left font character editor window" type=color id=refontc value="' + document.getElementById('fontc').value + '"></input>';
} else {
extra_as+='<input type=hidden id=refontc value="' + document.getElementById('fontc').value + '"></input>';
}
if (aalet == "'") {
extra_as+=sels.replace(">'<", " selected>'<");
} else {
extra_as+=sels.replace('>' + aalet + '<', ' selected>' + aalet + '<');
}
if (aalet == '"') {
tabs="<hr><table id=ftable border=5><tbody id=ftbody><tr id=ftr><td id=ftd style='background-color:lightgreen;'><!--canvas id=top_canvas width=100 height=100 style='position:absolute;top:0px;left:0px;width:50px;height:50px;display:none;z-index:-8;'></canvas--><iframe style='width:50px;height:50px;display:block;z-index:55;' id='top_iframe' src='./signature_signature.html?nocookies=" + encodeURIComponent(rss) + "&letter=" + encodeURIComponent(aalet) + "'></iframe>" + extra_as + "</td></tr><tr><td id=theletter style='background-color:lightblue;border:2px solid green;'>" + namefont + "<br>   <input type=button onclick=processi('" + '"' + "'); title='Click me when my character has been digitised above' style='border:3px solid pink;z-index:55;cursor:pointer;text-decoration:none;height:30px;' id='aletter' value=" + '"' + "></input></td></tr></tbody></table><hr>";
} else if (aalet == '#') {
tabs="<hr><table id=ftable border=5><tbody id=ftbody><tr id=ftr><td id=ftd style='background-color:lightgreen;'><!--canvas id=top_canvas width=100 height=100 style='position:absolute;top:0px;left:0px;width:50px;height:50px;display:none;z-index:-8;'></canvas--><iframe title='Local font character editor window' style='width:50px;height:50px;display:block;z-index:55;' id='top_iframe' src='./signature_signature.html?nocookies=" + encodeURIComponent(rss) + "&letter=" + encodeURIComponent(aalet) + "'></iframe>" + extra_as + "</td></tr><tr><td id=theletter style='background-color:lightblue;border:2px solid green;'>" + namefont + "<br>   <input type=button onclick=processii(); title='Click me when my character has been digitised above' style='border:3px solid pink;z-index:55;cursor:pointer;text-decoration:none;height:30px;' id='aletter' value=" + '#' + "></input></td></tr></tbody></table><hr>";
} else if (aalet == "'") {
tabs="<hr><table id=ftable border=5><tbody id=ftbody><tr id=ftr><td id=ftd style='background-color:lightgreen;'><!--canvas id=top_canvas width=100 height=100 style='position:absolute;top:0px;left:0px;width:50px;height:50px;display:none;z-index:-8;'></canvas--><iframe title='Local font character editor window' style='width:50px;height:50px;display:block;z-index:55;' id='top_iframe' src=\"./signature_signature.html?nocookies=" + encodeURIComponent(rss) + "&letter=" + encodeURIComponent(aalet) + "\"></iframe>" + extra_as + "</td></tr><tr><td id=theletter style='background-color:lightblue;border:2px solid green;'>" + namefont + "<br>   <input type=button onclick=processi(\"" + "'" + "\"); title='Click me when my character has been digitised above' style='border:3px solid pink;z-index:55;cursor:pointer;text-decoration:none;height:30px;' id='aletter' value=\"'\"></input></td></tr></tbody></table><hr>";
//alert(tabs);
} else {
tabs="<hr><table id=ftable border=5><tbody id=ftbody><tr id=ftr><td id=ftd style='background-color:lightgreen;'><!--canvas id=top_canvas width=100 height=100 style='position:absolute;top:0px;left:0px;width:50px;height:50px;display:none;z-index:-8;'></canvas--><iframe title='Local font character editor window' style='width:50px;height:50px;display:block;z-index:55;' id='top_iframe' src='./signature_signature.html?nocookies=" + encodeURIComponent(rss) + "&letter=" + encodeURIComponent(aalet) + "'></iframe>" + extra_as + "</td></tr><tr><td id=theletter style='background-color:lightblue;border:2px solid green;'>" + namefont + "<br>   <input type=button onclick=\"processi('" + aalet + "');\" title='Click me when my character has been digitised above' style='border:3px solid pink;z-index:55;cursor:pointer;text-decoration:none;height:30px;' id='aletter' value=" + aalet + "></input></td></tr></tbody></table><hr>";
}
//alert(tabs);
document.getElementById('fonti').innerHTML=tabs;
}
</script>
</head>
<body id=ibody style='width:100%;' onload='dofocus();'>
<form onsubmit='return lotsforthefuture(this);' id='myform' action='./textarea_pointing.html' method='GET'>
<textarea onclick='clicksup(event);' title='Base Textarea to type away on or click/touch to reposition text;font-family:Arial;font-size:12px;color:#000000;font-style:normal;' style='font-family:Arial;font-size:12px;font-style:normal;color:#000000;border:0px solid yellow;border-right:1px solid red;z-index:1;position:absolute;background-color:transparent;top:0px;left:0px;height:100vh;' id='motherboard' name='motherboard' cols=300 rows=300></textarea>
<input type='submit' id='mysubmit' value='Draw This' style='display:none;'></input>
<input name=raster id=raster type=hidden value=''></input><input name=positive id=positive type=hidden value='y'></input><input name=width id=width type=hidden value=''></input><input name=height id=height type=hidden value=''></input><input name=size id=size type=hidden value='1'></input>
<div id='d2'></div>
</form>
<div id='menu' style='margin-left:5px;background-color:yellow;position:absolute;left:85%;width:15%;top:0px;height:100vh;'><h1>  Textarea <br>  <div id=dtopsel style=display:inline;><select onchange=" if (this.value == '') { learnfont=false; } else { learnfont=settolearn(this.value.replace('both','')); if (!learnfont) { this.value=''; } } " title='Textarea Pointing or Font Learning (via Canvas or Textarea or both)' id=topsel><option value=''>Pointing</option></select></div></h1><h3>  RJM Programming</h3><h3>  December, 2017</h3>
<div id=fonti></div>
    <div id=dlearn style=display:inline;>Font</div> Family:     <input title='FPDF likes one of Arial,Courier,Helvetica,Symbol,Times,ZapfDingbats' style='margin-left:20px;' onblur="document.getElementById(focusto).style.fontFamily=altit(this.value,this.id);" type='text' id='fontf' value='Arial'></input><br>
    Font Size:     <input style='margin-left:20px;' onblur="document.getElementById(focusto).style.fontSize=altit(this.value,this.id);" type='text' id='fonts' value='12px'></input><br>
    Font Colour:     <input style='margin-left:20px;' onchange="document.getElementById(focusto).style.color=altit(this.value,this.id);" onblur="document.getElementById(focusto).style.color=altit(this.value,this.id);" type='color' id='fontc' value='#000000'></input><br>
    Font Style:     <input title='FPDF likes one of normal,bold,italic,underline' style='margin-left:20px;' onblur="document.getElementById(focusto).style.fontStyle=altit(this.value,this.id);" type='text' id='fontw' value='normal'></input><br><br>
<hr><span id=dsaveas><select onchange=pickold(this.value); id=ssaveas><option value=''>Fill in Save As or choose</option></select>    <input onblur=newone(this.value); title='Save As...' type=text value=''></input></span>
<hr> Window:  <input type='button' style='display:inline-block;' onclick="htmlout('100%');" value="New"></input> <input type='button' style='display:inline-block;' onclick="htmlout('85%');" value="Menu"></input><br>
    Canvas:     <input id=bcanvas type='button' style='margin-left:20px;' onclick=" if (document.getElementById('ipixel')) { document.getElementById('ipixel').style.top='-1200px'; document.getElementById('ipixel').style.zIndex='-5'; document.getElementById('ipixel').style.display='none'; } if (this.value == 'Canvas') { if (learnfont) { setTimeout(pib,4000); learnfont=false; } htmlout('85.0000%'); this.value='Textareas'; } else { pbtas(); } " value="Canvas"></input><div id=ddcanvas></div><br>
<div id='demail' style='display:none;'>  Email:  <input type='button' style='margin-left:20px;' onclick="htmlout(' 85%');" value="Email 📧"></input> <input type='button' onclick="htmlout('100.0%');" value="PDF"></input><br>    Download:     <input type='button' onclick="htmlout('100.00%');" value="PDF"></input><br>    Viewer:     <input type='button' style='margin-left:20px;' onclick="htmlout('100.000%');" value="PDF"></input><br><form target='iemail' action='../PHP/Geographicals/prediff.php' method='POST' style='display:none;' id='femail' name='femail'><input type=hidden name=htmltp id=htmltp value=''></input><input type=hidden name=emailto id=emailto value=''></input><input type=submit id=semail value='Email' style='display:none;'></input></form></div>
<hr>    <a target=_blank title='Emoji Use advice' href='https://www.google.com.au/search?q=emoji+keyboard+shortcuts&ie=utf-8&oe=utf-8&client=firefox-b-ab&gfe_rd=cr&dcr=0&ei=x7JKWsrFGcHN8gfBy5rABw'>Emoji 📧 Use?</a><br>
<input style='margin-left:-6000px' type='text' id='offtheradar' value=''></input>
</div><div id=dcanvas style='z-index:-9;display:none;'></div>
<iframe style='width:800px;height:800px;display:none;' name='iemail' id='iemail' onload='checki(this);' src='../PHP/Geographicals/prediff.php'></iframe>
<iframe style='position:absolute;top:-1200px;left:0px;width:800px;height:800px;display:none;z-index:-5;' name='ipixel' id='ipixel' onload='checkp(this);' src='../PHP/pixellate.php?positive=y&zeroes=-1&size=0' onclick=" this.style.top='-1200px'; this.style.display='none'; this.style.zIndex='-5'; this.style.display='none'; location.href='#ibody';"></iframe>
<iframe style='position:absolute;top:-2200px;left:0px;width:800px;height:800px;display:none;z-index:-5;' name='ifontletter' id='ifontletter' onload='checkf(this);' src='./signature_signature.html?nocookies=y' onclick=" this.style.top='-2200px'; this.style.display='none'; this.style.zIndex='-5'; this.style.display='none'; location.href='#ibody';"></iframe>
<div id='dscript'></div>
</body>
</html>