Modified: wicket/branches/wicket-1.4.x/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo-min.js URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo-min.js?rev=1127219&r1=1127218&r2=1127219&view=diff ============================================================================== --- wicket/branches/wicket-1.4.x/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo-min.js (original) +++ wicket/branches/wicket-1.4.x/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo-min.js Tue May 24 18:57:38 2011 @@ -1,7 +1,8 @@ /* -Copyright (c) 2009, Yahoo! Inc. All rights reserved. +Copyright (c) 2011, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: -http://developer.yahoo.net/yui/license.txt -version: 2.7.0 +http://developer.yahoo.com/yui/license.html +version: 2.9.0 */ -if(typeof YAHOO=="undefined"||!YAHOO){var YAHOO={};}YAHOO.namespace=function(){var A=arguments,E=null,C,B,D;for(C=0;C<A.length;C=C+1){D=(""+A[C]).split(".");E=YAHOO;for(B=(D[0]=="YAHOO")?1:0;B<D.length;B=B+1){E[D[B]]=E[D[B]]||{};E=E[D[B]];}}return E;};YAHOO.log=function(D,A,C){var B=YAHOO.widget.Logger;if(B&&B.log){return B.log(D,A,C);}else{return false;}};YAHOO.register=function(A,E,D){var I=YAHOO.env.modules,B,H,G,F,C;if(!I[A]){I[A]={versions:[],builds:[]};}B=I[A];H=D.version;G=D.build;F=YAHOO.env.listeners;B.name=A;B.version=H;B.build=G;B.versions.push(H);B.builds.push(G);B.mainClass=E;for(C=0;C<F.length;C=C+1){F[C](B);}if(E){E.VERSION=H;E.BUILD=G;}else{YAHOO.log("mainClass is undefined for module "+A,"warn");}};YAHOO.env=YAHOO.env||{modules:[],listeners:[]};YAHOO.env.getVersion=function(A){return YAHOO.env.modules[A]||null;};YAHOO.env.ua=function(){var C={ie:0,opera:0,gecko:0,webkit:0,mobile:null,air:0,caja:0},B=navigator.userAgent,A;if((/KHTML/).test(B)){C.webkit=1;}A=B .match(/AppleWebKit\/([^\s]*)/);if(A&&A[1]){C.webkit=parseFloat(A[1]);if(/ Mobile\//.test(B)){C.mobile="Apple";}else{A=B.match(/NokiaN[^\/]*/);if(A){C.mobile=A[0];}}A=B.match(/AdobeAIR\/([^\s]*)/);if(A){C.air=A[0];}}if(!C.webkit){A=B.match(/Opera[\s\/]([^\s]*)/);if(A&&A[1]){C.opera=parseFloat(A[1]);A=B.match(/Opera Mini[^;]*/);if(A){C.mobile=A[0];}}else{A=B.match(/MSIE\s([^;]*)/);if(A&&A[1]){C.ie=parseFloat(A[1]);}else{A=B.match(/Gecko\/([^\s]*)/);if(A){C.gecko=1;A=B.match(/rv:([^\s\)]*)/);if(A&&A[1]){C.gecko=parseFloat(A[1]);}}}}}A=B.match(/Caja\/([^\s]*)/);if(A&&A[1]){C.caja=parseFloat(A[1]);}return C;}();(function(){YAHOO.namespace("util","widget","example");if("undefined"!==typeof YAHOO_config){var B=YAHOO_config.listener,A=YAHOO.env.listeners,D=true,C;if(B){for(C=0;C<A.length;C=C+1){if(A[C]==B){D=false;break;}}if(D){A.push(B);}}}})();YAHOO.lang=YAHOO.lang||{};(function(){var B=YAHOO.lang,F="[object Array]",C="[object Function]",A=Object.prototype,E=["toString","valueOf" ],D={isArray:function(G){return A.toString.apply(G)===F;},isBoolean:function(G){return typeof G==="boolean";},isFunction:function(G){return A.toString.apply(G)===C;},isNull:function(G){return G===null;},isNumber:function(G){return typeof G==="number"&&isFinite(G);},isObject:function(G){return(G&&(typeof G==="object"||B.isFunction(G)))||false;},isString:function(G){return typeof G==="string";},isUndefined:function(G){return typeof G==="undefined";},_IEEnumFix:(YAHOO.env.ua.ie)?function(I,H){var G,K,J;for(G=0;G<E.length;G=G+1){K=E[G];J=H[K];if(B.isFunction(J)&&J!=A[K]){I[K]=J;}}}:function(){},extend:function(J,K,I){if(!K||!J){throw new Error("extend failed, please check that "+"all dependencies are included.");}var H=function(){},G;H.prototype=K.prototype;J.prototype=new H();J.prototype.constructor=J;J.superclass=K.prototype;if(K.prototype.constructor==A.constructor){K.prototype.constructor=K;}if(I){for(G in I){if(B.hasOwnProperty(I,G)){J.prototype[G]=I[G];}}B._IEEnumFix(J.pro totype,I);}},augmentObject:function(K,J){if(!J||!K){throw new Error("Absorb failed, verify dependencies.");}var G=arguments,I,L,H=G[2];if(H&&H!==true){for(I=2;I<G.length;I=I+1){K[G[I]]=J[G[I]];}}else{for(L in J){if(H||!(L in K)){K[L]=J[L];}}B._IEEnumFix(K,J);}},augmentProto:function(J,I){if(!I||!J){throw new Error("Augment failed, verify dependencies.");}var G=[J.prototype,I.prototype],H;for(H=2;H<arguments.length;H=H+1){G.push(arguments[H]);}B.augmentObject.apply(this,G);},dump:function(G,L){var I,K,N=[],O="{...}",H="f(){...}",M=", ",J=" => ";if(!B.isObject(G)){return G+"";}else{if(G instanceof Date||("nodeType" in G&&"tagName" in G)){return G;}else{if(B.isFunction(G)){return H;}}}L=(B.isNumber(L))?L:3;if(B.isArray(G)){N.push("[");for(I=0,K=G.length;I<K;I=I+1){if(B.isObject(G[I])){N.push((L>0)?B.dump(G[I],L-1):O);}else{N.push(G[I]);}N.push(M);}if(N.length>1){N.pop();}N.push("]");}else{N.push("{");for(I in G){if(B.hasOwnProperty(G,I)){N.push(I+J);if(B.isObject(G[I])){N.push( (L>0)?B.dump(G[I],L-1):O);}else{N.push(G[I]);}N.push(M);}}if(N.length>1){N.pop();}N.push("}");}return N.join("");},substitute:function(V,H,O){var L,K,J,R,S,U,Q=[],I,M="dump",P=" ",G="{",T="}",N;for(;;){L=V.lastIndexOf(G);if(L<0){break;}K=V.indexOf(T,L);if(L+1>=K){break;}I=V.substring(L+1,K);R=I;U=null;J=R.indexOf(P);if(J>-1){U=R.substring(J+1);R=R.substring(0,J);}S=H[R];if(O){S=O(R,S,U);}if(B.isObject(S)){if(B.isArray(S)){S=B.dump(S,parseInt(U,10));}else{U=U||"";N=U.indexOf(M);if(N>-1){U=U.substring(4);}if(S.toString===A.toString||N>-1){S=B.dump(S,parseInt(U,10));}else{S=S.toString();}}}else{if(!B.isString(S)&&!B.isNumber(S)){S="~-"+Q.length+"-~";Q[Q.length]=I;}}V=V.substring(0,L)+S+V.substring(K+1);}for(L=Q.length-1;L>=0;L=L-1){V=V.replace(new RegExp("~-"+L+"-~"),"{"+Q[L]+"}","g");}return V;},trim:function(G){try{return G.replace(/^\s+|\s+$/g,"");}catch(H){return G;}},merge:function(){var J={},H=arguments,G=H.length,I;for(I=0;I<G;I=I+1){B.augmentObject(J,H[I],true);}return J;},later:function(N,H,O,J,K){N=N||0;H=H||{};var I=O,M=J,L,G;if(B.isString(O)){I=H[O];}if(!I){throw new TypeError("method undefined");}if(!B.isArray(M)){M=[J];}L=function(){I.apply(H,M);};G=(K)?setInterval(L,N):setTimeout(L,N);return{interval:K,cancel:function(){if(this.interval){clearInterval(G);}else{clearTimeout(G);}}};},isValue:function(G){return(B.isObject(G)||B.isString(G)||B.isNumber(G)||B.isBoolean(G));}};B.hasOwnProperty=(A.hasOwnProperty)?function(G,H){return G&&G.hasOwnProperty(H);}:function(G,H){return !B.isUndefined(G[H])&&G.constructor.prototype[H]!==G[H];};D.augmentObject(B,D,true);YAHOO.util.Lang=B;B.augment=B.augmentProto;YAHOO.augment=B.augmentProto;YAHOO.extend=B.extend;})();YAHOO.register("yahoo",YAHOO,{version:"2.7.0",build:"1799"}); \ No newline at end of file +if(typeof YAHOO=="undefined"||!YAHOO){var YAHOO={};}YAHOO.namespace=function(){var b=arguments,g=null,e,c,f;for(e=0;e<b.length;e=e+1){f=(""+b[e]).split(".");g=YAHOO;for(c=(f[0]=="YAHOO")?1:0;c<f.length;c=c+1){g[f[c]]=g[f[c]]||{};g=g[f[c]];}}return g;};YAHOO.log=function(d,a,c){var b=YAHOO.widget.Logger;if(b&&b.log){return b.log(d,a,c);}else{return false;}};YAHOO.register=function(a,f,e){var k=YAHOO.env.modules,c,j,h,g,d;if(!k[a]){k[a]={versions:[],builds:[]};}c=k[a];j=e.version;h=e.build;g=YAHOO.env.listeners;c.name=a;c.version=j;c.build=h;c.versions.push(j);c.builds.push(h);c.mainClass=f;for(d=0;d<g.length;d=d+1){g[d](c);}if(f){f.VERSION=j;f.BUILD=h;}else{YAHOO.log("mainClass is undefined for module "+a,"warn");}};YAHOO.env=YAHOO.env||{modules:[],listeners:[]};YAHOO.env.getVersion=function(a){return YAHOO.env.modules[a]||null;};YAHOO.env.parseUA=function(d){var e=function(i){var j=0;return parseFloat(i.replace(/\./g,function(){return(j++==1)?"":".";}));},h=navigator,g={ie:0 ,opera:0,gecko:0,webkit:0,chrome:0,mobile:null,air:0,ipad:0,iphone:0,ipod:0,ios:null,android:0,webos:0,caja:h&&h.cajaVersion,secure:false,os:null},c=d||(navigator&&navigator.userAgent),f=window&&window.location,b=f&&f.href,a;g.secure=b&&(b.toLowerCase().indexOf("https")===0);if(c){if((/windows|win32/i).test(c)){g.os="windows";}else{if((/macintosh/i).test(c)){g.os="macintosh";}else{if((/rhino/i).test(c)){g.os="rhino";}}}if((/KHTML/).test(c)){g.webkit=1;}a=c.match(/AppleWebKit\/([^\s]*)/);if(a&&a[1]){g.webkit=e(a[1]);if(/ Mobile\//.test(c)){g.mobile="Apple";a=c.match(/OS ([^\s]*)/);if(a&&a[1]){a=e(a[1].replace("_","."));}g.ios=a;g.ipad=g.ipod=g.iphone=0;a=c.match(/iPad|iPod|iPhone/);if(a&&a[0]){g[a[0].toLowerCase()]=g.ios;}}else{a=c.match(/NokiaN[^\/]*|Android \d\.\d|webOS\/\d\.\d/);if(a){g.mobile=a[0];}if(/webOS/.test(c)){g.mobile="WebOS";a=c.match(/webOS\/([^\s]*);/);if(a&&a[1]){g.webos=e(a[1]);}}if(/ Android/.test(c)){g.mobile="Android";a=c.match(/Android ([^\s]*);/);if(a&& a[1]){g.android=e(a[1]);}}}a=c.match(/Chrome\/([^\s]*)/);if(a&&a[1]){g.chrome=e(a[1]);}else{a=c.match(/AdobeAIR\/([^\s]*)/);if(a){g.air=a[0];}}}if(!g.webkit){a=c.match(/Opera[\s\/]([^\s]*)/);if(a&&a[1]){g.opera=e(a[1]);a=c.match(/Version\/([^\s]*)/);if(a&&a[1]){g.opera=e(a[1]);}a=c.match(/Opera Mini[^;]*/);if(a){g.mobile=a[0];}}else{a=c.match(/MSIE\s([^;]*)/);if(a&&a[1]){g.ie=e(a[1]);}else{a=c.match(/Gecko\/([^\s]*)/);if(a){g.gecko=1;a=c.match(/rv:([^\s\)]*)/);if(a&&a[1]){g.gecko=e(a[1]);}}}}}}return g;};YAHOO.env.ua=YAHOO.env.parseUA();(function(){YAHOO.namespace("util","widget","example");if("undefined"!==typeof YAHOO_config){var b=YAHOO_config.listener,a=YAHOO.env.listeners,d=true,c;if(b){for(c=0;c<a.length;c++){if(a[c]==b){d=false;break;}}if(d){a.push(b);}}}})();YAHOO.lang=YAHOO.lang||{};(function(){var f=YAHOO.lang,a=Object.prototype,c="[object Array]",h="[object Function]",i="[object Object]",b=[],g={"&":"&","<":"<",">":">",'"':""","'":"'","/":" F;","`":"`"},d=["toString","valueOf"],e={isArray:function(j){return a.toString.apply(j)===c;},isBoolean:function(j){return typeof j==="boolean";},isFunction:function(j){return(typeof j==="function")||a.toString.apply(j)===h;},isNull:function(j){return j===null;},isNumber:function(j){return typeof j==="number"&&isFinite(j);},isObject:function(j){return(j&&(typeof j==="object"||f.isFunction(j)))||false;},isString:function(j){return typeof j==="string";},isUndefined:function(j){return typeof j==="undefined";},_IEEnumFix:(YAHOO.env.ua.ie)?function(l,k){var j,n,m;for(j=0;j<d.length;j=j+1){n=d[j];m=k[n];if(f.isFunction(m)&&m!=a[n]){l[n]=m;}}}:function(){},escapeHTML:function(j){return j.replace(/[&<>"'\/`]/g,function(k){return g[k];});},extend:function(m,n,l){if(!n||!m){throw new Error("extend failed, please check that "+"all dependencies are included.");}var k=function(){},j;k.prototype=n.prototype;m.prototype=new k();m.prototype.constructor=m;m.superclass=n.prototype;if(n.p rototype.constructor==a.constructor){n.prototype.constructor=n;}if(l){for(j in l){if(f.hasOwnProperty(l,j)){m.prototype[j]=l[j];}}f._IEEnumFix(m.prototype,l);}},augmentObject:function(n,m){if(!m||!n){throw new Error("Absorb failed, verify dependencies.");}var j=arguments,l,o,k=j[2];if(k&&k!==true){for(l=2;l<j.length;l=l+1){n[j[l]]=m[j[l]];}}else{for(o in m){if(k||!(o in n)){n[o]=m[o];}}f._IEEnumFix(n,m);}return n;},augmentProto:function(m,l){if(!l||!m){throw new Error("Augment failed, verify dependencies.");}var j=[m.prototype,l.prototype],k;for(k=2;k<arguments.length;k=k+1){j.push(arguments[k]);}f.augmentObject.apply(this,j);return m;},dump:function(j,p){var l,n,r=[],t="{...}",k="f(){...}",q=", ",m=" => ";if(!f.isObject(j)){return j+"";}else{if(j instanceof Date||("nodeType" in j&&"tagName" in j)){return j;}else{if(f.isFunction(j)){return k;}}}p=(f.isNumber(p))?p:3;if(f.isArray(j)){r.push("[");for(l=0,n=j.length;l<n;l=l+1){if(f.isObject(j[l])){r.push((p>0)?f.dump(j[l],p-1): t);}else{r.push(j[l]);}r.push(q);}if(r.length>1){r.pop();}r.push("]");}else{r.push("{");for(l in j){if(f.hasOwnProperty(j,l)){r.push(l+m);if(f.isObject(j[l])){r.push((p>0)?f.dump(j[l],p-1):t);}else{r.push(j[l]);}r.push(q);}}if(r.length>1){r.pop();}r.push("}");}return r.join("");},substitute:function(x,y,E,l){var D,C,B,G,t,u,F=[],p,z=x.length,A="dump",r=" ",q="{",m="}",n,w;for(;;){D=x.lastIndexOf(q,z);if(D<0){break;}C=x.indexOf(m,D);if(D+1>C){break;}p=x.substring(D+1,C);G=p;u=null;B=G.indexOf(r);if(B>-1){u=G.substring(B+1);G=G.substring(0,B);}t=y[G];if(E){t=E(G,t,u);}if(f.isObject(t)){if(f.isArray(t)){t=f.dump(t,parseInt(u,10));}else{u=u||"";n=u.indexOf(A);if(n>-1){u=u.substring(4);}w=t.toString();if(w===i||n>-1){t=f.dump(t,parseInt(u,10));}else{t=w;}}}else{if(!f.isString(t)&&!f.isNumber(t)){t="~-"+F.length+"-~";F[F.length]=p;}}x=x.substring(0,D)+t+x.substring(C+1);if(l===false){z=D-1;}}for(D=F.length-1;D>=0;D=D-1){x=x.replace(new RegExp("~-"+D+"-~"),"{"+F[D]+"}","g");}return x;},trim:function(j){try{return j.replace(/^\s+|\s+$/g,"");}catch(k){return j; +}},merge:function(){var n={},k=arguments,j=k.length,m;for(m=0;m<j;m=m+1){f.augmentObject(n,k[m],true);}return n;},later:function(t,k,u,n,p){t=t||0;k=k||{};var l=u,s=n,q,j;if(f.isString(u)){l=k[u];}if(!l){throw new TypeError("method undefined");}if(!f.isUndefined(n)&&!f.isArray(s)){s=[n];}q=function(){l.apply(k,s||b);};j=(p)?setInterval(q,t):setTimeout(q,t);return{interval:p,cancel:function(){if(this.interval){clearInterval(j);}else{clearTimeout(j);}}};},isValue:function(j){return(f.isObject(j)||f.isString(j)||f.isNumber(j)||f.isBoolean(j));}};f.hasOwnProperty=(a.hasOwnProperty)?function(j,k){return j&&j.hasOwnProperty&&j.hasOwnProperty(k);}:function(j,k){return !f.isUndefined(j[k])&&j.constructor.prototype[k]!==j[k];};e.augmentObject(f,e,true);YAHOO.util.Lang=f;f.augment=f.augmentProto;YAHOO.augment=f.augmentProto;YAHOO.extend=f.extend;})();YAHOO.register("yahoo",YAHOO,{version:"2.9.0",build:"2800"}); \ No newline at end of file
Modified: wicket/branches/wicket-1.4.x/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo.js URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo.js?rev=1127219&r1=1127218&r2=1127219&view=diff ============================================================================== --- wicket/branches/wicket-1.4.x/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo.js (original) +++ wicket/branches/wicket-1.4.x/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo.js Tue May 24 18:57:38 2011 @@ -1,8 +1,8 @@ /* -Copyright (c) 2009, Yahoo! Inc. All rights reserved. +Copyright (c) 2011, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: -http://developer.yahoo.net/yui/license.txt -version: 2.7.0 +http://developer.yahoo.com/yui/license.html +version: 2.9.0 */ /** * The YAHOO object is the single global object used by YUI Library. It @@ -14,10 +14,10 @@ version: 2.7.0 */ /** - * YAHOO_config is not included as part of the library. Instead it is an - * object that can be defined by the implementer immediately before + * YAHOO_config is not included as part of the library. Instead it is an + * object that can be defined by the implementer immediately before * including the YUI library. The properties included in this object - * will be used to configure global properties needed as soon as the + * will be used to configure global properties needed as soon as the * library begins to load. * @class YAHOO_config * @static @@ -36,7 +36,7 @@ version: 2.7.0 /** * Set to true if the library will be dynamically loaded after window.onload. - * Defaults to false + * Defaults to false * @property injecting * @type boolean * @static @@ -89,12 +89,17 @@ if (typeof YAHOO == "undefined" || !YAHO * This fails because "long" is a future reserved word in ECMAScript * * For implementation code that uses YUI, do not create your components - * in the namespaces created by the library. defined by YUI -- create - * your own (YAHOO.util, YAHOO.widget, YAHOO.lang, YAHOO.env) + * in the namespaces defined by YUI ( + * <code>YAHOO.util</code>, + * <code>YAHOO.widget</code>, + * <code>YAHOO.lang</code>, + * <code>YAHOO.tool</code>, + * <code>YAHOO.example</code>, + * <code>YAHOO.env</code>) -- create your own namespace (e.g., 'companyname'). * * @method namespace * @static - * @param {String*} arguments 1-n namespaces to create + * @param {String*} arguments 1-n namespaces to create * @return {Object} A reference to the last namespace object created */ YAHOO.namespace = function() { @@ -116,14 +121,15 @@ YAHOO.namespace = function() { /** * Uses YAHOO.widget.Logger to output a log message, if the widget is * available. + * Note: LogReader adds the message, category, and source to the DOM as HTML. * * @method log * @static - * @param {String} msg The message to log. - * @param {String} cat The log category for the message. Default + * @param {HTML} msg The message to log. + * @param {HTML} cat The log category for the message. Default * categories are "info", "warn", "error", time". * Custom categories can be used as well. (opt) - * @param {String} src The source of the the message (opt) + * @param {HTML} src The source of the the message (opt) * @return {Boolean} True if the log operation was successful. */ YAHOO.log = function(msg, cat, src) { @@ -153,9 +159,9 @@ YAHOO.register = function(name, mainClas var mods = YAHOO.env.modules, m, v, b, ls, i; if (!mods[name]) { - mods[name] = { - versions:[], - builds:[] + mods[name] = { + versions:[], + builds:[] }; } @@ -198,7 +204,7 @@ YAHOO.env = YAHOO.env || { * @type Object[] */ modules: [], - + /** * List of functions that should be executed every time a YUI module * reports itself. @@ -217,7 +223,7 @@ YAHOO.env = YAHOO.env || { * <dt>versions:</dt> <dd>All versions that were registered</dd> * <dt>builds:</dt> <dd>All builds that were registered.</dd> * <dt>mainClass:</dt> <dd>An object that was was stamped with the - * current version and build. If + * current version and build. If * mainClass.VERSION != version or mainClass.BUILD != build, * multiple versions of pieces of the library have been * loaded, potentially causing issues.</dd> @@ -236,51 +242,73 @@ YAHOO.env.getVersion = function(name) { * Do not fork for a browser if it can be avoided. Use feature detection when * you can. Use the user agent as a last resort. YAHOO.env.ua stores a version * number for the browser engine, 0 otherwise. This value may or may not map - * to the version number of the browser using the engine. The value is - * presented as a float so that it can easily be used for boolean evaluation - * as well as for looking for a particular range of versions. Because of this, - * some of the granularity of the version info may be lost (e.g., Gecko 1.8.0.9 + * to the version number of the browser using the engine. The value is + * presented as a float so that it can easily be used for boolean evaluation + * as well as for looking for a particular range of versions. Because of this, + * some of the granularity of the version info may be lost (e.g., Gecko 1.8.0.9 * reports 1.8). * @class YAHOO.env.ua * @static */ -YAHOO.env.ua = function() { - var o={ + +/** + * parses a user agent string (or looks for one in navigator to parse if + * not supplied). + * @method parseUA + * @since 2.9.0 + * @static + */ +YAHOO.env.parseUA = function(agent) { + + var numberify = function(s) { + var c = 0; + return parseFloat(s.replace(/\./g, function() { + return (c++ == 1) ? '' : '.'; + })); + }, + + nav = navigator, + + o = { /** * Internet Explorer version number or 0. Example: 6 * @property ie * @type float + * @static */ - ie:0, + ie: 0, /** * Opera version number or 0. Example: 9.2 * @property opera * @type float + * @static */ - opera:0, + opera: 0, /** - * Gecko engine revision number. Will evaluate to 1 if Gecko + * Gecko engine revision number. Will evaluate to 1 if Gecko * is detected but the revision could not be found. Other browsers * will be 0. Example: 1.8 * <pre> * Firefox 1.0.0.4: 1.7.8 <-- Reports 1.7 - * Firefox 1.5.0.9: 1.8.0.9 <-- Reports 1.8 - * Firefox 2.0.0.3: 1.8.1.3 <-- Reports 1.8 - * Firefox 3 alpha: 1.9a4 <-- Reports 1.9 + * Firefox 1.5.0.9: 1.8.0.9 <-- 1.8 + * Firefox 2.0.0.3: 1.8.1.3 <-- 1.81 + * Firefox 3.0 <-- 1.9 + * Firefox 3.5 <-- 1.91 * </pre> * @property gecko * @type float + * @static */ - gecko:0, + gecko: 0, /** - * AppleWebKit version. KHTML browsers that are not WebKit browsers - * will evaluate to 1, other browsers 0. Example: 418.9.1 + * AppleWebKit version. KHTML browsers that are not WebKit browsers + * will evaluate to 1, other browsers 0. Example: 418.9 * <pre> - * Safari 1.3.2 (312.6): 312.8.1 <-- Reports 312.8 -- currently the + * Safari 1.3.2 (312.6): 312.8.1 <-- Reports 312.8 -- currently the * latest available for Mac OSX 10.3. * Safari 2.0.2: 416 <-- hasOwnProperty introduced * Safari 2.0.4: 418 <-- preventDefault fixed @@ -289,30 +317,37 @@ YAHOO.env.ua = function() { * Safari 2.0.4 (419.3): 419 <-- Tiger installations that have been * updated, but not updated * to the latest patch. - * Webkit 212 nightly: 522+ <-- Safari 3.0 precursor (with native SVG - * and many major issues fixed). - * 3.x yahoo.com, flickr:422 <-- Safari 3.x hacks the user agent - * string when hitting yahoo.com and - * flickr.com. - * Safari 3.0.4 (523.12):523.12 <-- First Tiger release - automatic update - * from 2.x via the 10.4.11 OS patch + * Webkit 212 nightly: 522+ <-- Safari 3.0 precursor (with native + * SVG and many major issues fixed). + * Safari 3.0.4 (523.12) 523.12 <-- First Tiger release - automatic + * update from 2.x via the 10.4.11 OS patch. * Webkit nightly 1/2008:525+ <-- Supports DOMContentLoaded event. * yahoo.com user agent hack removed. - * * </pre> - * http://developer.apple.com/internet/safari/uamatrix.html + * http://en.wikipedia.org/wiki/Safari_version_history * @property webkit * @type float + * @static */ webkit: 0, /** + * Chrome will be detected as webkit, but this property will also + * be populated with the Chrome version number + * @property chrome + * @type float + * @static + */ + chrome: 0, + + /** * The mobile property will be set to a string containing any relevant * user agent information when a modern mobile browser is detected. * Currently limited to Safari on the iPhone/iPod Touch, Nokia N-series - * devices with the WebKit-based browser, and Opera Mini. - * @property mobile + * devices with the WebKit-based browser, and Opera Mini. + * @property mobile * @type string + * @static */ mobile: null, @@ -323,79 +358,187 @@ YAHOO.env.ua = function() { * @type float */ air: 0, + /** + * Detects Apple iPad's OS version + * @property ipad + * @type float + * @static + */ + ipad: 0, + /** + * Detects Apple iPhone's OS version + * @property iphone + * @type float + * @static + */ + iphone: 0, + /** + * Detects Apples iPod's OS version + * @property ipod + * @type float + * @static + */ + ipod: 0, + /** + * General truthy check for iPad, iPhone or iPod + * @property ios + * @type float + * @static + */ + ios: null, + /** + * Detects Googles Android OS version + * @property android + * @type float + * @static + */ + android: 0, + /** + * Detects Palms WebOS version + * @property webos + * @type float + * @static + */ + webos: 0, /** * Google Caja version number or 0. * @property caja * @type float */ - caja: 0 + caja: nav && nav.cajaVersion, + + /** + * Set to true if the page appears to be in SSL + * @property secure + * @type boolean + * @static + */ + secure: false, + + /** + * The operating system. Currently only detecting windows or macintosh + * @property os + * @type string + * @static + */ + os: null }, - ua = navigator.userAgent, - + ua = agent || (navigator && navigator.userAgent), + + loc = window && window.location, + + href = loc && loc.href, + m; - // Modern KHTML browsers should qualify as Safari X-Grade - if ((/KHTML/).test(ua)) { - o.webkit=1; - } - // Modern WebKit browsers are at least X-Grade - m=ua.match(/AppleWebKit\/([^\s]*)/); - if (m&&m[1]) { - o.webkit=parseFloat(m[1]); - - // Mobile browser check - if (/ Mobile\//.test(ua)) { - o.mobile = "Apple"; // iPhone or iPod Touch - } else { - m=ua.match(/NokiaN[^\/]*/); - if (m) { - o.mobile = m[0]; // Nokia N-series, ex: NokiaN95 - } - } + o.secure = href && (href.toLowerCase().indexOf("https") === 0); - m=ua.match(/AdobeAIR\/([^\s]*)/); - if (m) { - o.air = m[0]; // Adobe AIR 1.0 or better - } + if (ua) { - } + if ((/windows|win32/i).test(ua)) { + o.os = 'windows'; + } else if ((/macintosh/i).test(ua)) { + o.os = 'macintosh'; + } else if ((/rhino/i).test(ua)) { + o.os = 'rhino'; + } + + // Modern KHTML browsers should qualify as Safari X-Grade + if ((/KHTML/).test(ua)) { + o.webkit = 1; + } + // Modern WebKit browsers are at least X-Grade + m = ua.match(/AppleWebKit\/([^\s]*)/); + if (m && m[1]) { + o.webkit = numberify(m[1]); + + // Mobile browser check + if (/ Mobile\//.test(ua)) { + o.mobile = 'Apple'; // iPhone or iPod Touch + + m = ua.match(/OS ([^\s]*)/); + if (m && m[1]) { + m = numberify(m[1].replace('_', '.')); + } + o.ios = m; + o.ipad = o.ipod = o.iphone = 0; + + m = ua.match(/iPad|iPod|iPhone/); + if (m && m[0]) { + o[m[0].toLowerCase()] = o.ios; + } + } else { + m = ua.match(/NokiaN[^\/]*|Android \d\.\d|webOS\/\d\.\d/); + if (m) { + // Nokia N-series, Android, webOS, ex: NokiaN95 + o.mobile = m[0]; + } + if (/webOS/.test(ua)) { + o.mobile = 'WebOS'; + m = ua.match(/webOS\/([^\s]*);/); + if (m && m[1]) { + o.webos = numberify(m[1]); + } + } + if (/ Android/.test(ua)) { + o.mobile = 'Android'; + m = ua.match(/Android ([^\s]*);/); + if (m && m[1]) { + o.android = numberify(m[1]); + } - if (!o.webkit) { // not webkit - // @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr) - m=ua.match(/Opera[\s\/]([^\s]*)/); - if (m&&m[1]) { - o.opera=parseFloat(m[1]); - m=ua.match(/Opera Mini[^;]*/); - if (m) { - o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316 + } } - } else { // not opera or webkit - m=ua.match(/MSIE\s([^;]*)/); - if (m&&m[1]) { - o.ie=parseFloat(m[1]); - } else { // not opera, webkit, or ie - m=ua.match(/Gecko\/([^\s]*)/); + + m = ua.match(/Chrome\/([^\s]*)/); + if (m && m[1]) { + o.chrome = numberify(m[1]); // Chrome + } else { + m = ua.match(/AdobeAIR\/([^\s]*)/); if (m) { - o.gecko=1; // Gecko detected, look for revision - m=ua.match(/rv:([^\s\)]*)/); - if (m&&m[1]) { - o.gecko=parseFloat(m[1]); + o.air = m[0]; // Adobe AIR 1.0 or better + } + } + } + + if (!o.webkit) { // not webkit +// @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr) + m = ua.match(/Opera[\s\/]([^\s]*)/); + if (m && m[1]) { + o.opera = numberify(m[1]); + m = ua.match(/Version\/([^\s]*)/); + if (m && m[1]) { + o.opera = numberify(m[1]); // opera 10+ + } + m = ua.match(/Opera Mini[^;]*/); + if (m) { + o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316 + } + } else { // not opera or webkit + m = ua.match(/MSIE\s([^;]*)/); + if (m && m[1]) { + o.ie = numberify(m[1]); + } else { // not opera, webkit, or ie + m = ua.match(/Gecko\/([^\s]*)/); + if (m) { + o.gecko = 1; // Gecko detected, look for revision + m = ua.match(/rv:([^\s\)]*)/); + if (m && m[1]) { + o.gecko = numberify(m[1]); + } } } } } } - m=ua.match(/Caja\/([^\s]*)/); - if (m&&m[1]) { - o.caja=parseFloat(m[1]); - } - return o; -}(); +}; + +YAHOO.env.ua = YAHOO.env.parseUA(); /* * Initializes the global by creating the default namespaces and applying @@ -409,17 +552,18 @@ YAHOO.env.ua = function() { YAHOO.namespace("util", "widget", "example"); /*global YAHOO_config*/ if ("undefined" !== typeof YAHOO_config) { - var l=YAHOO_config.listener,ls=YAHOO.env.listeners,unique=true,i; + var l=YAHOO_config.listener, ls=YAHOO.env.listeners,unique=true, i; if (l) { // if YAHOO is loaded multiple times we need to check to see if // this is a new config object. If it is, add the new component // load listener to the stack - for (i=0;i<ls.length;i=i+1) { - if (ls[i]==l) { - unique=false; + for (i=0; i<ls.length; i++) { + if (ls[i] == l) { + unique = false; break; } } + if (unique) { ls.push(l); } @@ -437,9 +581,21 @@ YAHOO.lang = YAHOO.lang || {}; var L = YAHOO.lang, + OP = Object.prototype, ARRAY_TOSTRING = '[object Array]', FUNCTION_TOSTRING = '[object Function]', - OP = Object.prototype, + OBJECT_TOSTRING = '[object Object]', + NOTHING = [], + + HTML_CHARS = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '/': '/', + '`': '`' + }, // ADD = ["toString", "valueOf", "hasOwnProperty"], ADD = ["toString", "valueOf"], @@ -452,7 +608,7 @@ var L = YAHOO.lang, * @param {any} o The object being testing * @return {boolean} the result */ - isArray: function(o) { + isArray: function(o) { return OP.toString.apply(o) === ARRAY_TOSTRING; }, @@ -465,7 +621,7 @@ var L = YAHOO.lang, isBoolean: function(o) { return typeof o === 'boolean'; }, - + /** * Determines whether or not the provided object is a function. * Note: Internet Explorer thinks certain functions are objects: @@ -484,9 +640,9 @@ var L = YAHOO.lang, * @return {boolean} the result */ isFunction: function(o) { - return OP.toString.apply(o) === FUNCTION_TOSTRING; + return (typeof o === 'function') || OP.toString.apply(o) === FUNCTION_TOSTRING; }, - + /** * Determines whether or not the provided object is null * @method isNull @@ -496,7 +652,7 @@ var L = YAHOO.lang, isNull: function(o) { return o === null; }, - + /** * Determines whether or not the provided object is a legal number * @method isNumber @@ -506,18 +662,18 @@ var L = YAHOO.lang, isNumber: function(o) { return typeof o === 'number' && isFinite(o); }, - + /** * Determines whether or not the provided object is of type object * or function * @method isObject * @param {any} o The object being testing * @return {boolean} the result - */ + */ isObject: function(o) { return (o && (typeof o === 'object' || L.isFunction(o))) || false; }, - + /** * Determines whether or not the provided object is a string * @method isString @@ -527,7 +683,7 @@ return (o && (typeof o === 'object' || L isString: function(o) { return typeof o === 'string'; }, - + /** * Determines whether or not the provided object is undefined * @method isUndefined @@ -537,12 +693,12 @@ return (o && (typeof o === 'object' || L isUndefined: function(o) { return typeof o === 'undefined'; }, - - + + /** * IE will not enumerate native functions in a derived object even if the - * function was overridden. This is a workaround for specific functions - * we care about on the Object prototype. + * function was overridden. This is a workaround for specific functions + * we care about on the Object prototype. * @property _IEEnumFix * @param {Function} r the object to receive the augmentation * @param {Function} s the object that supplies the properties to augment @@ -561,7 +717,36 @@ return (o && (typeof o === 'object' || L } } } : function(){}, - + + /** + * <p> + * Returns a copy of the specified string with special HTML characters + * escaped. The following characters will be converted to their + * corresponding character entities: + * <code>& < > " ' / `</code> + * </p> + * + * <p> + * This implementation is based on the + * <a href="http://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet">OWASP + * HTML escaping recommendations</a>. In addition to the characters + * in the OWASP recommendation, we also escape the <code>`</code> + * character, since IE interprets it as an attribute delimiter when used in + * innerHTML. + * </p> + * + * @method escapeHTML + * @param {String} html String to escape. + * @return {String} Escaped string. + * @static + * @since 2.9.0 + */ + escapeHTML: function (html) { + return html.replace(/[&<>"'\/`]/g, function (match) { + return HTML_CHARS[match]; + }); + }, + /** * Utility to set up the prototype, constructor and superclass properties to * support an inheritance strategy that can chain constructors and methods. @@ -573,7 +758,7 @@ return (o && (typeof o === 'object' || L * @param {Function} superc the object to inherit * @param {Object} overrides additional properties/methods to add to the * subclass prototype. These will override the - * matching items obtained from the superclass + * matching items obtained from the superclass * if present. */ extend: function(subc, superc, overrides) { @@ -589,7 +774,7 @@ return (o && (typeof o === 'object' || L if (superc.prototype.constructor == OP.constructor) { superc.prototype.constructor=superc; } - + if (overrides) { for (i in overrides) { if (L.hasOwnProperty(overrides, i)) { @@ -600,14 +785,14 @@ return (o && (typeof o === 'object' || L L._IEEnumFix(subc.prototype, overrides); } }, - + /** * Applies all properties in the supplier to the receiver if the - * receiver does not have these properties yet. Optionally, one or - * more methods/properties can be specified (as additional - * parameters). This option will overwrite the property if receiver - * has it already. If true is passed as the third parameter, all - * properties will be applied and _will_ overwrite properties in + * receiver does not have these properties yet. Optionally, one or + * more methods/properties can be specified (as additional + * parameters). This option will overwrite the property if receiver + * has it already. If true is passed as the third parameter, all + * properties will be applied and _will_ overwrite properties in * the receiver. * * @method augmentObject @@ -615,7 +800,7 @@ return (o && (typeof o === 'object' || L * @since 2.3.0 * @param {Function} r the object to receive the augmentation * @param {Function} s the object that supplies the properties to augment - * @param {String*|boolean} arguments zero or more properties methods + * @param {String*|boolean} arguments zero or more properties methods * to augment the receiver with. If none specified, everything * in the supplier will be used unless it would * overwrite an existing property in the receiver. If true @@ -633,16 +818,18 @@ return (o && (typeof o === 'object' || L r[a[i]] = s[a[i]]; } } else { // take everything, overwriting only if the third parameter is true - for (p in s) { + for (p in s) { if (overrideList || !(p in r)) { r[p] = s[p]; } } - + L._IEEnumFix(r, s); } + + return r; }, - + /** * Same as YAHOO.lang.augmentObject, except it only applies prototype properties * @see YAHOO.lang.augmentObject @@ -650,11 +837,11 @@ return (o && (typeof o === 'object' || L * @static * @param {Function} r the object to receive the augmentation * @param {Function} s the object that supplies the properties to augment - * @param {String*|boolean} arguments zero or more properties methods - * to augment the receiver with. If none specified, everything - * in the supplier will be used unless it would overwrite an existing - * property in the receiver. if true is specified as the third - * parameter, all properties will be applied and will overwrite an + * @param {String*|boolean} arguments zero or more properties methods + * to augment the receiver with. If none specified, everything + * in the supplier will be used unless it would overwrite an existing + * property in the receiver. if true is specified as the third + * parameter, all properties will be applied and will overwrite an * existing property in the receiver */ augmentProto: function(r, s) { @@ -667,9 +854,11 @@ return (o && (typeof o === 'object' || L a.push(arguments[i]); } L.augmentObject.apply(this, a); + + return r; }, - + /** * Returns a simple string representation of the object or array. * Other types of objects will be returned unprocessed. Arrays @@ -687,7 +876,7 @@ return (o && (typeof o === 'object' || L // Cast non-objects to string // Skip dates because the std toString is what we want - // Skip HTMLElement-like objects because trying to dump + // Skip HTMLElement-like objects because trying to dump // an element will cause an unhandled exception in FF 2.x if (!L.isObject(o)) { return o + ""; @@ -739,18 +928,24 @@ return (o && (typeof o === 'object' || L }, /** - * Does variable substitution on a string. It scans through the string - * looking for expressions enclosed in { } braces. If an expression + * Does variable substitution on a string. It scans through the string + * looking for expressions enclosed in { } braces. If an expression * is found, it is used a key on the object. If there is a space in * the key, the first word is used for the key and the rest is provided * to an optional function to be used to programatically determine the - * value (the extra information might be used for this decision). If + * value (the extra information might be used for this decision). If * the value for the key in the object, or what is returned from the - * function has a string value, number value, or object value, it is + * function has a string value, number value, or object value, it is * substituted for the bracket expression and it repeats. If this * value is an object, it uses the Object's toString() if this has * been overridden, otherwise it does a shallow dump of the key/value * pairs. + * + * By specifying the recurse option, the string is rescanned after + * every replacement, allowing for nested template substitutions. + * The side effect of this option is that curly braces in the + * replacement content must be encoded. + * * @method substitute * @since 2.3.0 * @param s {String} The string that will be modified. @@ -759,25 +954,26 @@ return (o && (typeof o === 'object' || L * process each match. It receives the key, * value, and any extra metadata included with * the key inside of the braces. + * @param recurse {boolean} default true - if not false, the replaced + * string will be rescanned so that nested substitutions are possible. * @return {String} the substituted string */ - substitute: function (s, o, f) { - var i, j, k, key, v, meta, saved=[], token, + substitute: function (s, o, f, recurse) { + var i, j, k, key, v, meta, saved=[], token, lidx=s.length, DUMP='dump', SPACE=' ', LBRACE='{', RBRACE='}', - dump; - + dump, objstr; for (;;) { - i = s.lastIndexOf(LBRACE); + i = s.lastIndexOf(LBRACE, lidx); if (i < 0) { break; } j = s.indexOf(RBRACE, i); - if (i + 1 >= j) { + if (i + 1 > j) { break; } - //Extract key and meta info + //Extract key and meta info token = s.substring(i + 1, j); key = token; meta = null; @@ -807,12 +1003,14 @@ return (o && (typeof o === 'object' || L meta = meta.substring(4); } - // use the toString if it is not the Object toString + objstr = v.toString(); + + // use the toString if it is not the Object toString // and the 'dump' meta info was not found - if (v.toString===OP.toString || dump>-1) { + if (objstr === OBJECT_TOSTRING || dump > -1) { v = L.dump(v, parseInt(meta, 10)); } else { - v = v.toString(); + v = objstr; } } } else if (!L.isString(v) && !L.isNumber(v)) { @@ -825,6 +1023,9 @@ return (o && (typeof o === 'object' || L s = s.substring(0, i) + v + s.substring(j + 1); + if (recurse === false) { + lidx = i-1; + } } @@ -838,7 +1039,7 @@ return (o && (typeof o === 'object' || L /** - * Returns a string without any leading or trailing whitespace. If + * Returns a string without any leading or trailing whitespace. If * the input is not a string, the input will be returned untouched. * @method trim * @since 2.3.0 @@ -871,28 +1072,28 @@ return (o && (typeof o === 'object' || L }, /** - * Executes the supplied function in the context of the supplied - * object 'when' milliseconds later. Executes the function a + * Executes the supplied function in the context of the supplied + * object 'when' milliseconds later. Executes the function a * single time unless periodic is set to true. * @method later * @since 2.4.0 - * @param when {int} the number of milliseconds to wait until the fn + * @param when {int} the number of milliseconds to wait until the fn * is executed * @param o the context object - * @param fn {Function|String} the function to execute or the name of + * @param fn {Function|String} the function to execute or the name of * the method in the 'o' object to execute * @param data [Array] data that is provided to the function. This accepts * either a single item or an array. If an array is provided, the * function is executed with one parameter for each array item. If * you need to pass a single array parameter, it needs to be wrapped in * an array [myarray] - * @param periodic {boolean} if true, executes continuously at supplied + * @param periodic {boolean} if true, executes continuously at supplied * interval until canceled - * @return a timer object. Call the cancel() method on this object to + * @return a timer object. Call the cancel() method on this object to * stop the timer. */ later: function(when, o, fn, data, periodic) { - when = when || 0; + when = when || 0; o = o || {}; var m=fn, d=data, f, r; @@ -904,12 +1105,12 @@ return (o && (typeof o === 'object' || L throw new TypeError("method undefined"); } - if (!L.isArray(d)) { + if (!L.isUndefined(data) && !L.isArray(d)) { d = [data]; } f = function() { - m.apply(o, d); + m.apply(o, d || NOTHING); }; r = (periodic) ? setInterval(f, when) : setTimeout(f, when); @@ -925,10 +1126,10 @@ return (o && (typeof o === 'object' || L } }; }, - + /** * A convenience method for detecting a legitimate non-null value. - * Returns false for null/undefined/NaN, true for other values, + * Returns false for null/undefined/NaN, true for other values, * including 0/false/'' * @method isValue * @since 2.3.0 @@ -965,9 +1166,9 @@ return (L.isObject(o) || L.isString(o) | */ L.hasOwnProperty = (OP.hasOwnProperty) ? function(o, prop) { - return o && o.hasOwnProperty(prop); + return o && o.hasOwnProperty && o.hasOwnProperty(prop); } : function(o, prop) { - return !L.isUndefined(o[prop]) && + return !L.isUndefined(o[prop]) && o.constructor.prototype[prop] !== o[prop]; }; @@ -979,16 +1180,16 @@ OB.augmentObject(L, OB, true); * @class YAHOO.util.Lang */ YAHOO.util.Lang = L; - + /** - * Same as YAHOO.lang.augmentObject, except it only applies prototype + * Same as YAHOO.lang.augmentObject, except it only applies prototype * properties. This is an alias for augmentProto. * @see YAHOO.lang.augmentObject * @method augment * @static * @param {Function} r the object to receive the augmentation * @param {Function} s the object that supplies the properties to augment - * @param {String*|boolean} arguments zero or more properties methods to + * @param {String*|boolean} arguments zero or more properties methods to * augment the receiver with. If none specified, everything * in the supplier will be used unless it would * overwrite an existing property in the receiver. if true @@ -1005,13 +1206,13 @@ L.augment = L.augmentProto; * @static * @param {Function} r the object to receive the augmentation * @param {Function} s the object that supplies the properties to augment - * @param {String*} arguments zero or more properties methods to + * @param {String*} arguments zero or more properties methods to * augment the receiver with. If none specified, everything * in the supplier will be used unless it would * overwrite an existing property in the receiver */ YAHOO.augment = L.augmentProto; - + /** * An alias for <a href="YAHOO.lang.html#extend">YAHOO.lang.extend</a> * @method extend @@ -1025,4 +1226,4 @@ YAHOO.augment = L.augmentProto; YAHOO.extend = L.extend; })(); -YAHOO.register("yahoo", YAHOO, {version: "2.7.0", build: "1799"}); +YAHOO.register("yahoo", YAHOO, {version: "2.9.0", build: "2800"});