1 | (function() |
---|
2 | { |
---|
3 | var path = "/jmessenger/"; |
---|
4 | var _xtools = null; |
---|
5 | var zIndex = 9001; |
---|
6 | |
---|
7 | function TrophyIMChatArea() |
---|
8 | { |
---|
9 | var winImChatArea = |
---|
10 | { |
---|
11 | id_window : "window_chat_area", |
---|
12 | width : 490, |
---|
13 | height : 380, |
---|
14 | top : 100, |
---|
15 | left : 400, |
---|
16 | draggable : true, |
---|
17 | visible : "display", |
---|
18 | resizable : true, |
---|
19 | zindex : zIndex++, |
---|
20 | title : "Mensagens - Expresso Messenger", |
---|
21 | closeAction : "remove", |
---|
22 | content : '<div id="trophyimchat"><div id="trophyimchattabs"/></div>' |
---|
23 | }; |
---|
24 | |
---|
25 | _winBuild( winImChatArea ); |
---|
26 | |
---|
27 | //return '<div id="trophyimchat"><div id="trophyimchattabs"/></div>'; |
---|
28 | } |
---|
29 | |
---|
30 | function TrophyIMChatBox() |
---|
31 | { |
---|
32 | var chatBox = '<div>' + |
---|
33 | '<div id="trophyimchattabs"/>' + |
---|
34 | '<div class="trophyimchatbox"/>' + |
---|
35 | '<form name="chat" onsubmit="TrophyIM.sendMessage(this); return(false);">' + |
---|
36 | '<textarea class="trophyimchatinput" rows="3" cols="50"></textarea>' + |
---|
37 | '<input type="button" value="Send" onclick="TrophyIM.sendMessage(this)"/>' + |
---|
38 | '</form>' + |
---|
39 | '</div>'; |
---|
40 | |
---|
41 | return chatBox; |
---|
42 | } |
---|
43 | |
---|
44 | function TrophyIMChatTab() |
---|
45 | { |
---|
46 | var chatTab = '<div class="trophyimchattab" onclick="TrophyIM.tabClick(this);">' + |
---|
47 | '<div class="trophyimchattabjid" />' + |
---|
48 | '<div class="trophyimtabclose" onclick="TrophyIM.tabClose(this);">X</div>' + |
---|
49 | '<div class="trophyimchattabname" />' + |
---|
50 | '</div>'; |
---|
51 | return chatTab; |
---|
52 | } |
---|
53 | |
---|
54 | function TrophyIMLoggingDiv() |
---|
55 | { |
---|
56 | return '<div id="trophyimlog"/>'; |
---|
57 | } |
---|
58 | |
---|
59 | function TrophyIMLoginPage() |
---|
60 | { |
---|
61 | setXTools(); |
---|
62 | |
---|
63 | var winLoginPage = |
---|
64 | { |
---|
65 | id_window : "window_login_page", |
---|
66 | width : 260, |
---|
67 | height : 150, |
---|
68 | top : 100, |
---|
69 | left : 400, |
---|
70 | draggable : true, |
---|
71 | visible : "display", |
---|
72 | resizable : true, |
---|
73 | zindex : zIndex++, |
---|
74 | title : "Login - Expresso Messenger", |
---|
75 | closeAction : "remove", |
---|
76 | content : _xtools.parse(_xtools.xml("login_page"), "loginPage.xsl") |
---|
77 | }; |
---|
78 | |
---|
79 | _winBuild( winLoginPage ); |
---|
80 | } |
---|
81 | |
---|
82 | function TrophyIMRosterDiv() |
---|
83 | { |
---|
84 | setXTools(); |
---|
85 | |
---|
86 | var winRosterDiv = |
---|
87 | { |
---|
88 | id_window : "window_Roster_im", |
---|
89 | width : 250, |
---|
90 | height : 410, |
---|
91 | top : 50, |
---|
92 | left : 50, |
---|
93 | draggable : true, |
---|
94 | visible : "display", |
---|
95 | resizable : true, |
---|
96 | zindex : zIndex++, |
---|
97 | title : "Contatos - Expresso Messenger", |
---|
98 | closeAction : "hidden", |
---|
99 | content : '<div id="trophyimroster" />' + TrophyIMStatusDiv() |
---|
100 | }; |
---|
101 | |
---|
102 | _winBuild( winRosterDiv ); |
---|
103 | |
---|
104 | //return '<div id="trophyimroster" />'; |
---|
105 | } |
---|
106 | |
---|
107 | function TrophyIMRosterGroup() |
---|
108 | { |
---|
109 | return '<div class="trophyimrostergroup"><div class="trophyimrosterlabel"/></div>'; |
---|
110 | } |
---|
111 | |
---|
112 | function TrophyIMRosterItem() |
---|
113 | { |
---|
114 | var rosterItem = '<div class="trophyimrosteritem" onclick="TrophyIM.rosterClick(this)">' + |
---|
115 | '<div class="trophyimrosterjid" />' + |
---|
116 | '<div class="trophyimrostername" />' + |
---|
117 | '</div>'; |
---|
118 | |
---|
119 | return rosterItem; |
---|
120 | } |
---|
121 | |
---|
122 | function TrophyIMStatusDiv() |
---|
123 | { |
---|
124 | var statusDiv = '<div id="trophyimstatus">' + |
---|
125 | '<span>Status:</span>' + |
---|
126 | '<span id="trophyimstatuslist">Select box</span>' + |
---|
127 | '<br/>' + |
---|
128 | '<form>' + |
---|
129 | '<input type="button" value="disconnect" onclick="TrophyIM.logout()"/>' + |
---|
130 | '</form>' + |
---|
131 | '</div>'; |
---|
132 | |
---|
133 | return statusDiv; |
---|
134 | |
---|
135 | } |
---|
136 | |
---|
137 | function HTMLSnippets( pType ) |
---|
138 | { |
---|
139 | return new ( function( ) |
---|
140 | { |
---|
141 | this.chatArea = TrophyIMChatArea; |
---|
142 | |
---|
143 | this.chatBox = TrophyIMChatBox; |
---|
144 | |
---|
145 | this.chatTab = TrophyIMChatTab; |
---|
146 | |
---|
147 | this.loggingDiv = TrophyIMLoggingDiv; |
---|
148 | |
---|
149 | this.loginPage = TrophyIMLoginPage; |
---|
150 | |
---|
151 | this.rosterDiv = TrophyIMRosterDiv; |
---|
152 | |
---|
153 | this.rosterGroup = TrophyIMRosterGroup; |
---|
154 | |
---|
155 | this.rosterItem = TrophyIMRosterItem; |
---|
156 | |
---|
157 | this.statusDiv = TrophyIMStatusDiv; |
---|
158 | } ); |
---|
159 | } |
---|
160 | |
---|
161 | function loadScripts(pFiles) |
---|
162 | { |
---|
163 | //Load JavaScript |
---|
164 | var loadJavaScript = function(pJs) |
---|
165 | { |
---|
166 | var newScript = document.createElement("script"); |
---|
167 | newScript.setAttribute("type", "text/javascript"); |
---|
168 | newScript.setAttribute("src", pJs ); |
---|
169 | |
---|
170 | return newScript; |
---|
171 | }; |
---|
172 | |
---|
173 | //Load CSS |
---|
174 | var loadStyleSheet = function(pCss) |
---|
175 | { |
---|
176 | var newStyle = document.createElement("link"); |
---|
177 | newStyle.setAttribute("rel", "stylesheet"); |
---|
178 | newStyle.setAttribute("type", "text/css"); |
---|
179 | newStyle.setAttribute("href", pCss); |
---|
180 | |
---|
181 | return newStyle; |
---|
182 | }; |
---|
183 | |
---|
184 | for(var i = 0; i < pFiles.length; i++) |
---|
185 | { |
---|
186 | if( pFiles[i].indexOf(".js") > -1 ) |
---|
187 | document.getElementsByTagName("head")[0].appendChild(loadJavaScript(pFiles[i])); |
---|
188 | |
---|
189 | if( pFiles[i].indexOf(".css") > -1 ) |
---|
190 | document.getElementsByTagName("head")[0].appendChild(loadStyleSheet(pFiles[i])); |
---|
191 | } |
---|
192 | } |
---|
193 | |
---|
194 | |
---|
195 | function setXTools() |
---|
196 | { |
---|
197 | if( _xtools == null ) |
---|
198 | _xtools = new xtools(path); |
---|
199 | } |
---|
200 | |
---|
201 | function loadIM() |
---|
202 | { |
---|
203 | |
---|
204 | var files = [ |
---|
205 | 'js/xtools.js', |
---|
206 | 'js/dragdrop.js', |
---|
207 | 'js/makeW.js', |
---|
208 | 'css/trophyim.css', |
---|
209 | 'css/window_azul.css' |
---|
210 | //'css/window_cataratas.css' |
---|
211 | //'css/window_celepar.css' |
---|
212 | //'css/window_comics.css' |
---|
213 | //'css/window_default.css' |
---|
214 | //'css/window_escritorio.css' |
---|
215 | //'css/window_metropole.css' |
---|
216 | //'css/window_rochas.css' |
---|
217 | ]; |
---|
218 | |
---|
219 | loadScripts(files); |
---|
220 | |
---|
221 | } |
---|
222 | |
---|
223 | |
---|
224 | |
---|
225 | loadIM.prototype.HTMLSnippets = new HTMLSnippets; |
---|
226 | window.loadIM = new loadIM; |
---|
227 | |
---|
228 | })(); |
---|