Sha256: f07b9c11281b9e9de1cbaae06acb0ab2366fe84a8fa1a1835e078ac389fd313f

Contents?: true

Size: 658 Bytes

Versions: 1

Compression:

Stored size: 658 Bytes

Contents

<div id="main" style="height: 250px; overflow: auto;">
  #{listen}
</div>
<form onsubmit="return say();">
  <input type="text" name="message" style="width: 100%" id="talk" />
</form>
<script type="text/javascript">
  function update(){
    $('#main').load("/listen")
  };

  function say(){
    var input = $('input#talk')[0];
    var text = input.value;

    // TODO: escape text, /&|;/ currently breaks it.
    if( text != undefined ){
      $.get("/say", "text="+text, update, "text/plain");
    };

    input.value = '';
    return false;
  };

  $('body').ready(function(){
    // setInterval(update, 1000);
    $('input#talk').focus();
  });
</script>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
clivecrous-ramaze-0.3.9.5 examples/chat/view/chat.xhtml