~ubuntu-branches/ubuntu/trusty/jwchat/trusty

« back to all changes in this revision

Viewing changes to chat.html.pt_br

  • Committer: Bazaar Package Importer
  • Author(s): Lincoln de Sousa, Lincoln de Sousa, Marcelo Jorge Vieira
  • Date: 2010-09-16 11:42:28 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20100916114228-5s5ne28n1w6wrfbl
Tags: 1.0+dfsg-1
[Lincoln de Sousa]

* Switch to dpkg-source 3.0 (quilt) format
* Migrating package from cdbs to debhelper 7.0.50~
* Changing the rule get-orig-source to generate a dfsg compatible
  package striping swf files from the orig (Closes: #591962)
* Updated Standards-Version to 3.9.1
* Removing po-debconf from the Build-Depends-Indep list.

[Marcelo Jorge Vieira]

* Fixing the default backend
* Fixing Debugger dependency
* Changing information about packaging from old maintainers to
  Debian XMPP Team.
* Removing sound support.
* Setting a port for apache VirtualHost.

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