yujh wrote: ↑April 19th, 2021, 8:10 am
How to make viewers on other websites (html5?)
Meaning, you want to set up LifeViewer to work outside of the context of the forums or LifeWiki?
Here are some sample HTML files that do basically that. You can run those pages offline, at the expense of probably using an older version of LifeViewer. (I haven't bothered to update the checked-in version of lv-plugin.js past Build 521, whereas the current version is something like 597.)
Instead of the line '
<script src="lv-plugin.js"></script>', you could point the browser to some other location, like
Code: Select all
<script src="https://www.conwaylife.com/forums/styles/prosilver/template/lv-plugin.js"></script>
If you do that, then you'll always be working with the latest version of LifeViewer -- as long as conwaylife.com isn't down and you have a working Internet connection.
Otherwise, you just need to follow the exact HTML structure given in the samples, and LifeViewer will see it and use it:
Code: Select all
<div class="viewer">
<a href="" onclick="updateViewer(this); return false;">View Standalone</a><br>
<textarea rows=4 cols=75>
#C put RLE here
#C [[ "with LifeViewer waypoint script commands" ]] if you want them
x = 3, y = 3, rule = B3/S23
3o$o$bo!
</textarea>
<br>
<canvas width="1024" height="512"></canvas>
</div>
Canvas size, textarea height, link text, etc., can be adjusted as needed. LifeViewer is mainly looking for the div with a class of "viewer", and inside that, a textarea containing the RLE, and a canvas.
There's probably something subtle I've forgotten about the "View Standalone" link at the top, but maybe someone else can explain that.