You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2008/01/09 10:31:33 UTC
svn commit: r610317 -
/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/calendar/resource/popcalendar.js
Author: skitching
Date: Wed Jan 9 01:31:33 2008
New Revision: 610317
URL: http://svn.apache.org/viewvc?rev=610317&view=rev
Log:
Preload standard images from server on page load
NB: There was already some code that was a partial implementation of this, but it didn't actually do anything.
Modified:
myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/calendar/resource/popcalendar.js
Modified: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/calendar/resource/popcalendar.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/calendar/resource/popcalendar.js?rev=610317&r1=610316&r2=610317&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/calendar/resource/popcalendar.js (original)
+++ myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/calendar/resource/popcalendar.js Wed Jan 9 01:31:33 2008
@@ -97,6 +97,8 @@
this.dateNow = this.today.getDate();
this.monthNow = this.today.getMonth();
this.yearNow = this.today.getYear();
+
+ // list of images to be preloaded from the server
this.imgSrc = new Array("drop1.gif", "drop2.gif", "left1.gif", "left2.gif", "right1.gif", "right2.gif");
this.img = new Array();
@@ -257,8 +259,13 @@
if (!this.calendarDiv)
{
- for (i = 0; i < this.imgSrc.length; i++)
+ for (var i = 0; i < this.imgSrc.length; i++)
+ {
+ // force preload of all images, so that when DOM nodes have their src set to
+ // the name of this image, it has already been loaded from the server.
this.img[i] = new Image;
+ this.img[i].src = this.initData.imgDir + this.imgSrc[i];
+ }
this.containerCtl = containerCtl;