[2271] | 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, |
---|
[2290] | 13 | height : 395, |
---|
[2271] | 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 | |
---|
[2290] | 25 | //_winBuild( winImChatArea ); |
---|
[2271] | 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 | |
---|
[2290] | 161 | |
---|
| 162 | function getZindex() |
---|
| 163 | { |
---|
| 164 | return zIndex++; |
---|
| 165 | } |
---|
| 166 | |
---|
| 167 | function parse(pXml, pXsl) |
---|
| 168 | { |
---|
| 169 | return _xtools.parse(_xtools.xml(pXml), pXsl); |
---|
| 170 | } |
---|
| 171 | |
---|
[2271] | 172 | function loadScripts(pFiles) |
---|
| 173 | { |
---|
| 174 | //Load JavaScript |
---|
| 175 | var loadJavaScript = function(pJs) |
---|
| 176 | { |
---|
| 177 | var newScript = document.createElement("script"); |
---|
| 178 | newScript.setAttribute("type", "text/javascript"); |
---|
| 179 | newScript.setAttribute("src", pJs ); |
---|
| 180 | |
---|
| 181 | return newScript; |
---|
| 182 | }; |
---|
| 183 | |
---|
| 184 | //Load CSS |
---|
| 185 | var loadStyleSheet = function(pCss) |
---|
| 186 | { |
---|
| 187 | var newStyle = document.createElement("link"); |
---|
| 188 | newStyle.setAttribute("rel", "stylesheet"); |
---|
| 189 | newStyle.setAttribute("type", "text/css"); |
---|
| 190 | newStyle.setAttribute("href", pCss); |
---|
| 191 | |
---|
| 192 | return newStyle; |
---|
| 193 | }; |
---|
| 194 | |
---|
| 195 | for(var i = 0; i < pFiles.length; i++) |
---|
| 196 | { |
---|
| 197 | if( pFiles[i].indexOf(".js") > -1 ) |
---|
| 198 | document.getElementsByTagName("head")[0].appendChild(loadJavaScript(pFiles[i])); |
---|
| 199 | |
---|
| 200 | if( pFiles[i].indexOf(".css") > -1 ) |
---|
| 201 | document.getElementsByTagName("head")[0].appendChild(loadStyleSheet(pFiles[i])); |
---|
| 202 | } |
---|
| 203 | } |
---|
| 204 | |
---|
| 205 | |
---|
| 206 | function setXTools() |
---|
| 207 | { |
---|
| 208 | if( _xtools == null ) |
---|
| 209 | _xtools = new xtools(path); |
---|
| 210 | } |
---|
| 211 | |
---|
| 212 | function loadIM() |
---|
| 213 | { |
---|
| 214 | |
---|
| 215 | var files = [ |
---|
| 216 | 'js/xtools.js', |
---|
| 217 | 'js/dragdrop.js', |
---|
| 218 | 'js/makeW.js', |
---|
| 219 | 'css/trophyim.css', |
---|
| 220 | 'css/window_azul.css' |
---|
| 221 | //'css/window_cataratas.css' |
---|
| 222 | //'css/window_celepar.css' |
---|
| 223 | //'css/window_comics.css' |
---|
| 224 | //'css/window_default.css' |
---|
| 225 | //'css/window_escritorio.css' |
---|
| 226 | //'css/window_metropole.css' |
---|
| 227 | //'css/window_rochas.css' |
---|
| 228 | ]; |
---|
| 229 | |
---|
| 230 | loadScripts(files); |
---|
| 231 | |
---|
| 232 | } |
---|
| 233 | |
---|
| 234 | |
---|
[2290] | 235 | loadIM.prototype.getZIndex = getZindex; |
---|
| 236 | loadIM.prototype.parse = parse; |
---|
[2271] | 237 | |
---|
[2290] | 238 | loadIM.prototype.HTMLSnippets = new HTMLSnippets; |
---|
| 239 | window.loadIM = new loadIM; |
---|
[2271] | 240 | |
---|
| 241 | })(); |
---|