Skip to content
Snippets Groups Projects
Commit 65ca4c9c authored by Lucio Zambon's avatar Lucio Zambon
Browse files

Update panther2d.php

parent b5ea043f
No related branches found
No related tags found
No related merge requests found
<?php <?php
$local = (isset($_REQUEST['cdn']) || $_SERVER['SERVER_NAME']=='mac3d.elettra.eu')? false: true; // true = use only locally installed modules, false = use cdn $local = (isset($_REQUEST['cdn']) || $_SERVER['SERVER_NAME']=='mac3d.elettra.eu')? false: true; // true = use only locally installed modules, false = use cdn
$machine = empty($_REQUEST['machine'])? 'elettra': strtolower($_REQUEST['machine']);
$simulator = false;
if (strpos($machine, 'simulator_')!==false) {$simulator = true; list($trash, $machine) = explode('_', $machine, 2);}
$l = file_get_contents($simulator? 'http://'.$_SERVER["HTTP_HOST"].strtr($_SERVER["PHP_SELF"], array('panther2d.php'=>'')).'simulator.php?lattice&machine='.$machine: $machine.'_lattice.json');
$lattice = json_decode($l, true);
// die(json_encode($lattice));
$modules = '';
if (!empty($lattice['conf']['modules'])) foreach ($lattice['conf']['modules'] as $m) {
$modules .= " <script type='text/javascript' src='./{$m}2d.js'></script>\n";
}
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
...@@ -19,21 +29,29 @@ ...@@ -19,21 +29,29 @@
.blm {display: none;} .blm {display: none;}
.lil-gui.autoPlace {z-index: 1 !important;} .lil-gui.autoPlace {z-index: 1 !important;}
</style> </style>
<div id='pin' style='position:absolute; display:none;'> <!--div id='pin' style='position:absolute; display:none;'></div-->
</div>
<div id='tooltip' style='position:absolute; display:none;'> <div id='tooltip' style='position:absolute; display:none;'>
<div style='width: 490px; background-color: white; padding:5px; border-width: 3px; border-color: blue; border-top-left-radius: 5px; border-top-right-radius: 5px;'><table><tr><td>search in <b>components</b> DB </td><td><span id='compdb'></span></td></tr></table></div> <div style='width: 490px; background-color: white; padding:5px; border-width: 3px; border-color: blue; border-top-left-radius: 5px; border-top-right-radius: 5px;'><table><tr><td>search in <b>components</b> DB </td><td><span id='compdb'></span></td></tr></table></div>
<iframe id='tooltipFrame' style="border:0; position:absolute; background:transparent; " width="500px" height="220px" src=''></iframe> <iframe id='tooltipFrame' style="border:0; position:absolute; background:transparent; " width="500px" height="220px" src=''></iframe>
</div> </div>
<div id='main' onClick="hideTooltip()"> <div id='main' onClick="hideTooltip()">
<?php <?php
$machine = empty($_REQUEST['machine'])? 'elettra': strtolower($_REQUEST['machine']); list($bundle, $trash) = explode('_', $machine, 2);
if ($simulator) $bundle = 'simulator';
file_put_contents('./logs2d'.date('Y').'.txt', date('Y-m-d H:i:s').' '.$_SERVER['REMOTE_ADDR'].'_'.$_SERVER['HTTP_X_FORWARDED_FOR'].' - '.$_SERVER['QUERY_STRING'].PHP_EOL , FILE_APPEND | LOCK_EX); file_put_contents('./logs2d'.date('Y').'.txt', date('Y-m-d H:i:s').' '.$_SERVER['REMOTE_ADDR'].'_'.$_SERVER['HTTP_X_FORWARDED_FOR'].' - '.$_SERVER['QUERY_STRING'].PHP_EOL , FILE_APPEND | LOCK_EX);
$f = file_get_contents("./panther_conf.js"); $f = file_get_contents("./panther_conf.js");
echo "\n<script>\n".strtr($f, array('export '=>''))."</script>\n"; echo "\n<script>\n".strtr($f, array('export '=>''))."</script>\n";
$f = file_get_contents("./components/bundle_{$machine}2d.svg"); $f = file_get_contents("./components/bundle_{$bundle}2d.svg");
if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox/63') !== false) $f = strtr($f, array('fill="url(#Pattern)"'=>'fill="#a6a4c9"')); $replace = array('</svg>'=>' <filter x="0" y="0" width="1" height="1" id="solid">
echo $f; <feFlood flood-color="#333" flood-padding="20" result="bg" />
<feMerge>
<feMergeNode in="bg"/>
<feMergeNode in="SourceGraphic"/>
</feMerge>
</filter>
</svg>');
if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox/63') !== false) $replace['fill="url(#Pattern)"']='fill="#a6a4c9"';
echo strtr($f, $replace);
?> ?>
</div> </div>
<div id='measurement' style='display:none; position:absolute; left:5px; top:5px; max-width:600px; z-index: 10000;'> <div id='measurement' style='display:none; position:absolute; left:5px; top:5px; max-width:600px; z-index: 10000;'>
...@@ -48,5 +66,6 @@ ...@@ -48,5 +66,6 @@
<script type="text/javascript" src="./blm2d.js"></script> <script type="text/javascript" src="./blm2d.js"></script>
<script type="text/javascript" src="./bpm2d.js"></script> <script type="text/javascript" src="./bpm2d.js"></script>
<script type="text/javascript" src="./panther2d.js"></script> <script type="text/javascript" src="./panther2d.js"></script>
<?php echo trim($modules);?>
</body> </body>
</html> </html>
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment