Changeset 4476 in subversion
- Timestamp:
- Feb 1, 2011 3:04:31 AM (2 years ago)
- File:
-
- 1 edited
-
trunk/roundcubemail/program/js/app.js (modified) (26 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/js/app.js
r4454 r4476 18 18 */ 19 19 20 21 20 function rcube_webmail() 22 21 { … … 64 63 this.set_env = function(p, value) 65 64 { 66 if (p != null && typeof (p)== 'object' && !value)65 if (p != null && typeof p === 'object' && !value) 67 66 for (var n in p) 68 67 this.env[n] = p[n]; … … 429 428 // @deprecated 430 429 for (var i in this.onloads) { 431 if (typeof (this.onloads[i])== 'string')430 if (typeof this.onloads[i] === 'string') 432 431 eval(this.onloads[i]); 433 else if (typeof (this.onloads[i])== 'function')432 else if (typeof this.onloads[i] === 'function') 434 433 this.onloads[i](); 435 434 } … … 469 468 470 469 // process external commands 471 if (typeof this.command_handlers[command] == 'function') {470 if (typeof this.command_handlers[command] === 'function') { 472 471 var ret = this.command_handlers[command](props, obj); 473 return ret !== null? ret : (obj ? false : true);474 } 475 else if (typeof this.command_handlers[command] == 'string') {472 return ret !== undefined ? ret : (obj ? false : true); 473 } 474 else if (typeof this.command_handlers[command] === 'string') { 476 475 var ret = window[this.command_handlers[command]](props, obj); 477 return ret !== null? ret : (obj ? false : true);476 return ret !== undefined ? ret : (obj ? false : true); 478 477 } 479 478 … … 481 480 this.triggerEvent('actionbefore', {props:props, action:command}); 482 481 var event_ret = this.triggerEvent('before'+command, props); 483 if ( typeof event_ret != 'undefined') {482 if (event_ret !== undefined) { 484 483 // abort if one the handlers returned false 485 484 if (event_ret === false) … … 1035 1034 default: 1036 1035 var func = command.replace(/-/g, '_'); 1037 if (this[func] && typeof this[func] == 'function')1036 if (this[func] && typeof this[func] === 'function') 1038 1037 this[func](props); 1039 1038 break; … … 1411 1410 if (this.buttons_sel) { 1412 1411 for (var id in this.buttons_sel) 1413 if (typeof id != 'function')1412 if (typeof id !== 'function') 1414 1413 this.button_out(this.buttons_sel[id], id); 1415 1414 this.buttons_sel = {}; … … 1697 1696 } 1698 1697 else if (message.has_children) { 1699 if ( typeof(message.expanded) == 'undefined'&& (this.env.autoexpand_threads == 1 || (this.env.autoexpand_threads == 2 && message.unread_children))) {1698 if (message.expanded === undefined && (this.env.autoexpand_threads == 1 || (this.env.autoexpand_threads == 2 && message.unread_children))) { 1700 1699 message.expanded = true; 1701 1700 } … … 1785 1784 var update, add_url = ''; 1786 1785 1787 if ( typeof sort_col == 'undefined')1786 if (sort_col === undefined) 1788 1787 sort_col = this.env.sort_col; 1789 1788 if (!sort_order) … … 2381 2380 this.copy_messages = function(mbox) 2382 2381 { 2383 if (mbox && typeof mbox == 'object')2382 if (mbox && typeof mbox === 'object') 2384 2383 mbox = mbox.id; 2385 2384 … … 2410 2409 this.move_messages = function(mbox) 2411 2410 { 2412 if (mbox && typeof mbox == 'object')2411 if (mbox && typeof mbox === 'object') 2413 2412 mbox = mbox.id; 2414 2413 … … 2901 2900 // check if all files has been uploaded 2902 2901 for (var key in this.env.attachments) { 2903 if (typeof this.env.attachments[key] == 'object' && !this.env.attachments[key].complete) {2902 if (typeof this.env.attachments[key] === 'object' && !this.env.attachments[key].complete) { 2904 2903 alert(this.get_label('notuploadedwarning')); 2905 2904 return false; … … 3439 3438 3440 3439 // insert all members of a group 3441 if (typeof this.env.contacts[id] == 'object' && this.env.contacts[id].id) {3440 if (typeof this.env.contacts[id] === 'object' && this.env.contacts[id].id) { 3442 3441 insert += this.env.contacts[id].name + ', '; 3443 3442 this.group2expand = $.extend({}, this.env.contacts[id]); … … 3445 3444 this.http_request('group-expand', '_source='+urlencode(this.env.contacts[id].source)+'&_gid='+urlencode(this.env.contacts[id].id), false); 3446 3445 } 3447 else if (typeof this.env.contacts[id] == 'string')3446 else if (typeof this.env.contacts[id] === 'string') 3448 3447 insert = this.env.contacts[id] + ', '; 3449 3448 … … 3544 3543 // add each result line to list 3545 3544 for (i=0; i < a_results.length; i++) { 3546 text = typeof a_results[i] == 'object' ? a_results[i].name : a_results[i];3545 text = typeof a_results[i] === 'object' ? a_results[i].name : a_results[i]; 3547 3546 li = document.createElement('LI'); 3548 3547 li.innerHTML = text.replace(new RegExp('('+RegExp.escape(s_val)+')', 'ig'), '##$1%%').replace(/</g, '<').replace(/>/g, '>').replace(/##([^%]+)%%/g, '<b>$1</b>'); … … 4496 4495 { 4497 4496 for (var cmd in this.buttons) { 4498 if (typeof cmd != 'string')4497 if (typeof cmd !== 'string') 4499 4498 continue; 4500 4499 … … 4557 4556 } 4558 4557 // set class name according to button state 4559 else if (obj && typeof(button[state])!='undefined') {4558 else if (obj && button[state] !== undefined) { 4560 4559 button.status = state; 4561 4560 obj.className = button[state]; … … 4752 4751 4753 4752 // Hide message by object, don't use for 'loading'! 4754 if (typeof (obj)== 'object') {4753 if (typeof obj === 'object') { 4755 4754 $(obj)[fade?'fadeOut':'hide'](); 4756 4755 msg = $(obj).data('key'); … … 4898 4897 { 4899 4898 if (content && this.gui_objects.quotadisplay) { 4900 if (typeof (content)== 'object' && content.type == 'image')4899 if (typeof content === 'object' && content.type == 'image') 4901 4900 this.percent_indicator(this.gui_objects.quotadisplay, content); 4902 4901 else … … 5126 5125 this.url = function(action, query) 5127 5126 { 5128 var querystring = typeof (query)== 'string' ? '&' + query : '';5129 5130 if (typeof action != 'string')5127 var querystring = typeof query === 'string' ? '&' + query : ''; 5128 5129 if (typeof action !== 'string') 5131 5130 query = action; 5132 else if (!query || typeof (query) != 'object')5131 else if (!query || typeof query !== 'object') 5133 5132 query = {}; 5134 5133 5135 5134 if (action) 5136 5135 query._action = action; 5137 5136 else 5138 5137 query._action = this.env.action; 5139 5138 5140 5139 var base = this.env.comm_path; 5141 5140 … … 5145 5144 base = base.replace(/\_task=[a-z]+/, '_task='+RegExp.$1); 5146 5145 } 5147 5146 5148 5147 // remove undefined values 5149 5148 var param = {}; 5150 5149 for (var k in query) { 5151 if ( typeof(query[k]) != 'undefined'&& query[k] !== null)5150 if (query[k] !== undefined && query[k] !== null) 5152 5151 param[k] = query[k]; 5153 5152 } 5154 5153 5155 5154 return base + '&' + $.param(param) + querystring; 5156 5155 }; … … 5180 5179 var result = this.triggerEvent('request'+action, query); 5181 5180 5182 if ( typeof result != 'undefined') {5181 if (result !== undefined) { 5183 5182 // abort if one the handlers returned false 5184 5183 if (result === false) … … 5204 5203 var url = this.url(action); 5205 5204 5206 if (postdata && typeof (postdata)== 'object') {5205 if (postdata && typeof postdata === 'object') { 5207 5206 postdata._remote = 1; 5208 5207 postdata._unlock = (lock ? lock : 0); … … 5213 5212 // trigger plugin hook 5214 5213 var result = this.triggerEvent('request'+action, postdata); 5215 if ( typeof result != 'undefined') {5214 if (result !== undefined) { 5216 5215 // abort if one the handlers returned false 5217 5216 if (result === false) … … 5247 5246 5248 5247 // we have labels to add 5249 if (typeof response.texts == 'object') {5248 if (typeof response.texts === 'object') { 5250 5249 for (var name in response.texts) 5251 if (typeof response.texts[name] == 'string')5250 if (typeof response.texts[name] === 'string') 5252 5251 this.add_label(name, response.texts[name]); 5253 5252 } … … 5445 5444 this.get_caret_pos = function(obj) 5446 5445 { 5447 if ( typeof(obj.selectionEnd)!='undefined')5446 if (obj.selectionEnd !== undefined) 5448 5447 return obj.selectionEnd; 5449 5448 else if (document.selection && document.selection.createRange) {
Note: See TracChangeset
for help on using the changeset viewer.
