~ubuntu-branches/ubuntu/lucid/jwchat/lucid

« back to all changes in this revision

Viewing changes to chat.html.ca_ES

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2008-08-24 15:02:53 UTC
  • mfrom: (3.1.4 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080824150253-h0z39rzjmo4lc1k5
Tags: 1.0beta3-3
* Clean up README.Debian. (Closes: #481320)
* Add brazilian debconf messages translation. (Closes: #481522)
* Add swedish debconf messages translation. (Closes: #494887)
* Add italian debconf messages translation. (Closes: #495780)
* Add russian debconf messages translation. (Closes: #495573)
* Add finnish debconf messages translation. (Closes: #496227)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 
2
<html>
 
3
  <head>
 
4
    <title>JWChat - Chat</title>
 
5
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
 
6
    <script src="shared.js"></script>
 
7
    <script src="browsercheck.js"></script>
 
8
    <script src="emoticons.js"></script>
 
9
    <script src="switchStyle.js"></script>
 
10
    <script src="statusLed.js"></script>
 
11
    <script src="xmlextras.js"></script>
 
12
    <script src="jsjac.js"></script>
 
13
    <script>
 
14
      <!--
 
15
var user;
 
16
var srcW;
 
17
var cFrame;
 
18
 
 
19
var scrollHeight=0;
 
20
function putMsgHTML(msg) {
 
21
  var msgHTML = '';
 
22
  
 
23
  var body = '';
 
24
  var err = false;
 
25
  if (msg.getType() == 'error') {
 
26
    var error = aJSJaCPacket.getNode().getElementsByTagName('error').item(0);
 
27
    if (error && error.getElementsByTagName('text').item(0))
 
28
      body = error.getElementsByTagName('text').item(0).firstChild.nodeValue;
 
29
    err = true;
 
30
  }     else
 
31
    body = msg.getBody();
 
32
 
 
33
  var now;
 
34
  if (msg.jwcTimestamp)
 
35
    now = msg.jwcTimestamp;
 
36
  else
 
37
    now = new Date();
 
38
 
 
39
  var mtime = (now.getHours()<10)? "0" + now.getHours() : now.getHours();
 
40
  mtime += ":";
 
41
  mtime += (now.getMinutes()<10)? "0" + now.getMinutes() : now.getMinutes();
 
42
  mtime += ":";
 
43
  mtime += (now.getSeconds()<10)? "0" + now.getSeconds() : now.getSeconds();
 
44
 
 
45
  if (msg.getTo() == user.jid){ // msg sent by me
 
46
    nick = htmlEnc(srcW.roster.nick);
 
47
    nickcolor = 'blue';
 
48
    dir = 'to';
 
49
  } else {
 
50
    nick = user.name;
 
51
    nickcolor = 'red';
 
52
    dir = 'from';
 
53
  }
 
54
 
 
55
  msgHTML += "<div title=\"@ "+mtime+"\" cDate=\""+now.getTime()+"\" dir=\""+dir+"\" body=\""+htmlEnc(body)+"\"><span class=time>["+mtime+"] </span>";
 
56
  body = msgFormat(body);
 
57
  if (err) {
 
58
    msgHTML += "<span style='color:red;'>&nbsp;";
 
59
  } else if (body.match(/^\/me /)) {
 
60
    body = body.replace(/^\/me /,"<span style=\"color:green;font-weight:bold;\" class=msgnick>*&nbsp;"+nick+"</span> ");
 
61
  } else {
 
62
    msgHTML += "<span style=\"color:"+nickcolor+";\" class=msgnick>&lt;" + nick + "&gt;</span>&nbsp;";
 
63
  }
 
64
  msgHTML += body;
 
65
  if (err)
 
66
    msgHTML += '</span>';
 
67
  msgHTML += "</div>";
 
68
 
 
69
  var auto_scroll = false;
 
70
  if (cFrame.body.scrollTop+cFrame.body.clientHeight >= cFrame.body.scrollHeight) // scrollbar at bottom
 
71
    auto_scroll = true;
 
72
 
 
73
  cFrame.body.innerHTML += msgHTML;
 
74
 
 
75
  if (auto_scroll)
 
76
    chat.scrollTo(0,cFrame.body.scrollHeight);
 
77
}
 
78
 
 
79
function popMsgs() {
 
80
  while (user.chatmsgs.length>0) {
 
81
    var msg;
 
82
    if (is.ie5||is.op) {
 
83
      msg = user.chatmsgs[0];
 
84
      user.chatmsgs = user.chatmsgs.slice(1,user.chatmsgs.length);
 
85
    } else
 
86
      msg = user.chatmsgs.shift();
 
87
 
 
88
    // calc date
 
89
  
 
90
    putMsgHTML(msg);
 
91
  }
 
92
  if (jwcMain.focusWindows)     {
 
93
    window.focus();
 
94
    document.forms.chatform.msgbox.focus(); 
 
95
  }
 
96
  if (user.lastsrc != null && user.messages.length == 0) {
 
97
    var images = srcW.roster.getUserIcons(user.jid);
 
98
    for (var i=0; i<images.length; i++)
 
99
      images[i].src = user.lastsrc;
 
100
    user.lastsrc = null;
 
101
    if (srcW.roster.usersHidden && user.status == 'unavailable') // remove user from roster if not available any more 
 
102
      srcW.roster.print();
 
103
  }
 
104
}
 
105
 
 
106
function openUserInfo() {
 
107
  return jwcMain.openUserInfo(user.jid);
 
108
}
 
109
 
 
110
function openUserHistory() {
 
111
  return jwcMain.openUserHistory(user.jid);
 
112
}
 
113
 
 
114
function updateUserPresence() {
 
115
  //    var user = srcW.roster.getUserByJID(jid);
 
116
  var awaymsg = document.getElementById('awaymsg');
 
117
  document.getElementById('user_name').innerHTML = user.name;
 
118
  if (user.statusMsg) {
 
119
    awaymsg.style.display = '';
 
120
    awaymsg.innerHTML = htmlEnc(user.statusMsg);
 
121
  } else
 
122
    awaymsg.style.display = 'none';
 
123
 
 
124
  var img = document.images['statusLed'];
 
125
  img.src = eval(user.status + "Led").src;
 
126
}
 
127
 
 
128
function submitClicked() {
 
129
  var body = document.forms[0].elements["msgbox"].value;
 
130
  if (body == '') // don't send empty message
 
131
    return false;
 
132
 
 
133
  var aMessage = new JSJaCMessage();
 
134
  aMessage.setType('chat');
 
135
  aMessage.setTo(user.jid);
 
136
  aMessage.setBody(body);
 
137
 
 
138
  jwcMain.con.send(aMessage);
 
139
 
 
140
  // insert into chat window
 
141
  putMsgHTML(aMessage);
 
142
 
 
143
  // add message to our message history
 
144
  jwcMain.addtoHistory(body);
 
145
  document.forms["chatform"].msgbox.value=''; // empty box
 
146
  document.forms["chatform"].msgbox.focus(); // set focus back on input field
 
147
        
 
148
  return false;
 
149
}
 
150
 
 
151
var jwcMain;
 
152
function init() {
 
153
  getArgs();
 
154
  
 
155
  jid = passedArgs['jid'];
 
156
  
 
157
  if (opener.top.roster) {
 
158
    srcW = opener.top;
 
159
    if (srcW.srcW)
 
160
      jwcMain = srcW.srcW;
 
161
    else
 
162
      jwcMain = srcW;
 
163
  } else {
 
164
    alert("error starting chat");
 
165
    window.close();
 
166
  }
 
167
 
 
168
  cDate = new Date();
 
169
 
 
170
  cFrame = chat.document;
 
171
  user = srcW.roster.getUserByJID(jid);
 
172
  document.title = "Chat with "+user.name;
 
173
 
 
174
  document.getElementById('user_name').innerHTML = user.name;
 
175
 
 
176
  if (typeof(srcW.loghost) == 'undefined')
 
177
    document.getElementById('hist_button').style.display = 'none';
 
178
 
 
179
  updateUserPresence();
 
180
 
 
181
  popMsgs();
 
182
  displayTimestamp();
 
183
}
 
184
 
 
185
function displayTimestamp() {
 
186
  var tstyle;
 
187
  if (is.ie) {
 
188
    tstyle = cFrame.styleSheets('timestampstyle');
 
189
    tstyle.disabled = jwcMain.timestamps;
 
190
  } else {
 
191
    tstyle = cFrame.getElementById("timestampstyle");
 
192
    tstyle.sheet.disabled = jwcMain.timestamps;
 
193
  }
 
194
}
 
195
 
 
196
 
 
197
var group_open = new Image();
 
198
group_open.src = 'images/group_open.gif';
 
199
var group_close = new Image();
 
200
group_close.src = 'images/group_close.gif';
 
201
var msgbox_toggled = false;
 
202
function toggle_msgbox(el) {
 
203
  if (msgbox_toggled) {
 
204
    document.getElementById('msgbox').style.height = '1.4em';
 
205
    document.getElementById('chat').style.height = '100%';
 
206
    document.getElementById('submitbutton').style.display = 'none';
 
207
    el.src = group_close.src;
 
208
  } else {
 
209
    document.getElementById('msgbox').style.height = '4.2em';
 
210
    document.getElementById('chat').style.height = '99%';
 
211
    document.getElementById('submitbutton').style.display = '';
 
212
    el.src = group_open.src;
 
213
  }
 
214
  msgbox_toggled = !msgbox_toggled;
 
215
}
 
216
 
 
217
function msgboxKeyPressed(el,e) {
 
218
  var keycode;
 
219
  if (window.event) { e  = window.event; keycode = window.event.keyCode; }
 
220
  else if (e) keycode = e.which;
 
221
  else return true;
 
222
        
 
223
  switch (keycode) {
 
224
  case 13:
 
225
    if (e.shiftKey) {
 
226
      if (!msgbox_toggled) {
 
227
        toggle_msgbox(document.getElementById('toggle_icon'));
 
228
        return false;
 
229
      }
 
230
    } else
 
231
      return submitClicked();
 
232
    break;
 
233
  }
 
234
  return true;
 
235
}
 
236
 
 
237
function msgboxKeyDown(el,e) {
 
238
  var keycode;
 
239
  if (window.event) { e  = window.event; keycode = window.event.keyCode; }
 
240
  else if (e) keycode = e.which;
 
241
  else return true;
 
242
 
 
243
  switch (keycode) {
 
244
  case 38:                              // shift+up
 
245
    if (e.ctrlKey) {
 
246
      el.value = jwcMain.getHistory('up', el.value);
 
247
      el.focus(); el.select();
 
248
    }
 
249
    break;
 
250
  case 40:                              // shift+down 
 
251
    if (e.ctrlKey) {
 
252
      el.value = jwcMain.getHistory('down', el.value);
 
253
      el.focus(); el.select();
 
254
    }
 
255
    break;
 
256
  case 76:
 
257
    if (e.ctrlKey) {   // ctrl+l
 
258
      chat.document.body.innerHTML = '';
 
259
      return false;
 
260
    }
 
261
    break;
 
262
  case 27:
 
263
    window.close();
 
264
    break;
 
265
  }
 
266
  return true;
 
267
}
 
268
 
 
269
function cleanUp() {
 
270
  if (!srcW.enableLog || typeof(srcW.loghost) == 'undefined')
 
271
    return;
 
272
 
 
273
  var nodes = cFrame.body.getElementsByTagName("div");
 
274
  if (nodes.length == 0)
 
275
    return;
 
276
        
 
277
  var aIQ = new JSJaCIQ();
 
278
  aIQ.setType('set');
 
279
  aIQ.setTo(jwcMain.loghost);
 
280
  var aStore = aIQ.getNode().appendChild(aIQ.getDoc().createElement('store'));
 
281
  aStore.setAttribute('xmlns','http://jabber.org/protocol/archive');
 
282
  aStore.setAttribute('with',user.jid);
 
283
  aStore.setAttribute('start',jabberDate(cDate));
 
284
        
 
285
  for (var i=0; i<nodes.length; i++) {
 
286
    var node = nodes.item(i);
 
287
 
 
288
    var aItem = aStore.appendChild(aIQ.getDoc().createElement(node.getAttribute('dir')));
 
289
    aItem.setAttribute('secs',Math.round((node.getAttribute('cDate')-cDate.getTime())/1000));
 
290
    aItem.appendChild(aIQ.getDoc().createElement("body")).appendChild(aIQ.getDoc().createTextNode(node.getAttribute('body')));
 
291
  }
 
292
 
 
293
  jwcMain.Debug.log(aIQ.xml(),2);
 
294
  jwcMain.con.send(aIQ);
 
295
}
 
296
 
 
297
onload = init;
 
298
onunload = cleanUp;
 
299
      //-->
 
300
    </script>
 
301
  </head>
 
302
  <body style="margin:8px;">
 
303
  <table width="100%" height="100%">
 
304
                <tr><td colspan=2>
 
305
                <table border=0 cellspacing=0 cellpadding=0 width="100%">
 
306
                <tr>
 
307
                <td width="100%" valign=top><img src="images/unavailable.gif" name="statusLed" width=16 height=16 border=0 align=left><span id="user_name" class="link" onClick="return openUserInfo();" style="padding:2px;" title="Click to show user's vcard"></span><br clear=all>
 
308
                <span id="awaymsg" class="statusMsg"></span></td>
 
309
                <td align=right valign=top><button id='hist_button' onClick="return openUserHistory();">History</button></td></table>
 
310
                </td></tr>
 
311
    <tr><td width="100%" height="100%" colspan=2><iframe src="chat_iframe.html" id="chat" name="chat" scrolling="auto"></iframe></td></tr>
 
312
                <form name="chatform" style="border:0px;margin:0px;padding:0px;">
 
313
    <tr>
 
314
      <td valign=top><img id="toggle_icon" src="images/group_close.gif" width="14" height="14" onClick="toggle_msgbox(this);"></td>
 
315
      <td width="100%">
 
316
          <textarea id="msgbox" wrap="virtual" style="width:100%;height:1.4em;" onKeyPress="return msgboxKeyPressed(this,event);" onKeyDown="return msgboxKeyDown(this,event);"></textarea>
 
317
      </td>
 
318
    </tr>
 
319
    <tr id="submitbutton" style="display:none;"><td colspan=2 align=right><button onClick="submitClicked(); return false;">Send</button></td></tr>
 
320
          </form>
 
321
  </table>
 
322
  </body>
 
323
</html>