sonata_jqueryui_js_jquery.ui.effect_9.js 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289
  1. /*!
  2. * jQuery UI Effects 1.10.4
  3. * http://jqueryui.com
  4. *
  5. * Copyright 2014 jQuery Foundation and other contributors
  6. * Released under the MIT license.
  7. * http://jquery.org/license
  8. *
  9. * http://api.jqueryui.com/category/effects-core/
  10. */
  11. (function($, undefined) {
  12. var dataSpace = "ui-effects-";
  13. $.effects = {
  14. effect: {}
  15. };
  16. /*!
  17. * jQuery Color Animations v2.1.2
  18. * https://github.com/jquery/jquery-color
  19. *
  20. * Copyright 2013 jQuery Foundation and other contributors
  21. * Released under the MIT license.
  22. * http://jquery.org/license
  23. *
  24. * Date: Wed Jan 16 08:47:09 2013 -0600
  25. */
  26. (function( jQuery, undefined ) {
  27. var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
  28. // plusequals test for += 100 -= 100
  29. rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
  30. // a set of RE's that can match strings and generate color tuples.
  31. stringParsers = [{
  32. re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  33. parse: function( execResult ) {
  34. return [
  35. execResult[ 1 ],
  36. execResult[ 2 ],
  37. execResult[ 3 ],
  38. execResult[ 4 ]
  39. ];
  40. }
  41. }, {
  42. re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  43. parse: function( execResult ) {
  44. return [
  45. execResult[ 1 ] * 2.55,
  46. execResult[ 2 ] * 2.55,
  47. execResult[ 3 ] * 2.55,
  48. execResult[ 4 ]
  49. ];
  50. }
  51. }, {
  52. // this regex ignores A-F because it's compared against an already lowercased string
  53. re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
  54. parse: function( execResult ) {
  55. return [
  56. parseInt( execResult[ 1 ], 16 ),
  57. parseInt( execResult[ 2 ], 16 ),
  58. parseInt( execResult[ 3 ], 16 )
  59. ];
  60. }
  61. }, {
  62. // this regex ignores A-F because it's compared against an already lowercased string
  63. re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
  64. parse: function( execResult ) {
  65. return [
  66. parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
  67. parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
  68. parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
  69. ];
  70. }
  71. }, {
  72. re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  73. space: "hsla",
  74. parse: function( execResult ) {
  75. return [
  76. execResult[ 1 ],
  77. execResult[ 2 ] / 100,
  78. execResult[ 3 ] / 100,
  79. execResult[ 4 ]
  80. ];
  81. }
  82. }],
  83. // jQuery.Color( )
  84. color = jQuery.Color = function( color, green, blue, alpha ) {
  85. return new jQuery.Color.fn.parse( color, green, blue, alpha );
  86. },
  87. spaces = {
  88. rgba: {
  89. props: {
  90. red: {
  91. idx: 0,
  92. type: "byte"
  93. },
  94. green: {
  95. idx: 1,
  96. type: "byte"
  97. },
  98. blue: {
  99. idx: 2,
  100. type: "byte"
  101. }
  102. }
  103. },
  104. hsla: {
  105. props: {
  106. hue: {
  107. idx: 0,
  108. type: "degrees"
  109. },
  110. saturation: {
  111. idx: 1,
  112. type: "percent"
  113. },
  114. lightness: {
  115. idx: 2,
  116. type: "percent"
  117. }
  118. }
  119. }
  120. },
  121. propTypes = {
  122. "byte": {
  123. floor: true,
  124. max: 255
  125. },
  126. "percent": {
  127. max: 1
  128. },
  129. "degrees": {
  130. mod: 360,
  131. floor: true
  132. }
  133. },
  134. support = color.support = {},
  135. // element for support tests
  136. supportElem = jQuery( "<p>" )[ 0 ],
  137. // colors = jQuery.Color.names
  138. colors,
  139. // local aliases of functions called often
  140. each = jQuery.each;
  141. // determine rgba support immediately
  142. supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
  143. support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
  144. // define cache name and alpha properties
  145. // for rgba and hsla spaces
  146. each( spaces, function( spaceName, space ) {
  147. space.cache = "_" + spaceName;
  148. space.props.alpha = {
  149. idx: 3,
  150. type: "percent",
  151. def: 1
  152. };
  153. });
  154. function clamp( value, prop, allowEmpty ) {
  155. var type = propTypes[ prop.type ] || {};
  156. if ( value == null ) {
  157. return (allowEmpty || !prop.def) ? null : prop.def;
  158. }
  159. // ~~ is an short way of doing floor for positive numbers
  160. value = type.floor ? ~~value : parseFloat( value );
  161. // IE will pass in empty strings as value for alpha,
  162. // which will hit this case
  163. if ( isNaN( value ) ) {
  164. return prop.def;
  165. }
  166. if ( type.mod ) {
  167. // we add mod before modding to make sure that negatives values
  168. // get converted properly: -10 -> 350
  169. return (value + type.mod) % type.mod;
  170. }
  171. // for now all property types without mod have min and max
  172. return 0 > value ? 0 : type.max < value ? type.max : value;
  173. }
  174. function stringParse( string ) {
  175. var inst = color(),
  176. rgba = inst._rgba = [];
  177. string = string.toLowerCase();
  178. each( stringParsers, function( i, parser ) {
  179. var parsed,
  180. match = parser.re.exec( string ),
  181. values = match && parser.parse( match ),
  182. spaceName = parser.space || "rgba";
  183. if ( values ) {
  184. parsed = inst[ spaceName ]( values );
  185. // if this was an rgba parse the assignment might happen twice
  186. // oh well....
  187. inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
  188. rgba = inst._rgba = parsed._rgba;
  189. // exit each( stringParsers ) here because we matched
  190. return false;
  191. }
  192. });
  193. // Found a stringParser that handled it
  194. if ( rgba.length ) {
  195. // if this came from a parsed string, force "transparent" when alpha is 0
  196. // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
  197. if ( rgba.join() === "0,0,0,0" ) {
  198. jQuery.extend( rgba, colors.transparent );
  199. }
  200. return inst;
  201. }
  202. // named colors
  203. return colors[ string ];
  204. }
  205. color.fn = jQuery.extend( color.prototype, {
  206. parse: function( red, green, blue, alpha ) {
  207. if ( red === undefined ) {
  208. this._rgba = [ null, null, null, null ];
  209. return this;
  210. }
  211. if ( red.jquery || red.nodeType ) {
  212. red = jQuery( red ).css( green );
  213. green = undefined;
  214. }
  215. var inst = this,
  216. type = jQuery.type( red ),
  217. rgba = this._rgba = [];
  218. // more than 1 argument specified - assume ( red, green, blue, alpha )
  219. if ( green !== undefined ) {
  220. red = [ red, green, blue, alpha ];
  221. type = "array";
  222. }
  223. if ( type === "string" ) {
  224. return this.parse( stringParse( red ) || colors._default );
  225. }
  226. if ( type === "array" ) {
  227. each( spaces.rgba.props, function( key, prop ) {
  228. rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
  229. });
  230. return this;
  231. }
  232. if ( type === "object" ) {
  233. if ( red instanceof color ) {
  234. each( spaces, function( spaceName, space ) {
  235. if ( red[ space.cache ] ) {
  236. inst[ space.cache ] = red[ space.cache ].slice();
  237. }
  238. });
  239. } else {
  240. each( spaces, function( spaceName, space ) {
  241. var cache = space.cache;
  242. each( space.props, function( key, prop ) {
  243. // if the cache doesn't exist, and we know how to convert
  244. if ( !inst[ cache ] && space.to ) {
  245. // if the value was null, we don't need to copy it
  246. // if the key was alpha, we don't need to copy it either
  247. if ( key === "alpha" || red[ key ] == null ) {
  248. return;
  249. }
  250. inst[ cache ] = space.to( inst._rgba );
  251. }
  252. // this is the only case where we allow nulls for ALL properties.
  253. // call clamp with alwaysAllowEmpty
  254. inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
  255. });
  256. // everything defined but alpha?
  257. if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
  258. // use the default of 1
  259. inst[ cache ][ 3 ] = 1;
  260. if ( space.from ) {
  261. inst._rgba = space.from( inst[ cache ] );
  262. }
  263. }
  264. });
  265. }
  266. return this;
  267. }
  268. },
  269. is: function( compare ) {
  270. var is = color( compare ),
  271. same = true,
  272. inst = this;
  273. each( spaces, function( _, space ) {
  274. var localCache,
  275. isCache = is[ space.cache ];
  276. if (isCache) {
  277. localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
  278. each( space.props, function( _, prop ) {
  279. if ( isCache[ prop.idx ] != null ) {
  280. same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
  281. return same;
  282. }
  283. });
  284. }
  285. return same;
  286. });
  287. return same;
  288. },
  289. _space: function() {
  290. var used = [],
  291. inst = this;
  292. each( spaces, function( spaceName, space ) {
  293. if ( inst[ space.cache ] ) {
  294. used.push( spaceName );
  295. }
  296. });
  297. return used.pop();
  298. },
  299. transition: function( other, distance ) {
  300. var end = color( other ),
  301. spaceName = end._space(),
  302. space = spaces[ spaceName ],
  303. startColor = this.alpha() === 0 ? color( "transparent" ) : this,
  304. start = startColor[ space.cache ] || space.to( startColor._rgba ),
  305. result = start.slice();
  306. end = end[ space.cache ];
  307. each( space.props, function( key, prop ) {
  308. var index = prop.idx,
  309. startValue = start[ index ],
  310. endValue = end[ index ],
  311. type = propTypes[ prop.type ] || {};
  312. // if null, don't override start value
  313. if ( endValue === null ) {
  314. return;
  315. }
  316. // if null - use end
  317. if ( startValue === null ) {
  318. result[ index ] = endValue;
  319. } else {
  320. if ( type.mod ) {
  321. if ( endValue - startValue > type.mod / 2 ) {
  322. startValue += type.mod;
  323. } else if ( startValue - endValue > type.mod / 2 ) {
  324. startValue -= type.mod;
  325. }
  326. }
  327. result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
  328. }
  329. });
  330. return this[ spaceName ]( result );
  331. },
  332. blend: function( opaque ) {
  333. // if we are already opaque - return ourself
  334. if ( this._rgba[ 3 ] === 1 ) {
  335. return this;
  336. }
  337. var rgb = this._rgba.slice(),
  338. a = rgb.pop(),
  339. blend = color( opaque )._rgba;
  340. return color( jQuery.map( rgb, function( v, i ) {
  341. return ( 1 - a ) * blend[ i ] + a * v;
  342. }));
  343. },
  344. toRgbaString: function() {
  345. var prefix = "rgba(",
  346. rgba = jQuery.map( this._rgba, function( v, i ) {
  347. return v == null ? ( i > 2 ? 1 : 0 ) : v;
  348. });
  349. if ( rgba[ 3 ] === 1 ) {
  350. rgba.pop();
  351. prefix = "rgb(";
  352. }
  353. return prefix + rgba.join() + ")";
  354. },
  355. toHslaString: function() {
  356. var prefix = "hsla(",
  357. hsla = jQuery.map( this.hsla(), function( v, i ) {
  358. if ( v == null ) {
  359. v = i > 2 ? 1 : 0;
  360. }
  361. // catch 1 and 2
  362. if ( i && i < 3 ) {
  363. v = Math.round( v * 100 ) + "%";
  364. }
  365. return v;
  366. });
  367. if ( hsla[ 3 ] === 1 ) {
  368. hsla.pop();
  369. prefix = "hsl(";
  370. }
  371. return prefix + hsla.join() + ")";
  372. },
  373. toHexString: function( includeAlpha ) {
  374. var rgba = this._rgba.slice(),
  375. alpha = rgba.pop();
  376. if ( includeAlpha ) {
  377. rgba.push( ~~( alpha * 255 ) );
  378. }
  379. return "#" + jQuery.map( rgba, function( v ) {
  380. // default to 0 when nulls exist
  381. v = ( v || 0 ).toString( 16 );
  382. return v.length === 1 ? "0" + v : v;
  383. }).join("");
  384. },
  385. toString: function() {
  386. return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
  387. }
  388. });
  389. color.fn.parse.prototype = color.fn;
  390. // hsla conversions adapted from:
  391. // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
  392. function hue2rgb( p, q, h ) {
  393. h = ( h + 1 ) % 1;
  394. if ( h * 6 < 1 ) {
  395. return p + (q - p) * h * 6;
  396. }
  397. if ( h * 2 < 1) {
  398. return q;
  399. }
  400. if ( h * 3 < 2 ) {
  401. return p + (q - p) * ((2/3) - h) * 6;
  402. }
  403. return p;
  404. }
  405. spaces.hsla.to = function ( rgba ) {
  406. if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
  407. return [ null, null, null, rgba[ 3 ] ];
  408. }
  409. var r = rgba[ 0 ] / 255,
  410. g = rgba[ 1 ] / 255,
  411. b = rgba[ 2 ] / 255,
  412. a = rgba[ 3 ],
  413. max = Math.max( r, g, b ),
  414. min = Math.min( r, g, b ),
  415. diff = max - min,
  416. add = max + min,
  417. l = add * 0.5,
  418. h, s;
  419. if ( min === max ) {
  420. h = 0;
  421. } else if ( r === max ) {
  422. h = ( 60 * ( g - b ) / diff ) + 360;
  423. } else if ( g === max ) {
  424. h = ( 60 * ( b - r ) / diff ) + 120;
  425. } else {
  426. h = ( 60 * ( r - g ) / diff ) + 240;
  427. }
  428. // chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
  429. // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
  430. if ( diff === 0 ) {
  431. s = 0;
  432. } else if ( l <= 0.5 ) {
  433. s = diff / add;
  434. } else {
  435. s = diff / ( 2 - add );
  436. }
  437. return [ Math.round(h) % 360, s, l, a == null ? 1 : a ];
  438. };
  439. spaces.hsla.from = function ( hsla ) {
  440. if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
  441. return [ null, null, null, hsla[ 3 ] ];
  442. }
  443. var h = hsla[ 0 ] / 360,
  444. s = hsla[ 1 ],
  445. l = hsla[ 2 ],
  446. a = hsla[ 3 ],
  447. q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
  448. p = 2 * l - q;
  449. return [
  450. Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
  451. Math.round( hue2rgb( p, q, h ) * 255 ),
  452. Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
  453. a
  454. ];
  455. };
  456. each( spaces, function( spaceName, space ) {
  457. var props = space.props,
  458. cache = space.cache,
  459. to = space.to,
  460. from = space.from;
  461. // makes rgba() and hsla()
  462. color.fn[ spaceName ] = function( value ) {
  463. // generate a cache for this space if it doesn't exist
  464. if ( to && !this[ cache ] ) {
  465. this[ cache ] = to( this._rgba );
  466. }
  467. if ( value === undefined ) {
  468. return this[ cache ].slice();
  469. }
  470. var ret,
  471. type = jQuery.type( value ),
  472. arr = ( type === "array" || type === "object" ) ? value : arguments,
  473. local = this[ cache ].slice();
  474. each( props, function( key, prop ) {
  475. var val = arr[ type === "object" ? key : prop.idx ];
  476. if ( val == null ) {
  477. val = local[ prop.idx ];
  478. }
  479. local[ prop.idx ] = clamp( val, prop );
  480. });
  481. if ( from ) {
  482. ret = color( from( local ) );
  483. ret[ cache ] = local;
  484. return ret;
  485. } else {
  486. return color( local );
  487. }
  488. };
  489. // makes red() green() blue() alpha() hue() saturation() lightness()
  490. each( props, function( key, prop ) {
  491. // alpha is included in more than one space
  492. if ( color.fn[ key ] ) {
  493. return;
  494. }
  495. color.fn[ key ] = function( value ) {
  496. var vtype = jQuery.type( value ),
  497. fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
  498. local = this[ fn ](),
  499. cur = local[ prop.idx ],
  500. match;
  501. if ( vtype === "undefined" ) {
  502. return cur;
  503. }
  504. if ( vtype === "function" ) {
  505. value = value.call( this, cur );
  506. vtype = jQuery.type( value );
  507. }
  508. if ( value == null && prop.empty ) {
  509. return this;
  510. }
  511. if ( vtype === "string" ) {
  512. match = rplusequals.exec( value );
  513. if ( match ) {
  514. value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
  515. }
  516. }
  517. local[ prop.idx ] = value;
  518. return this[ fn ]( local );
  519. };
  520. });
  521. });
  522. // add cssHook and .fx.step function for each named hook.
  523. // accept a space separated string of properties
  524. color.hook = function( hook ) {
  525. var hooks = hook.split( " " );
  526. each( hooks, function( i, hook ) {
  527. jQuery.cssHooks[ hook ] = {
  528. set: function( elem, value ) {
  529. var parsed, curElem,
  530. backgroundColor = "";
  531. if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) {
  532. value = color( parsed || value );
  533. if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
  534. curElem = hook === "backgroundColor" ? elem.parentNode : elem;
  535. while (
  536. (backgroundColor === "" || backgroundColor === "transparent") &&
  537. curElem && curElem.style
  538. ) {
  539. try {
  540. backgroundColor = jQuery.css( curElem, "backgroundColor" );
  541. curElem = curElem.parentNode;
  542. } catch ( e ) {
  543. }
  544. }
  545. value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
  546. backgroundColor :
  547. "_default" );
  548. }
  549. value = value.toRgbaString();
  550. }
  551. try {
  552. elem.style[ hook ] = value;
  553. } catch( e ) {
  554. // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
  555. }
  556. }
  557. };
  558. jQuery.fx.step[ hook ] = function( fx ) {
  559. if ( !fx.colorInit ) {
  560. fx.start = color( fx.elem, hook );
  561. fx.end = color( fx.end );
  562. fx.colorInit = true;
  563. }
  564. jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
  565. };
  566. });
  567. };
  568. color.hook( stepHooks );
  569. jQuery.cssHooks.borderColor = {
  570. expand: function( value ) {
  571. var expanded = {};
  572. each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
  573. expanded[ "border" + part + "Color" ] = value;
  574. });
  575. return expanded;
  576. }
  577. };
  578. // Basic color names only.
  579. // Usage of any of the other color names requires adding yourself or including
  580. // jquery.color.svg-names.js.
  581. colors = jQuery.Color.names = {
  582. // 4.1. Basic color keywords
  583. aqua: "#00ffff",
  584. black: "#000000",
  585. blue: "#0000ff",
  586. fuchsia: "#ff00ff",
  587. gray: "#808080",
  588. green: "#008000",
  589. lime: "#00ff00",
  590. maroon: "#800000",
  591. navy: "#000080",
  592. olive: "#808000",
  593. purple: "#800080",
  594. red: "#ff0000",
  595. silver: "#c0c0c0",
  596. teal: "#008080",
  597. white: "#ffffff",
  598. yellow: "#ffff00",
  599. // 4.2.3. "transparent" color keyword
  600. transparent: [ null, null, null, 0 ],
  601. _default: "#ffffff"
  602. };
  603. })( jQuery );
  604. /******************************************************************************/
  605. /****************************** CLASS ANIMATIONS ******************************/
  606. /******************************************************************************/
  607. (function() {
  608. var classAnimationActions = [ "add", "remove", "toggle" ],
  609. shorthandStyles = {
  610. border: 1,
  611. borderBottom: 1,
  612. borderColor: 1,
  613. borderLeft: 1,
  614. borderRight: 1,
  615. borderTop: 1,
  616. borderWidth: 1,
  617. margin: 1,
  618. padding: 1
  619. };
  620. $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) {
  621. $.fx.step[ prop ] = function( fx ) {
  622. if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
  623. jQuery.style( fx.elem, prop, fx.end );
  624. fx.setAttr = true;
  625. }
  626. };
  627. });
  628. function getElementStyles( elem ) {
  629. var key, len,
  630. style = elem.ownerDocument.defaultView ?
  631. elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
  632. elem.currentStyle,
  633. styles = {};
  634. if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
  635. len = style.length;
  636. while ( len-- ) {
  637. key = style[ len ];
  638. if ( typeof style[ key ] === "string" ) {
  639. styles[ $.camelCase( key ) ] = style[ key ];
  640. }
  641. }
  642. // support: Opera, IE <9
  643. } else {
  644. for ( key in style ) {
  645. if ( typeof style[ key ] === "string" ) {
  646. styles[ key ] = style[ key ];
  647. }
  648. }
  649. }
  650. return styles;
  651. }
  652. function styleDifference( oldStyle, newStyle ) {
  653. var diff = {},
  654. name, value;
  655. for ( name in newStyle ) {
  656. value = newStyle[ name ];
  657. if ( oldStyle[ name ] !== value ) {
  658. if ( !shorthandStyles[ name ] ) {
  659. if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
  660. diff[ name ] = value;
  661. }
  662. }
  663. }
  664. }
  665. return diff;
  666. }
  667. // support: jQuery <1.8
  668. if ( !$.fn.addBack ) {
  669. $.fn.addBack = function( selector ) {
  670. return this.add( selector == null ?
  671. this.prevObject : this.prevObject.filter( selector )
  672. );
  673. };
  674. }
  675. $.effects.animateClass = function( value, duration, easing, callback ) {
  676. var o = $.speed( duration, easing, callback );
  677. return this.queue( function() {
  678. var animated = $( this ),
  679. baseClass = animated.attr( "class" ) || "",
  680. applyClassChange,
  681. allAnimations = o.children ? animated.find( "*" ).addBack() : animated;
  682. // map the animated objects to store the original styles.
  683. allAnimations = allAnimations.map(function() {
  684. var el = $( this );
  685. return {
  686. el: el,
  687. start: getElementStyles( this )
  688. };
  689. });
  690. // apply class change
  691. applyClassChange = function() {
  692. $.each( classAnimationActions, function(i, action) {
  693. if ( value[ action ] ) {
  694. animated[ action + "Class" ]( value[ action ] );
  695. }
  696. });
  697. };
  698. applyClassChange();
  699. // map all animated objects again - calculate new styles and diff
  700. allAnimations = allAnimations.map(function() {
  701. this.end = getElementStyles( this.el[ 0 ] );
  702. this.diff = styleDifference( this.start, this.end );
  703. return this;
  704. });
  705. // apply original class
  706. animated.attr( "class", baseClass );
  707. // map all animated objects again - this time collecting a promise
  708. allAnimations = allAnimations.map(function() {
  709. var styleInfo = this,
  710. dfd = $.Deferred(),
  711. opts = $.extend({}, o, {
  712. queue: false,
  713. complete: function() {
  714. dfd.resolve( styleInfo );
  715. }
  716. });
  717. this.el.animate( this.diff, opts );
  718. return dfd.promise();
  719. });
  720. // once all animations have completed:
  721. $.when.apply( $, allAnimations.get() ).done(function() {
  722. // set the final class
  723. applyClassChange();
  724. // for each animated element,
  725. // clear all css properties that were animated
  726. $.each( arguments, function() {
  727. var el = this.el;
  728. $.each( this.diff, function(key) {
  729. el.css( key, "" );
  730. });
  731. });
  732. // this is guarnteed to be there if you use jQuery.speed()
  733. // it also handles dequeuing the next anim...
  734. o.complete.call( animated[ 0 ] );
  735. });
  736. });
  737. };
  738. $.fn.extend({
  739. addClass: (function( orig ) {
  740. return function( classNames, speed, easing, callback ) {
  741. return speed ?
  742. $.effects.animateClass.call( this,
  743. { add: classNames }, speed, easing, callback ) :
  744. orig.apply( this, arguments );
  745. };
  746. })( $.fn.addClass ),
  747. removeClass: (function( orig ) {
  748. return function( classNames, speed, easing, callback ) {
  749. return arguments.length > 1 ?
  750. $.effects.animateClass.call( this,
  751. { remove: classNames }, speed, easing, callback ) :
  752. orig.apply( this, arguments );
  753. };
  754. })( $.fn.removeClass ),
  755. toggleClass: (function( orig ) {
  756. return function( classNames, force, speed, easing, callback ) {
  757. if ( typeof force === "boolean" || force === undefined ) {
  758. if ( !speed ) {
  759. // without speed parameter
  760. return orig.apply( this, arguments );
  761. } else {
  762. return $.effects.animateClass.call( this,
  763. (force ? { add: classNames } : { remove: classNames }),
  764. speed, easing, callback );
  765. }
  766. } else {
  767. // without force parameter
  768. return $.effects.animateClass.call( this,
  769. { toggle: classNames }, force, speed, easing );
  770. }
  771. };
  772. })( $.fn.toggleClass ),
  773. switchClass: function( remove, add, speed, easing, callback) {
  774. return $.effects.animateClass.call( this, {
  775. add: add,
  776. remove: remove
  777. }, speed, easing, callback );
  778. }
  779. });
  780. })();
  781. /******************************************************************************/
  782. /*********************************** EFFECTS **********************************/
  783. /******************************************************************************/
  784. (function() {
  785. $.extend( $.effects, {
  786. version: "1.10.4",
  787. // Saves a set of properties in a data storage
  788. save: function( element, set ) {
  789. for( var i=0; i < set.length; i++ ) {
  790. if ( set[ i ] !== null ) {
  791. element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
  792. }
  793. }
  794. },
  795. // Restores a set of previously saved properties from a data storage
  796. restore: function( element, set ) {
  797. var val, i;
  798. for( i=0; i < set.length; i++ ) {
  799. if ( set[ i ] !== null ) {
  800. val = element.data( dataSpace + set[ i ] );
  801. // support: jQuery 1.6.2
  802. // http://bugs.jquery.com/ticket/9917
  803. // jQuery 1.6.2 incorrectly returns undefined for any falsy value.
  804. // We can't differentiate between "" and 0 here, so we just assume
  805. // empty string since it's likely to be a more common value...
  806. if ( val === undefined ) {
  807. val = "";
  808. }
  809. element.css( set[ i ], val );
  810. }
  811. }
  812. },
  813. setMode: function( el, mode ) {
  814. if (mode === "toggle") {
  815. mode = el.is( ":hidden" ) ? "show" : "hide";
  816. }
  817. return mode;
  818. },
  819. // Translates a [top,left] array into a baseline value
  820. // this should be a little more flexible in the future to handle a string & hash
  821. getBaseline: function( origin, original ) {
  822. var y, x;
  823. switch ( origin[ 0 ] ) {
  824. case "top": y = 0; break;
  825. case "middle": y = 0.5; break;
  826. case "bottom": y = 1; break;
  827. default: y = origin[ 0 ] / original.height;
  828. }
  829. switch ( origin[ 1 ] ) {
  830. case "left": x = 0; break;
  831. case "center": x = 0.5; break;
  832. case "right": x = 1; break;
  833. default: x = origin[ 1 ] / original.width;
  834. }
  835. return {
  836. x: x,
  837. y: y
  838. };
  839. },
  840. // Wraps the element around a wrapper that copies position properties
  841. createWrapper: function( element ) {
  842. // if the element is already wrapped, return it
  843. if ( element.parent().is( ".ui-effects-wrapper" )) {
  844. return element.parent();
  845. }
  846. // wrap the element
  847. var props = {
  848. width: element.outerWidth(true),
  849. height: element.outerHeight(true),
  850. "float": element.css( "float" )
  851. },
  852. wrapper = $( "<div></div>" )
  853. .addClass( "ui-effects-wrapper" )
  854. .css({
  855. fontSize: "100%",
  856. background: "transparent",
  857. border: "none",
  858. margin: 0,
  859. padding: 0
  860. }),
  861. // Store the size in case width/height are defined in % - Fixes #5245
  862. size = {
  863. width: element.width(),
  864. height: element.height()
  865. },
  866. active = document.activeElement;
  867. // support: Firefox
  868. // Firefox incorrectly exposes anonymous content
  869. // https://bugzilla.mozilla.org/show_bug.cgi?id=561664
  870. try {
  871. active.id;
  872. } catch( e ) {
  873. active = document.body;
  874. }
  875. element.wrap( wrapper );
  876. // Fixes #7595 - Elements lose focus when wrapped.
  877. if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
  878. $( active ).focus();
  879. }
  880. wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element
  881. // transfer positioning properties to the wrapper
  882. if ( element.css( "position" ) === "static" ) {
  883. wrapper.css({ position: "relative" });
  884. element.css({ position: "relative" });
  885. } else {
  886. $.extend( props, {
  887. position: element.css( "position" ),
  888. zIndex: element.css( "z-index" )
  889. });
  890. $.each([ "top", "left", "bottom", "right" ], function(i, pos) {
  891. props[ pos ] = element.css( pos );
  892. if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
  893. props[ pos ] = "auto";
  894. }
  895. });
  896. element.css({
  897. position: "relative",
  898. top: 0,
  899. left: 0,
  900. right: "auto",
  901. bottom: "auto"
  902. });
  903. }
  904. element.css(size);
  905. return wrapper.css( props ).show();
  906. },
  907. removeWrapper: function( element ) {
  908. var active = document.activeElement;
  909. if ( element.parent().is( ".ui-effects-wrapper" ) ) {
  910. element.parent().replaceWith( element );
  911. // Fixes #7595 - Elements lose focus when wrapped.
  912. if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
  913. $( active ).focus();
  914. }
  915. }
  916. return element;
  917. },
  918. setTransition: function( element, list, factor, value ) {
  919. value = value || {};
  920. $.each( list, function( i, x ) {
  921. var unit = element.cssUnit( x );
  922. if ( unit[ 0 ] > 0 ) {
  923. value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
  924. }
  925. });
  926. return value;
  927. }
  928. });
  929. // return an effect options object for the given parameters:
  930. function _normalizeArguments( effect, options, speed, callback ) {
  931. // allow passing all options as the first parameter
  932. if ( $.isPlainObject( effect ) ) {
  933. options = effect;
  934. effect = effect.effect;
  935. }
  936. // convert to an object
  937. effect = { effect: effect };
  938. // catch (effect, null, ...)
  939. if ( options == null ) {
  940. options = {};
  941. }
  942. // catch (effect, callback)
  943. if ( $.isFunction( options ) ) {
  944. callback = options;
  945. speed = null;
  946. options = {};
  947. }
  948. // catch (effect, speed, ?)
  949. if ( typeof options === "number" || $.fx.speeds[ options ] ) {
  950. callback = speed;
  951. speed = options;
  952. options = {};
  953. }
  954. // catch (effect, options, callback)
  955. if ( $.isFunction( speed ) ) {
  956. callback = speed;
  957. speed = null;
  958. }
  959. // add options to effect
  960. if ( options ) {
  961. $.extend( effect, options );
  962. }
  963. speed = speed || options.duration;
  964. effect.duration = $.fx.off ? 0 :
  965. typeof speed === "number" ? speed :
  966. speed in $.fx.speeds ? $.fx.speeds[ speed ] :
  967. $.fx.speeds._default;
  968. effect.complete = callback || options.complete;
  969. return effect;
  970. }
  971. function standardAnimationOption( option ) {
  972. // Valid standard speeds (nothing, number, named speed)
  973. if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) {
  974. return true;
  975. }
  976. // Invalid strings - treat as "normal" speed
  977. if ( typeof option === "string" && !$.effects.effect[ option ] ) {
  978. return true;
  979. }
  980. // Complete callback
  981. if ( $.isFunction( option ) ) {
  982. return true;
  983. }
  984. // Options hash (but not naming an effect)
  985. if ( typeof option === "object" && !option.effect ) {
  986. return true;
  987. }
  988. // Didn't match any standard API
  989. return false;
  990. }
  991. $.fn.extend({
  992. effect: function( /* effect, options, speed, callback */ ) {
  993. var args = _normalizeArguments.apply( this, arguments ),
  994. mode = args.mode,
  995. queue = args.queue,
  996. effectMethod = $.effects.effect[ args.effect ];
  997. if ( $.fx.off || !effectMethod ) {
  998. // delegate to the original method (e.g., .show()) if possible
  999. if ( mode ) {
  1000. return this[ mode ]( args.duration, args.complete );
  1001. } else {
  1002. return this.each( function() {
  1003. if ( args.complete ) {
  1004. args.complete.call( this );
  1005. }
  1006. });
  1007. }
  1008. }
  1009. function run( next ) {
  1010. var elem = $( this ),
  1011. complete = args.complete,
  1012. mode = args.mode;
  1013. function done() {
  1014. if ( $.isFunction( complete ) ) {
  1015. complete.call( elem[0] );
  1016. }
  1017. if ( $.isFunction( next ) ) {
  1018. next();
  1019. }
  1020. }
  1021. // If the element already has the correct final state, delegate to
  1022. // the core methods so the internal tracking of "olddisplay" works.
  1023. if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
  1024. elem[ mode ]();
  1025. done();
  1026. } else {
  1027. effectMethod.call( elem[0], args, done );
  1028. }
  1029. }
  1030. return queue === false ? this.each( run ) : this.queue( queue || "fx", run );
  1031. },
  1032. show: (function( orig ) {
  1033. return function( option ) {
  1034. if ( standardAnimationOption( option ) ) {
  1035. return orig.apply( this, arguments );
  1036. } else {
  1037. var args = _normalizeArguments.apply( this, arguments );
  1038. args.mode = "show";
  1039. return this.effect.call( this, args );
  1040. }
  1041. };
  1042. })( $.fn.show ),
  1043. hide: (function( orig ) {
  1044. return function( option ) {
  1045. if ( standardAnimationOption( option ) ) {
  1046. return orig.apply( this, arguments );
  1047. } else {
  1048. var args = _normalizeArguments.apply( this, arguments );
  1049. args.mode = "hide";
  1050. return this.effect.call( this, args );
  1051. }
  1052. };
  1053. })( $.fn.hide ),
  1054. toggle: (function( orig ) {
  1055. return function( option ) {
  1056. if ( standardAnimationOption( option ) || typeof option === "boolean" ) {
  1057. return orig.apply( this, arguments );
  1058. } else {
  1059. var args = _normalizeArguments.apply( this, arguments );
  1060. args.mode = "toggle";
  1061. return this.effect.call( this, args );
  1062. }
  1063. };
  1064. })( $.fn.toggle ),
  1065. // helper functions
  1066. cssUnit: function(key) {
  1067. var style = this.css( key ),
  1068. val = [];
  1069. $.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
  1070. if ( style.indexOf( unit ) > 0 ) {
  1071. val = [ parseFloat( style ), unit ];
  1072. }
  1073. });
  1074. return val;
  1075. }
  1076. });
  1077. })();
  1078. /******************************************************************************/
  1079. /*********************************** EASING ***********************************/
  1080. /******************************************************************************/
  1081. (function() {
  1082. // based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
  1083. var baseEasings = {};
  1084. $.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
  1085. baseEasings[ name ] = function( p ) {
  1086. return Math.pow( p, i + 2 );
  1087. };
  1088. });
  1089. $.extend( baseEasings, {
  1090. Sine: function ( p ) {
  1091. return 1 - Math.cos( p * Math.PI / 2 );
  1092. },
  1093. Circ: function ( p ) {
  1094. return 1 - Math.sqrt( 1 - p * p );
  1095. },
  1096. Elastic: function( p ) {
  1097. return p === 0 || p === 1 ? p :
  1098. -Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 );
  1099. },
  1100. Back: function( p ) {
  1101. return p * p * ( 3 * p - 2 );
  1102. },
  1103. Bounce: function ( p ) {
  1104. var pow2,
  1105. bounce = 4;
  1106. while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
  1107. return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
  1108. }
  1109. });
  1110. $.each( baseEasings, function( name, easeIn ) {
  1111. $.easing[ "easeIn" + name ] = easeIn;
  1112. $.easing[ "easeOut" + name ] = function( p ) {
  1113. return 1 - easeIn( 1 - p );
  1114. };
  1115. $.easing[ "easeInOut" + name ] = function( p ) {
  1116. return p < 0.5 ?
  1117. easeIn( p * 2 ) / 2 :
  1118. 1 - easeIn( p * -2 + 2 ) / 2;
  1119. };
  1120. });
  1121. })();
  1122. })(jQuery);