Aleksander Machniak
2014-06-03 70da8c4dafce895bec92f0f609ca46d25ae06d65
Small code improvements/fixes
1 files modified
56 ■■■■■ changed files
program/js/app.js 56 ●●●●● patch | view | raw | blame | history
program/js/app.js
@@ -3002,7 +3002,7 @@
        this.delete_excessive_thread_rows();
    }
    // ??
    // set of messages to mark as seen
    if (r_uids.length)
      post_data._ruid = this.uids_to_list(r_uids);
@@ -3016,7 +3016,7 @@
  // argument should be a coma-separated list of uids
  this.flag_deleted_as_read = function(uids)
  {
    var icn_src, uid, i, len,
    var uid, i, len,
      rows = this.message_list ? this.message_list.rows : {};
    if (typeof uids == 'string')
@@ -4125,8 +4125,7 @@
    if (this.ksearch_timer)
      clearTimeout(this.ksearch_timer);
    var highlight,
      key = rcube_event.get_keycode(e),
    var key = rcube_event.get_keycode(e),
      mod = rcube_event.get_modifier(e);
    switch (key) {
@@ -4135,9 +4134,9 @@
        if (!this.ksearch_visible())
          return;
        var dir = key==38 ? 1 : 0;
        var dir = key == 38 ? 1 : 0,
        highlight = document.getElementById('rcmksearchSelected');
        if (!highlight)
          highlight = this.ksearch_pane.__ul.firstChild;
@@ -4662,7 +4661,9 @@
  // add/delete member to/from the group
  this.group_member_change = function(what, cid, source, gid)
  {
    what = what == 'add' ? 'add' : 'del';
    if (what != 'add')
      what = 'del';
    var label = this.get_label(what == 'add' ? 'addingmember' : 'removingmember'),
      lock = this.display_message(label, 'loading'),
      post_data = {_cid: cid, _source: source, _gid: gid};
@@ -4699,7 +4700,7 @@
  // copy contact(s) to the specified target (group or directory)
  this.copy_contacts = function(to)
  {
    var n, dest = to.type == 'group' ? to.source : to.id,
    var dest = to.type == 'group' ? to.source : to.id,
      source = this.env.source,
      group = this.env.group ? this.env.group : '',
      cid = this.contact_list.get_selection().join(',');
@@ -4777,6 +4778,7 @@
    var n, a_cids = [],
      label = action == 'delete' ? 'contactdeleting' : 'movingcontact',
      lock = this.display_message(this.get_label(label), 'loading');
    if (this.env.cid)
      a_cids.push(this.env.cid);
    else {
@@ -4814,7 +4816,7 @@
  // update a contact record in the list
  this.update_contact_row = function(cid, cols_arr, newcid, source, data)
  {
    var c, row, list = this.contact_list;
    var list = this.contact_list;
    cid = this.html_identifier(cid);
@@ -4874,7 +4876,7 @@
      return false;
    });
    $('select.addfieldmenu').change(function(e) {
    $('select.addfieldmenu').change(function() {
      ref.insert_edit_field($(this).val(), $(this).attr('rel'), this);
      this.selectedIndex = 0;
    });
@@ -4936,6 +4938,7 @@
  this.remove_group_item = function(prop)
  {
    var key = 'G'+prop.source+prop.id;
    if (this.treelist.remove(key)) {
      this.triggerEvent('group_delete', { source:prop.source, id:prop.id });
      delete this.env.contactfolders[key];
@@ -5053,6 +5056,7 @@
    this.reset_add_input();
    prop.type = 'group';
    var key = 'G'+prop.source+prop.id,
      link = $('<a>').attr('href', '#')
        .attr('rel', prop.source+':'+prop.id)
@@ -5108,9 +5112,11 @@
  this.update_group_commands = function()
  {
    var source = this.env.source != '' ? this.env.address_sources[this.env.source] : null;
    this.enable_command('group-create', (source && source.groups && !source.readonly));
    this.enable_command('group-rename', 'group-delete', (source && source.groups && this.env.group && !source.readonly));
    var source = this.env.source != '' ? this.env.address_sources[this.env.source] : null,
      supported = source && source.groups && !source.readonly;
    this.enable_command('group-create', supported);
    this.enable_command('group-rename', 'group-delete', supported && this.env.group);
  };
  this.init_edit_field = function(col, elem)
@@ -5158,6 +5164,7 @@
          label.html(colprop.label);
        var name_suffix = colprop.limit != 1 ? '[]' : '';
        if (colprop.type == 'text' || colprop.type == 'date') {
          input = $('<input>')
            .addClass('ff_'+col)
@@ -5178,12 +5185,13 @@
          this.init_edit_field(col, input);
        }
        else if (colprop.type == 'composite') {
          var childcol, cp, first, templ, cols = [], suffices = [];
          var i, childcol, cp, first, templ, cols = [], suffices = [];
          // read template for composite field order
          if ((templ = this.env[col+'_template'])) {
            for (var j=0; j < templ.length; j++) {
              cols.push(templ[j][1]);
              suffices.push(templ[j][2]);
            for (i=0; i < templ.length; i++) {
              cols.push(templ[i][1]);
              suffices.push(templ[i][2]);
            }
          }
          else {  // list fields according to appearance in colprop
@@ -5191,7 +5199,7 @@
              cols.push(childcol);
          }
          for (var i=0; i < cols.length; i++) {
          for (i=0; i < cols.length; i++) {
            childcol = cols[i];
            cp = colprop.childs[childcol];
            input = $('<input>')
@@ -5376,7 +5384,7 @@
  this.listsearch = function(id)
  {
    var folder, lock = this.set_busy(true, 'searching');
    var lock = this.set_busy(true, 'searching');
    if (this.contact_list) {
      this.list_contacts_clear();
@@ -5555,7 +5563,7 @@
    this.env.dstfolder = null;
    if (this.env.subscriptionrows[id] && row.length)
    if (row.length && this.env.subscriptionrows[id])
      row.removeClass('droptarget');
    else
      $(this.subscription_list.frame).removeClass('droptarget');
@@ -5623,7 +5631,7 @@
    if (!this.gui_objects.subscriptionlist)
      return false;
    var row, n, i, tmp, tmp_name, rowid, collator,
    var row, n, tmp, tmp_name, rowid, collator,
      folders = [], list = [], slist = [],
      tbody = this.gui_objects.subscriptionlist.tBodies[0],
      refrow = $('tr', tbody).get(1),
@@ -5818,7 +5826,7 @@
    this.subscription_list.remove_row(id.replace(/^rcmrow/, ''));
    $('#'+id).remove();
    delete this.env.subscriptionrows[id];
  }
  };
  this.get_subfolders = function(folder)
  {
@@ -5838,7 +5846,7 @@
    }
    return list;
  }
  };
  this.subscribe = function(folder)
  {
@@ -5862,8 +5870,6 @@
    var id, folders = this.env.subscriptionrows;
    for (id in folders)
      if (folders[id] && folders[id][0] == folder)
        break;
    return id;
  };