From 2954fdc32bf148218e82d837c00e064c191fb8e5 Mon Sep 17 00:00:00 2001 From: alec Date: Wed, 21 Apr 2010 08:21:33 +0000 Subject: - Add images pre-loading on login page (#1451160) git-svn-id: https://svn.roundcube.net/trunk@3515 208e9e7b-5314-0410-a742-e7e81cd9613c --- roundcubemail/program/include/rcube_template.php | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'roundcubemail/program/include') diff --git a/roundcubemail/program/include/rcube_template.php b/roundcubemail/program/include/rcube_template.php index ad498c9c5..c62238057 100755 --- a/roundcubemail/program/include/rcube_template.php +++ b/roundcubemail/program/include/rcube_template.php @@ -80,6 +80,7 @@ class rcube_template extends rcube_html_page // register common UI objects $this->add_handlers(array( 'loginform' => array($this, 'login_form'), + 'preloader' => array($this, 'preloader'), 'username' => array($this, 'current_username'), 'message' => array($this, 'message_container'), 'charsetselector' => array($this, 'charset_selector'), @@ -1072,6 +1073,30 @@ class rcube_template extends rcube_html_page } + /** + * GUI object 'preloader' + * Loads javascript code for images preloading + * + * @param array Named parameters + * @return void + */ + private function preloader($attrib) + { + $images = preg_split('/[\s\t\n,]+/', $attrib['images'], -1, PREG_SPLIT_NO_EMPTY); + $images = array_map(array($this, 'abs_url'), $images); + + if (empty($images) || $this->app->task == 'logout') + return; + + $this->add_script('$(document).ready(function(){ + var images = ' . json_serialize($images) .'; + for (var i=0; i