<?php
// twopi_vs_circo_example.php
// RJM Programming
// October, 2024
// Trying out Dot GraphViz package ... thanks to https://stackoverflow.com/questions/72531363/how-to-create-a-graph-with-a-circular-layout-in-graphviz
require_once(rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'make_graphviz_peers.php');
$outel='iframe';
$fmt='svg';
$verb='twopi '; // python
$codeext='dot'; // 'py';
$switch=' -T' . str_replace('html','cmapx',$fmt) . ' ';
$codeafters=' > ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'doctest-output' . DIRECTORY_SEPARATOR . 'my-twopi-vs-circo.gv.' . $fmt . ' ';
$tw='';
$xone='';
$abl=['my_twopi_vs_circo','YoumightfindmeOne','YoumightfindmeTwo','YoumightfindmeThree,YoumightfindmeZeroThree'];
$abl=['my_twopi_vs_circo',"digraph g1 {
//layout=\"circo\";
layout=\"twopi\";
ranksep=3 // set radius, in inches
root=CENTER // establish the (invisible) center node
edge [style=invis]
CENTER [style=invis]
// set equidistance all nodes from CENTER
CENTER -> {
JB
ML
VS
AM
JR
EL
LL
ML
OO
TK
JJ
PL
VP
}
// now the actual edges
edge [style=solid]
node [shape = circle];
JB -> ML [label = \"1\"];
JB -> VS [label = \"2\"];
AM -> ML [label = \"2\"];
AM -> VS [label = \"2\"];
JR -> EL [label = \"2\"];
JR -> VS [label = \"2\"];
LL -> ML [label = \"1\"];
LL -> VS [label = \"1\"];
OO -> TK [label = \"2\"];
JJ -> PL [label = \"1\"];
VS -> JB [label = \"2\"];
VS -> JR [label = \"2\"];
VS -> VP [label = \"4\"];
}",'YoumightfindmeOne=YounowfindmeOne','YoumightfindmeTwo=YounowfindmeTwo,YoumightfindmeZeroTwo=YounowfindmeZeroTwo'];
$newabl=['my-twopi-vs-circo',"digraph g1 {
//layout=\"circo\";
layout=\"twopi\";
ranksep=3 // set radius, in inches
root=CENTER // establish the (invisible) center node
edge [style=invis]
CENTER [style=invis]
// set equidistance all nodes from CENTER
CENTER -> {
JB
ML
VS
AM
JR
EL
LL
ML
OO
TK
JJ
PL
VP
}
// now the actual edges
edge [style=solid]
node [shape = circle];
JB -> ML [label = \"1\"];
JB -> VS [label = \"2\"];
AM -> ML [label = \"2\"];
AM -> VS [label = \"2\"];
JR -> EL [label = \"2\"];
JR -> VS [label = \"2\"];
LL -> ML [label = \"1\"];
LL -> VS [label = \"1\"];
OO -> TK [label = \"2\"];
JJ -> PL [label = \"1\"];
VS -> JB [label = \"2\"];
VS -> JR [label = \"2\"];
VS -> VP [label = \"4\"];
}",'YoumightfindmeOne=YounowfindmeOne','YoumightfindmeTwo=YounowfindmeTwo,YoumightfindmeZeroTwo=YounowfindmeZeroTwo'];
$tprefix='/tmp/';
$prefix='';
$suffix='';
$plus='<span id=plus>-</span>';
$minus='<span id=minus>-</span>';
$plus='<span ondblclick=domore(2); onclick=domore(1); id=plus>-</span>';
$minus='<span ondblclick=domore(-2); onclick=domore(-1); id=minus>-</span>';
$yes='n';
$mode='Graph';
$shape='';
$fsize='';
$bcol='lightblue2';
$bbcol='#aed8e8';
$newt='';
$newablzero='My%20Colour%20Wheel';
$outfn='';
$gv='.gv.';
$none='none';
$addimg='';
$suffile='';
if (isset($_POST['newablzero']) && isset($_POST['infile'])) {
$sg='</svg>';
$infis=str_replace('+',' ',urldecode($_POST['infile']));
if (file_exists($infis)) {
if (strpos($infis, 'doctest-output') !== false) {
$suffile='/doctest-output' . explode('doctest-output', $infis)[1];
if (strlen($_POST['newablzero']) > 0) {
//file_put_contents('x1.x1', '' . strlen($_POST['newablzero']));
$excont=file_get_contents($infis);
//file_put_contents('x11.x11', '' . strlen($excont));
if (strpos($excont, '</svg>') !== false) {
if (strpos($excont, '</g>') !== false) {
$sgs=explode('</g>', $excont);
$sg='</g>' . $sgs[-1 + sizeof($sgs)];
}
//file_put_contents('x111.x111', '' . strlen($excont));
$newcont=plusdata(str_replace('+',' ',urldecode($_POST['newablzero'])));
//file_put_contents('x1111.x1111', '' . strlen($newcont));
if (strpos($excont, $newcont) === false) {
//file_put_contents('x11111.x11111', '' . strlen($newcont));
$newercont=str_replace($sg, $newcont . $sg, $excont);
//file_put_contents('x111111.x111111', '' . strlen($newercont));
$outfis=rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . str_replace('doctestoutput','doctest-output',str_replace('-','',$infis));
file_put_contents($outfis, $newercont);
//file_put_contents('x1111112.x1111112', '' . strlen($newercont) . ' vs ' . $outfis . ' ' . strlen(file_get_contents($outfis)));
echo "<html><body onload=\" parent.setAVal('saved_twopi_vs_circo_" . server_remote_addr() . str_replace('/','_',$_POST['infile']) . "-' + parent.document.getElementById('ititle').value.replace(/\-/g,'_').replace(/\ /g,'_'), top.document.URL.split(':')[0] + '://' + '" . $_SERVER['SERVER_NAME'] . $suffile . "'); parent.cookieAVal('saved_twopi_vs_circo_', true); \"></body></html>";
exit;
}
}
} else {
$excont=file_get_contents($infis);
$outfis=rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . str_replace('doctestoutput','doctest-output',str_replace('-','',$infis));
file_put_contents($outfis, $excont);
echo "<html><body onload=\" parent.setAVal('saved_twopi_vs_circo_" . server_remote_addr() . str_replace('/','_',$_POST['infile']) . "-' + parent.document.getElementById('ititle').value.replace(/\-/g,'_').replace(/\ /g,'_'), top.document.URL.split(':')[0] + '://' + '" . $_SERVER['SERVER_NAME'] . $suffile . "'); parent.cookieAVal('saved_twopi_vs_circo_', true); \"></body></html>";
exit;
}
}
}
exit;
}
function plusdata($aig) {
$outig=$aig;
$dlm='"';
$outgs=explode('data:', $aig);
if (sizeof($outgs) > 1) {
$outig=$outgs[0];
$dlm=substr($outig,-1,1);
for ($iop=1; $iop<sizeof($outgs); $iop++) {
$outig.='data:' . str_replace(explode($dlm,$outgs[$iop])[0], str_replace('%20','+',str_replace(' ','+',explode($dlm,$outgs[$iop])[0])) ,$outgs[$iop]);
}
}
return $outig;
}
function ourfile_exists($infn) {
global $outfn, $gv, $tw, $fmt;
$retv=file_exists($infn);
if ($retv && $tw != '') {
if (strpos($infn, "/") === false) {
$tw='&thewords=' . urlencode("/" . $infn);
} else {
$tw='&thewords=' . urlencode(str_replace($_SERVER['DOCUMENT_ROOT'],'',$infn));
}
}
if ($retv && $fmt == 'html') {
exec('chmod 777 ' . $infn);
exec('chown rjmprogr ' . $infn);
exec('chgrp rjmprogr ' . $infn);
exec('rm -f ' . $infn);
$tw='&thewords=' . urlencode("//www.rjmprogramming.com.au/doctest-output/d.png");
file_put_contents($infn, "<html><head><style> * { margin: 0 0 0 0; padding: 0 0 0 0; }</style></head><body><img src='" . 'data:image/png;base64,' . base64_encode(file_get_contents("doctest-output" . DIRECTORY_SEPARATOR . "d.png")) . "' usemap='#V'/>" . str_replace("<area ", "<area onclick=\"if (parent.document.getElementById('hidecol')) { if (('' + this.href).indexOf('#') != -1) { parent.document.getElementById('hidecol').value=decodeURIComponent(this.href.split('#')[1].replace(/\+/g,'%20')); } else { parent.document.getElementById('hidecol').value=this.title; } }\" ontouchdown=\" if ((this.href + '!').indexOf('&q=!') != -1) { this.href+=encodeURIComponent(this.title); }\" ontouchstart=\" if ((this.href + '!').indexOf('&q=!') != -1) { this.href+=encodeURIComponent(this.title); }\" onmouseover=\" if ((this.href + '!').indexOf('&q=!') != -1) { this.href+=encodeURIComponent(this.title); }\" target='blank' ", str_replace("http:", "", str_replace("https:", "", str_replace("&", "&", file_get_contents("doctest-output" . DIRECTORY_SEPARATOR . "d.map"))))) . "</body></html>");
}
if ($retv && strpos($infn, '.svg') !== false && 1 == 2) {
exec('chmod 777 ' . $infn);
exec('chown rjmprogr ' . $infn);
exec('chgrp rjmprogr ' . $infn);
$retc=file_get_contents($infn);
$gv='.GV.';
$outfn=str_replace('.gv.','.GV.',$infn);
file_put_contents($outfn, str_replace('<g id=', '<g onclick="parent.svgit(this);" id=', $infn));
exec('chmod 777 ' . $outfn);
exec('chown rjmprogr ' . $outfn);
exec('chgrp rjmprogr ' . $outfn);
}
return $retv;
}
$nondefshapes=str_replace("\n","","
<option value=box>Box</option>
<option value=polygon>Polygon</option>
<option value=ellipse>Ellipse</option>
<option value=oval>Oval</option>
<option value=circle>Circle</option>
<option value=point>Point</option>
<option value=egg>Egg</option>
<option value=triangle>Triangle</option>
<option value=plaintext>Plaintext</option>
<option value=plain>Plain</option>
<option value=diamond>Diamond</option>
<option value=trapezium>Trapezium</option>
<option value=parallelogram>Parallelogram</option>
<option value=house>House</option>
<option value=pentagon>Pentagon</option>
<option value=hexagon>Hexagon</option>
<option value=septagon>Septagon</option>
<option value=octagon>Octagon</option>
<option value=doublecircle>Doublecircle</option>
<option value=doubleoctagon>Doubleoctagon</option>
<option value=tripleoctagon>Tripleoctagon</option>
<option value=invtriangle>Invtriangle</option>
<option value=invtrapezium>Invtrapezium</option>
<option value=invhouse>Invhouse</option>
<option value=Mdiamond>Mdiamond</option>
<option value=Msquare>Wsquare</option>
<option value=Mcircle>Mcircle</option>
<option value=rect>Rect</option>
<option value=rectangle>Rectangle</option>
<option value=square>Square</option>
<option value=star>Star</option>
<option value=none>None</option>
<option value=underline>Underline</option>
<option value=cylinder>Cylinder</option>
<option value=note>Note</option>
<option value=tab>Tab</option>
<option value=folder>Folder</option>
<option value=box3d>Box3d</option>
<option value=component>Component</option>
<option value=promoter>Promoter</option>
<option value=cds>Cds</option>
<option value=terminator>Terminator</option>
<option value=utr>Utr</option>
<option value=primersite>Primersite</option>
<option value=restrictionsite>Restrictionsite</option>
<option value=fivepoverhang>Fivepoverhang</option>
<option value=threepoverhang>Threepoverhang</option>
<option value=noverhang>Noverhang</option>
<option value=assembly>Assembly</option>
<option value=signature>Signature</option>
<option value=insulator>Insulator</option>
<option value=ribosite>Ribosite</option>
<option value=rnastab>Rnastab</option>
<option value=proteasesite>Proteasesite</option>
<option value=proteinstab>Proteinstab</option>
<option value=rpromoter>Rpromoter</option>
<option value=rarrow>Rarrow</option>
<option value=larrow>Larrow</option>
<option value=lpromoter>Lpromoter</option>");
$pyprefix='';
$pymidbit='';
$pysuffix='';
function doone() {
global $xone, $pycont;
if ($xone != '') {
if (strpos($xone, ',') !== false && substr((' ' . $xone),-1,1) != '}') {
$xsone=explode(',', $xone);
for ($iij=0; $iij<sizeof($xsone); $iij++) {
$xone=$xsone[$iij];
if (strpos($xone, '=') !== false) {
$pycont=str_replace(explode('=',$xone)[0], explode('=',$xone)[1], $pycont);
} else {
$pycont=str_replace($abl[1], $xone, $pycont);
}
}
} else if (substr((' ' . $xone),-1,1) == '}') {
$pycont=$xone;
} else if (strpos($xone, '=') !== false) {
$pycont=str_replace(explode('=',$xone)[0], explode('=',$xone)[1], $pycont);
} else {
$pycont=str_replace($abl[1], $xone, $pycont);
}
}
}
function server_remote_addr() {
$rma = $_SERVER['REMOTE_ADDR'];
return str_replace('.','_',$rma);
}
if (!isset($_POST['one']) && !isset($_POST['two']) && !isset($_POST['three']) && !isset($_POST['original'])) {
$yes='y';
//$newabl[1]='';
$newabl[2]='';
$newabl[3]='';
$_POST['one']=$newabl[1];
$_POST['two']=$newabl[2];
$_POST['three']=$newabl[3];
} else {
$none='inline-block';
$plus='<span title=Bigger ondblclick=domore(2); onclick=domore(1); style=cursor:pointer;text-decoration:underline; id=plus>+</span>';
$minus='<span title=Smaller ondblclick=domore(-2); onclick=domore(-1); style=cursor:pointer;text-decoration:underline; id=minus>-</span>';
}
if (strpos($newabl[0], 'iagram') !== false) {
$parts=explode('-',str_replace('_','-',$newabl[0]));
$newt='';
for ($iy=0; $iy<sizeof($parts); $iy++) {
$newt.=strtoupper(substr($parts[$iy],0,1)) . strtolower(substr($parts[$iy],1)) . ' ';
}
}
if (isset($_POST['fmt'])) {
$fmt=trim(str_replace('+',' ',urldecode($_POST['fmt'])));
if ($fmt == 'png' || $fmt == 'jpg') {
$outel='img draggable=true ';
$tw='&thewords=';
}
$switch=' -T' . str_replace('html','cmapx',$fmt) . ' ';
$codeafters=' > ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'doctest-output' . DIRECTORY_SEPARATOR . 'my-twopi-vs-circo.gv.' . $fmt . ' ';
} else if (!isset($_POST['original'])) {
$_POST['fmt']='svg';
}
if (isset($_POST['title'])) {
$newabl[0]=trim(str_replace('+',' ',urldecode($_POST['title'])));
$newablzero=str_replace('+','%20',urlencode($newabl[0]));
$switch=' -T' . str_replace('html','cmapx',$fmt) . ' ';
$codeafters=' > ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'doctest-output' . DIRECTORY_SEPARATOR . $newablzero . '.gv.' . $fmt . ' ';
} else if (!isset($_POST['original'])) {
$_POST['title']=$newabl[0];
}
if (isset($_POST['addimg'])) {
$addimg=plusdata(str_replace('+',' ',urldecode($_POST['addimg'])));
} else if (!isset($_POST['original'])) {
$_POST['addimg']='';
}
if (isset($_POST['mode'])) {
$mode=trim(str_replace('+',' ',urldecode($_POST['mode'])));
} else if (!isset($_POST['original'])) {
$_POST['mode']='Graph';
}
if (isset($_POST['back'])) {
$bcol=trim(str_replace('+',' ',urldecode($_POST['back'])));
if (strlen($bcol) == 6) { $bcol='#' . trim(str_replace('+',' ',urldecode($_POST['back']))); $bbcol=$bcol; } else if (strlen($bcol) == 7) { $bbcol=$bcol; }
} else if (!isset($_POST['original'])) {
$_POST['back']='lightblue2';
}
if (isset($_POST['shape'])) {
$shape=trim(str_replace('+',' ',urldecode($_POST['shape'])));
} else if (!isset($_POST['original'])) {
$_POST['shape']='';
}
if (isset($_POST['fsize'])) {
$fsize=trim(str_replace('+',' ',urldecode($_POST['fsize'])));
} else if (!isset($_POST['original'])) {
$_POST['fsize']='';
}
if (isset($_POST['one']) && isset($_POST['two']) && isset($_POST['three'])) {
$xone=str_replace('+',' ',(urldecode( str_replace("%2b","%0b",str_replace("%2B","%0b",$_POST['one'])))));
$prefix=$_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR; //'/tmp/';
$newabl[1]=str_replace('+',' ',urldecode(str_replace("%2b","%0b",str_replace("%2B","%0b",$_POST['one']))));
$newabl[2]=str_replace('+',' ',urldecode(str_replace("%2b","%0b",str_replace("%2B","%0b",$_POST['two']))));
$newabl[3]=str_replace('+',' ',urldecode(str_replace("%2b","%0b",str_replace("%2B","%0b",$_POST['three']))));
if ($fmt == 'html') {
if (!file_exists('./twopi_vs_circo.' . strtoupper($codeext))) {
exec("/usr/bin/" . $verb . " " . rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . "twopi_vs_circo.dot -Tsvg -o " . rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . "doctest-output" . DIRECTORY_SEPARATOR . "d.svg");
$svghelp=file_get_contents(rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . "doctest-output" . DIRECTORY_SEPARATOR . "d.svg");
//exec("cat " . rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . "twopi_vs_circo.dot | sed '/\\(\\\"\\)\\([^\\\"]*\)\\\" \\[color = /s//\\\"\\2\\\" \\[url = \\\"https\\:\\/\\/www.google.com\\/search\\?udm=2\\&sa=X\\&biw=1433\\&bih=739\\&dpr=2\\&q=\\2\\\"\\, color = /g' > " . rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . "twopi_vs_circo.DOT");
$pycont=file_get_contents('./twopi_vs_circo.' . $codeext);
doone();
$bits=explode('" [color = ', $pycont);
for ($iy=(-1 + sizeof($bits)); $iy>=1; $iy--) {
$thislab=explode('"', $bits[-1 + $iy])[-1 + sizeof(explode('"', $bits[-1 + $iy]))];
if (strpos($svghelp, '>' . $thislab . '</title>') !== false) {
$pycont=str_replace('"' . $thislab . '" [color = ', '"' . $thislab . '" [URL = "https://www.google.com/search?udm=2&sa=X&biw=1433&bih=739&dpr=2&q=' . urlencode($thislab) . str_replace('##','#','#' . urlencode(explode('"', explode(' fill="', explode('>' . $thislab . '</title>', $svghelp)[1])[1])[0])) . '" color = ', $pycont);
} else {
$pycont=str_replace('"' . $thislab . '" [color = ', '"' . $thislab . '" [URL = "https://www.google.com/search?udm=2&sa=X&biw=1433&bih=739&dpr=2&q=' . urlencode($thislab) . '" color = ', $pycont);
}
$bits=explode('" [color = ', $pycont);
}
$bits=explode(' [height=', str_replace("\t"," ",$pycont));
for ($iy=(-1 + sizeof($bits)); $iy>=1; $iy--) {
$thislab=explode(' ', $bits[-1 + $iy])[-1 + sizeof(explode(' ', $bits[-1 + $iy]))];
if (strpos($svghelp, '>' . $thislab . '</title>') !== false) {
$pycont=str_replace('' . $thislab . ' [height=', '' . $thislab . ' [URL = "https://www.google.com/search?udm=2&sa=X&biw=1433&bih=739&dpr=2&q=' . urlencode($thislab) . str_replace('##','#','#' . urlencode(explode('"', explode(' fill="', explode('>' . $thislab . '</title>', $svghelp)[1])[1])[0])) . '" height=', $pycont);
} else {
$pycont=str_replace('' . $thislab . ' [height=', '' . $thislab . ' [URL = "https://www.google.com/search?udm=2&sa=X&biw=1433&bih=739&dpr=2&q=' . urlencode($thislab) . '" height=', $pycont);
}
$bits=explode(' [height=', str_replace("\t"," ",$pycont));
}
file_put_contents('./twopi_vs_circo.' . strtoupper($codeext), $pycont);
}
if (file_exists('./twopi_vs_circo.' . strtoupper($codeext))) {
$pycont=file_get_contents('./twopi_vs_circo.' . strtoupper($codeext));
doone();
}
$prefstuff='';
if (file_exists('doctest-output/d.png')) {
$prefstuff.="rm -f " . rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . "doctest-output" . DIRECTORY_SEPARATOR . "d.png ; ";
}
if (file_exists('doctest-output/d.map')) {
$prefstuff.="rm -f " . rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . "doctest-output" . DIRECTORY_SEPARATOR . "d.map ; ";
}
exec($prefstuff . "/usr/bin/" . $verb . " " . rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . "twopi_vs_circo.DOT -Tpng -o " . rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . "doctest-output" . DIRECTORY_SEPARATOR . "d.png -Tcmapx -o " . rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . "doctest-output" . DIRECTORY_SEPARATOR . "d.map");
} else {
$pycont=file_get_contents('./twopi_vs_circo.' . $codeext);
doone();
}
if (trim($newt) != '') {
$newablzero=str_replace('+','%20',urlencode(trim($newt)));
$pycont=str_replace("My Circular Layout", trim($newt), $pycont);
}
if (strpos($pycont, 'u=u') !== false) {
$pyprefix=explode('u.edge(', $pycont)[0];
$pysuffix='' . explode('u=u', $pycont)[1];
//$pysuffix='' . explode('u.view()', $pycont)[1];
$pycont=$pyprefix . "\n\n" . $pysuffix;
} else if (strpos($pycont, 'u.view()') !== false) {
$pyprefix=explode('u.edge(', $pycont)[0];
$pysuffix='u.view()' . explode('u.view()', $pycont)[1];
//$pysuffix='' . explode('u.view()', $pycont)[1];
$pycont=$pyprefix . "\n\n" . $pysuffix;
}
if ($bcol != 'lightblue2' && trim($bcol) != '') {
$pycont=str_replace('lightblue2', $bcol, $pycont);
}
if ($shape != '') {
$pycont=str_replace("shape=circle", "shape=" . $shape . "", $pycont);
}
if ($fsize != '') {
$pycont=str_replace("fontsize = 12]", "fontsize = " . (explode(',',$fsize)[0] == '' ? '10' : explode(',',$fsize)[0]) . "]", $pycont);
if (strpos($fsize, ',') !== false) {
$pycont=str_replace("fontsize = 12]", "fontsize = " . (explode(',',$fsize)[1] == '' ? '20' : explode(',',$fsize)[1]) . "]", $pycont);
}
}
//$xone=str_replace("\t","+", str_replace('~','', str_replace('+',' ',str_replace('+|','`|',str_replace('+;','`;',str_replace('+;','`;',str_replace('+,','`,',urldecode( str_replace("%2b","%0b",str_replace("%2B","%0b",$_POST['one'])) . urlencode('~'))) ))) )));
//$xtwo=str_replace("\t","+", str_replace('~','', str_replace('+',' ',str_replace('+|','`|',str_replace('+;','`;',str_replace('+;','`;',str_replace('+,','`,',urldecode( str_replace("%2b","%0b",str_replace("%2B","%0b",$_POST['two'])) . urlencode('~'))) ))) )));
//$xthree=str_replace("\t","+", str_replace('~','', str_replace('+',' ',str_replace('+|','`|',str_replace('+;','`;',str_replace('+;','`;',str_replace('+,','`,',urldecode( str_replace("%2b","%0b",str_replace("%2B","%0b",$_POST['three'])) . urlencode('~'))) ))) )));
//$xone=str_replace("\t","+", str_replace('+',' ',(urldecode( str_replace("%2b","%0b",str_replace("%2B","%0b",$_POST['one']))))));
//$xtwo=str_replace("\t","+", str_replace('+',' ',(urldecode( str_replace("%2b","%0b",str_replace("%2B","%0b",$_POST['two']))))));
//$xthree=str_replace("\t","+", str_replace('+',' ',(urldecode( str_replace("%2b","%0b",str_replace("%2B","%0b",$_POST['three']))))));
$xone=str_replace('+',' ',(urldecode( str_replace("%2b","%0b",str_replace("%2B","%0b",$_POST['one'])))));
$xtwo=str_replace('+',' ',(urldecode( str_replace("%2b","%0b",str_replace("%2B","%0b",$_POST['two'])))));
$xthree=str_replace('+',' ',(urldecode( str_replace("%2b","%0b",str_replace("%2B","%0b",$_POST['three'])))));
if (strpos($xtwo, ',') !== false) {
$xsone=explode(',', $xtwo);
for ($iij=0; $iij<sizeof($xsone); $iij++) {
$xtwo=$xsone[$iij];
if (strpos($xtwo, '=') !== false) {
$pycont=str_replace(explode('=',$xtwo)[0], explode('=',$xtwo)[1], $pycont);
} else {
$pycont=str_replace($abl[2], $xtwo, $pycont);
}
}
} else if (strpos($xtwo, '=') !== false) {
$pycont=str_replace(explode('=',$xtwo)[0], explode('=',$xtwo)[1], $pycont);
} else {
$pycont=str_replace($abl[2], $xtwo, $pycont);
}
if (strpos($xthree, ',') !== false) {
$xsone=explode(',', $xthree);
for ($iij=0; $iij<sizeof($xsone); $iij++) {
$xthree=$xsone[$iij];
if (strpos($xthree, '=') !== false) {
$pycont=str_replace(explode('=',$xthree)[0], explode('=',$xthree)[1], $pycont);
} else {
$pycont=str_replace($abl[3], $xthree, $pycont);
}
}
} else if (strpos($xthree, '=') !== false) {
$pycont=str_replace(explode('=',$xthree)[0], explode('=',$xthree)[1], $pycont);
} else {
$pycont=str_replace($abl[3], $xthree, $pycont);
}
$pycont=str_replace($abl[0], $newabl[0], $pycont);
if ($fmt != 'svg') {
$pycont=str_replace("format='svg'", "format='" . $fmt . "'", $pycont);
}
if (strpos($newabl[0], 'iagram') !== false) {
$parts=explode('-',str_replace('_','-',$newabl[0]));
$newt='';
for ($iy=0; $iy<sizeof($parts); $iy++) {
$newt.=strtoupper(substr($parts[$iy],0,1)) . strtolower(substr($parts[$iy],1)) . ' ';
}
if (trim($newt) != '') {
$pycont=str_replace("My Circular Layout", trim($newt), $pycont);
}
}
$pycont=str_replace('doctest-output', $prefix . 'doctest-output', $pycont);
if (strtolower($mode) != 'graph' && trim($mode) != '') {
$pycont=str_replace('Graph Colour_', '' . strtoupper(substr($mode,0,1)) . strtolower(substr($mode,1)) . '', str_replace('graph Colour_', '' . strtolower($mode) . ' Colour_', $pycont));
}
if ($yes != 'y') { // use crontab
$suffix='_' . server_remote_addr();
file_put_contents($tprefix . 'twopi_vs_circo_' . $suffix . '.' . $codeext, $pycont);
file_put_contents($prefix . 'twopi_vs_circo0_' . $suffix . '.' . $codeext, $pycont);
//file_put_contents($prefix . 'twopi_vs_circo_' . $suffix . '.ksh', "#!/bin/ksh\n/usr/bin/" . $verb . $switch . " " . $prefix . "twopi_vs_circo_" . $suffix . "." . $codeext . $codeafters . " 2>> " . $prefix . "twopi_vs_circo.bad \nln -s " . $prefix . "doctest-output" . DIRECTORY_SEPARATOR . $newabl[0] . ".gv.pdf " . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "doctest-output" . DIRECTORY_SEPARATOR . $newabl[0] . ".gv.pdf \nrm -f " . $prefix . "twopi_vs_circo_" . $suffix . "." . $codeext . $codeafters . " \nrm -f " . $prefix . "twopi_vs_circo_" . $suffix . ".ksh \nexit");
file_put_contents($prefix . 'twopi_vs_circo_' . $suffix . '.ksh', "#!/bin/ksh\n/usr/bin/" . $verb . $switch . " " . $tprefix . "twopi_vs_circo_" . $suffix . "." . $codeext . $codeafters . " 2>> " . $prefix . "twopi_vs_circo.bad \nsleep 5\n\n/usr/bin/" .$verb . $switch . $tprefix . "twopi_vs_circo_" . $suffix . "." . $codeext . $codeafters . " 2>> " . $prefix . "twopi_vs_circo.bad \n\nrm -f " . $tprefix . "twopi_vs_circo_" . $suffix . "." . $codeext . " \nrm -f " . $prefix . "twopi_vs_circo_" . $suffix . ".ksh \nexit");
file_put_contents($prefix . 'twopi_vs_circo0_' . $suffix . '.ksh', "#!/bin/ksh\n/usr/bin/" . $verb . $switch . " " . $tprefix . "twopi_vs_circo_" . $suffix . "." . $codeext . $codeafters . " 2>> " . $prefix . "twopi_vs_circo.bad \nsleep 5\n\n/usr/bin/" .$verb . $switch . $tprefix . "twopi_vs_circo_" . $suffix . "." . $codeext . $codeafters . " 2>> " . $prefix . "twopi_vs_circo.bad \n\nrm -f " . $tprefix . "twopi_vs_circo_" . $suffix . "." . $codeext . " \nrm -f " . $prefix . "twopi_vs_circo_" . $suffix . ".ksh \nexit");
exec('chmod 777 ' . $prefix . 'twopi_vs_circo_' . $suffix . '.ksh');
exec('chown root ' . $prefix . 'twopi_vs_circo_' . $suffix . '.ksh');
exec('chgrp root ' . $prefix . 'twopi_vs_circo_' . $suffix . '.ksh');
while (file_exists($prefix . 'twopi_vs_circo_' . $suffix . '.ksh')) {
sleep(10);
}
} else {
file_put_contents('/tmp/twopi_vs_circo.' . $codeext, $pycont);
exec('chmod 777 ' . '/tmp/twopi_vs_circo.' . $codeext);
exec('chown rjmprogr ' .'/tmp/twopi_vs_circo.' . $codeext);
exec('chgrp rjmprogr ' . '/tmp/twopi_vs_circo.' . $codeext);
//if (file_exists('doctest-output' . DIRECTORY_SEPARATOR . $newabl[0] . '.gv.' . $fmt)) {
//exec('rm -f ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $newabl[0] . '.gv.' . $fmt);
//exec('rm -f ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $newabl[0] . '.gv');
//unlink('doctest-output' . DIRECTORY_SEPARATOR . $newabl[0] . '.gv.' . $fmt);
//unlink('doctest-output' . DIRECTORY_SEPARATOR . $newabl[0] . '.gv');
//}
//file_put_contents('x.x', '/usr/bin/' .$verb . $switch . '/tmp/twopi_vs_circo.' . $codeext . $codeafters . ' 2> twopi_vs_circo.bad');
exec('/usr/bin/' .$verb . $switch . '/tmp/twopi_vs_circo.' . $codeext . $codeafters . ' 2> twopi_vs_circo.bad');
sleep(8);
//if (file_exists($prefix . 'doctest-output' . DIRECTORY_SEPARATOR . $newabl[0] . '.gv.pdf')) {
//exec('ln -s ' . $prefix . 'doctest-output' . DIRECTORY_SEPARATOR . $newabl[0] . '.gv.pdf ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'doctest-output' . DIRECTORY_SEPARATOR . $newabl[0] . '.gv.pdf');
//}
}
} else {
//file_put_contents('xx.xx', '/usr/bin/' . $verb . $switch . ' twopi_vs_circo.' . $codeext . $codeafters);
exec('/usr/bin/' . $verb . $switch . ' twopi_vs_circo.' . $codeext . $codeafters);
sleep(8);
}
if (ourfile_exists($prefix . 'doctest-output' . DIRECTORY_SEPARATOR . $newabl[0] . '.gv.' . $fmt)) {
exec('chmod 777 ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $newabl[0] . $gv . $fmt);
exec('chmod 777 ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $newabl[0] . '.gv');
exec('chown rjmprogr ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $newabl[0] . $gv . $fmt);
exec('chown rjmprogr ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $newabl[0] . '.gv');
exec('chgrp rjmprogr ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $newabl[0] . $gv . $fmt);
exec('chgrp rjmprogr ' . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $newabl[0] . '.gv');
echo "<html>
<head>
<title>Trying out Dot GraphViz hosted in PHP - RJM Programming - October, 2024 - Circular Layout</title>
<scr" . "ipt type=text/javascript>
var lasturl='', lasttext=null, gzero=null, gone=null, lastx=0, lasty=0, lastw=0, lasth=0, lastp='', wasfrom=null, relrec='', clickcnt=0, lastwoo=null, lastj=0, lssel='', zerodotsix='0.6', bconto=null, pos3=0, pos4=0, dbt='', ifrect=null, bigoh='', lastoh='', lasto=null, svgconto=null, ellfill='', ellfillop='', midpoint='', rxry='', lastiurl='', szero=null, aimg='', lastimgc='', lastsvggeo=null, uselast=false;
String.prototype.toHtmlEntities = function() {
return this.replace(/./gm, function(s) {
return (s.match(/[a-z0-9\s]+/i)) ? s : '&#' + s.charCodeAt(0) + ';';
});
};
function onerecord(inoh, thepointx, thepointy, thepxx, thepxy) {
var myax=0, myay=0;
var mycx=0, mycy=0;
var ptsare=[];
var ynn='youllneverfindthis';
var vsone=top.document.getElementById('one').value;
var vsell=vsone.split('[height=');
var outoh=inoh;
if (outoh.indexOf(' fill=') == -1) {
outoh=outoh.replace(' ','X ');
outoh=' fill=' + outoh;
}
midpoint='';
rxry='';
switch ((inoh + ' ').substring(1).split(' ')[0].split('>')[0]) {
case 'area':
if (inoh.indexOf(' coords=\"') != -1) {
myax=inoh.split(' coords=\"')[1].split(',')[0];
myay=inoh.split(' coords=\"')[1].split(',')[1];
lastoh+=',' + myax + ',' + myay;
if (szero.outerHTML.indexOf(inoh) != -1) {
lastoh+=',' + szero.outerHTML.split(inoh).split('<area').length;
} else {
lastoh+=',-0';
}
} else {
return inoh;
}
//alert('here with area ' + lastoh);
break;
case 'img':
//alert('here with img');
break;
case 'polygon':
ynn='cx';
if (inoh.indexOf(' points=\"') != -1) {
ptsare=inoh.split(' points=\"')[1].split('\"')[0].replace(/\ /g,',').split(',');
rxry=',' + Math.abs(eval(eval('' + ptsare[4]) - eval('' + ptsare[0]))) + ',' + Math.abs(eval(eval('' + ptsare[5]) - eval('' + ptsare[1])));
mycx='' + eval(eval(eval('' + ptsare[4]) + eval('' + ptsare[0])) * 0.5); //eval(eval('' + ptsare[4]) - eval('' + ptsare[0]));
mycy='' + eval(eval(eval('' + ptsare[5]) + eval('' + ptsare[1])) * 0.5); //eval(eval('' + ptsare[5]) - eval('' + ptsare[1]));
midpoint=',' + eval(eval(eval('' + ptsare[4]) + eval('' + ptsare[0])) * 0.5) + ',' + eval(eval(eval('' + ptsare[5]) + eval('' + ptsare[1])) * 0.5);
//alert('rxry=' + rxry + ' and midpoint=' + midpoint + ' and outoh=' + outoh);
//var wer=prompt(szero.outerHTML, szero.outerHTML);
}
case 'ellipse':
if (inoh.indexOf(' cx=') != -1) {
mycx=inoh.split(' cx=')[1].substring(1).split(inoh.split(' cx=')[1].substring(0,1))[0];
mycy=inoh.split(' cy=')[1].substring(1).split(inoh.split(' cy=')[1].substring(0,1))[0];
}
lastoh+=',' + mycx + ',' + mycy;
//alert('mycxy=' + mycx + ',' + mycy + ' becomes ' + Math.round(eval(mycx * 3.0 / 4.0)) + ',' + Math.round(eval(288 - eval(mycy * 3.0 / 4.0))));
//lastoh+=',' + Math.round(eval(mycx * 3.0 / 4.0)) + ',' + Math.round(eval(288 - eval(mycy * 3.0 / 4.0)));
if (szero.outerHTML.indexOf(outoh.split(' fill=')[1].split(' ' + ynn + '=')[0].split('/>')[0].split('</')[0].split('>')[0]) == -1) {
//var sdf=prompt(inoh + ' not in ' + szero.outerHTML, inoh + ' not in ' + szero.outerHTML);
lastoh+=',-0';
if (midpoint != '') {
lastoh+=midpoint;
} else if (eval('' + vsell.length) > 1) {
lastoh+=',' + vsell[1].split(' pos=\"')[1].split('\"')[0];
} else {
lastoh+=',' + vsone.split(' pos=\"')[1].split('\"')[0];
}
} else if (szero.outerHTML.indexOf(outoh.split(' fill=')[1].split(' ' + ynn + '=')[0].split('/>')[0].split('</')[0].split('>')[0]) != -1) {
if (ynn == 'cx') {
lastoh+=',0000' + eval(-2 + eval('' + szero.outerHTML.split(outoh.split(' fill=')[1].split(' ' + ynn + '=')[0].split('/>')[0].split('</')[0].split('>')[0])[0].split('<' + (inoh + ' ').substring(1).split(' ')[0].split('>')[0] + ' ').length));
} else {
lastoh+=',0000' + eval(-1 + eval('' + szero.outerHTML.split(outoh.split(' fill=')[1].split(' ' + ynn + '=')[0].split('/>')[0].split('</')[0].split('>')[0])[0].split('<' + (inoh + ' ').substring(1).split(' ')[0].split('>')[0] + ' ').length));
}
if (eval('' + vsell.length) > eval('' + szero.outerHTML.split(inoh)[0].split('<' + (inoh + ' ').substring(1).split(' ')[0].split('>')[0]).length)) {
vssel.push('');
lastoh+=',' + vsell[eval('' + szero.outerHTML.split(outoh.split(' fill=')[1].split(' ' + ynn + '=')[0].split('/>')[0].split('</')[0].split('>')[0])[0].split('<' + (inoh + ' ').substring(1).split(' ')[0].split('>')[0] + ' ').length)].split(' pos=\"')[1].split('\"')[0];
} else {
if (midpoint != '') {
lastoh+=midpoint;
} else if (eval('' + vsell.length) > 1) {
lastoh+=',' + vsell[1].split(' pos=\"')[1].split('\"')[0];
} else {
lastoh+=',' + vsone.split(' pos=\"')[1].split('\"')[0];
}
}
}
break;
case 'text':
var myx=inoh.split(' x=')[1].substring(1).split(inoh.split(' x=')[1].substring(0,1))[0];
var myy=inoh.split(' y=')[1].substring(1).split(inoh.split(' y=')[1].substring(0,1))[0];
lastoh+=',' + myx + ',' + myy;
//lastoh+=',' + Math.round(eval(mycx * 3.0 / 4.0)) + ',' + Math.round(eval(288 - eval(mycy * 3.0 / 4.0)));
if (szero.outerHTML.indexOf(outoh.split(' x=')[1].split('/>')[0].split('</')[0].split('>')[0]) == -1) {
lastoh+=',-0';
if (vsone.indexOf(' xlabel=\"' + inoh.split('>')[1].split('<')[0] + '\" xlp=\"') != -1) {
lastoh+=',' + vsone.split(' xlabel=\"' + inoh.split('>')[1].split('<')[0] + '\" xlp=\"')[1].split('\"')[0];
} else {
lastoh+=',' + vsone.split(' pos=\"')[1].split('\"')[0];
}
} else if (szero.outerHTML.indexOf(outoh.split(' x=')[1].split('/>')[0].split('</')[0].split('>')[0]) != -1) {
lastoh+=',0000' + eval(-1 + eval('' + szero.outerHTML.split(outoh.split(' x=')[1].split('/>')[0].split('</')[0].split('>')[0])[0].split('<text ').length));
if (vsone.indexOf(' xlabel=\"' + inoh.split('>')[1].split('<')[0] + '\" xlp=\"') != -1) {
lastoh+=',' + vsone.split(' xlabel=\"' + inoh.split('>')[1].split('<')[0] + '\" xlp=\"')[1].split('\"')[0];
} else if (vsone.indexOf(' ' + inoh.split('>')[1].split('<')[0] + '[height=') != -1) {
if (xsone.split(' ' + inoh.split('>')[1].split('<')[0] + '[height=')[1].split(']')[0].indexOf(' xlp=\"') == -1 && xsone.split(' ' + inoh.split('>')[1].split('<')[0] + '[height=')[1].split(']')[0].indexOf(' pos=\"') != -1) {
lastoh+=',' + xsone.split(' ' + inoh.split('>')[1].split('<')[0] + '[height=')[1].split(']')[0].split(' pos=\"')[1].split('\"')[0];
} else if (xsone.split(' ' + inoh.split('>')[1].split('<')[0] + '[height=')[1].split(']')[0].indexOf(' xlp=\"') != -1) {
lastoh+=',' + xsone.split(' ' + inoh.split('>')[1].split('<')[0] + '[height=')[1].split(']')[0].split(' xlp=\"')[1].split('\"')[0];
} else {
lastoh+=',0,0';
}
} else {
lastoh+=',' + vsone.split(' pos=\"')[1].split('\"')[0];
}
}
break;
default:
break;
}
return inoh;
}
function fixgraph(osel) {
var vone=document.getElementById('one').value;
if (vone.indexOf('graph ') != -1 && osel.value != '') {
if (document.getElementById('one').value.indexOf('digraph ') != -1 && osel.value.toLowerCase() == 'graph') {
document.getElementById('one').value=vone.replace('digraph ', 'graph ');
} else if (document.getElementById('one').value.indexOf('digraph ') == -1 && osel.value.toLowerCase() == 'digraph') {
document.getElementById('one').value=vone.replace('graph ', 'digraph ');
}
}
}
function fixshape(osel) {
var vone=document.getElementById('one').value;
if (vone.indexOf('shape=') != -1 && osel.value != '') {
document.getElementById('one').value=vone.replace('shape=' + document.getElementById('one').value.split('shape=')[1].split(' ')[0].split(']')[0], 'shape=' + osel.value);
}
}
function fixfont(oin) {
var vone=document.getElementById('one').value;
if (vone.indexOf('fontsize=') != -1 && oin.value != '') {
document.getElementById('one').value=vone.replace('fontsize=' + document.getElementById('one').value.split('fontsize=')[1].split(' ')[0].split(']')[0], 'fontsize=' + oin.value);
if (eval('' + oin.value.indexOf(' ')) > 0) {
oin.value=oin.value.split(' ')[0];
}
}
}
function hwize(whcom) {
var whs=whcom.split(',');
if (whcom.indexOf(',') != -1) {
//alert('relrec=' + relrec + ' and wasfrom=' + wasfrom + ' and ' + whs[1] + ' width=' + whs[0]);
return '' + whs[1] + ' width=' + whs[0];
}
//alert('Relrec=' + relrec + ' and wasfrom=' + wasfrom + ' ' + whcom);
return '' + whcom;
}
function reshape(cshape, oit, polygono, centx, centy, widthd, heightd) {
// points='198,-198 144,-198 144,-126 198,-126 198,-198'
var outshape=cshape;
if (outshape.indexOf(' rx=\"') != -1) {
outshape=outshape.replace(' rx=\"' + outshape.replace(' rx=\"')[1].split('\"')[0] + '\"', ' rx=\"' + Math.round(eval('' + widthd)) + '\"');
}
if (outshape.indexOf(' ry=\"') != -1) {
outshape=outshape.replace(' ry=\"' + outshape.replace(' ry=\"')[1].split('\"')[0] + '\"', ' ry=\"' + Math.round(eval('' + heightd)) + '\"');
}
if (outshape.indexOf(' cx=\"') != -1) {
outshape=outshape.replace(' cx=\"' + outshape.replace(' cx=\"')[1].split('\"')[0] + '\"', ' cx=\"' + Math.round(eval('' + centx)) + '\"');
}
if (outshape.indexOf(' cy=\"') != -1) {
outshape=outshape.replace(' cy=\"' + outshape.replace(' cy=\"')[1].split('\"')[0] + '\"', ' cy=\"' + Math.round(eval('' + centy)) + '\"');
}
if (('' + oit).indexOf('1') == 0) {
polygono.setAttribute('rx', '' + Math.round(eval('' + widthd)));
polygono.setAttribute('ry', '' + Math.round(eval('' + heightd)));
polygono.setAttribute('cx', '' + Math.round(eval('' + centx)));
polygono.setAttribute('cy', '' + Math.round(eval('' + centy)));
}
var cpts='';
cpts='';
cpts+='' + Math.round(eval('' + centx) + eval(eval('' + widthd) / 2)) + ',';
cpts+='' + Math.round(eval('' + centy) - eval(eval('' + heightd) / 2)) + ' ';
cpts+='' + Math.round(eval('' + centx) - eval(eval('' + widthd) / 2)) + ',';
cpts+='' + Math.round(eval('' + centy) - eval(eval('' + heightd) / 2)) + ' ';
cpts+='' + Math.round(eval('' + centx) - eval(eval('' + widthd) / 2)) + ',';
cpts+='' + Math.round(eval('' + centy) + eval(eval('' + heightd) / 2)) + ' ';
cpts+='' + Math.round(eval('' + centx) + eval(eval('' + widthd) / 2)) + ',';
cpts+='' + Math.round(eval('' + centy) + eval(eval('' + heightd) / 2)) + ' ';
cpts+='' + Math.round(eval('' + centx) + eval(eval('' + widthd) / 2)) + ',';
cpts+='' + Math.round(eval('' + centy) - eval(eval('' + heightd) / 2)) + '';
if (('' + oit).indexOf('1') == 0) {
polygono.setAttribute('points', cpts);
}
outshape=outshape.replace(cshape.split(' points=\"')[1].split('\"')[0], cpts);
//alert(oit + ' ' + outshape + ' ' + cshape);
return outshape;
}
function movethis(xprevlastoh, xpos3, xpos4, xptx, xpty, firsttime) {
var mshape='ellipse';
var mxpts=0, mypts=0, mx=0, my=0, mxnew=0, mynew=0, wasto=null, szeroouterHTML='', newr=0, newry=0, svgindexofinterest=0;
var ynft='youllneverfindthis', ynftw='youllneverfindthis';
var yntxtft='youllneverfindthis', yntxtftw='youllneverfindthis';
var yncolft='youllneverfindthis', yncolftw='';
var zncolft='youllneverfindthis', zncolftw='';
var ges=szero.outerHTML.split('</g>'), gess=[], dotx=0, doty=0, dotdx=0, dotdy=0;
var hashbit=(xprevlastoh + '##').split('##')[1];
var hashcs=hashbit.split(',');
var precursor='[height=';
var defcol='#90806090';
var atoz='0123456789abcdef';
var partsof=document.getElementById('one').value.split('[height=');
var eight=8;
var ynn='youllneverfindthis';
relrec='';
wasfrom=null;
var wh=[];
var sets=[];
var cpts='';
var shapeword='circle';
var diameter='diameter (or use comma for ellipse width,height)';
ellfill='';
ellfillop='';
if (xprevlastoh.indexOf('<polygon') != -1) { eight=4; ynn='cx'; mshape='polygon'; shapeword='polygon'; diameter='width and height'; }
if (eval('' + hashcs.length) > 6) {
dotdx=eval(1 * eval(eval('' + xptx) - eval('' + hashcs[0])));
dotdy=eval(1 * eval(eval('' + xpty) - eval('' + hashcs[1])));
svgindexofinterest=eval('' + ('' + hashcs[6].replace(/^0000/g, '').replace('-','')));
}
if (eval('' + partsof.length) > eval('' + svgindexofinterest)) {
//alert(xprevlastoh);
if (eval('' + svgindexofinterest) == 0) {
relrec=partsof[svgindexofinterest];
if (xprevlastoh.indexOf('<text') == 0 && eval('' + hashcs.length) > 1) {
if (relrec.indexOf(' xlp=\"') == -1 && relrec.indexOf(' pos=\"') == -1) {
relrec+=precursor + partsof[1].split(']')[0]
}
} else {
if ((partsof[eval(-1 + eval('' + svgindexofinterest))] + '~').indexOf(' ' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).outerHTML.split('>')[1].split('<')[0] + ' ~') != -1) {
precursor=' ' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).outerHTML.split('>')[1].split('<')[0] + ' [height=';
}
relrec=precursor + partsof[svgindexofinterest].split(']')[0];
}
} else {
if (xprevlastoh.indexOf('<text') == 0) {
if ((partsof[eval(-1 + eval('' + svgindexofinterest))] + '~').indexOf(' ' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).outerHTML.split('>')[1].split('<')[0] + ' ~') != -1) {
precursor=' ' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).outerHTML.split('>')[1].split('<')[0] + ' [height=';
}
}
relrec=precursor + partsof[svgindexofinterest].split(']')[0];
}
}
console.log('31:' + xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]);
// lastoh ##pointx,pointy,pxx,pxy,cx,cy,svgindexofinterest,dotx,doty,svgid
if (svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)])) {
//alert('found');
if (xprevlastoh.indexOf('<' + mshape) != -1) {
console.log('1:' + xprevlastoh.split('##')[1]);
if (('' + xpos3) != ('' + xprevlastoh.split('##')[1].split(',')[2]) || ('' + xpos4) != ('' + xprevlastoh.split('##')[1].split(',')[3])) {
mx=eval(1.0 * eval(eval('' + xpos3) - eval('' + xprevlastoh.split('##')[1].split(',')[2])));
my=eval(1.0 * eval(1.0 * eval(eval('' + xpos4) - eval('' + xprevlastoh.split('##')[1].split(',')[3]))));
//alert('mxy=' + mx + ',' + my + ' ... ' + xprevlastoh);
//mxnew=eval(eval('' + xprevlastoh.split('##')[1].split(',')[4]) + mx);
//mynew=eval(eval('' + xprevlastoh.split('##')[1].split(',')[5]) + my);
//if (xprevlastoh.indexOf('<polygon') != -1) { alert(xprevlastoh); }
mxnew=eval(eval('' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cx')) + mx);
mynew=eval(eval('' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cy')) + my);
//alert('mxnewxy=' + mxnew + ',' + mynew);
mxpts=eval(0.75 * eval(eval('' + xpos3) - eval('' + xprevlastoh.split('##')[1].split(',')[2])));
mypts=eval(0.75 * eval(-1 * eval(eval('' + xpos4) - eval('' + xprevlastoh.split('##')[1].split(',')[3]))));
//alert('1:tocxcy ' + xptx + ',' + xpty + ' ... ' + mxnew + ',' + mynew + ' ' + xprevlastoh);
//svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).setAttribute('cx', '' + xpos3);
//svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).setAttribute('cy', '' + xpos4);
//alert((xprevlastoh.split(' id=')[0].split(' ID=')[0].split(' ' + ynn + '=')[0].split('/>')[0].split('>')[0] + '></' + mshape + '>').replace(svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cx'), '' + xpos3).replace(svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cy'), '' + xpos4));
if (firsttime) {
document.getElementById('myif').style.width='291pt';
document.getElementById('myif').style.height='210pt';
document.getElementById('bltd').innerHTML=szero.outerHTML;
document.getElementById('bltd').style.display='block';
document.getElementById('bltd').style.visibility='visible';
if (mshape == 'polygon') {
cpts=document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('points');
sets=cpts.split(' ');
for (var klj=0; klj<sets.length; klj++) {
cpts=cpts.replace(sets[klj], '' + eval(mx + eval('' + sets[klj].split(',')[0])) + ',' + eval(my + eval('' + sets[klj].split(',')[1])));
}
document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).setAttribute('points', cpts);
}
document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).setAttribute('cx', '' + mxnew);
document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).setAttribute('cy', '' + mynew);
//document.getElementById('ltd').style.backgroundRepeat='no-repeat';
//document.getElementById('ltd').style.backgroundPosition='right bottom';
//document.getElementById('ltd').style.backgoundImage='URL(data:image/svg+xml;base64,' + window.btoa(szero.outerHTML.replace('</g>' + ges[eval(-1 + ges.length)], (xprevlastoh.split(' id=')[0].split(' ID=')[0].split(' ' + ynn + '=')[0].split('/>')[0].split('>')[0] + '></' + mshape + '>').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cx') + '\"', '\"' + mxnew + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cy') + '\"', '\"' + mynew + '\"') + '') + '</g>' + ges[eval(-1 + ges.length)]) + ')';
setTimeout(function(){ movethis(xprevlastoh, xpos3, xpos4, xptx, xpty, false); }, 3000);
return '';
}
if (mshape == 'polygon') {
wasfrom='' + eval(eval(eval('' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('rx')) * 8 / 3) / 96) + ',' + eval(eval(eval('' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('ry')) * 8 / 3) / 96); //'1'; //svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).innerHTML;
} else {
wasfrom='' + eval(eval(eval('' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('rx')) * 8 / 3) / 96); //'1'; //svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).innerHTML;
}
wasto=prompt('If you want the ' + shapeword + ' ' + diameter + ' not be as suggested (in inches), enter different ' + diameter.split(' (or use comma')[0] + ' (in inches) now, where for any non-initial ' + shapeword + 's a value of 0 makes them invisible. Prefix + to your answer means an independent new ' + shapeword + ' is created. Suffix with hash (#) followed by 6 or 8 character length fill colour. Cancel withdraws proposed changes that are positionally shown below.', wasfrom);
//wasto=prompt('If you want the circle diameter not be as suggested (in inches), enter different diameter (in inches) now. Cancel withdraws proposed changes that are positionally shown below.', wasfrom);
if (wasto == null) {
wasto='';
document.getElementById('bltd').style.visibility='hidden';
} else {
wh=wasto.split(',');
if (relrec != '') {
if ((' ' + wasto).slice(-9).substring(0,1) == '#') {
yncolftw=' fillcolor=\"' + wasto.slice(-9) + '\"';
ellfill='' + wasto.slice(-9).substring(0,7);
defcol=wasto.slice(-9);
ellfillop='' + eval(eval(eval(eval('' + atoz.split(wasto.slice(-2).substring(0,1).toLowerCase())[0].length) * 16) + eval(eval('' + atoz.split(wasto.slice(-1).substring(0,1).toLowerCase())[0].length) * 1)) / 256);
wasto=wasto.replace(wasto.slice(-9), '');
} else if ((' ' + wasto).slice(-7).substring(0,1) == '#') {
yncolftw=' fillcolor=\"' + wasto.slice(-7) + '\"';
defcol=wasto.slice(-7);
ellfill='' + wasto.slice(-7).substring(0,7);
ellfillop='1.0';
wasto=wasto.replace(wasto.slice(-7), '');
}
//alert('relrec=' + relrec);
if (relrec.indexOf('[height=') != -1) {
if (relrec.indexOf(' fillcolor=') != -1 && yncolftw != '') {
yncolft=' fillcolor=\"' + relrec.split(' fillcolor=\"')[1].split('\"')[0] + '\"';
}
//alert('Relrec=' + relrec);
if (relrec.indexOf(' pos=\"') != -1) {
ynft=' pos=\"' + relrec.split(' pos=\"')[1].split('\"')[0] + '\"';
dotx=eval('' + relrec.split(' pos=\"')[1].split('\"')[0].split(',')[0]);
doty=eval('' + relrec.split(' pos=\"')[1].split('\"')[0].split(',')[1]);
//alert('ynft=' + ynft + ' and dotxy=' + dotx + ',' + doty + ' and dotdxy=' + dotdx + ',' + dotdy);
dotx+=dotdx;
doty+=dotdy;
ynftw=' pos=\"' + Math.round(dotx) + ',' + Math.round(doty) + '\"';
//ynftw=' pos=\"' + Math.round(xptx) + ',' + Math.round(xpty) + '\"';
//alert('ynftw=' + ynftw + ' ... ' + document.getElementById('one').value.replace(relrec, relrec.replace('' + relrec.substring(0).split(' ')[0] + ' ', '[height=' + hwize(wasto.replace(/^\+/g,'')) + ' ').replace(ynft, ynftw).replace(yncolft, yncolftw).replace(zncolft, zncolftw)));
}
if (wasto.trim() == '') { wasto='0'; } else if (wasto.trim() == '+') { wasto='+0'; }
if ((wasto + ' ').substring(0,1) != '+') {
document.getElementById('one').value=document.getElementById('one').value.replace(relrec, relrec.replace('' + relrec.substring(0).split(' ')[0] + ' ', '[height=' + hwize(wasto.replace(/^\+/g,'')) + ' ').replace(ynft, ynftw).replace(yncolft, yncolftw).replace(zncolft, zncolftw));
} else {
partsof=document.getElementById('one').value.split('[height=');
document.getElementById('one').value=document.getElementById('one').value.replace('[height=' + partsof[eval(-1 + partsof.length)].split(']')[0] + ']', '[height=' + partsof[eval(-1 + partsof.length)].split(']')[0] + ']' + String.fromCharCode(10) + ' ' + clickcnt + ' [height=' + hwize(wasto.replace(/^\+/g,'')) + ' fillcolor=\"' + defcol + '\" style=\"filled\" pos=\"' + Math.round(dotx) + ',' + Math.round(doty) + '\" label=\"\" xlabel=\"\"]');
}
}
}
wh=wasto.split(',');
if (wasto != wasfrom) {
if (wasto.substring(0,1) == '+') {
wh=wasto.substring(1).split(',');
if (wasto.substring(1) != wasfrom) {
newr='' + eval(eval(wasto.substring(1).split(',')[0] * 96 * 3 / eight));
if (eval('' + wh.length) > 1) { newry='' + eval(eval(wasto.replace(/^\+/g,'').split(',')[1] * 96 * 3 / eight)); } else { newry=newr; }
//alert('here ' + (xprevlastoh.split(' id=')[0].split(' ID=')[0].split(' ' + ynn + '=')[0].split('/>')[0].split('>')[0] + ' id=newel' + clickcnt + '></' + mshape + '>').replace('>' + wasfrom + '<', '>' + wasto.substring(1) + '<').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cx') + '\"', '\"' + mxnew + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cy') + '\"', '\"' + mynew + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('rx') + '\"', '\"' + newr + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('ry') + '\"', '\"' + newry + '\"'));
if (mshape == 'polygon') {
xprevlastoh=reshape(xprevlastoh, '0.0', svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]), mxnew, mynew, newr, newry);
//gone.innerHTML+=(xprevlastoh.split(' id=')[0].split(' ID=')[0].split(' ' + ynn + '=')[0].split('/>')[0].split('>')[0] + ' id=\"newel' + clickcnt + '\"></' + mshape + '>').replace('>' + wasfrom + '<', '>' + wasto.substring(1) + '<').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cx') + '\"', '\"' + mxnew + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cy') + '\"', '\"' + mynew + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('rx') + '\"', '\"' + newr + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('ry') + '\"', '\"' + newry + '\"');
gzero.innerHTML+=(xprevlastoh.split(' id=')[0].split(' ID=')[0].split(' ' + ynn + '=')[0].split('/>')[0].split('>')[0] + ' id=\"newel' + clickcnt + '\"></' + mshape + '>').replace('>' + wasfrom + '<', '>' + wasto.substring(1) + '<').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cx') + '\"', '\"' + mxnew + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cy') + '\"', '\"' + mynew + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('rx') + '\"', '\"' + newr + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('ry') + '\"', '\"' + newry + '\"');
} else {
gzero.innerHTML+=(xprevlastoh.split(' id=')[0].split(' ID=')[0].split(' ' + ynn + '=')[0].split('/>')[0].split('>')[0] + ' id=\"newel' + clickcnt + '\"></' + mshape + '>').replace('>' + wasfrom + '<', '>' + wasto.substring(1) + '<').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cx') + '\"', '\"' + mxnew + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cy') + '\"', '\"' + mynew + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('rx') + '\"', '\"' + newr + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('ry') + '\"', '\"' + newry + '\"');
}
if (ellfill != '') {
setTimeout(function(){ svgconto.document.getElementById('newel' + clickcnt).setAttribute('fill', '' + ellfill); }, 1000);
//alert('111:' + ellfill + ' ' + ellfillop);
}
if (ellfillop != '') {
setTimeout(function(){ svgconto.document.getElementById('newel' + clickcnt).setAttribute('fill-opacity', '' + ellfillop); }, 1100);
}
} else {
//alert('There ' + (xprevlastoh.split(' id=')[0].split(' ID=')[0].split(' ' + ynn + '=')[0].split('/>')[0].split('>')[0] + ' id=newel' + clickcnt + '></' + mshape + '>').replace('>' + wasfrom + '<', '>' + wasto.substring(1) + '<').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cx') + '\"', '\"' + mxnew + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cy') + '\"', '\"' + mynew + '\"'));
if (mshape == 'polygon') {
xprevlastoh=reshape(xprevlastoh, '0.1', svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]), mxnew, mynew, newr, newry);
//gone.innerHTML+=(xprevlastoh.split(' id=')[0].split(' ID=')[0].split(' ' + ynn + '=')[0].split('/>')[0].split('>')[0] + ' id=\"newel' + clickcnt + '\"></' + mshape + '>').replace('>' + wasfrom + '<', '>' + wasto.substring(1) + '<').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cx') + '\"', '\"' + mxnew + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cy') + '\"', '\"' + mynew + '\"');
gzero.innerHTML+=(xprevlastoh.split(' id=')[0].split(' ID=')[0].split(' ' + ynn + '=')[0].split('/>')[0].split('>')[0] + ' id=\"newel' + clickcnt + '\"></' + mshape + '>').replace('>' + wasfrom + '<', '>' + wasto.substring(1) + '<').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cx') + '\"', '\"' + mxnew + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cy') + '\"', '\"' + mynew + '\"');
} else {
gzero.innerHTML+=(xprevlastoh.split(' id=')[0].split(' ID=')[0].split(' ' + ynn + '=')[0].split('/>')[0].split('>')[0] + ' id=\"newel' + clickcnt + '\"></' + mshape + '>').replace('>' + wasfrom + '<', '>' + wasto.substring(1) + '<').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cx') + '\"', '\"' + mxnew + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cy') + '\"', '\"' + mynew + '\"');
}
if (ellfill != '') {
setTimeout(function(){ svgconto.document.getElementById('newel' + clickcnt).setAttribute('fill', '' + ellfill); }, 1000);
//alert('11:' + ellfill + ' ' + ellfillop);
}
if (ellfillop != '') {
setTimeout(function(){ svgconto.document.getElementById('newel' + clickcnt).setAttribute('fill-opacity', '' + ellfillop); }, 1100);
}
}
} else {
if (mshape == 'polygon') {
svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).setAttribute('cx', '' + mxnew);
svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).setAttribute('cy', '' + mynew);
xprevlastoh=reshape(xprevlastoh, '1.0', svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]), svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cx'), svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cy'), newr, newry);
} else {
wh=wasto.replace(/^\+/g,'').split(',');
newr='' + eval(eval(wasto.replace(/^\+/g,'').split(',')[0] * 96 * 3 / eight));
if (eval('' + wh.length) > 1) { newry='' + eval(eval(wasto.replace(/^\+/g,'').split(',')[1] * 96 * 3 / eight)); } else { newry=newr; }
svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).setAttribute('rx', '' + Math.round(newr));
svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).setAttribute('ry', '' + Math.round(newry));
}
if (ellfill != '') {
svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).setAttribute('fill', '' + ellfill);
}
if (ellfillop != '') {
svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).setAttribute('fill-opacity', '' + ellfillop);
}
}
}
if (5 == 5) {
if ((wasto + ' ').substring(0,1) != '+') {
newr='' + eval(eval(wasto.substring(0).split(',')[0] * 96 * 3 / eight));
if (wasto.indexOf(',') != -1) { newry='' + eval(eval(wasto.substring(0).split(',')[1] * 96 * 3 / eight)); } else { newry=newr; }
if (mshape == 'polygon') {
svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).setAttribute('cx', '' + mxnew);
svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).setAttribute('cy', '' + mynew);
xprevlastoh=reshape(xprevlastoh, '1.1', svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]), svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cx'), svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cy'), newr, newry);
} else {
svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).setAttribute('cx', '' + mxnew);
svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).setAttribute('cy', '' + mynew);
}
if (ellfill != '') {
svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).setAttribute('fill', '' + ellfill);
}
if (ellfillop != '') {
svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).setAttribute('fill-opacity', '' + ellfillop);
}
}
} else {
newr='' + eval(eval(wasto.replace(/^\+/g,'').substring(0).split(',')[0] * 96 * 3 / eight));
if (wasto.indexOf(',') != -1) { newry='' + eval(eval(wasto.replace(/^\+/g,'').substring(0).split(',')[1] * 96 * 3 / eight)); } else { newry=newr; }
if (mshape == 'polygon') {
xprevlastoh=reshape(xprevlastoh, '0.4', svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]), mxnew, mynew, newr, newry);
//gone.innerHTML+=(xprevlastoh.split(' id=')[0].split(' ID=')[0].split(' ' + ynn + '=')[0].split('/>')[0].split('>')[0] + ' id=newel' + clickcnt + '></' + mshape + '>').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cx') + '\"', '\"' + mxnew + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cy') + '\"', '\"' + mynew + '\"');
gzero.innerHTML+=(xprevlastoh.split(' id=')[0].split(' ID=')[0].split(' ' + ynn + '=')[0].split('/>')[0].split('>')[0] + ' id=newel' + clickcnt + '></' + mshape + '>').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cx') + '\"', '\"' + mxnew + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cy') + '\"', '\"' + mynew + '\"');
} else {
gzero.innerHTML+=(xprevlastoh.split(' id=')[0].split(' ID=')[0].split(' ' + ynn + '=')[0].split('/>')[0].split('>')[0] + ' id=newel' + clickcnt + '></' + mshape + '>').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cx') + '\"', '\"' + mxnew + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cy') + '\"', '\"' + mynew + '\"');
}
if (ellfill != '') {
setTimeout(function(){ svgconto.document.getElementById('newel' + clickcnt).setAttribute('fill', '' + ellfill); }, 1000);
//alert('1:' + ellfill + ' ' + ellfillop);
}
if (ellfillop != '') {
setTimeout(function(){ svgconto.document.getElementById('newel' + clickcnt).setAttribute('fill-opacity', '' + ellfillop); }, 1100);
}
svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).style.visibility='hidden';
//var woox=window.open('','_blank','top=50,left=50,width=500,height=500');
//var ges=szero.outerHTML.split('</g>');
//woox.document.write(szero.outerHTML.replace('</g>' + ges[eval(-1 + ges.length)], (xprevlastoh.split(' id=')[0].split(' ID=')[0].split(' ' + ynn + '=')[0].split('/>')[0].split('>')[0] + '></' + mshape + '>').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cx') + '\"', '\"' + mxnew + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cy') + '\"', '\"' + mynew + '\"') + '') + '</g>' + ges[eval(-1 + ges.length)]);
}
}
}
} else if (xprevlastoh.indexOf('<text') != -1) {
if (('' + xpos3) != ('' + xprevlastoh.split('##')[1].split(',')[2]) || ('' + xpos4) != ('' + xprevlastoh.split('##')[1].split(',')[3])) {
mx=eval(1.0 * eval(eval('' + xpos3) - eval('' + xprevlastoh.split('##')[1].split(',')[2])));
my=eval(1.0 * eval(1.0 * eval(eval('' + xpos4) - eval('' + xprevlastoh.split('##')[1].split(',')[3]))));
mxnew=eval(eval('' + xprevlastoh.split('##')[1].split(',')[4]) + mx);
mynew=eval(eval('' + xprevlastoh.split('##')[1].split(',')[5]) + my);
mxpts=eval(0.75 * eval(eval('' + xpos3) - eval('' + xprevlastoh.split('##')[1].split(',')[2])));
mypts=eval(0.75 * eval(-1 * eval(eval('' + xpos4) - eval('' + xprevlastoh.split('##')[1].split(',')[3]))));
console.log('11:tocxcy ' + xptx + ',' + xpty + ' ... ' + mxnew + ',' + mynew + ' ' + xprevlastoh);
//svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).setAttribute('x', '' + xpos3);
//svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).setAttribute('y', '' + xpos4);
//alert((xprevlastoh.split(' id=')[0].split(' ID=')[0].split(' ' + ynn + '=')[0].split('/>')[0].split('>')[0] + '></' + mshape + '>').replace(svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('x'), '' + xpos3).replace(svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('y'), '' + xpos4));
if (firsttime) {
//document.getElementById('ltd').style.backgroundRepeat='no-repeat';
//document.getElementById('ltd').style.backgroundPosition='right bottom';
//alert(1);
szeroouterHTML=szero.outerHTML;
while (szeroouterHTML.indexOf(String.fromCharCode(10)) != -1) {
szeroouterHTML=szeroouterHTML.replace(String.fromCharCode(10),' ');
}
//alert(11);
gess=szeroouterHTML.split('</g>')
//document.getElementById('ltd').style.backgoundImage=\"URL('data:image/svg+xml;utf8,\" + (szeroouterHTML.replace('</g>' + gess[eval(-1 + gess.length)], (xprevlastoh.split(' id=')[0].split(' ID=')[0].split(' ' + ynn + '=')[0].split('/>')[0].split('>')[0] + '></' + mshape + '>').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('x') + '\"', '\"' + mxnew + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('y') + '\"', '\"' + mynew + '\"') + '') + '</g>' + gess[eval(-1 + ges.length)]) + \"')\";
//alert(111);
document.getElementById('myif').style.width='291pt';
document.getElementById('myif').style.height='210pt';
document.getElementById('bltd').innerHTML=szero.outerHTML;
document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).setAttribute('x', '' + mxnew);
document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).setAttribute('y', '' + mynew);
//document.getElementById('ltd').style.backgroundRepeat='no-repeat';
//document.getElementById('ltd').style.backgroundPosition='right bottom';
//document.getElementById('ltd').style.backgoundImage='URL(data:image/svg+xml;base64,' + window.btoa(szero.outerHTML.replace('</g>' + ges[eval(-1 + ges.length)], (xprevlastoh.split(' id=')[0].split(' ID=')[0].split(' ' + ynn + '=')[0].split('/>')[0].split('>')[0] + '></' + mshape + '>').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cx') + '\"', '\"' + mxnew + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('cy') + '\"', '\"' + mynew + '\"') + '') + '</g>' + ges[eval(-1 + ges.length)]) + ')';
//alert(1111);
document.getElementById('bltd').style.display='block';
document.getElementById('bltd').style.visibility='visible';
setTimeout(function(){ movethis(xprevlastoh, xpos3, xpos4, xptx, xpty, false); }, 3000);
//alert(11111);
return '';
}
wasfrom=svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).innerHTML;
wasto=prompt('If you want the words not to be as suggested, enter different wording now. Prefix + to your answer means an independent new text (without the prefixing text showing) is created. Cancel withdraws proposed changes that are positionally shown below.', wasfrom);
//wasto=prompt('If you want the words not to be as suggested, enter different wording now. Cancel withdraws proposed changes that are positionally shown below.', wasfrom);
if (wasto == null) {
wasto='';
document.getElementById('bltd').style.visibility='hidden';
} else {
if (relrec != '') {
//alert('relrec=' + relrec + ' ' + xprevlastoh);
if (relrec.indexOf(' xlp=') != -1 || relrec.indexOf(' pos=') != -1) {
//alert('RelRec=' + relrec + ' and xprevlastoh=' + xprevlastoh);
if (relrec.indexOf(' xlp=\"') == -1 && relrec.indexOf(' pos=\"') != -1) { // label= xlabel=W xlp=144,144
ynft=' pos=\"' + relrec.split(' pos=\"')[1].split('\"')[0] + '\"';
dotx=eval('' + relrec.split(' pos=\"')[1].split('\"')[0].split(',')[0]);
doty=eval('' + relrec.split(' pos=\"')[1].split('\"')[0].split(',')[1]);
//alert('Ynft=' + ynft + ' and dotxy=' + dotx + ',' + doty + ' and dotdxy=' + dotdx + ',' + dotdy);
dotx+=dotdx;
doty+=dotdy;
ynftw=' pos=\"' + Math.round(dotx) + ',' + Math.round(doty) + '\"';
//ynftw=' pos=\"' + Math.round(xptx) + ',' + Math.round(xpty) + '\"';
//alert('with=' + (relrec + ' label=\"\" xlabel=\"' + wasto.replace(/^\+/g,'') + '\" xlp=\"' + dotx + ',' + doty + '\"'));
if ((wasto + ' ').substring(0,1) != '+') {
document.getElementById('one').value=document.getElementById('one').value.replace(relrec, (relrec + ' label=\"\" xlabel=\"' + wasto.replace(/^\+/g,'') + '\" xlp=\"' + Math.round(dotx) + ',' + Math.round(doty) + '\"').replace(' ' + wasfrom + ' [height=', ' ' + wasto.replace(/^\+/g,'') + ' [height=').replace(' xlabel=\"' + wasfrom + '\"', ' xlabel=\"' + wasto.replace(/^\+/g,'') + '\"').replace(' xlabel=\"\"', ' xlabel=\"' + wasto.replace(/^\+/g,'') + '\"'));
} else {
document.getElementById('one').value=document.getElementById('one').value.replace('}', ' ' + wasto.replace(/^\+/g,'') + ' [shape=plaintext pos=\"0,0\" label=\"\" xlabel=\"' + wasto.replace(/^\+/g,'') + '\" xlp=\"' + Math.round(dotx) + ',' + Math.round(doty) + '\"]' + String.fromCharCode(10) + '}');
}
} else if (relrec.indexOf(' xlp=\"') != -1) {
ynft=' xlp=\"' + relrec.split(' xlp=\"')[1].split('\"')[0] + '\"';
dotx=eval('' + relrec.split(' xlp=\"')[1].split('\"')[0].split(',')[0]);
doty=eval('' + relrec.split(' xlp=\"')[1].split('\"')[0].split(',')[1]);
//alert('ynft=' + ynft + ' and dotxy=' + dotx + ',' + doty + ' and dotdxy=' + dotdx + ',' + dotdy);
dotx+=dotdx;
doty+=dotdy;
ynftw=' xlp=\"' + Math.round(dotx) + ',' + Math.round(doty) + '\"';
//ynftw=' pos=\"' + Math.round(xptx) + ',' + Math.round(xpty) + '\"';
//alert('ynftw=' + ynftw + ' ... ' + document.getElementById('one').value.replace(relrec, relrec.replace('' + relrec.substring(0).split(' ')[0] + ' ', '[height=' + hwize(wasto.replace(/^\+/g,'')) + ' ').replace(ynft, ynftw).replace(yncolft, yncolftw).replace(zncolft, zncolftw).replace(' xlabel=\"' + wasfrom + '\"', ' xlabel=\"' + wasto.replace(/^\+/g,'') + '\"').replace(' xlabel=\"\"', ' xlabel=\"' + wasto.replace(/^\+/g,'') + '\"')));
if ((wasto + ' ').substring(0,1) != '+') {
document.getElementById('one').value=document.getElementById('one').value.replace(relrec, relrec.replace(' ' + wasfrom + ' [height=', ' ' + wasto.replace(/^\+/g,'') + ' [height=').replace(ynft, ynftw).replace(yncolft, yncolftw).replace(zncolft, zncolftw).replace(' xlabel=\"' + wasfrom + '\"', ' xlabel=\"' + wasto.replace(/^\+/g,'') + '\"').replace(' xlabel=\"\"', ' xlabel=\"' + wasto.replace(/^\+/g,'') + '\"'));
} else {
document.getElementById('one').value=document.getElementById('one').value.replace('}', ' ' + wasto.replace(/^\+/g,'') + ' [shape=plaintext pos=\"0,0\" label=\"\" xlabel=\"' + wasto.replace(/^\+/g,'') + '\" xlp=\"' + Math.round(dotx) + ',' + Math.round(doty) + '\"]' + String.fromCharCode(10) + '}');
}
}
}
}
if (wasto != wasfrom) {
if (wasto.substring(0,1) == '+') {
//alert('adding ' + (xprevlastoh.split(' id=')[0].split(' ID=')[0].split(' ' + ynn + '=')[0].split('/>')[0].split('>')[0] + '>' + wasto.replace(/^\+/g,'') + '</text>').replace('>' + wasfrom + '<', '>' + wasto.substring(1) + '<').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('x') + '\"', '\"' + mxnew + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('y') + '\"', '\"' + mynew + '\"'));
gzero.innerHTML+=(xprevlastoh.split(' id=')[0].split(' ID=')[0].split(' ' + ynn + '=')[0].split('/>')[0].split('>')[0] + ' id=\"newel' + clickcnt + '\">' + wasto.replace(/^\+/g,'') + '</text>').replace('>' + wasfrom + '<', '>' + wasto.substring(1) + '<').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('x') + '\"', '\"' + mxnew + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('y') + '\"', '\"' + mynew + '\"');
} else {
svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).innerHTML=wasto;
}
}
if (5 == 5) {
if ((wasto + ' ').substring(0,1) != '+') {
svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).setAttribute('x', '' + mxnew);
svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).setAttribute('y', '' + mynew);
}
} else {
gzero.innerHTML+=(xprevlastoh.split(' id=')[0].split(' ID=')[0].split(' ' + ynn + '=')[0].split('/>')[0].split('>')[0] + '></' + mshape + '>').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('x') + '\"', '\"' + mxnew + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('y') + '\"', '\"' + mynew + '\"');
svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).style.visibility='hidden';
//var woox=window.open('','_blank','top=50,left=50,width=500,height=500');
//var ges=szero.outerHTML.split('</g>');
//woox.document.write(szero.outerHTML.replace('</g>' + ges[eval(-1 + ges.length)], (xprevlastoh.split(' id=')[0].split(' ID=')[0].split(' ' + ynn + '=')[0].split('/>')[0].split('>')[0] + '></' + mshape + '>').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('x') + '\"', '\"' + mxnew + '\"').replace('\"' + svgconto.document.getElementById(xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]).getAttribute('y') + '\"', '\"' + mynew + '\"') + '') + '</g>' + ges[eval(-1 + ges.length)]);
}
}
}
}
}
lastoh='';
document.getElementById('bltd').style.visibility='hidden';
}
function clickreg(evt) {
// lastoh ##pointx,pointy,pxx,pxy,cx,cy,svgindexofinterest,dotx,doty,svgid
//alert(evt.target.outerHTML);
var ptx=0, pty=0, ptfromx=0, ptfromy=0;
var prevlastoh=lastoh;
if (evt.touches) {
//if (evt.touches[0].screenX) { pos3 = evt.touches[0].screenX; pos4 = evt.touches[0].screenY; } else
if (evt.touches[0].pageX) {
pos3 = evt.touches[0].pageX;
pos4 = evt.touches[0].pageY;
} else {
pos3 = evt.touches[0].clientX;
pos4 = evt.touches[0].clientY;
}
// // console.log('pos3 = ' + pos3 + ',pos4 = ' + pos4);
//} else if (evt.screenX) { pos3 = evt.screenX; pos4 = evt.screenY;
} else if (evt.clientX || evt.clientY) {
pos3 = evt.clientX;
pos4 = evt.clientY;
// console.log('pos3 = ' + pos3 + ' ,pos4 = ' + pos4);
} else {
pos3 = evt.pageX;
pos4 = evt.pageY;
// console.log('pos3 = ' + pos3 + ', pos4 = ' + pos4);
}
if (lastoh.indexOf(',' + pos3 + ',' + pos4 + ',') == -1) {
if (document.getElementById('pointsx') && document.getElementById('pointsy')) {
ptx=eval(document.getElementById('pointsx').innerHTML);
pty=eval(document.getElementById('pointsy').innerHTML);
} else {
ptx=eval(pos3 * 3.0 / 4.0);
pty=eval(288 - eval(pos4 * 3.0 / 4.0));
}
if (lastoh.indexOf('##') != -1) {
console.log('6:' + lastoh.split('##')[1]);
ptfromx=eval('' + lastoh.split('##')[1].split(',')[0]);
ptfromy=eval('' + lastoh.split('##')[1].split(',')[1]);
if (lastoh.split('##')[0].split(' id=')[0] == evt.target.outerHTML.split(' id=')[0] && lastoh.split('##')[0] != bigoh) {
try {
var xm=ptx;
xm-=ptfromx;
var ym=pty;
ym-=ptfromy;
//alert('xm=' + xm + ' and ym=' + ym);
if (eval('' + eval(Math.abs(xm) + Math.abs(ym))) > 6) {
lastoh=lastoh.replace(' id=', ' ID=').replace('>##', '##');
}
} catch(exer) {
alert('bad ' + lastoh);
alert('bAd ' + ptx);
alert('bAd ' + pty);
alert('bAd ' + ptfromx);
alert('bAd ' + ptfromy);
}
}
}
//if (lastoh.split('##')[0].split(' id=')[0] == evt.target.outerHTML.split(' id=')[0]) {
// alert('why ' + bigoh + ' ? ' + evt.target.outerHTML + ' ... ' + lastoh.split('##')[0].split(' id=')[0]);
//}
if (lastoh.split('##')[0].split(' id=')[0] != evt.target.outerHTML.split(' id=')[0]) {
//lastoh=evt.target.outerHTML + '##' + Math.round(eval('' + (document.getElementById('pointsx') ? document.getElementById('pointsx').innerHTML : '0'))) + ',' + Math.round(eval('' + (document.getElementById('pointsy') ? document.getElementById('pointsy').innerHTML : '0'))) + ',' + pos3 + ',' + pos4;
//lastoh=evt.target.outerHTML + '##' + (eval('' + (document.getElementById('pointsx') ? document.getElementById('pointsx').innerHTML : '0'))) + ',' + (eval('' + (document.getElementById('pointsy') ? document.getElementById('pointsy').innerHTML : '0'))) + ',' + pos3 + ',' + pos4;
lastoh=evt.target.outerHTML + '##' + ptx + ',' + pty + ',' + pos3 + ',' + pos4;
clickcnt++;
//alert('467:' + clickcnt + ' ' + evt.target.outerHTML + ' ... ' + lastoh.split('##')[0].split(' id=')[0]);
if (lastoh.split('##')[0].split(' id=')[0] == bigoh.split(' id=')[0]) {
if (eval(clickcnt % 2) == 0) {
if (top.document.URL.indexOf('nofix=') == -1) {
document.getElementById('myh4').innerHTML+='<span style=display:none;>' + clickcnt + ': YesMoveTo' + ptx + ',' + pty + '</span>';
//setTimeout(function(){ movethis(prevlastoh, pos3, pos4, ptx, pty); }, 2100);
//alert(98);
movethis(prevlastoh, pos3, pos4, ptx, pty, true);
}
lastoh='';
} else {
clickcnt--;
}
} else {
if (lastoh.split('##')[0].split(' id=')[0] == bigoh.split(' id=')[0] && eval(clickcnt % 2) == 1) {
clickcnt--;
} else {
if (eval(clickcnt % 2) == 0) {
if (top.document.URL.indexOf('nofix=') == -1) {
document.getElementById('myh4').innerHTML+='<span style=display:none;>' + clickcnt + ': ' + evt.target.outerHTML.substring(1).split(' ')[0].split('>')[0] + '-yesMoveTo' + ptx + ',' + pty + '</span>';
//setTimeout(function(){ movethis(prevlastoh, pos3, pos4, ptx, pty); }, 2100);
//alert(298);
movethis(prevlastoh, pos3, pos4, ptx, pty, true);
}
} else {
if (top.document.URL.indexOf('nofix=') == -1) {
document.getElementById('myh4').innerHTML+='<span style=display:none;>' + clickcnt + ': ' + onerecord(evt.target.outerHTML,ptx,pty,pos3,pos4).substring(1).split(' ')[0].split('>')[0] + '</span>';
//alert('LASTOH=' + lastoh);
}
if (evt.target.outerHTML.indexOf(' id=') == -1) {
//alert('LAStOH=' + lastoh);
evt.target.id='svgel' + clickcnt;
lastoh+=',svgel' + clickcnt;
lasto=evt.target;
//alert('lastoh=' + lastoh);
if (midpoint != '' && rxry != '') {
evt.target.setAttribute('cx', '' + midpoint.replace(/^\,/g,'').split(',')[0]);
evt.target.setAttribute('cy', '' + midpoint.replace(/^\,/g,'').split(',')[1]);
evt.target.setAttribute('rx', '' + rxry.replace(/^\,/g,'').split(',')[0]);
evt.target.setAttribute('ry', '' + rxry.replace(/^\,/g,'').split(',')[1]);
lastoh.replace('/>', '></' + lastoh.substring(1).split(' ')[0] + '>');
lastoh.replace('>', ' cx=\"' + midpoint.replace(/^\,/g,'').split(',')[0] + '\" cy=\"' + midpoint.replace(/^\,/g,'').split(',')[1] + '\" rx=\"' + midpoint.replace(/^\,/g,'').split(',')[0] + '\" ry=\"' + rxry.replace(/^\,/g,'').split(',')[1] + '\">');
midpoint='';
rxry='';
}
//alert('67:' + clickcnt);
} else {
lastoh+=',' + evt.target.id;
lasto=evt.target;
//alert('Lastoh=' + lastoh);
if (midpoint != '' && rxry != '') {
evt.target.setAttribute('cx', '' + midpoint.replace(/^\,/g,'').split(',')[0]);
evt.target.setAttribute('cy', '' + midpoint.replace(/^\,/g,'').split(',')[1]);
evt.target.setAttribute('rx', '' + rxry.replace(/^\,/g,'').split(',')[0]);
evt.target.setAttribute('ry', '' + rxry.replace(/^\,/g,'').split(',')[1]);
lastoh.replace('/>', '></' + lastoh.substring(1).split(' ')[0] + '>');
lastoh.replace('>', ' cx=\"' + midpoint.replace(/^\,/g,'').split(',')[0] + '\" cy=\"' + midpoint.replace(/^\,/g,'').split(',')[1] + '\" rx=\"' + midpoint.replace(/^\,/g,'').split(',')[0] + '\" ry=\"' + rxry.replace(/^\,/g,'').split(',')[1] + '\">');
midpoint='';
rxry='';
}
//alert('267:' + clickcnt);
}
}
}
}
}
}
}
function plusdata(aig) {
var outig=aig, dlm='\"';
var outgs=aig.split('data:');
if (eval('' + outgs.length) > 1) {
outig=outgs[0];
dlm=outig.slice(-1);
for (var iop=1; iop<outgs.length; iop++) {
//if (outgs[iop].split(dlm)[0] != outgs[iop].split(dlm)[0].replace(/\ /g,'+').replace(/\%20/g,'+')) {
// alert('Found');
//}
outig+='data:' + outgs[iop].replace(outgs[iop].split(dlm)[0], outgs[iop].split(dlm)[0].replace(/\ /g,'+').replace(/\%20/g,'+'));
}
}
if (outig != '') {
document.getElementById('ablnewzero').value=outig;
document.getElementById('mybutsave').style.display='inline-block';
}
return outig;
}
function ph() {
var aplace='';
if (1 == 2) {
document.body.addEventListener('mouseover', function(){
if (event.touches) {
//if (event.touches[0].screenX) { pos3 = event.touches[0].screenX; pos4 = event.touches[0].screenY; } else
if (event.touches[0].pageX) {
pos3 = event.touches[0].pageX;
pos4 = event.touches[0].pageY;
} else {
pos3 = event.touches[0].clientX;
pos4 = event.touches[0].clientY;
}
// // console.log('pos3 = ' + pos3 + ',pos4 = ' + pos4);
//} else if (event.screenX) { pos3 = event.screenX; pos4 = event.screenY;
} else if (event.clientX || event.clientY) {
pos3 = event.clientX;
pos4 = event.clientY;
// console.log('pos3 = ' + pos3 + ' ,pos4 = ' + pos4);
} else {
pos3 = event.pageX;
pos4 = event.pageY;
// console.log('pos3 = ' + pos3 + ', pos4 = ' + pos4);
}
if (event.target.outerHTML.indexOf('<body') == 0) {
if (dbt == '') { dbt=document.body.title; }
}
document.getElementById('pos').innerHTML=' ... ' + eval(eval('-' + ifrect.left) + pos3) + ',' + eval(eval('-' + ifrect.top) + pos4);
});
document.getElementById('mytable').addEventListener('mousemove', function(){
if (event.touches) {
//if (event.touches[0].screenX) { pos3 = event.touches[0].screenX; pos4 = event.touches[0].screenY; } else
if (event.touches[0].pageX) {
pos3 = event.touches[0].pageX;
pos4 = event.touches[0].pageY;
} else {
pos3 = event.touches[0].clientX;
pos4 = event.touches[0].clientY;
}
// // console.log('pos3 = ' + pos3 + ',pos4 = ' + pos4);
//} else if (event.screenX) { pos3 = event.screenX; pos4 = event.screenY;
} else if (event.clientX || event.clientY) {
pos3 = event.clientX;
pos4 = event.clientY;
// console.log('pos3 = ' + pos3 + ' ,pos4 = ' + pos4);
} else {
pos3 = event.pageX;
pos4 = event.pageY;
// console.log('pos3 = ' + pos3 + ', pos4 = ' + pos4);
}
if (event.target.outerHTML.indexOf('<body') == 0) {
if (dbt == '') { dbt=document.body.title; }
}
document.getElementById('pos').innerHTML=' ... ' + eval(eval('-' + ifrect.left) + pos3) + ',' + eval(eval('-' + ifrect.top) + pos4);
});
document.body.addEventListener('mousemove', function(){
if (event.touches) {
//if (event.touches[0].screenX) { pos3 = event.touches[0].screenX; pos4 = event.touches[0].screenY; } else
if (event.touches[0].pageX) {
pos3 = event.touches[0].pageX;
pos4 = event.touches[0].pageY;
} else {
pos3 = event.touches[0].clientX;
pos4 = event.touches[0].clientY;
}
// // console.log('pos3 = ' + pos3 + ',pos4 = ' + pos4);
//} else if (event.screenX) { pos3 = event.screenX; pos4 = event.screenY;
} else if (event.clientX || event.clientY) {
pos3 = event.clientX;
pos4 = event.clientY;
// console.log('pos3 = ' + pos3 + ' ,pos4 = ' + pos4);
} else {
pos3 = event.pageX;
pos4 = event.pageY;
// console.log('pos3 = ' + pos3 + ', pos4 = ' + pos4);
}
if (event.target.outerHTML.indexOf('<body') == 0) {
if (dbt == '') { dbt=document.body.title; }
}
document.getElementById('pos').innerHTML=' ... ' + eval(eval('-' + ifrect.left) + pos3) + ',' + eval(eval('-' + ifrect.top) + pos4);
});
document.body.addEventListener('touchmove', function(){
if (event.touches) {
//if (event.touches[0].screenX) { pos3 = event.touches[0].screenX; pos4 = event.touches[0].screenY; } else
if (event.touches[0].pageX) {
pos3 = event.touches[0].pageX;
pos4 = event.touches[0].pageY;
} else {
pos3 = event.touches[0].clientX;
pos4 = event.touches[0].clientY;
}
// // console.log('pos3 = ' + pos3 + ',pos4 = ' + pos4);
//} else if (event.screenX) { pos3 = event.screenX; pos4 = event.screenY;
} else if (event.clientX || event.clientY) {
pos3 = event.clientX;
pos4 = event.clientY;
// console.log('pos3 = ' + pos3 + ' ,pos4 = ' + pos4);
} else {
pos3 = event.pageX;
pos4 = event.pageY;
// console.log('pos3 = ' + pos3 + ', pos4 = ' + pos4);
}
if (event.target.outerHTML.indexOf('<body') == 0) {
if (dbt == '') { dbt=document.body.title; }
}
document.getElementById('pos').innerHTML=' ... ' + eval(eval('-' + ifrect.left) + pos3) + ',' + eval(eval('-' + ifrect.top) + pos4);
});
}
setTimeout(function(){ location.href='#myh1'; }, 15000);
aimg=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('addimg=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('addimg=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
if (aimg != '') { document.getElementById('addimg').value=plusdata(aimg); }
document.getElementById('myform').action=document.URL.split('?')[0].split('#')[0];
cookieAVal('saved_twopi_vs_circo_', true);
// one
aplace='" . str_replace("\n", "' + String.fromCharCode(10) + '",$abl[1]) . "'; //'5th Edition;6th Edition,PWB 1.0|6th Edition;LSX,1 BSD,Mini Unix,Wollongong,Interdata|Interdata;Unix/TS 3.0,PWB 2.0,7th Edition';
document.getElementById('one').placeholder=aplace;
// two
aplace='" . str_replace("\n", "' + String.fromCharCode(10) + '",$abl[2]) . "'; //'7th Edition;8th Edition,32V,V7M,Ultrix-11,Xenix,UniPlus+|V7M;Ultrix-11';
document.getElementById('two').placeholder=aplace;
// three
aplace='" . str_replace("\n", "' + String.fromCharCode(10) + '",$abl[3]) . "'; //'8th Edition;9th Edition|1 BSD;2 BSD|2 BSD;2.8 BSD|2.8 BSD;Ultrix-11,2.9 BSD|32V;3 BSD|3 BSD;4 BSD|4 BSD;4.1 BSD|4.1 BSD;4.2 BSD|4.2 BSD;4.3 BSD,Ultrix-32|PWB 1.0;PWB 1.2,USG 1.0|PWB 1.2;PWB 2.0|USG 1.0;CB Unix 1,USG 2.0|CB Unix 1;CB Unix 2|CB Unix 2;CB Unix 3|CB Unix 3;Unix/TS++,PDP-11 Sys V|USG 2.0;USG 3.0|USG 3.0;Unix/TS 3.0|PWB 2.0;Unix/TS 3.0|Unix/TS 1.0;Unix/TS 3.0|Unix/TS 3.0;TS 4.0|Unix/TS++;TS 4.0|CB Unix 3;TS 4.0|TS 4.0;System V.0|System V.0;System V.2|System V.2;System V.3';
document.getElementById('three').placeholder=aplace;
var asize=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('fsize=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('fsize=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
if (asize != '') { document.getElementById('fsize').value=asize; } else if ('" . $fsize . "' != '') { document.getElementById('fsize').value='" . $fsize . "'; }
var ashape=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('shape=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('shape=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
if (ashape != '') { document.getElementById('shape').value=ashape; } else if ('" . $shape . "' != '') { document.getElementById('shape').value='" . $shape . "'; }
var acol=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('back=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('back=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
if (acol != '') { if (('' + acol.length) == '6') { document.getElementById('back').value='#' + acol; } else { document.getElementById('back').value='' + acol; } }
var amode=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('mode=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('mode=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
if (amode != '') { document.getElementById('mode').value=amode; }
var atitle=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('title=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('title=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
if (atitle != '') { document.getElementById('ititle').value=atitle; }
var aone=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('one=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('one=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
if (aone != '') { document.getElementById('plus').title='Smaller'; document.getElementById('minus').style.cursor='Pointer'; document.getElementById('minus').style.textDecoration='underline'; document.getElementById('plus').title='Bigger'; document.getElementById('plus').style.cursor='Pointer'; document.getElementById('plus').style.textDecoration='underline'; document.getElementById('plus').innerHTML='+'; while (aone.indexOf(String.fromCharCode(9)) != -1) { aone=aone.replace(String.fromCharCode(9),'+'); } document.getElementById('one').value=aone; document.getElementById('none').value=aone; }
var atwo=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('two=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('two=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
if (atwo != '') { while (atwo.indexOf(String.fromCharCode(9)) != -1) { atwo=atwo.replace(String.fromCharCode(9),'+'); } document.getElementById('two').value=atwo; document.getElementById('ntwo').value=atwo; }
var athree=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('three=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('three=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
if (athree != '') { while (athree.indexOf(String.fromCharCode(9)) != -1) { athree=athree.replace(String.fromCharCode(9),'+'); } document.getElementById('three').value=athree; document.getElementById('nthree').value=athree; }
var afmt=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('fmt=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('fmt=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : 'svg';
if (afmt != '' && document.getElementById('one').value != '') { document.getElementById('fmt').value=afmt; }
if (('' + location.hash).indexOf('title=') != -1 && atitle.trim() != '' && aone.trim() != '') {
animbord(); //document.getElementById('mysub').style.border='3px dotted green';
setTimeout(function(){ document.getElementById('mysub').click(); }, 2000);
}
}
function deleteAVal(goodname, aparticularvalue) {
if (window.localStorage && goodname.indexOf('saved_twopi_vs_circo_') == 0) {
if (('' + localStorage.getItem(goodname)).replace(/^undefined/g,'').replace(/^null/g,'') != '') {
if (aparticularvalue == '') {
localStorage.removeItem(goodname);
} else {
if (aparticularvalue.replace('HTTP','http').toLowerCase() == ('' + localStorage.getItem(goodname)).toLowerCase()) {
localStorage.removeItem(goodname);
}
}
}
}
}
function setAVal(cName, cVal) {
if (cName.indexOf('saved_twopi_vs_circo_') == 0) {
if (window.localStorage) {
localStorage.setItem(cName, encodeURIComponent(cVal));
cookieAVal('saved_twopi_vs_circo_', true);
return ' ';
}
return '';
}
return '';
}
function gotothis(inu) {
if (inu.trim() != '') {
if (inu.indexOf('HttP') == 0) {
var toe=null;
if (document.getElementById('sells').innerHTML.indexOf(inu + '\">') != -1) {
toe=prompt('Please enter email address or SMS number to share ' + document.getElementById('sells').innerHTML.split(inu + '\">')[1].split('<')[0].replace('Email or SMS ','') + ' with.', '');
} else {
toe=prompt('Please enter email address or SMS number to share with.', '');
}
if (toe == null) { toe=''; }
if (toe.indexOf('@') != -1) {
if (document.getElementById('sells').innerHTML.indexOf(inu + '\">') != -1) {
document.getElementById('myaemailsms').href='mailto:' + toe.trim() + '?subject=' + encodeURIComponent(document.getElementById('sells').innerHTML.split(inu + '\">')[1].split('<')[0].replace('Email or SMS ','')) + '&body=' + encodeURIComponent(inu.replace('HttP','http').split('#')[0].replace(/\-/g,'').replace('doctestoutput','doctest-output'));
document.getElementById('myaemailsms').click();
} else {
document.getElementById('myaemailsms').href='mailto:' + toe.trim() + '?subject=' + encodeURIComponent('Circular Layout') + '&body=' + encodeURIComponent(inu.replace('HttP','http').split('#')[0].replace(/\-/g,'').replace('doctestoutput','doctest-output'));
document.getElementById('myaemailsms').click();
}
} else if (toe.trim() != '') {
if (toe.trim().replace(/0/g,'').replace(/1/g,'').replace(/2/g,'').replace(/3/g,'').replace(/4/g,'').replace(/5/g,'').replace(/6/g,'').replace(/7/g,'').replace(/8/g,'').replace(/9/g,'') == '') {
document.getElementById('myaemailsms').href='sms:' + toe.trim() + '&body=' + encodeURIComponent(inu.replace('HttP','http').split('#')[0].replace(/\-/g,'').replace('doctestoutput','doctest-output'));
document.getElementById('myaemailsms').click();
}
}
document.getElementById('sells').value='';
} else if (inu.indexOf('HTTP') == 0) {
//alert('2:' + inu);
if (inu.indexOf('#saved_twopi_vs_circo_') != -1) {
//alert('22:' + inu.split('#')[eval(-1 + inu.split('#').length)]);
deleteAVal(inu.split('#')[eval(-1 + inu.split('#').length)], encodeURIComponent(inu.replace('#' + inu.split('#')[eval(-1 + inu.split('#').length)], '').replace('HTTP','http')));
//alert('222:' + inu.split('#')[eval(-1 + inu.split('#').length)]);
cookieAVal('saved_twopi_vs_circo_', true);
//alert('2222:' + inu.split('#')[eval(-1 + inu.split('#').length)]);
}
} else {
//woo=window.open(inu, '_blank', 'top=50,left=50,width=800,height=800');
woo=window.open(inu.replace(/\-/g,'').replace('doctestoutput','doctest-output').replace('http:','').replace('https:',''), '_blank', 'top=50,left=50,width=800,height=800');
}
}
}
function rework(what) {
var outw=what;
if (what.toLowerCase().indexOf('doctest output ') != -1 && what.toLowerCase().indexOf('.gv.') != -1) {
outw=what.toLowerCase().split('doctest output ')[1].split('.gv.')[0];
var outwds=outw.split(' ');
outw=outwds[0].substring(0,1).toUpperCase() + (outwds[0] + ' ').substring(1).toLowerCase().trim();
for (var io=1; io<outwds.length; io++) {
outw+=' ' + outwds[io].substring(0,1).toUpperCase() + (outwds[io] + ' ').substring(1).toLowerCase().trim();
}
}
return outw;
}
function cookieAVal(cName, selize) {
var key=null;
if (selize && window.localStorage) {
lssel=' ';
for (var i=0; i<localStorage.length; i++) { // thanks to https://stackoverflow.com/questions/41271092/how-to-loop-through-localstorage-values
key = localStorage.key(i);
if (('' + key).indexOf(cName) == 0) {
if (lssel.trim() == '') {
lssel='<select id=sells onchange=gotothis(this.value);><option value=\"\">Recallable Circular Layout below ...</option></select>';
}
lssel=lssel.replace('</select>', '<option value=\"' + decodeURIComponent(localStorage.getItem('' + key)) + '\">' + rework(('' + key).substring(eval('' + cName.length)).replace(/\_/g,' ').replace(/\-/g,' ')) + '</option>' + '<option value=\"' + decodeURIComponent(localStorage.getItem('' + key).replace('http','HTTP')) + '#saved_twopi_vs_circo_' + ('' + key).substring(eval('' + cName.length)) + '\">Remove ' + rework(('' + key).substring(eval('' + cName.length)).replace(/\_/g,' ').replace(/\-/g,' ')) + '</option>' + '<option value=\"' + decodeURIComponent(localStorage.getItem('' + key).replace('http','HttP')) + '#saved_twopi_vs_circo_' + ('' + key).substring(eval('' + cName.length)) + '\">Email or SMS ' + rework(('' + key).substring(eval('' + cName.length)).replace(/\_/g,' ').replace(/\-/g,' ')) + '</option>' + '</select>');
}
}
if (lssel != '') {
document.getElementById('ssel').innerHTML=lssel.trim();
}
}
if (cName.indexOf('saved_twopi_vs_circo_') == 0) {
if (window.localStorage) {
if (decodeURIComponent(('' + localStorage.getItem(cName)).replace(/^undefined/g,'').replace(/^null/g,'')) != '') {
return decodeURIComponent(localStorage.getItem(cName));
}
if (decodeURIComponent(('' + sessionStorage.getItem(cName)).replace(/^undefined/g,'').replace(/^null/g,'')) != '') {
return decodeURIComponent(sessionStorage.getItem(cName));
}
}
return '';
}
return '';
}
function phv(tao) {
if (('' + tao.value) == '') {
tao.value=tao.placeholder;
}
}
function various(indi) {
var outdi=indi;
return outdi;
}
function contentfix(inid) {
document.getElementById('ititle').value=document.getElementById('ititle').value.replace(/\+/g,'-').replace(/\=/g,'-').replace(/\ /g,'-');
//document.getElementById('one').value=document.getElementById('one').value.replace(/\+/g,'`');
//document.getElementById('two').value=document.getElementById('two').value.replace(/\+/g,'`');
//document.getElementById('three').value=document.getElementById('three').value.replace(/\+/g,'`');
document.getElementById('none').value=various(document.getElementById('one').value.replace(/\+/g,String.fromCharCode(9)));
document.getElementById('ntwo').value=various(document.getElementById('two').value.replace(/\+/g,String.fromCharCode(9)));
document.getElementById('nthree').value=various(document.getElementById('three').value.replace(/\+/g,String.fromCharCode(9)));
document.getElementById('mysub').style.border='3px dotted green';
//alert(document.getElementById('none').value);
return inid;
}
function emailit(inais) {
event.stopPropagation();
var em=null;
window.focus();
em=prompt('Please enter email address to send output ' + document.getElementById('fmt').value + ' URL link to. ', '');
if (em == null) { em=''; }
if (em.indexOf('@') != -1) {
document.getElementById('ititle').value=document.getElementById('ititle').value.replace(/\+/g,'-').replace(/\=/g,'-').replace(/\ /g,'-');
document.getElementById('none').value=various(document.getElementById('one').value.replace(/\+/g,String.fromCharCode(9)));
document.getElementById('ntwo').value=various(document.getElementById('two').value.replace(/\+/g,String.fromCharCode(9)));
document.getElementById('nthree').value=various(document.getElementById('three').value.replace(/\+/g,String.fromCharCode(9)));
//alert(document.getElementById('addimg').value);
em+='?subject=' + document.getElementById('newablzero').value + '&body=' + encodeURIComponent( (document.URL.split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 19897865) + '#title=' + encodeURIComponent(document.getElementById('ititle').value) + '#back=' + encodeURIComponent(document.getElementById('back').value.replace('#','')) + '#fsize=' + encodeURIComponent(document.getElementById('fsize').value) + '#shape=' + encodeURIComponent(document.getElementById('shape').value) + '#mode=' + encodeURIComponent(document.getElementById('mode').value) + '#fmt=' + encodeURIComponent(document.getElementById('fmt').value) + '#one=' + encodeURIComponent(document.getElementById('none').value) + '#two=' + encodeURIComponent(document.getElementById('ntwo').value) + '#three=' + encodeURIComponent(document.getElementById('nthree').value) + '#addimg=' + encodeURIComponent(document.getElementById('addimg').value)).replace('#fmt=svg#one=#','#fmt=pdf#one=#') );
document.getElementById('dimap').innerHTML='<a style=display:none; id=theaemail target=_blank href=\"mailto:' + em + '\">Email</a>';
document.getElementById('theaemail').click();
}
return false;
}
function svghost(svgheo, imgc) {
if (9 == 8) {
if (gzero) {
gzero.innerHTML+=\"<image x='0' y='0' href='/camel.png'></image>\";
} else {
svgheo.innerHTML+=\"<image x='0' y='0' href='/camel.png'></image>\";
}
}
}
function animbord() {
var bcolsare=['green','#F0F8FF','#F0FFFF','#F0F0E0','#F0FFF0','#FFFFF0','#FFF0E0','#FFFFE0','#F0FFF0','#FFFFFF','#F0F0F0','#F0F7FF','#FFF8F0','#FFF0F0','#E0FFFF','#FFFFE0'];
document.getElementById('mysub').style.border='3px dotted ' + bcolsare[lastj];
lastj++;
if (lastj >= eval('' + bcolsare.length)) { lastj=0; }
setTimeout(animbord, 200);
}
function psvgit() {
svgit(lastsvgeo, lastimgc);
}
function hsvtorgb(hsbh, hsbs, hsbb) { // thanks to https://stackoverflow.com/questions/17242144/javascript-convert-hsb-hsv-color-to-rgb-accurately
var rgb = { };
var h = Math.round(hsbh * 255);
var s = Math.round(hsb.s * 255 / 100);
var v = Math.round(hsb.b * 255 / 100);
if (s == 0) {
rgb.r = rgb.g = rgb.b = v;
} else {
var t1 = v;
var t2 = (255 - s) * v / 255;
var t3 = (t1 - t2) * (h % 60) / 60;
if (h == 360) h = 0;
if (h < 60) { rgb.r = t1; rgb.b = t2; rgb.g = t2 + t3 }
else if (h < 120) { rgb.g = t1; rgb.b = t2; rgb.r = t1 - t3 }
else if (h < 180) { rgb.g = t1; rgb.r = t2; rgb.b = t2 + t3 }
else if (h < 240) { rgb.b = t1; rgb.r = t2; rgb.g = t1 - t3 }
else if (h < 300) { rgb.b = t1; rgb.g = t2; rgb.r = t2 + t3 }
else if (h < 360) { rgb.r = t1; rgb.g = t2; rgb.b = t1 - t3 }
else { rgb.r = 0; rgb.g = 0; rgb.b = 0 }
}
return 'rgb(' + Math.round(rgb.r) + ',' + Math.round(rgb.g) + ',' + Math.round(rgb.b) + ')';
}
function svgit(svgeo, imgc) {
var pres='';
lastsvgeo=svgeo;
lastimgc=imgc;
if (('' + svgeo.outerHTML).indexOf('<text') == 0) {
if (((' ' + svgeo.innerHTML.toHtmlEntities()).split('&')[0].split('(')[0].split('<')[0]).replace('%20',' ').replace('+',' ').indexOf(' ') != -1 && lasturl != '//thatsthem.com/name/' + encodeURIComponent(svgeo.innerHTML.toHtmlEntities().split('&')[0].split('(')[0].split('<')[0])) {
lasturl='//thatsthem.com/name/' + encodeURIComponent(svgeo.innerHTML.toHtmlEntities().split('&')[0].split('(')[0].split('<')[0])
window.open('//www.google.com/search?sca_esv=8957a51bd870705f&sxsrf=ADLYWIL9Z95Y2XILCVHy1Ep_vA8UA0HVLw:1728014294038&q=' + encodeURIComponent(svgeo.innerHTML) + '&udm=2&fbs=AEQNm0CrHVBV9axs7YmgJiq-TjYcvrKLYvLdNLLD2b8MCfaxte6rE3yH_shvJRqV-Iqr8JJvO9luGxMyf8tABHRE_ER5WVi_ouuYD0ZGCgonp8RpBmOUpTB-X6dVFbJc8KMdvjlHxs0_OJiYCY4-Y60oHTMiC_1a9mkGkMIYHO4XqP68ipa4P5rJaQCtA4WPne6f0aAKhdyAMTPbTsWJEdFYpNvI5RzOgw&sa=X&ved=2ahUKEwjCwabx6vOIAxWJ7DQHHQIOJBoQtKgLegQIDRAB&biw=1433&bih=739&dpr=2', '_blank', 'top=100,left=' + eval(-600 + screen.width) + ',width=600,height=600');
window.focus();
uselast=true;
setTimeout(psvgit, 2000);
return '';
}
lasttext=svgeo;
if (lastiurl.indexOf(\"<image x='\" + svgeo.getAttribute('x') + \"' y='\" + svgeo.getAttribute('y')) == -1 && (imgc == 'ask' || lasturl == '//thatsthem.com/name/' + encodeURIComponent(svgeo.innerHTML.toHtmlEntities().split('&')[0].split('(')[0].split('<')[0]))) {
if (('' + svgeo.getAttribute('width')).indexOf('null') != -1) {
lastiurl=\"<image x='\" + eval(-20 + eval('' + svgeo.getAttribute('x'))) + \"' y='\" + eval(-20 + eval('' + svgeo.getAttribute('y'))) + \"' width='45' height='45' opacity='\" + zerodotsix + \"' href=''></image>\";
} else {
lastiurl=\"<image x='\" + svgeo.getAttribute('x') + \"' y='\" + svgeo.getAttribute('y') + \"' opacity='\" + zerodotsix + \"' width='\" + svgeo.getAttribute('width') + \"' height='\" + svgeo.getAttribute('height') + \"' href=''></image>\";
}
window.focus();
pres=null;
try {
if (lastp.indexOf('Regarding ' + svgeo.innerHTML + ' ') == -1) {
//alert(szero.innerHTML.split(svgeo.innerHTML + '</title>')[1].substring(0,300));
if (bconto) { document.getElementById('hidecol').value=szero.innerHTML.split('>' + svgeo.innerHTML + '</title>')[1].split(' fill=\"')[1].split('\"')[0]; bconto.setlhifto(szero.innerHTML.split(svgeo.innerHTML + '</title>')[1].split(' fill=\"')[1].split('\"')[0]); }
//pres=prompt('Regarding ' + svgeo.innerHTML + ' please see the whole node ' + svgeo.outerHTML.substring(0,1) + ' .+. ' + szero.innerHTML.split(svgeo.innerHTML + '</title>')[1].split(' fill=\"')[1].split('\"')[0] + '', '');
pres='';
}
} catch(exc) {
console.log('error');
}
if (pres == null) { console.log('err'); pres=''; if (uselast) { setTimeout(psvgit, 2000); } } else { uselast=false; lastp='Regarding ' + svgeo.innerHTML + ' please enter an optional image URL'; }
if (pres != '') {
if (pres.indexOf('#') == -1) { zerodotsix='0.6'; } else if (pres.indexOf('#') != -1) { zerodotsix=pres.split('#')[1]; pres=pres.split('#')[0].trim(); if ((zerodotsix + 'z').substring(0,1) < '0' || (zerodotsix + 'z').substring(0,1) > '9') { zerodotsix='0.6'; } }
if (pres != '') {
uselast=false;
lastp='Regarding ' + svgeo.innerHTML + ' please see the whole node ' + svgeo.outerHTML + '';
lastiurl=lastiurl.replace(\" href=''\", \" href='\" + pres + \"'\");
if (gzero) {
//alert(\"<image x='0' y='0' width='45' height='45' href=\" + lastiurl.split('href=')[1]);
//gzero.innerHTML+=\"<image x='0' y='0' width='45' height='45' href=\" + lastiurl.split('href=')[1]; //.replace(/\-/g,'');
//if (document.getElementById('addimg').value == '') {
// document.getElementById('addimg').value=' gzero.innerHTML+=\"\"; ';
//}
document.getElementById('addimg').value+=lastiurl;
gzero.innerHTML+=lastiurl;
}
}
}
}
if (lasturl != '//thatsthem.com/name/' + encodeURIComponent(svgeo.innerHTML.toHtmlEntities().split('&')[0].split('(')[0].split('<')[0])) {
lasturl='//thatsthem.com/name/' + encodeURIComponent(svgeo.innerHTML.toHtmlEntities().split('&')[0].split('(')[0].split('<')[0])
if (('' + svgeo.innerHTML.toHtmlEntities().split('&')[0].split('(')[0].split('<')[0]).replace('%20',' ').replace('+',' ').indexOf(' ') == -1) {
if (1 == 2) { setTimeout(function(){ window.open(lasturl, '_blank', 'top=100,left=' + eval(-600 + screen.width) + ',width=600,height=600'); }, 3000); }
} else {
lasturl+=' ';
}
//svgeo.innerHTML+='</text><text>+';
}
}
if (1 == 2) {
svgeo.innerHTML+='+';
alert('' + svgeo.outerHTML);
}
}
function naz(intvo) {
var intv=intvo.value;
if (intv.replace(' ','-').replace('_','-').indexOf('-') == -1 && intv.trim() != '') {
intvo.value='a-' + intv;
intv=intvo.value;
}
var retval='My%20%Colour%20Wheel';
var jntv=intv.replace(/\ /g,'-').replace(/\_/g,'-');
var jst=jntv.split('-');
if (jntv.indexOf('iagram') != -1) {
retval=jst[0].substring(0,1).toUpperCase() + jst[0].substring(1).toLowerCase() + ' ';
for (var ij=1; ij<jst.length; ij++) {
retval+=jst[ij].substring(0,1).toUpperCase() + jst[ij].substring(1).toLowerCase() + ' ';
}
retval=encodeURIComponent(retval.trim());
}
document.getElementById('newablzero').value=retval;
if (document.getElementById('addimg').value != '') {
document.getElementById('ablnewzero').value=document.getElementById('addimg').value;
}
document.getElementById('mybutsave').style.display='inline-block';
return retval;
}
function smsit(inais) {
event.stopPropagation();
var em=null;
window.focus();
em=prompt('Please enter SMS number to send output ' + document.getElementById('fmt').value + ' URL link to.', '');
if (em == null) { em=''; }
if (em.trim() != '') {
if (em.trim() != '') {
document.getElementById('ititle').value=document.getElementById('ititle').value.replace(/\+/g,'-').replace(/\=/g,'-').replace(/\ /g,'-');
document.getElementById('none').value=various(document.getElementById('one').value.replace(/\+/g,String.fromCharCode(9)));
document.getElementById('ntwo').value=various(document.getElementById('two').value.replace(/\+/g,String.fromCharCode(9)));
document.getElementById('nthree').value=various(document.getElementById('three').value.replace(/\+/g,String.fromCharCode(9)));
em+='&body=' + encodeURIComponent( (document.URL.split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 19897865) + '#title=' + encodeURIComponent(document.getElementById('ititle').value) + '#back=' + encodeURIComponent(document.getElementById('back').value.replace('#','')) + '#fsize=' + encodeURIComponent(document.getElementById('fsize').value) + '#shape=' + encodeURIComponent(document.getElementById('shape').value) + '#mode=' + encodeURIComponent(document.getElementById('mode').value) + '#fmt=' + encodeURIComponent(document.getElementById('fmt').value) + '#one=' + encodeURIComponent(document.getElementById('none').value) + '#two=' + encodeURIComponent(document.getElementById('ntwo').value) + '#three=' + encodeURIComponent(document.getElementById('nthree').value) + '#addimg=' + encodeURIComponent(document.getElementById('addimg').value)).replace('#fmt=svg#one=#','#fmt=pdf#one=#') );
document.getElementById('dimap').innerHTML='<a style=display:none; id=theasms target=_blank href=\"sms:' + em + '\">SMS</a>';
if (!document.getElementById('theasms') && document.getElementById('psms')) {
document.getElementById('psms').click();
} else {
document.getElementById('theasms').click();
}
}
}
return false;
}
function sz(inum) {
var uni='px';
if (szero) {
if (('' + szero.getAttribute('width')).indexOf('pt') != -1) { uni='pt'; } else if (('' + szero.getAttribute('width')).indexOf('%') != -1) { uni='%'; }
szero.setAttribute('width', '' + ('' + eval(eval('' + szero.getAttribute('width').split(uni)[0])) * eval('' + inum)) + uni);
szero.setAttribute('height', '' + ('' + eval(eval('' + szero.getAttribute('height').split(uni)[0])) * eval('' + inum)) + uni);
}
}
function domore(hm) {
var rectis=document.getElementById('myif').getBoundingClientRect();
if (('' + hm) == '1') {
document.getElementById('rtd').style.width='20%';
document.getElementById('myif').style.width='' + eval(eval('' + rectis.width) * sz(1.1)) + 'px';
document.getElementById('myif').style.height='' + eval(eval('' + rectis.height) * 1.1) + 'px';
} else if (('' + hm) == '-1') {
document.getElementById('rtd').style.width='50%';
document.getElementById('myif').style.width='' + eval(eval('' + rectis.width) * sz(0.9)) + 'px';
document.getElementById('myif').style.height='' + eval(eval('' + rectis.height) * 0.9) + 'px';
} else if (('' + hm) == '-2') {
document.getElementById('rtd').style.width='50%';
document.getElementById('myif').style.width='' + eval(eval('' + rectis.width) * sz(0.8)) + 'px';
document.getElementById('myif').style.height='' + eval(eval('' + rectis.height) * 0.8) + 'px';
} else {
document.getElementById('rtd').style.width='20%';
document.getElementById('myif').style.width='' + eval(eval('' + rectis.width) * sz(1.2)) + 'px';
document.getElementById('myif').style.height='' + eval(eval('' + rectis.height) * 1.2) + 'px';
}
}
function prechecksvg() {
checksvg(lastwoo);
}
function checki(iois) {
bconto = (iois.contentWindow || iois.contentDocument);
}
function checksvg(iiois) {
var gs=[];
var iois=iiois;
if (lastwoo) {
iois=lastwoo.document.childNodes[0]; //.getSVGDocument();
console.log('lAstwoo ' + lastwoo);
} else if (('' + iiois.src).toLowerCase().indexOf('.svg') == -1 && lastwoo != null) {
iois=lastwoo.document.childNodes[0]; //.getSVGDocument();
console.log('lastwoo ' + lastwoo);
}
if (iois != null) { // check out window.svgDocument
console.log('lastwoo2');
var aconto = (iois.contentWindow || iois.contentDocument);
svgconto=aconto;
console.log('lastwoo3a ' + iois.document);
console.log('lastwoo3 ' + aconto);
if (aconto != null) {
//alert(1);
console.log('lastwoo4 ' + aconto);
if (aconto.document) {
console.log('lastwoo5 ' + aconto);
aconto = aconto.document;
gs=aconto.getElementsByTagName('g');
if (eval('' + gs.length) > 0) {
gzero=gs[0];
gone=gs[0];
for (var sd=0; sd<gs.length; sd++) {
if (('' + gs[sd].id) == 'node1') { gone=gs[sd]; }
if (iois == lastwoo) {
gs[sd].onclick=function(event){ window.opener.svgit(event.target, ''); };
gs[sd].ondblclick=function(event){ window.opener.svgit(event.target, 'ask'); };
} else {
gs[sd].onclick=function(event){ parent.svgit(event.target, ''); };
gs[sd].ondblclick=function(event){ parent.svgit(event.target, 'ask'); };
if (gs[sd].outerHTML.indexOf(' stroke=\"transparent\"') != -1 && gs[sd].outerHTML.indexOf(' stroke=\"transparent\"') < 80) {
bigoh=gs[sd].outerHTML;
} else {
gs[sd].addEventListener('mousedown', function(event){ parent.clickreg(event); });
gs[sd].addEventListener('touchdown', function(event){ parent.clickreg(event); });
}
}
}
}
gs=aconto.getElementsByTagName('polygon');
for (var isd=0; isd<gs.length; isd++) {
if (gs[isd].outerHTML.indexOf(' stroke=\"transparent\"') != -1 && gs[isd].outerHTML.indexOf(' stroke=\"transparent\"') < 80) {
if (bigoh == '') { bigoh=gs[isd].outerHTML; }
}
}
gs=aconto.getElementsByTagName('svg');
if (eval('' + gs.length) > 0) {
szero=gs[0];
szero.addEventListener('mousedown', function(event){ parent.clickreg(event); });
szero.addEventListener('touchdown', function(event){ parent.clickreg(event); });
szero.addEventListener('mousemove', function(){
if (event.touches) {
//if (event.touches[0].screenX) { pos3 = event.touches[0].screenX; pos4 = event.touches[0].screenY; } else
if (event.touches[0].pageX) {
pos3 = event.touches[0].pageX;
pos4 = event.touches[0].pageY;
} else {
pos3 = event.touches[0].clientX;
pos4 = event.touches[0].clientY;
}
// // console.log('pos3 = ' + pos3 + ',pos4 = ' + pos4);
//} else if (event.screenX) { pos3 = event.screenX; pos4 = event.screenY;
} else if (event.clientX || event.clientY) {
pos3 = event.clientX;
pos4 = event.clientY;
// console.log('pos3 = ' + pos3 + ' ,pos4 = ' + pos4);
} else {
pos3 = event.pageX;
pos4 = event.pageY;
// console.log('pos3 = ' + pos3 + ', pos4 = ' + pos4);
}
if (event.target.outerHTML.indexOf('<body') == 0) {
if (dbt == '') { dbt=document.body.title; }
}
pos4+=140; pos3-=40;
parent.document.getElementById('pos').innerHTML=' ... ' + pos3 + ',' + pos4 + ' ... inches ... ' + eval(pos3 / 96).toPrecision(5) + ',' + eval(eval(288 - pos4) / 96).toPrecision(5) + ' ... points ... <span id=pointsx>' + eval(pos3 * 3.0 / 4.0).toPrecision(5) + '</span>,<span id=pointsy>' + eval(288 - eval(pos4 * 3.0 / 4.0)).toPrecision(5) + '</span>';
});
for (var sd=0; sd<gs.length; sd++) {
if (iois == lastwoo) {
gs[sd].onclick=function(event){ window.opener.svghost(event.target, ''); };
} else {
gs[sd].onclick=function(event){ parent.svghost(event.target, ''); };
}
}
}
console.log(gs.length);
console.log(aconto);
}
//alert(11);
if (aconto.body != null) {
iois=iois;
//alert('yay!');
if (5 == 7) {
szero=aconto.body;
szero.addEventListener('mousedown', function(event){ parent.clickreg(event); });
szero.addEventListener('touchdown', function(event){ parent.clickreg(event); });
gs=aconto.getElementsByTagName('img');
gs[0].addEventListener('mousedown', function(event){ parent.clickreg(event); });
gs[0].addEventListener('touchdown', function(event){ parent.clickreg(event); });
gzero=gs[0];
if (bigoh == '') { bigoh=gs[0].outerHTML; }
gs=aconto.getElementsByTagName('area');
for (var iqw=0; iqw<gs.length; iqw++) {
gs[iqw].addEventListener('mousedown', function(event){ parent.clickreg(event); });
gs[iqw].addEventListener('touchdown', function(event){ parent.clickreg(event); });
}
gs=aconto.getElementsByTagName('map');
szero=gs[0];
gs[0].innerHTML+='<area id=defarea onmousedown=parent.clickreg(event); ontouchdown=parent.clickreg(event); shape=default nohref></area>';
if (bigoh == '') { bigoh=aconto.getElementById('defarea').outerHTML; }
}
aconto.body.addEventListener('mousemove', function(){
if (event.touches) {
//if (event.touches[0].screenX) { pos3 = event.touches[0].screenX; pos4 = event.touches[0].screenY; } else
if (event.touches[0].pageX) {
pos3 = event.touches[0].pageX;
pos4 = event.touches[0].pageY;
} else {
pos3 = event.touches[0].clientX;
pos4 = event.touches[0].clientY;
}
// // console.log('pos3 = ' + pos3 + ',pos4 = ' + pos4);
//} else if (event.screenX) { pos3 = event.screenX; pos4 = event.screenY;
} else if (event.clientX || event.clientY) {
pos3 = event.clientX;
pos4 = event.clientY;
// console.log('pos3 = ' + pos3 + ' ,pos4 = ' + pos4);
} else {
pos3 = event.pageX;
pos4 = event.pageY;
// console.log('pos3 = ' + pos3 + ', pos4 = ' + pos4);
}
if (event.target.outerHTML.indexOf('<body') == 0) {
if (dbt == '') { dbt=document.body.title; }
}
pos4+=140; pos3-=40;
parent.document.getElementById('pos').innerHTML=' ... ' + pos3 + ',' + pos4 + ' ... inches ... ' + eval(pos3 / 96).toPrecision(5) + ',' + eval(eval(288 - pos4) / 96).toPrecision(5) + ' ... points ... ' + '<span id=pointsx>' + eval(pos3 * 3.0 / 4.0).toPrecision(5) + '</span>,<span id=pointsy>' + eval(288 - eval(pos4 * 3.0 / 4.0)).toPrecision(5) + '</span>';
});
}
}
if (gzero) {
gzero=gzero;
" . (strlen($addimg) == 0 ? $addimg : ' gzero.innerHTML+="' . $addimg . '"') . "
if (aimg != '') { eval(' gzero.innerHTML+=\"' + aimg + '\"'); }
}
}
}
</scr" . "ipt>
<style>
#fsize { width: 80px; }
#bltd { text-align:right; vertical-align: bottom; background-color: rgba(255,223,0,0.8); border: 2px dotted purple; border-radius: 28px; }
#ltd { background-color: #90c070; margin: 0 0 0 0; padding: 0 0 0 0; }
body { background-color: #9070c0; }
#myif { background-color: #70c090; margin: 0 0 0 0; padding: 0 0 0 0; }
textarea {
width: 99%;
height: 50px;
}
#one {
height: 220px;
}
#back { display: none; }
td { vertical-align: top; }
</style>
</head>
<body onload=\"ifrect=document.getElementById('myif').getBoundingClientRect();\" title='Click on a GraphViz SVG node, and if the associated circle shape has a name a Google search window will open and associated colour available to draw with on the canvas below. Two discrete clicks on circles and/or text along with an SVG format output can allow for Circular Layout enity editing and adding and rewording and resizing.' onload=ph();>
<h1 id=myh1>Trying out <span title='Actually twopi for this Circular Layout idea'>Dot</span> GraphViz hosted in PHP " . $plus . " Circular Layout <span id=ssel></span> <a id=pemail title=Email class=share onclick=emailit(this); style=text-decoration:none;cursor:pointer;>📧</a> <a id=psms title=SMS class=share onclick=smsit(this); style=text-decoration:none;cursor:pointer;>📟</a></h1>
<h3>RJM Programming " . $minus . " October, 2024 <span id=pos></span></h3>
<h4 id=myh4>Thanks to <a target=_blank title='Dot GraphViz package information' href='//forum.graphviz.org/t/subset-diagrams/1118/4'>https://stackoverflow.com/questions/72531363/how-to-create-a-graph-with-a-circular-layout-in-graphviz</a></h4>
<table id=mytable cellpadding=1 cellspacing=1 style=width:98%;><tr><td id=ltd>
<" . $outel . " onload='checksvg(this);' id=myif style='width:95%;height:500px;' type=application/" . $fmt . " src='/doctest-output" . DIRECTORY_SEPARATOR . $newabl[0] . $gv . $fmt . "?rand=" . rand(13456,6789056) . "'></" . explode(' ',$outel)[0] . ">
<div id=bltd title='Proposed look before size prompt.'></div></td><td title=\"Double click for new window just with the GraphViz graphics showing.\" ondblclick=\"if (szero) { lastwoo=window.open('','_blank','top=200,left=200,width=700,height=600'); lastwoo.document.write(szero.outerHTML); lastwoo.document.title=(document.getElementById('ititle').value != '' ? document.getElementById('ititle').value : document.getElementById('ititle').placeholder); } else { lastwoo=window.open(top.document.URL.split('//')[0].replace('https:','').replace('http:','') + '//www.rjmprogramming.com.au/doctest-output' + document.getElementById('myif').src.split('doctest-output')[1],'_blank','top=200,left=200,width=700,height=600'); setTimeout(prechecksvg, 20000); } \" id=rtd style=background-color:#f0f0f0;width:50%;>
<form id=myform onsubmit=\"if (document.getElementById('ititle').value.replace('venn-diagram','').trim() == '') { alert('Please enter a different title, then click/tap Draw again.'); return false; } document.body.style.cursor=contentfix('progress'); return true;\" method=POST action=./twopi_vs_circo_example.php>
<p>Title ...</p><br>
<input onblur=naz(this); type=text id=ititle name=title placeholder='" . $newabl[0] . "' value=''></input> <select id=fmt name=fmt><option value=svg>SVG</option><option value=pdf>PDF</option><option value=png>PNG</option><option value=jpg>JPEG</option><option value=html>HTML</option></select> <input type=color name=back id=back title='rgb(174,216,232)' value='" . $bbcol . "'></input> <input type=text id=fsize name=fsize placeholder='12' title='Font size ( and you can add node attributes, optionally eg. 14 margin=0 fontcolor=blue )' value='' onblur=fixfont(this);></input> <select id=shape name=shape onchange=fixshape(this);><option value=''>Circle</option>" . $nondefshapes . "</select> <select id=mode name=mode onchange=fixgraph(this);><option value=Digraph>digraph</option><option value=Graph>graph</option></select><br><br>
<p>Circular Layout Names ...</p><br>
<textarea style=display:none; ondblclick=\"event.stopPropagation(); phv(this);\" title='Change whole dot (via neato -n here). Double click makes suggestion the real value' placeholder='' data-contenteditable=true id=none name=one value=''>" . str_replace("\t","+",urldecode($newabl[1])) . "</textarea>
<textarea style=display:none; ondblclick=\"event.stopPropagation(); phv(this);\" title='Old=New comma separated optional list. Double click makes suggestion the real value' placeholder='" . $abl[2] . "' data-contenteditable=true id=ntwo name=two value=''>" . str_replace("\t","+",urldecode($newabl[2])) . "</textarea>
<textarea style=display:none; ondblclick=\"event.stopPropagation(); phv(this);\" title='Old=New comma separated optional list. Double click makes suggestion the real value' placeholder='" . $abl[3] . "' data-contenteditable=true id=nthree name=three value=''>" . str_replace("\t","+",urldecode($newabl[3])) . "</textarea>
<textarea ondblclick=\"event.stopPropagation(); phv(this);\" title='Change whole dot (via neato -n here). Double click makes suggestion the real value' placeholder='' data-name=one id=one data-contenteditable=true value=''>" . str_replace("\t","+",urldecode($newabl[1])) . "</textarea><br>
<textarea ondblclick=\"event.stopPropagation(); phv(this);\" title='Old=New comma separated optional list. Double click makes suggestion the real value' placeholder='" . $abl[2] . "' data-name=two id=two data-contenteditable=true value=''>" . str_replace("\t","+",urldecode($newabl[2])) . "</textarea><br>
<textarea ondblclick=\"event.stopPropagation(); phv(this);\" title='Old=New comma separated optional list. Double click makes suggestion the real value' placeholder='" . $abl[3] . "' data-name=three id=three data-contenteditable=true value=''>" . str_replace("\t","+",urldecode($newabl[3])) . "</textarea><br><br>
<input type=hidden id=addimg name=addimg value=\"" . $addimg . "\"></input>
<input id=mysub type=submit value=Draw style=background-color:pink;></input> <input onclick=\"document.getElementById('myformsub').click();\" style=background-color:yellow;display:" . $none . "; id=mybutsave type=button value=Save style=background-color:yellow;></input>
</form>
</td></tr></table>
<details id=detailsuof open><summary>Canvas Drawing With Clicked Colour to Top and Left As Revealed Below ...</summary><iframe onload=checki(this); style=width:100%;height:800px; id=ifuos name=ifuos src='/HTMLCSS/user_of_signature_signature.htm?fcol=&xc=" . $tw . "'></iframe></details>
<form id=myformsave style=display:none; action=./twopi_vs_circo_example.php method=POST target=myifsave><input type=hidden id=ablnewzero name=newablzero value=\"" . $addimg . "\"></input><input type=hidden id=infile name=infile value='doctest-output" . DIRECTORY_SEPARATOR . $newabl[0] . $gv . $fmt . "'></input><input type=submit id=myformsub style=display:none; value=Submit></input></form>
<a target=_blank id=myaemailsms href='/About_Us.html' style=display:none;>Email/SMS</a><iframe style=display:none; id=myifsave name=myifsave src=/About_Us.html></iframe><div id=dimap></div>
<input type=hidden id=newablzero value='" . $newablzero . "'></input>
<input type=hidden id=hidecol value=''></input>
</body>
</html>";
} else {
echo "<html>
<head>
<title>Trying out Dot GraphViz hosted in PHP - RJM Programming - October, 2024 - Circular Layout</title>
<scr" . "ipt type=text/javascript>
var lasturl='', lasttext=null, gone=null, gzero=null, lastx=0, lasty=0, lastw=0, lasth=0, lastp='', clickcnt=0, lastwoo=null, lastj=0, lssel='', zerodotsix='0.6', bconto=null, pos3=0, pos4=0, dbt='', ifrect=null, bigoh='', lastoh='', lasto=null, svgconto=null, ellfill='', ellfillop='', midpoint='', rxry='', lastiurl='', szero=null, aimg='', lastimgc='', lastsvggeo=null, uselast=false;
String.prototype.toHtmlEntities = function() {
return this.replace(/./gm, function(s) {
return (s.match(/[a-z0-9\s]+/i)) ? s : '&#' + s.charCodeAt(0) + ';';
});
};
function oldclickreg(evt) {
if (evt.touches) {
//if (evt.touches[0].screenX) { pos3 = evt.touches[0].screenX; pos4 = evt.touches[0].screenY; } else
if (evt.touches[0].pageX) {
pos3 = evt.touches[0].pageX;
pos4 = evt.touches[0].pageY;
} else {
pos3 = evt.touches[0].clientX;
pos4 = evt.touches[0].clientY;
}
// // console.log('pos3 = ' + pos3 + ',pos4 = ' + pos4);
//} else if (evt.screenX) { pos3 = evt.screenX; pos4 = evt.screenY;
} else if (evt.clientX || evt.clientY) {
pos3 = evt.clientX;
pos4 = evt.clientY;
// console.log('pos3 = ' + pos3 + ' ,pos4 = ' + pos4);
} else {
pos3 = evt.pageX;
pos4 = evt.pageY;
// console.log('pos3 = ' + pos3 + ', pos4 = ' + pos4);
}
if (lastoh.split(' id=')[0] != evt.target.outerHTML.split(' id=')[0]) {
lastoh=evt.target.outerHTML;
clickcnt++;
if (lastoh.split(' id=')[0] == bigoh.split(' id=')[0]) {
//document.getElementById('myh4').innerHTML+=' ' + clickcnt + ': svg';
} else {
//document.getElementById('myh4').innerHTML+=' ' + clickcnt + ': ' + evt.target.outerHTML.substring(1).split(' ')[0].split('>')[0];
}
}
}
function youngerclickreg(evt) {
var ptx=0, pty=0, ptfromx=0, ptfromy=0;
if (evt.touches) {
//if (evt.touches[0].screenX) { pos3 = evt.touches[0].screenX; pos4 = evt.touches[0].screenY; } else
if (evt.touches[0].pageX) {
pos3 = evt.touches[0].pageX;
pos4 = evt.touches[0].pageY;
} else {
pos3 = evt.touches[0].clientX;
pos4 = evt.touches[0].clientY;
}
// // console.log('pos3 = ' + pos3 + ',pos4 = ' + pos4);
//} else if (evt.screenX) { pos3 = evt.screenX; pos4 = evt.screenY;
} else if (evt.clientX || evt.clientY) {
pos3 = evt.clientX;
pos4 = evt.clientY;
// console.log('pos3 = ' + pos3 + ' ,pos4 = ' + pos4);
} else {
pos3 = evt.pageX;
pos4 = evt.pageY;
// console.log('pos3 = ' + pos3 + ', pos4 = ' + pos4);
}
ptx=eval(pos3 * 3.0 / 4.0);
pty=eval(288 - eval(pos4 * 3.0 / 4.0));
if (lastoh.indexOf('##') != -1) {
console.log('7:' + lastoh.split('##')[1]);
ptfromx=eval('' + lastoh.split('##')[1].split(',')[0]);
ptfromy=eval('' + lastoh.split('##')[1].split(',')[1]);
if (lastoh.split('##')[0].split(' id=')[0] == evt.target.outerHTML.split(' id=')[0] && lastoh.split('##')[0] != bigoh) {
if (eval('' + Math.abs(eval(ptx - ptfromx)) + Math.abs(eval(pty - ptfromy))) > 6) {
lastoh=lastoh.replace(' id=', ' ID=').replace('>##', '##');
}
}
}
if (lastoh.split('##')[0].split(' id=')[0] != evt.target.outerHTML.split(' id=')[0]) {
//lastoh=evt.target.outerHTML + '##' + (document.getElementById('pointsx') ? document.getElementById('pointsx').innerHTML : '0') + ',' + (document.getElementById('pointsy') ? document.getElementById('pointsy').innerHTML : '0');
lastoh=evt.target.outerHTML + '##' + ptx + ',' + pty;
clickcnt++;
if (lastoh.split('##')[0].split(' id=')[0] == bigoh.split(' id=')[0]) {
if (eval(clickcnt % 2) == 0) {
//document.getElementById('myh4').innerHTML+=' ' + clickcnt + ': YesMoveTo' + ptx + ',' + pty;
lastoh='';
} else {
clickcnt--;
}
} else {
if (lastoh.split('##')[0].split(' id=')[0] == bigoh.split(' id=')[0] && eval(clickcnt % 2) == 1) {
clickcnt--;
} else {
if (eval(clickcnt % 2) == 0) {
//document.getElementById('myh4').innerHTML+=' ' + clickcnt + ': ' + evt.target.outerHTML.substring(1).split(' ')[0].split('>')[0] + '-yesMoveTo' + ptx + ',' + pty;
} else {
//document.getElementById('myh4').innerHTML+=' ' + clickcnt + ': ' + evt.target.outerHTML.substring(1).split(' ')[0].split('>')[0];
}
}
}
}
}
function onerecord(inoh, thepointx, thepointy, thepxx, thepxy) {
var vsone=top.document.getElementById('one').value;
var vsell=vsone.split('[height=');
switch ((inoh + ' ').substring(1).split(' ')[0].split('>')[0]) {
case 'ellipse':
var mycx=inoh.split(' cx=')[1].substring(1).split(inoh.split(' cx=')[1].substring(0,1))[0];
var mycy=inoh.split(' cy=')[1].substring(1).split(inoh.split(' cy=')[1].substring(0,1))[0];
lastoh+=',' + mycx + ',' + mycy;
if (szero.outerHTML.indexOf(inoh) == -1) {
lastoh+=',-0';
if (eval('' + vsell.length) > 1) {
lastoh+=',' + vsell[1].split(' pos=\"')[1].split('\"')[0];
} else {
lastoh+=',' + vsone.split(' pos=\"')[1].split('\"')[0];
}
} else if (szero.outerHTML.indexOf(inoh) != -1) {
lastoh+=',0000' + szero.outerHTML.split(inoh)[0].split('<ellipse').length;
if (eval('' + vsell.length) > eval('' + szero.outerHTML.split(inoh)[0].split('<ellipse').length)) {
lastoh+=',' + vsell[eval('' + szero.outerHTML.split(inoh)[0].split('<ellipse').length)].split(' pos=\"')[1].split('\"')[0];
alert('pos is ' + szero.outerHTML.split(inoh)[0].split('<ellipse').length + ' leads to ' + vsell[eval('' + szero.outerHTML.split(inoh)[0].split('<ellipse').length)].split(' pos=\"')[1].split('\"')[0]);
} else {
if (eval('' + vsell.length) > 1) {
lastoh+=',' + vsell[1].split(' pos=\"')[1].split('\"')[0];
} else {
lastoh+=',' + vsone.split(' pos=\"')[1].split('\"')[0];
}
}
}
break;
case 'text':
var myx=inoh.split(' x=')[1].substring(1).split(inoh.split(' x=')[1].substring(0,1))[0];
var myy=inoh.split(' y=')[1].substring(1).split(inoh.split(' y=')[1].substring(0,1))[0];
lastoh+=',' + myx + ',' + myy;
if (szero.outerHTML.indexOf(inoh) == -1) {
lastoh+=',-0';
if (vsone.indexOf(' xlabel=\"' + inoh.split('>')[1].split('<')[0] + '\" xlp=\"') != -1) {
lastoh+=',' + vsone.split(' xlabel=\"' + inoh.split('>')[1].split('<')[0] + '\" xlp=\"')[1].split('\"')[0];
} else {
lastoh+=',' + vsone.split(' pos=\"')[1].split('\"')[0];
}
} else if (szero.outerHTML.indexOf(inoh) != -1) {
lastoh+=',0000' + szero.outerHTML.split(inoh)[0].split('<text').length;
if (vsone.indexOf(' xlabel=\"' + inoh.split('>')[1].split('<')[0] + '\" xlp=\"') != -1) {
lastoh+=',' + vsone.split(' xlabel=\"' + inoh.split('>')[1].split('<')[0] + '\" xlp=\"')[1].split('\"')[0];
} else if (vsone.indexOf(' ' + inoh.split('>')[1].split('<')[0] + '[height=') != -1) {
if (xsone.split(' ' + inoh.split('>')[1].split('<')[0] + '[height=')[1].split(']')[0].indexOf(' xlp=\"') == -1 && xsone.split(' ' + inoh.split('>')[1].split('<')[0] + '[height=')[1].split(']')[0].indexOf(' pos=\"') != -1) {
lastoh+=',' + xsone.split(' ' + inoh.split('>')[1].split('<')[0] + '[height=')[1].split(']')[0].split(' pos=\"')[1].split('\"')[0];
} else if (xsone.split(' ' + inoh.split('>')[1].split('<')[0] + '[height=')[1].split(']')[0].indexOf(' xlp=\"') != -1) {
lastoh+=',' + xsone.split(' ' + inoh.split('>')[1].split('<')[0] + '[height=')[1].split(']')[0].split(' xlp=\"')[1].split('\"')[0];
} else {
lastoh+=',0,0';
}
} else {
lastoh+=',' + vsone.split(' pos=\"')[1].split('\"')[0];
}
}
break;
default:
break;
}
return inoh;
}
function fixgraph(osel) {
var vone=document.getElementById('one').value;
if (vone.indexOf('graph ') != -1 && osel.value != '') {
if (document.getElementById('one').value.indexOf('digraph ') != -1 && osel.value.toLowerCase() == 'graph') {
document.getElementById('one').value=vone.replace('digraph ', 'graph ');
} else if (document.getElementById('one').value.indexOf('digraph ') == -1 && osel.value.toLowerCase() == 'digraph') {
document.getElementById('one').value=vone.replace('graph ', 'digraph ');
}
}
}
function fixshape(osel) {
var vone=document.getElementById('one').value;
if (vone.indexOf('shape=') != -1 && osel.value != '') {
document.getElementById('one').value=vone.replace('shape=' + document.getElementById('one').value.split('shape=')[1].split(' ')[0].split(']')[0], 'shape=' + osel.value);
}
}
function fixfont(oin) {
var vone=document.getElementById('one').value;
if (vone.indexOf('fontsize=') != -1 && oin.value != '') {
document.getElementById('one').value=vone.replace('fontsize=' + document.getElementById('one').value.split('fontsize=')[1].split(' ')[0].split(']')[0], 'fontsize=' + oin.value);
if (eval('' + oin.value.indexOf(' ')) > 0) {
oin.value=oin.value.split(' ')[0];
}
}
}
function movethis(xprevlastoh, xpos3, xpos4, xptx, xpty) {
alert('2:' + xprevlastoh.split(',')[eval(-1 + xprevlastoh.split(',').length)]);
}
function clickreg(evt) {
// lastoh ##pointx,pointy,pxx,pxy,cx,cy,svgindexofinterest,dotx,doty,svgid
var ptx=0, pty=0, ptfromx=0, ptfromy=0;
var prevlastoh=lastoh;
if (evt.touches) {
//if (evt.touches[0].screenX) { pos3 = evt.touches[0].screenX; pos4 = evt.touches[0].screenY; } else
if (evt.touches[0].pageX) {
pos3 = evt.touches[0].pageX;
pos4 = evt.touches[0].pageY;
} else {
pos3 = evt.touches[0].clientX;
pos4 = evt.touches[0].clientY;
}
// // console.log('pos3 = ' + pos3 + ',pos4 = ' + pos4);
//} else if (evt.screenX) { pos3 = evt.screenX; pos4 = evt.screenY;
} else if (evt.clientX || evt.clientY) {
pos3 = evt.clientX;
pos4 = evt.clientY;
// console.log('pos3 = ' + pos3 + ' ,pos4 = ' + pos4);
} else {
pos3 = evt.pageX;
pos4 = evt.pageY;
// console.log('pos3 = ' + pos3 + ', pos4 = ' + pos4);
}
ptx=eval(pos3 * 3.0 / 4.0);
pty=eval(288 - eval(pos4 * 3.0 / 4.0));
if (lastoh.indexOf('##') != -1) {
console.log('8:' + lastoh.split('##')[1]);
ptfromx=eval('' + lastoh.split('##')[1].split(',')[0]);
ptfromy=eval('' + lastoh.split('##')[1].split(',')[1]);
if (lastoh.split('##')[0].split(' id=')[0] == evt.target.outerHTML.split(' id=')[0] && lastoh.split('##')[0] != bigoh) {
if (eval('' + Math.abs(eval(ptx - ptfromx)) + Math.abs(eval(pty - ptfromy))) > 6) {
lastoh=lastoh.replace(' id=', ' ID=').replace('>##', '##');
}
}
}
if (lastoh.split('##')[0].split(' id=')[0] != evt.target.outerHTML.split(' id=')[0]) {
lastoh=evt.target.outerHTML + '##' + (document.getElementById('pointsx') ? document.getElementById('pointsx').innerHTML : '0') + ',' + (document.getElementById('pointsy') ? document.getElementById('pointsy').innerHTML : '0') + ',' + pos3 + ',' + pos4;
clickcnt++;
if (lastoh.split('##')[0].split(' id=')[0] == bigoh.split(' id=')[0]) {
if (eval(clickcnt % 2) == 0) {
if (top.document.URL.indexOf('nofix=') == -1) {
document.getElementById('myh4').innerHTML+=' ' + clickcnt + ': YesMoveTo' + ptx + ',' + pty;
movethis(prevlastoh, pos3, pos4, ptx, pty);
}
lastoh='';
} else {
clickcnt--;
}
} else {
if (lastoh.split('##')[0].split(' id=')[0] == bigoh.split(' id=')[0] && eval(clickcnt % 2) == 1) {
clickcnt--;
} else {
if (eval(clickcnt % 2) == 0) {
if (top.document.URL.indexOf('nofix=') == -1) {
document.getElementById('myh4').innerHTML+=' ' + clickcnt + ': ' + evt.target.outerHTML.substring(1).split(' ')[0].split('>')[0] + '-yesMoveTo' + ptx + ',' + pty;
movethis(prevlastoh, pos3, pos4, ptx, pty);
}
} else {
if (top.document.URL.indexOf('nofix=') == -1) {
document.getElementById('myh4').innerHTML+=' ' + clickcnt + ': ' + onerecord(evt.target.outerHTML,ptx,pty,pos3,pos4).substring(1).split(' ')[0].split('>')[0];
}
if (evt.target.outerHTML.indexOf(' id=') == -1) {
evt.target.id='svgel' + clickcnt;
lastoh+=',svgel' + clickcnt;
lasto=evt.target;
} else {
lastoh+=',' + evt.target.id;
lasto=evt.target;
}
}
}
}
}
}
function plusdata(aig) {
var outig=aig, dlm='\"';
var outgs=aig.split('data:');
if (eval('' + outgs.length) > 1) {
outig=outgs[0];
dlm=outig.slice(-1);
for (var iop=1; iop<outgs.length; iop++) {
//if (outgs[iop].split(dlm)[0] != outgs[iop].split(dlm)[0].replace(/\ /g,'+').replace(/\%20/g,'+')) {
// alert('found');
//}
outig+='data:' + outgs[iop].replace(outgs[iop].split(dlm)[0], outgs[iop].split(dlm)[0].replace(/\ /g,'+').replace(/\%20/g,'+'));
}
}
if (outig != '') {
document.getElementById('ablnewzero').value=outig;
document.getElementById('mybutsave').style.display='inline-block';
}
return outig;
}
function ph() {
var aplace='';
if (1 == 2) {
document.body.addEventListener('mouseover', function(){
if (event.touches) {
//if (event.touches[0].screenX) { pos3 = event.touches[0].screenX; pos4 = event.touches[0].screenY; } else
if (event.touches[0].pageX) {
pos3 = event.touches[0].pageX;
pos4 = event.touches[0].pageY;
} else {
pos3 = event.touches[0].clientX;
pos4 = event.touches[0].clientY;
}
// // console.log('pos3 = ' + pos3 + ',pos4 = ' + pos4);
//} else if (event.screenX) { pos3 = event.screenX; pos4 = event.screenY;
} else if (event.clientX || event.clientY) {
pos3 = event.clientX;
pos4 = event.clientY;
// console.log('pos3 = ' + pos3 + ' ,pos4 = ' + pos4);
} else {
pos3 = event.pageX;
pos4 = event.pageY;
// console.log('pos3 = ' + pos3 + ', pos4 = ' + pos4);
}
if (event.target.outerHTML.indexOf('<body') == 0) {
if (dbt == '') { dbt=document.body.title; }
}
document.getElementById('pos').innerHTML=' ... ' + eval(eval('-' + ifrect.left) + pos3) + ',' + eval(eval('-' + ifrect.top) + pos4);
});
document.getElementById('mytable').addEventListener('mousemove', function(){
if (event.touches) {
//if (event.touches[0].screenX) { pos3 = event.touches[0].screenX; pos4 = event.touches[0].screenY; } else
if (event.touches[0].pageX) {
pos3 = event.touches[0].pageX;
pos4 = event.touches[0].pageY;
} else {
pos3 = event.touches[0].clientX;
pos4 = event.touches[0].clientY;
}
// // console.log('pos3 = ' + pos3 + ',pos4 = ' + pos4);
//} else if (event.screenX) { pos3 = event.screenX; pos4 = event.screenY;
} else if (event.clientX || event.clientY) {
pos3 = event.clientX;
pos4 = event.clientY;
// console.log('pos3 = ' + pos3 + ' ,pos4 = ' + pos4);
} else {
pos3 = event.pageX;
pos4 = event.pageY;
// console.log('pos3 = ' + pos3 + ', pos4 = ' + pos4);
}
if (event.target.outerHTML.indexOf('<body') == 0) {
if (dbt == '') { dbt=document.body.title; }
}
document.getElementById('pos').innerHTML=' ... ' + eval(eval('-' + ifrect.left) + pos3) + ',' + eval(eval('-' + ifrect.top) + pos4);
});
document.body.addEventListener('mousemove', function(){
if (event.touches) {
//if (event.touches[0].screenX) { pos3 = event.touches[0].screenX; pos4 = event.touches[0].screenY; } else
if (event.touches[0].pageX) {
pos3 = event.touches[0].pageX;
pos4 = event.touches[0].pageY;
} else {
pos3 = event.touches[0].clientX;
pos4 = event.touches[0].clientY;
}
// // console.log('pos3 = ' + pos3 + ',pos4 = ' + pos4);
//} else if (event.screenX) { pos3 = event.screenX; pos4 = event.screenY;
} else if (event.clientX || event.clientY) {
pos3 = event.clientX;
pos4 = event.clientY;
// console.log('pos3 = ' + pos3 + ' ,pos4 = ' + pos4);
} else {
pos3 = event.pageX;
pos4 = event.pageY;
// console.log('pos3 = ' + pos3 + ', pos4 = ' + pos4);
}
if (event.target.outerHTML.indexOf('<body') == 0) {
if (dbt == '') { dbt=document.body.title; }
}
document.getElementById('pos').innerHTML=' ... ' + eval(eval('-' + ifrect.left) + pos3) + ',' + eval(eval('-' + ifrect.top) + pos4);
});
document.body.addEventListener('touchmove', function(){
if (event.touches) {
//if (event.touches[0].screenX) { pos3 = event.touches[0].screenX; pos4 = event.touches[0].screenY; } else
if (event.touches[0].pageX) {
pos3 = event.touches[0].pageX;
pos4 = event.touches[0].pageY;
} else {
pos3 = event.touches[0].clientX;
pos4 = event.touches[0].clientY;
}
// // console.log('pos3 = ' + pos3 + ',pos4 = ' + pos4);
//} else if (event.screenX) { pos3 = event.screenX; pos4 = event.screenY;
} else if (event.clientX || event.clientY) {
pos3 = event.clientX;
pos4 = event.clientY;
// console.log('pos3 = ' + pos3 + ' ,pos4 = ' + pos4);
} else {
pos3 = event.pageX;
pos4 = event.pageY;
// console.log('pos3 = ' + pos3 + ', pos4 = ' + pos4);
}
if (event.target.outerHTML.indexOf('<body') == 0) {
if (dbt == '') { dbt=document.body.title; }
document.getElementById('pos').innerHTML=' ... ' + eval(eval('-' + ifrect.left) + pos3) + ',' + eval(eval('-' + ifrect.top) + pos4);;
}
});
}
setTimeout(function(){ location.href='#myh1'; }, 15000);
aimg=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('addimg=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('addimg=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
if (aimg != '') { document.getElementById('addimg').value=plusdata(aimg); }
document.getElementById('myform').action=document.URL.split('?')[0].split('#')[0];
cookieAVal('saved_twopi_vs_circo_', true);
// one
aplace='" . $abl[0] . "'; //'5th Edition;6th Edition,PWB 1.0|6th Edition;LSX,1 BSD,Mini Unix,Wollongong,Interdata|Interdata;Unix/TS 3.0,PWB 2.0,7th Edition';
document.getElementById('one').placeholder=aplace;
// two
aplace='" . $abl[1] . "'; //'7th Edition;8th Edition,32V,V7M,Ultrix-11,Xenix,UniPlus+|V7M;Ultrix-11';
document.getElementById('two').placeholder=aplace;
// three
aplace='" . $abl[2] . "'; //'8th Edition;9th Edition|1 BSD;2 BSD|2 BSD;2.8 BSD|2.8 BSD;Ultrix-11,2.9 BSD|32V;3 BSD|3 BSD;4 BSD|4 BSD;4.1 BSD|4.1 BSD;4.2 BSD|4.2 BSD;4.3 BSD,Ultrix-32|PWB 1.0;PWB 1.2,USG 1.0|PWB 1.2;PWB 2.0|USG 1.0;CB Unix 1,USG 2.0|CB Unix 1;CB Unix 2|CB Unix 2;CB Unix 3|CB Unix 3;Unix/TS++,PDP-11 Sys V|USG 2.0;USG 3.0|USG 3.0;Unix/TS 3.0|PWB 2.0;Unix/TS 3.0|Unix/TS 1.0;Unix/TS 3.0|Unix/TS 3.0;TS 4.0|Unix/TS++;TS 4.0|CB Unix 3;TS 4.0|TS 4.0;System V.0|System V.0;System V.2|System V.2;System V.3';
document.getElementById('three').placeholder=aplace;
var asize=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('fsize=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('fsize=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
if (asize != '') { document.getElementById('fsize').value=asize; } else if ('" . $fsize . "' != '') { document.getElementById('fsize').value='" . $fsize . "'; }
var ashape=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('shape=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('shape=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
if (ashape != '') { document.getElementById('shape').value=ashape; } else if ('" . $shape . "' != '') { document.getElementById('shape').value='" . $shape . "'; }
var acol=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('back=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('back=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
if (acol != '') { if (('' + acol.length) == '6') { document.getElementById('back').value='#' + acol; } else { document.getElementById('back').value='' + acol; } }
var amode=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('mode=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('mode=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
if (amode != '') { document.getElementById('mode').value=amode; }
var atitle=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('title=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('title=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
if (atitle != '') { document.getElementById('ititle').value=atitle; }
var aone=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('one=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('one=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
if (aone != '') { document.getElementById('plus').title='Smaller'; document.getElementById('minus').style.cursor='Pointer'; document.getElementById('minus').style.textDecoration='underline'; document.getElementById('plus').title='Bigger'; document.getElementById('plus').style.cursor='Pointer'; document.getElementById('plus').style.textDecoration='underline'; document.getElementById('plus').innerHTML='+'; while (aone.indexOf(String.fromCharCode(9)) != -1) { aone=aone.replace(String.fromCharCode(9),'+'); } document.getElementById('one').value=aone; document.getElementById('none').value=aone; }
var atwo=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('two=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('two=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
if (atwo != '') { while (atwo.indexOf(String.fromCharCode(9)) != -1) { atwo=atwo.replace(String.fromCharCode(9),'+'); } document.getElementById('two').value=atwo; document.getElementById('ntwo').value=atwo; }
var athree=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('three=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('three=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : '';
if (athree != '') { while (athree.indexOf(String.fromCharCode(9)) != -1) { athree=athree.replace(String.fromCharCode(9),'+'); } document.getElementById('three').value=athree; document.getElementById('nthree').value=athree; }
var afmt=(location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('fmt=')[1] ? (decodeURIComponent((location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'').replace(/^\#/g,'&')).split('fmt=')[1].split('&')[0].split('#')[0].split(encodeURIComponent('#'))[0])) : 'svg';
if (afmt != '' && document.getElementById('one').value != '') { document.getElementById('fmt').value=afmt; }
if (('' + location.hash).indexOf('title=') != -1 && atitle.trim() != '' && aone.trim() != '') {
animbord(); document.getElementById('mysub').style.border='3px dotted green';
setTimeout(function(){ document.getElementById('mysub').click(); }, 2000);
}
}
function phv(tao) {
if (('' + tao.value) == '') {
tao.value=tao.placeholder;
}
}
function deleteAVal(goodname, aparticularvalue) {
if (window.localStorage && goodname.indexOf('saved_twopi_vs_circo_') == 0) {
if (('' + localStorage.getItem(goodname)).replace(/^undefined/g,'').replace(/^null/g,'') != '') {
if (aparticularvalue == '') {
localStorage.removeItem(goodname);
} else {
if (aparticularvalue.replace('HTTP','http').toLowerCase() == ('' + localStorage.getItem(goodname)).toLowerCase()) {
localStorage.removeItem(goodname);
}
}
}
}
}
function setAVal(cName, cVal) {
if (cName.indexOf('saved_twopi_vs_circo_') == 0) {
if (window.localStorage) {
localStorage.setItem(cName, encodeURIComponent(cVal));
cookieAVal('saved_twopi_vs_circo_', true);
return ' ';
}
return '';
}
return '';
}
function gotothis(inu) {
if (inu.trim() != '') {
if (inu.indexOf('HttP') == 0) {
var toe=null;
if (document.getElementById('sells').innerHTML.indexOf(inu + '\">') != -1) {
toe=prompt('Please enter email address or SMS number to share ' + document.getElementById('sells').innerHTML.split(inu + '\">')[1].split('<')[0].replace('Email or SMS ','') + ' with.', '');
} else {
toe=prompt('Please enter email address or SMS number to share with.', '');
}
if (toe == null) { toe=''; }
if (toe.indexOf('@') != -1) {
if (document.getElementById('sells').innerHTML.indexOf(inu + '\">') != -1) {
document.getElementById('myaemailsms').href='mailto:' + toe.trim() + '?subject=' + encodeURIComponent(document.getElementById('sells').innerHTML.split(inu + '\">')[1].split('<')[0].replace('Email or SMS ','')) + '&body=' + encodeURIComponent(inu.replace('HttP','http').split('#')[0].replace(/\-/g,'').replace('doctestoutput','doctest-output'));
document.getElementById('myaemailsms').click();
} else {
document.getElementById('myaemailsms').href='mailto:' + toe.trim() + '?subject=' + encodeURIComponent('Circular Layout') + '&body=' + encodeURIComponent(inu.replace('HttP','http').split('#')[0].replace(/\-/g,'').replace('doctestoutput','doctest-output'));
document.getElementById('myaemailsms').click();
}
} else if (toe.trim() != '') {
if (toe.trim().replace(/0/g,'').replace(/1/g,'').replace(/2/g,'').replace(/3/g,'').replace(/4/g,'').replace(/5/g,'').replace(/6/g,'').replace(/7/g,'').replace(/8/g,'').replace(/9/g,'') == '') {
document.getElementById('myaemailsms').href='sms:' + toe.trim() + '&body=' + encodeURIComponent(inu.replace('HttP','http').split('#')[0].replace(/\-/g,'').replace('doctestoutput','doctest-output'));
document.getElementById('myaemailsms').click();
}
}
document.getElementById('sells').value='';
} else if (inu.indexOf('HTTP') == 0) {
//alert('2:' + inu);
if (inu.indexOf('#saved_twopi_vs_circo_') != -1) {
//alert('22:' + inu.split('#')[eval(-1 + inu.split('#').length)]);
deleteAVal(inu.split('#')[eval(-1 + inu.split('#').length)], encodeURIComponent(inu.replace('#' + inu.split('#')[eval(-1 + inu.split('#').length)], '').replace('HTTP','http')));
//alert('222:' + inu.split('#')[eval(-1 + inu.split('#').length)]);
cookieAVal('saved_twopi_vs_circo_', true);
//alert('2222:' + inu.split('#')[eval(-1 + inu.split('#').length)]);
}
} else {
//woo=window.open(inu, '_blank', 'top=50,left=50,width=800,height=800');
woo=window.open(inu.replace(/\-/g,'').replace('doctestoutput','doctest-output').replace('http:','').replace('https:',''), '_blank', 'top=50,left=50,width=800,height=800');
}
}
}
function rework(what) {
var outw=what;
if (what.toLowerCase().indexOf('doctest output ') != -1 && what.toLowerCase().indexOf('.gv.') != -1) {
outw=what.toLowerCase().split('doctest output ')[1].split('.gv.')[0];
var outwds=outw.split(' ');
outw=outwds[0].substring(0,1).toUpperCase() + (outwds[0] + ' ').substring(1).toLowerCase().trim();
for (var io=1; io<outwds.length; io++) {
outw+=' ' + outwds[io].substring(0,1).toUpperCase() + (outwds[io] + ' ').substring(1).toLowerCase().trim();
}
}
return outw;
}
function cookieAVal(cName, selize) {
var key=null;
if (selize && window.localStorage) {
lssel=' ';
for (var i=0; i<localStorage.length; i++) { // thanks to https://stackoverflow.com/questions/41271092/how-to-loop-through-localstorage-values
key = localStorage.key(i);
if (('' + key).indexOf(cName) == 0) {
if (lssel.trim() == '') {
lssel='<select id=sells onchange=gotothis(this.value);><option value=\"\">Recallable Circular Layout below ...</option></select>';
}
lssel=lssel.replace('</select>', '<option value=\"' + decodeURIComponent(localStorage.getItem('' + key)) + '\">' + rework(('' + key).substring(eval('' + cName.length)).replace(/\_/g,' ').replace(/\-/g,' ')) + '</option>' + '<option value=\"' + decodeURIComponent(localStorage.getItem('' + key).replace('http','HTTP')) + '#saved_twopi_vs_circo_' + ('' + key).substring(eval('' + cName.length)) + '\">Remove ' + rework(('' + key).substring(eval('' + cName.length)).replace(/\_/g,' ').replace(/\-/g,' ')) + '</option>' + '<option value=\"' + decodeURIComponent(localStorage.getItem('' + key).replace('http','HttP')) + '#saved_twopi_vs_circo_' + ('' + key).substring(eval('' + cName.length)) + '\">Email or SMS ' + rework(('' + key).substring(eval('' + cName.length)).replace(/\_/g,' ').replace(/\-/g,' ')) + '</option>' + '</select>');
}
}
if (lssel != '') {
document.getElementById('ssel').innerHTML=lssel.trim();
}
}
if (cName.indexOf('saved_twopi_vs_circo_') == 0) {
if (window.localStorage) {
if (decodeURIComponent(('' + localStorage.getItem(cName)).replace(/^undefined/g,'').replace(/^null/g,'')) != '') {
return decodeURIComponent(localStorage.getItem(cName));
}
if (decodeURIComponent(('' + sessionStorage.getItem(cName)).replace(/^undefined/g,'').replace(/^null/g,'')) != '') {
return decodeURIComponent(sessionStorage.getItem(cName));
}
}
return '';
}
return '';
}
function contentfix(inid) {
document.getElementById('ititle').value=document.getElementById('ititle').value.replace(/\+/g,'-').replace(/\=/g,'-').replace(/\ /g,'-');
document.getElementById('none').value=various(document.getElementById('one').value.replace(/\+/g,String.fromCharCode(9)));
document.getElementById('ntwo').value=various(document.getElementById('two').value.replace(/\+/g,String.fromCharCode(9)));
document.getElementById('nthree').value=various(document.getElementById('three').value.replace(/\+/g,String.fromCharCode(9)));
//alert('2:' + document.getElementById('none').value);
document.getElementById('mysub').style.border='3px dotted green';
return inid;
}
function various(indi) {
var outdi=indi;
return outdi;
}
function svghost(svgheo, imgc) {
if (9 == 8) {
if (gzero) {
gzero.innerHTML+=\"<image x='0' y='0' href='/camel.png'></image>\";
} else {
svgheo.innerHTML+=\"<image x='0' y='0' href='/camel.png'></image>\";
}
}
}
function psvgit() {
svgit(lastsvgeo, lastimgc);
}
function hsvtorgb(hsbh, hsbs, hsbb) { // thanks to https://stackoverflow.com/questions/17242144/javascript-convert-hsb-hsv-color-to-rgb-accurately
var rgb = { };
var h = Math.round(hsbh * 255);
var s = Math.round(hsb.s * 255 / 100);
var v = Math.round(hsb.b * 255 / 100);
if (s == 0) {
rgb.r = rgb.g = rgb.b = v;
} else {
var t1 = v;
var t2 = (255 - s) * v / 255;
var t3 = (t1 - t2) * (h % 60) / 60;
if (h == 360) h = 0;
if (h < 60) { rgb.r = t1; rgb.b = t2; rgb.g = t2 + t3 }
else if (h < 120) { rgb.g = t1; rgb.b = t2; rgb.r = t1 - t3 }
else if (h < 180) { rgb.g = t1; rgb.r = t2; rgb.b = t2 + t3 }
else if (h < 240) { rgb.b = t1; rgb.r = t2; rgb.g = t1 - t3 }
else if (h < 300) { rgb.b = t1; rgb.g = t2; rgb.r = t2 + t3 }
else if (h < 360) { rgb.r = t1; rgb.g = t2; rgb.b = t1 - t3 }
else { rgb.r = 0; rgb.g = 0; rgb.b = 0 }
}
return 'rgb(' + Math.round(rgb.r) + ',' + Math.round(rgb.g) + ',' + Math.round(rgb.b) + ')';
}
function animbord() {
var bcolsare=['green','#F0F8FF','#F0FFFF','#F0F0E0','#F0FFF0','#FFFFF0','#FFF0E0','#FFFFE0','#F0FFF0','#FFFFFF','#F0F0F0','#F0F7FF','#FFF8F0','#FFF0F0','#E0FFFF','#FFFFE0'];
document.getElementById('mysub').style.border='3px dotted ' + bcolsare[lastj];
lastj++;
if (lastj >= eval('' + bcolsare.length)) { lastj=0; }
setTimeout(animbord, 200);
}
function svgit(svgeo, imgc) {
var pres='';
lastsvgeo=svgeo;
lastimgc=imgc;
if (('' + svgeo.outerHTML).indexOf('<text') == 0) {
if (((' ' + svgeo.innerHTML.toHtmlEntities()).split('&')[0].split('(')[0].split('<')[0]).replace('%20',' ').replace('+',' ').indexOf(' ') != -1 && lasturl != '//thatsthem.com/name/' + encodeURIComponent(svgeo.innerHTML.toHtmlEntities().split('&')[0].split('(')[0].split('<')[0])) {
lasturl='//thatsthem.com/name/' + encodeURIComponent(svgeo.innerHTML.toHtmlEntities().split('&')[0].split('(')[0].split('<')[0])
window.open('//www.google.com/search?sca_esv=8957a51bd870705f&sxsrf=ADLYWIL9Z95Y2XILCVHy1Ep_vA8UA0HVLw:1728014294038&q=' + encodeURIComponent(svgeo.innerHTML) + '&udm=2&fbs=AEQNm0CrHVBV9axs7YmgJiq-TjYcvrKLYvLdNLLD2b8MCfaxte6rE3yH_shvJRqV-Iqr8JJvO9luGxMyf8tABHRE_ER5WVi_ouuYD0ZGCgonp8RpBmOUpTB-X6dVFbJc8KMdvjlHxs0_OJiYCY4-Y60oHTMiC_1a9mkGkMIYHO4XqP68ipa4P5rJaQCtA4WPne6f0aAKhdyAMTPbTsWJEdFYpNvI5RzOgw&sa=X&ved=2ahUKEwjCwabx6vOIAxWJ7DQHHQIOJBoQtKgLegQIDRAB&biw=1433&bih=739&dpr=2', '_blank', 'top=100,left=' + eval(-600 + screen.width) + ',width=600,height=600');
window.focus();
uselast=true;
setTimeout(psvgit, 2000);
return '';
}
lasttext=svgeo;
if (lastiurl.indexOf(\"<image x='\" + svgeo.getAttribute('x') + \"' y='\" + svgeo.getAttribute('y')) == -1 && (imgc == 'ask' || lasturl == '//thatsthem.com/name/' + encodeURIComponent(svgeo.innerHTML.toHtmlEntities().split('&')[0].split('(')[0].split('<')[0]))) {
if (('' + svgeo.getAttribute('width')).indexOf('null') != -1) {
lastiurl=\"<image x='\" + eval(-20 + eval('' + svgeo.getAttribute('x'))) + \"' y='\" + eval(-20 + eval('' + svgeo.getAttribute('y'))) + \"' width='45' height='45' opacity='\" + zerodotsix + \"' href=''></image>\";
} else {
lastiurl=\"<image x='\" + svgeo.getAttribute('x') + \"' y='\" + svgeo.getAttribute('y') + \"' opacity='\" + zerodotsix + \"' width='\" + svgeo.getAttribute('width') + \"' height='\" + svgeo.getAttribute('height') + \"' href=''></image>\";
}
window.focus();
pres=null;
try {
if (lastp.indexOf('Regarding ' + svgeo.innerHTML + ' ') == -1) {
if (bconto) { document.getElementById('hidecol').value=szero.innerHTML.split('>' + svgeo.innerHTML + '</title>')[1].split(' fill=\"')[1].split('\"')[0]; bconto.setlhifto(szero.innerHTML.split(svgeo.innerHTML)[1].split(' fill=\"')[1].split('\"')[0]); }
//pres=prompt('Regarding ' + svgeo.innerHTML + ' please see the whole node ' + svgeo.outerHTML + ' ... ' + szero.outerHTML.split('>' + svgeo.innerHTML + '</text>')[1].substring(0,200) + '', '');
pres='';
}
} catch(exc) {
console.log('error');
}
if (pres == null) { console.log('err'); pres=''; if (uselast) { setTimeout(psvgit, 2000); } } else { uselast=false; lastp='Regarding ' + svgeo.innerHTML + ' please enter an optional image URL'; }
if (pres != '') {
if (pres.indexOf('#') == -1) { zerodotsix='0.6'; } else if (pres.indexOf('#') != -1) { zerodotsix=pres.split('#')[1]; pres=pres.split('#')[0].trim(); if ((zerodotsix + 'z').substring(0,1) < '0' || (zerodotsix + 'z').substring(0,1) > '9') { zerodotsix='0.6'; } }
if (pres != '') {
uselast=false;
lastp='Regarding ' + svgeo.innerHTML + ' please see the whole node ' + svgeo.outerHTML + ''
lastiurl=lastiurl.replace(\" href=''\", \" href='\" + pres + \"'\");
if (gzero) {
//alert(\"<image x='0' y='0' width='45' height='45' href=\" + lastiurl.split('href=')[1]);
//gzero.innerHTML+=\"<image x='0' y='0' width='45' height='45' href=\" + lastiurl.split('href=')[1]; //.replace(/\-/g,'');
//if (document.getElementById('addimg').value == '') {
// document.getElementById('addimg').value=' gzero.innerHTML+=\"\"; ';
//}
document.getElementById('addimg').value+=lastiurl;
gzero.innerHTML+=lastiurl;
}
}
}
}
if (lasturl != '//thatsthem.com/name/' + encodeURIComponent(svgeo.innerHTML.toHtmlEntities().split('&')[0].split('(')[0].split('<')[0])) {
lasturl='//thatsthem.com/name/' + encodeURIComponent(svgeo.innerHTML.toHtmlEntities().split('&')[0].split('(')[0].split('<')[0])
if (1 == 5) { setTimeout(function(){ window.open(lasturl, '_blank', 'top=100,left=' + eval(-600 + screen.width) + ',width=600,height=600'); }, 3000); }
//svgeo.innerHTML+='</text><text>+';
}
}
if (1 == 2) {
svgeo.innerHTML+='+';
alert('' + svgeo.outerHTML);
}
}
function emailit(inais) {
event.stopPropagation();
var em=null;
window.focus();
em=prompt('Please enter email address to send output ' + document.getElementById('fmt').value + ' URL link to.', '');
if (em == null) { em=''; }
if (em.indexOf('@') != -1) {
document.getElementById('ititle').value=document.getElementById('ititle').value.replace(/\+/g,'-').replace(/\=/g,'-').replace(/\ /g,'-');
document.getElementById('none').value=various(document.getElementById('one').value.replace(/\+/g,String.fromCharCode(9)));
document.getElementById('ntwo').value=various(document.getElementById('two').value.replace(/\+/g,String.fromCharCode(9)));
document.getElementById('nthree').value=various(document.getElementById('three').value.replace(/\+/g,String.fromCharCode(9)));
//alert('2:' + document.getElementById('addimg').value);
em+='?subject=' + document.getElementById('newablzero').value + '&body=' + encodeURIComponent( (document.URL.split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 19897865) + '#title=' + encodeURIComponent(document.getElementById('ititle').value) + '#back=' + encodeURIComponent(document.getElementById('back').value.replace('#','')) + '#fsize=' + encodeURIComponent(document.getElementById('fsize').value) + '#shape=' + encodeURIComponent(document.getElementById('shape').value) + '#mode=' + encodeURIComponent(document.getElementById('mode').value) + '#fmt=' + encodeURIComponent(document.getElementById('fmt').value) + '#one=' + encodeURIComponent(document.getElementById('none').value) + '#two=' + encodeURIComponent(document.getElementById('ntwo').value) + '#three=' + encodeURIComponent(document.getElementById('nthree').value) + '#addimg=' + encodeURIComponent(document.getElementById('addimg').value)).replace('#fmt=svg#one=#','#fmt=pdf#one=#') );
document.getElementById('dimap').innerHTML='<a style=display:none; id=theaemail target=_blank href=\"mailto:' + em + '\">Email</a>';
document.getElementById('theaemail').click();
}
return false;
}
function naz(intvo) {
var intv=intvo.value;
if (intv.replace(' ','-').replace('_','-').indexOf('-') == -1 && intv.trim() != '') {
intvo.value='a-' + intv;
intv=intvo.value;
}
var retval='My%20%Colour%20Wheel';
var jntv=intv.replace(/\ /g,'-').replace(/\_/g,'-');
var jst=jntv.split('-');
if (jntv.indexOf('iagram') != -1) {
retval=jst[0].substring(0,1).toUpperCase() + jst[0].substring(1).toLowerCase() + ' ';
for (var ij=1; ij<jst.length; ij++) {
retval+=jst[ij].substring(0,1).toUpperCase() + jst[ij].substring(1).toLowerCase() + ' ';
}
retval=encodeURIComponent(retval.trim());
}
document.getElementById('newablzero').value=retval;
if (document.getElementById('addimg').value != '') {
document.getElementById('ablnewzero').value=document.getElementById('addimg').value;
}
document.getElementById('mybutsave').style.display='inline-block';
return retval;
}
function smsit(inais) {
event.stopPropagation();
var em=null;
window.focus();
em=prompt('Please enter SMS number to send output ' + document.getElementById('fmt').value + ' URL link to.', '');
if (em == null) { em=''; }
if (em.trim() != '') {
if (em.trim() != '') {
document.getElementById('ititle').value=document.getElementById('ititle').value.replace(/\+/g,'-').replace(/\=/g,'-').replace(/\ /g,'-');
document.getElementById('none').value=various(document.getElementById('one').value.replace(/\+/g,String.fromCharCode(9)));
document.getElementById('ntwo').value=various(document.getElementById('two').value.replace(/\+/g,String.fromCharCode(9)));
document.getElementById('nthree').value=various(document.getElementById('three').value.replace(/\+/g,String.fromCharCode(9)));
em+='&body=' + encodeURIComponent( (document.URL.split('?')[0].split('#')[0] + '?rand=' + Math.floor(Math.random() * 19897865) + '#title=' + encodeURIComponent(document.getElementById('ititle').value) + '#back=' + encodeURIComponent(document.getElementById('back').value.replace('#','')) + '#fsize=' + encodeURIComponent(document.getElementById('fsize').value) + '#shape=' + encodeURIComponent(document.getElementById('shape').value) + '#mode=' + encodeURIComponent(document.getElementById('mode').value) + '#fmt=' + encodeURIComponent(document.getElementById('fmt').value) + '#one=' + encodeURIComponent(document.getElementById('none').value) + '#two=' + encodeURIComponent(document.getElementById('ntwo').value) + '#three=' + encodeURIComponent(document.getElementById('nthree').value)).replace('#fmt=svg#one=#','#fmt=pdf#one=#') );
document.getElementById('dimap').innerHTML='<a style=display:none; id=theasms target=_blank href=\"sms:' + em + '\">SMS</a>';
if (!document.getElementById('theasms') && document.getElementById('psms')) {
document.getElementById('psms').click();
} else {
document.getElementById('theasms').click();
}
}
}
return false;
}
function sz(inum) {
var uni='px';
if (szero) {
if (('' + szero.getAttribute('width')).indexOf('pt') != -1) { uni='pt'; } else if (('' + szero.getAttribute('width')).indexOf('%') != -1) { uni='%'; }
szero.setAttribute('width', '' + ('' + eval(eval('' + szero.getAttribute('width').split(uni)[0])) * eval('' + inum)) + uni);
szero.setAttribute('height', '' + ('' + eval(eval('' + szero.getAttribute('height').split(uni)[0])) * eval('' + inum)) + uni);
}
}
function domore(hm) {
var rectis=document.getElementById('myif').getBoundingClientRect();
if (('' + hm) == '1') {
document.getElementById('rtd').style.width='20%';
document.getElementById('myif').style.width='' + eval(eval('' + rectis.width) * sz(1.1)) + 'px';
document.getElementById('myif').style.height='' + eval(eval('' + rectis.height) * 1.1) + 'px';
} else if (('' + hm) == '-1') {
document.getElementById('rtd').style.width='50%';
document.getElementById('myif').style.width='' + eval(eval('' + rectis.width) * sz(0.9)) + 'px';
document.getElementById('myif').style.height='' + eval(eval('' + rectis.height) * 0.9) + 'px';
} else if (('' + hm) == '-2') {
document.getElementById('rtd').style.width='50%';
document.getElementById('myif').style.width='' + eval(eval('' + rectis.width) * sz(0.8)) + 'px';
document.getElementById('myif').style.height='' + eval(eval('' + rectis.height) * 0.8) + 'px';
} else {
document.getElementById('rtd').style.width='20%';
document.getElementById('myif').style.width='' + eval(eval('' + rectis.width) * sz(1.2)) + 'px';
document.getElementById('myif').style.height='' + eval(eval('' + rectis.height) * 1.2) + 'px';
}
}
function prechecksvg() {
checksvg(lastwoo);
}
function checki(iois) {
bconto = (iois.contentWindow || iois.contentDocument);
}
function checksvg(iiois) {
var gs=[];
var iois=iiois;
if (('' + iiois.src).toLowerCase().indexOf('.svg') == -1 && lastwoo != null) {
iois=lastwoo;
//alert(1);
console.log('lastWoo');
}
if (iois != null) { // check out window.svgDocument
console.log('lastWoo2');
var aconto = (iois.contentWindow || iois.contentDocument);
svgconto=aconto;
console.log('lastWoo3 ' + aconto);
if (aconto != null) {
//alert(1);
console.log('lastWoo4 ' + aconto);
if (aconto.document) {
console.log('lastWoo5 ' + aconto);
aconto = aconto.document;
gs=aconto.getElementsByTagName('g');
if (eval('' + gs.length) > 0) {
gzero=gs[0];
for (var sd=0; sd<gs.length; sd++) {
if (iois == lastwoo) {
gs[sd].onclick=function(event){ window.opener.svgit(event.target, ''); };
gs[sd].ondblclick=function(event){ window.opener.svgit(event.target, 'ask'); };
} else {
gs[sd].onclick=function(event){ parent.svgit(event.target, ''); };
gs[sd].ondblclick=function(event){ parent.svgit(event.target, 'ask'); };
if (gs[sd].outerHTML.indexOf(' stroke=\"transparent\"') != -1 && gs[sd].outerHTML.indexOf(' stroke=\"transparent\"') < 80) {
bigoh=gs[sd].outerHTML;
} else {
gs[sd].addEventListener('mousedown', function(event){ parent.clickreg(event); });
gs[sd].addEventListener('touchdown', function(event){ parent.clickreg(event); });
}
}
}
}
gs=aconto.getElementsByTagName('polygon');
for (var isd=0; isd<gs.length; isd++) {
if (gs[isd].outerHTML.indexOf(' stroke=\"transparent\"') != -1 && gs[isd].outerHTML.indexOf(' stroke=\"transparent\"') < 80) {
if (bigoh == '') { bigoh=gs[isd].outerHTML; }
}
}
gs=aconto.getElementsByTagName('svg');
if (eval('' + gs.length) > 0) {
szero=gs[0];
szero.addEventListener('mousedown', function(event){ parent.clickreg(event); });
szero.addEventListener('touchdown', function(event){ parent.clickreg(event); });
szero.addEventListener('mousemove', function(){
if (event.touches) {
//if (event.touches[0].screenX) { pos3 = event.touches[0].screenX; pos4 = event.touches[0].screenY; } else
if (event.touches[0].pageX) {
pos3 = event.touches[0].pageX;
pos4 = event.touches[0].pageY;
} else {
pos3 = event.touches[0].clientX;
pos4 = event.touches[0].clientY;
}
// // console.log('pos3 = ' + pos3 + ',pos4 = ' + pos4);
//} else if (event.screenX) { pos3 = event.screenX; pos4 = event.screenY;
} else if (event.clientX || event.clientY) {
pos3 = event.clientX;
pos4 = event.clientY;
// console.log('pos3 = ' + pos3 + ' ,pos4 = ' + pos4);
} else {
pos3 = event.pageX;
pos4 = event.pageY;
// console.log('pos3 = ' + pos3 + ', pos4 = ' + pos4);
}
pos4+=140; pos3-=40;
parent.document.getElementById('pos').innerHTML=' ... ' + pos3 + ',' + pos4 + ' ... inches ... ' + eval(pos3 / 96).toPrecision(5) + ',' + eval(eval(288 - pos4) / 96).toPrecision(5) + ' ... points ... ' + '<span id=pointsx>' + eval(pos3 * 3.0 / 4.0).toPrecision(5) + '</span>,<span id=pointsy>' + eval(288 - eval(pos4 * 3.0 / 4.0)).toPrecision(5) + '</span>';
});
for (var sd=0; sd<gs.length; sd++) {
if (iois == lastwoo) {
gs[sd].onclick=function(event){ window.opener.svghost(event.target, ''); };
} else {
gs[sd].onclick=function(event){ parent.svghost(event.target, ''); };
}
}
}
console.log(gs.length);
console.log(aconto);
}
//alert(11);
if (aconto.body != null) {
iois=iois;
//alert('yay!');
aconto.body.addEventListener('mousemove', function(){
if (event.touches) {
//if (event.touches[0].screenX) { pos3 = event.touches[0].screenX; pos4 = event.touches[0].screenY; } else
if (event.touches[0].pageX) {
pos3 = event.touches[0].pageX;
pos4 = event.touches[0].pageY;
} else {
pos3 = event.touches[0].clientX;
pos4 = event.touches[0].clientY;
}
// // console.log('pos3 = ' + pos3 + ',pos4 = ' + pos4);
//} else if (event.screenX) { pos3 = event.screenX; pos4 = event.screenY;
} else if (event.clientX || event.clientY) {
pos3 = event.clientX;
pos4 = event.clientY;
// console.log('pos3 = ' + pos3 + ' ,pos4 = ' + pos4);
} else {
pos3 = event.pageX;
pos4 = event.pageY;
// console.log('pos3 = ' + pos3 + ', pos4 = ' + pos4);
}
if (event.target.outerHTML.indexOf('<body') == 0) {
if (dbt == '') { dbt=document.body.title; }
}
pos4+=140; pos3-=40;
parent.document.getElementById('pos').innerHTML=' ... ' + pos3 + ',' + pos4 + ' ... inches ... ' + eval(pos3 / 96).toPrecision(5) + ',' + eval(eval(288 - pos4) / 96).toPrecision(5) + ' ... points ... ' + '<span id=pointsx>' + eval(pos3 * 3.0 / 4.0).toPrecision(5) + '</span>,<span id=pointsy>' + eval(288 - eval(pos4 * 3.0 / 4.0)).toPrecision(5) + '</span>';
});
}
}
if (gzero) {
gzero=gzero;
" . (strlen($addimg) == 0 ? $addimg : ' gzero.innerHTML+="' . $addimg . '"') . "
if (aimg != '') { eval(' gzero.innerHTML+=\"' + aimg + '\"'); }
}
}
}
function waschecksvg(iois) {
if (iois != null) {
var aconto = (iois.contentWindow || iois.contentDocument);
if (aconto != null) {
//alert(2);
if (aconto.document) {
aconto = aconto.document;
gs=aconto.getElementsByTagName('g');
if (eval('' + gs.length) > 0) {
gzero=gs[0];
for (var sd=0; sd<gs.length; sd++) {
gs[sd].onclick=function(event){ parent.svgit(event.target, ''); };
gs[sd].ondblclick=function(event){ parent.svgit(event.target, 'ask'); };
}
}
gs=aconto.getElementsByTagName('svg');
if (eval('' + gs.length) > 0) {
for (var sd=0; sd<gs.length; sd++) {
gs[sd].onclick=function(event){ parent.svghost(event.target, ''); };
}
}
console.log(gs.length);
console.log(aconto);
}
//alert(22);
if (aconto.body != null) {
iois=iois;
//alert('Yay!');
}
if (gzero) {
gzero=gzero;
" . (strlen($addimg) == 0 ? $addimg : ' gzero.innerHTML+="' . $addimg . '"') . "
if (aimg != '') { eval(' gzero.innerHTML+=\"' + aimg + '\"'); }
}
}
}
}
</scr" . "ipt>
<style>
#fsize { width: 80px; }
#bltd { text-align:right; vertical-align: bottom; background-color: rgba(255,223,0,0.8); border: 2px dotted purple; border-radius: 28px; }
#ltd { background-color: #90c070; margin: 0 0 0 0; padding: 0 0 0 0; }
body { background-color: #9070c0; }
#myif { background-color: #70c090; margin: 0 0 0 0; padding: 0 0 0 0; }
textarea {
width: 99%;
height: 50px;
}
#one {
height: 220px;
}
#back { display: none; }
td { vertical-align: top; }
</style>
</head>
<body onload=\"ifrect=document.getElementById('myif').getBoundingClientRect();\" title='Click on a GraphViz SVG node, and if the associated circle shape has a name a Google search window will open and associated colour available to draw with on the canvas below. Two discrete clicks on circles and/or text along with an SVG format output can allow for Circular Layout enity editing and adding and rewording and resizing.' onload=ph();>
<h1 id=myh1>Trying out <span title='Actually twopi for this Circular Layout idea'>Dot</span> GraphViz hosted in PHP " . $plus . " Circular Layout <span id=ssel></span> <a id=pemail title=Email class=share onclick=emailit(this); style=text-decoration:none;cursor:pointer;>📧</a> <a id=psms title=SMS class=share onclick=smsit(this); style=text-decoration:none;cursor:pointer;>📟</a></h1>
<h3>RJM Programming " . $minus . " October, 2024 <span id=pos></span></h3>
<h4 id=myh4>Thanks to <a target=_blank title='Dot GraphViz package information' href='//forum.graphviz.org/t/subset-diagrams/1118/4'>https://stackoverflow.com/questions/72531363/how-to-create-a-graph-with-a-circular-layout-in-graphviz</a></h4>
<table id=mytable cellpadding=1 cellspacing=1 style=width:98%;><tr><td id=ltd>
<" . $outel . " onload='checksvg(this);' id=myif style='width:95%;height:500px;' type=application/" . $fmt . " src='/doctest-output" . DIRECTORY_SEPARATOR . $newabl[0] . $gv . $fmt . "?rand=" . rand(13456,6789056) . "'></" . explode(' ',$outel)[0] . ">
<div id=bltd title='Proposed look before size prompt.'></div></td><td title=\"Double click for new window just with the GraphViz graphics showing.\" ondblclick=\"if (szero) { lastwoo=window.open('','_blank','top=200,left=200,width=700,height=600'); lastwoo.document.write(szero.outerHTML); lastwoo.document.title=(document.getElementById('ititle').value != '' ? document.getElementById('ititle').value : document.getElementById('ititle').placeholder); } else { lastwoo=window.open(top.document.URL.split('//')[0].replace('httJUNKps:','').replace('httJUNKp:','') + '//www.rjmprogramming.com.au/doctest-output' + document.getElementById('myif').src.split('doctest-output')[1],'_blank','top=200,left=200,width=700,height=600'); setTimeout(prechecksvg, 20000); } \" id=rtd style=background-color:#f0f0f0;width:50%;>
<form id=myform onsubmit=\"if (document.getElementById('ititle').value.replace('venn-diagram','').trim() == '') { alert('Please enter a different title, then click/tap Draw again.'); return false; } document.body.style.cursor=contentfix('progress'); return true;\" method=POST action=./twopi_vs_circo_example.php>
<p>Title ...</p><br>
<input onblur=naz(this); type=text id=ititle name=title placeholder='" . $newabl[0] . "' value=''></input> <select id=fmt name=fmt><option value=svg>SVG</option><option value=pdf>PDF</option><option value=png>PNG</option><option value=jpg>JPEG</option><option value=html>HTML</option></select> <input type=color name=back id=back title='rgb(174,216,232)' value='" . $bbcol . "'></input> <input type=text id=fsize name=fsize placeholder='12' title='Font size ( and you can add node attributes, optionally eg. 14 margin=0 fontcolor=blue )' value='' onblur=fixfont(this);></input> <select id=shape name=shape onchange=fixshape(this);><option value=''>Record</option>" . $nondefshapes . "</select> <select id=mode name=mode onchange=fixgraph(this);><option value=Digraph>digraph</option><option value=Graph>graph</option></select><br><br>
<p>Circular Layout Names ...</p><br>
<textarea style=display:none; ondblclick=\"event.stopPropagation(); phv(this);\" title='Change whole dot (via neato -n here). Double click makes suggestion the real value' placeholder='' data-contenteditable=true id=none name=one value=''>" . str_replace("\t","+",urldecode($newabl[1])) . "</textarea>
<textarea style=display:none; ondblclick=\"event.stopPropagation(); phv(this);\" title='Old=New comma separated optional list. Double click makes suggestion the real value' placeholder='" . $abl[2] . "' data-contenteditable=true id=ntwo name=two value=''>" . str_replace("\t","+",urldecode($newabl[2])) . "</textarea>
<textarea style=display:none; ondblclick=\"event.stopPropagation(); phv(this);\" title='Old=New comma separated optional list. Double click makes suggestion the real value' placeholder='" . $abl[3] . "' data-contenteditable=true id=nthree name=three value=''>" . str_replace("\t","+",urldecode($newabl[3])) . "</textarea>
<textarea ondblclick=\"event.stopPropagation(); phv(this);\" title='Change whole dot (via neato -n here). Double click makes suggestion the real value' placeholder='' data-name=one id=one data-contenteditable=true value=''>" . str_replace("\t","+",urldecode($newabl[1])) . "</textarea><br>
<textarea ondblclick=\"event.stopPropagation(); phv(this);\" title='Old=New comma separated optional list. Double click makes suggestion the real value' placeholder='" . $abl[2] . "' data-name=two id=two data-contenteditable=true value=''>" . str_replace("\t","+",urldecode($newabl[2])) . "</textarea><br>
<textarea ondblclick=\"event.stopPropagation(); phv(this);\" title='Old=New comma separated optional list. Double click makes suggestion the real value' placeholder='" . $abl[3] . "' data-name=three id=three data-contenteditable=true value=''>" . str_replace("\t","+",urldecode($newabl[3])) . "</textarea><br><br>
<input type=hidden id=addimg name=addimg value=\"" . $addimg . "\"></input>
<input id=mysub type=submit value=Draw style=background-color:pink;></input> <input onload=checki(this); onclick=\"document.getElementById('myformsub').click();\" style=background-color:yellow;display:" . $none . "; id=mybutsave type=button value=Save style=background-color:yellow;></input>
</form>
</td></tr></table>
<details id=detailsuof open><summary>Canvas Drawing With Clicked Colour to Top and Left As Revealed Below ...</summary><iframe style=width:100%;height:800px; id=ifuos name=ifuos src='/HTMLCSS/user_of_signature_signature.htm?fcol=&xc=" . $tw . "'></iframe></details>
<form id=myformsave style=display:none; action=./twopi_vs_circo_example.php method=POST target=myifsave><input type=hidden id=ablnewzero name=newablzero value=\"" . $addimg . "\"></input><input type=hidden id=infile name=infile value='doctest-output" . DIRECTORY_SEPARATOR . $newabl[0] . $gv . $fmt . "'></input><input type=submit id=myformsub style=display:none; value=Submit></input></form>
<a target=_blank id=myaemailsms href='/About_Us.html' style=display:none;>Email/SMS</a><iframe style=display:none; id=myifsave name=myifsave src=/About_Us.html></iframe><div id=dimap></div>
<input type=hidden id=hidecol value=''></input>
</body>
</html>";
}
?>