summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
Diffstat (limited to 'program')
-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
*