Changeset a4c163f in github


Ignore:
Timestamp:
Apr 15, 2010 9:11:05 AM (3 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
47b9294
Parents:
a446829
Message:
  • removed redundant code + code formatting
File:
1 edited

Legend:

Unmodified
Added
Removed
  • program/js/app.js

    rda8f11c ra4c163f  
    25922592    this.init_address_input_events($("[name='_bcc']")); 
    25932593     
    2594     if (!html_mode) 
     2594    if (!html_mode) { 
     2595      // add signature according to selected identity 
     2596      // if we have HTML editor, signature is added in callback 
     2597      if (input_from.attr('type') == 'select-one' && $("input[name='_draft_saveid']").val() == '') { 
     2598        this.change_identity(input_from[0]); 
     2599      } 
    25952600      this.set_caret_pos(input_message, this.env.top_posting ? 0 : $(input_message).val().length); 
    2596  
    2597     // add signature according to selected identity 
    2598     if (input_from.attr('type') == 'select-one' && $("input[name='_draft_saveid']").val() == '' 
    2599         && !html_mode) {  // if we have HTML editor, signature is added in callback 
    2600       this.change_identity(input_from[0]); 
    2601     } 
    2602     else if (!html_mode)  
    2603       this.set_caret_pos(input_message, this.env.top_posting ? 0 : $(input_message).val().length); 
     2601    } 
    26042602 
    26052603    if (input_to.val() == '') 
     
    26362634 
    26372635    // check sender (if have no identities) 
    2638     if (input_from.attr('type') == 'text' && !rcube_check_email(input_from.val(), true)) 
    2639       { 
     2636    if (input_from.attr('type') == 'text' && !rcube_check_email(input_from.val(), true)) { 
    26402637      alert(this.get_label('nosenderwarning')); 
    26412638      input_from.focus(); 
    26422639      return false; 
    2643       } 
     2640    } 
    26442641 
    26452642    // check for empty recipient 
    26462643    var recipients = input_to.val() ? input_to.val() : (input_cc.val() ? input_cc.val() : input_bcc.val()); 
    2647     if (!rcube_check_email(recipients.replace(/^\s+/, '').replace(/[\s,;]+$/, ''), true)) 
    2648       { 
     2644    if (!rcube_check_email(recipients.replace(/^\s+/, '').replace(/[\s,;]+$/, ''), true)) { 
    26492645      alert(this.get_label('norecipientwarning')); 
    26502646      input_to.focus(); 
    26512647      return false; 
    2652       } 
     2648    } 
    26532649 
    26542650    // check if all files has been uploaded 
     
    27122708 
    27132709      $(this.env.spellcheck.spell_container).css('visibility', vis ? 'visible' : 'hidden'); 
    2714       } 
     2710    } 
    27152711  }; 
    27162712 
    27172713  this.set_spellcheck_state = function(s) 
    2718     { 
     2714  { 
    27192715    this.spellcheck_ready = (s == 'ready' || s == 'no_error_found'); 
    27202716    this.enable_command('spellcheck', this.spellcheck_ready); 
    2721     }; 
     2717  }; 
    27222718 
    27232719  this.set_draft_id = function(id) 
    2724     { 
     2720  { 
    27252721    $("input[name='_draft_saveid']").val(id); 
    2726     }; 
     2722  }; 
    27272723 
    27282724  this.auto_save_start = function() 
    2729     { 
     2725  { 
    27302726    if (this.env.draft_autosave) 
    27312727      this.save_timer = self.setTimeout(function(){ ref.command("savedraft"); }, this.env.draft_autosave * 1000); 
     
    27332729    // Unlock interface now that saving is complete 
    27342730    this.busy = false; 
    2735     }; 
     2731  }; 
    27362732 
    27372733  this.compose_field_hash = function(save) 
    2738     { 
     2734  { 
    27392735    // check input fields 
    27402736    var value_to = $("[name='_to']").val(); 
     
    27672763 
    27682764    return str; 
    2769     }; 
     2765  }; 
    27702766     
    27712767  this.change_identity = function(obj, show_sig) 
     
    28992895 
    29002896  this.show_attachment_form = function(a) 
    2901     { 
     2897  { 
    29022898    if (!this.gui_objects.uploadbox) 
    29032899      return false; 
    29042900 
    29052901    var elm, list; 
    2906     if (elm = this.gui_objects.uploadbox) 
    2907       { 
    2908       if (a && (list = this.gui_objects.attachmentlist)) 
    2909         { 
     2902    if (elm = this.gui_objects.uploadbox) { 
     2903      if (a && (list = this.gui_objects.attachmentlist)) { 
    29102904        var pos = $(list).offset(); 
    29112905        elm.style.top = (pos.top + list.offsetHeight + 10) + 'px'; 
    29122906        elm.style.left = pos.left + 'px'; 
    2913         } 
     2907      } 
    29142908 
    29152909      $(elm).toggle(); 
    2916       } 
     2910    } 
    29172911       
    29182912    // clear upload form 
     
    29242918     
    29252919    return true; 
    2926     }; 
     2920  }; 
    29272921 
    29282922  // upload attachment file 
    29292923  this.upload_file = function(form) 
    2930     { 
     2924  { 
    29312925    if (!form) 
    29322926      return false; 
     
    29352929    var send = false; 
    29362930    for (var n=0; n<form.elements.length; n++) 
    2937       if (form.elements[n].type=='file' && form.elements[n].value) 
    2938         { 
     2931      if (form.elements[n].type=='file' && form.elements[n].value) { 
    29392932        send = true; 
    29402933        break; 
    2941         } 
     2934      } 
    29422935     
    29432936    // create hidden iframe and post upload form 
    2944     if (send) 
    2945       { 
     2937    if (send) { 
    29462938      var ts = new Date().getTime(); 
    29472939      var frame_name = 'rcmupload'+ts; 
     
    29492941      // have to do it this way for IE 
    29502942      // otherwise the form will be posted to a new window 
    2951       if(document.all) 
    2952         { 
     2943      if (document.all) { 
    29532944        var html = '<iframe name="'+frame_name+'" src="program/blank.gif" style="width:0;height:0;visibility:hidden;"></iframe>'; 
    29542945        document.body.insertAdjacentHTML('BeforeEnd',html); 
    2955         } 
    2956       else  // for standards-compilant browsers 
    2957         { 
     2946      } 
     2947      else { // for standards-compilant browsers 
    29582948        var frame = document.createElement('iframe'); 
    29592949        frame.name = frame_name; 
     
    29632953        frame.style.visibility = 'hidden'; 
    29642954        document.body.appendChild(frame); 
    2965         } 
     2955      } 
    29662956 
    29672957      // handle upload errors, parsing iframe content in onload 
     
    30012991        content = '<a title="'+this.get_label('cancel')+'" onclick="return rcmail.cancel_attachment_upload(\''+ts+'\', \''+frame_name+'\');" href="#cancelupload"><img src="'+this.env.cancelicon+'" alt="" /></a>'+content; 
    30022992      this.add2attachment_list(ts, { name:'', html:content, complete:false }); 
    3003       } 
     2993    } 
    30042994     
    30052995    // set reference to the form object 
    30062996    this.gui_objects.attachmentform = form; 
    30072997    return true; 
    3008     }; 
     2998  }; 
    30092999 
    30103000  // add file name to attachment list 
     
    30493039 
    30503040  this.remove_attachment = function(name) 
    3051     { 
     3041  { 
    30523042    if (name && this.env.attachments[name]) 
    30533043      this.http_post('remove-attachment', '_file='+urlencode(name)); 
    30543044 
    30553045    return true; 
    3056     }; 
     3046  }; 
    30573047 
    30583048  this.cancel_attachment_upload = function(name, frame_name) 
    3059     { 
     3049  { 
    30603050    if (!name || !frame_name) 
    30613051      return false; 
     
    30643054    $("iframe[name='"+frame_name+"']").remove(); 
    30653055    return false; 
    3066     }; 
     3056  }; 
    30673057 
    30683058  // send remote request to add a new contact 
    30693059  this.add_contact = function(value) 
    3070     { 
     3060  { 
    30713061    if (value) 
    30723062      this.http_post('addcontact', '_address='+value); 
    30733063     
    30743064    return true; 
    3075     }; 
     3065  }; 
    30763066 
    30773067  // send remote request to search mail or contacts 
    30783068  this.qsearch = function(value) 
    3079     { 
    3080     if (value != '') 
    3081       { 
     3069  { 
     3070    if (value != '') { 
    30823071      var addurl = ''; 
    30833072      if (this.message_list) { 
     
    30903079              head_arr.push(n); 
    30913080            addurl += '&_headers='+head_arr.join(','); 
    3092             } 
    30933081          } 
    3094         } else if (this.contact_list) { 
     3082        } 
     3083      } else if (this.contact_list) { 
    30953084        this.contact_list.clear(true); 
    30963085        this.show_contentframe(false); 
    3097         } 
     3086      } 
    30983087 
    30993088      if (this.gui_objects.search_filter) 
     
    31083097        + (this.env.group ? '&_gid='+urlencode(this.env.group) : '') 
    31093098        + (addurl ? addurl : ''), true); 
    3110       } 
     3099    } 
    31113100    return true; 
    3112     }; 
     3101  }; 
    31133102 
    31143103  // reset quick-search form 
    31153104  this.reset_qsearch = function() 
    3116     { 
     3105  { 
    31173106    if (this.gui_objects.qsearchbox) 
    31183107      this.gui_objects.qsearchbox.value = ''; 
     
    31203109    this.env.search_request = null; 
    31213110    return true; 
    3122     }; 
     3111  }; 
    31233112 
    31243113  this.sent_successfully = function(type, msg) 
    3125     { 
     3114  { 
    31263115    this.list_mailbox(); 
    31273116    this.display_message(msg, type, true); 
    3128     } 
     3117  }; 
    31293118 
    31303119 
Note: See TracChangeset for help on using the changeset viewer.