HackerTrans
トップ新着トレンドコメント過去質問紹介求人

andipodean

no profile record

投稿

Valentino Braitenberg's Vehicles

braitenberg.world
3 ポイント·投稿者 andipodean·2 年前·1 コメント

コメント

andipodean
·2 年前·議論
Perhaps the most horrible JavaScript I ever wrote did something like this, and has been very useful for over a decade and still going strong.

It's a log file that starts with a header: just a script tag with some JS, followed by a special string (I used a special HTML comment as a boundary indicator). The server then appends its logging to this file in a web hosted directory.

The JS periodically does an XHR of it's own location.href, polling itself. It then splits on the special boundary string, thus collecting the latest log data, parses it to generate pretty/coloured/linked HTML, and updates the current page according (and controls scrolling if required).

This gives you a log file that's continuously being appended to, but can be visited in the browser using any static file serving and automatically updates as it's populated.
andipodean
·2 年前·議論
I built this today for Valentin(o)e's day. I've always loved these little guys since I came across them in an AI lecture. More about them: https://en.wikipedia.org/wiki/Braitenberg_vehicle