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

« back to all changes in this revision

Viewing changes to shared.js.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
 
 
2
 
function getArgs(){
3
 
  passedArgs=new Array();
4
 
  search = self.location.href;
5
 
  search = search.split('?');
6
 
  if(search.length>1){
7
 
    argList = search[1];
8
 
    argList = argList.split('&');
9
 
    for(var i=0; i<argList.length; i++){
10
 
      newArg = argList[i];
11
 
      newArg = argList[i].split('=');
12
 
      passedArgs[unescape(newArg[0])] = unescape(newArg[1]);
13
 
    }
14
 
  }
15
 
}
16
 
 
17
 
function cutResource(aJID) { // removes resource from a given jid
18
 
  if (typeof(aJID) == 'undefined' || !aJID)
19
 
    return;
20
 
  var retval = aJID;
21
 
  if (retval.indexOf("/") != -1)
22
 
    retval = retval.substring(0,retval.indexOf("/"));
23
 
  return retval;
24
 
}
25
 
 
26
 
function msgEscape(msg) {
27
 
  if (typeof(msg) == 'undefined' || !msg || msg == '')
28
 
    return;
29
 
 
30
 
  msg = msg.replace(/%/g,"%25"); // must be done first
31
 
 
32
 
  msg = msg.replace(/\n/g,"%0A");
33
 
  msg = msg.replace(/\r/g,"%0D");
34
 
  msg = msg.replace(/ /g,"%20");
35
 
  msg = msg.replace(/\"/g,"%22");
36
 
  msg = msg.replace(/#/g,"%23");
37
 
  msg = msg.replace(/\$/g,"%24");
38
 
  msg = msg.replace(/&/g,"%26");
39
 
  msg = msg.replace(/\(/g,"%28");
40
 
  msg = msg.replace(/\)/g,"%29");
41
 
  msg = msg.replace(/\+/g,"%2B");
42
 
  msg = msg.replace(/,/g,"%2C");
43
 
  msg = msg.replace(/\//g,"%2F");
44
 
  msg = msg.replace(/\:/g,"%3A");
45
 
  msg = msg.replace(/\;/g,"%3B");
46
 
  msg = msg.replace(/</g,"%3C");
47
 
  msg = msg.replace(/=/g,"%3D");
48
 
  msg = msg.replace(/>/g,"%3E");
49
 
  msg = msg.replace(/@/g,"%40");
50
 
 
51
 
  return msg;
52
 
}
53
 
 
54
 
// fucking IE is too stupid for window names
55
 
function makeWindowName(wName) {
56
 
  wName = wName.replace(/@/,"at");
57
 
  wName = wName.replace(/\./g,"dot");
58
 
  wName = wName.replace(/\//g,"slash");
59
 
  wName = wName.replace(/&/g,"amp");
60
 
  wName = wName.replace(/\'/g,"tick");
61
 
  wName = wName.replace(/=/g,"equals");
62
 
  wName = wName.replace(/#/g,"pound");
63
 
  wName = wName.replace(/:/g,"colon");  
64
 
  wName = wName.replace(/%/g,"percent");
65
 
  wName = wName.replace(/-/g,"dash");
66
 
  wName = wName.replace(/ /g,"blank");
67
 
  wName = wName.replace(/\*/g,"asterix");
68
 
  return wName;
69
 
}
70
 
 
71
 
function htmlEnc(str) {
72
 
  if (!str)
73
 
    return '';
74
 
 
75
 
  str = str.replace(/&/g,"&amp;");
76
 
  str = str.replace(/</g,"&lt;");
77
 
  str = str.replace(/>/g,"&gt;");
78
 
  str = str.replace(/\"/g,"&quot;");
79
 
  return str;
80
 
}
81
 
 
82
 
function msgFormat(msg) { // replaces emoticons and urls in a message
83
 
  if (!msg)
84
 
    return null;
85
 
 
86
 
  msg = htmlEnc(msg);
87
 
 
88
 
  if (typeof(emoticons) != 'undefined') {
89
 
    for (var i in emoticons) {
90
 
                        if (!emoticons.hasOwnProperty(i))
91
 
                                continue;
92
 
      var iq = i.replace(/\\/g, '');
93
 
      var emo = new Image();
94
 
      emo.src = emoticonpath+emoticons[i];
95
 
      if (emo.width > 0 && emo.height > 0)
96
 
        msg = msg.replace(eval("/\(\\s\|\^\)"+i+"\(\\s|\$\)/g"),"$1<img src=\""+emo.src+"\" width='"+emo.width+"' height='"+emo.height+"' alt=\""+iq+"\" title=\""+iq+"\">$2");
97
 
      else
98
 
        msg = msg.replace(eval("/\(\\s\|\^\)"+i+"\(\\s|\$\)/g"),"$1<img src=\""+emo.src+"\" alt=\""+iq+"\" title=\""+iq+"\">$2");
99
 
    }
100
 
  }
101
 
        
102
 
  // replace http://<url>
103
 
  msg = msg.replace(/(\s|^)(https?:\/\/\S+)/gi,"$1<a href=\"$2\" target=\"_blank\">$2</a>");
104
 
  
105
 
  // replace ftp://<url>
106
 
  msg = msg.replace(/(\s|^)(ftp:\/\/\S+)/gi,"$1<a href=\"$2\" target=\"_blank\">$2</a>");
107
 
  
108
 
  // replace mail-links
109
 
  msg = msg.replace(/(\s|^)(\w+\@\S+\.\S+)/g,"$1<a href=\"mailto:$2\">$2</a>");
110
 
  
111
 
  // replace *<pattern>*
112
 
  msg = msg.replace(/(\s|^)\*([^\*\r\n]+)\*/g,"$1<b>\$2\</b>");
113
 
  
114
 
  // replace _bla_ 
115
 
  msg = msg.replace(/(\s|^)\_([^\*\r\n]+)\_/g,"$1<u>$2</u>");
116
 
 
117
 
  msg = msg.replace(/\n/g,"<br>");
118
 
 
119
 
  return msg;
120
 
}
121
 
 
122
 
/* isValidJID
123
 
 * checks whether jid is valid
124
 
 */
125
 
var prohibited = ['"',' ','&','\'','/',':','<','>','@']; // invalid chars
126
 
function isValidJID(jid) {
127
 
  var nodeprep = jid.substring(0,jid.lastIndexOf('@')); // node name (string before the @)
128
 
 
129
 
  for (var i=0; i<prohibited.length; i++) {
130
 
    if (nodeprep.indexOf(prohibited[i]) != -1) {
131
 
      alert("JID Invalido\n'"+prohibited[i]+"' nao e permitido no JID.\nEscolha outro!");
132
 
      return false;
133
 
    }
134
 
  }
135
 
  return true;
136
 
}
137
 
 
138
 
/* jab2date
139
 
 * converts from jabber timestamps to javascript date objects
140
 
 */
141
 
function jab2date(ts) {
142
 
  var date = new Date(Date.UTC(ts.substr(0,4),ts.substr(5,2)-1,ts.substr(8,2),ts.substr(11,2),ts.substr(14,2),ts.substr(17,2)));
143
 
  if (ts.substr(ts.length-6,1) != 'Z') { // there's an offset
144
 
    var offset = new Date();
145
 
    offset.setTime(0);
146
 
    offset.setUTCHours(ts.substr(ts.length-5,2));
147
 
    offset.setUTCMinutes(ts.substr(ts.length-2,2));
148
 
    if (ts.substr(ts.length-6,1) == '+')
149
 
      date.setTime(date.getTime() - offset.getTime());
150
 
                else if (ts.substr(ts.length-6,1) == '-')
151
 
                  date.setTime(date.getTime() + offset.getTime());
152
 
  }
153
 
  return date;
154
 
}
155
 
 
156
 
/* hrTime - human readable Time
157
 
 * takes a timestamp in the form of 2004-08-13T12:07:04±02:00 as argument
158
 
 * and converts it to some sort of humane readable format
159
 
 */
160
 
function hrTime(ts) {
161
 
  return jab2date(ts).toLocaleString();
162
 
}
163
 
 
164
 
/* jabberDate
165
 
 * somewhat opposit to hrTime (see above)
166
 
 * expects a javascript Date object as parameter and returns a jabber 
167
 
 * date string conforming to JEP-0082
168
 
 */
169
 
function jabberDate(date) {
170
 
  if (!date.getUTCFullYear)
171
 
    return;
172
 
  
173
 
  var jDate = date.getUTCFullYear() + "-";
174
 
  jDate += (((date.getUTCMonth()+1) < 10)? "0" : "") + (date.getUTCMonth()+1) + "-";
175
 
  jDate += ((date.getUTCDate() < 10)? "0" : "") + date.getUTCDate() + "T";
176
 
  
177
 
  jDate += ((date.getUTCHours()<10)? "0" : "") + date.getUTCHours() + ":";
178
 
  jDate += ((date.getUTCMinutes()<10)? "0" : "") + date.getUTCMinutes() + ":";
179
 
  jDate += ((date.getUTCSeconds()<10)? "0" : "") + date.getUTCSeconds() + "Z";
180
 
  
181
 
  return jDate;
182
 
}