summaryrefslogtreecommitdiff
path: root/roundcubemail/program
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-04-21 08:21:33 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-04-21 08:21:33 +0000
commit2954fdc32bf148218e82d837c00e064c191fb8e5 (patch)
treef79443cb8a8cc0ea1db972f7cb3c77e364aad533 /roundcubemail/program
parent7a91e9596c6448f06782b324447f95c4a032fd04 (diff)
- Add images pre-loading on login page (#1451160)
git-svn-id: https://svn.roundcube.net/trunk@3515 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program')
-rwxr-xr-xroundcubemail/program/include/rcube_template.php25
1 files changed, 25 insertions, 0 deletions
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'),
@@ -1073,6 +1074,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<images.length; i++) {
+ img = new Image();
+ img.src = images[i];
+ }});', 'foot');
+ }
+
+
+ /**
* GUI object 'searchform'
* Returns code for search function
*