packages feed

salvia-demo-1.0.0: www/index.html

<!doctype html>
<!-- html5! -->
<title>Salvia demo.</title>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta charset=utf-8>
<link rel=stylesheet href=index.css type=text/css>

<header>
  <h1>Demo</h1>
  <p id=banner></p>
</header>

<ul>
  <li>Request counter: <span id=counter>$counter$</span></li>
  <li>
    Web Socket, ping counter: <span id=ping>$ping$</span>
    <a href="javascript:sendPing()"><strong>ping</strong></a>
  </li>
  <li><a href=/index.css>css file</a> (<a href=/index.ccss>CleverCSS source</a>)</li>
  <li><a href=/loginfo>session and login information</a></li>
  <li><a href=/signup.html>signup form</a></li>
  <li><a href=/login.html>login form</a></li>
  <li><a href=/logout>logout</a></li>
  <li><a href=/users.db>user database</a></li>
  <li>unicode urls:<br>
    <a href="/لغة عربية">arabic</a><br>
    <a href="/Ελληνική">greek</a><br>
    <a href="/Русский">russian</a><br>
    <a href="/עִבְרִית">hebrew</a>
  </li>
</ul>

<p>The following examples only works when this demo is run in the root directory of the salvia-demo package.<p>

<ul>
  <li><a href=/code/>source directory</a></li>
  <li><a href=/code/Demo.hs>this demo</a></li>
  <li><a href=/sources>CGI demo</a></li>
  <li>
    <a href=/store>filestore of this demo</a><br>
    <a href=/store/src/Demo.hs?history>history of this demo</a><br>
    <a href=/store/src/Demo.hs?9813f75>first version of this demo</a><br>
  </li>
</ul>

<script>
  if ("$username$") document.getElementById("banner").innerHTML = "Welcome: $username$!";

  var ws, open = false;

  function wsOpen ()
  {
    if (open) return;
    ws = new WebSocket("ws://127.0.0.1:8080/ping");
    ws.onmessage = function (a) { document.getElementById("ping").innerHTML = a.data; };
    ws.onopen    = function (a) { open = true; document.getElementById("ping").innerHTML += " (waiting for initial data)"; };
    ws.onclose   = function (a) { open = false; document.getElementById("ping").innerHTML = " (connection closed)"; };
  }

  wsOpen();
  setInterval(wsOpen, 100);

  function sendPing () { ws.send("ping!"); }
</script>