diff options
| author | thomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-08-29 22:13:07 +0000 |
|---|---|---|
| committer | thomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-08-29 22:13:07 +0000 |
| commit | 0e75c95acf063e482281e028c6e21b478864017f (patch) | |
| tree | dcc99d847b7f6bee43280e8b1562fe7dcbc00310 | |
| parent | 4e7f17c8b9b38dfaee557003643b7b368e334f88 (diff) | |
Initialize GUI objects which are added after init
git-svn-id: https://svn.roundcube.net/trunk@5146 208e9e7b-5314-0410-a742-e7e81cd9613c
| -rw-r--r-- | roundcubemail/program/js/app.js | 61 |
1 files changed, 34 insertions, 27 deletions
diff --git a/roundcubemail/program/js/app.js b/roundcubemail/program/js/app.js index fbf3233f1..adb7be8c8 100644 --- a/roundcubemail/program/js/app.js +++ b/roundcubemail/program/js/app.js @@ -86,12 +86,15 @@ function rcube_webmail() if (over) button_prop.over = over; this.buttons[command].push(button_prop); + + if (this.loaded) + init_button(command, button_prop); }; // register a specific gui object this.gui_object = function(name, id) { - this.gui_objects[name] = id; + this.gui_objects[name] = this.loaded ? rcube_find_object(id) : id; }; // register a container object @@ -4916,6 +4919,34 @@ function rcube_webmail() /********* GUI functionality *********/ /*********************************************************/ + var init_button = function(cmd, prop) + { + var elm = document.getElementById(prop.id); + if (!elm) + return; + + var preload = false; + if (prop.type == 'image') { + elm = elm.parentNode; + preload = true; + } + + elm._command = cmd; + elm._id = prop.id; + if (prop.sel) { + elm.onmousedown = function(e){ return rcmail.button_sel(this._command, this._id); }; + elm.onmouseup = function(e){ return rcmail.button_out(this._command, this._id); }; + if (preload) + new Image().src = prop.sel; + } + if (prop.over) { + elm.onmouseover = function(e){ return rcmail.button_over(this._command, this._id); }; + elm.onmouseout = function(e){ return rcmail.button_out(this._command, this._id); }; + if (preload) + new Image().src = prop.over; + } + }; + // enable/disable buttons for page shifting this.set_page_buttons = function() { @@ -4931,31 +4962,7 @@ function rcube_webmail() continue; for (var i=0; i< this.buttons[cmd].length; i++) { - var prop = this.buttons[cmd][i]; - var elm = document.getElementById(prop.id); - if (!elm) - continue; - - var preload = false; - if (prop.type == 'image') { - elm = elm.parentNode; - preload = true; - } - - elm._command = cmd; - elm._id = prop.id; - if (prop.sel) { - elm.onmousedown = function(e){ return rcmail.button_sel(this._command, this._id); }; - elm.onmouseup = function(e){ return rcmail.button_out(this._command, this._id); }; - if (preload) - new Image().src = prop.sel; - } - if (prop.over) { - elm.onmouseover = function(e){ return rcmail.button_over(this._command, this._id); }; - elm.onmouseout = function(e){ return rcmail.button_out(this._command, this._id); }; - if (preload) - new Image().src = prop.over; - } + init_button(cmd, this.buttons[cmd][i]); } } }; @@ -5568,7 +5575,7 @@ function rcube_webmail() var base = this.env.comm_path; // overwrite task name - if (query._action.match(/([a-z]+)\/([a-z-_]+)/)) { + if (query._action.match(/([a-z]+)\/([a-z-_.]+)/)) { query._action = RegExp.$2; base = base.replace(/\_task=[a-z]+/, '_task='+RegExp.$1); } |
