Changeset 5146 in subversion


Ignore:
Timestamp:
Aug 29, 2011 6:13:07 PM (22 months ago)
Author:
thomasb
Message:

Initialize GUI objects which are added after init

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/js/app.js

    r5145 r5146  
    8787 
    8888    this.buttons[command].push(button_prop); 
     89     
     90    if (this.loaded) 
     91      init_button(command, button_prop); 
    8992  }; 
    9093 
     
    9295  this.gui_object = function(name, id) 
    9396  { 
    94     this.gui_objects[name] = id; 
     97    this.gui_objects[name] = this.loaded ? rcube_find_object(id) : id; 
    9598  }; 
    9699 
     
    49174920  /*********************************************************/ 
    49184921 
     4922  var init_button = function(cmd, prop) 
     4923  { 
     4924    var elm = document.getElementById(prop.id); 
     4925    if (!elm) 
     4926      return; 
     4927 
     4928    var preload = false; 
     4929    if (prop.type == 'image') { 
     4930      elm = elm.parentNode; 
     4931      preload = true; 
     4932    } 
     4933 
     4934    elm._command = cmd; 
     4935    elm._id = prop.id; 
     4936    if (prop.sel) { 
     4937      elm.onmousedown = function(e){ return rcmail.button_sel(this._command, this._id); }; 
     4938      elm.onmouseup = function(e){ return rcmail.button_out(this._command, this._id); }; 
     4939      if (preload) 
     4940        new Image().src = prop.sel; 
     4941    } 
     4942    if (prop.over) { 
     4943      elm.onmouseover = function(e){ return rcmail.button_over(this._command, this._id); }; 
     4944      elm.onmouseout = function(e){ return rcmail.button_out(this._command, this._id); }; 
     4945      if (preload) 
     4946        new Image().src = prop.over; 
     4947    } 
     4948  }; 
     4949 
    49194950  // enable/disable buttons for page shifting 
    49204951  this.set_page_buttons = function() 
     
    49324963 
    49334964      for (var i=0; i< this.buttons[cmd].length; i++) { 
    4934         var prop = this.buttons[cmd][i]; 
    4935         var elm = document.getElementById(prop.id); 
    4936         if (!elm) 
    4937           continue; 
    4938  
    4939         var preload = false; 
    4940         if (prop.type == 'image') { 
    4941           elm = elm.parentNode; 
    4942           preload = true; 
    4943         } 
    4944  
    4945         elm._command = cmd; 
    4946         elm._id = prop.id; 
    4947         if (prop.sel) { 
    4948           elm.onmousedown = function(e){ return rcmail.button_sel(this._command, this._id); }; 
    4949           elm.onmouseup = function(e){ return rcmail.button_out(this._command, this._id); }; 
    4950           if (preload) 
    4951             new Image().src = prop.sel; 
    4952         } 
    4953         if (prop.over) { 
    4954           elm.onmouseover = function(e){ return rcmail.button_over(this._command, this._id); }; 
    4955           elm.onmouseout = function(e){ return rcmail.button_out(this._command, this._id); }; 
    4956           if (preload) 
    4957             new Image().src = prop.over; 
    4958         } 
     4965        init_button(cmd, this.buttons[cmd][i]); 
    49594966      } 
    49604967    } 
     
    55695576 
    55705577    // overwrite task name 
    5571     if (query._action.match(/([a-z]+)\/([a-z-_]+)/)) { 
     5578    if (query._action.match(/([a-z]+)\/([a-z-_.]+)/)) { 
    55725579      query._action = RegExp.$2; 
    55735580      base = base.replace(/\_task=[a-z]+/, '_task='+RegExp.$1); 
Note: See TracChangeset for help on using the changeset viewer.