Skip to content
Browse files

Gallery Build Tag: gallery-2011.02.02-21-07

  • Loading branch information...
1 parent 6e4386b commit 833887ee6b2ef467e92991df6ea19ff094529973 YUI Builder committed Feb 2, 2011
Showing with 2,163 additions and 711 deletions.
  1. +44 −0 build/gallery-ac-list-scaler/gallery-ac-list-scaler-debug.js
  2. +1 −0 build/gallery-ac-list-scaler/gallery-ac-list-scaler-min.js
  3. +44 −0 build/gallery-ac-list-scaler/gallery-ac-list-scaler.js
  4. +185 −0 build/gallery-ac-multidelimit/gallery-ac-multidelimit-debug.js
  5. +1 −0 build/gallery-ac-multidelimit/gallery-ac-multidelimit-min.js
  6. +185 −0 build/gallery-ac-multidelimit/gallery-ac-multidelimit.js
  7. +149 −0 build/gallery-ac-typeahead/gallery-ac-typeahead-debug.js
  8. +1 −0 build/gallery-ac-typeahead/gallery-ac-typeahead-min.js
  9. +149 −0 build/gallery-ac-typeahead/gallery-ac-typeahead.js
  10. +100 −76 build/gallery-button/gallery-button-debug.js
  11. +1 −1 build/gallery-button/gallery-button-min.js
  12. +98 −76 build/gallery-button/gallery-button.js
  13. +54 −52 build/gallery-dialog/gallery-dialog-debug.js
  14. +1 −1 build/gallery-dialog/gallery-dialog-min.js
  15. +53 −51 build/gallery-dialog/gallery-dialog.js
  16. +18 −10 build/gallery-ellipsis/gallery-ellipsis-debug.js
  17. +1 −1 build/gallery-ellipsis/gallery-ellipsis-min.js
  18. +18 −10 build/gallery-ellipsis/gallery-ellipsis.js
  19. +21 −45 build/gallery-event-nav-keys/gallery-event-nav-keys-debug.js
  20. +1 −1 build/gallery-event-nav-keys/gallery-event-nav-keys-min.js
  21. +21 −45 build/gallery-event-nav-keys/gallery-event-nav-keys.js
  22. +226 −131 build/gallery-markout/gallery-markout-debug.js
  23. +4 −4 build/gallery-markout/gallery-markout-min.js
  24. +226 −131 build/gallery-markout/gallery-markout.js
  25. +105 −33 build/gallery-progress-bar/gallery-progress-bar-debug.js
  26. +1 −1 build/gallery-progress-bar/gallery-progress-bar-min.js
  27. +99 −31 build/gallery-progress-bar/gallery-progress-bar.js
  28. +171 −0 build/gallery-xarno-calendar-controls/gallery-xarno-calendar-controls-debug.js
  29. +1 −0 build/gallery-xarno-calendar-controls/gallery-xarno-calendar-controls-min.js
  30. +171 −0 build/gallery-xarno-calendar-controls/gallery-xarno-calendar-controls.js
  31. +6 −5 build/gallery-xarno-calendar/gallery-xarno-calendar-debug.js
  32. +1 −1 build/gallery-xarno-calendar/gallery-xarno-calendar-min.js
  33. +6 −5 build/gallery-xarno-calendar/gallery-xarno-calendar.js
