diff options
| author | thomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-03-01 22:33:12 +0000 |
|---|---|---|
| committer | thomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-03-01 22:33:12 +0000 |
| commit | 405270e06f4b94ff59cdd75b1d4cc6d92971de4f (patch) | |
| tree | db06f7e7f8e4e93a57feb7f92c044d937037dc5a /roundcubemail/program/include/rcube_template.php | |
| parent | 48eadaca0ce3d8a8aefe9aa9c2f55c3f64e42db1 (diff) | |
Make it easier to add code to $(document).ready()
git-svn-id: https://svn.roundcube.net/trunk@4588 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcube_template.php')
| -rwxr-xr-x | roundcubemail/program/include/rcube_template.php | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/roundcubemail/program/include/rcube_template.php b/roundcubemail/program/include/rcube_template.php index c4b7a4426..a686ec8ad 100755 --- a/roundcubemail/program/include/rcube_template.php +++ b/roundcubemail/program/include/rcube_template.php @@ -5,7 +5,7 @@ | program/include/rcube_template.php | | | | This file is part of the Roundcube Webmail client | - | Copyright (C) 2006-2010, The Roundcube Dev Team | + | Copyright (C) 2006-2011, The Roundcube Dev Team | | Licensed under the GNU GPL | | | | PURPOSE: | @@ -57,7 +57,6 @@ class rcube_template extends rcube_html_page /** * Constructor * - * @todo Use jQuery's $(document).ready() here. * @todo Replace $this->config with the real rcube_config object */ public function __construct($task, $framed = false) @@ -79,10 +78,9 @@ class rcube_template extends rcube_html_page $javascript = 'var '.JS_OBJECT_NAME.' = new rcube_webmail();'; // don't wait for page onload. Call init at the bottom of the page (delayed) - $javascript_foot = '$(document).ready(function(){ '.JS_OBJECT_NAME.'.init(); });'; + $this->add_script(JS_OBJECT_NAME.'.init();', 'docready'); $this->add_script($javascript, 'head_top'); - $this->add_script($javascript_foot, 'foot'); $this->scripts_path = 'program/js/'; $this->include_script('jquery-1.5.min.js'); $this->include_script('common.js'); @@ -1152,12 +1150,11 @@ class rcube_template extends rcube_html_page if (empty($images) || $this->app->task == 'logout') return; - $this->add_script('$(document).ready(function(){ - var images = ' . json_serialize($images) .'; + $this->add_script('var images = ' . json_serialize($images) .'; for (var i=0; i<images.length; i++) { img = new Image(); img.src = images[i]; - }});', 'foot'); + }', 'docready'); } |
