Changeset 323 for trunk/instant_messenger/js/preferences.js
- Timestamp:
- 06/20/08 15:16:25 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/instant_messenger/js/preferences.js
r318 r323 7 7 var _window = new Windows(_xtools, _im_content); 8 8 var _cookies = new IMCookies; 9 var idTimeout = "";10 9 var Timeout = ""; 11 10 … … 37 36 _win_preferences.bx.style.display = 'none'; 38 37 _win_preferences.wc.style.padding = '5px'; 39 38 40 39 var _params = { 41 40 'lang1':imGetLang('Options'), … … 76 75 var preferences = arguments[0].split(';'); 77 76 preferences.pop(); 78 77 79 78 for(var i in preferences) 80 79 { … … 94 93 else 95 94 { 96 Timeout = ( parseInt(value) > 0 ) ? value : "1"; 95 Timeout = ( parseInt(value) > 0 ) ? value : "1"; 97 96 if( top.document.getElementById(field) ) 98 97 top.document.getElementById(field).value = Timeout; … … 104 103 { 105 104 var preferences = ""; 106 105 107 106 if((preferences = _cookies.get('preferences_im'))) 108 107 _preferences(preferences); … … 114 113 { 115 114 _win_preferences = _window.get('preferences_window'); 116 115 117 116 var preferences = ""; 118 117 var numbers = /^\d+$/; 119 118 120 119 // Offline 121 120 if (top.document.getElementById('ch_offline').checked) … … 129 128 _cookies.set('IM_unavailable', 'hidden'); 130 129 } 131 130 132 131 // TimeOut 133 132 if(numbers.test(top.document.getElementById('time_xa_im').value) && top.document.getElementById('time_xa_im').value != "0") … … 141 140 Timeout = 1; 142 141 } 143 142 144 143 // New Message 145 144 if(top.document.getElementById('rd_nm').checked) … … 150 149 else 151 150 preferences += 'rd_nm:false;'; 152 151 153 152 if(top.document.getElementById('rd_ch').checked) 154 153 { … … 175 174 } 176 175 177 function _setPresence() 178 { 179 var _presence = false; 180 var _pPresence; 181 if ( arguments.length == 0 ) 182 { 183 if ( !(_pPresence = _cookies.get('IM_presence')) ) 184 _pPresence = 'available'; 185 } 186 else 187 _pPresence = arguments[0]; 188 189 _cookies.set('IM_presence', _pPresence); 190 191 switch ( _pPresence ) 192 { 193 case 'away': 194 case 'dnd': 195 case 'xa': 196 _presence = 'show=' + _pPresence; 197 break; 198 case 'available': 199 case 'unavailable': 200 _presence = 'type=' + _pPresence; 201 break; 202 } 203 204 if ( _presence ) 205 { 206 var _img_status = eval('im_' + _pPresence + '.src'); 207 208 var _status = top.document.getElementById('im_status'); 209 if ( _status ) 210 _status.style.backgroundImage = 'url(' + _img_status + ')'; 211 212 var _win_contacts = _window.get('contact_list'); 213 if ( _win_contacts ) 214 _win_contacts.icon(_img_status); 215 216 _conn.go('$this.Ujabber.setPresence', _presence); 217 } 218 } 219 176 var _changed = false; 177 var _id_timeout = ""; 220 178 function _setTimeOut() 221 179 { 222 _ setPresence('xa');223 idTimeout = setTimeout('top.window.im_preferences.timeOut();', parseInt(Timeout) * 60000);180 _changed = true; 181 InstantMessengerPresence('auto'); 224 182 } 225 183 226 184 function _timeOut() 227 185 { 228 if (idTimeout)229 {230 clearTimeout(idTimeout); 231 var _status = '';232 233 if((_status = _cookies.get('IM_presence')) === 'xa')234 _setPresence('available');235 } 236 237 idTimeout = setTimeout('top.window.im_preferences._setTimeOut("xa");', parseInt(Timeout) * 60000);186 if ( _id_timeout ) 187 clearTimeout(_id_timeout); 188 189 if ( _changed ) 190 { 191 _changed = false; 192 InstantMessengerPresence(); 193 } 194 195 _id_timeout = setTimeout(_setTimeOut, parseInt(Timeout) * 60000); 238 196 } 239 197 … … 243 201 _timeOut(); 244 202 } 245 203 246 204 Preferences.prototype._setTimeOut = _setTimeOut; 247 205 Preferences.prototype.timeOut = _timeOut; … … 249 207 Preferences.prototype.getfocus = focus_select; 250 208 top.window.im_preferences = new Preferences; 251 top.window.document.onmousemove = _timeOut;209 _config(top.window.document, 'onmousemove', _timeOut); 252 210 253 211 })();
Note: See TracChangeset
for help on using the changeset viewer.