|
|
Line 229: |
Line 229: |
| } | | } |
| }); | | }); |
− | /*!
| + | eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(n(k,l){x m="H 2B 2z 2u 2s w 2p 2l 2k 2j",1Z=/^([\\-+])=\\s*(\\d+\\.?\\d*)/,1Y=[{12:/y?\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*(?:,\\s*(\\d?(?:\\.\\d+)?)\\s*)?\\)/,K:n(a){8[a[1],a[2],a[3],a[4]]}},{12:/y?\\(\\s*(\\d+(?:\\.\\d+)?)\\%\\s*,\\s*(\\d+(?:\\.\\d+)?)\\%\\s*,\\s*(\\d+(?:\\.\\d+)?)\\%\\s*(?:,\\s*(\\d?(?:\\.\\d+)?)\\s*)?\\)/,K:n(a){8[a[1]*2.1t,a[2]*2.1t,a[3]*2.1t,a[4]]}},{12:/#([a-11-9]{2})([a-11-9]{2})([a-11-9]{2})/,K:n(a){8[14(a[1],16),14(a[2],16),14(a[3],16)]}},{12:/#([a-11-9])([a-11-9])([a-11-9])/,K:n(a){8[14(a[1]+a[1],16),14(a[2]+a[2],16),14(a[3]+a[3],16)]}},{12:/E?\\(\\s*(\\d+(?:\\.\\d+)?)\\s*,\\s*(\\d+(?:\\.\\d+)?)\\%\\s*,\\s*(\\d+(?:\\.\\d+)?)\\%\\s*(?:,\\s*(\\d?(?:\\.\\d+)?)\\s*)?\\)/,N:"E",K:n(a){8[a[1],a[2]/1w,a[3]/1w,a[4]]}}],w=k.1q=n(a,b,c,d){8 2g k.1q.J.K(a,b,c,d)},D={y:{S:{1X:{C:0,u:"1p"},1J:{C:1,u:"1p"},1U:{C:2,u:"1p"}}},E:{S:{3k:{C:0,u:"1T"},2E:{C:1,u:"1l"},2C:{C:2,u:"1l"}}}},1z={"1p":{1C:1a,F:P},"1l":{F:1},"1T":{L:1i,1C:1a}},1g=w.1g={},1v=k("<p>")[0],19,B=k.B;1v.1e.2A="2x-w:y(1,1,1,.5)";1g.y=1v.1e.H.2q("y")>-1;B(D,n(a,b){b.z="1S"+a;b.S.13={C:3,u:"1l",1n:1}});n 15(a,b,c){x d=1z[b.u]||{};7(a==o){8(c||!b.1n)?o:b.1n}a=d.1C?~~a:1R(a);7(2h(a)){8 b.1n}7(d.L){8(a+d.L)%d.L}8 0>a?0:d.F<a?d.F:a}n 1B(c){x d=w(),y=d.A=[];c=c.2e();B(1Y,n(i,a){x b,O=a.12.1N(c),1s=!(!O||!a.K(O)),T=a.N||"y";7(1s){b=d[T](1s);d[D[T].z]=b[D[T].z];y=d.A=b.A;8 2o}});7(y.1M){7(y.1r()==="0,0,0,0"){k.1L(y,19.W)}8 d}8 19[c]}w.J=k.1L(w.1W,{K:n(f,g,h,i){7(f===l){t.A=[o,o,o,o];8 t}7(f.2f||f.2a){f=k(f).1K(g);g=l}x j=t,u=k.u(f),y=t.A=[];7(g!==l){f=[f,g,h,i];u="1G"}7(u==="1x"){8 t.K(1B(f)||19.1I)}7(u==="1G"){B(D.y.S,n(a,b){y[b.C]=15(f[b.C],b)});8 t}7(u==="1E"){7(f 2y w){B(D,n(a,b){7(f[b.z]){j[b.z]=f[b.z].V()}})}M{B(D,n(c,d){x e=d.z;B(d.S,n(a,b){7(!(j[e]||!d.R)){7(a==="13"||f[a]==o){8}j[e]=d.R(j.A)}j[e][b.C]=15(f[a],b,1a)});7(j[e])7(k.2d(o,j[e].V(0,3))<0){j[e][3]=1;7(d.Z){j.A=d.Z(j[e])}}})}8 t}},2i:n(a){x b=w(a),1f=1a,1H=t;B(D,n(1S,N)){}1f=0;8 1f});8 1f},1O:n(){x c=[],1H=t;B(D,n(a,b){7(1H[b.z]){c.1P(a)}});8 c.18()},1Q:n(d,e){x f=w(d),T=f.1O(),N=D[T],1A=t.13()===0?w("W"):t,17=1A[N.z]||N.R(1A.A),1j=17.V();f=f[N.z];B(N.S,n(a,b){x c=b.C,Q=17[c],10=f[c],u=1z[b.u]||{};7(10===o){8}7(Q===o){1j[c]=10}M{7(u.L){7(10-Q>u.L/2){Q+=u.L}M 7(Q-10>u.L/2){Q-=u.L}}1j[c]=15((10-Q)*e+Q,b)}});8 t[T](1j)},1d:n(b){7(t.A[3]===1){8 t}x c=t.A.V(),a=c.18(),1d=w(b).A;8 w(k.1k(c,n(v,i){8(1-a)*1d[i]+a*v}))},1u:n(){x a="y(",y=k.1k(t.A,n(v,i){8 v==o?(i>2?1:0):v});7(y[3]===1){y.18();a="2I("}8 a+y.1r()+")"},2J:n(){x a="E(",E=k.1k(t.E(),n(v,i){7(v==o){v=i>2?1:0}7(!(!i||i>=3)){v=Y.1b(v*1w)+"%"}8 v});7(E[3]===1){E.18();a="2b("}8 a+E.1r()+")"},2c:n(a){x b=t.A.V(),13=b.18();7(a){b.1P(~~(13*P))}8"#"+k.1k(b,n(v){v=(v||0).1V(16);8 v.1M===1?"0"+v:v}).1r("")},1V:n(){8 t.A[3]===0?"W":t.1u()}});w.J.K.1W=w.J;n 1o(p,q,h){h=(h+1)%1;7(h*6<1){8 p+(q-p)*h*6}7(h*2<1){8 q}7(h*3<2){8 p+(q-p)*((2/3)-h)*6}8 p}D.E.R=n(c){7(c[0]==o||c[1]==o||c[2]==o){8[o,o,o,c[3]]}x r=c[0]/P,g=c[1]/P,b=c[2]/P,a=c[3],F=Y.F(r,g,b),1c=Y.1c(r,g,b),X=F-1c,1h=F+1c,l=1h*0.5,h,s;7(1c===F){h=0}M 7(r===F){h=(1y*(g-b)/X)+1i}M 7(g===F){h=(1y*(b-r)/X)+2m}M{h=(1y*(r-g)/X)+2n}7(X===0){s=0}M 7(l<=0.5){s=X/1h}M{s=X/(2-1h)}8[Y.1b(h)%1i,s,l,a==o?1:a]};D.E.Z=n(b){7(b[0]==o||b[1]==o||b[2]==o){8[o,o,o,b[3]]}x h=b[0]/1i,s=b[1],l=b[2],a=b[3],q=l<=0.5?l*(1+s):l+s-l*s,p=2*l-q;8[Y.1b(1o(p,q,h+(1/3))*P),Y.1b(1o(p,q,h)*P),Y.1b(1o(p,q,h-(1/3))*P),a]};B(D,n(f,g){x h=g.S,z=g.z,R=g.R,Z=g.Z;w.J[f]=n(d){7(!(!R||t[z])){t[z]=R(t.A)}7(d===20){8 t[z].V()}x e,u=G.u(d),21=(u==="1G"||u==="1E")?d:2r,I=t[z].V();B(h,n(a,b){x c=21[u==="1E"?a:b.C];7(c==o){c=I[b.C]}I[b.C]=15(c,b)});7(Z){e=w(Z(I));e[z]=I;8 e}M{8 w(I)}};B(h,n(c,d){7(w.J[c]){8}w.J[c]=n(a){x b=G.u(a),J=(c==="13"?(t.2t?"E":"y"):f),I=t[J](),1m=I[d.C],O;7(b==="20"){8 1m}7(b==="n"){a=a.2v(t,1m);b=G.u(a)}7(!(a!=o||!d.2w)){8 t}7(b==="1x"){O=1Z.1N(a);7(O){a=1m+1R(O[2])*(O[1]==="+"?1:-1)}}I[d.C]=a;8 t[J](I)}})});w.22=n(f){x g=f.3m(" ");B(g,n(i,d){G.1F[d]={23:n(a,b){x c,U,H="";7(!(b==="W"||!(G.u(b)!=="1x"||(c=1B(b))))){b=w(c||b);7(!(1g.y||b.A[3]===1)){U=d==="H"?a.24:a;2D(!(!(H===""||H==="W")||!U||!U.1e)){25{H=G.1K(U,"H");U=U.24}26(e){}}b=b.1d(!(!H||H==="W")?H:"1I")}b=b.1u()}25{a.1e[d]=b}26(e){}}};G.2G.2H[d]=n(a){7(!a.27){a.17=w(a.28,d);a.1D=w(a.1D);a.27=1a}G.1F[d].23(a.28,a.17.1Q(a.1D,a.2K))}})};w.22(2L);G.1F.2M={2N:n(b){x c={};B(["2O","2P","2Q","2R"],n(i,a){c["2S"+a+"1q"]=b});8 c}};19=G.1q.2T={2U:"#2V",2W:"#2X",1U:"#2Y",2Z:"#30",31:"#32",1J:"#33",34:"#35",36:"#37",38:"#39",3a:"#3b",3c:"#3d",1X:"#3e",3f:"#3g",3h:"#3i",3j:"#29",3l:"#2F",W:[o,o,o,0],1I:"#29"}}(G));',62,209,'|||||||if|return|||||||||||||||function|null|||||this|type||color|var|rgba|cache|_rgba|each|idx|spaces|hsla|max|jQuery|backgroundColor|local|fn|parse|mod|else|space|match|255|startValue|to|props|spaceName|curElem|slice|transparent|diff|Math|from|endValue|f0|re|alpha|parseInt|clamp||start|pop|colors|true|round|min|blend|style|same|support|add|360|result|map|percent|cur|def|hue2rgb|byte|Color|join|values|55|toRgbaString|supportElem|100|string|60|propTypes|startColor|stringParse|floor|end|object|cssHooks|array|inst|_default|green|css|extend|length|exec|_space|push|transition|parseFloat|_|degrees|blue|toString|prototype|red|stringParsers|rplusequals|undefined|arr|hook|set|parentNode|try|catch|colorInit|elem|ffffff|nodeType|hsl|toHexString|inArray|toLowerCase|jquery|new|isNaN|is|textEmphasisColor|textDecorationColor|outlineColor|120|240|false|columnRuleColor|indexOf|arguments|borderTopColor|_hsla|borderRightColor|call|empty|background|instanceof|borderLeftColor|cssText|borderBottomColor|lightness|while|saturation|ffff00|fx|step|rgb|toHslaString|pos|stepHooks|borderColor|expand|Top|Right|Bottom|Left|border|names|aqua|00ffff|black|000000|0000ff|fuchsia|ff00ff|gray|808080|008000|lime|00ff00|maroon|800000|navy|000080|olive|808000|purple|800080|ff0000|silver|c0c0c0|teal|008080|white|hue|yellow|split'.split('|'),0,{})); |
− | * jQuery Color Animations v@VERSION
| + | |
− | * https://github.com/jquery/jquery-color
| + | |
− | *
| + | |
− | * Copyright jQuery Foundation and other contributors
| + | |
− | * Released under the MIT license.
| + | |
− | * http://jquery.org/license
| + | |
− | *
| + | |
− | * Date: @DATE
| + | |
− | */
| + | |
− | (function( jQuery, undefined ) { | + | |
− | | + | |
− | var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
| + | |
− | | + | |
− | // plusequals test for += 100 -= 100
| + | |
− | rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
| + | |
− | // a set of RE's that can match strings and generate color tuples.
| + | |
− | stringParsers = [{
| + | |
− | re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
| + | |
− | parse: function( execResult ) {
| + | |
− | return [
| + | |
− | execResult[ 1 ],
| + | |
− | execResult[ 2 ],
| + | |
− | execResult[ 3 ],
| + | |
− | execResult[ 4 ]
| + | |
− | ];
| + | |
− | }
| + | |
− | }, {
| + | |
− | re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
| + | |
− | parse: function( execResult ) {
| + | |
− | return [
| + | |
− | execResult[ 1 ] * 2.55,
| + | |
− | execResult[ 2 ] * 2.55,
| + | |
− | execResult[ 3 ] * 2.55,
| + | |
− | execResult[ 4 ]
| + | |
− | ];
| + | |
− | }
| + | |
− | }, {
| + | |
− | // this regex ignores A-F because it's compared against an already lowercased string
| + | |
− | re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
| + | |
− | parse: function( execResult ) {
| + | |
− | return [
| + | |
− | parseInt( execResult[ 1 ], 16 ),
| + | |
− | parseInt( execResult[ 2 ], 16 ),
| + | |
− | parseInt( execResult[ 3 ], 16 )
| + | |
− | ];
| + | |
− | }
| + | |
− | }, {
| + | |
− | // this regex ignores A-F because it's compared against an already lowercased string
| + | |
− | re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
| + | |
− | parse: function( execResult ) {
| + | |
− | return [
| + | |
− | parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
| + | |
− | parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
| + | |
− | parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
| + | |
− | ];
| + | |
− | }
| + | |
− | }, {
| + | |
− | re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
| + | |
− | space: "hsla",
| + | |
− | parse: function( execResult ) {
| + | |
− | return [
| + | |
− | execResult[ 1 ],
| + | |
− | execResult[ 2 ] / 100,
| + | |
− | execResult[ 3 ] / 100,
| + | |
− | execResult[ 4 ]
| + | |
− | ];
| + | |
− | }
| + | |
− | }],
| + | |
− | | + | |
− | // jQuery.Color( )
| + | |
− | color = jQuery.Color = function( color, green, blue, alpha ) {
| + | |
− | return new jQuery.Color.fn.parse( color, green, blue, alpha );
| + | |
− | },
| + | |
− | spaces = {
| + | |
− | rgba: {
| + | |
− | props: {
| + | |
− | red: {
| + | |
− | idx: 0,
| + | |
− | type: "byte"
| + | |
− | },
| + | |
− | green: {
| + | |
− | idx: 1,
| + | |
− | type: "byte"
| + | |
− | },
| + | |
− | blue: {
| + | |
− | idx: 2,
| + | |
− | type: "byte"
| + | |
− | }
| + | |
− | }
| + | |
− | },
| + | |
− | | + | |
− | hsla: {
| + | |
− | props: {
| + | |
− | hue: {
| + | |
− | idx: 0,
| + | |
− | type: "degrees"
| + | |
− | },
| + | |
− | saturation: {
| + | |
− | idx: 1,
| + | |
− | type: "percent"
| + | |
− | },
| + | |
− | lightness: {
| + | |
− | idx: 2,
| + | |
− | type: "percent"
| + | |
− | }
| + | |
− | }
| + | |
− | }
| + | |
− | },
| + | |
− | propTypes = {
| + | |
− | "byte": {
| + | |
− | floor: true,
| + | |
− | max: 255
| + | |
− | },
| + | |
− | "percent": {
| + | |
− | max: 1
| + | |
− | },
| + | |
− | "degrees": {
| + | |
− | mod: 360,
| + | |
− | floor: true
| + | |
− | }
| + | |
− | },
| + | |
− | support = color.support = {},
| + | |
− | | + | |
− | // element for support tests
| + | |
− | supportElem = jQuery( "<p>" )[ 0 ],
| + | |
− | | + | |
− | // colors = jQuery.Color.names
| + | |
− | colors,
| + | |
− | | + | |
− | // local aliases of functions called often
| + | |
− | each = jQuery.each;
| + | |
− | | + | |
− | // determine rgba support immediately
| + | |
− | supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
| + | |
− | support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
| + | |
− | | + | |
− | // define cache name and alpha properties
| + | |
− | // for rgba and hsla spaces
| + | |
− | each( spaces, function( spaceName, space ) {
| + | |
− | space.cache = "_" + spaceName;
| + | |
− | space.props.alpha = {
| + | |
− | idx: 3,
| + | |
− | type: "percent",
| + | |
− | def: 1
| + | |
− | };
| + | |
− | }); | + | |
− | | + | |
− | function clamp( value, prop, allowEmpty ) {
| + | |
− | var type = propTypes[ prop.type ] || {};
| + | |
− | | + | |
− | if ( value == null ) {
| + | |
− | return (allowEmpty || !prop.def) ? null : prop.def;
| + | |
− | }
| + | |
− | | + | |
− | // ~~ is an short way of doing floor for positive numbers
| + | |
− | value = type.floor ? ~~value : parseFloat( value );
| + | |
− | | + | |
− | // IE will pass in empty strings as value for alpha,
| + | |
− | // which will hit this case
| + | |
− | if ( isNaN( value ) ) {
| + | |
− | return prop.def;
| + | |
− | }
| + | |
− | | + | |
− | if ( type.mod ) {
| + | |
− | // we add mod before modding to make sure that negatives values
| + | |
− | // get converted properly: -10 -> 350
| + | |
− | return (value + type.mod) % type.mod;
| + | |
− | }
| + | |
− | | + | |
− | // for now all property types without mod have min and max
| + | |
− | return 0 > value ? 0 : type.max < value ? type.max : value;
| + | |
− | } | + | |
− | | + | |
− | function stringParse( string ) {
| + | |
− | var inst = color(),
| + | |
− | rgba = inst._rgba = [];
| + | |
− | | + | |
− | string = string.toLowerCase();
| + | |
− | | + | |
− | each( stringParsers, function( i, parser ) {
| + | |
− | var parsed,
| + | |
− | match = parser.re.exec( string ),
| + | |
− | values = !(!match || !parser.parse( match )),
| + | |
− | spaceName = parser.space || "rgba";
| + | |
− | | + | |
− | if ( values ) {
| + | |
− | parsed = inst[ spaceName ]( values );
| + | |
− | | + | |
− | // if this was an rgba parse the assignment might happen twice
| + | |
− | // oh well....
| + | |
− | inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
| + | |
− | rgba = inst._rgba = parsed._rgba;
| + | |
− | | + | |
− | // exit each( stringParsers ) here because we matched
| + | |
− | return false;
| + | |
− | }
| + | |
− | });
| + | |
− | | + | |
− | // Found a stringParser that handled it
| + | |
− | if ( rgba.length ) {
| + | |
− | | + | |
− | // if this came from a parsed string, force "transparent" when alpha is 0
| + | |
− | // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
| + | |
− | if ( rgba.join() === "0,0,0,0" ) {
| + | |
− | jQuery.extend( rgba, colors.transparent );
| + | |
− | }
| + | |
− | return inst;
| + | |
− | }
| + | |
− | | + | |
− | // named colors
| + | |
− | return colors[ string ];
| + | |
− | } | + | |
− | | + | |
− | color.fn = jQuery.extend( color.prototype, {
| + | |
− | parse: function( red, green, blue, alpha ) {
| + | |
− | if ( red === undefined ) {
| + | |
− | this._rgba = [ null, null, null, null ];
| + | |
− | return this;
| + | |
− | }
| + | |
− | if ( red.jquery || red.nodeType ) {
| + | |
− | red = jQuery( red ).css( green );
| + | |
− | green = undefined;
| + | |
− | }
| + | |
− | | + | |
− | var inst = this,
| + | |
− | type = jQuery.type( red ),
| + | |
− | rgba = this._rgba = [];
| + | |
− | | + | |
− | // more than 1 argument specified - assume ( red, green, blue, alpha )
| + | |
− | if ( green !== undefined ) {
| + | |
− | red = [ red, green, blue, alpha ];
| + | |
− | type = "array";
| + | |
− | }
| + | |
− | | + | |
− | if ( type === "string" ) {
| + | |
− | return this.parse( stringParse( red ) || colors._default );
| + | |
− | }
| + | |
− | | + | |
− | if ( type === "array" ) {
| + | |
− | each( spaces.rgba.props, function( key, prop ) {
| + | |
− | rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
| + | |
− | });
| + | |
− | return this;
| + | |
− | }
| + | |
− | | + | |
− | if ( type === "object" ) {
| + | |
− | if ( red instanceof color ) {
| + | |
− | each( spaces, function( spaceName, space ) {
| + | |
− | if ( red[ space.cache ] ) {
| + | |
− | inst[ space.cache ] = red[ space.cache ].slice();
| + | |
− | }
| + | |
− | });
| + | |
− | } else {
| + | |
− | each( spaces, function( spaceName, space ) {
| + | |
− | var cache = space.cache;
| + | |
− | each( space.props, function( key, prop ) {
| + | |
− | | + | |
− | // if the cache doesn't exist, and we know how to convert
| + | |
− | if ( !(inst[ cache ] || !space.to ) ) {
| + | |
− | | + | |
− | // if the value was null, we don't need to copy it
| + | |
− | // if the key was alpha, we don't need to copy it either
| + | |
− | if ( key === "alpha" || red[ key ] == null ) {
| + | |
− | return;
| + | |
− | }
| + | |
− | inst[ cache ] = space.to( inst._rgba );
| + | |
− | }
| + | |
− | | + | |
− | // this is the only case where we allow nulls for ALL properties.
| + | |
− | // call clamp with alwaysAllowEmpty
| + | |
− | inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
| + | |
− | });
| + | |
− | | + | |
− | // everything defined but alpha?
| + | |
− | if ( inst[ cache ] )if( jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
| + | |
− | // use the default of 1
| + | |
− | inst[ cache ][ 3 ] = 1;
| + | |
− | if ( space.from ) {
| + | |
− | inst._rgba = space.from( inst[ cache ] );
| + | |
− | }
| + | |
− | }
| + | |
− | });
| + | |
− | }
| + | |
− | return this;
| + | |
− | }
| + | |
− | },
| + | |
− | is: function( compare ) {
| + | |
− | var is = color( compare ),
| + | |
− | same = true,
| + | |
− | inst = this;
| + | |
− | | + | |
− | each( spaces, function( _, space ) {
| + | |
− | /*var localCache,
| + | |
− | isCache = is[ space.cache ];
| + | |
− | if (isCache) {
| + | |
− | localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
| + | |
− | each( space.props, function( _, prop ) {
| + | |
− | if ( isCache[ prop.idx ] != null ) {
| + | |
− | same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
| + | |
− | return same;
| + | |
− | }
| + | |
− | });*/
| + | |
− | }
| + | |
− | same=0;
| + | |
− | return same;
| + | |
− | });
| + | |
− | return same;
| + | |
− | },
| + | |
− | _space: function() {
| + | |
− | var used = [],
| + | |
− | inst = this;
| + | |
− | each( spaces, function( spaceName, space ) {
| + | |
− | if ( inst[ space.cache ] ) {
| + | |
− | used.push( spaceName );
| + | |
− | }
| + | |
− | });
| + | |
− | return used.pop();
| + | |
− | },
| + | |
− | transition: function( other, distance ) {
| + | |
− | var end = color( other ),
| + | |
− | spaceName = end._space(),
| + | |
− | space = spaces[ spaceName ],
| + | |
− | startColor = this.alpha() === 0 ? color( "transparent" ) : this,
| + | |
− | start = startColor[ space.cache ] || space.to( startColor._rgba ),
| + | |
− | result = start.slice();
| + | |
− | | + | |
− | end = end[ space.cache ];
| + | |
− | each( space.props, function( key, prop ) {
| + | |
− | var index = prop.idx,
| + | |
− | startValue = start[ index ],
| + | |
− | endValue = end[ index ],
| + | |
− | type = propTypes[ prop.type ] || {};
| + | |
− | | + | |
− | // if null, don't override start value
| + | |
− | if ( endValue === null ) {
| + | |
− | return;
| + | |
− | }
| + | |
− | // if null - use end
| + | |
− | if ( startValue === null ) {
| + | |
− | result[ index ] = endValue;
| + | |
− | } else {
| + | |
− | if ( type.mod ) {
| + | |
− | if ( endValue - startValue > type.mod / 2 ) {
| + | |
− | startValue += type.mod;
| + | |
− | } else if ( startValue - endValue > type.mod / 2 ) {
| + | |
− | startValue -= type.mod;
| + | |
− | }
| + | |
− | }
| + | |
− | result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
| + | |
− | }
| + | |
− | });
| + | |
− | return this[ spaceName ]( result );
| + | |
− | },
| + | |
− | blend: function( opaque ) {
| + | |
− | // if we are already opaque - return ourself
| + | |
− | if ( this._rgba[ 3 ] === 1 ) {
| + | |
− | return this;
| + | |
− | }
| + | |
− | | + | |
− | var rgb = this._rgba.slice(),
| + | |
− | a = rgb.pop(),
| + | |
− | blend = color( opaque )._rgba;
| + | |
− | | + | |
− | return color( jQuery.map( rgb, function( v, i ) {
| + | |
− | return ( 1 - a ) * blend[ i ] + a * v;
| + | |
− | }));
| + | |
− | },
| + | |
− | toRgbaString: function() {
| + | |
− | var prefix = "rgba(",
| + | |
− | rgba = jQuery.map( this._rgba, function( v, i ) {
| + | |
− | return v == null ? ( i > 2 ? 1 : 0 ) : v;
| + | |
− | });
| + | |
− | | + | |
− | if ( rgba[ 3 ] === 1 ) {
| + | |
− | rgba.pop();
| + | |
− | prefix = "rgb(";
| + | |
− | }
| + | |
− | | + | |
− | return prefix + rgba.join() + ")";
| + | |
− | },
| + | |
− | toHslaString: function() {
| + | |
− | var prefix = "hsla(",
| + | |
− | hsla = jQuery.map( this.hsla(), function( v, i ) {
| + | |
− | if ( v == null ) {
| + | |
− | v = i > 2 ? 1 : 0;
| + | |
− | }
| + | |
− | | + | |
− | // catch 1 and 2
| + | |
− | if (!(!i || i >= 3) ) {
| + | |
− | v = Math.round( v * 100 ) + "%";
| + | |
− | }
| + | |
− | return v;
| + | |
− | });
| + | |
− | | + | |
− | if ( hsla[ 3 ] === 1 ) {
| + | |
− | hsla.pop();
| + | |
− | prefix = "hsl(";
| + | |
− | }
| + | |
− | return prefix + hsla.join() + ")";
| + | |
− | },
| + | |
− | toHexString: function( includeAlpha ) {
| + | |
− | var rgba = this._rgba.slice(),
| + | |
− | alpha = rgba.pop();
| + | |
− | | + | |
− | if ( includeAlpha ) {
| + | |
− | rgba.push( ~~( alpha * 255 ) );
| + | |
− | }
| + | |
− | | + | |
− | return "#" + jQuery.map( rgba, function( v ) {
| + | |
− | | + | |
− | // default to 0 when nulls exist
| + | |
− | v = ( v || 0 ).toString( 16 );
| + | |
− | return v.length === 1 ? "0" + v : v;
| + | |
− | }).join("");
| + | |
− | },
| + | |
− | toString: function() {
| + | |
− | return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
| + | |
− | }
| + | |
− | }); | + | |
− | color.fn.parse.prototype = color.fn;
| + | |
− | | + | |
− | // hsla conversions adapted from:
| + | |
− | // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
| + | |
− | | + | |
− | function hue2rgb( p, q, h ) {
| + | |
− | h = ( h + 1 ) % 1;
| + | |
− | if ( h * 6 < 1 ) {
| + | |
− | return p + (q - p) * h * 6;
| + | |
− | }
| + | |
− | if ( h * 2 < 1) {
| + | |
− | return q;
| + | |
− | }
| + | |
− | if ( h * 3 < 2 ) {
| + | |
− | return p + (q - p) * ((2/3) - h) * 6;
| + | |
− | }
| + | |
− | return p;
| + | |
− | } | + | |
− | | + | |
− | spaces.hsla.to = function ( rgba ) {
| + | |
− | if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
| + | |
− | return [ null, null, null, rgba[ 3 ] ];
| + | |
− | }
| + | |
− | var r = rgba[ 0 ] / 255,
| + | |
− | g = rgba[ 1 ] / 255,
| + | |
− | b = rgba[ 2 ] / 255,
| + | |
− | a = rgba[ 3 ],
| + | |
− | max = Math.max( r, g, b ),
| + | |
− | min = Math.min( r, g, b ),
| + | |
− | diff = max - min,
| + | |
− | add = max + min,
| + | |
− | l = add * 0.5,
| + | |
− | h, s;
| + | |
− | | + | |
− | if ( min === max ) {
| + | |
− | h = 0;
| + | |
− | } else if ( r === max ) {
| + | |
− | h = ( 60 * ( g - b ) / diff ) + 360;
| + | |
− | } else if ( g === max ) {
| + | |
− | h = ( 60 * ( b - r ) / diff ) + 120;
| + | |
− | } else {
| + | |
− | h = ( 60 * ( r - g ) / diff ) + 240;
| + | |
− | }
| + | |
− | | + | |
− | // chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
| + | |
− | // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
| + | |
− | if ( diff === 0 ) {
| + | |
− | s = 0;
| + | |
− | } else if ( l <= 0.5 ) {
| + | |
− | s = diff / add;
| + | |
− | } else {
| + | |
− | s = diff / ( 2 - add );
| + | |
− | }
| + | |
− | return [ Math.round(h) % 360, s, l, a == null ? 1 : a ];
| + | |
− | }; | + | |
− | | + | |
− | spaces.hsla.from = function ( hsla ) {
| + | |
− | if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
| + | |
− | return [ null, null, null, hsla[ 3 ] ];
| + | |
− | }
| + | |
− | var h = hsla[ 0 ] / 360,
| + | |
− | s = hsla[ 1 ],
| + | |
− | l = hsla[ 2 ],
| + | |
− | a = hsla[ 3 ],
| + | |
− | q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
| + | |
− | p = 2 * l - q;
| + | |
− | | + | |
− | return [
| + | |
− | Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
| + | |
− | Math.round( hue2rgb( p, q, h ) * 255 ),
| + | |
− | Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
| + | |
− | a
| + | |
− | ];
| + | |
− | }; | + | |
− | | + | |
− | | + | |
− | each( spaces, function( spaceName, space ) {
| + | |
− | var props = space.props,
| + | |
− | cache = space.cache,
| + | |
− | to = space.to,
| + | |
− | from = space.from;
| + | |
− | | + | |
− | // makes rgba() and hsla()
| + | |
− | color.fn[ spaceName ] = function( value ) {
| + | |
− | | + | |
− | // generate a cache for this space if it doesn't exist
| + | |
− | if ( !(!to || this[ cache ]) ) {
| + | |
− | this[ cache ] = to( this._rgba );
| + | |
− | }
| + | |
− | if ( value === undefined ) {
| + | |
− | return this[ cache ].slice();
| + | |
− | }
| + | |
− | | + | |
− | var ret,
| + | |
− | type = jQuery.type( value ),
| + | |
− | arr = ( type === "array" || type === "object" ) ? value : arguments,
| + | |
− | local = this[ cache ].slice();
| + | |
− | | + | |
− | each( props, function( key, prop ) {
| + | |
− | var val = arr[ type === "object" ? key : prop.idx ];
| + | |
− | if ( val == null ) {
| + | |
− | val = local[ prop.idx ];
| + | |
− | }
| + | |
− | local[ prop.idx ] = clamp( val, prop );
| + | |
− | });
| + | |
− | | + | |
− | if ( from ) {
| + | |
− | ret = color( from( local ) );
| + | |
− | ret[ cache ] = local;
| + | |
− | return ret;
| + | |
− | } else {
| + | |
− | return color( local );
| + | |
− | }
| + | |
− | };
| + | |
− | | + | |
− | // makes red() green() blue() alpha() hue() saturation() lightness()
| + | |
− | each( props, function( key, prop ) {
| + | |
− | // alpha is included in more than one space
| + | |
− | if ( color.fn[ key ] ) {
| + | |
− | return;
| + | |
− | }
| + | |
− | color.fn[ key ] = function( value ) {
| + | |
− | var vtype = jQuery.type( value ),
| + | |
− | fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
| + | |
− | local = this[ fn ](),
| + | |
− | cur = local[ prop.idx ],
| + | |
− | match;
| + | |
− | | + | |
− | if ( vtype === "undefined" ) {
| + | |
− | return cur;
| + | |
− | }
| + | |
− | | + | |
− | if ( vtype === "function" ) {
| + | |
− | value = value.call( this, cur );
| + | |
− | vtype = jQuery.type( value );
| + | |
− | }
| + | |
− | if ( !(value != null || !prop.empty) ) {
| + | |
− | return this;
| + | |
− | }
| + | |
− | if ( vtype === "string" ) {
| + | |
− | match = rplusequals.exec( value );
| + | |
− | if ( match ) {
| + | |
− | value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
| + | |
− | }
| + | |
− | }
| + | |
− | local[ prop.idx ] = value;
| + | |
− | return this[ fn ]( local );
| + | |
− | };
| + | |
− | });
| + | |
− | }); | + | |
− | | + | |
− | // add cssHook and .fx.step function for each named hook.
| + | |
− | // accept a space separated string of properties
| + | |
− | color.hook = function( hook ) {
| + | |
− | var hooks = hook.split( " " );
| + | |
− | each( hooks, function( i, hook ) {
| + | |
− | jQuery.cssHooks[ hook ] = {
| + | |
− | set: function( elem, value ) {
| + | |
− | var parsed, curElem,
| + | |
− | backgroundColor = "";
| + | |
− | | + | |
− | if ( !(value === "transparent" || !( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) ) {
| + | |
− | value = color( parsed || value );
| + | |
− | if ( !(support.rgba || value._rgba[ 3 ] === 1) ) {
| + | |
− | curElem = hook === "backgroundColor" ? elem.parentNode : elem;
| + | |
− | while (
| + | |
− | !(!(backgroundColor === "" || backgroundColor === "transparent") ||
| + | |
− | !curElem || !curElem.style)
| + | |
− | ) {
| + | |
− | try {
| + | |
− | backgroundColor = jQuery.css( curElem, "backgroundColor" );
| + | |
− | curElem = curElem.parentNode;
| + | |
− | } catch ( e ) {
| + | |
− | }
| + | |
− | }
| + | |
− | | + | |
− | value = value.blend( !(!backgroundColor || backgroundColor === "transparent") ?
| + | |
− | backgroundColor :
| + | |
− | "_default" );
| + | |
− | }
| + | |
− | | + | |
− | value = value.toRgbaString();
| + | |
− | }
| + | |
− | try {
| + | |
− | elem.style[ hook ] = value;
| + | |
− | } catch( e ) {
| + | |
− | // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
| + | |
− | }
| + | |
− | }
| + | |
− | };
| + | |
− | jQuery.fx.step[ hook ] = function( fx ) {
| + | |
− | if ( !fx.colorInit ) {
| + | |
− | fx.start = color( fx.elem, hook );
| + | |
− | fx.end = color( fx.end );
| + | |
− | fx.colorInit = true;
| + | |
− | }
| + | |
− | jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
| + | |
− | };
| + | |
− | });
| + | |
− | | + | |
− | }; | + | |
− | | + | |
− | color.hook( stepHooks );
| + | |
− | | + | |
− | jQuery.cssHooks.borderColor = {
| + | |
− | expand: function( value ) {
| + | |
− | var expanded = {};
| + | |
− | | + | |
− | each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
| + | |
− | expanded[ "border" + part + "Color" ] = value;
| + | |
− | });
| + | |
− | return expanded;
| + | |
− | }
| + | |
− | }; | + | |
− | | + | |
− | // Basic color names only.
| + | |
− | // Usage of any of the other color names requires adding yourself or including
| + | |
− | // jquery.color.svg-names.js.
| + | |
− | colors = jQuery.Color.names = {
| + | |
− | // 4.1. Basic color keywords
| + | |
− | aqua: "#00ffff",
| + | |
− | black: "#000000",
| + | |
− | blue: "#0000ff",
| + | |
− | fuchsia: "#ff00ff",
| + | |
− | gray: "#808080",
| + | |
− | green: "#008000",
| + | |
− | lime: "#00ff00",
| + | |
− | maroon: "#800000",
| + | |
− | navy: "#000080",
| + | |
− | olive: "#808000",
| + | |
− | purple: "#800080",
| + | |
− | red: "#ff0000",
| + | |
− | silver: "#c0c0c0",
| + | |
− | teal: "#008080",
| + | |
− | white: "#ffffff",
| + | |
− | yellow: "#ffff00",
| + | |
− | | + | |
− | // 4.2.3. "transparent" color keyword
| + | |
− | transparent: [ null, null, null, 0 ],
| + | |
− | | + | |
− | _default: "#ffffff"
| + | |
− | }; | + | |
− | | + | |
− | }( jQuery )); | + | |
| var scroll_pos = 0; | | var scroll_pos = 0; |
| var animation_begin_pos = 0; //where you want the animation to begin | | var animation_begin_pos = 0; //where you want the animation to begin |