From 5cc7ad725788a90ee979efecf02a14be50ac1c11 Mon Sep 17 00:00:00 2001 From: YUI Builder Date: Thu, 10 Nov 2011 08:26:12 -0800 Subject: [PATCH] Gallery Build Tag: gallery-2011.11.10-16-24 --- .../gallery-carousel-circular-min.css | 1 + .../gallery-carousel-circular.css | 48 ++ build/gallery-form/gallery-form-debug.js | 45 +- build/gallery-form/gallery-form-min.js | 8 +- build/gallery-form/gallery-form.js | 45 +- .../gallery-pulldown-refresh-min.css | 1 + .../gallery-pulldown-refresh.css | 56 ++ .../gallery-slidecheckbox-debug.js | 11 +- .../gallery-slidecheckbox-min.js | 2 +- .../gallery-slidecheckbox.js | 10 +- .../assets/gallery-slider-window-core.css | 193 ++++++ .../skins/sam/gallery-slider-window-skin.css | 0 .../skins/sam/gallery-slider-window.css | 1 + .../assets/sw_footer_bg.gif | Bin 0 -> 1245 bytes .../assets/sw_handle_bg.gif | Bin 0 -> 281 bytes .../assets/sw_header_bg.gif | Bin 0 -> 1465 bytes .../assets/sw_sprite.gif | Bin 0 -> 104 bytes .../assets/sw_t-handle_bg.gif | Bin 0 -> 79 bytes .../gallery-slider-window-debug.js | 633 ++++++++++++++++++ .../gallery-slider-window-min.js | 2 + .../gallery-slider-window.js | 602 +++++++++++++++++ .../gallery-yui-dualslider-debug.js | 13 +- .../gallery-yui-dualslider-min.js | 2 +- .../gallery-yui-dualslider.js | 13 +- 24 files changed, 1626 insertions(+), 60 deletions(-) create mode 100644 build/gallery-carousel-circular/gallery-carousel-circular-min.css create mode 100644 build/gallery-carousel-circular/gallery-carousel-circular.css create mode 100644 build/gallery-pulldown-refresh/gallery-pulldown-refresh-min.css create mode 100644 build/gallery-pulldown-refresh/gallery-pulldown-refresh.css create mode 100644 build/gallery-slider-window/assets/gallery-slider-window-core.css create mode 100644 build/gallery-slider-window/assets/skins/sam/gallery-slider-window-skin.css create mode 100644 build/gallery-slider-window/assets/skins/sam/gallery-slider-window.css create mode 100644 build/gallery-slider-window/assets/sw_footer_bg.gif create mode 100644 build/gallery-slider-window/assets/sw_handle_bg.gif create mode 100644 build/gallery-slider-window/assets/sw_header_bg.gif create mode 100644 build/gallery-slider-window/assets/sw_sprite.gif create mode 100644 build/gallery-slider-window/assets/sw_t-handle_bg.gif create mode 100644 build/gallery-slider-window/gallery-slider-window-debug.js create mode 100644 build/gallery-slider-window/gallery-slider-window-min.js create mode 100644 build/gallery-slider-window/gallery-slider-window.js diff --git a/build/gallery-carousel-circular/gallery-carousel-circular-min.css b/build/gallery-carousel-circular/gallery-carousel-circular-min.css new file mode 100644 index 0000000000..b3308cb73c --- /dev/null +++ b/build/gallery-carousel-circular/gallery-carousel-circular-min.css @@ -0,0 +1 @@ +.yui3-circular-carousel{-webkit-perspective:500px}.yui3-circular-carousel-item{position:absolute;height:200px;width:200px;border:1px solid black;-webkit-border-radius:12px;-webkit-box-sizing:border-box;text-align:center;font-family:Times,serif;font-size:124pt;color:black;background-color:rgba(148,116,172,0.6);-webkit-transition:-webkit-transform 2s,opacity 2s;-webkit-backface-visibility:hidden;position:absolute;-webkit-transition:.3s ease;-webkit-transform:rotate(0) scale(0.9) translateX(100%);z-index:0;width:200px;overflow:visible;opacity:0}.yui3-circular-carousel .yui3-circular-carousel-selected{opacity:1;-webkit-transform:rotate(0) scale(1) translateX(54%);z-index:99}.yui3-circular-carousel .yui3-circular-carousel-left,.yui3-circular-carousel .yui3-circular-carousel-right{opacity:.4;z-index:88}.yui3-circular-carousel .yui3-circular-carousel-left{-webkit-transform:rotate(0) scale(0.9) translateX(0%)}.yui3-circular-carousel .yui3-circular-carousel-right{-webkit-transform:rotate(0) scale(0.9) translateX(134%)} \ No newline at end of file diff --git a/build/gallery-carousel-circular/gallery-carousel-circular.css b/build/gallery-carousel-circular/gallery-carousel-circular.css new file mode 100644 index 0000000000..af445e651e --- /dev/null +++ b/build/gallery-carousel-circular/gallery-carousel-circular.css @@ -0,0 +1,48 @@ + +.yui3-circular-carousel{ + -webkit-perspective: 500px; +} + +.yui3-circular-carousel-item { + position: absolute; + height: 200px; + width: 200px; + border: 1px solid black; + -webkit-border-radius: 12px; + -webkit-box-sizing: border-box; + text-align: center; + font-family: Times, serif; + font-size: 124pt; + color: black; + background-color: rgba(148,116,172, 0.6); + -webkit-transition: -webkit-transform 2s, opacity 2s; + -webkit-backface-visibility: hidden; + position: absolute; + -webkit-transition: 0.3s ease; + -webkit-transform: rotate(0) scale(0.9) translateX(100%); + z-index: 0; + width: 200px; + overflow: visible; + opacity: 0; +} + +.yui3-circular-carousel .yui3-circular-carousel-selected{ + opacity: 1; + -webkit-transform: rotate(0) scale(1) translateX(54%); + z-index: 99; +} + +.yui3-circular-carousel .yui3-circular-carousel-left, +.yui3-circular-carousel .yui3-circular-carousel-right { + opacity: 0.4; + z-index: 88; +} + +.yui3-circular-carousel .yui3-circular-carousel-left { + -webkit-transform: rotate(0) scale(0.9) translateX(0%); +} + +.yui3-circular-carousel .yui3-circular-carousel-right { + -webkit-transform: rotate(0) scale(0.9) translateX(134%); +} + diff --git a/build/gallery-form/gallery-form-debug.js b/build/gallery-form/gallery-form-debug.js index bf33d70fcd..23ceb258ab 100644 --- a/build/gallery-form/gallery-form-debug.js +++ b/build/gallery-form/gallery-form-debug.js @@ -547,7 +547,7 @@ Y.FormField = Y.Base.create('form-field', Y.Widget, [Y.WidgetParent, Y.WidgetChi * @type String * @description Template used to render the field node */ - FIELD_TEMPLATE : '', + FIELD_TEMPLATE : '', /** * @property FormField.FIELD_CLASS @@ -817,7 +817,7 @@ Y.FormField = Y.Base.create('form-field', Y.Widget, [Y.WidgetParent, Y.WidgetChi * @description Syncs the fieldNode and this instances attributes */ _syncFieldNode: function() { - var nodeType = this.name.split('-')[0]; + var nodeType = this.INPUT_TYPE || this.name.split('-')[0]; if (!nodeType) { return; } @@ -1421,7 +1421,7 @@ Y.CheckboxField = Y.Base.create('checkbox-field', Y.FormField, [Y.WidgetChild], * @constructor * @description A Radio field node */ -Y.RadioField = Y.Base.create('radio-field', Y.FormField, [Y.WidgetChild]); +Y.RadioField = Y.Base.create('radio-field', Y.CheckboxField, [Y.WidgetChild]); /** * @class HiddenField * @extends FormField @@ -1561,6 +1561,7 @@ Y.ChoiceField = Y.Base.create('choice-field', Y.FormField, [Y.WidgetParent, Y.Wi Y.Array.each(choices, function(c, i, a) { var cfg = { + checked : c.checked, value: c.value, id: (this.get('id') + '_choice' + i), name: this.get('name'), @@ -1577,19 +1578,23 @@ Y.ChoiceField = Y.Base.create('choice-field', Y.FormField, [Y.WidgetParent, Y.Wi var choices = this.get('value').split(','); if (choices && choices.length > 0) { - Y.Array.each(choices, function(choice) { - this._fieldNode.each(function(node, index, list) { - if (Y.Lang.trim(node.get('value')) == Y.Lang.trim(choice)) { - node.set('checked', true); - return true; - } - }, this); - }, this); + choices = Y.Array.map(choices, function(choice) { + return Y.Lang.trim(choice); + }); + + this._fieldNode.each(function(node, index, list) { + var nodeValue = Y.Lang.trim(node.get('value')); + if (!!~Y.Array.indexOf(choices, nodeValue)) { + node.set('checked', true); + } else { + node.set('checked', false); + } + }); } }, /** - * @method _afterChoiceChange + * @method _afterChoicesChange * @description When the available choices for the choice field change, * the old ones are removed and the new ones are rendered. */ @@ -1610,19 +1615,27 @@ Y.ChoiceField = Y.Base.create('choice-field', Y.FormField, [Y.WidgetParent, Y.Wi bindUI: function() { this._fieldNode.on('change', Y.bind(function(e) { - var value = ''; + var value = '', + type = this.get('multi') ? 'checkbox' : 'radio'; + this._fieldNode.each(function(node, index, list) { - if (node.get('checked') === true) { + if (node.get('type') == type && node.get('checked') === true) { if (value.length > 0) { value += ','; } value += node.get('value'); } }, this); - this.set('value', value); + this.set('value', value, {fromUI : true}); }, this)); this.after('choicesChange', this._afterChoicesChange); + + this.after('valueChange', function (e) { + if (!e.fromUI) { + this._syncFieldNode(); + } + }); } }, @@ -1966,4 +1979,4 @@ Y.ResetButton = Y.Base.create('reset-button', Y.FormField, [Y.WidgetChild], { }); -}, 'gallery-2011.09.28-20-06' ,{requires:['node', 'widget-base', 'widget-htmlparser', 'io-form', 'widget-parent', 'widget-child', 'base-build', 'substitute', 'io-upload-iframe']}); +}, 'gallery-2011.11.10-16-24' ,{requires:['node', 'widget-base', 'widget-htmlparser', 'io-form', 'widget-parent', 'widget-child', 'base-build', 'substitute', 'io-upload-iframe', 'collection']}); diff --git a/build/gallery-form/gallery-form-min.js b/build/gallery-form/gallery-form-min.js index db744f5035..4a86f52740 100644 --- a/build/gallery-form/gallery-form-min.js +++ b/build/gallery-form/gallery-form-min.js @@ -1,4 +1,4 @@ -YUI.add("gallery-form",function(a){a.Form=a.Base.create("form",a.Widget,[a.WidgetParent],{toString:function(){return this.name;},CONTENT_TEMPLATE:"
",_ioIds:null,_validateMethod:function(b){if(!a.Lang.isString(b)){return false;}if(b.toLowerCase()!="get"&&b.toLowerCase()!="post"){return false;}return true;},_parseAction:function(b){var c=b.one("form");if(!c){c=b;}if(c){return c.get("action");}},_parseMethod:function(b){var c=b.one("form");if(!c){c=b;}if(c){return c.get("method");}},_parseFields:function(c){var e=c.all("*"),f=c.all("label"),b=[],d={text:a.TextField,hidden:a.HiddenField,file:a.FileField,checkbox:a.CheckboxField,radio:a.RadioField,reset:a.ResetButton,submit:a.SubmitButton,button:(a.Button||a.FormButton)};e.each(function(j,h,g){var n=j.get("nodeName"),l=j.get("id"),i,k,m=[];if(n=="INPUT"){i=j.get("type");k={type:(d[i]?d[i]:a.TextField),name:j.get("name"),value:j.get("value"),checked:j.get("checked")};if(k.type==d.button){k.label=j.get("value");}}else{if(n=="BUTTON"){k={type:d.button,name:j.get("name"),label:j.get("innerHTML")};}else{if(n=="SELECT"){j.all("option").each(function(p,q,o){m.push({label:p.get("innerHTML"),value:p.get("value")});});k={type:a.SelectField,name:j.get("name"),choices:m};}else{if(n=="TEXTAREA"){k={type:a.TextareaField,name:j.get("name"),value:j.get("innerHTML")};}}}}if(k){if(l){k.id=l;f.some(function(p,q,o){if(p.get("htmlFor")==l){k.label=p.get("innerHTML");}});}b.push(k);}j.remove();});return b;},_syncFormAttributes:function(){var b=this.get("contentBox");b.setAttrs({action:this.get("action"),method:this.get("method")});if(this.get("encodingType")===a.Form.MULTIPART_ENCODED){b.setAttribute("enctype","multipart/form-data");}},_runValidation:function(){var b=true;this.each(function(c){if(c.validateField()===false){b=false;}});return b;},_enableInlineValidation:function(){this.each(function(b){b.set("validateInline",true);});},_disableInlineValidation:function(){this.each(function(b){b.set("validateInline",false);});},_handleIOEvent:function(d,b,c){if(this._ioIds[b]!==undefined){this.fire(d,{response:c});}},reset:function(){var b=a.Node.getDOMNode(this.get("contentBox"));if(a.Lang.isFunction(b.reset)){b.reset();}this.each(function(c){c.resetFieldNode();c.set("error",null);});},submit:function(){if(this.get("skipValidationBeforeSubmit")===true||this._runValidation()){var d=this.get("action"),f=this.get("method"),e=this.get("submitViaIO"),h=this.get("io"),c=this.get("ioConfig")||{},g,b;if(e===true){b=a.merge({method:f,form:{id:this.get("contentBox"),upload:(this.get("encodingType")===a.Form.MULTIPART_ENCODED)}},c);g=h(d,b);this._ioIds[g.id]=g;}else{this.get("contentBox").submit();}}},getField:function(b){var c;if(a.Lang.isNumber(b)){c=this.item(b);}else{if(a.Lang.isString(b)){this.each(function(d){if(d.get("name")==b){c=d;}});}}return c;},toJSON:function(){var b={};this.each(function(c){b[c.get("name")]=(c instanceof a.CheckboxField)?c.get("checked"):c.get("value");});return b;},initializer:function(b){this._ioIds={};this.publish("submit");this.publish("reset");this.publish("start");this.publish("success");this.publish("failure");this.publish("complete");this.publish("xdr");},destructor:function(){},renderUI:function(){},bindUI:function(){this.get("contentBox").on("submit",a.bind(function(b){b.halt();},this));this.after("inlineValidationChange",a.bind(function(b){if(b.newVal===true){this._enableInlineValidation();}else{this._disableInlineValidation();}},this));this.after("success",a.bind(function(b){if(this.get("resetAfterSubmit")===true){this.reset();}},this));a.on("io:start",a.bind(this._handleIOEvent,this,"start"));a.on("io:complete",a.bind(this._handleIOEvent,this,"complete"));a.on("io:xdr",a.bind(this._handleIOEvent,this,"xdr"));a.on("io:success",a.bind(this._handleIOEvent,this,"success"));a.on("io:failure",a.bind(this._handleIOEvent,this,"failure"));this.each(a.bind(function(b){if(b.name=="submit-button"){b.on("click",a.bind(this.submit,this));}else{if(b.name=="reset-button"){b.on("click",a.bind(this.reset,this));}}},this));},syncUI:function(){this._syncFormAttributes();if(this.get("inlineValidation")===true){this._enableInlineValidation();}}},{ATTRS:{defaultChildType:{valueFn:function(){return a.TextField;}},method:{value:"post",validator:function(b){return this._validateMethod(b);},setter:function(b){return b.toLowerCase();}},action:{value:".",validator:a.Lang.isString},fields:{setter:function(b){return this.set("children",b);}},inlineValidation:{value:false,validator:a.Lang.isBoolean},resetAfterSubmit:{value:true,validator:a.Lang.isBoolean},encodingType:{value:1,validator:a.Lang.isNumber},skipValidationBeforeSubmit:{value:false,validator:a.Lang.isBoolean},submitViaIO:{value:true,validator:a.Lang.isBoolean},io:{value:a.io},ioConfig:{}},HTML_PARSER:{action:function(b){return this._parseAction(b);},method:function(b){return this._parseMethod(b);},children:function(b){return this._parseFields(b);}},FORM_TEMPLATE:"
",URL_ENCODED:1,MULTIPART_ENCODED:2});a.FormField=a.Base.create("form-field",a.Widget,[a.WidgetParent,a.WidgetChild],{toString:function(){return this.name;},FIELD_TEMPLATE:"",FIELD_CLASS:"field",LABEL_TEMPLATE:"",LABEL_CLASS:"label",HINT_TEMPLATE:"",HINT_CLASS:"hint",ERROR_TEMPLATE:"",ERROR_CLASS:"error",_labelNode:null,_hintNode:null,_fieldNode:null,_errorNode:null,_initialValue:null,_validateError:function(b){if(a.Lang.isString(b)){return true;}if(b===null||typeof b=="undefined"){return true;}return false;},_validateValidator:function(c){if(a.Lang.isString(c)){var b=/^(email|phone|ip|date|time|postal|special)$/;if(b.test(c)===true){return true;}}if(a.Lang.isFunction(c)){return true;}return false;},_setValidator:function(c){var b={email:a.FormField.VALIDATE_EMAIL_ADDRESS,phone:a.FormField.VALIDATE_PHONE_NUMBER,ip:a.FormField.VALIDATE_IP_ADDRESS,date:a.FormField.VALIDATE_DATE,time:a.FormField.VALIDATE_TIME,postal:a.FormField.VALIDATE_POSTAL_CODE,special:a.FormField.VALIDATE_NO_SPECIAL_CHARS}; -return(b[c]?b[c]:c);},_renderNode:function(e,d,c){if(!e){return null;}var b=this.get("contentBox"),g=a.Node.create(e),f=b.one("."+d);g.addClass(d);if(f){f.replace(g);}else{if(c){b.insertBefore(g,c);}else{b.appendChild(g);}}return g;},_renderLabelNode:function(){var b=this.get("contentBox"),c=b.one("label");if(!c||c.get("for")!=this.get("id")){c=this._renderNode(this.LABEL_TEMPLATE,this.LABEL_CLASS);}this._labelNode=c;},_renderHintNode:function(){this._hintNode=this._renderNode(this.HINT_TEMPLATE,this.HINT_CLASS);},_renderFieldNode:function(){var b=this.get("contentBox"),c=b.one("#"+this.get("id"));if(!c){c=this._renderNode(this.FIELD_TEMPLATE,this.FIELD_CLASS);}this._fieldNode=c;},_syncLabelNode:function(){var b=this.get("label"),d=this.get("required"),c=this.get("requiredLabel");if(this._labelNode){this._labelNode.set("text","");if(b){this._labelNode.append(""+b+"");}if(d&&c){this._labelNode.append(" ");this._labelNode.append(""+c+"");}this._labelNode.setAttribute("for",this.get("id")+a.FormField.FIELD_ID_SUFFIX);}},_syncHintNode:function(){if(this._hintNode){this._hintNode.set("text",this.get("hint"));}},_syncFieldNode:function(){var b=this.name.split("-")[0];if(!b){return;}this._fieldNode.setAttrs({name:this.get("name"),type:b,id:this.get("id")+a.FormField.FIELD_ID_SUFFIX,value:this.get("value")});this._fieldNode.setAttribute("tabindex",a.FormField.tabIndex);a.FormField.tabIndex++;},_syncError:function(){var b=this.get("error");if(b){this._showError(b);}},_syncDisabled:function(c){var b=this.get("disabled");if(b===true){this._fieldNode.setAttribute("disabled","disabled");}else{this._fieldNode.removeAttribute("disabled");}},_checkRequired:function(){if(this.get("required")===true&&this.get("value").length===0){return false;}return true;},_showError:function(b){var c=this._renderNode(this.ERROR_TEMPLATE,this.ERROR_CLASS,this._labelNode);c.set("text",b);this._errorNode=c;},_clearError:function(){if(this._errorNode){this._errorNode.remove();this._errorNode=null;}},_enableInlineValidation:function(){this.after("valueChange",this.validateField,this);},_disableInlineValidation:function(){this.detach("valueChange",this.validateField,this);},validateField:function(d){var c=this.get("value"),b=this.get("validator");this.set("error",null);if(d&&d.src!="ui"){return false;}if(!this._checkRequired()){this.set("error",a.FormField.REQUIRED_ERROR_TEXT);return false;}else{if(!c){return true;}}return b.call(this,c,this);},resetFieldNode:function(){this.set("value",this._initialValue);this._fieldNode.set("value",this._initialValue);this.fire("nodeReset");},clear:function(){this.set("value","");this._fieldNode.set("value","");this._initialValue=null;this.fire("clear");},initializer:function(){this.publish("blur");this.publish("change");this.publish("focus");this.publish("clear");this.publish("nodeReset");this._initialValue=this.get("value");},destructor:function(b){},renderUI:function(){this._renderLabelNode();this._renderFieldNode();this._renderHintNode();},bindUI:function(){this._fieldNode.on("change",a.bind(function(b){this.set("value",this._fieldNode.get("value"),{src:"ui"});},this));this.on("valueChange",a.bind(function(b){if(b.src!="ui"){this._fieldNode.set("value",b.newVal);}},this));this._fieldNode.on("blur",a.bind(function(b){this.set("value",this._fieldNode.get("value"),{src:"ui"});},this));this._fieldNode.on("focus",a.bind(function(b){this.fire("focus",b);},this));this.on("errorChange",a.bind(function(b){if(b.newVal){this._showError(b.newVal);}else{this._clearError();}},this));this.on("validateInlineChange",a.bind(function(b){if(b.newVal===true){this._enableInlineValidation();}else{this._disableInlineValidation();}},this));this.after("disabledChange",a.bind(function(b){this._syncDisabled();},this));},syncUI:function(){this.get("boundingBox").removeAttribute("tabindex");this._syncLabelNode();this._syncHintNode();this._syncFieldNode();this._syncError();this._syncDisabled();if(this.get("validateInline")===true){this._enableInlineValidation();}}},{ATTRS:{id:{value:a.guid(),validator:a.Lang.isString,writeOnce:true},name:{validator:a.Lang.isString,writeOnce:true},value:{value:"",validator:a.Lang.isString},label:{value:"",validator:a.Lang.isString},hint:{value:"",validator:a.Lang.isString},validator:{value:function(b){return true;},validator:function(b){return this._validateValidator(b);},setter:function(b){return this._setValidator(b);}},error:{value:false,validator:function(b){return this._validateError(b);}},required:{value:false,validator:a.Lang.isBoolean},validateInline:{value:false,validator:a.Lang.isBoolean},requiredLabel:{value:"",validator:a.Lang.isString}},tabIndex:1,VALIDATE_EMAIL_ADDRESS:function(d,c){var b=/^([\w]+(?:\.[\w]+)*)@((?:[\w]+\.)*\w[\w]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;if(b.test(d)===false){c.set("error",a.FormField.INVALID_EMAIL_MESSAGE);return false;}return true;},INVALID_EMAIL_MESSAGE:"Please enter a valid email address",VALIDATE_PHONE_NUMBER:function(d,c){var b=/^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/;if(b.test(d)===false){c.set("error",a.FormField.INVALID_PHONE_NUMBER);return false;}return true;},INVALID_PHONE_NUMBER:"Please enter a valid phone number",VALIDATE_IP_ADDRESS:function(f,e){var c=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/,b,d=true;if(c.test(f)===false){d=false;}b=f.split(".");a.Array.each(b,function(h,j,g){var k=parseInt(h,10);if(k<0||k>255){d=false;}});if(d===false){e.set("error",a.FormField.INVALID_IP_MESSAGE);}return d;},INVALID_IP_MESSAGE:"Please enter a valid IP address",VALIDATE_DATE:function(d,c){var b=/^([1-9]|1[0-2])(\-|\/)([0-2][0-9]|3[0-1])(\-|\/)(\d{4}|\d{2})$/;if(b.test(d)===false){c.set("error",a.FormField.INVALID_DATE_MESSAGE);return false;}return true;},INVALID_DATE_MESSAGE:"Please enter a a valid date",VALIDATE_TIME:function(d,c){var b=/^([1-9]|1[0-2]):[0-5]\d(:[0-5]\d(\.\d{1,3})?)?$/; -if(b.test(d)===false){c.set("error",a.FormField.INVALID_TIME_MESSAGE);return false;}return true;},INVALID_TIME_MESSAGE:"Please enter a valid time",VALIDATE_POSTAL_CODE:function(e,d){var b,c=true;if(e.length==6||e.length==7){b=/^[a-zA-Z]\d[a-zA-Z](-|\s)?\d[a-zA-Z]\d$/;}else{if(e.length==5||e.length==10){b=/^\d{5}((-|\s)\d{4})?$/;}else{if(e.length>0){c=false;}}}if(c===false||(b&&b.test(e)===false)){d.set("error",a.FormField.INVALID_POSTAL_CODE_MESSAGE);return false;}return true;},INVALID_POSTAL_CODE_MESSAGE:"Please enter a valid postal code",VALIDATE_NO_SPECIAL_CHARS:function(d,c){var b=/^[a-zA-Z0-9]*$/;if(b.test(d)===false){c.set("error",a.FormField.INVALID_SPECIAL_CHARS);return false;}return true;},INVALID_SPECIAL_CHARS:"Please use only letters and numbers",REQUIRED_ERROR_TEXT:"This field is required",FIELD_ID_SUFFIX:"-field"});a.TextField=a.Base.create("text-field",a.FormField,[a.WidgetChild]);a.PasswordField=a.Base.create("password-field",a.FormField,[a.WidgetChild]);a.CheckboxField=a.Base.create("checkbox-field",a.FormField,[a.WidgetChild],{_syncChecked:function(){this._fieldNode.set("checked",this.get("checked"));},initializer:function(){a.CheckboxField.superclass.initializer.apply(this,arguments);},renderUI:function(){this._renderFieldNode();this._renderLabelNode();},syncUI:function(){a.CheckboxField.superclass.syncUI.apply(this,arguments);this._syncChecked();},bindUI:function(){a.CheckboxField.superclass.bindUI.apply(this,arguments);this.after("checkedChange",a.bind(function(b){if(b.src!="ui"){this._fieldNode.set("checked",b.newVal);}},this));this._fieldNode.after("change",a.bind(function(b){this.set("checked",b.currentTarget.get("checked"),{src:"ui"});},this));}},{ATTRS:{"checked":{value:false,validator:a.Lang.isBoolean}}});a.RadioField=a.Base.create("radio-field",a.FormField,[a.WidgetChild]);a.HiddenField=a.Base.create("hidden-field",a.FormField,[a.WidgetChild],{_valueDisplayNode:null,_renderValueDisplayNode:function(){if(this.get("displayValue")===true){var c=a.Node.create("
"),b=this.get("contentBox");b.appendChild(c);this._valueDisplayNode=c;}},renderUI:function(){a.HiddenField.superclass.renderUI.apply(this,arguments);this._renderValueDisplayNode();},bindUI:function(){a.HiddenField.superclass.bindUI.apply(this,arguments);if(this.get("displayValue")===true){this.after("valueChange",a.bind(function(b,c){this._valueDisplayNode.set("innerHTML",c.newVal);},this,true));}},clear:function(){}},{ATTRS:{displayValue:{value:false,writeOnce:true,validator:a.Lang.isBoolean}}});a.TextareaField=a.Base.create("textarea-field",a.FormField,[a.WidgetChild],{FIELD_TEMPLATE:""});a.ChoiceField=a.Base.create("choice-field",a.FormField,[a.WidgetParent,a.WidgetChild],{LABEL_TEMPLATE:"",SINGLE_CHOICE:a.RadioField,MULTI_CHOICE:a.CheckboxField,_validateChoices:function(d){if(!a.Lang.isArray(d)){return false;}var c=0,b=d.length;for(;c0){a.Array.each(b,function(c){this._fieldNode.each(function(e,d,f){if(a.Lang.trim(e.get("value"))==a.Lang.trim(c)){e.set("checked",true);return true;}},this);},this);}},_afterChoicesChange:function(c){var b=this.get("contentBox");b.all(".yui3-form-field").remove();this._renderFieldNode();},clear:function(){this._fieldNode.each(function(c,b,d){c.set("checked",false);},this);this.set("value","");},bindUI:function(){this._fieldNode.on("change",a.bind(function(c){var b="";this._fieldNode.each(function(e,d,f){if(e.get("checked")===true){if(b.length>0){b+=",";}b+=e.get("value");}},this);this.set("value",b);},this));this.after("choicesChange",this._afterChoicesChange);}},{ATTRS:{choices:{valueFn:function(){return[];},validator:function(b){return this._validateChoices(b);}},multi:{validator:a.Lang.isBoolean,value:false}}});a.SelectField=a.Base.create("select-field",a.ChoiceField,[a.WidgetParent,a.WidgetChild],{FIELD_TEMPLATE:"",DEFAULT_OPTION_TEXT:"Choose one",_renderFieldNode:function(){a.SelectField.superclass.constructor.superclass._renderFieldNode.apply(this,arguments);this._renderOptionNodes();},_renderOptionNodes:function(){var c=this.get("choices"),b;if(this.get("useDefaultOption")===true){b=a.Node.create(a.SelectField.OPTION_TEMPLATE);this._fieldNode.appendChild(b);}a.Array.each(c,function(f,e,d){b=a.Node.create(a.SelectField.OPTION_TEMPLATE);this._fieldNode.appendChild(b);},this);},_syncFieldNode:function(){a.SelectField.superclass.constructor.superclass._syncFieldNode.apply(this,arguments);this._fieldNode.setAttrs({size:this.get("size"),multiple:(this.get("multi")===true?"multiple":"")});},_syncOptionNodes:function(){var f=this.get("choices")||[],b=this.get("contentBox"),d=b.all("option"),e=this.get("useDefaultOption"),c=this.get("value");if(e===true){f.unshift({label:this.DEFAULT_OPTION_TEXT,value:""});}d.each(function(j,i,h){var g=f[i].label,k=f[i].value;j.setAttrs({innerHTML:g,value:k});if(c==k){j.setAttrs({selected:true,defaultSelected:true});}},this);if(!c&&!e&&f[0]){this.set("value",f[0].value);}},_afterChoicesChange:function(b){var c=this._fieldNode.all("option");c.remove();this._renderOptionNodes();this._syncOptionNodes();},clear:function(){this._fieldNode.value="";},bindUI:function(){a.SelectField.superclass.constructor.superclass.bindUI.apply(this,arguments);this.after("choicesChange",this._afterChoicesChange);},syncUI:function(){a.SelectField.superclass.syncUI.apply(this,arguments); -this._syncOptionNodes();}},{OPTION_TEMPLATE:"",ATTRS:{useDefaultOption:{validator:a.Lang.isBoolean,value:true},choices:{validator:function(b){if(this.get("useDefaultOption")&&a.Lang.isArray(b)&&b.length===0){return true;}else{return this._validateChoices(b);}}},size:{validator:a.Lang.isString,value:"0"}}});a.FormButton=a.Base.create("button-field",a.FormField,[a.WidgetChild],{FIELD_TEMPLATE:"",LABEL_TEMPLATE:"",_syncFieldNode:function(){this._fieldNode.setAttrs({innerHTML:this.get("label"),id:this.get("id")+a.FormField.FIELD_ID_SUFFIX});this.get("contentBox").addClass("first-child");},_setClickHandler:function(){if(!this._fieldNode){return;}a.Event.purgeElement(this._fieldNode,true,"click");a.on("click",a.bind(this._promptConfirm,this),this._fieldNode);},_promptConfirm:function(d){d.preventDefault();var c=this.get("message"),b=this.get("onclick");if(c){if(!this.get("confirm")(c)){return;}}b.fn.apply(b.scope);},bindUI:function(){this.after("onclickChange",a.bind(this._setClickHandler,this,true));this.after("disabledChange",this._syncDisabled,this);this._setClickHandler();}},{ATTRS:{onclick:{validator:function(b){if(a.Lang.isObject(b)===false){return false;}if(typeof b.fn=="undefined"||a.Lang.isFunction(b.fn)===false){return false;}return true;},value:{fn:function(b){}},setter:function(b){b.scope=b.scope||this;b.argument=b.argument||{};return b;}},message:{validator:a.Lang.isString,value:null},confirm:{validator:a.Lang.isFunction,value:null}}});a.FileField=a.Base.create("file-field",a.FormField,[a.WidgetChild]);a.SubmitButton=a.Base.create("submit-button",a.FormField,[a.WidgetChild],{_renderLabelNode:function(){}});a.ResetButton=a.Base.create("reset-button",a.FormField,[a.WidgetChild],{LABEL_TEMPLATE:""});},"gallery-2011.09.28-20-06",{requires:["node","widget-base","widget-htmlparser","io-form","widget-parent","widget-child","base-build","substitute","io-upload-iframe"]}); \ No newline at end of file +YUI.add("gallery-form",function(a){a.Form=a.Base.create("form",a.Widget,[a.WidgetParent],{toString:function(){return this.name;},CONTENT_TEMPLATE:"
",_ioIds:null,_validateMethod:function(b){if(!a.Lang.isString(b)){return false;}if(b.toLowerCase()!="get"&&b.toLowerCase()!="post"){return false;}return true;},_parseAction:function(b){var c=b.one("form");if(!c){c=b;}if(c){return c.get("action");}},_parseMethod:function(b){var c=b.one("form");if(!c){c=b;}if(c){return c.get("method");}},_parseFields:function(c){var e=c.all("*"),f=c.all("label"),b=[],d={text:a.TextField,hidden:a.HiddenField,file:a.FileField,checkbox:a.CheckboxField,radio:a.RadioField,reset:a.ResetButton,submit:a.SubmitButton,button:(a.Button||a.FormButton)};e.each(function(j,h,g){var n=j.get("nodeName"),l=j.get("id"),i,k,m=[];if(n=="INPUT"){i=j.get("type");k={type:(d[i]?d[i]:a.TextField),name:j.get("name"),value:j.get("value"),checked:j.get("checked")};if(k.type==d.button){k.label=j.get("value");}}else{if(n=="BUTTON"){k={type:d.button,name:j.get("name"),label:j.get("innerHTML")};}else{if(n=="SELECT"){j.all("option").each(function(p,q,o){m.push({label:p.get("innerHTML"),value:p.get("value")});});k={type:a.SelectField,name:j.get("name"),choices:m};}else{if(n=="TEXTAREA"){k={type:a.TextareaField,name:j.get("name"),value:j.get("innerHTML")};}}}}if(k){if(l){k.id=l;f.some(function(p,q,o){if(p.get("htmlFor")==l){k.label=p.get("innerHTML");}});}b.push(k);}j.remove();});return b;},_syncFormAttributes:function(){var b=this.get("contentBox");b.setAttrs({action:this.get("action"),method:this.get("method")});if(this.get("encodingType")===a.Form.MULTIPART_ENCODED){b.setAttribute("enctype","multipart/form-data");}},_runValidation:function(){var b=true;this.each(function(c){if(c.validateField()===false){b=false;}});return b;},_enableInlineValidation:function(){this.each(function(b){b.set("validateInline",true);});},_disableInlineValidation:function(){this.each(function(b){b.set("validateInline",false);});},_handleIOEvent:function(d,b,c){if(this._ioIds[b]!==undefined){this.fire(d,{response:c});}},reset:function(){var b=a.Node.getDOMNode(this.get("contentBox"));if(a.Lang.isFunction(b.reset)){b.reset();}this.each(function(c){c.resetFieldNode();c.set("error",null);});},submit:function(){if(this.get("skipValidationBeforeSubmit")===true||this._runValidation()){var d=this.get("action"),f=this.get("method"),e=this.get("submitViaIO"),h=this.get("io"),c=this.get("ioConfig")||{},g,b;if(e===true){b=a.merge({method:f,form:{id:this.get("contentBox"),upload:(this.get("encodingType")===a.Form.MULTIPART_ENCODED)}},c);g=h(d,b);this._ioIds[g.id]=g;}else{this.get("contentBox").submit();}}},getField:function(b){var c;if(a.Lang.isNumber(b)){c=this.item(b);}else{if(a.Lang.isString(b)){this.each(function(d){if(d.get("name")==b){c=d;}});}}return c;},toJSON:function(){var b={};this.each(function(c){b[c.get("name")]=(c instanceof a.CheckboxField)?c.get("checked"):c.get("value");});return b;},initializer:function(b){this._ioIds={};this.publish("submit");this.publish("reset");this.publish("start");this.publish("success");this.publish("failure");this.publish("complete");this.publish("xdr");},destructor:function(){},renderUI:function(){},bindUI:function(){this.get("contentBox").on("submit",a.bind(function(b){b.halt();},this));this.after("inlineValidationChange",a.bind(function(b){if(b.newVal===true){this._enableInlineValidation();}else{this._disableInlineValidation();}},this));this.after("success",a.bind(function(b){if(this.get("resetAfterSubmit")===true){this.reset();}},this));a.on("io:start",a.bind(this._handleIOEvent,this,"start"));a.on("io:complete",a.bind(this._handleIOEvent,this,"complete"));a.on("io:xdr",a.bind(this._handleIOEvent,this,"xdr"));a.on("io:success",a.bind(this._handleIOEvent,this,"success"));a.on("io:failure",a.bind(this._handleIOEvent,this,"failure"));this.each(a.bind(function(b){if(b.name=="submit-button"){b.on("click",a.bind(this.submit,this));}else{if(b.name=="reset-button"){b.on("click",a.bind(this.reset,this));}}},this));},syncUI:function(){this._syncFormAttributes();if(this.get("inlineValidation")===true){this._enableInlineValidation();}}},{ATTRS:{defaultChildType:{valueFn:function(){return a.TextField;}},method:{value:"post",validator:function(b){return this._validateMethod(b);},setter:function(b){return b.toLowerCase();}},action:{value:".",validator:a.Lang.isString},fields:{setter:function(b){return this.set("children",b);}},inlineValidation:{value:false,validator:a.Lang.isBoolean},resetAfterSubmit:{value:true,validator:a.Lang.isBoolean},encodingType:{value:1,validator:a.Lang.isNumber},skipValidationBeforeSubmit:{value:false,validator:a.Lang.isBoolean},submitViaIO:{value:true,validator:a.Lang.isBoolean},io:{value:a.io},ioConfig:{}},HTML_PARSER:{action:function(b){return this._parseAction(b);},method:function(b){return this._parseMethod(b);},children:function(b){return this._parseFields(b);}},FORM_TEMPLATE:"
",URL_ENCODED:1,MULTIPART_ENCODED:2});a.FormField=a.Base.create("form-field",a.Widget,[a.WidgetParent,a.WidgetChild],{toString:function(){return this.name;},FIELD_TEMPLATE:"",FIELD_CLASS:"field",LABEL_TEMPLATE:"",LABEL_CLASS:"label",HINT_TEMPLATE:"",HINT_CLASS:"hint",ERROR_TEMPLATE:"",ERROR_CLASS:"error",_labelNode:null,_hintNode:null,_fieldNode:null,_errorNode:null,_initialValue:null,_validateError:function(b){if(a.Lang.isString(b)){return true;}if(b===null||typeof b=="undefined"){return true;}return false;},_validateValidator:function(c){if(a.Lang.isString(c)){var b=/^(email|phone|ip|date|time|postal|special)$/;if(b.test(c)===true){return true;}}if(a.Lang.isFunction(c)){return true;}return false;},_setValidator:function(c){var b={email:a.FormField.VALIDATE_EMAIL_ADDRESS,phone:a.FormField.VALIDATE_PHONE_NUMBER,ip:a.FormField.VALIDATE_IP_ADDRESS,date:a.FormField.VALIDATE_DATE,time:a.FormField.VALIDATE_TIME,postal:a.FormField.VALIDATE_POSTAL_CODE,special:a.FormField.VALIDATE_NO_SPECIAL_CHARS}; +return(b[c]?b[c]:c);},_renderNode:function(e,d,c){if(!e){return null;}var b=this.get("contentBox"),g=a.Node.create(e),f=b.one("."+d);g.addClass(d);if(f){f.replace(g);}else{if(c){b.insertBefore(g,c);}else{b.appendChild(g);}}return g;},_renderLabelNode:function(){var b=this.get("contentBox"),c=b.one("label");if(!c||c.get("for")!=this.get("id")){c=this._renderNode(this.LABEL_TEMPLATE,this.LABEL_CLASS);}this._labelNode=c;},_renderHintNode:function(){this._hintNode=this._renderNode(this.HINT_TEMPLATE,this.HINT_CLASS);},_renderFieldNode:function(){var b=this.get("contentBox"),c=b.one("#"+this.get("id"));if(!c){c=this._renderNode(this.FIELD_TEMPLATE,this.FIELD_CLASS);}this._fieldNode=c;},_syncLabelNode:function(){var b=this.get("label"),d=this.get("required"),c=this.get("requiredLabel");if(this._labelNode){this._labelNode.set("text","");if(b){this._labelNode.append(""+b+"");}if(d&&c){this._labelNode.append(" ");this._labelNode.append(""+c+"");}this._labelNode.setAttribute("for",this.get("id")+a.FormField.FIELD_ID_SUFFIX);}},_syncHintNode:function(){if(this._hintNode){this._hintNode.set("text",this.get("hint"));}},_syncFieldNode:function(){var b=this.INPUT_TYPE||this.name.split("-")[0];if(!b){return;}this._fieldNode.setAttrs({name:this.get("name"),type:b,id:this.get("id")+a.FormField.FIELD_ID_SUFFIX,value:this.get("value")});this._fieldNode.setAttribute("tabindex",a.FormField.tabIndex);a.FormField.tabIndex++;},_syncError:function(){var b=this.get("error");if(b){this._showError(b);}},_syncDisabled:function(c){var b=this.get("disabled");if(b===true){this._fieldNode.setAttribute("disabled","disabled");}else{this._fieldNode.removeAttribute("disabled");}},_checkRequired:function(){if(this.get("required")===true&&this.get("value").length===0){return false;}return true;},_showError:function(b){var c=this._renderNode(this.ERROR_TEMPLATE,this.ERROR_CLASS,this._labelNode);c.set("text",b);this._errorNode=c;},_clearError:function(){if(this._errorNode){this._errorNode.remove();this._errorNode=null;}},_enableInlineValidation:function(){this.after("valueChange",this.validateField,this);},_disableInlineValidation:function(){this.detach("valueChange",this.validateField,this);},validateField:function(d){var c=this.get("value"),b=this.get("validator");this.set("error",null);if(d&&d.src!="ui"){return false;}if(!this._checkRequired()){this.set("error",a.FormField.REQUIRED_ERROR_TEXT);return false;}else{if(!c){return true;}}return b.call(this,c,this);},resetFieldNode:function(){this.set("value",this._initialValue);this._fieldNode.set("value",this._initialValue);this.fire("nodeReset");},clear:function(){this.set("value","");this._fieldNode.set("value","");this._initialValue=null;this.fire("clear");},initializer:function(){this.publish("blur");this.publish("change");this.publish("focus");this.publish("clear");this.publish("nodeReset");this._initialValue=this.get("value");},destructor:function(b){},renderUI:function(){this._renderLabelNode();this._renderFieldNode();this._renderHintNode();},bindUI:function(){this._fieldNode.on("change",a.bind(function(b){this.set("value",this._fieldNode.get("value"),{src:"ui"});},this));this.on("valueChange",a.bind(function(b){if(b.src!="ui"){this._fieldNode.set("value",b.newVal);}},this));this._fieldNode.on("blur",a.bind(function(b){this.set("value",this._fieldNode.get("value"),{src:"ui"});},this));this._fieldNode.on("focus",a.bind(function(b){this.fire("focus",b);},this));this.on("errorChange",a.bind(function(b){if(b.newVal){this._showError(b.newVal);}else{this._clearError();}},this));this.on("validateInlineChange",a.bind(function(b){if(b.newVal===true){this._enableInlineValidation();}else{this._disableInlineValidation();}},this));this.after("disabledChange",a.bind(function(b){this._syncDisabled();},this));},syncUI:function(){this.get("boundingBox").removeAttribute("tabindex");this._syncLabelNode();this._syncHintNode();this._syncFieldNode();this._syncError();this._syncDisabled();if(this.get("validateInline")===true){this._enableInlineValidation();}}},{ATTRS:{id:{value:a.guid(),validator:a.Lang.isString,writeOnce:true},name:{validator:a.Lang.isString,writeOnce:true},value:{value:"",validator:a.Lang.isString},label:{value:"",validator:a.Lang.isString},hint:{value:"",validator:a.Lang.isString},validator:{value:function(b){return true;},validator:function(b){return this._validateValidator(b);},setter:function(b){return this._setValidator(b);}},error:{value:false,validator:function(b){return this._validateError(b);}},required:{value:false,validator:a.Lang.isBoolean},validateInline:{value:false,validator:a.Lang.isBoolean},requiredLabel:{value:"",validator:a.Lang.isString}},tabIndex:1,VALIDATE_EMAIL_ADDRESS:function(d,c){var b=/^([\w]+(?:\.[\w]+)*)@((?:[\w]+\.)*\w[\w]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;if(b.test(d)===false){c.set("error",a.FormField.INVALID_EMAIL_MESSAGE);return false;}return true;},INVALID_EMAIL_MESSAGE:"Please enter a valid email address",VALIDATE_PHONE_NUMBER:function(d,c){var b=/^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/;if(b.test(d)===false){c.set("error",a.FormField.INVALID_PHONE_NUMBER);return false;}return true;},INVALID_PHONE_NUMBER:"Please enter a valid phone number",VALIDATE_IP_ADDRESS:function(f,e){var c=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/,b,d=true;if(c.test(f)===false){d=false;}b=f.split(".");a.Array.each(b,function(h,j,g){var k=parseInt(h,10);if(k<0||k>255){d=false;}});if(d===false){e.set("error",a.FormField.INVALID_IP_MESSAGE);}return d;},INVALID_IP_MESSAGE:"Please enter a valid IP address",VALIDATE_DATE:function(d,c){var b=/^([1-9]|1[0-2])(\-|\/)([0-2][0-9]|3[0-1])(\-|\/)(\d{4}|\d{2})$/;if(b.test(d)===false){c.set("error",a.FormField.INVALID_DATE_MESSAGE);return false;}return true;},INVALID_DATE_MESSAGE:"Please enter a a valid date",VALIDATE_TIME:function(d,c){var b=/^([1-9]|1[0-2]):[0-5]\d(:[0-5]\d(\.\d{1,3})?)?$/; +if(b.test(d)===false){c.set("error",a.FormField.INVALID_TIME_MESSAGE);return false;}return true;},INVALID_TIME_MESSAGE:"Please enter a valid time",VALIDATE_POSTAL_CODE:function(e,d){var b,c=true;if(e.length==6||e.length==7){b=/^[a-zA-Z]\d[a-zA-Z](-|\s)?\d[a-zA-Z]\d$/;}else{if(e.length==5||e.length==10){b=/^\d{5}((-|\s)\d{4})?$/;}else{if(e.length>0){c=false;}}}if(c===false||(b&&b.test(e)===false)){d.set("error",a.FormField.INVALID_POSTAL_CODE_MESSAGE);return false;}return true;},INVALID_POSTAL_CODE_MESSAGE:"Please enter a valid postal code",VALIDATE_NO_SPECIAL_CHARS:function(d,c){var b=/^[a-zA-Z0-9]*$/;if(b.test(d)===false){c.set("error",a.FormField.INVALID_SPECIAL_CHARS);return false;}return true;},INVALID_SPECIAL_CHARS:"Please use only letters and numbers",REQUIRED_ERROR_TEXT:"This field is required",FIELD_ID_SUFFIX:"-field"});a.TextField=a.Base.create("text-field",a.FormField,[a.WidgetChild]);a.PasswordField=a.Base.create("password-field",a.FormField,[a.WidgetChild]);a.CheckboxField=a.Base.create("checkbox-field",a.FormField,[a.WidgetChild],{_syncChecked:function(){this._fieldNode.set("checked",this.get("checked"));},initializer:function(){a.CheckboxField.superclass.initializer.apply(this,arguments);},renderUI:function(){this._renderFieldNode();this._renderLabelNode();},syncUI:function(){a.CheckboxField.superclass.syncUI.apply(this,arguments);this._syncChecked();},bindUI:function(){a.CheckboxField.superclass.bindUI.apply(this,arguments);this.after("checkedChange",a.bind(function(b){if(b.src!="ui"){this._fieldNode.set("checked",b.newVal);}},this));this._fieldNode.after("change",a.bind(function(b){this.set("checked",b.currentTarget.get("checked"),{src:"ui"});},this));}},{ATTRS:{"checked":{value:false,validator:a.Lang.isBoolean}}});a.RadioField=a.Base.create("radio-field",a.CheckboxField,[a.WidgetChild]);a.HiddenField=a.Base.create("hidden-field",a.FormField,[a.WidgetChild],{_valueDisplayNode:null,_renderValueDisplayNode:function(){if(this.get("displayValue")===true){var c=a.Node.create("
"),b=this.get("contentBox");b.appendChild(c);this._valueDisplayNode=c;}},renderUI:function(){a.HiddenField.superclass.renderUI.apply(this,arguments);this._renderValueDisplayNode();},bindUI:function(){a.HiddenField.superclass.bindUI.apply(this,arguments);if(this.get("displayValue")===true){this.after("valueChange",a.bind(function(b,c){this._valueDisplayNode.set("innerHTML",c.newVal);},this,true));}},clear:function(){}},{ATTRS:{displayValue:{value:false,writeOnce:true,validator:a.Lang.isBoolean}}});a.TextareaField=a.Base.create("textarea-field",a.FormField,[a.WidgetChild],{FIELD_TEMPLATE:""});a.ChoiceField=a.Base.create("choice-field",a.FormField,[a.WidgetParent,a.WidgetChild],{LABEL_TEMPLATE:"",SINGLE_CHOICE:a.RadioField,MULTI_CHOICE:a.CheckboxField,_validateChoices:function(d){if(!a.Lang.isArray(d)){return false;}var c=0,b=d.length;for(;c0){b=a.Array.map(b,function(c){return a.Lang.trim(c);});this._fieldNode.each(function(e,d,f){var c=a.Lang.trim(e.get("value"));if(!!~a.Array.indexOf(b,c)){e.set("checked",true);}else{e.set("checked",false);}});}},_afterChoicesChange:function(c){var b=this.get("contentBox");b.all(".yui3-form-field").remove();this._renderFieldNode();},clear:function(){this._fieldNode.each(function(c,b,d){c.set("checked",false);},this);this.set("value","");},bindUI:function(){this._fieldNode.on("change",a.bind(function(d){var c="",b=this.get("multi")?"checkbox":"radio";this._fieldNode.each(function(f,e,g){if(f.get("type")==b&&f.get("checked")===true){if(c.length>0){c+=",";}c+=f.get("value");}},this);this.set("value",c,{fromUI:true});},this));this.after("choicesChange",this._afterChoicesChange);this.after("valueChange",function(b){if(!b.fromUI){this._syncFieldNode();}});}},{ATTRS:{choices:{valueFn:function(){return[];},validator:function(b){return this._validateChoices(b);}},multi:{validator:a.Lang.isBoolean,value:false}}});a.SelectField=a.Base.create("select-field",a.ChoiceField,[a.WidgetParent,a.WidgetChild],{FIELD_TEMPLATE:"",DEFAULT_OPTION_TEXT:"Choose one",_renderFieldNode:function(){a.SelectField.superclass.constructor.superclass._renderFieldNode.apply(this,arguments);this._renderOptionNodes();},_renderOptionNodes:function(){var c=this.get("choices"),b;if(this.get("useDefaultOption")===true){b=a.Node.create(a.SelectField.OPTION_TEMPLATE);this._fieldNode.appendChild(b);}a.Array.each(c,function(f,e,d){b=a.Node.create(a.SelectField.OPTION_TEMPLATE);this._fieldNode.appendChild(b);},this);},_syncFieldNode:function(){a.SelectField.superclass.constructor.superclass._syncFieldNode.apply(this,arguments);this._fieldNode.setAttrs({size:this.get("size"),multiple:(this.get("multi")===true?"multiple":"")});},_syncOptionNodes:function(){var f=this.get("choices")||[],b=this.get("contentBox"),d=b.all("option"),e=this.get("useDefaultOption"),c=this.get("value");if(e===true){f.unshift({label:this.DEFAULT_OPTION_TEXT,value:""});}d.each(function(j,i,h){var g=f[i].label,k=f[i].value;j.setAttrs({innerHTML:g,value:k});if(c==k){j.setAttrs({selected:true,defaultSelected:true});}},this);if(!c&&!e&&f[0]){this.set("value",f[0].value);}},_afterChoicesChange:function(b){var c=this._fieldNode.all("option");c.remove();this._renderOptionNodes();this._syncOptionNodes(); +},clear:function(){this._fieldNode.value="";},bindUI:function(){a.SelectField.superclass.constructor.superclass.bindUI.apply(this,arguments);this.after("choicesChange",this._afterChoicesChange);},syncUI:function(){a.SelectField.superclass.syncUI.apply(this,arguments);this._syncOptionNodes();}},{OPTION_TEMPLATE:"",ATTRS:{useDefaultOption:{validator:a.Lang.isBoolean,value:true},choices:{validator:function(b){if(this.get("useDefaultOption")&&a.Lang.isArray(b)&&b.length===0){return true;}else{return this._validateChoices(b);}}},size:{validator:a.Lang.isString,value:"0"}}});a.FormButton=a.Base.create("button-field",a.FormField,[a.WidgetChild],{FIELD_TEMPLATE:"",LABEL_TEMPLATE:"",_syncFieldNode:function(){this._fieldNode.setAttrs({innerHTML:this.get("label"),id:this.get("id")+a.FormField.FIELD_ID_SUFFIX});this.get("contentBox").addClass("first-child");},_setClickHandler:function(){if(!this._fieldNode){return;}a.Event.purgeElement(this._fieldNode,true,"click");a.on("click",a.bind(this._promptConfirm,this),this._fieldNode);},_promptConfirm:function(d){d.preventDefault();var c=this.get("message"),b=this.get("onclick");if(c){if(!this.get("confirm")(c)){return;}}b.fn.apply(b.scope);},bindUI:function(){this.after("onclickChange",a.bind(this._setClickHandler,this,true));this.after("disabledChange",this._syncDisabled,this);this._setClickHandler();}},{ATTRS:{onclick:{validator:function(b){if(a.Lang.isObject(b)===false){return false;}if(typeof b.fn=="undefined"||a.Lang.isFunction(b.fn)===false){return false;}return true;},value:{fn:function(b){}},setter:function(b){b.scope=b.scope||this;b.argument=b.argument||{};return b;}},message:{validator:a.Lang.isString,value:null},confirm:{validator:a.Lang.isFunction,value:null}}});a.FileField=a.Base.create("file-field",a.FormField,[a.WidgetChild]);a.SubmitButton=a.Base.create("submit-button",a.FormField,[a.WidgetChild],{_renderLabelNode:function(){}});a.ResetButton=a.Base.create("reset-button",a.FormField,[a.WidgetChild],{LABEL_TEMPLATE:""});},"gallery-2011.11.10-16-24",{requires:["node","widget-base","widget-htmlparser","io-form","widget-parent","widget-child","base-build","substitute","io-upload-iframe","collection"]}); \ No newline at end of file diff --git a/build/gallery-form/gallery-form.js b/build/gallery-form/gallery-form.js index 468946215e..802d89813c 100644 --- a/build/gallery-form/gallery-form.js +++ b/build/gallery-form/gallery-form.js @@ -547,7 +547,7 @@ Y.FormField = Y.Base.create('form-field', Y.Widget, [Y.WidgetParent, Y.WidgetChi * @type String * @description Template used to render the field node */ - FIELD_TEMPLATE : '', + FIELD_TEMPLATE : '', /** * @property FormField.FIELD_CLASS @@ -816,7 +816,7 @@ Y.FormField = Y.Base.create('form-field', Y.Widget, [Y.WidgetParent, Y.WidgetChi * @description Syncs the fieldNode and this instances attributes */ _syncFieldNode: function() { - var nodeType = this.name.split('-')[0]; + var nodeType = this.INPUT_TYPE || this.name.split('-')[0]; if (!nodeType) { return; } @@ -1420,7 +1420,7 @@ Y.CheckboxField = Y.Base.create('checkbox-field', Y.FormField, [Y.WidgetChild], * @constructor * @description A Radio field node */ -Y.RadioField = Y.Base.create('radio-field', Y.FormField, [Y.WidgetChild]); +Y.RadioField = Y.Base.create('radio-field', Y.CheckboxField, [Y.WidgetChild]); /** * @class HiddenField * @extends FormField @@ -1557,6 +1557,7 @@ Y.ChoiceField = Y.Base.create('choice-field', Y.FormField, [Y.WidgetParent, Y.Wi Y.Array.each(choices, function(c, i, a) { var cfg = { + checked : c.checked, value: c.value, id: (this.get('id') + '_choice' + i), name: this.get('name'), @@ -1573,19 +1574,23 @@ Y.ChoiceField = Y.Base.create('choice-field', Y.FormField, [Y.WidgetParent, Y.Wi var choices = this.get('value').split(','); if (choices && choices.length > 0) { - Y.Array.each(choices, function(choice) { - this._fieldNode.each(function(node, index, list) { - if (Y.Lang.trim(node.get('value')) == Y.Lang.trim(choice)) { - node.set('checked', true); - return true; - } - }, this); - }, this); + choices = Y.Array.map(choices, function(choice) { + return Y.Lang.trim(choice); + }); + + this._fieldNode.each(function(node, index, list) { + var nodeValue = Y.Lang.trim(node.get('value')); + if (!!~Y.Array.indexOf(choices, nodeValue)) { + node.set('checked', true); + } else { + node.set('checked', false); + } + }); } }, /** - * @method _afterChoiceChange + * @method _afterChoicesChange * @description When the available choices for the choice field change, * the old ones are removed and the new ones are rendered. */ @@ -1606,19 +1611,27 @@ Y.ChoiceField = Y.Base.create('choice-field', Y.FormField, [Y.WidgetParent, Y.Wi bindUI: function() { this._fieldNode.on('change', Y.bind(function(e) { - var value = ''; + var value = '', + type = this.get('multi') ? 'checkbox' : 'radio'; + this._fieldNode.each(function(node, index, list) { - if (node.get('checked') === true) { + if (node.get('type') == type && node.get('checked') === true) { if (value.length > 0) { value += ','; } value += node.get('value'); } }, this); - this.set('value', value); + this.set('value', value, {fromUI : true}); }, this)); this.after('choicesChange', this._afterChoicesChange); + + this.after('valueChange', function (e) { + if (!e.fromUI) { + this._syncFieldNode(); + } + }); } }, @@ -1962,4 +1975,4 @@ Y.ResetButton = Y.Base.create('reset-button', Y.FormField, [Y.WidgetChild], { }); -}, 'gallery-2011.09.28-20-06' ,{requires:['node', 'widget-base', 'widget-htmlparser', 'io-form', 'widget-parent', 'widget-child', 'base-build', 'substitute', 'io-upload-iframe']}); +}, 'gallery-2011.11.10-16-24' ,{requires:['node', 'widget-base', 'widget-htmlparser', 'io-form', 'widget-parent', 'widget-child', 'base-build', 'substitute', 'io-upload-iframe', 'collection']}); diff --git a/build/gallery-pulldown-refresh/gallery-pulldown-refresh-min.css b/build/gallery-pulldown-refresh/gallery-pulldown-refresh-min.css new file mode 100644 index 0000000000..7738ae2267 --- /dev/null +++ b/build/gallery-pulldown-refresh/gallery-pulldown-refresh-min.css @@ -0,0 +1 @@ +.yui3-pulldown-refresh-icon-pulldown,.yui3-pulldown-refresh-icon-release{background:url(http://l.yimg.com/us.yimg.com/i/us/ls/gr/t/1304966707/common_sprite_low_res.png) no-repeat}.yui3-pulldown-refresh-icon-pulldown{background-position:0 -919px}.yui3-pulldown-refresh-icon-release{background-position:0 -840px}.yui3-pulldown-refresh-animated{-webkit-transition:all .3s ease}#yui3-pulldown-refresh-icon{float:left;height:40px;display:inline-block;padding-left:24px;position:relative;top:-3px}.yui3-pulldown-refresh-loading-con{float:left;position:relative;display:inline-block;margin-left:49px;top:16px}.yui3-pulldown-refresh-last-update{float:left;position:relative;display:inline-block;margin-top:5px;font-size:12px}.yui3-pulldown-refresh-loading-stat{position:relative;width:260px;display:block}#yui3-pulldown-refresh-icon .yui3-pulldown-refresh-hidden{display:none}#yui3-pulldown-refresh-icon .yui3-pulldown-refresh-loading{background:url(http://l.yimg.com/a/i/us/ls/gr/loading_16x16_1_trans.gif) no-repeat;width:20px;height:20px;position:absolute;top:3px;left:0} \ No newline at end of file diff --git a/build/gallery-pulldown-refresh/gallery-pulldown-refresh.css b/build/gallery-pulldown-refresh/gallery-pulldown-refresh.css new file mode 100644 index 0000000000..76ee1d87ee --- /dev/null +++ b/build/gallery-pulldown-refresh/gallery-pulldown-refresh.css @@ -0,0 +1,56 @@ + .yui3-pulldown-refresh-icon-pulldown, + .yui3-pulldown-refresh-icon-release { + background: url(http://l.yimg.com/us.yimg.com/i/us/ls/gr/t/1304966707/common_sprite_low_res.png) no-repeat; +} + + .yui3-pulldown-refresh-icon-pulldown { + background-position: 0 -919px; +} + + .yui3-pulldown-refresh-icon-release { + background-position: 0 -840px; +} +.yui3-pulldown-refresh-animated { + -webkit-transition:all 0.3s ease; +} + +#yui3-pulldown-refresh-icon { + float: left; + height: 40px; + display: inline-block; + padding-left: 24px; + position: relative; + top: -3px; +} + +.yui3-pulldown-refresh-loading-con { + float: left; + position: relative; + display: inline-block; + margin-left: 49px; + top: 16px; +} +.yui3-pulldown-refresh-last-update { + float: left; + position: relative; + display: inline-block; + margin-top: 5px; + font-size: 12px; +} + +.yui3-pulldown-refresh-loading-stat { + position: relative; + width: 260px; + display:block; +} +#yui3-pulldown-refresh-icon .yui3-pulldown-refresh-hidden { + display: none; +} +#yui3-pulldown-refresh-icon .yui3-pulldown-refresh-loading { + background: url(http://l.yimg.com/a/i/us/ls/gr/loading_16x16_1_trans.gif) no-repeat; + width: 20px; + height: 20px; + position: absolute; + top: 3px; + left: 0px; +} diff --git a/build/gallery-slidecheckbox/gallery-slidecheckbox-debug.js b/build/gallery-slidecheckbox/gallery-slidecheckbox-debug.js index aab7fec986..1d71e7c979 100644 --- a/build/gallery-slidecheckbox/gallery-slidecheckbox-debug.js +++ b/build/gallery-slidecheckbox/gallery-slidecheckbox-debug.js @@ -86,7 +86,10 @@ YUI.add('gallery-slidecheckbox', function(Y) { cb.on('focus',function(){ cb.on('key',this.goLeft,'down:37',this); cb.on('key',this.goRight,'down:39',this); - cb.on('key',this.move,'down:32',this); + cb.on('key',function(e){ + e.preventDefault(); + this.move(); + },'down:32',this); },this); cb.on('blur',function(){ cb.detach('key'); @@ -141,10 +144,11 @@ YUI.add('gallery-slidecheckbox', function(Y) { return null; }, _onClick : function(e){ + e.preventDefault(); this.move(); }, _execute : function(){ - this.get(CBX).focus(); + this.focus(); if(this.disabled){ return; } @@ -163,6 +167,7 @@ YUI.add('gallery-slidecheckbox', function(Y) { this.anim.set('to',{left:this.to}); this.anim.run(); this.src.set('checked',!this.src.get('checked')); + Y.log("New value: " + this.src.get('checked')); }, _replacePx : function(el){ return parseInt(el.replace('px','')); @@ -201,4 +206,4 @@ YUI.add('gallery-slidecheckbox', function(Y) { ); -}, 'gallery-2011.10.27-17-03' ,{skinnable:true, requires:['node-base', 'anim-base', 'anim-easing', 'base-build', 'event-key', 'event-move', 'widget', 'node-style', 'gallery-makenode', 'dd-drag', 'dd-constrain']}); +}, 'gallery-2011.11.10-16-24' ,{skinnable:true, requires:['node-base', 'anim-base', 'anim-easing', 'base-build', 'event-key', 'event-move', 'widget', 'node-style', 'gallery-makenode', 'dd-drag', 'dd-constrain']}); diff --git a/build/gallery-slidecheckbox/gallery-slidecheckbox-min.js b/build/gallery-slidecheckbox/gallery-slidecheckbox-min.js index dfdd91fa67..2189a80be1 100644 --- a/build/gallery-slidecheckbox/gallery-slidecheckbox-min.js +++ b/build/gallery-slidecheckbox/gallery-slidecheckbox-min.js @@ -1 +1 @@ -YUI.add("gallery-slidecheckbox",function(c){var e="SlideCheckbox",i="contentBox",g="wrapper",a="slider",f="sliderwrap",b="labelOn",h="labelOff",d="handle";c[e]=c.Base.create(e,c.Widget,[c.MakeNode],{anim:null,currentX:null,lastX:null,renderUI:function(){this.src=this.get("srcNode").addClass(this.getClassName("hidden"));this.get(i).append(this._makeNode()).append(this.src);this._locateNodes();var m=this._labelOnNode.one("span").get("offsetWidth"),l=this._labelOffNode.one("span").get("offsetWidth"),n=this._labelOnNode.get("offsetWidth"),o=this.getSkinName(),j=o?o.indexOf("ios5")>-1:null;if(m>l){this._labelOffNode.one("span").setStyle("width",m);}else{this._labelOnNode.one("span").setStyle("width",l);n=this._labelOnNode.get("offsetWidth");}this.left=-this._labelOnNode.get("offsetWidth")+3;var k=2*n;if(j){this._slideWrapWidth=2*n+28;this.left=this.left+11;k=n+14;}else{this._slideWrapWidth=3*n+10;this._handleNode.setStyle("width",n-3);}this._sliderwrapNode.setStyle("width",this._slideWrapWidth);this._wrapperNode.setStyle("width",k);},bindUI:function(){this.disabled=this.src.get("disabled");var k=new c.DD.Drag({node:this._sliderwrapNode,activeHandle:this._handleNode,lock:this.disabled}),j=this.get(i);this._addDragConstraint(k);k.on("drag:drag",function(m){var l=this._wrapperNode.getXY();if(l[1]!==k.actXY[1]){k.unplug();this._addDragConstraint(k);m.halt(true);}if(k.actXY[0]%2===0){this.lastX=this.currentX;}this.currentX=k.actXY[0];},this);k.on("drag:end",this.move,this);j.on("focus",function(){j.on("key",this.goLeft,"down:37",this);j.on("key",this.goRight,"down:39",this);j.on("key",this.move,"down:32",this);},this);j.on("blur",function(){j.detach("key");j.blur();},this);},syncUI:function(){this._sliderwrapNode.setStyle("left",this.src.get("checked")?0:this.left);},destructor:function(){this.anim.stop().destroy();this.src=null;},goLeft:function(){this.to=this.left;this._execute();},goRight:function(){this.to=0;this._execute();},move:function(){this.from=this._replacePx(this._sliderwrapNode.getComputedStyle("left"));if(this.lastX!==null){if(this.currentXthis.left){this.goLeft();}else{this.goRight();}},_addDragConstraint:function(j){var k=this._wrapperNode.getXY();j.plug(c.Plugin.DDConstrained,{constrain:{top:k[1],bottom:k[1]+this._wrapperNode.get("offsetHeight"),right:k[0]+this._slideWrapWidth,left:k[0]+this.left}});},_defaultCB:function(j){return null;},_onClick:function(j){this.move();},_execute:function(){this.get(i).focus();if(this.disabled){return;}if(this.anim===null){this.anim=new c.Anim({node:this._sliderwrapNode,from:{left:this.from},duration:this.get("duration"),to:{left:this.to},easing:"easeIn"});}this.lastX=null;this.anim.set("from",{left:(this.from?this.from:this.baseX)});this.anim.set("to",{left:this.to});this.anim.run();this.src.set("checked",!this.src.get("checked"));},_replacePx:function(j){return parseInt(j.replace("px",""));}},{ATTRS:{duration:{value:0.2},strings:{value:{labelOn:"ON",labelOff:"OFF"}}},_CLASS_NAMES:[g,a,f,b,h,d],_TEMPLATE:['
  ','
','','
  
','',"
"].join("\n"),_EVENTS:{slider:[{type:"click",fn:"_onClick"}]},HTML_PARSER:{value:function(j){return j.getAttribute("checked");}}});},"gallery-2011.10.27-17-03",{skinnable:true,requires:["node-base","anim-base","anim-easing","base-build","event-key","event-move","widget","node-style","gallery-makenode","dd-drag","dd-constrain"]}); \ No newline at end of file +YUI.add("gallery-slidecheckbox",function(c){var e="SlideCheckbox",i="contentBox",g="wrapper",a="slider",f="sliderwrap",b="labelOn",h="labelOff",d="handle";c[e]=c.Base.create(e,c.Widget,[c.MakeNode],{anim:null,currentX:null,lastX:null,renderUI:function(){this.src=this.get("srcNode").addClass(this.getClassName("hidden"));this.get(i).append(this._makeNode()).append(this.src);this._locateNodes();var m=this._labelOnNode.one("span").get("offsetWidth"),l=this._labelOffNode.one("span").get("offsetWidth"),n=this._labelOnNode.get("offsetWidth"),o=this.getSkinName(),j=o?o.indexOf("ios5")>-1:null;if(m>l){this._labelOffNode.one("span").setStyle("width",m);}else{this._labelOnNode.one("span").setStyle("width",l);n=this._labelOnNode.get("offsetWidth");}this.left=-this._labelOnNode.get("offsetWidth")+3;var k=2*n;if(j){this._slideWrapWidth=2*n+28;this.left=this.left+11;k=n+14;}else{this._slideWrapWidth=3*n+10;this._handleNode.setStyle("width",n-3);}this._sliderwrapNode.setStyle("width",this._slideWrapWidth);this._wrapperNode.setStyle("width",k);},bindUI:function(){this.disabled=this.src.get("disabled");var k=new c.DD.Drag({node:this._sliderwrapNode,activeHandle:this._handleNode,lock:this.disabled}),j=this.get(i);this._addDragConstraint(k);k.on("drag:drag",function(m){var l=this._wrapperNode.getXY();if(l[1]!==k.actXY[1]){k.unplug();this._addDragConstraint(k);m.halt(true);}if(k.actXY[0]%2===0){this.lastX=this.currentX;}this.currentX=k.actXY[0];},this);k.on("drag:end",this.move,this);j.on("focus",function(){j.on("key",this.goLeft,"down:37",this);j.on("key",this.goRight,"down:39",this);j.on("key",function(l){l.preventDefault();this.move();},"down:32",this);},this);j.on("blur",function(){j.detach("key");j.blur();},this);},syncUI:function(){this._sliderwrapNode.setStyle("left",this.src.get("checked")?0:this.left);},destructor:function(){this.anim.stop().destroy();this.src=null;},goLeft:function(){this.to=this.left;this._execute();},goRight:function(){this.to=0;this._execute();},move:function(){this.from=this._replacePx(this._sliderwrapNode.getComputedStyle("left"));if(this.lastX!==null){if(this.currentXthis.left){this.goLeft();}else{this.goRight();}},_addDragConstraint:function(j){var k=this._wrapperNode.getXY();j.plug(c.Plugin.DDConstrained,{constrain:{top:k[1],bottom:k[1]+this._wrapperNode.get("offsetHeight"),right:k[0]+this._slideWrapWidth,left:k[0]+this.left}});},_defaultCB:function(j){return null;},_onClick:function(j){j.preventDefault();this.move();},_execute:function(){this.focus();if(this.disabled){return;}if(this.anim===null){this.anim=new c.Anim({node:this._sliderwrapNode,from:{left:this.from},duration:this.get("duration"),to:{left:this.to},easing:"easeIn"});}this.lastX=null;this.anim.set("from",{left:(this.from?this.from:this.baseX)});this.anim.set("to",{left:this.to});this.anim.run();this.src.set("checked",!this.src.get("checked"));},_replacePx:function(j){return parseInt(j.replace("px",""));}},{ATTRS:{duration:{value:0.2},strings:{value:{labelOn:"ON",labelOff:"OFF"}}},_CLASS_NAMES:[g,a,f,b,h,d],_TEMPLATE:['
  ','
','','
  
','',"
"].join("\n"),_EVENTS:{slider:[{type:"click",fn:"_onClick"}]},HTML_PARSER:{value:function(j){return j.getAttribute("checked");}}});},"gallery-2011.11.10-16-24",{skinnable:true,requires:["node-base","anim-base","anim-easing","base-build","event-key","event-move","widget","node-style","gallery-makenode","dd-drag","dd-constrain"]}); \ No newline at end of file diff --git a/build/gallery-slidecheckbox/gallery-slidecheckbox.js b/build/gallery-slidecheckbox/gallery-slidecheckbox.js index 485b551403..9ed3ed506a 100644 --- a/build/gallery-slidecheckbox/gallery-slidecheckbox.js +++ b/build/gallery-slidecheckbox/gallery-slidecheckbox.js @@ -86,7 +86,10 @@ YUI.add('gallery-slidecheckbox', function(Y) { cb.on('focus',function(){ cb.on('key',this.goLeft,'down:37',this); cb.on('key',this.goRight,'down:39',this); - cb.on('key',this.move,'down:32',this); + cb.on('key',function(e){ + e.preventDefault(); + this.move(); + },'down:32',this); },this); cb.on('blur',function(){ cb.detach('key'); @@ -140,10 +143,11 @@ YUI.add('gallery-slidecheckbox', function(Y) { return null; }, _onClick : function(e){ + e.preventDefault(); this.move(); }, _execute : function(){ - this.get(CBX).focus(); + this.focus(); if(this.disabled){ return; } @@ -200,4 +204,4 @@ YUI.add('gallery-slidecheckbox', function(Y) { ); -}, 'gallery-2011.10.27-17-03' ,{skinnable:true, requires:['node-base', 'anim-base', 'anim-easing', 'base-build', 'event-key', 'event-move', 'widget', 'node-style', 'gallery-makenode', 'dd-drag', 'dd-constrain']}); +}, 'gallery-2011.11.10-16-24' ,{skinnable:true, requires:['node-base', 'anim-base', 'anim-easing', 'base-build', 'event-key', 'event-move', 'widget', 'node-style', 'gallery-makenode', 'dd-drag', 'dd-constrain']}); diff --git a/build/gallery-slider-window/assets/gallery-slider-window-core.css b/build/gallery-slider-window/assets/gallery-slider-window-core.css new file mode 100644 index 0000000000..9843dc92b0 --- /dev/null +++ b/build/gallery-slider-window/assets/gallery-slider-window-core.css @@ -0,0 +1,193 @@ +/* ver. 0.6.0 */ +.eaSliderWindow p h1 h2 h3 h4 h5{ + font-size:0.8em; +} + +/* +this should be the boundingBox +eaSliderWindow -> yui3-sliderwindow +*/ +.yui3-sliderwindow { + position:absolute; + left:0px; + padding:0px; + margin:0px; + overflow-y:hidden; + overflow-x:hidden; +} + +/* +this is needed to keeep the handle-target div inside the yui3-overlay-content +and not jumping at the far right of the screen +*/ +.yui3-sliderwindow .yui3-sliderwindow-content { + position: absolute; + /* override default */ + padding: 0px; + margin-right: 0px; + position: relative; +} + +.yui3-sliderwindow .yui3-sliderwindow-content .yui3-widget-bd{ + border:0px; + height:254px; + left:0px; +/* width:inherit; do not 'inherit' otherwise Safari won't resize */ + background:#fff; + background-image:url(sw_handle_bg.gif); + background-repeat: no-repeat; + background-position: right center; +/* +add negative margin-right to make the handle target bg overlap the handle target div +The same to header and footer to make images align. +*/ + margin-right: 0px;/* check this after adding handle-target */ + padding-right: 0px; +} + +.container-close, .yui3-sliderwindow .container-close{ + background:transparent url(sw_sprite.gif) no-repeat scroll 0px 0px; + cursor:pointer; + height:12px; + position:absolute; + right:7px; + top:5px; + visibility:inherit; + width:12px; + z-index:1; +} + +.yui3-sliderwindow .handle-target{ + background:transparent; + cursor:pointer; + width:5px; + position:absolute; + right:0px; + top:21px; + visibility:inherit; + z-index:1; + /* move to right so the click target overlaps the bg image for the body */ + right:0px;/* check this again, cause hd bd and ft have margin-right changed from -5px to +5px */ +} + + /* margin-right to hide the text against right backg image, rest normal padding, height:254px; */ +.yui3-overlay .yui3-sliderwindow-content .yui3-widget-bd .yui3-sliderwindow-bdc{ + height:100%; + overflow-x:hidden; + overflow-y: auto; + left:0px; + text-align: left; + margin-right: 5px;/* equals the width of the handle */ + margin-left: 5px;/* equals the width of the handle and pushes the text outside of the visble area in IE7 */ +} + +.yui3-sliderwindow .yui3-sliderwindow-content .yui3-widget-hd{ + height:21px; + background-image:url(sw_header_bg.gif); + background-repeat: no-repeat; + background-position: top right; + font-size:0.7em; + line-height:21px; + vertical-align: text-bottom; + text-align:center; + border:none; +/* +make images align with bg for handle-targe +*/ + margin-right: 0px;/* check this after adding handle-target */ + padding-right: 0px; +} + +.yui3-sliderwindow .yui3-sliderwindow-hdc{ + height: 21px; + font-size: 1.0em; + line-height: 21px; + vertical-align: text-bottom; + text-align: center; + border: none; + left:0px; + overflow-x: hidden; + overflow-y: hidden; +} + +.yui3-sliderwindow .hd p{ + vertical-align:bottom; +} + +.yui3-sliderwindow .yui3-sliderwindow-content .yui3-widget-ft{ + + height:12px; + background-image:url(sw_footer_bg.gif); + background-repeat: no-repeat; + background-position: top right; +/* +make images align with bg for handle-targe +*/ + margin-right: 0px; + padding-right: 0px; +} + +a#sliderwindow_lnk:link{ + color: #676767; + text-decoration: none; +} + +a#sliderwindow_lnk:visited{ + color: #676767; + text-decoration: none; +} + +a#sliderwindow_lnk:active{ + color: #676767; + text-decoration: none; +} + +a#sliderwindow_lnk:hovered{ + color: #676767; + text-decoration: none; +} + +/* +Show the active handle when hovered +Overriding YUI styles + +.yui-resize-hover .yui-resize-handle-active { + opacity: 1; + filter: alpha(opacity=100); +} + +.yui-resize .yui-resize-handle-inner-t{ + background: transparent no-repeat url(sw_t-handle_bg.gif) 50% 0; + position:absolute; + left: 0px; + height: 5px; + width: 100%; +} + +.yui-resize .yui-resize-handle-inner-tr{ + position:absolute; + left: -5px; + height: 10px; + width: 10px; + background-image: url(sw_sprite.gif); + background-repeat: no-repeat; + background-position: -2px -12px; +} +*/ +/* + here using the original yui3 sprites, just repositioning to: + avoid tr handle to interfere with close icon + align rasterized are to the corner +*/ +.yui3-resize-handle-tr { + right: -6px !important; + top: -6px !important; + width: 10px !important; + height: 10px !important; +} + +.yui3-resize-handle-inner-tr { + right: 3px !important; + top: 3px !important; + +} \ No newline at end of file diff --git a/build/gallery-slider-window/assets/skins/sam/gallery-slider-window-skin.css b/build/gallery-slider-window/assets/skins/sam/gallery-slider-window-skin.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/build/gallery-slider-window/assets/skins/sam/gallery-slider-window.css b/build/gallery-slider-window/assets/skins/sam/gallery-slider-window.css new file mode 100644 index 0000000000..d7292d3d76 --- /dev/null +++ b/build/gallery-slider-window/assets/skins/sam/gallery-slider-window.css @@ -0,0 +1 @@ +.eaSliderWindow p h1 h2 h3 h4 h5{font-size:.8em}.yui3-sliderwindow{position:absolute;left:0;padding:0;margin:0;overflow-y:hidden;overflow-x:hidden}.yui3-sliderwindow .yui3-sliderwindow-content{position:absolute;padding:0;margin-right:0;position:relative}.yui3-sliderwindow .yui3-sliderwindow-content .yui3-widget-bd{border:0;height:254px;left:0;background:#fff;background-image:url(sw_handle_bg.gif);background-repeat:no-repeat;background-position:right center;margin-right:0;padding-right:0}.container-close,.yui3-sliderwindow .container-close{background:transparent url(sw_sprite.gif) no-repeat scroll 0 0;cursor:pointer;height:12px;position:absolute;right:7px;top:5px;visibility:inherit;width:12px;z-index:1}.yui3-sliderwindow .handle-target{background:transparent;cursor:pointer;width:5px;position:absolute;right:0;top:21px;visibility:inherit;z-index:1;right:0}.yui3-overlay .yui3-sliderwindow-content .yui3-widget-bd .yui3-sliderwindow-bdc{height:100%;overflow-x:hidden;overflow-y:auto;left:0;text-align:left;margin-right:5px;margin-left:5px}.yui3-sliderwindow .yui3-sliderwindow-content .yui3-widget-hd{height:21px;background-image:url(sw_header_bg.gif);background-repeat:no-repeat;background-position:top right;font-size:.7em;line-height:21px;vertical-align:text-bottom;text-align:center;border:0;margin-right:0;padding-right:0}.yui3-sliderwindow .yui3-sliderwindow-hdc{height:21px;font-size:1.0em;line-height:21px;vertical-align:text-bottom;text-align:center;border:0;left:0;overflow-x:hidden;overflow-y:hidden}.yui3-sliderwindow .hd p{vertical-align:bottom}.yui3-sliderwindow .yui3-sliderwindow-content .yui3-widget-ft{height:12px;background-image:url(sw_footer_bg.gif);background-repeat:no-repeat;background-position:top right;margin-right:0;padding-right:0}a#sliderwindow_lnk:link{color:#676767;text-decoration:none}a#sliderwindow_lnk:visited{color:#676767;text-decoration:none}a#sliderwindow_lnk:active{color:#676767;text-decoration:none}a#sliderwindow_lnk:hovered{color:#676767;text-decoration:none}.yui3-resize-handle-tr{right:-6px!important;top:-6px!important;width:10px!important;height:10px!important}.yui3-resize-handle-inner-tr{right:3px!important;top:3px!important} diff --git a/build/gallery-slider-window/assets/sw_footer_bg.gif b/build/gallery-slider-window/assets/sw_footer_bg.gif new file mode 100644 index 0000000000000000000000000000000000000000..ba86ffab7f188e5bdf96bcd194d6bd3425dcfb5d GIT binary patch literal 1245 zcmV<31S0!KNk%w1VY~ti0HOu}&d$!-+S-|!nd9T*r>Cc}v9bUE|GvJyA^8LW000I6 zEC2ui0K5VW000C3IJ(^aFv>}*y*TU5yZ>M)j$~<`XsWL48305p&vb3yc&_h!@Bgg8 zD<%vKjK$*-iBvM3!sW8qd`7R+>Xn(~IJ zVT+A;u#|Ozx0p?uh5!cy053wrMaIL(#Ky(MhQH0t%2dqM(Z|2Z&dAEu&(6}`%-Z1C z+veZP-_zvM&)V(d-Pi78-uCL`)${q*_wU#A;e%GL;0t)s0Pss!E}1xN)2yAN2k_s- zcIu!Z49M^Q;XRA)Htwspu^z*T86Of^pyDhmeB;lZ8?g9bhL z)2G9uLuVQVs#IvwrbL+*eTuZ|(Wq0cMun<$SyHdvtahc^bga{@Nb{X_%66+)v|!mT z<@z%#R=R8D*2P;i>(#tM_cAT}RPf!tK*RY>40!Nd#BmAh#rs%n;lO6Kn!Ss8GFOD1 z0Z+AinRH&mVV6bB!2s+zoZQ8JJ*PeY_VQ;p-ZO0zo8n^G_x#c2Pj=VQ- z;>VNkW)569^XJWz3lFYad2s61u}_b_{5W>m(7zk^KKy%k^61sC2S46C^!Vt(&%a;% z_w@7sxN*1NfchCH9(e-x*PealRd?Nj4ni0mfO5$fo`MNJSD$|Vc_)B|yoD$tFb9+v zB8eoHh+>K+f_S2eExwqWi7cjwqKGiYm}849zNll38qRnljMDkYV~jTbxMPwt8W|*r zLaI2VZzD?iq>)J;>Ewz!x;Q10MB)f!j!o_e=9x5_nP!^OeHmtyII5YYmU9-l<&!r~ zsppbb7CB^Tha(aNLU4|-Z ziJ*?^X{lYJI%yXYHO&R;<{_BCZ781s=fkStggehdhD+M z%koO=t-}WUYOm4e+N`am3R`Wh#FE-=w90M^Ex6C-nk)eV7~n0a)PCA-0q~w0Z?EvW zO7FVt(p&Gm`%>GlzV7;Kuf6pKJn+5*%X@IY$hLd1!3^K~FRBj5yKch^yX)=17gzi+ z#0hU)FvlDt9I(6=r%W)u!RqUB#2Tmk@5BBUtg^%*$4s)e$ac&s&Jm9+ZN9>KT(ibH zD=e_jC@-w-$VQ9I^2q=ny)vmTQw?<0GYedE(?@@ewbMFZ%yiHzPmDFfy=qE;0r3(r zuiWs`Ew|nL=B@YM1<=hm-+uos_}qgF9(de<_x<UV37dfls^j=0~c!wxy#uG^mb=y_xQxahS9&N}az zqMNP(1SGHg^2|5y{PWO9Fa7k?S8x6G*k`Z(_S|>x{rBL9FaG%Cmv8?0=%=s#`r>P< zsR8i2FaP}X*Khy*_~)FMdj#Khj--jR`!b#-;6rKSJ>|MT5}j$r)^BX^NQcL-q$%G zFSzp&e?_5j$Xq&=(4-VeJzAU5Dt3B(a<^J~ioHnb^@VDGeZ`;}UwLV_Y z^Y43efPa31g?)jDgo%TOjE7tWA_D~+0RsdVmjoFB1Oy!gpA(oE1Bf!9==+6JsgsrWuy}iAiot>wrr>3T+oSdAjtgM5BgSEA_o12@Fk&*xZ|K#N4 z000000000000000A^8LW000^QEC2ui0K5Vf000I5pd*fCX`X1RuBhd>?isUfIg9gc z@AVkNubb{gBmq~jp)vR?CQTM4O&OJ?a#fquheP6q&mu8AhC0R3YSzkRcg1Kfi|Xbz z-@NV?&kw@$I%{coIX;3yWqNaFeR6((MthB5T5yPYC>k09oSmMZprN9pq@|{(sHv)} ztgWuEu(7hUw6(UkxVgH!yuH4(8=x8##Kp$P$jQpf%*_-70};>>)YH<`*U;M2(cIP1 z(%|9U;n?Qb;^5I3)#cw26ywqb+t%mz`1$(#{Qdpp{sO{tW-Ob#ZRpI2lQ&MCI)x0m zv4g1aS-pz`2|hEJO>liIO?*jgg9iPL7W zj4^Kt_4yNM&x;MGyK>!5D8RO`;lqd%D^^^9Fk8Zo4?`YId9dTgl`Tg$ zyqPlQ&xJQbzWg}zV#IyD{@uD7?CQ8?@zQN9`ZQzOxO3~?&AYen-@t#{zAf2uapRID zj4sVQv}xzhLr*r{*Z615hBt)H@SsBX2i?7c7Y}}X`10t-S6I)!z5Dm@X%-493seIgc6o`;)^iGDC3MY)@b96IOeG1jy(40hyLoO1Hn=bm}$iRYem7Ru+Kch;F_p?~73r=Wo<`lz9RG8!qNj`j&@qli}O z=b(~0>M5m%VhXCInKr5^rh+Q!Dxj@~dg`X8mU=3skNz2HuC`X1>!PJ{ny8(tCi*F? zvihm%qLUIEtFxd!yDX`_25PMTsjDI?Y_{13do8wxa>}Zz(-L|qx37LmY_h-}8mqgn zHY@F@mjF!J(MTt)^wLZ>?KIK`81QBQR99{F)mUe(_10W>?e*7Shb{KlWS4FB*=VP&_S$T> z?e^Pn$1V5Vbk}V++$_I|z}|fK?f2h+2QK*Fgcol3;fN=$_~MK=?)c-7M=tr~lvi%~ z<(Ox#`R1H=emT`|0wDVT=%kl!`st{ruKMb%x9XiQ@Wzo^DGy77&0jH4Xq=tdt#k&bxGqaOFj$3FT|gmx6b T9|uXuLK^arh&||B63Z7#SFt8FUzc03^@AWZBctemYm7 zZ4T2O!Iv8tPs}O2H$7L}vh#jc*^Mt
'; + //setting padding-left to headerHeight quick way to avoid showing the text on the bg image when sw is closed + SliderWindow.CREDIT = '
{creditCont}
'; + SliderWindow.HEADER_CONTENT = '
'; + SliderWindow.BODY_CONTENT = '
{userContent}
'; + + /* SliderWindow extends the base Widget class */ + Y.extend(SliderWindow, Y.Overlay, { + + initializer: function() { + /* + * initializer is part of the lifecycle introduced by + * the Base class. It is invoked during construction, + * and can be used to setup instance specific state or publish events which + * require special configuration (if they don't need custom configuration, + * events are published lazily only if there are subscribers). + * + * It does not need to invoke the superclass initializer. + * init() will call initializer() for all classes in the hierarchy. + */ + }, + + renderUI : function() { + /* + * renderUI is part of the lifecycle introduced by the + * Widget class. Widget's renderer method invokes: + * + * renderUI() + * bindUI() + * syncUI() + * + * renderUI is intended to be used by the Widget subclass + * to create or insert new elements into the DOM. + */ + this.slider = Y.one(POUND + this.get("id")); + ANIM = new Y.Anim({ + node: this.get(STR_SRCNODE), + to: { + width: this.get(STR_HANDLEWIDTH) + }, + from: { + width: this.get(STR_OPENWIDTH) + } + }); + + ANIM.set('duration', TIME_DURATION); + ANIM.set('easing', Easing.easeIn); + + //Append close icon, and handle click target + var title = Y.UA.opera > 0 ? "Click to close/open or hit ctrl+shift-left/right arrow to close/open" : this.get("closeTitle"), + //Append header container to header, give it a class name + headerHeight = this.get("headerHeight"), + cssHeaderName = this.getClassName(CSS_HEADERCONT); + + this.get(STR_SRCNODE).append(Y.substitute(SliderWindow.CLOSE_HANDLE, + {title: title, + closeHandleHeight: 300, + headerHeight: headerHeight} + ) + ); + + this.set('headerContent',Y.substitute(SliderWindow.HEADER_CONTENT, + {cssHeaderCont: cssHeaderName} + ) + ); + + if(this.get('credit') === FALSE){ + CREDIT_CONT = ''; + } + footerConfig = {footerHeight: this.get("footerHeight"),headerHeight: headerHeight, creditCont: CREDIT_CONT}; + this.set('footerContent',Y.substitute(SliderWindow.CREDIT, + footerConfig + ) + ); + + + this.contentElement = Y.one(POUND + CONTENT_EL_ID); + + }, + + bindUI : function() { + /* + * bindUI is intended to be used by the Widget subclass + * to bind any event listeners which will drive the Widget UI. + * + * It will generally bind event listeners for attribute change + * events, to update the state of the rendered UI in response + * to attribute value changes, and also attach any DOM events, + * to activate the UI. + */ + Y.log("bindUI", 'info', SliderWindow.NAME); + + /* + using Y.bind cause it seems like Y.on supports context in signature, + node.delegate does too, but node.on does not + */ + this.slider.on("click", Y.bind(function (e) { + this._handleClick(e); + }, this), ["." + CLASS_CONTAINER_CLOSE, "." + CLASS_HANDLE_TARGET]); + + this.after("openWidthChange", this._uiSetOpenWidth, this); + this.after("widthChange", this._afterWidthChange, this); + + Y.on("keydown", this._handleArrow, "html", this); + + ANIM.on('end', this._handleEndBehaviour, this); + + if(resizeConfig){ + /* + contrain to maxWidth and maxHeight + due to images dimensions + */ + var constrainConfig = { + maxWidth: resizeConfig.maxWidth, + maxHeight: resizeConfig.maxHeight + }; + this.resize = new Y.Resize(resizeConfig) + .plug(Y.Plugin.ResizeProxy) + .plug(Y.Plugin.ResizeConstrained, constrainConfig); + /* + after each proxy resize, refresh sw dimensions + Use 'after' event not 'on', to avoid _repositionSlider + and _removeWidthStyle conflicting with resizing + */ + + this.resize.after('resize:end',function(ev){ + Y.log("resize:end", 'info', SliderWindow.NAME); + var newHeight = ev.details[0].info.offsetHeight; + this.set(STR_HEIGHT, newHeight); + this.set('srcWidth', ev.details[0].info.offsetWidth); + Y.log("resize:end invoking _respositionSlider", 'info', SliderWindow.NAME); + Y.bind(this._repositionSlider(), this); + /* + Apparently the resize utility (or maybe Anim) does add a width to + the boundingBox after resizing. + This prevents the handlers to follow the srcNode back to dock + position when the sw closes. Removing the width property fixes the issue + */ + this._removeWidthStyle(); + + },this); + } + }, + + syncUI : function() { + /* + * syncUI is intended to be used by the Widget subclass to + * update the UI to reflect the initial state of the widget, + * after renderUI. From there, the event listeners we bound above + * will take over. + */ + + /* + get width and height and render the widget. + That is: + set yui3-sliderwindow yui3-sliderwindow-content to width + set .yui3-sliderwindow .yui3-sliderwindow-content .yui3-widget-bd to + height = (userHeight - headerHeight - footerHeight) + + We need a default headerHeight and footerHeight + + */ + // uiSetAttrA methods are called automatically by widget class for default attributes + // this._uiSetWidth(w); + // this._uiSetHeight(h - hh - fh); + this._uiSetHandleWidth(); + this._uiSetOpenWidth(); + this._repositionSlider(); + }, + + // Beyond this point is the MyWidget specific application and rendering logic + + + _setResizing : function (val) { + Y.log("_setResizing", 'info', SliderWindow.NAME); + if(val){ + resizeConfig = { + node: POUND + this.get('id'), + handles: ['t', 'tr'], + maxWidth: SIZE_MAX_WIDTH, + maxHeight: SIZE_MAX_HEIGHT + }; + } + return val; + }, + /* Attribute state supporting methods (see attribute config above) */ + + _uiSetOpenWidth : function () { + Y.log("_uiSetOpenWidth", 'info', SliderWindow.NAME); + var i_width = parseInt(this.get(STR_OPENWIDTH), 10); + ANIM.set('from', {width: i_width}); + }, + + _uiSetHandleWidth : function (val) { + Y.log("_uiSetHandleWidth", 'info', SliderWindow.NAME); + var i_width = parseInt(this.get(STR_HANDLEWIDTH), 10); + this.get(STR_SRCNODE).setStyle('width', i_width + PX); + }, + + _setWithFocus : function (val) { + Y.log("_setWithFocus: " + Y.dump(val), 'info', SliderWindow.NAME); + this.once("isOpenChange",function (e, val) { + this._uiSetWithFocus(val); + }, this, val); + + }, + + _uiSetWithFocus : function (val) { + Y.log("_uiSetWithFocus", 'info', SliderWindow.NAME); + // Y.one(val).getDOMNode().addClass('focused'); + Y.Node.getDOMNode(Y.one(val)).focus(); + }, + /* to do: change into _uiSetHeight */ + _setHeight : function (val) { + Y.log("_setHeight with val:" + val, 'info', SliderWindow.NAME); + var i_height = parseInt(val, 10); + this.get(STR_SRCNODE).setStyle(STR_HEIGHT, i_height + PX); + }, + + /* to do: change into _uiSetSrcWidth */ + _setSrcWidth : function (val) { + Y.log("_setSrcWidth with val:" + val, 'info', SliderWindow.NAME); + var i_width = parseInt(val, 10); + this.get(STR_SRCNODE).setStyle('width', i_width + PX); + this.set(STR_OPENWIDTH, i_width); + }, + + _repositionSlider : function () { + Y.log("_repositionSlider", 'info', SliderWindow.NAME); + + //Reposition the widget at the bottom of the page. It might have been scrolled up + var offSet = this.slider.get("docScrollY"), + vp = this.slider.get("winHeight"), + iHeight = parseInt(this.get(STR_HEIGHT), 10); + //using overlay own property: xy + Y.log("_repositionSlider with vals: offSet: " + offSet + " viewPort height: " + vp + " sliderWindow height: " + iHeight, 'info', SliderWindow.NAME); + //place on viewport bottom, adding the invisible part that has been scrolled up + this.set("xy",[0, vp + offSet - iHeight]); + }, + + _handleClick : function (e) { + //handle click on click target (handle-target or container-close) + Y.log("_handleClick", 'info', SliderWindow.NAME); + + if(CLASS_CONTAINER_CLOSE === e.target.get(STR_CLASSNAME)){ + this.closeWindow(); + + }else if (CLASS_HANDLE_TARGET === e.target.get(STR_CLASSNAME)){ + if(this.get('isClosed')){ + this._handlePublishMessageEvent(STR_STOP); + }else{ + this.closeWindow(); + } + } + }, + + /** + * Publish an event delegation for the event 'eventName' to the elements reached by the selector 'selector' + * Listen to it with Y.on/after ... as sliderWindow:prefix + * NB! duplicate event/selector pairs won't be published, however you are responsible for + * not using different selectors that leads to the same event attached to the same element + * + * @method publishEvent + * @param {string} eventName the event to be fired, must be a native DOM event + * @param {string} selector, the selector used to define the elements the event is attached to + * @param {string} prefix, a prefix to be added to the event type, use it for listening to the event + */ + publishEvent : function (eventName, selector, prefix) { + Y.log("publishEvent", 'info', SliderWindow.NAME); + + if(!this._isPublished(eventName, selector, prefix)){ + this._storePublished(eventName, selector); + this.publish(prefix + STR_SUFFIX_SEP + eventName, + { + emitFacade: false,/*substitue with the e (this) passed to this._passThroughEvent*/ + bubbles: true, + broadcast: true/*Y is able to catch it*/ + + }); + //delegate a DOM event, pass to the handler the custom event name, but the original event + var evt = Y.delegate(eventName,this._passThroughEvent,this.get('boundingBox'), selector,this, prefix + STR_SUFFIX_SEP + eventName); + Y.log("Published event: " + evt.type + " for selector: " + selector, 'info', SliderWindow.NAME); + this._saveHandle(evt, eventName, selector); + + }else{ + Y.log("Ignoring already published event: " + prefix + STR_SUFFIX_SEP + eventName + " for selector: '" + selector + "'", 'info', SliderWindow.NAME); + } + }, + + _isPublished : function (eventName, selector) { + Y.log("_isPublished", 'info', SliderWindow.NAME); + var ret = false; + OBJ_PUBLISHED_EVENTS[eventName] = OBJ_PUBLISHED_EVENTS[eventName] || {}; + if( undefined !== OBJ_PUBLISHED_EVENTS[eventName][selector]){ + ret = true; + } + var is_added = ret? 'is not' : 'is'; + Y.log("Event: '" + eventName + "' " + is_added + " added to be published" , 'info', SliderWindow.NAME); + return ret; + + }, + + _storePublished : function (eventName, selector) { + OBJ_PUBLISHED_EVENTS[eventName][selector] = {}; + }, + + _saveHandle : function (evHandle, eventName, selector) { + OBJ_PUBLISHED_EVENTS[eventName][selector] = evHandle; + }, + /** + * Detach an event 'eventName' added with publishEvent from the elements reached by the selector 'selector' + * and prefixed + * Listen to it with Y.on/after ... as sliderWindow:prefix + * NB! duplicate event/selector pairs won't be published, however you are responsible for + * not using different selectors that leads to the same event attached to the same element + * + * @method detachEvent + * @param {string} eventName the event to be fired, must be a native DOM event + * @param {string} selector, the selector used to define the elements the event is attached to + * @param {string} prefix, a prefix to be added to the event type, use it for listening to the event + */ + detachEvent : function (eventName, selector) { + Y.log("detachEvent, detaching " + eventName + ' for els selected with: ' + selector, 'info', SliderWindow.NAME); + var detachRes = OBJ_PUBLISHED_EVENTS[eventName][selector].detach(); + Y.log("detachEvent, purging " + detachRes + ' element(s)' + SliderWindow.NAME, 'info', SliderWindow.NAME); + + }, + + _passThroughEvent : function (e, eventName) { + Y.log("_passThroughEvent vith event: " + eventName , 'info', SliderWindow.NAME); + Y.log("Firing: '" + eventName+ "'", 'info', SliderWindow.NAME); + this.fire(eventName, e); + }, + + _handleMouseDown : function () { + //handel mouseup, not used originally, may be used for editing in sw + Y.log("_handleMouseDown", 'info', SliderWindow.NAME); + }, + + _handleMouseUp : function () { + //handel mouseup, not used originally, may be used for editing in sw + Y.log("_handleMouseUp", 'info', SliderWindow.NAME); + }, + + _handleArrow : function (e) { + //handel keydown on arrow keys + Y.log("_handleArrow", 'info', SliderWindow.NAME); + isCtrl = FALSE; + if(e.ctrlKey){ + isCtrl = TRUE; + } + if(isCtrl){ + if(e.shiftKey && !Y.UA.opera){ + return; + } + /* right arrow */ + if (39 == e.charCode){ + if(this.get('isClosed')){ + this._handlePublishMessageEvent(STR_STOP); + } + + //in Opera it doesn't prevent it to browse back/forth + //Opera user will have to ctrl shift - arrow + e.halt(); + } + /* left arrow */ + if (37 == e.charCode){ + /* + if the window was not completely open do nothing + */ + if(this.get('isOpen')){ + this.closeWindow(); + } + e.halt(); + } + } + }, + + _handlePublishMessageEvent : function (action) { + Y.log("_handlePublishMessageEvent", 'info', SliderWindow.NAME); + this._repositionSlider(); + + switch(action){ + case STR_STOP: + STOP = TRUE; + + break; + case STR_PUBLISH: + STOP = FALSE; + + break; + } + //behave normal running from closed window + if(this.get('isClosed')){ + this.openWindow(); + }else{ + //close window with delay for publish or else leave it open + if(!STOP){ + Y.later(TIME_DURATION * 1000 / 2, this, 'closeWindow'); + } + } + + }, + + _handleEndBehaviour : function (action) { + Y.log("_handleEndBehaviour", 'info', SliderWindow.NAME); + this._setIsOpen(); + /** + * change styles for the window (to please IE6). + * The handler bg image is reset to the right + */ + if(this.get('isOpen')){ + Y.one("." + CLASS_HANDLE_TARGET).setStyle(CSS_BACKGROUND_POSITION_X,'right'); + if(STOP){ + return; + } + ANIM.set(STR_REVERSE, FALSE); + this.closeWindow(); + }else{ + Y.one("." + CLASS_HANDLE_TARGET).setStyle(CSS_BACKGROUND_POSITION_X,'left'); + } + }, + + _setIsOpen : function () { + if(parseInt(this.get(STR_SRCNODE).getStyle('width'), 10) < parseInt(this.get(STR_OPENWIDTH), 10)){ + this._set('isOpen', false); + this._set('isClosed', true); + }else{ + this._set('isOpen', true); + this._set('isClosed', false); + } + }, + + _setBodyContent : function (val) { + Y.log('_setBodyContent', 'info', SliderWindow.NAME); + var cssBodyName = this.getClassName(CSS_BODYCONT); + return Y.substitute(SliderWindow.BODY_CONTENT, + {cssBodyCont: cssBodyName, userContent: val} + ); + }, + + _removeWidthStyle : function () { + Y.log("_removeWidthStyle", 'info', SliderWindow.NAME); + this.get('boundingBox').setStyle('width', ''); + }, + /** + * Close the window without changing the content + * @method closeWindow + */ + closeWindow : function () { + Y.log("closeWindow", 'info', SliderWindow.NAME); + ANIM.set(STR_REVERSE, FALSE); + this._repositionSlider(); + ANIM.run(); + }, + /** + * Open the window without changing the content + * @method openWindow + */ + openWindow : function () { + Y.log("openWindow", 'info', SliderWindow.NAME); + ANIM.set(STR_REVERSE, TRUE); + ANIM.set("easing", Easing.easeIn); + ANIM.run(); + }, + + /** + * Add a new text to the Bodycont element and trigger the handlePublishMessageEvent + * @method sendMessage + * @param {string} txt the text/html to be published + * @param {string} mode, (publish| open), whether the window shall open and close or only open + * @param {string} bypass, if 'ponderaid' bypass setting body. Ponderaid has its own method for writing text. + */ + sendMessage : function (txt, mode, bypass) { + + var isPonderaid = FALSE; + + if(bypass == 'ponderaid'){ + isPonderaid = TRUE; + } + + if(!isPonderaid){ + this.set('bodyContent', txt); + } + + if(Y.Lang.isString(mode)){ + switch(mode){ + case STR_PUBLISH: + this._handlePublishMessageEvent(STR_PUBLISH); + + break; + case 'open': + this._handlePublishMessageEvent(STR_STOP); + + break; + } + }else{ + this._handlePublishMessageEvent(STR_PUBLISH); + } + } + }); + + Y.namespace("Overlay").SliderWindow = SliderWindow; + + +}, 'gallery-2011.11.10-16-24' ,{requires:['overlay', 'node', 'anim-base','anim-node','anim-easing', 'substitute']}); diff --git a/build/gallery-slider-window/gallery-slider-window-min.js b/build/gallery-slider-window/gallery-slider-window-min.js new file mode 100644 index 0000000000..8637086213 --- /dev/null +++ b/build/gallery-slider-window/gallery-slider-window-min.js @@ -0,0 +1,2 @@ +YUI.add("gallery-slider-window",function(e){var A=21,I=12,a=5,p=700,l=500,v=400,c=287,h=0.5,j="bdc",d="hdc",H="background-position-x",J="px",x="#",n="handle-target",F="container-close",z='SliderWindow',g=e.Easing,y="ea_swbdc",b,m,u,i,w=true,G=false,B=w,D="stop",K="publish",t="openWidth",o="height",k="srcNode",f="handleWidth",r="className",q="reverse",E="-",s={};function C(L){C.superclass.constructor.apply(this,arguments);}C.NAME="sliderWindow";C.ATTRS={openWidth:{value:v},headerCWidth:{value:v-A},height:{value:c,setter:"_setHeight"},srcWidth:{setter:"_setSrcWidth"},headerHeight:{value:A},footerHeight:{value:I},resizing:{value:G,setter:"_setResizing",lazyAdd:G},closeTitle:{value:"Click to close/open or ctrl-left/right arrow to close/open"},handleWidth:{value:a},className:{value:"eaSliderWindow"},credit:{value:w},bodyContent:{value:"",setter:"_setBodyContent"},withFocus:{setter:"_setWithFocus",validator:function(L){return this.get("isClosed")&&e.one(L);}},isOpen:{value:false,readOnly:true},isClosed:{value:true,readOnly:true}};C.CLOSE_HANDLE='
';C.CREDIT='
{creditCont}
';C.HEADER_CONTENT='
';C.BODY_CONTENT='
{userContent}
';e.extend(C,e.Overlay,{initializer:function(){},renderUI:function(){this.slider=e.one(x+this.get("id"));b=new e.Anim({node:this.get(k),to:{width:this.get(f)},from:{width:this.get(t)}});b.set("duration",h);b.set("easing",g.easeIn);var N=e.UA.opera>0?"Click to close/open or hit ctrl+shift-left/right arrow to close/open":this.get("closeTitle"),M=this.get("headerHeight"),L=this.getClassName(d);this.get(k).append(e.substitute(C.CLOSE_HANDLE,{title:N,closeHandleHeight:300,headerHeight:M}));this.set("headerContent",e.substitute(C.HEADER_CONTENT,{cssHeaderCont:L}));if(this.get("credit")===G){z="";}m={footerHeight:this.get("footerHeight"),headerHeight:M,creditCont:z};this.set("footerContent",e.substitute(C.CREDIT,m));this.contentElement=e.one(x+y);},bindUI:function(){this.slider.on("click",e.bind(function(M){this._handleClick(M);},this),["."+F,"."+n]);this.after("openWidthChange",this._uiSetOpenWidth,this);this.after("widthChange",this._afterWidthChange,this);e.on("keydown",this._handleArrow,"html",this);b.on("end",this._handleEndBehaviour,this);if(i){var L={maxWidth:i.maxWidth,maxHeight:i.maxHeight};this.resize=new e.Resize(i).plug(e.Plugin.ResizeProxy).plug(e.Plugin.ResizeConstrained,L);this.resize.after("resize:end",function(N){var M=N.details[0].info.offsetHeight;this.set(o,M);this.set("srcWidth",N.details[0].info.offsetWidth);e.bind(this._repositionSlider(),this);this._removeWidthStyle();},this);}},syncUI:function(){this._uiSetHandleWidth();this._uiSetOpenWidth();this._repositionSlider();},_setResizing:function(L){if(L){i={node:x+this.get("id"),handles:["t","tr"],maxWidth:p,maxHeight:l};}return L;},_uiSetOpenWidth:function(){var L=parseInt(this.get(t),10);b.set("from",{width:L});},_uiSetHandleWidth:function(L){var M=parseInt(this.get(f),10);this.get(k).setStyle("width",M+J);},_setWithFocus:function(L){this.once("isOpenChange",function(M,N){this._uiSetWithFocus(N);},this,L);},_uiSetWithFocus:function(L){e.Node.getDOMNode(e.one(L)).focus();},_setHeight:function(M){var L=parseInt(M,10);this.get(k).setStyle(o,L+J);},_setSrcWidth:function(L){var M=parseInt(L,10);this.get(k).setStyle("width",M+J);this.set(t,M);},_repositionSlider:function(){var M=this.slider.get("docScrollY"),L=this.slider.get("winHeight"),N=parseInt(this.get(o),10);this.set("xy",[0,L+M-N]);},_handleClick:function(L){if(F===L.target.get(r)){this.closeWindow();}else{if(n===L.target.get(r)){if(this.get("isClosed")){this._handlePublishMessageEvent(D);}else{this.closeWindow();}}}},publishEvent:function(N,L,O){if(!this._isPublished(N,L,O)){this._storePublished(N,L);this.publish(O+E+N,{emitFacade:false,bubbles:true,broadcast:true});var M=e.delegate(N,this._passThroughEvent,this.get("boundingBox"),L,this,O+E+N);this._saveHandle(M,N,L);}else{}},_isPublished:function(N,M){var O=false;s[N]=s[N]||{};if(undefined!==s[N][M]){O=true;}var L=O?"is not":"is";return O;},_storePublished:function(M,L){s[M][L]={};},_saveHandle:function(N,M,L){s[M][L]=N;},detachEvent:function(N,L){var M=s[N][L].detach();},_passThroughEvent:function(M,L){this.fire(L,M);},_handleMouseDown:function(){},_handleMouseUp:function(){},_handleArrow:function(L){u=G;if(L.ctrlKey){u=w;}if(u){if(L.shiftKey&&!e.UA.opera){return;}if(39==L.charCode){if(this.get("isClosed")){this._handlePublishMessageEvent(D);}L.halt();}if(37==L.charCode){if(this.get("isOpen")){this.closeWindow();}L.halt();}}},_handlePublishMessageEvent:function(L){this._repositionSlider();switch(L){case D:B=w;break;case K:B=G;break;}if(this.get("isClosed")){this.openWindow();}else{if(!B){e.later(h*1000/2,this,"closeWindow");}}},_handleEndBehaviour:function(L){this._setIsOpen();if(this.get("isOpen")){e.one("."+n).setStyle(H,"right");if(B){return;}b.set(q,G);this.closeWindow();}else{e.one("."+n).setStyle(H,"left");}},_setIsOpen:function(){if(parseInt(this.get(k).getStyle("width"),10)
'; + //setting padding-left to headerHeight quick way to avoid showing the text on the bg image when sw is closed + SliderWindow.CREDIT = '
{creditCont}
'; + SliderWindow.HEADER_CONTENT = '
'; + SliderWindow.BODY_CONTENT = '
{userContent}
'; + + /* SliderWindow extends the base Widget class */ + Y.extend(SliderWindow, Y.Overlay, { + + initializer: function() { + /* + * initializer is part of the lifecycle introduced by + * the Base class. It is invoked during construction, + * and can be used to setup instance specific state or publish events which + * require special configuration (if they don't need custom configuration, + * events are published lazily only if there are subscribers). + * + * It does not need to invoke the superclass initializer. + * init() will call initializer() for all classes in the hierarchy. + */ + }, + + renderUI : function() { + /* + * renderUI is part of the lifecycle introduced by the + * Widget class. Widget's renderer method invokes: + * + * renderUI() + * bindUI() + * syncUI() + * + * renderUI is intended to be used by the Widget subclass + * to create or insert new elements into the DOM. + */ + this.slider = Y.one(POUND + this.get("id")); + ANIM = new Y.Anim({ + node: this.get(STR_SRCNODE), + to: { + width: this.get(STR_HANDLEWIDTH) + }, + from: { + width: this.get(STR_OPENWIDTH) + } + }); + + ANIM.set('duration', TIME_DURATION); + ANIM.set('easing', Easing.easeIn); + + //Append close icon, and handle click target + var title = Y.UA.opera > 0 ? "Click to close/open or hit ctrl+shift-left/right arrow to close/open" : this.get("closeTitle"), + //Append header container to header, give it a class name + headerHeight = this.get("headerHeight"), + cssHeaderName = this.getClassName(CSS_HEADERCONT); + + this.get(STR_SRCNODE).append(Y.substitute(SliderWindow.CLOSE_HANDLE, + {title: title, + closeHandleHeight: 300, + headerHeight: headerHeight} + ) + ); + + this.set('headerContent',Y.substitute(SliderWindow.HEADER_CONTENT, + {cssHeaderCont: cssHeaderName} + ) + ); + + if(this.get('credit') === FALSE){ + CREDIT_CONT = ''; + } + footerConfig = {footerHeight: this.get("footerHeight"),headerHeight: headerHeight, creditCont: CREDIT_CONT}; + this.set('footerContent',Y.substitute(SliderWindow.CREDIT, + footerConfig + ) + ); + + + this.contentElement = Y.one(POUND + CONTENT_EL_ID); + + }, + + bindUI : function() { + /* + * bindUI is intended to be used by the Widget subclass + * to bind any event listeners which will drive the Widget UI. + * + * It will generally bind event listeners for attribute change + * events, to update the state of the rendered UI in response + * to attribute value changes, and also attach any DOM events, + * to activate the UI. + */ + + /* + using Y.bind cause it seems like Y.on supports context in signature, + node.delegate does too, but node.on does not + */ + this.slider.on("click", Y.bind(function (e) { + this._handleClick(e); + }, this), ["." + CLASS_CONTAINER_CLOSE, "." + CLASS_HANDLE_TARGET]); + + this.after("openWidthChange", this._uiSetOpenWidth, this); + this.after("widthChange", this._afterWidthChange, this); + + Y.on("keydown", this._handleArrow, "html", this); + + ANIM.on('end', this._handleEndBehaviour, this); + + if(resizeConfig){ + /* + contrain to maxWidth and maxHeight + due to images dimensions + */ + var constrainConfig = { + maxWidth: resizeConfig.maxWidth, + maxHeight: resizeConfig.maxHeight + }; + this.resize = new Y.Resize(resizeConfig) + .plug(Y.Plugin.ResizeProxy) + .plug(Y.Plugin.ResizeConstrained, constrainConfig); + /* + after each proxy resize, refresh sw dimensions + Use 'after' event not 'on', to avoid _repositionSlider + and _removeWidthStyle conflicting with resizing + */ + + this.resize.after('resize:end',function(ev){ + var newHeight = ev.details[0].info.offsetHeight; + this.set(STR_HEIGHT, newHeight); + this.set('srcWidth', ev.details[0].info.offsetWidth); + Y.bind(this._repositionSlider(), this); + /* + Apparently the resize utility (or maybe Anim) does add a width to + the boundingBox after resizing. + This prevents the handlers to follow the srcNode back to dock + position when the sw closes. Removing the width property fixes the issue + */ + this._removeWidthStyle(); + + },this); + } + }, + + syncUI : function() { + /* + * syncUI is intended to be used by the Widget subclass to + * update the UI to reflect the initial state of the widget, + * after renderUI. From there, the event listeners we bound above + * will take over. + */ + + /* + get width and height and render the widget. + That is: + set yui3-sliderwindow yui3-sliderwindow-content to width + set .yui3-sliderwindow .yui3-sliderwindow-content .yui3-widget-bd to + height = (userHeight - headerHeight - footerHeight) + + We need a default headerHeight and footerHeight + + */ + // uiSetAttrA methods are called automatically by widget class for default attributes + // this._uiSetWidth(w); + // this._uiSetHeight(h - hh - fh); + this._uiSetHandleWidth(); + this._uiSetOpenWidth(); + this._repositionSlider(); + }, + + // Beyond this point is the MyWidget specific application and rendering logic + + + _setResizing : function (val) { + if(val){ + resizeConfig = { + node: POUND + this.get('id'), + handles: ['t', 'tr'], + maxWidth: SIZE_MAX_WIDTH, + maxHeight: SIZE_MAX_HEIGHT + }; + } + return val; + }, + /* Attribute state supporting methods (see attribute config above) */ + + _uiSetOpenWidth : function () { + var i_width = parseInt(this.get(STR_OPENWIDTH), 10); + ANIM.set('from', {width: i_width}); + }, + + _uiSetHandleWidth : function (val) { + var i_width = parseInt(this.get(STR_HANDLEWIDTH), 10); + this.get(STR_SRCNODE).setStyle('width', i_width + PX); + }, + + _setWithFocus : function (val) { + this.once("isOpenChange",function (e, val) { + this._uiSetWithFocus(val); + }, this, val); + + }, + + _uiSetWithFocus : function (val) { + // Y.one(val).getDOMNode().addClass('focused'); + Y.Node.getDOMNode(Y.one(val)).focus(); + }, + /* to do: change into _uiSetHeight */ + _setHeight : function (val) { + var i_height = parseInt(val, 10); + this.get(STR_SRCNODE).setStyle(STR_HEIGHT, i_height + PX); + }, + + /* to do: change into _uiSetSrcWidth */ + _setSrcWidth : function (val) { + var i_width = parseInt(val, 10); + this.get(STR_SRCNODE).setStyle('width', i_width + PX); + this.set(STR_OPENWIDTH, i_width); + }, + + _repositionSlider : function () { + + //Reposition the widget at the bottom of the page. It might have been scrolled up + var offSet = this.slider.get("docScrollY"), + vp = this.slider.get("winHeight"), + iHeight = parseInt(this.get(STR_HEIGHT), 10); + //using overlay own property: xy + //place on viewport bottom, adding the invisible part that has been scrolled up + this.set("xy",[0, vp + offSet - iHeight]); + }, + + _handleClick : function (e) { + //handle click on click target (handle-target or container-close) + + if(CLASS_CONTAINER_CLOSE === e.target.get(STR_CLASSNAME)){ + this.closeWindow(); + + }else if (CLASS_HANDLE_TARGET === e.target.get(STR_CLASSNAME)){ + if(this.get('isClosed')){ + this._handlePublishMessageEvent(STR_STOP); + }else{ + this.closeWindow(); + } + } + }, + + /** + * Publish an event delegation for the event 'eventName' to the elements reached by the selector 'selector' + * Listen to it with Y.on/after ... as sliderWindow:prefix + * NB! duplicate event/selector pairs won't be published, however you are responsible for + * not using different selectors that leads to the same event attached to the same element + * + * @method publishEvent + * @param {string} eventName the event to be fired, must be a native DOM event + * @param {string} selector, the selector used to define the elements the event is attached to + * @param {string} prefix, a prefix to be added to the event type, use it for listening to the event + */ + publishEvent : function (eventName, selector, prefix) { + + if(!this._isPublished(eventName, selector, prefix)){ + this._storePublished(eventName, selector); + this.publish(prefix + STR_SUFFIX_SEP + eventName, + { + emitFacade: false,/*substitue with the e (this) passed to this._passThroughEvent*/ + bubbles: true, + broadcast: true/*Y is able to catch it*/ + + }); + //delegate a DOM event, pass to the handler the custom event name, but the original event + var evt = Y.delegate(eventName,this._passThroughEvent,this.get('boundingBox'), selector,this, prefix + STR_SUFFIX_SEP + eventName); + this._saveHandle(evt, eventName, selector); + + }else{ + } + }, + + _isPublished : function (eventName, selector) { + var ret = false; + OBJ_PUBLISHED_EVENTS[eventName] = OBJ_PUBLISHED_EVENTS[eventName] || {}; + if( undefined !== OBJ_PUBLISHED_EVENTS[eventName][selector]){ + ret = true; + } + var is_added = ret? 'is not' : 'is'; + return ret; + + }, + + _storePublished : function (eventName, selector) { + OBJ_PUBLISHED_EVENTS[eventName][selector] = {}; + }, + + _saveHandle : function (evHandle, eventName, selector) { + OBJ_PUBLISHED_EVENTS[eventName][selector] = evHandle; + }, + /** + * Detach an event 'eventName' added with publishEvent from the elements reached by the selector 'selector' + * and prefixed + * Listen to it with Y.on/after ... as sliderWindow:prefix + * NB! duplicate event/selector pairs won't be published, however you are responsible for + * not using different selectors that leads to the same event attached to the same element + * + * @method detachEvent + * @param {string} eventName the event to be fired, must be a native DOM event + * @param {string} selector, the selector used to define the elements the event is attached to + * @param {string} prefix, a prefix to be added to the event type, use it for listening to the event + */ + detachEvent : function (eventName, selector) { + var detachRes = OBJ_PUBLISHED_EVENTS[eventName][selector].detach(); + + }, + + _passThroughEvent : function (e, eventName) { + this.fire(eventName, e); + }, + + _handleMouseDown : function () { + //handel mouseup, not used originally, may be used for editing in sw + }, + + _handleMouseUp : function () { + //handel mouseup, not used originally, may be used for editing in sw + }, + + _handleArrow : function (e) { + //handel keydown on arrow keys + isCtrl = FALSE; + if(e.ctrlKey){ + isCtrl = TRUE; + } + if(isCtrl){ + if(e.shiftKey && !Y.UA.opera){ + return; + } + /* right arrow */ + if (39 == e.charCode){ + if(this.get('isClosed')){ + this._handlePublishMessageEvent(STR_STOP); + } + + //in Opera it doesn't prevent it to browse back/forth + //Opera user will have to ctrl shift - arrow + e.halt(); + } + /* left arrow */ + if (37 == e.charCode){ + /* + if the window was not completely open do nothing + */ + if(this.get('isOpen')){ + this.closeWindow(); + } + e.halt(); + } + } + }, + + _handlePublishMessageEvent : function (action) { + this._repositionSlider(); + + switch(action){ + case STR_STOP: + STOP = TRUE; + + break; + case STR_PUBLISH: + STOP = FALSE; + + break; + } + //behave normal running from closed window + if(this.get('isClosed')){ + this.openWindow(); + }else{ + //close window with delay for publish or else leave it open + if(!STOP){ + Y.later(TIME_DURATION * 1000 / 2, this, 'closeWindow'); + } + } + + }, + + _handleEndBehaviour : function (action) { + this._setIsOpen(); + /** + * change styles for the window (to please IE6). + * The handler bg image is reset to the right + */ + if(this.get('isOpen')){ + Y.one("." + CLASS_HANDLE_TARGET).setStyle(CSS_BACKGROUND_POSITION_X,'right'); + if(STOP){ + return; + } + ANIM.set(STR_REVERSE, FALSE); + this.closeWindow(); + }else{ + Y.one("." + CLASS_HANDLE_TARGET).setStyle(CSS_BACKGROUND_POSITION_X,'left'); + } + }, + + _setIsOpen : function () { + if(parseInt(this.get(STR_SRCNODE).getStyle('width'), 10) < parseInt(this.get(STR_OPENWIDTH), 10)){ + this._set('isOpen', false); + this._set('isClosed', true); + }else{ + this._set('isOpen', true); + this._set('isClosed', false); + } + }, + + _setBodyContent : function (val) { + var cssBodyName = this.getClassName(CSS_BODYCONT); + return Y.substitute(SliderWindow.BODY_CONTENT, + {cssBodyCont: cssBodyName, userContent: val} + ); + }, + + _removeWidthStyle : function () { + this.get('boundingBox').setStyle('width', ''); + }, + /** + * Close the window without changing the content + * @method closeWindow + */ + closeWindow : function () { + ANIM.set(STR_REVERSE, FALSE); + this._repositionSlider(); + ANIM.run(); + }, + /** + * Open the window without changing the content + * @method openWindow + */ + openWindow : function () { + ANIM.set(STR_REVERSE, TRUE); + ANIM.set("easing", Easing.easeIn); + ANIM.run(); + }, + + /** + * Add a new text to the Bodycont element and trigger the handlePublishMessageEvent + * @method sendMessage + * @param {string} txt the text/html to be published + * @param {string} mode, (publish| open), whether the window shall open and close or only open + * @param {string} bypass, if 'ponderaid' bypass setting body. Ponderaid has its own method for writing text. + */ + sendMessage : function (txt, mode, bypass) { + + var isPonderaid = FALSE; + + if(bypass == 'ponderaid'){ + isPonderaid = TRUE; + } + + if(!isPonderaid){ + this.set('bodyContent', txt); + } + + if(Y.Lang.isString(mode)){ + switch(mode){ + case STR_PUBLISH: + this._handlePublishMessageEvent(STR_PUBLISH); + + break; + case 'open': + this._handlePublishMessageEvent(STR_STOP); + + break; + } + }else{ + this._handlePublishMessageEvent(STR_PUBLISH); + } + } + }); + + Y.namespace("Overlay").SliderWindow = SliderWindow; + + +}, 'gallery-2011.11.10-16-24' ,{requires:['overlay', 'node', 'anim-base','anim-node','anim-easing', 'substitute']}); diff --git a/build/gallery-yui-dualslider/gallery-yui-dualslider-debug.js b/build/gallery-yui-dualslider/gallery-yui-dualslider-debug.js index dd130a16eb..e8cd170074 100644 --- a/build/gallery-yui-dualslider/gallery-yui-dualslider-debug.js +++ b/build/gallery-yui-dualslider/gallery-yui-dualslider-debug.js @@ -1,7 +1,7 @@ YUI.add('gallery-yui-dualslider', function(Y) { -//Inherit and extend slider to add dual slider -YUI.add('gallery-yui-dualslider', function(Y) { + + //Inherit and extend slider to add dual slider var VALUE = 'value', VALUE2 = 'value2', THUMBSEPARATION = 'thumbSeparation', THUMBSFLIPPED = 'thumbsFlipped'; @@ -9,7 +9,7 @@ YUI.add('gallery-yui-dualslider', function(Y) { DualSlider.superclass.constructor.apply(this, arguments); } - Y.DualSlider = Y.extend(DualSlider, Y.rdSlider, { + Y.DualSlider = Y.extend(DualSlider, Y.Slider, { renderThumb2: function () { return this.renderThumb(); }, @@ -491,11 +491,8 @@ YUI.add('gallery-yui-dualslider', function(Y) { value : 0 } } - }); + }); -}, '0.0.0', { - requires:['slider'] -}); -}, 'gallery-2011.10.06-19-55' ,{skinnable:true, requires:['slider']}); +}, 'gallery-2011.11.10-16-24' ,{skinnable:true, requires:['slider']}); diff --git a/build/gallery-yui-dualslider/gallery-yui-dualslider-min.js b/build/gallery-yui-dualslider/gallery-yui-dualslider-min.js index 5caa3d59b1..ba674cc46a 100644 --- a/build/gallery-yui-dualslider/gallery-yui-dualslider-min.js +++ b/build/gallery-yui-dualslider/gallery-yui-dualslider-min.js @@ -1 +1 @@ -YUI.add("gallery-yui-dualslider",function(a){YUI.add("gallery-yui-dualslider",function(g){var f="value",c="value2",b="thumbSeparation",d="thumbsFlipped";function e(){e.superclass.constructor.apply(this,arguments);}g.DualSlider=g.extend(e,g.rdSlider,{renderThumb2:function(){return this.renderThumb();},renderUI:function(){var h=this.get("contentBox");this.rail=this.renderRail();this._uiSetRailLength(this.get("length"));this.thumb=this.renderThumb();this.rail.appendChild(this.thumb);this.thumb2=this.renderThumb2();this.rail.appendChild(this.thumb2);h.appendChild(this.rail);h.addClass(this.getClassName(this.axis));},_bindThumbDD:function(){var h={constrain:this.rail};h["stick"+this.axis.toUpperCase()]=true;this._dd=new g.DD.Drag({node:this.thumb,bubble:false,on:{"drag:start":g.bind(this._onDragStart,this)},after:{"drag:drag":g.bind(this._afterDrag,this),"drag:end":g.bind(this._afterDragEnd,this)}});this._dd2=new g.DD.Drag({node:this.thumb2,bubble:false,on:{"drag:start":g.bind(this._onDragStart,this)},after:{"drag:drag":g.bind(this._afterDrag,this),"drag:end":g.bind(this._afterDragEnd,this)}});this._dd.plug(g.Plugin.DDConstrained,h);this._dd2.plug(g.Plugin.DDConstrained,h);},_bindValueLogic:function(){this.after({minChange:this._afterMinChange,maxChange:this._afterMaxChange,valueChange:this._afterValueChange,value2Change:this._afterValue2Change});},_afterValue2Change:function(h){if(!h.positioned){var i=this._valueToOffset(h.newVal);if(h.newVal=0){n=this.get(b);var r=this.get("max")-this.get("min"),t=parseInt(this.get("length")),l=parseInt(this.thumb.getStyle(this._key.dim));var k=n/r;if(k<0){k*=-1;}if(k>this._factor){n=(t-l)*k;}else{if(this.get("tickCount")){n=(t-l)/this.get("tickCount");}else{n*=(t-l)/r;}}}else{n=0;}if(i+q.offset>=j-n&&i+q.offset<=j+n){m=true;}if(i+q.offset>=p-n&&i+q.offset<=p+n){s=true;}if(!v&&j>=p-n){h=-n;}else{if(v&&j<=p+n){h=n;}}if(h==null&&m){o=this.getValue();u=this._offsetToValue(q.offset);if(o!==u){this.set(f,u,{positioned:true});}}else{if(h==null&&s){o=this.getValue2();u=this._offsetToValue(q.offset);if(o!==u){this.set(c,u,{positioned:true});}}else{if(q.ddEvent){switch(q.ddEvent.target){case this._dd:if(h!==null){switch(this.axis){case"x":this.thumb.setX(p+h);break;case"y":this.thumb.setY(p+h);break;}q.halt();}break;case this._dd2:if(h!==null){h*=-1;switch(this.axis){case"x":this.thumb2.setX(j+h);break;case"y":this.thumb2.setY(j+h);break;}q.halt();}break;}}}}},getValue2:function(){return this.get(c);},setValue2:function(h){return this.set(c,h);},_setThumbSeparation:function(h){if(h<=0){return 0;}return h;},syncUI:function(){this._dd.con.resetCache();this._syncThumbPosition();this._syncThumbPosition2();},_syncThumbPosition2:function(){this._calculateFactor();var h=this._valueToOffset(this.get(c));this._uiMoveThumb2(h);},_uiMoveThumb2:function(h){if(this.thumb2){this.thumb2.setStyle(this._key.minEdge,h+"px");this.fire("thumbMove",{offset:h});}},_defRailMouseDownFn:function(o){o=o.ev;var h=this._resolveThumb(o),l=this._key.xyIndex,m=parseFloat(this.get("length"),10),k,j,n;if(h){k=h.get("dragNode");j=parseFloat(k.getStyle(this._key.dim),10);n=this._getThumbDestination(o,k);n=n[l]-this.rail.getXY()[l];n=Math.min(Math.max(n,0),(m-j));var p;if(this._dd==h){this._uiMoveThumb(n);p=this.thumb.one("img")||this.thumb;}else{this._uiMoveThumb2(n);p=this.thumb2.one("img")||this.thumb2;}o.target=p;h._handleMouseDownEvent(o);}},_resolveThumb:function(l){var h,k,m;switch(this.axis){case"x":h=l.clientX;k=this.thumb.getX();m=this.thumb2.getX();break;case"y":h=l.clientY;k=this.thumb.getY();m=this.thumb2.getY();break;}var j=h-k,i=h-m;if(j<0){j*=-1;}if(i<0){i*=-1;}if(j=0){m=this.get(a);var q=this.get("max")-this.get("min"),s=parseInt(this.get("length")),k=parseInt(this.thumb.getStyle(this._key.dim));var j=m/q;if(j<0){j*=-1;}if(j>this._factor){m=(s-k)*j;}else{if(this.get("tickCount")){m=(s-k)/this.get("tickCount");}else{m*=(s-k)/q;}}}else{m=0;}if(h+p.offset>=i-m&&h+p.offset<=i+m){l=true;}if(h+p.offset>=o-m&&h+p.offset<=o+m){r=true;}if(!u&&i>=o-m){g=-m;}else{if(u&&i<=o+m){g=m;}}if(g==null&&l){n=this.getValue();t=this._offsetToValue(p.offset);if(n!==t){this.set(e,t,{positioned:true});}}else{if(g==null&&r){n=this.getValue2();t=this._offsetToValue(p.offset);if(n!==t){this.set(b,t,{positioned:true});}}else{if(p.ddEvent){switch(p.ddEvent.target){case this._dd:if(g!==null){switch(this.axis){case"x":this.thumb.setX(o+g);break;case"y":this.thumb.setY(o+g);break;}p.halt();}break;case this._dd2:if(g!==null){g*=-1;switch(this.axis){case"x":this.thumb2.setX(i+g);break;case"y":this.thumb2.setY(i+g);break;}p.halt();}break;}}}}},getValue2:function(){return this.get(b);},setValue2:function(g){return this.set(b,g);},_setThumbSeparation:function(g){if(g<=0){return 0;}return g;},syncUI:function(){this._dd.con.resetCache();this._syncThumbPosition();this._syncThumbPosition2();},_syncThumbPosition2:function(){this._calculateFactor();var g=this._valueToOffset(this.get(b));this._uiMoveThumb2(g);},_uiMoveThumb2:function(g){if(this.thumb2){this.thumb2.setStyle(this._key.minEdge,g+"px");this.fire("thumbMove",{offset:g});}},_defRailMouseDownFn:function(n){n=n.ev;var g=this._resolveThumb(n),k=this._key.xyIndex,l=parseFloat(this.get("length"),10),j,h,m;if(g){j=g.get("dragNode");h=parseFloat(j.getStyle(this._key.dim),10);m=this._getThumbDestination(n,j);m=m[k]-this.rail.getXY()[k];m=Math.min(Math.max(m,0),(l-h));var o;if(this._dd==g){this._uiMoveThumb(m);o=this.thumb.one("img")||this.thumb;}else{this._uiMoveThumb2(m);o=this.thumb2.one("img")||this.thumb2;}n.target=o;g._handleMouseDownEvent(n);}},_resolveThumb:function(k){var g,j,l;switch(this.axis){case"x":g=k.clientX;j=this.thumb.getX();l=this.thumb2.getX();break;case"y":g=k.clientY;j=this.thumb.getY();l=this.thumb2.getY();break;}var i=g-j,h=g-l;if(i<0){i*=-1;}if(h<0){h*=-1;}if(i