jquery-ui-rails 6.0.1 → 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitmodules +1 -1
- data/History.md +7 -2
- data/README.md +12 -12
- data/Rakefile +8 -3
- data/VERSIONS.md +1 -0
- data/app/assets/images/jquery-ui/ui-icons_444444_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_555555_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_777620_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_777777_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_cc0000_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_ffffff_256x240.png +0 -0
- data/app/assets/javascripts/jquery-ui/core.js +1 -1
- data/app/assets/javascripts/jquery-ui/data.js +8 -4
- data/app/assets/javascripts/jquery-ui/disable-selection.js +6 -3
- data/app/assets/javascripts/jquery-ui/effect.js +55 -717
- data/app/assets/javascripts/jquery-ui/effects/effect-blind.js +6 -3
- data/app/assets/javascripts/jquery-ui/effects/effect-bounce.js +6 -3
- data/app/assets/javascripts/jquery-ui/effects/effect-clip.js +6 -3
- data/app/assets/javascripts/jquery-ui/effects/effect-drop.js +6 -3
- data/app/assets/javascripts/jquery-ui/effects/effect-explode.js +8 -5
- data/app/assets/javascripts/jquery-ui/effects/effect-fade.js +6 -3
- data/app/assets/javascripts/jquery-ui/effects/effect-fold.js +6 -3
- data/app/assets/javascripts/jquery-ui/effects/effect-highlight.js +6 -3
- data/app/assets/javascripts/jquery-ui/effects/effect-puff.js +6 -3
- data/app/assets/javascripts/jquery-ui/effects/effect-pulsate.js +6 -3
- data/app/assets/javascripts/jquery-ui/effects/effect-scale.js +6 -3
- data/app/assets/javascripts/jquery-ui/effects/effect-shake.js +6 -3
- data/app/assets/javascripts/jquery-ui/effects/effect-size.js +8 -3
- data/app/assets/javascripts/jquery-ui/effects/effect-slide.js +6 -3
- data/app/assets/javascripts/jquery-ui/effects/effect-transfer.js +6 -3
- data/app/assets/javascripts/jquery-ui/focusable.js +8 -5
- data/app/assets/javascripts/jquery-ui/form-reset-mixin.js +7 -4
- data/app/assets/javascripts/jquery-ui/form.js +6 -3
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-af.js +8 -5
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ar-DZ.js +6 -3
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ar.js +5 -2
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-az.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-be.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-bg.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-bs.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ca.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-cs.js +10 -7
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-cy-GB.js +8 -5
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-da.js +13 -10
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-de-AT.js +41 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-de.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-el.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-AU.js +8 -5
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-GB.js +8 -5
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-NZ.js +8 -5
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-eo.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-es.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-et.js +8 -5
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-eu.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fa.js +6 -3
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fi.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fo.js +11 -8
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr-CA.js +5 -2
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr-CH.js +5 -2
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr.js +6 -3
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-gl.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-he.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-hi.js +7 -4
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-hr.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-hu.js +9 -6
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-hy.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-id.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-is.js +11 -8
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-it-CH.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-it.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ja.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ka.js +9 -6
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-kk.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-km.js +9 -6
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ko.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ky.js +10 -7
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-lb.js +8 -5
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-lt.js +11 -8
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-lv.js +11 -8
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-mk.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ml.js +8 -5
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ms.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-nb.js +9 -6
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-nl-BE.js +5 -2
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-nl.js +5 -2
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-nn.js +9 -6
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-no.js +9 -6
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-pl.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-pt-BR.js +11 -8
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-pt.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-rm.js +8 -5
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ro.js +8 -5
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ru.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sk.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sl.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sq.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sr-SR.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sr.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sv.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ta.js +10 -7
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-th.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-tj.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-tr.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-uk.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-vi.js +5 -2
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-CN.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-HK.js +12 -9
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-TW.js +15 -12
- data/app/assets/javascripts/jquery-ui/ie.js +5 -2
- data/app/assets/javascripts/jquery-ui/jquery-patch.js +91 -0
- data/app/assets/javascripts/jquery-ui/jquery-var-for-color.js +24 -0
- data/app/assets/javascripts/jquery-ui/keycode.js +7 -3
- data/app/assets/javascripts/jquery-ui/labels.js +12 -6
- data/app/assets/javascripts/jquery-ui/plugin.js +5 -2
- data/app/assets/javascripts/jquery-ui/position.js +24 -11
- data/app/assets/javascripts/jquery-ui/safe-active-element.js +6 -2
- data/app/assets/javascripts/jquery-ui/safe-blur.js +6 -2
- data/app/assets/javascripts/jquery-ui/scroll-parent.js +6 -3
- data/app/assets/javascripts/jquery-ui/tabbable.js +7 -4
- data/app/assets/javascripts/jquery-ui/unique-id.js +6 -3
- data/app/assets/javascripts/jquery-ui/vendor/jquery-color/jquery.color.js +722 -0
- data/app/assets/javascripts/jquery-ui/version.js +6 -3
- data/app/assets/javascripts/jquery-ui/widget.js +43 -24
- data/app/assets/javascripts/jquery-ui/widgets/accordion.js +17 -8
- data/app/assets/javascripts/jquery-ui/widgets/autocomplete.js +23 -32
- data/app/assets/javascripts/jquery-ui/widgets/button.js +82 -19
- data/app/assets/javascripts/jquery-ui/widgets/checkboxradio.js +9 -11
- data/app/assets/javascripts/jquery-ui/widgets/controlgroup.js +10 -6
- data/app/assets/javascripts/jquery-ui/widgets/datepicker.js +176 -56
- data/app/assets/javascripts/jquery-ui/widgets/dialog.js +45 -31
- data/app/assets/javascripts/jquery-ui/widgets/draggable.js +22 -13
- data/app/assets/javascripts/jquery-ui/widgets/droppable.js +19 -13
- data/app/assets/javascripts/jquery-ui/widgets/menu.js +83 -43
- data/app/assets/javascripts/jquery-ui/widgets/mouse.js +18 -7
- data/app/assets/javascripts/jquery-ui/widgets/progressbar.js +9 -6
- data/app/assets/javascripts/jquery-ui/widgets/resizable.js +36 -18
- data/app/assets/javascripts/jquery-ui/widgets/selectable.js +13 -6
- data/app/assets/javascripts/jquery-ui/widgets/selectmenu.js +15 -10
- data/app/assets/javascripts/jquery-ui/widgets/slider.js +10 -7
- data/app/assets/javascripts/jquery-ui/widgets/sortable.js +221 -159
- data/app/assets/javascripts/jquery-ui/widgets/spinner.js +20 -13
- data/app/assets/javascripts/jquery-ui/widgets/tabs.js +13 -13
- data/app/assets/javascripts/jquery-ui/widgets/tooltip.js +15 -11
- data/app/assets/javascripts/jquery-ui.js +3 -2
- data/app/assets/stylesheets/jquery-ui/accordion.css +1 -1
- data/app/assets/stylesheets/jquery-ui/all.css +1 -1
- data/app/assets/stylesheets/jquery-ui/autocomplete.css +1 -1
- data/app/assets/stylesheets/jquery-ui/base.css +1 -1
- data/app/assets/stylesheets/jquery-ui/button.css +1 -1
- data/app/assets/stylesheets/jquery-ui/checkboxradio.css +1 -1
- data/app/assets/stylesheets/jquery-ui/controlgroup.css +1 -1
- data/app/assets/stylesheets/jquery-ui/core.css +2 -2
- data/app/assets/stylesheets/jquery-ui/datepicker.css +1 -1
- data/app/assets/stylesheets/jquery-ui/dialog.css +1 -1
- data/app/assets/stylesheets/jquery-ui/draggable.css +1 -1
- data/app/assets/stylesheets/jquery-ui/menu.css +1 -1
- data/app/assets/stylesheets/jquery-ui/progressbar.css +2 -2
- data/app/assets/stylesheets/jquery-ui/resizable.css +1 -1
- data/app/assets/stylesheets/jquery-ui/selectable.css +1 -1
- data/app/assets/stylesheets/jquery-ui/selectmenu.css +1 -1
- data/app/assets/stylesheets/jquery-ui/slider.css +2 -2
- data/app/assets/stylesheets/jquery-ui/sortable.css +1 -1
- data/app/assets/stylesheets/jquery-ui/spinner.css +1 -1
- data/app/assets/stylesheets/jquery-ui/tabs.css +1 -1
- data/app/assets/stylesheets/jquery-ui/theme.css.erb +9 -6
- data/app/assets/stylesheets/jquery-ui/tooltip.css +1 -1
- data/lib/jquery/ui/rails/version.rb +2 -2
- metadata +8 -7
- data/app/assets/javascripts/jquery-ui/escape-selector.js +0 -23
- data/app/assets/javascripts/jquery-ui/jquery-1-7.js +0 -91
@@ -0,0 +1,722 @@
|
|
1
|
+
/*!
|
2
|
+
* jQuery Color Animations v2.2.0
|
3
|
+
* https://github.com/jquery/jquery-color
|
4
|
+
*
|
5
|
+
* Copyright OpenJS Foundation and other contributors
|
6
|
+
* Released under the MIT license.
|
7
|
+
* http://jquery.org/license
|
8
|
+
*
|
9
|
+
* Date: Sun May 10 09:02:36 2020 +0200
|
10
|
+
*/
|
11
|
+
|
12
|
+
( function( root, factory ) {
|
13
|
+
if ( typeof define === "function" && define.amd ) {
|
14
|
+
|
15
|
+
// AMD. Register as an anonymous module.
|
16
|
+
define( [ "jquery" ], factory );
|
17
|
+
} else if ( typeof exports === "object" ) {
|
18
|
+
module.exports = factory( require( "jquery" ) );
|
19
|
+
} else {
|
20
|
+
factory( root.jQuery );
|
21
|
+
}
|
22
|
+
} )( this, function( jQuery, undefined ) {
|
23
|
+
|
24
|
+
var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " +
|
25
|
+
"borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
|
26
|
+
|
27
|
+
class2type = {},
|
28
|
+
toString = class2type.toString,
|
29
|
+
|
30
|
+
// plusequals test for += 100 -= 100
|
31
|
+
rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
|
32
|
+
|
33
|
+
// a set of RE's that can match strings and generate color tuples.
|
34
|
+
stringParsers = [ {
|
35
|
+
re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
|
36
|
+
parse: function( execResult ) {
|
37
|
+
return [
|
38
|
+
execResult[ 1 ],
|
39
|
+
execResult[ 2 ],
|
40
|
+
execResult[ 3 ],
|
41
|
+
execResult[ 4 ]
|
42
|
+
];
|
43
|
+
}
|
44
|
+
}, {
|
45
|
+
re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
|
46
|
+
parse: function( execResult ) {
|
47
|
+
return [
|
48
|
+
execResult[ 1 ] * 2.55,
|
49
|
+
execResult[ 2 ] * 2.55,
|
50
|
+
execResult[ 3 ] * 2.55,
|
51
|
+
execResult[ 4 ]
|
52
|
+
];
|
53
|
+
}
|
54
|
+
}, {
|
55
|
+
|
56
|
+
// this regex ignores A-F because it's compared against an already lowercased string
|
57
|
+
re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/,
|
58
|
+
parse: function( execResult ) {
|
59
|
+
return [
|
60
|
+
parseInt( execResult[ 1 ], 16 ),
|
61
|
+
parseInt( execResult[ 2 ], 16 ),
|
62
|
+
parseInt( execResult[ 3 ], 16 ),
|
63
|
+
execResult[ 4 ] ?
|
64
|
+
( parseInt( execResult[ 4 ], 16 ) / 255 ).toFixed( 2 ) :
|
65
|
+
1
|
66
|
+
];
|
67
|
+
}
|
68
|
+
}, {
|
69
|
+
|
70
|
+
// this regex ignores A-F because it's compared against an already lowercased string
|
71
|
+
re: /#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/,
|
72
|
+
parse: function( execResult ) {
|
73
|
+
return [
|
74
|
+
parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
|
75
|
+
parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
|
76
|
+
parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ),
|
77
|
+
execResult[ 4 ] ?
|
78
|
+
( parseInt( execResult[ 4 ] + execResult[ 4 ], 16 ) / 255 )
|
79
|
+
.toFixed( 2 ) :
|
80
|
+
1
|
81
|
+
];
|
82
|
+
}
|
83
|
+
}, {
|
84
|
+
re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
|
85
|
+
space: "hsla",
|
86
|
+
parse: function( execResult ) {
|
87
|
+
return [
|
88
|
+
execResult[ 1 ],
|
89
|
+
execResult[ 2 ] / 100,
|
90
|
+
execResult[ 3 ] / 100,
|
91
|
+
execResult[ 4 ]
|
92
|
+
];
|
93
|
+
}
|
94
|
+
} ],
|
95
|
+
|
96
|
+
// jQuery.Color( )
|
97
|
+
color = jQuery.Color = function( color, green, blue, alpha ) {
|
98
|
+
return new jQuery.Color.fn.parse( color, green, blue, alpha );
|
99
|
+
},
|
100
|
+
spaces = {
|
101
|
+
rgba: {
|
102
|
+
props: {
|
103
|
+
red: {
|
104
|
+
idx: 0,
|
105
|
+
type: "byte"
|
106
|
+
},
|
107
|
+
green: {
|
108
|
+
idx: 1,
|
109
|
+
type: "byte"
|
110
|
+
},
|
111
|
+
blue: {
|
112
|
+
idx: 2,
|
113
|
+
type: "byte"
|
114
|
+
}
|
115
|
+
}
|
116
|
+
},
|
117
|
+
|
118
|
+
hsla: {
|
119
|
+
props: {
|
120
|
+
hue: {
|
121
|
+
idx: 0,
|
122
|
+
type: "degrees"
|
123
|
+
},
|
124
|
+
saturation: {
|
125
|
+
idx: 1,
|
126
|
+
type: "percent"
|
127
|
+
},
|
128
|
+
lightness: {
|
129
|
+
idx: 2,
|
130
|
+
type: "percent"
|
131
|
+
}
|
132
|
+
}
|
133
|
+
}
|
134
|
+
},
|
135
|
+
propTypes = {
|
136
|
+
"byte": {
|
137
|
+
floor: true,
|
138
|
+
max: 255
|
139
|
+
},
|
140
|
+
"percent": {
|
141
|
+
max: 1
|
142
|
+
},
|
143
|
+
"degrees": {
|
144
|
+
mod: 360,
|
145
|
+
floor: true
|
146
|
+
}
|
147
|
+
},
|
148
|
+
support = color.support = {},
|
149
|
+
|
150
|
+
// element for support tests
|
151
|
+
supportElem = jQuery( "<p>" )[ 0 ],
|
152
|
+
|
153
|
+
// colors = jQuery.Color.names
|
154
|
+
colors,
|
155
|
+
|
156
|
+
// local aliases of functions called often
|
157
|
+
each = jQuery.each;
|
158
|
+
|
159
|
+
// determine rgba support immediately
|
160
|
+
supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
|
161
|
+
support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
|
162
|
+
|
163
|
+
// define cache name and alpha properties
|
164
|
+
// for rgba and hsla spaces
|
165
|
+
each( spaces, function( spaceName, space ) {
|
166
|
+
space.cache = "_" + spaceName;
|
167
|
+
space.props.alpha = {
|
168
|
+
idx: 3,
|
169
|
+
type: "percent",
|
170
|
+
def: 1
|
171
|
+
};
|
172
|
+
} );
|
173
|
+
|
174
|
+
// Populate the class2type map
|
175
|
+
jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
|
176
|
+
function( _i, name ) {
|
177
|
+
class2type[ "[object " + name + "]" ] = name.toLowerCase();
|
178
|
+
} );
|
179
|
+
|
180
|
+
function getType( obj ) {
|
181
|
+
if ( obj == null ) {
|
182
|
+
return obj + "";
|
183
|
+
}
|
184
|
+
|
185
|
+
return typeof obj === "object" ?
|
186
|
+
class2type[ toString.call( obj ) ] || "object" :
|
187
|
+
typeof obj;
|
188
|
+
}
|
189
|
+
|
190
|
+
function clamp( value, prop, allowEmpty ) {
|
191
|
+
var type = propTypes[ prop.type ] || {};
|
192
|
+
|
193
|
+
if ( value == null ) {
|
194
|
+
return ( allowEmpty || !prop.def ) ? null : prop.def;
|
195
|
+
}
|
196
|
+
|
197
|
+
// ~~ is an short way of doing floor for positive numbers
|
198
|
+
value = type.floor ? ~~value : parseFloat( value );
|
199
|
+
|
200
|
+
// IE will pass in empty strings as value for alpha,
|
201
|
+
// which will hit this case
|
202
|
+
if ( isNaN( value ) ) {
|
203
|
+
return prop.def;
|
204
|
+
}
|
205
|
+
|
206
|
+
if ( type.mod ) {
|
207
|
+
|
208
|
+
// we add mod before modding to make sure that negatives values
|
209
|
+
// get converted properly: -10 -> 350
|
210
|
+
return ( value + type.mod ) % type.mod;
|
211
|
+
}
|
212
|
+
|
213
|
+
// for now all property types without mod have min and max
|
214
|
+
return Math.min( type.max, Math.max( 0, value ) );
|
215
|
+
}
|
216
|
+
|
217
|
+
function stringParse( string ) {
|
218
|
+
var inst = color(),
|
219
|
+
rgba = inst._rgba = [];
|
220
|
+
|
221
|
+
string = string.toLowerCase();
|
222
|
+
|
223
|
+
each( stringParsers, function( _i, parser ) {
|
224
|
+
var parsed,
|
225
|
+
match = parser.re.exec( string ),
|
226
|
+
values = match && parser.parse( match ),
|
227
|
+
spaceName = parser.space || "rgba";
|
228
|
+
|
229
|
+
if ( values ) {
|
230
|
+
parsed = inst[ spaceName ]( values );
|
231
|
+
|
232
|
+
// if this was an rgba parse the assignment might happen twice
|
233
|
+
// oh well....
|
234
|
+
inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
|
235
|
+
rgba = inst._rgba = parsed._rgba;
|
236
|
+
|
237
|
+
// exit each( stringParsers ) here because we matched
|
238
|
+
return false;
|
239
|
+
}
|
240
|
+
} );
|
241
|
+
|
242
|
+
// Found a stringParser that handled it
|
243
|
+
if ( rgba.length ) {
|
244
|
+
|
245
|
+
// if this came from a parsed string, force "transparent" when alpha is 0
|
246
|
+
// chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
|
247
|
+
if ( rgba.join() === "0,0,0,0" ) {
|
248
|
+
jQuery.extend( rgba, colors.transparent );
|
249
|
+
}
|
250
|
+
return inst;
|
251
|
+
}
|
252
|
+
|
253
|
+
// named colors
|
254
|
+
return colors[ string ];
|
255
|
+
}
|
256
|
+
|
257
|
+
color.fn = jQuery.extend( color.prototype, {
|
258
|
+
parse: function( red, green, blue, alpha ) {
|
259
|
+
if ( red === undefined ) {
|
260
|
+
this._rgba = [ null, null, null, null ];
|
261
|
+
return this;
|
262
|
+
}
|
263
|
+
if ( red.jquery || red.nodeType ) {
|
264
|
+
red = jQuery( red ).css( green );
|
265
|
+
green = undefined;
|
266
|
+
}
|
267
|
+
|
268
|
+
var inst = this,
|
269
|
+
type = getType( red ),
|
270
|
+
rgba = this._rgba = [];
|
271
|
+
|
272
|
+
// more than 1 argument specified - assume ( red, green, blue, alpha )
|
273
|
+
if ( green !== undefined ) {
|
274
|
+
red = [ red, green, blue, alpha ];
|
275
|
+
type = "array";
|
276
|
+
}
|
277
|
+
|
278
|
+
if ( type === "string" ) {
|
279
|
+
return this.parse( stringParse( red ) || colors._default );
|
280
|
+
}
|
281
|
+
|
282
|
+
if ( type === "array" ) {
|
283
|
+
each( spaces.rgba.props, function( _key, prop ) {
|
284
|
+
rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
|
285
|
+
} );
|
286
|
+
return this;
|
287
|
+
}
|
288
|
+
|
289
|
+
if ( type === "object" ) {
|
290
|
+
if ( red instanceof color ) {
|
291
|
+
each( spaces, function( _spaceName, space ) {
|
292
|
+
if ( red[ space.cache ] ) {
|
293
|
+
inst[ space.cache ] = red[ space.cache ].slice();
|
294
|
+
}
|
295
|
+
} );
|
296
|
+
} else {
|
297
|
+
each( spaces, function( _spaceName, space ) {
|
298
|
+
var cache = space.cache;
|
299
|
+
each( space.props, function( key, prop ) {
|
300
|
+
|
301
|
+
// if the cache doesn't exist, and we know how to convert
|
302
|
+
if ( !inst[ cache ] && space.to ) {
|
303
|
+
|
304
|
+
// if the value was null, we don't need to copy it
|
305
|
+
// if the key was alpha, we don't need to copy it either
|
306
|
+
if ( key === "alpha" || red[ key ] == null ) {
|
307
|
+
return;
|
308
|
+
}
|
309
|
+
inst[ cache ] = space.to( inst._rgba );
|
310
|
+
}
|
311
|
+
|
312
|
+
// this is the only case where we allow nulls for ALL properties.
|
313
|
+
// call clamp with alwaysAllowEmpty
|
314
|
+
inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
|
315
|
+
} );
|
316
|
+
|
317
|
+
// everything defined but alpha?
|
318
|
+
if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
|
319
|
+
|
320
|
+
// use the default of 1
|
321
|
+
if ( inst[ cache ][ 3 ] == null ) {
|
322
|
+
inst[ cache ][ 3 ] = 1;
|
323
|
+
}
|
324
|
+
|
325
|
+
if ( space.from ) {
|
326
|
+
inst._rgba = space.from( inst[ cache ] );
|
327
|
+
}
|
328
|
+
}
|
329
|
+
} );
|
330
|
+
}
|
331
|
+
return this;
|
332
|
+
}
|
333
|
+
},
|
334
|
+
is: function( compare ) {
|
335
|
+
var is = color( compare ),
|
336
|
+
same = true,
|
337
|
+
inst = this;
|
338
|
+
|
339
|
+
each( spaces, function( _, space ) {
|
340
|
+
var localCache,
|
341
|
+
isCache = is[ space.cache ];
|
342
|
+
if ( isCache ) {
|
343
|
+
localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
|
344
|
+
each( space.props, function( _, prop ) {
|
345
|
+
if ( isCache[ prop.idx ] != null ) {
|
346
|
+
same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
|
347
|
+
return same;
|
348
|
+
}
|
349
|
+
} );
|
350
|
+
}
|
351
|
+
return same;
|
352
|
+
} );
|
353
|
+
return same;
|
354
|
+
},
|
355
|
+
_space: function() {
|
356
|
+
var used = [],
|
357
|
+
inst = this;
|
358
|
+
each( spaces, function( spaceName, space ) {
|
359
|
+
if ( inst[ space.cache ] ) {
|
360
|
+
used.push( spaceName );
|
361
|
+
}
|
362
|
+
} );
|
363
|
+
return used.pop();
|
364
|
+
},
|
365
|
+
transition: function( other, distance ) {
|
366
|
+
var end = color( other ),
|
367
|
+
spaceName = end._space(),
|
368
|
+
space = spaces[ spaceName ],
|
369
|
+
startColor = this.alpha() === 0 ? color( "transparent" ) : this,
|
370
|
+
start = startColor[ space.cache ] || space.to( startColor._rgba ),
|
371
|
+
result = start.slice();
|
372
|
+
|
373
|
+
end = end[ space.cache ];
|
374
|
+
each( space.props, function( _key, prop ) {
|
375
|
+
var index = prop.idx,
|
376
|
+
startValue = start[ index ],
|
377
|
+
endValue = end[ index ],
|
378
|
+
type = propTypes[ prop.type ] || {};
|
379
|
+
|
380
|
+
// if null, don't override start value
|
381
|
+
if ( endValue === null ) {
|
382
|
+
return;
|
383
|
+
}
|
384
|
+
|
385
|
+
// if null - use end
|
386
|
+
if ( startValue === null ) {
|
387
|
+
result[ index ] = endValue;
|
388
|
+
} else {
|
389
|
+
if ( type.mod ) {
|
390
|
+
if ( endValue - startValue > type.mod / 2 ) {
|
391
|
+
startValue += type.mod;
|
392
|
+
} else if ( startValue - endValue > type.mod / 2 ) {
|
393
|
+
startValue -= type.mod;
|
394
|
+
}
|
395
|
+
}
|
396
|
+
result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
|
397
|
+
}
|
398
|
+
} );
|
399
|
+
return this[ spaceName ]( result );
|
400
|
+
},
|
401
|
+
blend: function( opaque ) {
|
402
|
+
|
403
|
+
// if we are already opaque - return ourself
|
404
|
+
if ( this._rgba[ 3 ] === 1 ) {
|
405
|
+
return this;
|
406
|
+
}
|
407
|
+
|
408
|
+
var rgb = this._rgba.slice(),
|
409
|
+
a = rgb.pop(),
|
410
|
+
blend = color( opaque )._rgba;
|
411
|
+
|
412
|
+
return color( jQuery.map( rgb, function( v, i ) {
|
413
|
+
return ( 1 - a ) * blend[ i ] + a * v;
|
414
|
+
} ) );
|
415
|
+
},
|
416
|
+
toRgbaString: function() {
|
417
|
+
var prefix = "rgba(",
|
418
|
+
rgba = jQuery.map( this._rgba, function( v, i ) {
|
419
|
+
if ( v != null ) {
|
420
|
+
return v;
|
421
|
+
}
|
422
|
+
return i > 2 ? 1 : 0;
|
423
|
+
} );
|
424
|
+
|
425
|
+
if ( rgba[ 3 ] === 1 ) {
|
426
|
+
rgba.pop();
|
427
|
+
prefix = "rgb(";
|
428
|
+
}
|
429
|
+
|
430
|
+
return prefix + rgba.join() + ")";
|
431
|
+
},
|
432
|
+
toHslaString: function() {
|
433
|
+
var prefix = "hsla(",
|
434
|
+
hsla = jQuery.map( this.hsla(), function( v, i ) {
|
435
|
+
if ( v == null ) {
|
436
|
+
v = i > 2 ? 1 : 0;
|
437
|
+
}
|
438
|
+
|
439
|
+
// catch 1 and 2
|
440
|
+
if ( i && i < 3 ) {
|
441
|
+
v = Math.round( v * 100 ) + "%";
|
442
|
+
}
|
443
|
+
return v;
|
444
|
+
} );
|
445
|
+
|
446
|
+
if ( hsla[ 3 ] === 1 ) {
|
447
|
+
hsla.pop();
|
448
|
+
prefix = "hsl(";
|
449
|
+
}
|
450
|
+
return prefix + hsla.join() + ")";
|
451
|
+
},
|
452
|
+
toHexString: function( includeAlpha ) {
|
453
|
+
var rgba = this._rgba.slice(),
|
454
|
+
alpha = rgba.pop();
|
455
|
+
|
456
|
+
if ( includeAlpha ) {
|
457
|
+
rgba.push( ~~( alpha * 255 ) );
|
458
|
+
}
|
459
|
+
|
460
|
+
return "#" + jQuery.map( rgba, function( v ) {
|
461
|
+
|
462
|
+
// default to 0 when nulls exist
|
463
|
+
v = ( v || 0 ).toString( 16 );
|
464
|
+
return v.length === 1 ? "0" + v : v;
|
465
|
+
} ).join( "" );
|
466
|
+
},
|
467
|
+
toString: function() {
|
468
|
+
return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
|
469
|
+
}
|
470
|
+
} );
|
471
|
+
color.fn.parse.prototype = color.fn;
|
472
|
+
|
473
|
+
// hsla conversions adapted from:
|
474
|
+
// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
|
475
|
+
|
476
|
+
function hue2rgb( p, q, h ) {
|
477
|
+
h = ( h + 1 ) % 1;
|
478
|
+
if ( h * 6 < 1 ) {
|
479
|
+
return p + ( q - p ) * h * 6;
|
480
|
+
}
|
481
|
+
if ( h * 2 < 1 ) {
|
482
|
+
return q;
|
483
|
+
}
|
484
|
+
if ( h * 3 < 2 ) {
|
485
|
+
return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6;
|
486
|
+
}
|
487
|
+
return p;
|
488
|
+
}
|
489
|
+
|
490
|
+
spaces.hsla.to = function( rgba ) {
|
491
|
+
if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
|
492
|
+
return [ null, null, null, rgba[ 3 ] ];
|
493
|
+
}
|
494
|
+
var r = rgba[ 0 ] / 255,
|
495
|
+
g = rgba[ 1 ] / 255,
|
496
|
+
b = rgba[ 2 ] / 255,
|
497
|
+
a = rgba[ 3 ],
|
498
|
+
max = Math.max( r, g, b ),
|
499
|
+
min = Math.min( r, g, b ),
|
500
|
+
diff = max - min,
|
501
|
+
add = max + min,
|
502
|
+
l = add * 0.5,
|
503
|
+
h, s;
|
504
|
+
|
505
|
+
if ( min === max ) {
|
506
|
+
h = 0;
|
507
|
+
} else if ( r === max ) {
|
508
|
+
h = ( 60 * ( g - b ) / diff ) + 360;
|
509
|
+
} else if ( g === max ) {
|
510
|
+
h = ( 60 * ( b - r ) / diff ) + 120;
|
511
|
+
} else {
|
512
|
+
h = ( 60 * ( r - g ) / diff ) + 240;
|
513
|
+
}
|
514
|
+
|
515
|
+
// chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
|
516
|
+
// otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
|
517
|
+
if ( diff === 0 ) {
|
518
|
+
s = 0;
|
519
|
+
} else if ( l <= 0.5 ) {
|
520
|
+
s = diff / add;
|
521
|
+
} else {
|
522
|
+
s = diff / ( 2 - add );
|
523
|
+
}
|
524
|
+
return [ Math.round( h ) % 360, s, l, a == null ? 1 : a ];
|
525
|
+
};
|
526
|
+
|
527
|
+
spaces.hsla.from = function( hsla ) {
|
528
|
+
if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
|
529
|
+
return [ null, null, null, hsla[ 3 ] ];
|
530
|
+
}
|
531
|
+
var h = hsla[ 0 ] / 360,
|
532
|
+
s = hsla[ 1 ],
|
533
|
+
l = hsla[ 2 ],
|
534
|
+
a = hsla[ 3 ],
|
535
|
+
q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
|
536
|
+
p = 2 * l - q;
|
537
|
+
|
538
|
+
return [
|
539
|
+
Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
|
540
|
+
Math.round( hue2rgb( p, q, h ) * 255 ),
|
541
|
+
Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
|
542
|
+
a
|
543
|
+
];
|
544
|
+
};
|
545
|
+
|
546
|
+
|
547
|
+
each( spaces, function( spaceName, space ) {
|
548
|
+
var props = space.props,
|
549
|
+
cache = space.cache,
|
550
|
+
to = space.to,
|
551
|
+
from = space.from;
|
552
|
+
|
553
|
+
// makes rgba() and hsla()
|
554
|
+
color.fn[ spaceName ] = function( value ) {
|
555
|
+
|
556
|
+
// generate a cache for this space if it doesn't exist
|
557
|
+
if ( to && !this[ cache ] ) {
|
558
|
+
this[ cache ] = to( this._rgba );
|
559
|
+
}
|
560
|
+
if ( value === undefined ) {
|
561
|
+
return this[ cache ].slice();
|
562
|
+
}
|
563
|
+
|
564
|
+
var ret,
|
565
|
+
type = getType( value ),
|
566
|
+
arr = ( type === "array" || type === "object" ) ? value : arguments,
|
567
|
+
local = this[ cache ].slice();
|
568
|
+
|
569
|
+
each( props, function( key, prop ) {
|
570
|
+
var val = arr[ type === "object" ? key : prop.idx ];
|
571
|
+
if ( val == null ) {
|
572
|
+
val = local[ prop.idx ];
|
573
|
+
}
|
574
|
+
local[ prop.idx ] = clamp( val, prop );
|
575
|
+
} );
|
576
|
+
|
577
|
+
if ( from ) {
|
578
|
+
ret = color( from( local ) );
|
579
|
+
ret[ cache ] = local;
|
580
|
+
return ret;
|
581
|
+
} else {
|
582
|
+
return color( local );
|
583
|
+
}
|
584
|
+
};
|
585
|
+
|
586
|
+
// makes red() green() blue() alpha() hue() saturation() lightness()
|
587
|
+
each( props, function( key, prop ) {
|
588
|
+
|
589
|
+
// alpha is included in more than one space
|
590
|
+
if ( color.fn[ key ] ) {
|
591
|
+
return;
|
592
|
+
}
|
593
|
+
color.fn[ key ] = function( value ) {
|
594
|
+
var local, cur, match, fn,
|
595
|
+
vtype = getType( value );
|
596
|
+
|
597
|
+
if ( key === "alpha" ) {
|
598
|
+
fn = this._hsla ? "hsla" : "rgba";
|
599
|
+
} else {
|
600
|
+
fn = spaceName;
|
601
|
+
}
|
602
|
+
local = this[ fn ]();
|
603
|
+
cur = local[ prop.idx ];
|
604
|
+
|
605
|
+
if ( vtype === "undefined" ) {
|
606
|
+
return cur;
|
607
|
+
}
|
608
|
+
|
609
|
+
if ( vtype === "function" ) {
|
610
|
+
value = value.call( this, cur );
|
611
|
+
vtype = getType( value );
|
612
|
+
}
|
613
|
+
if ( value == null && prop.empty ) {
|
614
|
+
return this;
|
615
|
+
}
|
616
|
+
if ( vtype === "string" ) {
|
617
|
+
match = rplusequals.exec( value );
|
618
|
+
if ( match ) {
|
619
|
+
value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
|
620
|
+
}
|
621
|
+
}
|
622
|
+
local[ prop.idx ] = value;
|
623
|
+
return this[ fn ]( local );
|
624
|
+
};
|
625
|
+
} );
|
626
|
+
} );
|
627
|
+
|
628
|
+
// add cssHook and .fx.step function for each named hook.
|
629
|
+
// accept a space separated string of properties
|
630
|
+
color.hook = function( hook ) {
|
631
|
+
var hooks = hook.split( " " );
|
632
|
+
each( hooks, function( _i, hook ) {
|
633
|
+
jQuery.cssHooks[ hook ] = {
|
634
|
+
set: function( elem, value ) {
|
635
|
+
var parsed, curElem,
|
636
|
+
backgroundColor = "";
|
637
|
+
|
638
|
+
if ( value !== "transparent" && ( getType( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) {
|
639
|
+
value = color( parsed || value );
|
640
|
+
if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
|
641
|
+
curElem = hook === "backgroundColor" ? elem.parentNode : elem;
|
642
|
+
while (
|
643
|
+
( backgroundColor === "" || backgroundColor === "transparent" ) &&
|
644
|
+
curElem && curElem.style
|
645
|
+
) {
|
646
|
+
try {
|
647
|
+
backgroundColor = jQuery.css( curElem, "backgroundColor" );
|
648
|
+
curElem = curElem.parentNode;
|
649
|
+
} catch ( e ) {
|
650
|
+
}
|
651
|
+
}
|
652
|
+
|
653
|
+
value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
|
654
|
+
backgroundColor :
|
655
|
+
"_default" );
|
656
|
+
}
|
657
|
+
|
658
|
+
value = value.toRgbaString();
|
659
|
+
}
|
660
|
+
try {
|
661
|
+
elem.style[ hook ] = value;
|
662
|
+
} catch ( e ) {
|
663
|
+
|
664
|
+
// wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
|
665
|
+
}
|
666
|
+
}
|
667
|
+
};
|
668
|
+
jQuery.fx.step[ hook ] = function( fx ) {
|
669
|
+
if ( !fx.colorInit ) {
|
670
|
+
fx.start = color( fx.elem, hook );
|
671
|
+
fx.end = color( fx.end );
|
672
|
+
fx.colorInit = true;
|
673
|
+
}
|
674
|
+
jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
|
675
|
+
};
|
676
|
+
} );
|
677
|
+
|
678
|
+
};
|
679
|
+
|
680
|
+
color.hook( stepHooks );
|
681
|
+
|
682
|
+
jQuery.cssHooks.borderColor = {
|
683
|
+
expand: function( value ) {
|
684
|
+
var expanded = {};
|
685
|
+
|
686
|
+
each( [ "Top", "Right", "Bottom", "Left" ], function( _i, part ) {
|
687
|
+
expanded[ "border" + part + "Color" ] = value;
|
688
|
+
} );
|
689
|
+
return expanded;
|
690
|
+
}
|
691
|
+
};
|
692
|
+
|
693
|
+
// Basic color names only.
|
694
|
+
// Usage of any of the other color names requires adding yourself or including
|
695
|
+
// jquery.color.svg-names.js.
|
696
|
+
colors = jQuery.Color.names = {
|
697
|
+
|
698
|
+
// 4.1. Basic color keywords
|
699
|
+
aqua: "#00ffff",
|
700
|
+
black: "#000000",
|
701
|
+
blue: "#0000ff",
|
702
|
+
fuchsia: "#ff00ff",
|
703
|
+
gray: "#808080",
|
704
|
+
green: "#008000",
|
705
|
+
lime: "#00ff00",
|
706
|
+
maroon: "#800000",
|
707
|
+
navy: "#000080",
|
708
|
+
olive: "#808000",
|
709
|
+
purple: "#800080",
|
710
|
+
red: "#ff0000",
|
711
|
+
silver: "#c0c0c0",
|
712
|
+
teal: "#008080",
|
713
|
+
white: "#ffffff",
|
714
|
+
yellow: "#ffff00",
|
715
|
+
|
716
|
+
// 4.2.3. "transparent" color keyword
|
717
|
+
transparent: [ null, null, null, 0 ],
|
718
|
+
|
719
|
+
_default: "#ffffff"
|
720
|
+
};
|
721
|
+
|
722
|
+
} );
|