summaryrefslogtreecommitdiff
path: root/program/include/rcube_template.php
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-04-21 08:21:33 +0000
committeralecpl <alec@alec.pl>2010-04-21 08:21:33 +0000
commit8e211adb01bd6145eb250edabff38db449f34d92 (patch)
tree814af34e0983e3b6b572f0bc71b333a26c54ba35 /program/include/rcube_template.php
parentdd51b73a9be093a86125519562a8ee238e134aeb (diff)
- Add images pre-loading on login page (#1451160)
Diffstat (limited to 'program/include/rcube_template.php')
-rwxr-xr-xprogram/include/rcube_template.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/program/include/rcube_template.php b/program/include/rcube_template.php
index ad498c9c5..c62238057 100755
--- a/program/include/rcube_template.php
+++ b/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
*