[Cosmo-dev] Re: [commits-cosmo] (mde) [2713] Prefetch images for
buttons.
Ted Leung
twl at osafoundation.org
Fri Oct 20 17:37:53 PDT 2006
Please include the bug number in your commit comment when fixing a bug.
Thanks,
Ted
On Oct 20, 2006, at 5:20 PM, svncheckin at osafoundation.org wrote:
> Revision
> 2713
> Author
> mde
> Date
> 2006-10-20 17:20:18 -0700 (Fri, 20 Oct 2006)
> Log Message
>
> Prefetch images for buttons.
> Modified Paths
>
> cosmo/trunk/src/webapp/js/cosmo/ui/button.js
> Diff
>
> Modified: cosmo/trunk/src/webapp/js/cosmo/ui/button.js (2712 => 2713)
>
> --- cosmo/trunk/src/webapp/js/cosmo/ui/button.js 2006-10-20
> 23:16:13 UTC (rev 2712)
> +++ cosmo/trunk/src/webapp/js/cosmo/ui/button.js 2006-10-21
> 00:20:18 UTC (rev 2713)
> @@ -24,13 +24,28 @@
> * @object Button -- creates a button with a text label, and images
> * for endcaps and a stretchable, tiling middle section. Comes in
> * two sizes, normal and small.
> - * TO-DO: Refactor so this big ol' string function doesn't come
> - * first
> - * TO-DO: Consider doing this all with DOM methods
> - * FIXME: A standard object constructor function should probably not
> - * return a DOM node. Is it an object? Or a DOM node? Make it a
> static
> - * method of a Button singleton or something
> */
> +
> +function buttonPreload() {
> + var btnSizes = ['', '_sm'];
> + var btnSides = ['left', 'center', 'right'];
> + var btnTypes = ['', '_dim', '_lit'];
> + var btnPreload = {};
> + var f = function(base, suffix, size) {
> + var p = 'button_' + base + suffix + size;
> + btnPreload[p] = new Image();
> + btnPreload[p].src = BUTTON_DIR_PATH + p + '.gif';
> + }
> + for (var h in btnSizes) {
> + for (var i in btnSides) {
> + for (var j in btnTypes) {
> + f(btnSides[i], btnTypes[j], btnSizes[h]);
> + }
> + }
> + }
> +}
> +buttonPreload();
> +
> function Button(elemId, width, onClickHandler, displayText,
> isSmall) {
>
> /**
>
> _______________________________________________
> Commits-Cosmo mailing list
> Commits-Cosmo at osafoundation.org
> http://lists.osafoundation.org/cgi-bin/mailman/listinfo/commits-cosmo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osafoundation.org/pipermail/cosmo-dev/attachments/20061020/5c4311d8/attachment.htm
More information about the cosmo-dev
mailing list