Skip to content
Browse files

gallery-2011.02.02-21-07 ghinch gallery-ac-list-scaler

  • Loading branch information...
1 parent b323e0b commit 6e4386bf385d0619fa1e1c37fde943b80f9ee5e0 YUI Builder committed Feb 2, 2011
View
23 src/gallery-ac-list-scaler/build.properties
@@ -0,0 +1,23 @@
+# MyComponent Build Properties
+
+# As long as the 'builder' project is cloned to the default folder
+# next to the 'yui3' project folder, the 'builddir' property does not
+# need to be changed
+#
+# If the 'builder' project is checked out to an alternate location, this
+# property should be updated to point to the checkout location.
+builddir=../../../builder/componentbuild
+
+# The name of the component. E.g. event, attribute, widget
+component=gallery-ac-list-scaler
+
+# The list of files which should be concatenated to create the component.
+# NOTE: For a css component (e.g. cssfonts, cssgrids etc.) use component.cssfiles instead.
+component.jsfiles=scaler.js
+
+# The list of modules this component requires. Used to setup the Y.add module call for YUI 3.
+# NOTE: For a css component, this property is not used/required.
+
+# component.use, component.supersedes, component.optional and component.skinnable are other properties which can be defined
+component.requires=base-build, plugin, autocomplete-list
+component.builddir=../../tmp
View
9 src/gallery-ac-list-scaler/build.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- YUI 3 Component Build File -->
+
+<project name="Autocomplete Scaler" default="local">
+ <description>Gallery Autocomplete Scaler</description>
+ <property file="build.properties" />
+ <import file="${builddir}/3.x/bootstrap.xml" description="Default Build Properties and Targets" />
+</project>
View
39 src/gallery-ac-list-scaler/js/scaler.js
@@ -0,0 +1,39 @@
+var HOST = 'host',
+ CONTENT_BOX = 'contentBox';
+
+Y.ACListScaler = Y.Base.create('ac-list-scaler', Y.Plugin.Base, [], {
+ _afterRender : function (e) {
+ var host = this.get(HOST),
+ hostCb = host.get(CONTENT_BOX);
+ hostCb.setStyle('overflow', 'auto');
+ },
+
+ _afterResults : function(e) {
+ var host = this.get(HOST),
+ hostCb, cbRegion, vpRegion;
+
+ if (host.get('visible')) {
+ hostCb = host.get(CONTENT_BOX);
+ vpRegion = Y.DOM.viewportRegion();
+
+ hostCb.setStyle('height', '');
+ cbRegion = hostCb.get('region');
+ if (cbRegion.height + cbRegion.top > vpRegion.height) {
+ hostCb.setStyle('height', (vpRegion.height - cbRegion.top) + 'px');
+ }
+ }
+ },
+
+ initializer : function () {
+ this.doAfter('render', this._afterRender);
+ this.doAfter('results', this._afterResults);
+ },
+
+ destructor : function () {
+ var host = this.get(HOST),
+ hostCb = host.get(CONTENT_BOX);
+ hostCb.setStyle('overflow', '');
+ }
+}, {
+ NS : 'scaler'
+});

0 comments on commit 6e4386b

Please sign in to comment.
Something went wrong with that request. Please try again.