Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
118 lines (114 sloc) 2.85 KB
<html>
<head>
<script type='text/javascript' src='display_synth.js'></script>
<script type='text/javascript'>
function do_it() {
var sp = window.location.href.split('?');
var code = document.getElementById('code0');
if (sp.length > 1) {
code.innerHTML = apgcode_to_synthesis_rle(sp[1]);
} else {
code.innerHTML = "#C Add apgcode after a '?' in URL<br>#C e.g." + window.location.href + "?xs4_33";
}
}
//from forum_fn.js on conwaylife.com/forums
function selectCode(a)
{
// Get ID of code block
var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0];
// Not IE
if (window.getSelection)
{
var s = window.getSelection();
// Safari
if (s.setBaseAndExtent)
{
var l = (e.innerText.length > 1) ? e.innerText.length - 1 : 1;
try {
s.setBaseAndExtent(e, 0, e, l);
}
catch (error) {
var r = document.createRange();
r.selectNodeContents(e);
s.removeAllRanges();
s.addRange(r);
}
}
// Firefox and Opera
else
{
// workaround for bug # 42885
if (window.opera && e.innerHTML.substring(e.innerHTML.length - 4) == '<BR>')
{
e.innerHTML = e.innerHTML + '&nbsp;';
}
var r = document.createRange();
r.selectNodeContents(e);
s.removeAllRanges();
s.addRange(r);
}
}
// Some older browsers
else if (document.getSelection)
{
var s = document.getSelection();
var r = document.createRange();
r.selectNodeContents(e);
s.removeAllRanges();
s.addRange(r);
}
// IE
else if (document.selection)
{
var r = document.body.createTextRange();
r.moveToElementText(e);
r.select();
}
}
</script>
<style type='text/css'><!--
/* Code block */
div.codebox {
padding: 3px;
background-color: #FFFFFF;
border: 1px solid #d8d8d8;
font-size: 1em;
}
div.selall {
text-transform: uppercase;
border-bottom: 1px solid #CCCCCC;
margin-bottom: 3px;
font-size: 0.8em;
font-weight: bold;
display: block;
}
blockquote div.codebox {
margin-left: 0;
}
div.codebox code {
/* Also see tweaks.css */
overflow: auto;
display: block;
height: auto;
max-height: 200px;
white-space: normal;
padding-top: 5px;
font: 0.9em Monaco, "Andale Mono","Courier New", Courier, mono;
line-height: 1.3em;
color: #8b8b8b;
margin: 2px 0;
}
--></style>
</head>
<body onload="do_it()">
<meta name="LifeViewer" content="rle code 120 hide limit">
<script type='text/javascript' src='lv-plugin.js'></script>
<div class="rle">
<div class="codebox">
<div class="selall">Code:
<a href="" onclick="selectCode(this); return false;">Select all</a>
</div>
<div><code id="code0"></code></div></div>
<canvas width="480" height="480" style="margin-left:1px;"></canvas></div>
</body>
</html>