View
44 build/gallery-ac-list-scaler/gallery-ac-list-scaler-debug.js
@@ -0,0 +1,44 @@
+YUI.add('gallery-ac-list-scaler', function(Y) {
+
+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'
+});
+
+
+}, 'gallery-2011.02.02-21-07' ,{requires:['base-build', 'plugin', 'autocomplete-list']});
View
1 build/gallery-ac-list-scaler/gallery-ac-list-scaler-min.js
@@ -0,0 +1 @@
+YUI.add("gallery-ac-list-scaler",function(c){var a="host",b="contentBox";c.ACListScaler=c.Base.create("ac-list-scaler",c.Plugin.Base,[],{_afterRender:function(f){var d=this.get(a),g=d.get(b);g.setStyle("overflow","auto");},_afterResults:function(h){var g=this.get(a),i,d,f;if(g.get("visible")){i=g.get(b);f=c.DOM.viewportRegion();i.setStyle("height","");d=i.get("region");if(d.height+d.top>f.height){i.setStyle("height",(f.height-d.top)+"px");}}},initializer:function(){this.doAfter("render",this._afterRender);this.doAfter("results",this._afterResults);},destructor:function(){var d=this.get(a),e=d.get(b);e.setStyle("overflow","");}},{NS:"scaler"});},"gallery-2011.02.02-21-07",{requires:["base-build","plugin","autocomplete-list"]});
View
44 build/gallery-ac-list-scaler/gallery-ac-list-scaler.js
@@ -0,0 +1,44 @@
+YUI.add('gallery-ac-list-scaler', function(Y) {
+
+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'
+});
+
+
+}, 'gallery-2011.02.02-21-07' ,{requires:['base-build', 'plugin', 'autocomplete-list']});
View
185 build/gallery-ac-multidelimit/gallery-ac-multidelimit-debug.js
@@ -0,0 +1,185 @@
+YUI.add('gallery-ac-multidelimit', function(Y) {
+
+var HOST = 'host',
+ QUERY_DELIMITER = 'queryDelimiter',
+ VALUE = 'value',
+ VALUE_CHANGE = 'valueChange',
+ PARSE_VALUE = '_parseValue',
+ UPDATE_VALUE = '_updateValue',
+ ON_INPUT_BLUR = '_onInputBlur';
+
+Y.ACMultiQueryDelim = Y.Base.create('ac-multidelim', Y.Plugin.Base, [], {
+ _beforeParseValue : function (value) {
+ return new Y.Do.Prevent();
+ },
+
+ _findLastDelimiter : function (str, delim) {
+ if (!Y.Lang.isArray(delim)) {
+ return delim;
+ }
+
+ var delimIndex = 0,
+ useDelim;
+
+ Y.Array.each(delim, function (d) {
+ var index = str.lastIndexOf(d);
+ if (index > delimIndex) {
+ delimIndex = index;
+ useDelim = d;
+ }
+ });
+
+ return useDelim;
+ },
+
+ _newParseValue : function (value) {
+ var delim = this.get(HOST).get(QUERY_DELIMITER);
+
+ value = value || '';
+
+ delim = this._findLastDelimiter(value, delim);
+
+ if (Y.Lang.isString(delim)) {
+ value = value.split(delim);
+ value = value[value.length - 1];
+ }
+
+ return new Y.Do.AlterReturn('', Y.Lang.trimLeft(value));
+ },
+
+ _newUpdateValue : function (newVal) {
+ var host = this.get(HOST),
+ delim = host.get(QUERY_DELIMITER),
+ insertDelim,
+ len,
+ prevVal;
+
+ newVal = Y.Lang.trimLeft(newVal);
+
+ if (delim) {
+ if (Y.Lang.isString(delim)) {
+ insertDelim = Y.Lang.trim(delim); // so we don't double up on spaces
+ prevVal = Y.Array.map(Y.Lang.trim(host.get(VALUE)).split(delim), Y.Lang.trim);
+ len = prevVal.length;
+
+ if (len > 1) {
+ prevVal[len - 1] = newVal;
+ newVal = prevVal.join(insertDelim + ' ');
+ }
+
+ newVal = newVal + insertDelim + ' ';
+ } else if (Y.Lang.isArray(delim)) {
+ // For now if you have multiple delimiters, there is no need to
+ // try and append one after completing
+ }
+ }
+
+ host.set(VALUE, newVal);
+ return new Y.Do.Prevent();
+ },
+
+ _newOnInputBlur : function (e) {
+ var host = this.get(HOST),
+ delim = host.get(QUERY_DELIMITER),
+ testArr,
+ delimPos,
+ newVal,
+ value;
+
+ function trimDelim(str, d) {
+ while ((str = Y.Lang.trimRight(str)) &&
+ (delimPos = str.length - d.length) &&
+ str.lastIndexOf(d) === delimPos) {
+
+ str = str.substring(0, delimPos);
+ }
+ return str;
+ }
+
+ function checkForDelimiter (d, i) {
+ var trimmed = trimDelim(newVal, Y.Lang.trimRight(d));
+ if (trimmed == newVal) {
+ testArr[i] = true;
+ } else {
+ testArr[i] = false;
+ }
+ newVal = trimmed;
+ }
+
+ // If a query delimiter is set and the input's value contains one or
+ // more trailing delimiters, strip them.
+ if (delim && !host.get('allowTrailingDelimiter')) {
+ value = newVal = host._inputNode.get(VALUE);
+
+ if (delim) {
+ if (Y.Lang.isString(delim)) {
+ delim = Y.Lang.trimRight(delim);
+ newVal = trimDelim(newVal, delim);
+ } else if (Y.Lang.isArray(delim)) {
+ // For an array of delimiters, we need to go through
+ // all of them until none remain at the end
+ testArr = Y.Array.map(delim, function () {
+ return false;
+ });
+
+ while (Y.Array.indexOf(testArr, false) > -1) {
+ Y.Array.each(delim, checkForDelimiter);
+ }
+ }
+ } else {
+ // Delimiter is one or more space characters, so just trim the
+ // value.
+ newVal = Y.Lang.trimRight(newVal);
+ }
+
+ if (newVal !== value) {
+ host.set(VALUE, newVal);
+ }
+ }
+ return new Y.Do.Prevent();
+ },
+
+ _onValueChange : function (e) {
+ if (!e.newVal || (e.src && e.src == 'ui')) {
+ return;
+ }
+ var val = e.newVal,
+ host = this.get(HOST),
+ completed;
+
+ completed = this.getCompletedStr(e.prevVal, val, host.get(QUERY_DELIMITER));
+
+ if (completed) {
+ e.newVal = completed;
+ } else {
+ e.newVal = val;
+ }
+ },
+
+ getCompletedStr : function (fullStr, term, delim) {
+ var lastDelim = this._findLastDelimiter(fullStr, delim),
+ valueArr;
+
+ if (lastDelim) {
+ valueArr = fullStr.split(lastDelim);
+ valueArr.pop();
+ valueArr.push(term);
+ return valueArr.join(lastDelim);
+ }
+
+ },
+
+ initializer : function () {
+ this.doBefore(PARSE_VALUE, this._beforeParseValue);
+ this.doAfter(PARSE_VALUE, this._newParseValue);
+ this.doBefore(UPDATE_VALUE, this._newUpdateValue);
+ this.doBefore(ON_INPUT_BLUR, this._newOnInputBlur);
+ this.doBefore(VALUE_CHANGE, this._onValueChange);
+ }
+}, {
+ NS : 'multiQueryDelim'
+});
+
+
+
+}, 'gallery-2011.02.02-21-07' ,{requires:['autocomplete-list', 'plugin', 'base-build']});
View
1 build/gallery-ac-multidelimit/gallery-ac-multidelimit-min.js
@@ -0,0 +1 @@
+YUI.add("gallery-ac-multidelimit",function(h){var c="host",g="queryDelimiter",f="value",b="valueChange",a="_parseValue",d="_updateValue",e="_onInputBlur";h.ACMultiQueryDelim=h.Base.create("ac-multidelim",h.Plugin.Base,[],{_beforeParseValue:function(i){return new h.Do.Prevent();},_findLastDelimiter:function(l,k){if(!h.Lang.isArray(k)){return k;}var i=0,j;h.Array.each(k,function(n){var m=l.lastIndexOf(n);if(m>i){i=m;j=n;}});return j;},_newParseValue:function(i){var j=this.get(c).get(g);i=i||"";j=this._findLastDelimiter(i,j);if(h.Lang.isString(j)){i=i.split(j);i=i[i.length-1];}return new h.Do.AlterReturn("",h.Lang.trimLeft(i));},_newUpdateValue:function(j){var l=this.get(c),m=l.get(g),k,i,n;j=h.Lang.trimLeft(j);if(m){if(h.Lang.isString(m)){k=h.Lang.trim(m);n=h.Array.map(h.Lang.trim(l.get(f)).split(m),h.Lang.trim);i=n.length;if(i>1){n[i-1]=j;j=n.join(k+" ");}j=j+k+" ";}else{if(h.Lang.isArray(m)){}}}l.set(f,j);return new h.Do.Prevent();},_newOnInputBlur:function(n){var p=this.get(c),j=p.get(g),l,m,k,o;function q(s,r){while((s=h.Lang.trimRight(s))&&(m=s.length-r.length)&&s.lastIndexOf(r)===m){s=s.substring(0,m);}return s;}function i(t,r){var s=q(k,h.Lang.trimRight(t));if(s==k){l[r]=true;}else{l[r]=false;}k=s;}if(j&&!p.get("allowTrailingDelimiter")){o=k=p._inputNode.get(f);if(j){if(h.Lang.isString(j)){j=h.Lang.trimRight(j);k=q(k,j);}else{if(h.Lang.isArray(j)){l=h.Array.map(j,function(){return false;});while(h.Array.indexOf(l,false)>-1){h.Array.each(j,i);}}}}else{k=h.Lang.trimRight(k);}if(k!==o){p.set(f,k);}}return new h.Do.Prevent();},_onValueChange:function(k){if(!k.newVal||(k.src&&k.src=="ui")){return;}var l=k.newVal,j=this.get(c),i;i=this.getCompletedStr(k.prevVal,l,j.get(g));if(i){k.newVal=i;}else{k.newVal=l;}},getCompletedStr:function(l,j,m){var k=this._findLastDelimiter(l,m),i;if(k){i=l.split(k);i.pop();i.push(j);return i.join(k);}},initializer:function(){this.doBefore(a,this._beforeParseValue);this.doAfter(a,this._newParseValue);this.doBefore(d,this._newUpdateValue);this.doBefore(e,this._newOnInputBlur);this.doBefore(b,this._onValueChange);}},{NS:"multiQueryDelim"});},"gallery-2011.02.02-21-07",{requires:["autocomplete-list","plugin","base-build"]});
View
185 build/gallery-ac-multidelimit/gallery-ac-multidelimit.js
@@ -0,0 +1,185 @@
+YUI.add('gallery-ac-multidelimit', function(Y) {
+
+var HOST = 'host',
+ QUERY_DELIMITER = 'queryDelimiter',
+ VALUE = 'value',
+ VALUE_CHANGE = 'valueChange',
+ PARSE_VALUE = '_parseValue',
+ UPDATE_VALUE = '_updateValue',
+ ON_INPUT_BLUR = '_onInputBlur';
+
+Y.ACMultiQueryDelim = Y.Base.create('ac-multidelim', Y.Plugin.Base, [], {
+ _beforeParseValue : function (value) {
+ return new Y.Do.Prevent();
+ },
+
+ _findLastDelimiter : function (str, delim) {
+ if (!Y.Lang.isArray(delim)) {
+ return delim;
+ }
+
+ var delimIndex = 0,
+ useDelim;
+
+ Y.Array.each(delim, function (d) {
+ var index = str.lastIndexOf(d);
+ if (index > delimIndex) {
+ delimIndex = index;
+ useDelim = d;
+ }
+ });
+
+ return useDelim;
+ },
+
+ _newParseValue : function (value) {
+ var delim = this.get(HOST).get(QUERY_DELIMITER);
+
+ value = value || '';
+
+ delim = this._findLastDelimiter(value, delim);
+
+ if (Y.Lang.isString(delim)) {
+ value = value.split(delim);
+ value = value[value.length - 1];
+ }
+
+ return new Y.Do.AlterReturn('', Y.Lang.trimLeft(value));
+ },
+
+ _newUpdateValue : function (newVal) {
+ var host = this.get(HOST),
+ delim = host.get(QUERY_DELIMITER),
+ insertDelim,
+ len,
+ prevVal;
+
+ newVal = Y.Lang.trimLeft(newVal);
+
+ if (delim) {
+ if (Y.Lang.isString(delim)) {
+ insertDelim = Y.Lang.trim(delim); // so we don't double up on spaces
+ prevVal = Y.Array.map(Y.Lang.trim(host.get(VALUE)).split(delim), Y.Lang.trim);
+ len = prevVal.length;
+
+ if (len > 1) {
+ prevVal[len - 1] = newVal;
+ newVal = prevVal.join(insertDelim + ' ');
+ }
+
+ newVal = newVal + insertDelim + ' ';
+ } else if (Y.Lang.isArray(delim)) {
+ // For now if you have multiple delimiters, there is no need to
+ // try and append one after completing
+ }
+ }
+
+ host.set(VALUE, newVal);
+ return new Y.Do.Prevent();
+ },
+
+ _newOnInputBlur : function (e) {
+ var host = this.get(HOST),
+ delim = host.get(QUERY_DELIMITER),
+ testArr,
+ delimPos,
+ newVal,
+ value;
+
+ function trimDelim(str, d) {
+ while ((str = Y.Lang.trimRight(str)) &&
+ (delimPos = str.length - d.length) &&
+ str.lastIndexOf(d) === delimPos) {
+
+ str = str.substring(0, delimPos);
+ }
+ return str;
+ }
+
+ function checkForDelimiter (d, i) {
+ var trimmed = trimDelim(newVal, Y.Lang.trimRight(d));
+ if (trimmed == newVal) {
+ testArr[i] = true;
+ } else {
+ testArr[i] = false;
+ }
+ newVal = trimmed;
+ }
+
+ // If a query delimiter is set and the input's value contains one or
+ // more trailing delimiters, strip them.
+ if (delim && !host.get('allowTrailingDelimiter')) {
+ value = newVal = host._inputNode.get(VALUE);
+
+ if (delim) {
+ if (Y.Lang.isString(delim)) {
+ delim = Y.Lang.trimRight(delim);
+ newVal = trimDelim(newVal, delim);
+ } else if (Y.Lang.isArray(delim)) {
+ // For an array of delimiters, we need to go through
+ // all of them until none remain at the end
+ testArr = Y.Array.map(delim, function () {
+ return false;
+ });
+
+ while (Y.Array.indexOf(testArr, false) > -1) {
+ Y.Array.each(delim, checkForDelimiter);
+ }
+ }
+ } else {
+ // Delimiter is one or more space characters, so just trim the
+ // value.
+ newVal = Y.Lang.trimRight(newVal);
+ }
+
+ if (newVal !== value) {
+ host.set(VALUE, newVal);
+ }
+ }
+ return new Y.Do.Prevent();
+ },
+
+ _onValueChange : function (e) {
+ if (!e.newVal || (e.src && e.src == 'ui')) {
+ return;
+ }
+ var val = e.newVal,
+ host = this.get(HOST),
+ completed;
+
+ completed = this.getCompletedStr(e.prevVal, val, host.get(QUERY_DELIMITER));
+
+ if (completed) {
+ e.newVal = completed;
+ } else {
+ e.newVal = val;
+ }
+ },
+
+ getCompletedStr : function (fullStr, term, delim) {
+ var lastDelim = this._findLastDelimiter(fullStr, delim),
+ valueArr;
+
+ if (lastDelim) {
+ valueArr = fullStr.split(lastDelim);
+ valueArr.pop();
+ valueArr.push(term);
+ return valueArr.join(lastDelim);
+ }
+
+ },
+
+ initializer : function () {
+ this.doBefore(PARSE_VALUE, this._beforeParseValue);
+ this.doAfter(PARSE_VALUE, this._newParseValue);
+ this.doBefore(UPDATE_VALUE, this._newUpdateValue);
+ this.doBefore(ON_INPUT_BLUR, this._newOnInputBlur);
+ this.doBefore(VALUE_CHANGE, this._onValueChange);
+ }
+}, {
+ NS : 'multiQueryDelim'
+});
+
+
+
+}, 'gallery-2011.02.02-21-07' ,{requires:['autocomplete-list', 'plugin', 'base-build']});
View
149 build/gallery-ac-typeahead/gallery-ac-typeahead-debug.js
@@ -0,0 +1,149 @@
+YUI.add('gallery-ac-typeahead', function(Y) {
+
+var HOST = 'host',
+ INPUT_NODE = 'inputNode',
+ VALUE = 'value',
+ QUERY_DELIMITER = 'queryDelimiter';
+
+Y.ACTypeAhead = Y.Base.create('ac-typeahead', Y.Plugin.Base, [], {
+ _setTypeAheadValue : function (value) {
+ if (!this._userInput) {
+ return;
+ }
+
+ var host = this.get(HOST),
+ inputNode = host.get(INPUT_NODE),
+ inputValue = inputNode.get(VALUE);
+ this._taNode.set('disabled', false);
+ this._taNode.set(VALUE, value);
+ this._taNode.set('disabled', true);
+
+ // Convert the case in the input to match the result
+ if (value.length > 0) {
+ inputNode.set(VALUE, value.substr(0,inputValue.length));
+ }
+ },
+
+ _afterResults : function (e) {
+ var res = e.results[0],
+ host = this.get(HOST),
+ taVal = '';
+
+ if (e.query.length > 0 && res) {
+ if (host.multiQueryDelim) {
+ taVal = host.multiQueryDelim.getCompletedStr(
+ host.get(VALUE),
+ res.text,
+ host.get(QUERY_DELIMITER)
+ ) || res.text;
+ } else {
+ taVal = res.text;
+ }
+ }
+
+ this._setTypeAheadValue(taVal);
+ },
+
+ _afterActiveItemChange : function (e) {
+ var host = this.get(HOST),
+ txt;
+ if (e.newVal) {
+ txt = e.newVal.getData('result').text;
+ if (host.multiQueryDelim) {
+ txt = host.multiQueryDelim.getCompletedStr(
+ host.get(VALUE),
+ txt,
+ host.get(QUERY_DELIMITER)
+ );
+ }
+ }
+ if (txt) {
+ this._setTypeAheadValue(txt);
+ }
+ },
+
+ _afterVisChange : function (e) {
+ if (!e.newVal) {
+ this._setTypeAheadValue('');
+ }
+ this._userInput = false;
+ },
+
+ _afterTabKeyDown : function (e) {
+ if (!this._userInput || !this._taNode.get(VALUE)) {
+ return;
+ }
+
+ var host = this.get(HOST),
+ listNode, listItems, selected;
+
+ if (host.get('visible')) {
+ listNode = host.get('listNode');
+ listItems = listNode.all('li.yui3-aclist-item');
+ selected = host.get('activeItem') || listItems.item(0);
+
+ if (selected) {
+ host.selectItem(selected);
+ }
+
+ e.preventDefault();
+ }
+
+ host.hide();
+ },
+
+ _afterKeydown : function (e) {
+ this._userInput = true;
+ },
+
+ _initTypeAheadNode : function () {
+ this._taNode = Y.Node.create('<input disabled />');
+ this._taContainer = Y.Node.create('<div></div>');
+
+ var inputNode = this.get(HOST).get(INPUT_NODE);
+
+ inputNode.get('parentNode').insert(this._taContainer, inputNode);
+ this._taContainer.append(this._taNode);
+
+ this._tabKeyDownHandle = Y.after('key', this._afterTabKeyDown, inputNode, 'down:9,13', this);
+ this._keyDownHandle = inputNode.after('keydown', this._afterKeydown, this);
+
+ this._taContainer.setStyles({
+ position: 'absolute',
+ zIndex: 1,
+ opacity : 0.75
+ });
+
+ inputNode.setStyles({
+ position: 'relative',
+ zIndex: 2,
+ backgroundColor: 'transparent'
+ });
+ },
+
+ initializer : function () {
+ this._initTypeAheadNode();
+ this._userInput = false;
+
+ this.doAfter('results', this._afterResults);
+ this.doAfter('visibleChange', this._afterVisChange);
+ this.doAfter('activeItemChange', this._afterActiveItemChange);
+ },
+
+ destructor : function () {
+ this._taContainer.remove();
+ this.get(HOST).get(INPUT_NODE).setStyles({
+ position: '',
+ zIndex: '',
+ backgroundColor: ''
+
+ });
+ this._keyDownHandle.detach();
+ this._tabKeyDownHandle.detach();
+ }
+}, {
+ NS : 'typeahead'
+});
+
+
+}, 'gallery-2011.02.02-21-07' ,{requires:['autocomplete-base', 'plugin', 'base-build']});
View
1 build/gallery-ac-typeahead/gallery-ac-typeahead-min.js
@@ -0,0 +1 @@
+YUI.add("gallery-ac-typeahead",function(d){var a="host",e="inputNode",b="value",c="queryDelimiter";d.ACTypeAhead=d.Base.create("ac-typeahead",d.Plugin.Base,[],{_setTypeAheadValue:function(i){if(!this._userInput){return;}var h=this.get(a),g=h.get(e),f=g.get(b);this._taNode.set("disabled",false);this._taNode.set(b,i);this._taNode.set("disabled",true);if(i.length>0){g.set(b,i.substr(0,f.length));}},_afterResults:function(i){var g=i.results[0],h=this.get(a),f="";if(i.query.length>0&&g){if(h.multiQueryDelim){f=h.multiQueryDelim.getCompletedStr(h.get(b),g.text,h.get(c))||g.text;}else{f=g.text;}}this._setTypeAheadValue(f);},_afterActiveItemChange:function(h){var g=this.get(a),f;if(h.newVal){f=h.newVal.getData("result").text;if(g.multiQueryDelim){f=g.multiQueryDelim.getCompletedStr(g.get(b),f,g.get(c));}}if(f){this._setTypeAheadValue(f);}},_afterVisChange:function(f){if(!f.newVal){this._setTypeAheadValue("");}this._userInput=false;},_afterTabKeyDown:function(j){if(!this._userInput||!this._taNode.get(b)){return;}var h=this.get(a),g,i,f;if(h.get("visible")){g=h.get("listNode");i=g.all("li.yui3-aclist-item");f=h.get("activeItem")||i.item(0);if(f){h.selectItem(f);}j.preventDefault();}h.hide();},_afterKeydown:function(f){this._userInput=true;},_initTypeAheadNode:function(){this._taNode=d.Node.create("<input disabled />");this._taContainer=d.Node.create("<div></div>");var f=this.get(a).get(e);f.get("parentNode").insert(this._taContainer,f);this._taContainer.append(this._taNode);this._tabKeyDownHandle=d.after("key",this._afterTabKeyDown,f,"down:9,13",this);this._keyDownHandle=f.after("keydown",this._afterKeydown,this);this._taContainer.setStyles({position:"absolute",zIndex:1,opacity:0.75});f.setStyles({position:"relative",zIndex:2,backgroundColor:"transparent"});},initializer:function(){this._initTypeAheadNode();this._userInput=false;this.doAfter("results",this._afterResults);this.doAfter("visibleChange",this._afterVisChange);this.doAfter("activeItemChange",this._afterActiveItemChange);},destructor:function(){this._taContainer.remove();this.get(a).get(e).setStyles({position:"",zIndex:"",backgroundColor:""});this._keyDownHandle.detach();this._tabKeyDownHandle.detach();}},{NS:"typeahead"});},"gallery-2011.02.02-21-07",{requires:["autocomplete-base","plugin","base-build"]});
View
149 build/gallery-ac-typeahead/gallery-ac-typeahead.js
@@ -0,0 +1,149 @@
+YUI.add('gallery-ac-typeahead', function(Y) {
+
+var HOST = 'host',
+ INPUT_NODE = 'inputNode',
+ VALUE = 'value',
+ QUERY_DELIMITER = 'queryDelimiter';
+
+Y.ACTypeAhead = Y.Base.create('ac-typeahead', Y.Plugin.Base, [], {
+ _setTypeAheadValue : function (value) {
+ if (!this._userInput) {
+ return;
+ }
+
+ var host = this.get(HOST),
+ inputNode = host.get(INPUT_NODE),
+ inputValue = inputNode.get(VALUE);
+ this._taNode.set('disabled', false);
+ this._taNode.set(VALUE, value);
+ this._taNode.set('disabled', true);
+
+ // Convert the case in the input to match the result
+ if (value.length > 0) {
+ inputNode.set(VALUE, value.substr(0,inputValue.length));
+ }
+ },
+
+ _afterResults : function (e) {
+ var res = e.results[0],
+ host = this.get(HOST),
+ taVal = '';
+
+ if (e.query.length > 0 && res) {
+ if (host.multiQueryDelim) {
+ taVal = host.multiQueryDelim.getCompletedStr(
+ host.get(VALUE),
+ res.text,
+ host.get(QUERY_DELIMITER)
+ ) || res.text;
+ } else {
+ taVal = res.text;
+ }
+ }
+
+ this._setTypeAheadValue(taVal);
+ },
+
+ _afterActiveItemChange : function (e) {
+ var host = this.get(HOST),
+ txt;
+ if (e.newVal) {
+ txt = e.newVal.getData('result').text;
+ if (host.multiQueryDelim) {
+ txt = host.multiQueryDelim.getCompletedStr(
+ host.get(VALUE),
+ txt,
+ host.get(QUERY_DELIMITER)
+ );
+ }
+ }
+ if (txt) {
+ this._setTypeAheadValue(txt);
+ }
+ },
+
+ _afterVisChange : function (e) {
+ if (!e.newVal) {
+ this._setTypeAheadValue('');
+ }
+ this._userInput = false;
+ },
+
+ _afterTabKeyDown : function (e) {
+ if (!this._userInput || !this._taNode.get(VALUE)) {
+ return;
+ }
+
+ var host = this.get(HOST),
+ listNode, listItems, selected;
+
+ if (host.get('visible')) {
+ listNode = host.get('listNode');
+ listItems = listNode.all('li.yui3-aclist-item');
+ selected = host.get('activeItem') || listItems.item(0);
+
+ if (selected) {
+ host.selectItem(selected);
+ }
+
+ e.preventDefault();
+ }
+
+ host.hide();
+ },
+
+ _afterKeydown : function (e) {
+ this._userInput = true;
+ },
+
+ _initTypeAheadNode : function () {
+ this._taNode = Y.Node.create('<input disabled />');
+ this._taContainer = Y.Node.create('<div></div>');
+
+ var inputNode = this.get(HOST).get(INPUT_NODE);
+
+ inputNode.get('parentNode').insert(this._taContainer, inputNode);
+ this._taContainer.append(this._taNode);
+
+ this._tabKeyDownHandle = Y.after('key', this._afterTabKeyDown, inputNode, 'down:9,13', this);
+ this._keyDownHandle = inputNode.after('keydown', this._afterKeydown, this);
+
+ this._taContainer.setStyles({
+ position: 'absolute',
+ zIndex: 1,
+ opacity : 0.75
+ });
+
+ inputNode.setStyles({
+ position: 'relative',
+ zIndex: 2,
+ backgroundColor: 'transparent'
+ });
+ },
+
+ initializer : function () {
+ this._initTypeAheadNode();
+ this._userInput = false;
+
+ this.doAfter('results', this._afterResults);
+ this.doAfter('visibleChange', this._afterVisChange);
+ this.doAfter('activeItemChange', this._afterActiveItemChange);
+ },
+
+ destructor : function () {
+ this._taContainer.remove();
+ this.get(HOST).get(INPUT_NODE).setStyles({
+ position: '',
+ zIndex: '',
+ backgroundColor: ''
+
+ });
+ this._keyDownHandle.detach();
+ this._tabKeyDownHandle.detach();
+ }
+}, {
+ NS : 'typeahead'
+});
+
+
+}, 'gallery-2011.02.02-21-07' ,{requires:['autocomplete-base', 'plugin', 'base-build']});
View
176 build/gallery-button/gallery-button-debug.js
@@ -11,13 +11,14 @@ var YL = Y.Lang,
CLASS_PRESSED = '-pressed',
CLASS_DEFAULT = '-default',
CLASS_DISABLED = '-disabled',
- CLASS_NO_LABEL = '-no-label',
+ CLASS_NO_LABEL = 'no-label',
BOUNDING_BOX = 'boundingBox',
CONTENT_BOX = 'contentBox',
DEFAULT = 'default',
ENABLED = 'enabled',
DISABLED = 'disabled',
HREF = 'href',
+ TAB_INDEX = 'tabindex',
ICON = 'icon',
TITLE = 'title',
INNER_HTML = 'innerHTML';
@@ -56,13 +57,15 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
*/
renderUI : function(){
Y.log('renderUI', 'info', 'Y.Button');
- var href = this.get(HREF);
-
- this.get(CONTENT_BOX).setContent(this.get('label'));
-
- if(href) {
- this.get(BOUNDING_BOX).setAttribute(HREF, href);
- }
+ var href = this.get(HREF);
+
+ this.get(CONTENT_BOX).setContent(this.get('label'));
+
+ if(href) {
+ this.get(BOUNDING_BOX).setAttribute(HREF, href);
+ } else {
+ this.get(BOUNDING_BOX).set('tabIndex',0);
+ }
},
/**
@@ -79,6 +82,7 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
bb.on('click', this._defClickFn, this);
bb.on('mouseup', this._mouseUp, this);
bb.on('mousedown', this._mouseDown, this);
+ bb.after('tabindexChange', this._afterTabindexChange, this);
},
/**
@@ -91,6 +95,7 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
Y.log('syncUI', 'info', 'Y.Button');
this._updateDefault(this.get(DEFAULT));
this._updateEnabled(this.get(ENABLED));
+ this._updateTabindex(this.get(TAB_INDEX));
},
/**
@@ -103,7 +108,7 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
disable : function() {
Y.log('disable', 'info', 'Y.Button');
this.set(ENABLED, false);
- return this;
+ return this;
},
/**
@@ -116,7 +121,7 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
enable : function() {
Y.log('enable', 'info', 'Y.Button');
this.set(ENABLED, true);
- return this;
+ return this;
},
/**
@@ -141,16 +146,16 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
*/
_defClickFn : function(e) {
Y.log('_defClickFn', 'info', 'Y.Button');
- var href = this.get(HREF);
-
- if (!this.get(ENABLED)) {
- e.preventDefault();
- return;
- }
-
- if(!href || href === '#') {
- e.preventDefault();
- }
+ var href = this.get(HREF);
+
+ if (!this.get(ENABLED)) {
+ e.preventDefault();
+ return;
+ }
+
+ if(!href || href === '#') {
+ e.preventDefault();
+ }
this.fire(EVENT_PRESS, {click : e});
},
@@ -179,7 +184,7 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
if(this._mouseListener !== null) {
this._mouseListener.detach();
this._mouseListener = null;
- }
+ }
},
/**
@@ -192,7 +197,7 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
Y.log('_mouseDown', 'info', 'Y.Button');
if(this.get(ENABLED)) {
this.get(BOUNDING_BOX).addClass(this._className + CLASS_PRESSED);
- this._mouseIsDown = true;
+ this._mouseIsDown = true;
if(this._mouseListener === null) {
this._mouseListener = Y.on('mouseup',Y.bind(this._listenForMouseUp,this));
}
@@ -234,11 +239,11 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
if(status) {
bb.removeClass(disableClass);
- bb.set(DISABLED,'');
+ bb.removeAttribute(DISABLED);
}else{
bb.addClass(disableClass);
bb.removeClass(this._className + CLASS_PRESSED);
- bb.set(DISABLED,DISABLED);
+ bb.setAttribute(DISABLED,DISABLED);
}
},
@@ -287,8 +292,8 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
if(this.get('callback')) {
(this.get('callback'))(e);
}else{
- (this._callbackFromType())(e);
- }
+ (this._callbackFromType())(e);
+ }
},
/**
@@ -316,9 +321,9 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
_labelSetterFn : function(val) {
Y.log('_labelSetterFn', 'info', 'Y.Button');
if (!val || val === '') {
- this.get(BOUNDING_BOX).addClass(this._className + CLASS_NO_LABEL);
+ this.get(BOUNDING_BOX).addClass(this.getClassName(CLASS_NO_LABEL));
} else {
- this.get(BOUNDING_BOX).removeClass(this._className + CLASS_NO_LABEL);
+ this.get(BOUNDING_BOX).removeClass(this.getClassName(CLASS_NO_LABEL));
}
this.get(CONTENT_BOX).setContent(val);
this.set(TITLE, val);
@@ -350,18 +355,34 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
_callbackFromType : function() {
Y.log('_callbackFromType', 'info', 'Y.Button');
var bb = this.get(BOUNDING_BOX),
- frm = bb.ancestor('form');
+ frm = bb.ancestor('form');
+
+ switch (this.get('type')) {
+ case 'submit':
+ if (frm) { return Y.bind(frm.submit, frm); }
+ break;
+ case 'reset':
+ if (frm) { return Y.bind(frm.reset, frm); }
+ break;
+ }
- switch (this.get('type')) {
- case 'submit':
- if (frm) { return Y.bind(frm.submit, frm); }
- break;
- case 'reset':
- if (frm) { return Y.bind(frm.reset, frm); }
- break;
- }
+ return function(){};
+ },
+
+ _afterTabindexChange : function(e) {
+ Y.log('_afterTabindexChange', 'info', 'Y.Button');
+ this._updateTabindex(e.newVal);
+ },
- return function(){};
+ _updateTabindex : function(val) {
+ Y.log('_updateTabindex', 'info', 'Y.Button');
+ var bb = this.get(BOUNDING_BOX);
+
+ if (val !== undefined && val !== null) {
+ bb.setAttribute(TAB_INDEX, val);
+ } else {
+ bb.removeAttribute(TAB_INDEX);
+ }
}
}, {
@@ -387,22 +408,25 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
validator : YL.isBoolean
},
icon : {
- value : DEFAULT,
+ value : DEFAULT,
setter : '_iconSetterFn',
- lazyAdd : false
+ lazyAdd : false
+ },
+ href : {
+ value : null
},
- href : {
- value : null
- },
title : {
validator : YL.isString,
setter : '_titleSetterFn'
},
+ tabindex : {
+ value : 0
+ },
type : {
value : 'push',
validator : YL.isString,
lazyAdd : false
- }
+ }
},
/**
* HTML Parser assumes srcNode is either a &lt;button&gt; or
@@ -412,62 +436,62 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
HTML_PARSER : {
enabled : function(srcNode) {
- return !srcNode.get(DISABLED);
- },
-
+ return !srcNode.get(DISABLED);
+ },
+
label : function(srcNode) {
if(srcNode.getAttribute('value')) {
return srcNode.getAttribute('value');
}
if(srcNode.get(INNER_HTML)) {
return srcNode.get(INNER_HTML);
}
-
- // default form button labels based on type
- if(srcNode.get('tagName') === 'INPUT') {
- switch (srcNode.get('type')) {
- case 'reset' : return 'Reset';
- case 'submit' : return 'Submit';
- }
- }
-
+
+ // default form button labels based on type
+ if(srcNode.get('tagName') === 'INPUT') {
+ switch (srcNode.get('type')) {
+ case 'reset' : return 'Reset';
+ case 'submit' : return 'Submit';
+ }
+ }
+
return null;
},
-
- href : function(srcNode) {
- var href = srcNode.getAttribute(HREF);
- if(href) {
- return href;
- }
+ href : function(srcNode) {
+ var href = srcNode.getAttribute(HREF);
+
+ if(href) {
+ return href;
+ }
+
+ return null;
+ },
- return null;
- },
-
- type : function(srcNode) {
- var type = srcNode.getAttribute('type');
+ type : function(srcNode) {
+ var type = srcNode.getAttribute('type');
+
+ if(type) {
+ return type;
+ }
+ return null;
+ },
- if(type) {
- return type;
- }
- return null;
- },
-
title : function(srcNode) {
if(srcNode.getAttribute(TITLE)) {
return srcNode.getAttribute(TITLE);
}
- if(srcNode.getAttribute('value')) {
+ if(srcNode.getAttribute('value')) {
return srcNode.getAttribute('value');
}
if(srcNode.get(INNER_HTML)) {
return srcNode.get(INNER_HTML);
}
return null;
- }
+ }
}
});
-}, 'gallery-2010.12.10-17-31' ,{requires:['widget','event-mouseenter','widget-child']});
+}, 'gallery-2011.02.02-21-07' ,{requires:['widget','event-mouseenter','widget-child']});
View
2 build/gallery-button/gallery-button-min.js
@@ -1 +1 @@
-YUI.add("gallery-button",function(a){var l=a.Lang,k=a.ClassNameManager,o="press",m="-pressed",b="-default",h="-disabled",c="-no-label",j="boundingBox",n="contentBox",f="default",q="enabled",g="disabled",p="href",i="icon",e="title",d="innerHTML";a.Button=a.Base.create("button",a.Widget,[a.WidgetChild],{BOUNDING_TEMPLATE:"<a />",CONTENT_TEMPLATE:'<span class="yui3-icon"/>',_className:"",_mouseIsDown:false,_mouseListener:null,_defaultCB:function(){return null;},initializer:function(r){this._className=this.getClassName();this.publish(o,{defaultFn:this._defPressFn});this.after("defaultChange",this._afterDefaultChanged,this);this.after("enabledChange",this._afterEnabledChanged,this);},renderUI:function(){var r=this.get(p);this.get(n).setContent(this.get("label"));if(r){this.get(j).setAttribute(p,r);}},bindUI:function(){var r=this.get(j);r.on("click",this._defClickFn,this);r.on("mouseup",this._mouseUp,this);r.on("mousedown",this._mouseDown,this);},syncUI:function(){this._updateDefault(this.get(f));this._updateEnabled(this.get(q));},disable:function(){this.set(q,false);return this;},enable:function(){this.set(q,true);return this;},setTitle:function(r){this.get(j).set(e,r);return this;},_defClickFn:function(s){var r=this.get(p);if(!this.get(q)){s.preventDefault();return;}if(!r||r==="#"){s.preventDefault();}this.fire(o,{click:s});},_defPressFn:function(r){this._executeCallback(r);},_mouseUp:function(){this.get(j).removeClass(this._className+m);this._mouseIsDown=false;if(this._mouseListener!==null){this._mouseListener.detach();this._mouseListener=null;}},_mouseDown:function(){if(this.get(q)){this.get(j).addClass(this._className+m);this._mouseIsDown=true;if(this._mouseListener===null){this._mouseListener=a.on("mouseup",a.bind(this._listenForMouseUp,this));}}},_listenForMouseUp:function(){this._mouseUp();},_afterEnabledChanged:function(r){this._updateEnabled(r.newVal);},_updateEnabled:function(r){var t=this.get(j),s=this._className+h;if(r){t.removeClass(s);t.set(g,"");}else{t.addClass(s);t.removeClass(this._className+m);t.set(g,g);}},_afterDefaultChanged:function(r){this._updateDefault(r.newVal);},_updateDefault:function(s){var t=this.get(j),r=this._className+b;if(s){t.addClass(r);t.setAttribute(f,f);}else{t.removeClass(r);t.set(f,"");}},_executeCallback:function(r){if(this.get("callback")){(this.get("callback"))(r);}else{(this._callbackFromType())(r);}},_iconSetterFn:function(r){this.get(j).replaceClass(k.getClassName(i,this.get(i)||f),k.getClassName(i,r||f));return r;},_labelSetterFn:function(r){if(!r||r===""){this.get(j).addClass(this._className+c);}else{this.get(j).removeClass(this._className+c);}this.get(n).setContent(r);this.set(e,r);return r;},_titleSetterFn:function(r){this.get(j).set(e,r);return r;},_callbackFromType:function(){var s=this.get(j),r=s.ancestor("form");switch(this.get("type")){case"submit":if(r){return a.bind(r.submit,r);}break;case"reset":if(r){return a.bind(r.reset,r);}break;}return function(){};}},{EVENTS:{PRESS:o},ATTRS:{label:{value:"",validator:l.isString,setter:"_labelSetterFn",lazyAdd:false},callback:{validator:l.isFunction},enabled:{value:true,validator:l.isBoolean},DEFAULT:{value:false,validator:l.isBoolean},icon:{value:f,setter:"_iconSetterFn",lazyAdd:false},href:{value:null},title:{validator:l.isString,setter:"_titleSetterFn"},type:{value:"push",validator:l.isString,lazyAdd:false}},HTML_PARSER:{enabled:function(r){return !r.get(g);},label:function(r){if(r.getAttribute("value")){return r.getAttribute("value");}if(r.get(d)){return r.get(d);}if(r.get("tagName")==="INPUT"){switch(r.get("type")){case"reset":return"Reset";case"submit":return"Submit";}}return null;},href:function(s){var r=s.getAttribute(p);if(r){return r;}return null;},type:function(s){var r=s.getAttribute("type");if(r){return r;}return null;},title:function(r){if(r.getAttribute(e)){return r.getAttribute(e);}if(r.getAttribute("value")){return r.getAttribute("value");}if(r.get(d)){return r.get(d);}return null;}}});},"gallery-2010.12.10-17-31",{requires:["widget","event-mouseenter","widget-child"]});
+YUI.add("gallery-button",function(d){var m=d.Lang,i=d.ClassNameManager,h="press",j="-pressed",f="-default",c="-disabled",g="no-label",q="boundingBox",k="contentBox",p="default",r="enabled",o="disabled",a="href",b="tabindex",e="icon",l="title",n="innerHTML";d.Button=d.Base.create("button",d.Widget,[d.WidgetChild],{BOUNDING_TEMPLATE:"<a />",CONTENT_TEMPLATE:'<span class="yui3-icon"/>',_className:"",_mouseIsDown:false,_mouseListener:null,_defaultCB:function(){return null;},initializer:function(s){this._className=this.getClassName();this.publish(h,{defaultFn:this._defPressFn});this.after("defaultChange",this._afterDefaultChanged,this);this.after("enabledChange",this._afterEnabledChanged,this);},renderUI:function(){var s=this.get(a);this.get(k).setContent(this.get("label"));if(s){this.get(q).setAttribute(a,s);}else{this.get(q).set("tabIndex",0);}},bindUI:function(){var s=this.get(q);s.on("click",this._defClickFn,this);s.on("mouseup",this._mouseUp,this);s.on("mousedown",this._mouseDown,this);s.after("tabindexChange",this._afterTabindexChange,this);},syncUI:function(){this._updateDefault(this.get(p));this._updateEnabled(this.get(r));this._updateTabindex(this.get(b));},disable:function(){this.set(r,false);return this;},enable:function(){this.set(r,true);return this;},setTitle:function(s){this.get(q).set(l,s);return this;},_defClickFn:function(t){var s=this.get(a);if(!this.get(r)){t.preventDefault();return;}if(!s||s==="#"){t.preventDefault();}this.fire(h,{click:t});},_defPressFn:function(s){this._executeCallback(s);},_mouseUp:function(){this.get(q).removeClass(this._className+j);this._mouseIsDown=false;if(this._mouseListener!==null){this._mouseListener.detach();this._mouseListener=null;}},_mouseDown:function(){if(this.get(r)){this.get(q).addClass(this._className+j);this._mouseIsDown=true;if(this._mouseListener===null){this._mouseListener=d.on("mouseup",d.bind(this._listenForMouseUp,this));}}},_listenForMouseUp:function(){this._mouseUp();},_afterEnabledChanged:function(s){this._updateEnabled(s.newVal);},_updateEnabled:function(s){var u=this.get(q),t=this._className+c;if(s){u.removeClass(t);u.removeAttribute(o);}else{u.addClass(t);u.removeClass(this._className+j);u.setAttribute(o,o);}},_afterDefaultChanged:function(s){this._updateDefault(s.newVal);},_updateDefault:function(t){var u=this.get(q),s=this._className+f;if(t){u.addClass(s);u.setAttribute(p,p);}else{u.removeClass(s);u.set(p,"");}},_executeCallback:function(s){if(this.get("callback")){(this.get("callback"))(s);}else{(this._callbackFromType())(s);}},_iconSetterFn:function(s){this.get(q).replaceClass(i.getClassName(e,this.get(e)||p),i.getClassName(e,s||p));return s;},_labelSetterFn:function(s){if(!s||s===""){this.get(q).addClass(this.getClassName(g));}else{this.get(q).removeClass(this.getClassName(g));}this.get(k).setContent(s);this.set(l,s);return s;},_titleSetterFn:function(s){this.get(q).set(l,s);return s;},_callbackFromType:function(){var t=this.get(q),s=t.ancestor("form");switch(this.get("type")){case"submit":if(s){return d.bind(s.submit,s);}break;case"reset":if(s){return d.bind(s.reset,s);}break;}return function(){};},_afterTabindexChange:function(s){this._updateTabindex(s.newVal);},_updateTabindex:function(t){var s=this.get(q);if(t!==undefined&&t!==null){s.setAttribute(b,t);}else{s.removeAttribute(b);}}},{EVENTS:{PRESS:h},ATTRS:{label:{value:"",validator:m.isString,setter:"_labelSetterFn",lazyAdd:false},callback:{validator:m.isFunction},enabled:{value:true,validator:m.isBoolean},DEFAULT:{value:false,validator:m.isBoolean},icon:{value:p,setter:"_iconSetterFn",lazyAdd:false},href:{value:null},title:{validator:m.isString,setter:"_titleSetterFn"},tabindex:{value:0},type:{value:"push",validator:m.isString,lazyAdd:false}},HTML_PARSER:{enabled:function(s){return !s.get(o);},label:function(s){if(s.getAttribute("value")){return s.getAttribute("value");}if(s.get(n)){return s.get(n);}if(s.get("tagName")==="INPUT"){switch(s.get("type")){case"reset":return"Reset";case"submit":return"Submit";}}return null;},href:function(t){var s=t.getAttribute(a);if(s){return s;}return null;},type:function(t){var s=t.getAttribute("type");if(s){return s;}return null;},title:function(s){if(s.getAttribute(l)){return s.getAttribute(l);}if(s.getAttribute("value")){return s.getAttribute("value");}if(s.get(n)){return s.get(n);}return null;}}});},"gallery-2011.02.02-21-07",{requires:["widget","event-mouseenter","widget-child"]});
View
174 build/gallery-button/gallery-button.js
@@ -11,13 +11,14 @@ var YL = Y.Lang,
CLASS_PRESSED = '-pressed',
CLASS_DEFAULT = '-default',
CLASS_DISABLED = '-disabled',
- CLASS_NO_LABEL = '-no-label',
+ CLASS_NO_LABEL = 'no-label',
BOUNDING_BOX = 'boundingBox',
CONTENT_BOX = 'contentBox',
DEFAULT = 'default',
ENABLED = 'enabled',
DISABLED = 'disabled',
HREF = 'href',
+ TAB_INDEX = 'tabindex',
ICON = 'icon',
TITLE = 'title',
INNER_HTML = 'innerHTML';
@@ -54,13 +55,15 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
* @since 1.0.0
*/
renderUI : function(){
- var href = this.get(HREF);
-
- this.get(CONTENT_BOX).setContent(this.get('label'));
-
- if(href) {
- this.get(BOUNDING_BOX).setAttribute(HREF, href);
- }
+ var href = this.get(HREF);
+
+ this.get(CONTENT_BOX).setContent(this.get('label'));
+
+ if(href) {
+ this.get(BOUNDING_BOX).setAttribute(HREF, href);
+ } else {
+ this.get(BOUNDING_BOX).set('tabIndex',0);
+ }
},
/**
@@ -76,6 +79,7 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
bb.on('click', this._defClickFn, this);
bb.on('mouseup', this._mouseUp, this);
bb.on('mousedown', this._mouseDown, this);
+ bb.after('tabindexChange', this._afterTabindexChange, this);
},
/**
@@ -87,6 +91,7 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
syncUI : function() {
this._updateDefault(this.get(DEFAULT));
this._updateEnabled(this.get(ENABLED));
+ this._updateTabindex(this.get(TAB_INDEX));
},
/**
@@ -98,7 +103,7 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
*/
disable : function() {
this.set(ENABLED, false);
- return this;
+ return this;
},
/**
@@ -110,7 +115,7 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
*/
enable : function() {
this.set(ENABLED, true);
- return this;
+ return this;
},
/**
@@ -133,16 +138,16 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
*
*/
_defClickFn : function(e) {
- var href = this.get(HREF);
-
- if (!this.get(ENABLED)) {
- e.preventDefault();
- return;
- }
-
- if(!href || href === '#') {
- e.preventDefault();
- }
+ var href = this.get(HREF);
+
+ if (!this.get(ENABLED)) {
+ e.preventDefault();
+ return;
+ }
+
+ if(!href || href === '#') {
+ e.preventDefault();
+ }
this.fire(EVENT_PRESS, {click : e});
},
@@ -169,7 +174,7 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
if(this._mouseListener !== null) {
this._mouseListener.detach();
this._mouseListener = null;
- }
+ }
},
/**
@@ -181,7 +186,7 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
_mouseDown : function() {
if(this.get(ENABLED)) {
this.get(BOUNDING_BOX).addClass(this._className + CLASS_PRESSED);
- this._mouseIsDown = true;
+ this._mouseIsDown = true;
if(this._mouseListener === null) {
this._mouseListener = Y.on('mouseup',Y.bind(this._listenForMouseUp,this));
}
@@ -221,11 +226,11 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
if(status) {
bb.removeClass(disableClass);
- bb.set(DISABLED,'');
+ bb.removeAttribute(DISABLED);
}else{
bb.addClass(disableClass);
bb.removeClass(this._className + CLASS_PRESSED);
- bb.set(DISABLED,DISABLED);
+ bb.setAttribute(DISABLED,DISABLED);
}
},
@@ -271,8 +276,8 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
if(this.get('callback')) {
(this.get('callback'))(e);
}else{
- (this._callbackFromType())(e);
- }
+ (this._callbackFromType())(e);
+ }
},
/**
@@ -299,9 +304,9 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
*/
_labelSetterFn : function(val) {
if (!val || val === '') {
- this.get(BOUNDING_BOX).addClass(this._className + CLASS_NO_LABEL);
+ this.get(BOUNDING_BOX).addClass(this.getClassName(CLASS_NO_LABEL));
} else {
- this.get(BOUNDING_BOX).removeClass(this._className + CLASS_NO_LABEL);
+ this.get(BOUNDING_BOX).removeClass(this.getClassName(CLASS_NO_LABEL));
}
this.get(CONTENT_BOX).setContent(val);
this.set(TITLE, val);
@@ -332,18 +337,32 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
*/
_callbackFromType : function() {
var bb = this.get(BOUNDING_BOX),
- frm = bb.ancestor('form');
+ frm = bb.ancestor('form');
+
+ switch (this.get('type')) {
+ case 'submit':
+ if (frm) { return Y.bind(frm.submit, frm); }
+ break;
+ case 'reset':
+ if (frm) { return Y.bind(frm.reset, frm); }
+ break;
+ }
- switch (this.get('type')) {
- case 'submit':
- if (frm) { return Y.bind(frm.submit, frm); }
- break;
- case 'reset':
- if (frm) { return Y.bind(frm.reset, frm); }
- break;
- }
+ return function(){};
+ },
+
+ _afterTabindexChange : function(e) {
+ this._updateTabindex(e.newVal);
+ },
- return function(){};
+ _updateTabindex : function(val) {
+ var bb = this.get(BOUNDING_BOX);
+
+ if (val !== undefined && val !== null) {
+ bb.setAttribute(TAB_INDEX, val);
+ } else {
+ bb.removeAttribute(TAB_INDEX);
+ }
}
}, {
@@ -369,22 +388,25 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
validator : YL.isBoolean
},
icon : {
- value : DEFAULT,
+ value : DEFAULT,
setter : '_iconSetterFn',
- lazyAdd : false
+ lazyAdd : false
+ },
+ href : {
+ value : null
},
- href : {
- value : null
- },
title : {
validator : YL.isString,
setter : '_titleSetterFn'
},
+ tabindex : {
+ value : 0
+ },
type : {
value : 'push',
validator : YL.isString,
lazyAdd : false
- }
+ }
},
/**
* HTML Parser assumes srcNode is either a &lt;button&gt; or
@@ -394,62 +416,62 @@ Y.Button = Y.Base.create('button',Y.Widget, [Y.WidgetChild], {
HTML_PARSER : {
enabled : function(srcNode) {
- return !srcNode.get(DISABLED);
- },
-
+ return !srcNode.get(DISABLED);
+ },
+
label : function(srcNode) {
if(srcNode.getAttribute('value')) {
return srcNode.getAttribute('value');
}
if(srcNode.get(INNER_HTML)) {
return srcNode.get(INNER_HTML);
}
-
- // default form button labels based on type
- if(srcNode.get('tagName') === 'INPUT') {
- switch (srcNode.get('type')) {
- case 'reset' : return 'Reset';
- case 'submit' : return 'Submit';
- }
- }
-
+
+ // default form button labels based on type
+ if(srcNode.get('tagName') === 'INPUT') {
+ switch (srcNode.get('type')) {
+ case 'reset' : return 'Reset';
+ case 'submit' : return 'Submit';
+ }
+ }
+
return null;
},
-
- href : function(srcNode) {
- var href = srcNode.getAttribute(HREF);
- if(href) {
- return href;
- }
+ href : function(srcNode) {
+ var href = srcNode.getAttribute(HREF);
+
+ if(href) {
+ return href;
+ }
+
+ return null;
+ },
- return null;
- },
-
- type : function(srcNode) {
- var type = srcNode.getAttribute('type');
+ type : function(srcNode) {
+ var type = srcNode.getAttribute('type');
+
+ if(type) {
+ return type;
+ }
+ return null;
+ },
- if(type) {
- return type;
- }
- return null;
- },
-
title : function(srcNode) {
if(srcNode.getAttribute(TITLE)) {
return srcNode.getAttribute(TITLE);
}
- if(srcNode.getAttribute('value')) {
+ if(srcNode.getAttribute('value')) {
return srcNode.getAttribute('value');
}
if(srcNode.get(INNER_HTML)) {
return srcNode.get(INNER_HTML);
}
return null;
- }
+ }
}
});
-}, 'gallery-2010.12.10-17-31' ,{requires:['widget','event-mouseenter','widget-child']});
+}, 'gallery-2011.02.02-21-07' ,{requires:['widget','event-mouseenter','widget-child']});
View
106 build/gallery-dialog/gallery-dialog-debug.js
@@ -1,20 +1,16 @@
YUI.add('gallery-dialog', function(Y) {
var YL = Y.Lang,
- LABEL = {
- CANCEL : 'Cancel',
- OK : 'OK'
- },
- CALLBACK = {
- CANCEL : 'cancel',
- OK : 'ok'
- },
+ LABEL_CANCEL = 'Cancel',
+ LABEL_OK = 'OK',
+ CALLBACK_CANCEL = 'cancel',
+ CALLBACK_OK = 'ok',
EMPTY_FN = function(){},
ATTR_CALLBACKS = 'callbacks',
ATTR_DEFAULT_BUTTON = 'defaultButton',
ATTR_DRAGGABLE = 'draggable',
ATTR_RETURN_VAL = 'returnVal',
- ATTR_TYPE = 'type';
+ ATTR_ICON = 'icon';
Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
@@ -49,15 +45,10 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
Y.one('body').set('tabIndex',-1).focus();
Y.Dialog.superclass.hide.apply(this,arguments);
- var fn = (callbackType) ? this.getCallback(callbackType) : null;
+ var fn = (callbackType) ? this.getCallback(callbackType) : this.getCallback(CALLBACK_CANCEL);
if(YL.isFunction(fn)) {
(Y.bind(fn,this,this.get(ATTR_RETURN_VAL)))();
this.set(ATTR_RETURN_VAL,null);
- }else{
- fn = this.getCallback(CALLBACK.CANCEL);
- if(fn) {
- (fn)();
- }
}
this.anim.get('animHide').on('end',Y.bind(function(){
@@ -74,16 +65,17 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
Y.log('initializer','info','Y.Dialog');
this.get(ATTR_DRAGGABLE);
- this.handleEscape = Y.once('esc',Y.bind(function(){this.hide();},this),Y.config.doc);
+ this.handleEscape = Y.once('esc', Y.bind(function(){ this.hide(); }, this), Y.config.doc);
Y.Dialog.superclass.show.apply(this,arguments);
+ this.syncUI();
var dBtn = this.get(ATTR_DEFAULT_BUTTON);
if(dBtn) {
dBtn.focus();
}
- this.get('boundingBox').set('tabIndex',-1);
+ this.get('boundingBox').set('tabIndex', -1);
},
/**
@@ -96,7 +88,7 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
*/
header : function(content, placement) {
Y.log('initializer','info','Y.Dialog');
- this._setContent(Y.WidgetStdMod.HEADER,content,placement);
+ this._setContent(Y.WidgetStdMod.HEADER, content, placement);
},
/**
@@ -109,7 +101,7 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
*/
body : function(content, placement) {
Y.log('initializer','info','Y.Dialog');
- this._setContent(Y.WidgetStdMod.BODY,content,placement);
+ this._setContent(Y.WidgetStdMod.BODY, content, placement);
},
/**
@@ -122,7 +114,7 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
*/
footer : function(content, placement) {
Y.log('initializer','info','Y.Dialog');
- this._setContent(Y.WidgetStdMod.FOOTER,content,placement);
+ this._setContent(Y.WidgetStdMod.FOOTER, content, placement);
},
/**
@@ -135,7 +127,8 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
*/
build : function(header, body, buttons) {
Y.log('initializer','info','Y.Dialog');
- var i,l,btn;
+
+ var i, l, btn;
this.purge();
@@ -153,7 +146,7 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
btn = buttons[i];
btn.render();
if(btn.get('default')) {
- this.set(ATTR_DEFAULT_BUTTON,btn);
+ this.set(ATTR_DEFAULT_BUTTON, btn);
}
this.footer(btn.get('boundingBox'), 'after');
@@ -206,13 +199,13 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
* @returns this
*/
addCloseButton : function() {
- Y.log('addCloseButton','info','Y.Dialog');
+ Y.log('addCloseButton', 'info', 'Y.Dialog');
var btn = new Y.Button({
label: "X",
callback: Y.bind(function(e){
this.hide();
},this),
- type: 'close'
+ title: 'Close'
});
btn.render();
this.header(btn.get('boundingBox'),'after');
@@ -241,14 +234,14 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
*/
alert: function(msg, title, callback){
Y.log('initializer','info','Y.Dialog');
- this.set(ATTR_TYPE,'alert');
+ this.set(ATTR_ICON,'alert');
- this.addCallback(CALLBACK.CANCEL, callback || EMPTY_FN);
+ this.addCallback(CALLBACK_CANCEL, callback || EMPTY_FN);
var header = title || this._getDefaultTitle(),
body = msg || null,
okBtn = new Y.Button({
- label: LABEL.OK,
+ label: LABEL_OK,
callback: Y.bind(function(e){
this.hide();
},this),
@@ -268,22 +261,22 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
*/
confirm: function(msg, title, okCallback, cancelCallback){
Y.log('initializer','info','Y.Dialog');
- this.set(ATTR_TYPE,'confirm');
+ this.set(ATTR_ICON,'confirm');
- this.addCallback(CALLBACK.OK, okCallback || EMPTY_FN);
- this.addCallback(CALLBACK.CANCEL, cancelCallback || EMPTY_FN);
+ this.addCallback(CALLBACK_OK, okCallback || EMPTY_FN);
+ this.addCallback(CALLBACK_CANCEL, cancelCallback || EMPTY_FN);
var header = title || this._getDefaultTitle(),
body = msg || null,
okBtn = new Y.Button({
- label: LABEL.OK,
+ label: LABEL_OK,
callback: Y.bind(function(e){
- this.hide(CALLBACK.OK);
+ this.hide(CALLBACK_OK);
},this),
'default': true
}),
cancelBtn = new Y.Button({
- label: LABEL.CANCEL,
+ label: LABEL_CANCEL,
callback: Y.bind(function(e){
this.hide();
},this)
@@ -304,22 +297,22 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
*/
prompt: function(msg, title, okCallback, cancelCallback){
Y.log('initializer','info','Y.Dialog');
- this.set(ATTR_TYPE,'prompt');
+ this.set(ATTR_ICON,'prompt');
- this.addCallback(CALLBACK.OK, okCallback || EMPTY_FN);
- this.addCallback(CALLBACK.CANCEL, cancelCallback || EMPTY_FN);
+ this.addCallback(CALLBACK_OK, okCallback || EMPTY_FN);
+ this.addCallback(CALLBACK_CANCEL, cancelCallback || EMPTY_FN);
var header = title || this._getDefaultTitle(),
body = msg || null, promptInput,
okBtn = new Y.Button({
- label: LABEL.OK,
+ label: LABEL_OK,
callback: Y.bind(function(e){
- this.hide(CALLBACK.OK);
+ this.hide(CALLBACK_OK);
},this),
'default': true
}),
cancelBtn = new Y.Button({
- label: LABEL.CANCEL,
+ label: LABEL_CANCEL,
callback: Y.bind(function(e){
this.hide();
},this)
@@ -330,24 +323,20 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
// need to build the input box and bind the events to it
// then append it to the body
promptInput = Y.Node.create('<input type="text" style="display: block; margin-top: 0.5em;">');
- if(Y.UA.ie < 8) {
- promptInput.setStyle('width','300px');
- }else{
- promptInput.setStyle('width','100%');
- }
+ promptInput.addClass(this.getClassName('prompt'));
- promptInput.on('keyup',Y.bind(function(e){
+ promptInput.on('keyup', Y.bind(function(e){
this.set(ATTR_RETURN_VAL, promptInput.get('value'));
},this));
- this.handleEnter = Y.once('enter',Y.bind(function(e){
+ this.handleEnter = Y.once('enter', Y.bind(function(e){
var defBtn = this.get(ATTR_DEFAULT_BUTTON);
if(defBtn) {
defBtn.fire('press');
}
},this),promptInput);
- this.body(promptInput,'after');
+ this.body(promptInput, 'after');
this.addCloseButton().show();
},
@@ -390,7 +379,7 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
_setContent : function(section, content, placement) {
Y.log('_setContent','info','Y.Dialog');
- this.setStdModContent(section,content,this._standardizePlacement(placement));
+ this.setStdModContent(section, content, this._standardizePlacement(placement));
},
/**
@@ -418,17 +407,25 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
},{
ATTRS : {
+
+ centered : {
+ value : true
+ },
+
callbacks : {
value : {}
},
+
constrain : {
value : true
},
+
defaultButton : {
validator : function(val) {
return (val instanceof Y.Button);
}
},
+
draggable : {
value : true,
validator : YL.isBoolean,
@@ -437,30 +434,35 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
return val;
}
},
+
render : {
value : true
},
+
returnVal : {
value : null
},
- type : {
+
+ icon : {
validator : YL.isString,
setter : function(val) {
this.get('boundingBox').replaceClass(
- this.getClassName(ATTR_TYPE, this.get(ATTR_TYPE) || 'default'),
- this.getClassName(ATTR_TYPE, val || 'default')
+ this.getClassName(ATTR_ICON, this.get(ATTR_ICON) || 'default'),
+ this.getClassName(ATTR_ICON, val || 'default')
);
return val;
}
},
+
visible : {
value : false
},
+
zIndex : {
value : 20000
}
}
});
-}, 'gallery-2010.09.08-19-45' ,{requires:['gallery-overlay-extras','gallery-button','overlay','widget-anim','node','gallery-event-nav-keys','dd']});
+}, 'gallery-2011.02.02-21-07' ,{requires:['gallery-overlay-extras','gallery-button','overlay','widget-anim','node','gallery-event-nav-keys','dd-plugin']});
View
2 build/gallery-dialog/gallery-dialog-min.js
@@ -1 +1 @@
-YUI.add("gallery-dialog",function(B){var I=B.Lang,E={CANCEL:"Cancel",OK:"OK"},D={CANCEL:"cancel",OK:"ok"},C=function(){},J="callbacks",H="defaultButton",G="draggable",F="returnVal",A="type";B.Dialog=B.Base.create("dialog",B.Overlay,[],{handleEnter:null,handleEscape:null,initializer:function(K){this.plug(B.Plugin.WidgetAnim);this.plug(B.Plugin.OverlayModal);this.plug(B.Plugin.OverlayKeepaligned);},hide:function(L){B.one("body").set("tabIndex",-1).focus();B.Dialog.superclass.hide.apply(this,arguments);var K=(L)?this.getCallback(L):null;if(I.isFunction(K)){(B.bind(K,this,this.get(F)))();this.set(F,null);}else{K=this.getCallback(D.CANCEL);if(K){(K)();}}this.anim.get("animHide").on("end",B.bind(function(){this.purge();},this));},show:function(){this.get(G);this.handleEscape=B.once("esc",B.bind(function(){this.hide();},this),B.config.doc);B.Dialog.superclass.show.apply(this,arguments);var K=this.get(H);if(K){K.focus();}this.get("boundingBox").set("tabIndex",-1);},header:function(L,K){this._setContent(B.WidgetStdMod.HEADER,L,K);},body:function(L,K){this._setContent(B.WidgetStdMod.BODY,L,K);},footer:function(L,K){this._setContent(B.WidgetStdMod.FOOTER,L,K);},build:function(P,K,O){var N,L,M;this.purge();if(P){this.header(P);}if(K){this.body(K||null);}if(O){for(N=0,L=O.length;N<L;N++){M=O[N];M.render();if(M.get("default")){this.set(H,M);}this.footer(M.get("boundingBox"),"after");}}return this;},getCallback:function(K){return(this.get(J)[K]||null);},addCallback:function(L,K){if(I.isFunction(K)){this.get(J)[L]=K;}},removeCallback:function(K){if(this.get(J)[K]){this.get(J)[K]=null;}},addCloseButton:function(){var K=new B.Button({label:"X",callback:B.bind(function(L){this.hide();},this),type:"close"});K.render();this.header(K.get("boundingBox"),"after");return this;},purge:function(){this.header(null);this.body(null);this.footer(null);},alert:function(N,M,P){this.set(A,"alert");this.addCallback(D.CANCEL,P||C);var O=M||this._getDefaultTitle(),K=N||null,L=new B.Button({label:E.OK,callback:B.bind(function(Q){this.hide();},this),"default":true});this.build(O,K,[L]).addCloseButton().show();},confirm:function(Q,P,O,L){this.set(A,"confirm");this.addCallback(D.OK,O||C);this.addCallback(D.CANCEL,L||C);var R=P||this._getDefaultTitle(),K=Q||null,M=new B.Button({label:E.OK,callback:B.bind(function(S){this.hide(D.OK);},this),"default":true}),N=new B.Button({label:E.CANCEL,callback:B.bind(function(S){this.hide();},this)});this.build(R,K,[M,N]).addCloseButton().show();},prompt:function(K,Q,N,S){this.set(A,"prompt");this.addCallback(D.OK,N||C);this.addCallback(D.CANCEL,S||C);var L=Q||this._getDefaultTitle(),M=K||null,R,O=new B.Button({label:E.OK,callback:B.bind(function(T){this.hide(D.OK);},this),"default":true}),P=new B.Button({label:E.CANCEL,callback:B.bind(function(T){this.hide();},this)});this.build(L,M,[O,P]);R=B.Node.create('<input type="text" style="display: block; margin-top: 0.5em;">');if(B.UA.ie<8){R.setStyle("width","300px");}else{R.setStyle("width","100%");}R.on("keyup",B.bind(function(T){this.set(F,R.get("value"));},this));this.handleEnter=B.once("enter",B.bind(function(U){var T=this.get(H);if(T){T.fire("press");}},this),R);this.body(R,"after");this.addCloseButton().show();},_getDefaultTitle:function(){return"The page "+location.protocol+"//"+location.host+"/ says:";},_updateDraggable:function(K){var M=this.get("boundingBox"),L=M.all(".yui3-widget-hd");if(K){M.plug(B.Plugin.Drag,{handle:L}).dd.plug(B.Plugin.DDConstrained,{constrain2view:true,gutter:"20"});}else{M.unplug(B.Plugin.Drag).unplug(B.Plugin.DDContrained);}},_setContent:function(M,L,K){this.setStdModContent(M,L,this._standardizePlacement(K));},_standardizePlacement:function(K){var L=(I.isString(K))?K.toLowerCase():null;switch(L){case"prepend":case"before":return B.WidgetStdMod.BEFORE;case"append":case"after":return B.WidgetStdMod.AFTER;default:return B.WidgetStdMod.REPLACE;}}},{ATTRS:{callbacks:{value:{}},constrain:{value:true},defaultButton:{validator:function(K){return(K instanceof B.Button);}},draggable:{value:true,validator:I.isBoolean,setter:function(K){this._updateDraggable(K);return K;}},render:{value:true},returnVal:{value:null},type:{validator:I.isString,setter:function(K){this.get("boundingBox").replaceClass(this.getClassName(A,this.get(A)||"default"),this.getClassName(A,K||"default"));return K;}},visible:{value:false},zIndex:{value:20000}}});},"gallery-2010.09.08-19-45",{requires:["gallery-overlay-extras","gallery-button","overlay","widget-anim","node","gallery-event-nav-keys","dd"]});
+YUI.add("gallery-dialog",function(a){var h=a.Lang,i="Cancel",k="OK",l="cancel",d="ok",c=function(){},j="callbacks",g="defaultButton",f="draggable",e="returnVal",b="icon";a.Dialog=a.Base.create("dialog",a.Overlay,[],{handleEnter:null,handleEscape:null,initializer:function(m){this.plug(a.Plugin.WidgetAnim);this.plug(a.Plugin.OverlayModal);this.plug(a.Plugin.OverlayKeepaligned);},hide:function(n){a.one("body").set("tabIndex",-1).focus();a.Dialog.superclass.hide.apply(this,arguments);var m=(n)?this.getCallback(n):this.getCallback(l);if(h.isFunction(m)){(a.bind(m,this,this.get(e)))();this.set(e,null);}this.anim.get("animHide").on("end",a.bind(function(){this.purge();},this));},show:function(){this.get(f);this.handleEscape=a.once("esc",a.bind(function(){this.hide();},this),a.config.doc);a.Dialog.superclass.show.apply(this,arguments);this.syncUI();var m=this.get(g);if(m){m.focus();}this.get("boundingBox").set("tabIndex",-1);},header:function(n,m){this._setContent(a.WidgetStdMod.HEADER,n,m);},body:function(n,m){this._setContent(a.WidgetStdMod.BODY,n,m);},footer:function(n,m){this._setContent(a.WidgetStdMod.FOOTER,n,m);},build:function(r,m,q){var p,n,o;this.purge();if(r){this.header(r);}if(m){this.body(m||null);}if(q){for(p=0,n=q.length;p<n;p++){o=q[p];o.render();if(o.get("default")){this.set(g,o);}this.footer(o.get("boundingBox"),"after");}}return this;},getCallback:function(m){return(this.get(j)[m]||null);},addCallback:function(n,m){if(h.isFunction(m)){this.get(j)[n]=m;}},removeCallback:function(m){if(this.get(j)[m]){this.get(j)[m]=null;}},addCloseButton:function(){var m=new a.Button({label:"X",callback:a.bind(function(n){this.hide();},this),title:"Close"});m.render();this.header(m.get("boundingBox"),"after");return this;},purge:function(){this.header(null);this.body(null);this.footer(null);},alert:function(p,o,r){this.set(b,"alert");this.addCallback(l,r||c);var q=o||this._getDefaultTitle(),m=p||null,n=new a.Button({label:k,callback:a.bind(function(s){this.hide();},this),"default":true});this.build(q,m,[n]).addCloseButton().show();},confirm:function(s,r,q,n){this.set(b,"confirm");this.addCallback(d,q||c);this.addCallback(l,n||c);var t=r||this._getDefaultTitle(),m=s||null,o=new a.Button({label:k,callback:a.bind(function(u){this.hide(d);},this),"default":true}),p=new a.Button({label:i,callback:a.bind(function(u){this.hide();},this)});this.build(t,m,[o,p]).addCloseButton().show();},prompt:function(m,s,p,u){this.set(b,"prompt");this.addCallback(d,p||c);this.addCallback(l,u||c);var n=s||this._getDefaultTitle(),o=m||null,t,q=new a.Button({label:k,callback:a.bind(function(v){this.hide(d);},this),"default":true}),r=new a.Button({label:i,callback:a.bind(function(v){this.hide();},this)});this.build(n,o,[q,r]);t=a.Node.create('<input type="text" style="display: block; margin-top: 0.5em;">');t.addClass(this.getClassName("prompt"));t.on("keyup",a.bind(function(v){this.set(e,t.get("value"));},this));this.handleEnter=a.once("enter",a.bind(function(w){var v=this.get(g);if(v){v.fire("press");}},this),t);this.body(t,"after");this.addCloseButton().show();},_getDefaultTitle:function(){return"The page "+location.protocol+"//"+location.host+"/ says:";},_updateDraggable:function(m){var o=this.get("boundingBox"),n=o.all(".yui3-widget-hd");if(m){o.plug(a.Plugin.Drag,{handle:n}).dd.plug(a.Plugin.DDConstrained,{constrain2view:true,gutter:"20"});}else{o.unplug(a.Plugin.Drag).unplug(a.Plugin.DDContrained);}},_setContent:function(o,n,m){this.setStdModContent(o,n,this._standardizePlacement(m));},_standardizePlacement:function(m){var n=(h.isString(m))?m.toLowerCase():null;switch(n){case"prepend":case"before":return a.WidgetStdMod.BEFORE;case"append":case"after":return a.WidgetStdMod.AFTER;default:return a.WidgetStdMod.REPLACE;}}},{ATTRS:{centered:{value:true},callbacks:{value:{}},constrain:{value:true},defaultButton:{validator:function(m){return(m instanceof a.Button);}},draggable:{value:true,validator:h.isBoolean,setter:function(m){this._updateDraggable(m);return m;}},render:{value:true},returnVal:{value:null},icon:{validator:h.isString,setter:function(m){this.get("boundingBox").replaceClass(this.getClassName(b,this.get(b)||"default"),this.getClassName(b,m||"default"));return m;}},visible:{value:false},zIndex:{value:20000}}});},"gallery-2011.02.02-21-07",{requires:["gallery-overlay-extras","gallery-button","overlay","widget-anim","node","gallery-event-nav-keys","dd-plugin"]});
View
104 build/gallery-dialog/gallery-dialog.js
@@ -1,20 +1,16 @@
YUI.add('gallery-dialog', function(Y) {
var YL = Y.Lang,
- LABEL = {
- CANCEL : 'Cancel',
- OK : 'OK'
- },
- CALLBACK = {
- CANCEL : 'cancel',
- OK : 'ok'
- },
+ LABEL_CANCEL = 'Cancel',
+ LABEL_OK = 'OK',
+ CALLBACK_CANCEL = 'cancel',
+ CALLBACK_OK = 'ok',
EMPTY_FN = function(){},
ATTR_CALLBACKS = 'callbacks',
ATTR_DEFAULT_BUTTON = 'defaultButton',
ATTR_DRAGGABLE = 'draggable',
ATTR_RETURN_VAL = 'returnVal',
- ATTR_TYPE = 'type';
+ ATTR_ICON = 'icon';
Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
@@ -47,15 +43,10 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
Y.one('body').set('tabIndex',-1).focus();
Y.Dialog.superclass.hide.apply(this,arguments);
- var fn = (callbackType) ? this.getCallback(callbackType) : null;
+ var fn = (callbackType) ? this.getCallback(callbackType) : this.getCallback(CALLBACK_CANCEL);
if(YL.isFunction(fn)) {
(Y.bind(fn,this,this.get(ATTR_RETURN_VAL)))();
this.set(ATTR_RETURN_VAL,null);
- }else{
- fn = this.getCallback(CALLBACK.CANCEL);
- if(fn) {
- (fn)();
- }
}
this.anim.get('animHide').on('end',Y.bind(function(){
@@ -71,16 +62,17 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
show : function() {
this.get(ATTR_DRAGGABLE);
- this.handleEscape = Y.once('esc',Y.bind(function(){this.hide();},this),Y.config.doc);
+ this.handleEscape = Y.once('esc', Y.bind(function(){ this.hide(); }, this), Y.config.doc);
Y.Dialog.superclass.show.apply(this,arguments);
+ this.syncUI();
var dBtn = this.get(ATTR_DEFAULT_BUTTON);
if(dBtn) {
dBtn.focus();
}
- this.get('boundingBox').set('tabIndex',-1);
+ this.get('boundingBox').set('tabIndex', -1);
},
/**
@@ -92,7 +84,7 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
* @see _standardizePlacement
*/
header : function(content, placement) {
- this._setContent(Y.WidgetStdMod.HEADER,content,placement);
+ this._setContent(Y.WidgetStdMod.HEADER, content, placement);
},
/**
@@ -104,7 +96,7 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
* @see _standardizePlacement
*/
body : function(content, placement) {
- this._setContent(Y.WidgetStdMod.BODY,content,placement);
+ this._setContent(Y.WidgetStdMod.BODY, content, placement);
},
/**
@@ -116,7 +108,7 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
* @see _standardizePlacement
*/
footer : function(content, placement) {
- this._setContent(Y.WidgetStdMod.FOOTER,content,placement);
+ this._setContent(Y.WidgetStdMod.FOOTER, content, placement);
},
/**
@@ -128,7 +120,8 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
* @return this
*/
build : function(header, body, buttons) {
- var i,l,btn;
+
+ var i, l, btn;
this.purge();
@@ -146,7 +139,7 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
btn = buttons[i];
btn.render();
if(btn.get('default')) {
- this.set(ATTR_DEFAULT_BUTTON,btn);
+ this.set(ATTR_DEFAULT_BUTTON, btn);
}
this.footer(btn.get('boundingBox'), 'after');
@@ -201,7 +194,7 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
callback: Y.bind(function(e){
this.hide();
},this),
- type: 'close'
+ title: 'Close'
});
btn.render();
this.header(btn.get('boundingBox'),'after');
@@ -228,14 +221,14 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
* @param cancelCallback Function | null
*/
alert: function(msg, title, callback){
- this.set(ATTR_TYPE,'alert');
+ this.set(ATTR_ICON,'alert');
- this.addCallback(CALLBACK.CANCEL, callback || EMPTY_FN);
+ this.addCallback(CALLBACK_CANCEL, callback || EMPTY_FN);
var header = title || this._getDefaultTitle(),
body = msg || null,
okBtn = new Y.Button({
- label: LABEL.OK,
+ label: LABEL_OK,
callback: Y.bind(function(e){
this.hide();
},this),
@@ -254,22 +247,22 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
* @param cancelCallback Function | null
*/
confirm: function(msg, title, okCallback, cancelCallback){
- this.set(ATTR_TYPE,'confirm');
+ this.set(ATTR_ICON,'confirm');
- this.addCallback(CALLBACK.OK, okCallback || EMPTY_FN);
- this.addCallback(CALLBACK.CANCEL, cancelCallback || EMPTY_FN);
+ this.addCallback(CALLBACK_OK, okCallback || EMPTY_FN);
+ this.addCallback(CALLBACK_CANCEL, cancelCallback || EMPTY_FN);
var header = title || this._getDefaultTitle(),
body = msg || null,
okBtn = new Y.Button({
- label: LABEL.OK,
+ label: LABEL_OK,
callback: Y.bind(function(e){
- this.hide(CALLBACK.OK);
+ this.hide(CALLBACK_OK);
},this),
'default': true
}),
cancelBtn = new Y.Button({
- label: LABEL.CANCEL,
+ label: LABEL_CANCEL,
callback: Y.bind(function(e){
this.hide();
},this)
@@ -289,22 +282,22 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
* @param cancelCallback Function | null
*/
prompt: function(msg, title, okCallback, cancelCallback){
- this.set(ATTR_TYPE,'prompt');
+ this.set(ATTR_ICON,'prompt');
- this.addCallback(CALLBACK.OK, okCallback || EMPTY_FN);
- this.addCallback(CALLBACK.CANCEL, cancelCallback || EMPTY_FN);
+ this.addCallback(CALLBACK_OK, okCallback || EMPTY_FN);
+ this.addCallback(CALLBACK_CANCEL, cancelCallback || EMPTY_FN);
var header = title || this._getDefaultTitle(),
body = msg || null, promptInput,
okBtn = new Y.Button({
- label: LABEL.OK,
+ label: LABEL_OK,
callback: Y.bind(function(e){
- this.hide(CALLBACK.OK);
+ this.hide(CALLBACK_OK);
},this),
'default': true
}),
cancelBtn = new Y.Button({
- label: LABEL.CANCEL,
+ label: LABEL_CANCEL,
callback: Y.bind(function(e){
this.hide();
},this)
@@ -315,24 +308,20 @@ Y.Dialog = Y.Base.create('dialog', Y.Overlay, [], {
// need to build the input box and bind the events to it
// then append it to the body
promptInput = Y.Node.create('<input type="text" style="display: block; margin-top: 0.5em;">');
- if(Y.