changeset 92:a4d3ecf188b7

RLG-Web client: replace setTitle() with message(). Remove the title line, and make setTitle() add a message instead. Also remove setTitle() from termemu.js, because shterm.js duplicates the code.
author John "Elwin" Edwards <elwin@sdf.org>
date Tue, 10 Jul 2012 18:39:36 -0700
parents e07f98799120
children 104409bf5f03
files index-rlg.html rlgterm.js termemu.js
diffstat 3 files changed, 4 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/index-rlg.html	Tue Jul 10 16:32:49 2012 -0700
+++ b/index-rlg.html	Tue Jul 10 18:39:36 2012 -0700
@@ -11,7 +11,6 @@
 <body onload="setup()" onkeydown="sendkey(event)">
 <h1>RLG-Web β3</h1>
 <div id ="top">
-  <span id="ttitle"></span>
   <img src="/bell.png" alt="bell" id="bell">
 </div>
 <div id="termwrap">TERM</div>
--- a/rlgterm.js	Tue Jul 10 16:32:49 2012 -0700
+++ b/rlgterm.js	Tue Jul 10 18:39:36 2012 -0700
@@ -385,7 +385,6 @@
 function setup() {
   keyHexCodes.init();
   termemu.init("termwrap", 24, 80);
-  setTitle("Not connected.");
   setmode("login");
   /* Set up the text size. */
   var cssSize = termemu.view.style.fontSize;
@@ -445,7 +444,6 @@
       /* Success */
       session.lcred = reply.k;
       session.lname = reply.u;
-      setTitle("Logged in as " + reply.u);
       debug(0, "Logged in as " + reply.u + " with id " + reply.k);
       message("You are now logged in as " + reply.u + ".");
       setmode("choose");
@@ -623,7 +621,6 @@
       session.id = reply.id;
       session.playing = true;
       termemu.resize(reply.h, reply.w);
-      setTitle("Playing as " + session.lname);
       debug(1, "Playing with id " + session.id);
       message("You are now playing " + game.name + ".");
       setmode("play");
@@ -659,7 +656,6 @@
       termemu.resize(reply.h, reply.w);
       termemu.reset();
       termemu.toAltBuf();
-      setTitle("Watching");
       debug(1, "Watching with id " + session.id);
       var pname = reply.p;
       var gname = games[reply.g].name;
@@ -705,7 +701,6 @@
       message("Welcome " + reply.u + ", you are now registered.");
       session.lcred = reply.k;
       session.lname = reply.u;
-      setTitle("Logged in as " + session.lname);
       debug(1, "Logged in as " + session.lname + " with id " + session.lcred);
       message("You are now logged in as " + reply.u + ".");
       setmode("choose");
@@ -734,7 +729,6 @@
   session.id = null;
   session.playing = false;
   ajaxstate.clear();
-  setTitle("Game over.");
   termemu.toNormBuf();
   nsend = 0;
   nrecv = 0;
@@ -843,6 +837,10 @@
   return;
 }
 
+function setTitle(tstr) {
+  message(tstr);
+}
+
 function textsize(larger) {
   var cssSize = termemu.view.style.fontSize;
   if (!cssSize) {
--- a/termemu.js	Tue Jul 10 16:32:49 2012 -0700
+++ b/termemu.js	Tue Jul 10 18:39:36 2012 -0700
@@ -1162,16 +1162,6 @@
   }
 };
 
-function setTitle(tstr) {
-  var titlespan = document.getElementById("ttitle");
-  var tnode = document.createTextNode(tstr);
-  if (titlespan.childNodes.length == 0)
-    titlespan.appendChild(tnode);
-  else
-    titlespan.replaceChild(tnode, titlespan.childNodes[0]);
-  return;
-}
-
 function dchunk(codes) {
   var dstr = "Chunk: ";
   for (var i = 0; i < codes.length; i++) {