979 _mouseStop: function(/* event */) {}, |
978 _mouseStop: function(/* event */) {}, |
980 _mouseCapture: function(/* event */) { return true; } |
979 _mouseCapture: function(/* event */) { return true; } |
981 }); |
980 }); |
982 |
981 |
983 })(jQuery); |
982 })(jQuery); |
984 |
|
985 (function( $, undefined ) { |
983 (function( $, undefined ) { |
986 |
984 |
|
985 $.ui = $.ui || {}; |
|
986 |
|
987 var cachedScrollbarWidth, |
|
988 max = Math.max, |
|
989 abs = Math.abs, |
|
990 round = Math.round, |
|
991 rhorizontal = /left|center|right/, |
|
992 rvertical = /top|center|bottom/, |
|
993 roffset = /[\+\-]\d+(\.[\d]+)?%?/, |
|
994 rposition = /^\w+/, |
|
995 rpercent = /%$/, |
|
996 _position = $.fn.position; |
|
997 |
|
998 function getOffsets( offsets, width, height ) { |
|
999 return [ |
|
1000 parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ), |
|
1001 parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 ) |
|
1002 ]; |
|
1003 } |
|
1004 |
|
1005 function parseCss( element, property ) { |
|
1006 return parseInt( $.css( element, property ), 10 ) || 0; |
|
1007 } |
|
1008 |
|
1009 function getDimensions( elem ) { |
|
1010 var raw = elem[0]; |
|
1011 if ( raw.nodeType === 9 ) { |
|
1012 return { |
|
1013 width: elem.width(), |
|
1014 height: elem.height(), |
|
1015 offset: { top: 0, left: 0 } |
|
1016 }; |
|
1017 } |
|
1018 if ( $.isWindow( raw ) ) { |
|
1019 return { |
|
1020 width: elem.width(), |
|
1021 height: elem.height(), |
|
1022 offset: { top: elem.scrollTop(), left: elem.scrollLeft() } |
|
1023 }; |
|
1024 } |
|
1025 if ( raw.preventDefault ) { |
|
1026 return { |
|
1027 width: 0, |
|
1028 height: 0, |
|
1029 offset: { top: raw.pageY, left: raw.pageX } |
|
1030 }; |
|
1031 } |
|
1032 return { |
|
1033 width: elem.outerWidth(), |
|
1034 height: elem.outerHeight(), |
|
1035 offset: elem.offset() |
|
1036 }; |
|
1037 } |
|
1038 |
|
1039 $.position = { |
|
1040 scrollbarWidth: function() { |
|
1041 if ( cachedScrollbarWidth !== undefined ) { |
|
1042 return cachedScrollbarWidth; |
|
1043 } |
|
1044 var w1, w2, |
|
1045 div = $( "<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ), |
|
1046 innerDiv = div.children()[0]; |
|
1047 |
|
1048 $( "body" ).append( div ); |
|
1049 w1 = innerDiv.offsetWidth; |
|
1050 div.css( "overflow", "scroll" ); |
|
1051 |
|
1052 w2 = innerDiv.offsetWidth; |
|
1053 |
|
1054 if ( w1 === w2 ) { |
|
1055 w2 = div[0].clientWidth; |
|
1056 } |
|
1057 |
|
1058 div.remove(); |
|
1059 |
|
1060 return (cachedScrollbarWidth = w1 - w2); |
|
1061 }, |
|
1062 getScrollInfo: function( within ) { |
|
1063 var overflowX = within.isWindow || within.isDocument ? "" : |
|
1064 within.element.css( "overflow-x" ), |
|
1065 overflowY = within.isWindow || within.isDocument ? "" : |
|
1066 within.element.css( "overflow-y" ), |
|
1067 hasOverflowX = overflowX === "scroll" || |
|
1068 ( overflowX === "auto" && within.width < within.element[0].scrollWidth ), |
|
1069 hasOverflowY = overflowY === "scroll" || |
|
1070 ( overflowY === "auto" && within.height < within.element[0].scrollHeight ); |
|
1071 return { |
|
1072 width: hasOverflowY ? $.position.scrollbarWidth() : 0, |
|
1073 height: hasOverflowX ? $.position.scrollbarWidth() : 0 |
|
1074 }; |
|
1075 }, |
|
1076 getWithinInfo: function( element ) { |
|
1077 var withinElement = $( element || window ), |
|
1078 isWindow = $.isWindow( withinElement[0] ), |
|
1079 isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9; |
|
1080 return { |
|
1081 element: withinElement, |
|
1082 isWindow: isWindow, |
|
1083 isDocument: isDocument, |
|
1084 offset: withinElement.offset() || { left: 0, top: 0 }, |
|
1085 scrollLeft: withinElement.scrollLeft(), |
|
1086 scrollTop: withinElement.scrollTop(), |
|
1087 width: isWindow ? withinElement.width() : withinElement.outerWidth(), |
|
1088 height: isWindow ? withinElement.height() : withinElement.outerHeight() |
|
1089 }; |
|
1090 } |
|
1091 }; |
|
1092 |
|
1093 $.fn.position = function( options ) { |
|
1094 if ( !options || !options.of ) { |
|
1095 return _position.apply( this, arguments ); |
|
1096 } |
|
1097 |
|
1098 // make a copy, we don't want to modify arguments |
|
1099 options = $.extend( {}, options ); |
|
1100 |
|
1101 var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, |
|
1102 target = $( options.of ), |
|
1103 within = $.position.getWithinInfo( options.within ), |
|
1104 scrollInfo = $.position.getScrollInfo( within ), |
|
1105 collision = ( options.collision || "flip" ).split( " " ), |
|
1106 offsets = {}; |
|
1107 |
|
1108 dimensions = getDimensions( target ); |
|
1109 if ( target[0].preventDefault ) { |
|
1110 // force left top to allow flipping |
|
1111 options.at = "left top"; |
|
1112 } |
|
1113 targetWidth = dimensions.width; |
|
1114 targetHeight = dimensions.height; |
|
1115 targetOffset = dimensions.offset; |
|
1116 // clone to reuse original targetOffset later |
|
1117 basePosition = $.extend( {}, targetOffset ); |
|
1118 |
|
1119 // force my and at to have valid horizontal and vertical positions |
|
1120 // if a value is missing or invalid, it will be converted to center |
|
1121 $.each( [ "my", "at" ], function() { |
|
1122 var pos = ( options[ this ] || "" ).split( " " ), |
|
1123 horizontalOffset, |
|
1124 verticalOffset; |
|
1125 |
|
1126 if ( pos.length === 1) { |
|
1127 pos = rhorizontal.test( pos[ 0 ] ) ? |
|
1128 pos.concat( [ "center" ] ) : |
|
1129 rvertical.test( pos[ 0 ] ) ? |
|
1130 [ "center" ].concat( pos ) : |
|
1131 [ "center", "center" ]; |
|
1132 } |
|
1133 pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center"; |
|
1134 pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center"; |
|
1135 |
|
1136 // calculate offsets |
|
1137 horizontalOffset = roffset.exec( pos[ 0 ] ); |
|
1138 verticalOffset = roffset.exec( pos[ 1 ] ); |
|
1139 offsets[ this ] = [ |
|
1140 horizontalOffset ? horizontalOffset[ 0 ] : 0, |
|
1141 verticalOffset ? verticalOffset[ 0 ] : 0 |
|
1142 ]; |
|
1143 |
|
1144 // reduce to just the positions without the offsets |
|
1145 options[ this ] = [ |
|
1146 rposition.exec( pos[ 0 ] )[ 0 ], |
|
1147 rposition.exec( pos[ 1 ] )[ 0 ] |
|
1148 ]; |
|
1149 }); |
|
1150 |
|
1151 // normalize collision option |
|
1152 if ( collision.length === 1 ) { |
|
1153 collision[ 1 ] = collision[ 0 ]; |
|
1154 } |
|
1155 |
|
1156 if ( options.at[ 0 ] === "right" ) { |
|
1157 basePosition.left += targetWidth; |
|
1158 } else if ( options.at[ 0 ] === "center" ) { |
|
1159 basePosition.left += targetWidth / 2; |
|
1160 } |
|
1161 |
|
1162 if ( options.at[ 1 ] === "bottom" ) { |
|
1163 basePosition.top += targetHeight; |
|
1164 } else if ( options.at[ 1 ] === "center" ) { |
|
1165 basePosition.top += targetHeight / 2; |
|
1166 } |
|
1167 |
|
1168 atOffset = getOffsets( offsets.at, targetWidth, targetHeight ); |
|
1169 basePosition.left += atOffset[ 0 ]; |
|
1170 basePosition.top += atOffset[ 1 ]; |
|
1171 |
|
1172 return this.each(function() { |
|
1173 var collisionPosition, using, |
|
1174 elem = $( this ), |
|
1175 elemWidth = elem.outerWidth(), |
|
1176 elemHeight = elem.outerHeight(), |
|
1177 marginLeft = parseCss( this, "marginLeft" ), |
|
1178 marginTop = parseCss( this, "marginTop" ), |
|
1179 collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width, |
|
1180 collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height, |
|
1181 position = $.extend( {}, basePosition ), |
|
1182 myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() ); |
|
1183 |
|
1184 if ( options.my[ 0 ] === "right" ) { |
|
1185 position.left -= elemWidth; |
|
1186 } else if ( options.my[ 0 ] === "center" ) { |
|
1187 position.left -= elemWidth / 2; |
|
1188 } |
|
1189 |
|
1190 if ( options.my[ 1 ] === "bottom" ) { |
|
1191 position.top -= elemHeight; |
|
1192 } else if ( options.my[ 1 ] === "center" ) { |
|
1193 position.top -= elemHeight / 2; |
|
1194 } |
|
1195 |
|
1196 position.left += myOffset[ 0 ]; |
|
1197 position.top += myOffset[ 1 ]; |
|
1198 |
|
1199 // if the browser doesn't support fractions, then round for consistent results |
|
1200 if ( !$.support.offsetFractions ) { |
|
1201 position.left = round( position.left ); |
|
1202 position.top = round( position.top ); |
|
1203 } |
|
1204 |
|
1205 collisionPosition = { |
|
1206 marginLeft: marginLeft, |
|
1207 marginTop: marginTop |
|
1208 }; |
|
1209 |
|
1210 $.each( [ "left", "top" ], function( i, dir ) { |
|
1211 if ( $.ui.position[ collision[ i ] ] ) { |
|
1212 $.ui.position[ collision[ i ] ][ dir ]( position, { |
|
1213 targetWidth: targetWidth, |
|
1214 targetHeight: targetHeight, |
|
1215 elemWidth: elemWidth, |
|
1216 elemHeight: elemHeight, |
|
1217 collisionPosition: collisionPosition, |
|
1218 collisionWidth: collisionWidth, |
|
1219 collisionHeight: collisionHeight, |
|
1220 offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ], |
|
1221 my: options.my, |
|
1222 at: options.at, |
|
1223 within: within, |
|
1224 elem : elem |
|
1225 }); |
|
1226 } |
|
1227 }); |
|
1228 |
|
1229 if ( options.using ) { |
|
1230 // adds feedback as second argument to using callback, if present |
|
1231 using = function( props ) { |
|
1232 var left = targetOffset.left - position.left, |
|
1233 right = left + targetWidth - elemWidth, |
|
1234 top = targetOffset.top - position.top, |
|
1235 bottom = top + targetHeight - elemHeight, |
|
1236 feedback = { |
|
1237 target: { |
|
1238 element: target, |
|
1239 left: targetOffset.left, |
|
1240 top: targetOffset.top, |
|
1241 width: targetWidth, |
|
1242 height: targetHeight |
|
1243 }, |
|
1244 element: { |
|
1245 element: elem, |
|
1246 left: position.left, |
|
1247 top: position.top, |
|
1248 width: elemWidth, |
|
1249 height: elemHeight |
|
1250 }, |
|
1251 horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", |
|
1252 vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" |
|
1253 }; |
|
1254 if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) { |
|
1255 feedback.horizontal = "center"; |
|
1256 } |
|
1257 if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) { |
|
1258 feedback.vertical = "middle"; |
|
1259 } |
|
1260 if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) { |
|
1261 feedback.important = "horizontal"; |
|
1262 } else { |
|
1263 feedback.important = "vertical"; |
|
1264 } |
|
1265 options.using.call( this, props, feedback ); |
|
1266 }; |
|
1267 } |
|
1268 |
|
1269 elem.offset( $.extend( position, { using: using } ) ); |
|
1270 }); |
|
1271 }; |
|
1272 |
|
1273 $.ui.position = { |
|
1274 fit: { |
|
1275 left: function( position, data ) { |
|
1276 var within = data.within, |
|
1277 withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, |
|
1278 outerWidth = within.width, |
|
1279 collisionPosLeft = position.left - data.collisionPosition.marginLeft, |
|
1280 overLeft = withinOffset - collisionPosLeft, |
|
1281 overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, |
|
1282 newOverRight; |
|
1283 |
|
1284 // element is wider than within |
|
1285 if ( data.collisionWidth > outerWidth ) { |
|
1286 // element is initially over the left side of within |
|
1287 if ( overLeft > 0 && overRight <= 0 ) { |
|
1288 newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset; |
|
1289 position.left += overLeft - newOverRight; |
|
1290 // element is initially over right side of within |
|
1291 } else if ( overRight > 0 && overLeft <= 0 ) { |
|
1292 position.left = withinOffset; |
|
1293 // element is initially over both left and right sides of within |
|
1294 } else { |
|
1295 if ( overLeft > overRight ) { |
|
1296 position.left = withinOffset + outerWidth - data.collisionWidth; |
|
1297 } else { |
|
1298 position.left = withinOffset; |
|
1299 } |
|
1300 } |
|
1301 // too far left -> align with left edge |
|
1302 } else if ( overLeft > 0 ) { |
|
1303 position.left += overLeft; |
|
1304 // too far right -> align with right edge |
|
1305 } else if ( overRight > 0 ) { |
|
1306 position.left -= overRight; |
|
1307 // adjust based on position and margin |
|
1308 } else { |
|
1309 position.left = max( position.left - collisionPosLeft, position.left ); |
|
1310 } |
|
1311 }, |
|
1312 top: function( position, data ) { |
|
1313 var within = data.within, |
|
1314 withinOffset = within.isWindow ? within.scrollTop : within.offset.top, |
|
1315 outerHeight = data.within.height, |
|
1316 collisionPosTop = position.top - data.collisionPosition.marginTop, |
|
1317 overTop = withinOffset - collisionPosTop, |
|
1318 overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, |
|
1319 newOverBottom; |
|
1320 |
|
1321 // element is taller than within |
|
1322 if ( data.collisionHeight > outerHeight ) { |
|
1323 // element is initially over the top of within |
|
1324 if ( overTop > 0 && overBottom <= 0 ) { |
|
1325 newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset; |
|
1326 position.top += overTop - newOverBottom; |
|
1327 // element is initially over bottom of within |
|
1328 } else if ( overBottom > 0 && overTop <= 0 ) { |
|
1329 position.top = withinOffset; |
|
1330 // element is initially over both top and bottom of within |
|
1331 } else { |
|
1332 if ( overTop > overBottom ) { |
|
1333 position.top = withinOffset + outerHeight - data.collisionHeight; |
|
1334 } else { |
|
1335 position.top = withinOffset; |
|
1336 } |
|
1337 } |
|
1338 // too far up -> align with top |
|
1339 } else if ( overTop > 0 ) { |
|
1340 position.top += overTop; |
|
1341 // too far down -> align with bottom edge |
|
1342 } else if ( overBottom > 0 ) { |
|
1343 position.top -= overBottom; |
|
1344 // adjust based on position and margin |
|
1345 } else { |
|
1346 position.top = max( position.top - collisionPosTop, position.top ); |
|
1347 } |
|
1348 } |
|
1349 }, |
|
1350 flip: { |
|
1351 left: function( position, data ) { |
|
1352 var within = data.within, |
|
1353 withinOffset = within.offset.left + within.scrollLeft, |
|
1354 outerWidth = within.width, |
|
1355 offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, |
|
1356 collisionPosLeft = position.left - data.collisionPosition.marginLeft, |
|
1357 overLeft = collisionPosLeft - offsetLeft, |
|
1358 overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, |
|
1359 myOffset = data.my[ 0 ] === "left" ? |
|
1360 -data.elemWidth : |
|
1361 data.my[ 0 ] === "right" ? |
|
1362 data.elemWidth : |
|
1363 0, |
|
1364 atOffset = data.at[ 0 ] === "left" ? |
|
1365 data.targetWidth : |
|
1366 data.at[ 0 ] === "right" ? |
|
1367 -data.targetWidth : |
|
1368 0, |
|
1369 offset = -2 * data.offset[ 0 ], |
|
1370 newOverRight, |
|
1371 newOverLeft; |
|
1372 |
|
1373 if ( overLeft < 0 ) { |
|
1374 newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset; |
|
1375 if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) { |
|
1376 position.left += myOffset + atOffset + offset; |
|
1377 } |
|
1378 } |
|
1379 else if ( overRight > 0 ) { |
|
1380 newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft; |
|
1381 if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) { |
|
1382 position.left += myOffset + atOffset + offset; |
|
1383 } |
|
1384 } |
|
1385 }, |
|
1386 top: function( position, data ) { |
|
1387 var within = data.within, |
|
1388 withinOffset = within.offset.top + within.scrollTop, |
|
1389 outerHeight = within.height, |
|
1390 offsetTop = within.isWindow ? within.scrollTop : within.offset.top, |
|
1391 collisionPosTop = position.top - data.collisionPosition.marginTop, |
|
1392 overTop = collisionPosTop - offsetTop, |
|
1393 overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, |
|
1394 top = data.my[ 1 ] === "top", |
|
1395 myOffset = top ? |
|
1396 -data.elemHeight : |
|
1397 data.my[ 1 ] === "bottom" ? |
|
1398 data.elemHeight : |
|
1399 0, |
|
1400 atOffset = data.at[ 1 ] === "top" ? |
|
1401 data.targetHeight : |
|
1402 data.at[ 1 ] === "bottom" ? |
|
1403 -data.targetHeight : |
|
1404 0, |
|
1405 offset = -2 * data.offset[ 1 ], |
|
1406 newOverTop, |
|
1407 newOverBottom; |
|
1408 if ( overTop < 0 ) { |
|
1409 newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset; |
|
1410 if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) { |
|
1411 position.top += myOffset + atOffset + offset; |
|
1412 } |
|
1413 } |
|
1414 else if ( overBottom > 0 ) { |
|
1415 newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop; |
|
1416 if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) { |
|
1417 position.top += myOffset + atOffset + offset; |
|
1418 } |
|
1419 } |
|
1420 } |
|
1421 }, |
|
1422 flipfit: { |
|
1423 left: function() { |
|
1424 $.ui.position.flip.left.apply( this, arguments ); |
|
1425 $.ui.position.fit.left.apply( this, arguments ); |
|
1426 }, |
|
1427 top: function() { |
|
1428 $.ui.position.flip.top.apply( this, arguments ); |
|
1429 $.ui.position.fit.top.apply( this, arguments ); |
|
1430 } |
|
1431 } |
|
1432 }; |
|
1433 |
|
1434 // fraction support test |
|
1435 (function () { |
|
1436 var testElement, testElementParent, testElementStyle, offsetLeft, i, |
|
1437 body = document.getElementsByTagName( "body" )[ 0 ], |
|
1438 div = document.createElement( "div" ); |
|
1439 |
|
1440 //Create a "fake body" for testing based on method used in jQuery.support |
|
1441 testElement = document.createElement( body ? "div" : "body" ); |
|
1442 testElementStyle = { |
|
1443 visibility: "hidden", |
|
1444 width: 0, |
|
1445 height: 0, |
|
1446 border: 0, |
|
1447 margin: 0, |
|
1448 background: "none" |
|
1449 }; |
|
1450 if ( body ) { |
|
1451 $.extend( testElementStyle, { |
|
1452 position: "absolute", |
|
1453 left: "-1000px", |
|
1454 top: "-1000px" |
|
1455 }); |
|
1456 } |
|
1457 for ( i in testElementStyle ) { |
|
1458 testElement.style[ i ] = testElementStyle[ i ]; |
|
1459 } |
|
1460 testElement.appendChild( div ); |
|
1461 testElementParent = body || document.documentElement; |
|
1462 testElementParent.insertBefore( testElement, testElementParent.firstChild ); |
|
1463 |
|
1464 div.style.cssText = "position: absolute; left: 10.7432222px;"; |
|
1465 |
|
1466 offsetLeft = $( div ).offset().left; |
|
1467 $.support.offsetFractions = offsetLeft > 10 && offsetLeft < 11; |
|
1468 |
|
1469 testElement.innerHTML = ""; |
|
1470 testElementParent.removeChild( testElement ); |
|
1471 })(); |
|
1472 |
|
1473 }( jQuery ) ); |
|
1474 (function( $, undefined ) { |
|
1475 |
987 $.widget("ui.draggable", $.ui.mouse, { |
1476 $.widget("ui.draggable", $.ui.mouse, { |
988 version: "1.10.3", |
1477 version: "1.10.4", |
989 widgetEventPrefix: "drag", |
1478 widgetEventPrefix: "drag", |
990 options: { |
1479 options: { |
991 addClasses: true, |
1480 addClasses: true, |
992 appendTo: "parent", |
1481 appendTo: "parent", |
993 axis: false, |
1482 axis: false, |
4768 } |
5284 } |
4769 |
5285 |
4770 }); |
5286 }); |
4771 |
5287 |
4772 })(jQuery); |
5288 })(jQuery); |
4773 |
|
4774 (function($, undefined) { |
|
4775 |
|
4776 var dataSpace = "ui-effects-"; |
|
4777 |
|
4778 $.effects = { |
|
4779 effect: {} |
|
4780 }; |
|
4781 |
|
4782 /*! |
|
4783 * jQuery Color Animations v2.1.2 |
|
4784 * https://github.com/jquery/jquery-color |
|
4785 * |
|
4786 * Copyright 2013 jQuery Foundation and other contributors |
|
4787 * Released under the MIT license. |
|
4788 * http://jquery.org/license |
|
4789 * |
|
4790 * Date: Wed Jan 16 08:47:09 2013 -0600 |
|
4791 */ |
|
4792 (function( jQuery, undefined ) { |
|
4793 |
|
4794 var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", |
|
4795 |
|
4796 // plusequals test for += 100 -= 100 |
|
4797 rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, |
|
4798 // a set of RE's that can match strings and generate color tuples. |
|
4799 stringParsers = [{ |
|
4800 re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, |
|
4801 parse: function( execResult ) { |
|
4802 return [ |
|
4803 execResult[ 1 ], |
|
4804 execResult[ 2 ], |
|
4805 execResult[ 3 ], |
|
4806 execResult[ 4 ] |
|
4807 ]; |
|
4808 } |
|
4809 }, { |
|
4810 re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, |
|
4811 parse: function( execResult ) { |
|
4812 return [ |
|
4813 execResult[ 1 ] * 2.55, |
|
4814 execResult[ 2 ] * 2.55, |
|
4815 execResult[ 3 ] * 2.55, |
|
4816 execResult[ 4 ] |
|
4817 ]; |
|
4818 } |
|
4819 }, { |
|
4820 // this regex ignores A-F because it's compared against an already lowercased string |
|
4821 re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/, |
|
4822 parse: function( execResult ) { |
|
4823 return [ |
|
4824 parseInt( execResult[ 1 ], 16 ), |
|
4825 parseInt( execResult[ 2 ], 16 ), |
|
4826 parseInt( execResult[ 3 ], 16 ) |
|
4827 ]; |
|
4828 } |
|
4829 }, { |
|
4830 // this regex ignores A-F because it's compared against an already lowercased string |
|
4831 re: /#([a-f0-9])([a-f0-9])([a-f0-9])/, |
|
4832 parse: function( execResult ) { |
|
4833 return [ |
|
4834 parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ), |
|
4835 parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ), |
|
4836 parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ) |
|
4837 ]; |
|
4838 } |
|
4839 }, { |
|
4840 re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, |
|
4841 space: "hsla", |
|
4842 parse: function( execResult ) { |
|
4843 return [ |
|
4844 execResult[ 1 ], |
|
4845 execResult[ 2 ] / 100, |
|
4846 execResult[ 3 ] / 100, |
|
4847 execResult[ 4 ] |
|
4848 ]; |
|
4849 } |
|
4850 }], |
|
4851 |
|
4852 // jQuery.Color( ) |
|
4853 color = jQuery.Color = function( color, green, blue, alpha ) { |
|
4854 return new jQuery.Color.fn.parse( color, green, blue, alpha ); |
|
4855 }, |
|
4856 spaces = { |
|
4857 rgba: { |
|
4858 props: { |
|
4859 red: { |
|
4860 idx: 0, |
|
4861 type: "byte" |
|
4862 }, |
|
4863 green: { |
|
4864 idx: 1, |
|
4865 type: "byte" |
|
4866 }, |
|
4867 blue: { |
|
4868 idx: 2, |
|
4869 type: "byte" |
|
4870 } |
|
4871 } |
|
4872 }, |
|
4873 |
|
4874 hsla: { |
|
4875 props: { |
|
4876 hue: { |
|
4877 idx: 0, |
|
4878 type: "degrees" |
|
4879 }, |
|
4880 saturation: { |
|
4881 idx: 1, |
|
4882 type: "percent" |
|
4883 }, |
|
4884 lightness: { |
|
4885 idx: 2, |
|
4886 type: "percent" |
|
4887 } |
|
4888 } |
|
4889 } |
|
4890 }, |
|
4891 propTypes = { |
|
4892 "byte": { |
|
4893 floor: true, |
|
4894 max: 255 |
|
4895 }, |
|
4896 "percent": { |
|
4897 max: 1 |
|
4898 }, |
|
4899 "degrees": { |
|
4900 mod: 360, |
|
4901 floor: true |
|
4902 } |
|
4903 }, |
|
4904 support = color.support = {}, |
|
4905 |
|
4906 // element for support tests |
|
4907 supportElem = jQuery( "<p>" )[ 0 ], |
|
4908 |
|
4909 // colors = jQuery.Color.names |
|
4910 colors, |
|
4911 |
|
4912 // local aliases of functions called often |
|
4913 each = jQuery.each; |
|
4914 |
|
4915 // determine rgba support immediately |
|
4916 supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; |
|
4917 support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1; |
|
4918 |
|
4919 // define cache name and alpha properties |
|
4920 // for rgba and hsla spaces |
|
4921 each( spaces, function( spaceName, space ) { |
|
4922 space.cache = "_" + spaceName; |
|
4923 space.props.alpha = { |
|
4924 idx: 3, |
|
4925 type: "percent", |
|
4926 def: 1 |
|
4927 }; |
|
4928 }); |
|
4929 |
|
4930 function clamp( value, prop, allowEmpty ) { |
|
4931 var type = propTypes[ prop.type ] || {}; |
|
4932 |
|
4933 if ( value == null ) { |
|
4934 return (allowEmpty || !prop.def) ? null : prop.def; |
|
4935 } |
|
4936 |
|
4937 // ~~ is an short way of doing floor for positive numbers |
|
4938 value = type.floor ? ~~value : parseFloat( value ); |
|
4939 |
|
4940 // IE will pass in empty strings as value for alpha, |
|
4941 // which will hit this case |
|
4942 if ( isNaN( value ) ) { |
|
4943 return prop.def; |
|
4944 } |
|
4945 |
|
4946 if ( type.mod ) { |
|
4947 // we add mod before modding to make sure that negatives values |
|
4948 // get converted properly: -10 -> 350 |
|
4949 return (value + type.mod) % type.mod; |
|
4950 } |
|
4951 |
|
4952 // for now all property types without mod have min and max |
|
4953 return 0 > value ? 0 : type.max < value ? type.max : value; |
|
4954 } |
|
4955 |
|
4956 function stringParse( string ) { |
|
4957 var inst = color(), |
|
4958 rgba = inst._rgba = []; |
|
4959 |
|
4960 string = string.toLowerCase(); |
|
4961 |
|
4962 each( stringParsers, function( i, parser ) { |
|
4963 var parsed, |
|
4964 match = parser.re.exec( string ), |
|
4965 values = match && parser.parse( match ), |
|
4966 spaceName = parser.space || "rgba"; |
|
4967 |
|
4968 if ( values ) { |
|
4969 parsed = inst[ spaceName ]( values ); |
|
4970 |
|
4971 // if this was an rgba parse the assignment might happen twice |
|
4972 // oh well.... |
|
4973 inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ]; |
|
4974 rgba = inst._rgba = parsed._rgba; |
|
4975 |
|
4976 // exit each( stringParsers ) here because we matched |
|
4977 return false; |
|
4978 } |
|
4979 }); |
|
4980 |
|
4981 // Found a stringParser that handled it |
|
4982 if ( rgba.length ) { |
|
4983 |
|
4984 // if this came from a parsed string, force "transparent" when alpha is 0 |
|
4985 // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) |
|
4986 if ( rgba.join() === "0,0,0,0" ) { |
|
4987 jQuery.extend( rgba, colors.transparent ); |
|
4988 } |
|
4989 return inst; |
|
4990 } |
|
4991 |
|
4992 // named colors |
|
4993 return colors[ string ]; |
|
4994 } |
|
4995 |
|
4996 color.fn = jQuery.extend( color.prototype, { |
|
4997 parse: function( red, green, blue, alpha ) { |
|
4998 if ( red === undefined ) { |
|
4999 this._rgba = [ null, null, null, null ]; |
|
5000 return this; |
|
5001 } |
|
5002 if ( red.jquery || red.nodeType ) { |
|
5003 red = jQuery( red ).css( green ); |
|
5004 green = undefined; |
|
5005 } |
|
5006 |
|
5007 var inst = this, |
|
5008 type = jQuery.type( red ), |
|
5009 rgba = this._rgba = []; |
|
5010 |
|
5011 // more than 1 argument specified - assume ( red, green, blue, alpha ) |
|
5012 if ( green !== undefined ) { |
|
5013 red = [ red, green, blue, alpha ]; |
|
5014 type = "array"; |
|
5015 } |
|
5016 |
|
5017 if ( type === "string" ) { |
|
5018 return this.parse( stringParse( red ) || colors._default ); |
|
5019 } |
|
5020 |
|
5021 if ( type === "array" ) { |
|
5022 each( spaces.rgba.props, function( key, prop ) { |
|
5023 rgba[ prop.idx ] = clamp( red[ prop.idx ], prop ); |
|
5024 }); |
|
5025 return this; |
|
5026 } |
|
5027 |
|
5028 if ( type === "object" ) { |
|
5029 if ( red instanceof color ) { |
|
5030 each( spaces, function( spaceName, space ) { |
|
5031 if ( red[ space.cache ] ) { |
|
5032 inst[ space.cache ] = red[ space.cache ].slice(); |
|
5033 } |
|
5034 }); |
|
5035 } else { |
|
5036 each( spaces, function( spaceName, space ) { |
|
5037 var cache = space.cache; |
|
5038 each( space.props, function( key, prop ) { |
|
5039 |
|
5040 // if the cache doesn't exist, and we know how to convert |
|
5041 if ( !inst[ cache ] && space.to ) { |
|
5042 |
|
5043 // if the value was null, we don't need to copy it |
|
5044 // if the key was alpha, we don't need to copy it either |
|
5045 if ( key === "alpha" || red[ key ] == null ) { |
|
5046 return; |
|
5047 } |
|
5048 inst[ cache ] = space.to( inst._rgba ); |
|
5049 } |
|
5050 |
|
5051 // this is the only case where we allow nulls for ALL properties. |
|
5052 // call clamp with alwaysAllowEmpty |
|
5053 inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true ); |
|
5054 }); |
|
5055 |
|
5056 // everything defined but alpha? |
|
5057 if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) { |
|
5058 // use the default of 1 |
|
5059 inst[ cache ][ 3 ] = 1; |
|
5060 if ( space.from ) { |
|
5061 inst._rgba = space.from( inst[ cache ] ); |
|
5062 } |
|
5063 } |
|
5064 }); |
|
5065 } |
|
5066 return this; |
|
5067 } |
|
5068 }, |
|
5069 is: function( compare ) { |
|
5070 var is = color( compare ), |
|
5071 same = true, |
|
5072 inst = this; |
|
5073 |
|
5074 each( spaces, function( _, space ) { |
|
5075 var localCache, |
|
5076 isCache = is[ space.cache ]; |
|
5077 if (isCache) { |
|
5078 localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || []; |
|
5079 each( space.props, function( _, prop ) { |
|
5080 if ( isCache[ prop.idx ] != null ) { |
|
5081 same = ( isCache[ prop.idx ] === localCache[ prop.idx ] ); |
|
5082 return same; |
|
5083 } |
|
5084 }); |
|
5085 } |
|
5086 return same; |
|
5087 }); |
|
5088 return same; |
|
5089 }, |
|
5090 _space: function() { |
|
5091 var used = [], |
|
5092 inst = this; |
|
5093 each( spaces, function( spaceName, space ) { |
|
5094 if ( inst[ space.cache ] ) { |
|
5095 used.push( spaceName ); |
|
5096 } |
|
5097 }); |
|
5098 return used.pop(); |
|
5099 }, |
|
5100 transition: function( other, distance ) { |
|
5101 var end = color( other ), |
|
5102 spaceName = end._space(), |
|
5103 space = spaces[ spaceName ], |
|
5104 startColor = this.alpha() === 0 ? color( "transparent" ) : this, |
|
5105 start = startColor[ space.cache ] || space.to( startColor._rgba ), |
|
5106 result = start.slice(); |
|
5107 |
|
5108 end = end[ space.cache ]; |
|
5109 each( space.props, function( key, prop ) { |
|
5110 var index = prop.idx, |
|
5111 startValue = start[ index ], |
|
5112 endValue = end[ index ], |
|
5113 type = propTypes[ prop.type ] || {}; |
|
5114 |
|
5115 // if null, don't override start value |
|
5116 if ( endValue === null ) { |
|
5117 return; |
|
5118 } |
|
5119 // if null - use end |
|
5120 if ( startValue === null ) { |
|
5121 result[ index ] = endValue; |
|
5122 } else { |
|
5123 if ( type.mod ) { |
|
5124 if ( endValue - startValue > type.mod / 2 ) { |
|
5125 startValue += type.mod; |
|
5126 } else if ( startValue - endValue > type.mod / 2 ) { |
|
5127 startValue -= type.mod; |
|
5128 } |
|
5129 } |
|
5130 result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop ); |
|
5131 } |
|
5132 }); |
|
5133 return this[ spaceName ]( result ); |
|
5134 }, |
|
5135 blend: function( opaque ) { |
|
5136 // if we are already opaque - return ourself |
|
5137 if ( this._rgba[ 3 ] === 1 ) { |
|
5138 return this; |
|
5139 } |
|
5140 |
|
5141 var rgb = this._rgba.slice(), |
|
5142 a = rgb.pop(), |
|
5143 blend = color( opaque )._rgba; |
|
5144 |
|
5145 return color( jQuery.map( rgb, function( v, i ) { |
|
5146 return ( 1 - a ) * blend[ i ] + a * v; |
|
5147 })); |
|
5148 }, |
|
5149 toRgbaString: function() { |
|
5150 var prefix = "rgba(", |
|
5151 rgba = jQuery.map( this._rgba, function( v, i ) { |
|
5152 return v == null ? ( i > 2 ? 1 : 0 ) : v; |
|
5153 }); |
|
5154 |
|
5155 if ( rgba[ 3 ] === 1 ) { |
|
5156 rgba.pop(); |
|
5157 prefix = "rgb("; |
|
5158 } |
|
5159 |
|
5160 return prefix + rgba.join() + ")"; |
|
5161 }, |
|
5162 toHslaString: function() { |
|
5163 var prefix = "hsla(", |
|
5164 hsla = jQuery.map( this.hsla(), function( v, i ) { |
|
5165 if ( v == null ) { |
|
5166 v = i > 2 ? 1 : 0; |
|
5167 } |
|
5168 |
|
5169 // catch 1 and 2 |
|
5170 if ( i && i < 3 ) { |
|
5171 v = Math.round( v * 100 ) + "%"; |
|
5172 } |
|
5173 return v; |
|
5174 }); |
|
5175 |
|
5176 if ( hsla[ 3 ] === 1 ) { |
|
5177 hsla.pop(); |
|
5178 prefix = "hsl("; |
|
5179 } |
|
5180 return prefix + hsla.join() + ")"; |
|
5181 }, |
|
5182 toHexString: function( includeAlpha ) { |
|
5183 var rgba = this._rgba.slice(), |
|
5184 alpha = rgba.pop(); |
|
5185 |
|
5186 if ( includeAlpha ) { |
|
5187 rgba.push( ~~( alpha * 255 ) ); |
|
5188 } |
|
5189 |
|
5190 return "#" + jQuery.map( rgba, function( v ) { |
|
5191 |
|
5192 // default to 0 when nulls exist |
|
5193 v = ( v || 0 ).toString( 16 ); |
|
5194 return v.length === 1 ? "0" + v : v; |
|
5195 }).join(""); |
|
5196 }, |
|
5197 toString: function() { |
|
5198 return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString(); |
|
5199 } |
|
5200 }); |
|
5201 color.fn.parse.prototype = color.fn; |
|
5202 |
|
5203 // hsla conversions adapted from: |
|
5204 // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 |
|
5205 |
|
5206 function hue2rgb( p, q, h ) { |
|
5207 h = ( h + 1 ) % 1; |
|
5208 if ( h * 6 < 1 ) { |
|
5209 return p + (q - p) * h * 6; |
|
5210 } |
|
5211 if ( h * 2 < 1) { |
|
5212 return q; |
|
5213 } |
|
5214 if ( h * 3 < 2 ) { |
|
5215 return p + (q - p) * ((2/3) - h) * 6; |
|
5216 } |
|
5217 return p; |
|
5218 } |
|
5219 |
|
5220 spaces.hsla.to = function ( rgba ) { |
|
5221 if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) { |
|
5222 return [ null, null, null, rgba[ 3 ] ]; |
|
5223 } |
|
5224 var r = rgba[ 0 ] / 255, |
|
5225 g = rgba[ 1 ] / 255, |
|
5226 b = rgba[ 2 ] / 255, |
|
5227 a = rgba[ 3 ], |
|
5228 max = Math.max( r, g, b ), |
|
5229 min = Math.min( r, g, b ), |
|
5230 diff = max - min, |
|
5231 add = max + min, |
|
5232 l = add * 0.5, |
|
5233 h, s; |
|
5234 |
|
5235 if ( min === max ) { |
|
5236 h = 0; |
|
5237 } else if ( r === max ) { |
|
5238 h = ( 60 * ( g - b ) / diff ) + 360; |
|
5239 } else if ( g === max ) { |
|
5240 h = ( 60 * ( b - r ) / diff ) + 120; |
|
5241 } else { |
|
5242 h = ( 60 * ( r - g ) / diff ) + 240; |
|
5243 } |
|
5244 |
|
5245 // chroma (diff) == 0 means greyscale which, by definition, saturation = 0% |
|
5246 // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add) |
|
5247 if ( diff === 0 ) { |
|
5248 s = 0; |
|
5249 } else if ( l <= 0.5 ) { |
|
5250 s = diff / add; |
|
5251 } else { |
|
5252 s = diff / ( 2 - add ); |
|
5253 } |
|
5254 return [ Math.round(h) % 360, s, l, a == null ? 1 : a ]; |
|
5255 }; |
|
5256 |
|
5257 spaces.hsla.from = function ( hsla ) { |
|
5258 if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) { |
|
5259 return [ null, null, null, hsla[ 3 ] ]; |
|
5260 } |
|
5261 var h = hsla[ 0 ] / 360, |
|
5262 s = hsla[ 1 ], |
|
5263 l = hsla[ 2 ], |
|
5264 a = hsla[ 3 ], |
|
5265 q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s, |
|
5266 p = 2 * l - q; |
|
5267 |
|
5268 return [ |
|
5269 Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ), |
|
5270 Math.round( hue2rgb( p, q, h ) * 255 ), |
|
5271 Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ), |
|
5272 a |
|
5273 ]; |
|
5274 }; |
|
5275 |
|
5276 |
|
5277 each( spaces, function( spaceName, space ) { |
|
5278 var props = space.props, |
|
5279 cache = space.cache, |
|
5280 to = space.to, |
|
5281 from = space.from; |
|
5282 |
|
5283 // makes rgba() and hsla() |
|
5284 color.fn[ spaceName ] = function( value ) { |
|
5285 |
|
5286 // generate a cache for this space if it doesn't exist |
|
5287 if ( to && !this[ cache ] ) { |
|
5288 this[ cache ] = to( this._rgba ); |
|
5289 } |
|
5290 if ( value === undefined ) { |
|
5291 return this[ cache ].slice(); |
|
5292 } |
|
5293 |
|
5294 var ret, |
|
5295 type = jQuery.type( value ), |
|
5296 arr = ( type === "array" || type === "object" ) ? value : arguments, |
|
5297 local = this[ cache ].slice(); |
|
5298 |
|
5299 each( props, function( key, prop ) { |
|
5300 var val = arr[ type === "object" ? key : prop.idx ]; |
|
5301 if ( val == null ) { |
|
5302 val = local[ prop.idx ]; |
|
5303 } |
|
5304 local[ prop.idx ] = clamp( val, prop ); |
|
5305 }); |
|
5306 |
|
5307 if ( from ) { |
|
5308 ret = color( from( local ) ); |
|
5309 ret[ cache ] = local; |
|
5310 return ret; |
|
5311 } else { |
|
5312 return color( local ); |
|
5313 } |
|
5314 }; |
|
5315 |
|
5316 // makes red() green() blue() alpha() hue() saturation() lightness() |
|
5317 each( props, function( key, prop ) { |
|
5318 // alpha is included in more than one space |
|
5319 if ( color.fn[ key ] ) { |
|
5320 return; |
|
5321 } |
|
5322 color.fn[ key ] = function( value ) { |
|
5323 var vtype = jQuery.type( value ), |
|
5324 fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ), |
|
5325 local = this[ fn ](), |
|
5326 cur = local[ prop.idx ], |
|
5327 match; |
|
5328 |
|
5329 if ( vtype === "undefined" ) { |
|
5330 return cur; |
|
5331 } |
|
5332 |
|
5333 if ( vtype === "function" ) { |
|
5334 value = value.call( this, cur ); |
|
5335 vtype = jQuery.type( value ); |
|
5336 } |
|
5337 if ( value == null && prop.empty ) { |
|
5338 return this; |
|
5339 } |
|
5340 if ( vtype === "string" ) { |
|
5341 match = rplusequals.exec( value ); |
|
5342 if ( match ) { |
|
5343 value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 ); |
|
5344 } |
|
5345 } |
|
5346 local[ prop.idx ] = value; |
|
5347 return this[ fn ]( local ); |
|
5348 }; |
|
5349 }); |
|
5350 }); |
|
5351 |
|
5352 // add cssHook and .fx.step function for each named hook. |
|
5353 // accept a space separated string of properties |
|
5354 color.hook = function( hook ) { |
|
5355 var hooks = hook.split( " " ); |
|
5356 each( hooks, function( i, hook ) { |
|
5357 jQuery.cssHooks[ hook ] = { |
|
5358 set: function( elem, value ) { |
|
5359 var parsed, curElem, |
|
5360 backgroundColor = ""; |
|
5361 |
|
5362 if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) { |
|
5363 value = color( parsed || value ); |
|
5364 if ( !support.rgba && value._rgba[ 3 ] !== 1 ) { |
|
5365 curElem = hook === "backgroundColor" ? elem.parentNode : elem; |
|
5366 while ( |
|
5367 (backgroundColor === "" || backgroundColor === "transparent") && |
|
5368 curElem && curElem.style |
|
5369 ) { |
|
5370 try { |
|
5371 backgroundColor = jQuery.css( curElem, "backgroundColor" ); |
|
5372 curElem = curElem.parentNode; |
|
5373 } catch ( e ) { |
|
5374 } |
|
5375 } |
|
5376 |
|
5377 value = value.blend( backgroundColor && backgroundColor !== "transparent" ? |
|
5378 backgroundColor : |
|
5379 "_default" ); |
|
5380 } |
|
5381 |
|
5382 value = value.toRgbaString(); |
|
5383 } |
|
5384 try { |
|
5385 elem.style[ hook ] = value; |
|
5386 } catch( e ) { |
|
5387 // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit' |
|
5388 } |
|
5389 } |
|
5390 }; |
|
5391 jQuery.fx.step[ hook ] = function( fx ) { |
|
5392 if ( !fx.colorInit ) { |
|
5393 fx.start = color( fx.elem, hook ); |
|
5394 fx.end = color( fx.end ); |
|
5395 fx.colorInit = true; |
|
5396 } |
|
5397 jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) ); |
|
5398 }; |
|
5399 }); |
|
5400 |
|
5401 }; |
|
5402 |
|
5403 color.hook( stepHooks ); |
|
5404 |
|
5405 jQuery.cssHooks.borderColor = { |
|
5406 expand: function( value ) { |
|
5407 var expanded = {}; |
|
5408 |
|
5409 each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) { |
|
5410 expanded[ "border" + part + "Color" ] = value; |
|
5411 }); |
|
5412 return expanded; |
|
5413 } |
|
5414 }; |
|
5415 |
|
5416 // Basic color names only. |
|
5417 // Usage of any of the other color names requires adding yourself or including |
|
5418 // jquery.color.svg-names.js. |
|
5419 colors = jQuery.Color.names = { |
|
5420 // 4.1. Basic color keywords |
|
5421 aqua: "#00ffff", |
|
5422 black: "#000000", |
|
5423 blue: "#0000ff", |
|
5424 fuchsia: "#ff00ff", |
|
5425 gray: "#808080", |
|
5426 green: "#008000", |
|
5427 lime: "#00ff00", |
|
5428 maroon: "#800000", |
|
5429 navy: "#000080", |
|
5430 olive: "#808000", |
|
5431 purple: "#800080", |
|
5432 red: "#ff0000", |
|
5433 silver: "#c0c0c0", |
|
5434 teal: "#008080", |
|
5435 white: "#ffffff", |
|
5436 yellow: "#ffff00", |
|
5437 |
|
5438 // 4.2.3. "transparent" color keyword |
|
5439 transparent: [ null, null, null, 0 ], |
|
5440 |
|
5441 _default: "#ffffff" |
|
5442 }; |
|
5443 |
|
5444 })( jQuery ); |
|
5445 |
|
5446 |
|
5447 /******************************************************************************/ |
|
5448 /****************************** CLASS ANIMATIONS ******************************/ |
|
5449 /******************************************************************************/ |
|
5450 (function() { |
|
5451 |
|
5452 var classAnimationActions = [ "add", "remove", "toggle" ], |
|
5453 shorthandStyles = { |
|
5454 border: 1, |
|
5455 borderBottom: 1, |
|
5456 borderColor: 1, |
|
5457 borderLeft: 1, |
|
5458 borderRight: 1, |
|
5459 borderTop: 1, |
|
5460 borderWidth: 1, |
|
5461 margin: 1, |
|
5462 padding: 1 |
|
5463 }; |
|
5464 |
|
5465 $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) { |
|
5466 $.fx.step[ prop ] = function( fx ) { |
|
5467 if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) { |
|
5468 jQuery.style( fx.elem, prop, fx.end ); |
|
5469 fx.setAttr = true; |
|
5470 } |
|
5471 }; |
|
5472 }); |
|
5473 |
|
5474 function getElementStyles( elem ) { |
|
5475 var key, len, |
|
5476 style = elem.ownerDocument.defaultView ? |
|
5477 elem.ownerDocument.defaultView.getComputedStyle( elem, null ) : |
|
5478 elem.currentStyle, |
|
5479 styles = {}; |
|
5480 |
|
5481 if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) { |
|
5482 len = style.length; |
|
5483 while ( len-- ) { |
|
5484 key = style[ len ]; |
|
5485 if ( typeof style[ key ] === "string" ) { |
|
5486 styles[ $.camelCase( key ) ] = style[ key ]; |
|
5487 } |
|
5488 } |
|
5489 // support: Opera, IE <9 |
|
5490 } else { |
|
5491 for ( key in style ) { |
|
5492 if ( typeof style[ key ] === "string" ) { |
|
5493 styles[ key ] = style[ key ]; |
|
5494 } |
|
5495 } |
|
5496 } |
|
5497 |
|
5498 return styles; |
|
5499 } |
|
5500 |
|
5501 |
|
5502 function styleDifference( oldStyle, newStyle ) { |
|
5503 var diff = {}, |
|
5504 name, value; |
|
5505 |
|
5506 for ( name in newStyle ) { |
|
5507 value = newStyle[ name ]; |
|
5508 if ( oldStyle[ name ] !== value ) { |
|
5509 if ( !shorthandStyles[ name ] ) { |
|
5510 if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) { |
|
5511 diff[ name ] = value; |
|
5512 } |
|
5513 } |
|
5514 } |
|
5515 } |
|
5516 |
|
5517 return diff; |
|
5518 } |
|
5519 |
|
5520 // support: jQuery <1.8 |
|
5521 if ( !$.fn.addBack ) { |
|
5522 $.fn.addBack = function( selector ) { |
|
5523 return this.add( selector == null ? |
|
5524 this.prevObject : this.prevObject.filter( selector ) |
|
5525 ); |
|
5526 }; |
|
5527 } |
|
5528 |
|
5529 $.effects.animateClass = function( value, duration, easing, callback ) { |
|
5530 var o = $.speed( duration, easing, callback ); |
|
5531 |
|
5532 return this.queue( function() { |
|
5533 var animated = $( this ), |
|
5534 baseClass = animated.attr( "class" ) || "", |
|
5535 applyClassChange, |
|
5536 allAnimations = o.children ? animated.find( "*" ).addBack() : animated; |
|
5537 |
|
5538 // map the animated objects to store the original styles. |
|
5539 allAnimations = allAnimations.map(function() { |
|
5540 var el = $( this ); |
|
5541 return { |
|
5542 el: el, |
|
5543 start: getElementStyles( this ) |
|
5544 }; |
|
5545 }); |
|
5546 |
|
5547 // apply class change |
|
5548 applyClassChange = function() { |
|
5549 $.each( classAnimationActions, function(i, action) { |
|
5550 if ( value[ action ] ) { |
|
5551 animated[ action + "Class" ]( value[ action ] ); |
|
5552 } |
|
5553 }); |
|
5554 }; |
|
5555 applyClassChange(); |
|
5556 |
|
5557 // map all animated objects again - calculate new styles and diff |
|
5558 allAnimations = allAnimations.map(function() { |
|
5559 this.end = getElementStyles( this.el[ 0 ] ); |
|
5560 this.diff = styleDifference( this.start, this.end ); |
|
5561 return this; |
|
5562 }); |
|
5563 |
|
5564 // apply original class |
|
5565 animated.attr( "class", baseClass ); |
|
5566 |
|
5567 // map all animated objects again - this time collecting a promise |
|
5568 allAnimations = allAnimations.map(function() { |
|
5569 var styleInfo = this, |
|
5570 dfd = $.Deferred(), |
|
5571 opts = $.extend({}, o, { |
|
5572 queue: false, |
|
5573 complete: function() { |
|
5574 dfd.resolve( styleInfo ); |
|
5575 } |
|
5576 }); |
|
5577 |
|
5578 this.el.animate( this.diff, opts ); |
|
5579 return dfd.promise(); |
|
5580 }); |
|
5581 |
|
5582 // once all animations have completed: |
|
5583 $.when.apply( $, allAnimations.get() ).done(function() { |
|
5584 |
|
5585 // set the final class |
|
5586 applyClassChange(); |
|
5587 |
|
5588 // for each animated element, |
|
5589 // clear all css properties that were animated |
|
5590 $.each( arguments, function() { |
|
5591 var el = this.el; |
|
5592 $.each( this.diff, function(key) { |
|
5593 el.css( key, "" ); |
|
5594 }); |
|
5595 }); |
|
5596 |
|
5597 // this is guarnteed to be there if you use jQuery.speed() |
|
5598 // it also handles dequeuing the next anim... |
|
5599 o.complete.call( animated[ 0 ] ); |
|
5600 }); |
|
5601 }); |
|
5602 }; |
|
5603 |
|
5604 $.fn.extend({ |
|
5605 addClass: (function( orig ) { |
|
5606 return function( classNames, speed, easing, callback ) { |
|
5607 return speed ? |
|
5608 $.effects.animateClass.call( this, |
|
5609 { add: classNames }, speed, easing, callback ) : |
|
5610 orig.apply( this, arguments ); |
|
5611 }; |
|
5612 })( $.fn.addClass ), |
|
5613 |
|
5614 removeClass: (function( orig ) { |
|
5615 return function( classNames, speed, easing, callback ) { |
|
5616 return arguments.length > 1 ? |
|
5617 $.effects.animateClass.call( this, |
|
5618 { remove: classNames }, speed, easing, callback ) : |
|
5619 orig.apply( this, arguments ); |
|
5620 }; |
|
5621 })( $.fn.removeClass ), |
|
5622 |
|
5623 toggleClass: (function( orig ) { |
|
5624 return function( classNames, force, speed, easing, callback ) { |
|
5625 if ( typeof force === "boolean" || force === undefined ) { |
|
5626 if ( !speed ) { |
|
5627 // without speed parameter |
|
5628 return orig.apply( this, arguments ); |
|
5629 } else { |
|
5630 return $.effects.animateClass.call( this, |
|
5631 (force ? { add: classNames } : { remove: classNames }), |
|
5632 speed, easing, callback ); |
|
5633 } |
|
5634 } else { |
|
5635 // without force parameter |
|
5636 return $.effects.animateClass.call( this, |
|
5637 { toggle: classNames }, force, speed, easing ); |
|
5638 } |
|
5639 }; |
|
5640 })( $.fn.toggleClass ), |
|
5641 |
|
5642 switchClass: function( remove, add, speed, easing, callback) { |
|
5643 return $.effects.animateClass.call( this, { |
|
5644 add: add, |
|
5645 remove: remove |
|
5646 }, speed, easing, callback ); |
|
5647 } |
|
5648 }); |
|
5649 |
|
5650 })(); |
|
5651 |
|
5652 /******************************************************************************/ |
|
5653 /*********************************** EFFECTS **********************************/ |
|
5654 /******************************************************************************/ |
|
5655 |
|
5656 (function() { |
|
5657 |
|
5658 $.extend( $.effects, { |
|
5659 version: "1.10.3", |
|
5660 |
|
5661 // Saves a set of properties in a data storage |
|
5662 save: function( element, set ) { |
|
5663 for( var i=0; i < set.length; i++ ) { |
|
5664 if ( set[ i ] !== null ) { |
|
5665 element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] ); |
|
5666 } |
|
5667 } |
|
5668 }, |
|
5669 |
|
5670 // Restores a set of previously saved properties from a data storage |
|
5671 restore: function( element, set ) { |
|
5672 var val, i; |
|
5673 for( i=0; i < set.length; i++ ) { |
|
5674 if ( set[ i ] !== null ) { |
|
5675 val = element.data( dataSpace + set[ i ] ); |
|
5676 // support: jQuery 1.6.2 |
|
5677 // http://bugs.jquery.com/ticket/9917 |
|
5678 // jQuery 1.6.2 incorrectly returns undefined for any falsy value. |
|
5679 // We can't differentiate between "" and 0 here, so we just assume |
|
5680 // empty string since it's likely to be a more common value... |
|
5681 if ( val === undefined ) { |
|
5682 val = ""; |
|
5683 } |
|
5684 element.css( set[ i ], val ); |
|
5685 } |
|
5686 } |
|
5687 }, |
|
5688 |
|
5689 setMode: function( el, mode ) { |
|
5690 if (mode === "toggle") { |
|
5691 mode = el.is( ":hidden" ) ? "show" : "hide"; |
|
5692 } |
|
5693 return mode; |
|
5694 }, |
|
5695 |
|
5696 // Translates a [top,left] array into a baseline value |
|
5697 // this should be a little more flexible in the future to handle a string & hash |
|
5698 getBaseline: function( origin, original ) { |
|
5699 var y, x; |
|
5700 switch ( origin[ 0 ] ) { |
|
5701 case "top": y = 0; break; |
|
5702 case "middle": y = 0.5; break; |
|
5703 case "bottom": y = 1; break; |
|
5704 default: y = origin[ 0 ] / original.height; |
|
5705 } |
|
5706 switch ( origin[ 1 ] ) { |
|
5707 case "left": x = 0; break; |
|
5708 case "center": x = 0.5; break; |
|
5709 case "right": x = 1; break; |
|
5710 default: x = origin[ 1 ] / original.width; |
|
5711 } |
|
5712 return { |
|
5713 x: x, |
|
5714 y: y |
|
5715 }; |
|
5716 }, |
|
5717 |
|
5718 // Wraps the element around a wrapper that copies position properties |
|
5719 createWrapper: function( element ) { |
|
5720 |
|
5721 // if the element is already wrapped, return it |
|
5722 if ( element.parent().is( ".ui-effects-wrapper" )) { |
|
5723 return element.parent(); |
|
5724 } |
|
5725 |
|
5726 // wrap the element |
|
5727 var props = { |
|
5728 width: element.outerWidth(true), |
|
5729 height: element.outerHeight(true), |
|
5730 "float": element.css( "float" ) |
|
5731 }, |
|
5732 wrapper = $( "<div></div>" ) |
|
5733 .addClass( "ui-effects-wrapper" ) |
|
5734 .css({ |
|
5735 fontSize: "100%", |
|
5736 background: "transparent", |
|
5737 border: "none", |
|
5738 margin: 0, |
|
5739 padding: 0 |
|
5740 }), |
|
5741 // Store the size in case width/height are defined in % - Fixes #5245 |
|
5742 size = { |
|
5743 width: element.width(), |
|
5744 height: element.height() |
|
5745 }, |
|
5746 active = document.activeElement; |
|
5747 |
|
5748 // support: Firefox |
|
5749 // Firefox incorrectly exposes anonymous content |
|
5750 // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 |
|
5751 try { |
|
5752 active.id; |
|
5753 } catch( e ) { |
|
5754 active = document.body; |
|
5755 } |
|
5756 |
|
5757 element.wrap( wrapper ); |
|
5758 |
|
5759 // Fixes #7595 - Elements lose focus when wrapped. |
|
5760 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { |
|
5761 $( active ).focus(); |
|
5762 } |
|
5763 |
|
5764 wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element |
|
5765 |
|
5766 // transfer positioning properties to the wrapper |
|
5767 if ( element.css( "position" ) === "static" ) { |
|
5768 wrapper.css({ position: "relative" }); |
|
5769 element.css({ position: "relative" }); |
|
5770 } else { |
|
5771 $.extend( props, { |
|
5772 position: element.css( "position" ), |
|
5773 zIndex: element.css( "z-index" ) |
|
5774 }); |
|
5775 $.each([ "top", "left", "bottom", "right" ], function(i, pos) { |
|
5776 props[ pos ] = element.css( pos ); |
|
5777 if ( isNaN( parseInt( props[ pos ], 10 ) ) ) { |
|
5778 props[ pos ] = "auto"; |
|
5779 } |
|
5780 }); |
|
5781 element.css({ |
|
5782 position: "relative", |
|
5783 top: 0, |
|
5784 left: 0, |
|
5785 right: "auto", |
|
5786 bottom: "auto" |
|
5787 }); |
|
5788 } |
|
5789 element.css(size); |
|
5790 |
|
5791 return wrapper.css( props ).show(); |
|
5792 }, |
|
5793 |
|
5794 removeWrapper: function( element ) { |
|
5795 var active = document.activeElement; |
|
5796 |
|
5797 if ( element.parent().is( ".ui-effects-wrapper" ) ) { |
|
5798 element.parent().replaceWith( element ); |
|
5799 |
|
5800 // Fixes #7595 - Elements lose focus when wrapped. |
|
5801 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { |
|
5802 $( active ).focus(); |
|
5803 } |
|
5804 } |
|
5805 |
|
5806 |
|
5807 return element; |
|
5808 }, |
|
5809 |
|
5810 setTransition: function( element, list, factor, value ) { |
|
5811 value = value || {}; |
|
5812 $.each( list, function( i, x ) { |
|
5813 var unit = element.cssUnit( x ); |
|
5814 if ( unit[ 0 ] > 0 ) { |
|
5815 value[ x ] = unit[ 0 ] * factor + unit[ 1 ]; |
|
5816 } |
|
5817 }); |
|
5818 return value; |
|
5819 } |
|
5820 }); |
|
5821 |
|
5822 // return an effect options object for the given parameters: |
|
5823 function _normalizeArguments( effect, options, speed, callback ) { |
|
5824 |
|
5825 // allow passing all options as the first parameter |
|
5826 if ( $.isPlainObject( effect ) ) { |
|
5827 options = effect; |
|
5828 effect = effect.effect; |
|
5829 } |
|
5830 |
|
5831 // convert to an object |
|
5832 effect = { effect: effect }; |
|
5833 |
|
5834 // catch (effect, null, ...) |
|
5835 if ( options == null ) { |
|
5836 options = {}; |
|
5837 } |
|
5838 |
|
5839 // catch (effect, callback) |
|
5840 if ( $.isFunction( options ) ) { |
|
5841 callback = options; |
|
5842 speed = null; |
|
5843 options = {}; |
|
5844 } |
|
5845 |
|
5846 // catch (effect, speed, ?) |
|
5847 if ( typeof options === "number" || $.fx.speeds[ options ] ) { |
|
5848 callback = speed; |
|
5849 speed = options; |
|
5850 options = {}; |
|
5851 } |
|
5852 |
|
5853 // catch (effect, options, callback) |
|
5854 if ( $.isFunction( speed ) ) { |
|
5855 callback = speed; |
|
5856 speed = null; |
|
5857 } |
|
5858 |
|
5859 // add options to effect |
|
5860 if ( options ) { |
|
5861 $.extend( effect, options ); |
|
5862 } |
|
5863 |
|
5864 speed = speed || options.duration; |
|
5865 effect.duration = $.fx.off ? 0 : |
|
5866 typeof speed === "number" ? speed : |
|
5867 speed in $.fx.speeds ? $.fx.speeds[ speed ] : |
|
5868 $.fx.speeds._default; |
|
5869 |
|
5870 effect.complete = callback || options.complete; |
|
5871 |
|
5872 return effect; |
|
5873 } |
|
5874 |
|
5875 function standardAnimationOption( option ) { |
|
5876 // Valid standard speeds (nothing, number, named speed) |
|
5877 if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) { |
|
5878 return true; |
|
5879 } |
|
5880 |
|
5881 // Invalid strings - treat as "normal" speed |
|
5882 if ( typeof option === "string" && !$.effects.effect[ option ] ) { |
|
5883 return true; |
|
5884 } |
|
5885 |
|
5886 // Complete callback |
|
5887 if ( $.isFunction( option ) ) { |
|
5888 return true; |
|
5889 } |
|
5890 |
|
5891 // Options hash (but not naming an effect) |
|
5892 if ( typeof option === "object" && !option.effect ) { |
|
5893 return true; |
|
5894 } |
|
5895 |
|
5896 // Didn't match any standard API |
|
5897 return false; |
|
5898 } |
|
5899 |
|
5900 $.fn.extend({ |
|
5901 effect: function( /* effect, options, speed, callback */ ) { |
|
5902 var args = _normalizeArguments.apply( this, arguments ), |
|
5903 mode = args.mode, |
|
5904 queue = args.queue, |
|
5905 effectMethod = $.effects.effect[ args.effect ]; |
|
5906 |
|
5907 if ( $.fx.off || !effectMethod ) { |
|
5908 // delegate to the original method (e.g., .show()) if possible |
|
5909 if ( mode ) { |
|
5910 return this[ mode ]( args.duration, args.complete ); |
|
5911 } else { |
|
5912 return this.each( function() { |
|
5913 if ( args.complete ) { |
|
5914 args.complete.call( this ); |
|
5915 } |
|
5916 }); |
|
5917 } |
|
5918 } |
|
5919 |
|
5920 function run( next ) { |
|
5921 var elem = $( this ), |
|
5922 complete = args.complete, |
|
5923 mode = args.mode; |
|
5924 |
|
5925 function done() { |
|
5926 if ( $.isFunction( complete ) ) { |
|
5927 complete.call( elem[0] ); |
|
5928 } |
|
5929 if ( $.isFunction( next ) ) { |
|
5930 next(); |
|
5931 } |
|
5932 } |
|
5933 |
|
5934 // If the element already has the correct final state, delegate to |
|
5935 // the core methods so the internal tracking of "olddisplay" works. |
|
5936 if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) { |
|
5937 elem[ mode ](); |
|
5938 done(); |
|
5939 } else { |
|
5940 effectMethod.call( elem[0], args, done ); |
|
5941 } |
|
5942 } |
|
5943 |
|
5944 return queue === false ? this.each( run ) : this.queue( queue || "fx", run ); |
|
5945 }, |
|
5946 |
|
5947 show: (function( orig ) { |
|
5948 return function( option ) { |
|
5949 if ( standardAnimationOption( option ) ) { |
|
5950 return orig.apply( this, arguments ); |
|
5951 } else { |
|
5952 var args = _normalizeArguments.apply( this, arguments ); |
|
5953 args.mode = "show"; |
|
5954 return this.effect.call( this, args ); |
|
5955 } |
|
5956 }; |
|
5957 })( $.fn.show ), |
|
5958 |
|
5959 hide: (function( orig ) { |
|
5960 return function( option ) { |
|
5961 if ( standardAnimationOption( option ) ) { |
|
5962 return orig.apply( this, arguments ); |
|
5963 } else { |
|
5964 var args = _normalizeArguments.apply( this, arguments ); |
|
5965 args.mode = "hide"; |
|
5966 return this.effect.call( this, args ); |
|
5967 } |
|
5968 }; |
|
5969 })( $.fn.hide ), |
|
5970 |
|
5971 toggle: (function( orig ) { |
|
5972 return function( option ) { |
|
5973 if ( standardAnimationOption( option ) || typeof option === "boolean" ) { |
|
5974 return orig.apply( this, arguments ); |
|
5975 } else { |
|
5976 var args = _normalizeArguments.apply( this, arguments ); |
|
5977 args.mode = "toggle"; |
|
5978 return this.effect.call( this, args ); |
|
5979 } |
|
5980 }; |
|
5981 })( $.fn.toggle ), |
|
5982 |
|
5983 // helper functions |
|
5984 cssUnit: function(key) { |
|
5985 var style = this.css( key ), |
|
5986 val = []; |
|
5987 |
|
5988 $.each( [ "em", "px", "%", "pt" ], function( i, unit ) { |
|
5989 if ( style.indexOf( unit ) > 0 ) { |
|
5990 val = [ parseFloat( style ), unit ]; |
|
5991 } |
|
5992 }); |
|
5993 return val; |
|
5994 } |
|
5995 }); |
|
5996 |
|
5997 })(); |
|
5998 |
|
5999 /******************************************************************************/ |
|
6000 /*********************************** EASING ***********************************/ |
|
6001 /******************************************************************************/ |
|
6002 |
|
6003 (function() { |
|
6004 |
|
6005 // based on easing equations from Robert Penner (http://www.robertpenner.com/easing) |
|
6006 |
|
6007 var baseEasings = {}; |
|
6008 |
|
6009 $.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) { |
|
6010 baseEasings[ name ] = function( p ) { |
|
6011 return Math.pow( p, i + 2 ); |
|
6012 }; |
|
6013 }); |
|
6014 |
|
6015 $.extend( baseEasings, { |
|
6016 Sine: function ( p ) { |
|
6017 return 1 - Math.cos( p * Math.PI / 2 ); |
|
6018 }, |
|
6019 Circ: function ( p ) { |
|
6020 return 1 - Math.sqrt( 1 - p * p ); |
|
6021 }, |
|
6022 Elastic: function( p ) { |
|
6023 return p === 0 || p === 1 ? p : |
|
6024 -Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 ); |
|
6025 }, |
|
6026 Back: function( p ) { |
|
6027 return p * p * ( 3 * p - 2 ); |
|
6028 }, |
|
6029 Bounce: function ( p ) { |
|
6030 var pow2, |
|
6031 bounce = 4; |
|
6032 |
|
6033 while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {} |
|
6034 return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 ); |
|
6035 } |
|
6036 }); |
|
6037 |
|
6038 $.each( baseEasings, function( name, easeIn ) { |
|
6039 $.easing[ "easeIn" + name ] = easeIn; |
|
6040 $.easing[ "easeOut" + name ] = function( p ) { |
|
6041 return 1 - easeIn( 1 - p ); |
|
6042 }; |
|
6043 $.easing[ "easeInOut" + name ] = function( p ) { |
|
6044 return p < 0.5 ? |
|
6045 easeIn( p * 2 ) / 2 : |
|
6046 1 - easeIn( p * -2 + 2 ) / 2; |
|
6047 }; |
|
6048 }); |
|
6049 |
|
6050 })(); |
|
6051 |
|
6052 })(jQuery); |
|
6053 |
|
6054 (function( $, undefined ) { |
5289 (function( $, undefined ) { |
6055 |
5290 |
6056 var uid = 0, |
5291 var uid = 0, |
6057 hideProps = {}, |
5292 hideProps = {}, |
6058 showProps = {}; |
5293 showProps = {}; |
10424 } |
9640 } |
10425 }); |
9641 }); |
10426 } |
9642 } |
10427 |
9643 |
10428 }( jQuery ) ); |
9644 }( jQuery ) ); |
10429 |
|
10430 (function( $, undefined ) { |
9645 (function( $, undefined ) { |
10431 |
9646 |
10432 var rvertical = /up|down|vertical/, |
|
10433 rpositivemotion = /up|left|vertical|horizontal/; |
|
10434 |
|
10435 $.effects.effect.blind = function( o, done ) { |
|
10436 // Create element |
|
10437 var el = $( this ), |
|
10438 props = [ "position", "top", "bottom", "left", "right", "height", "width" ], |
|
10439 mode = $.effects.setMode( el, o.mode || "hide" ), |
|
10440 direction = o.direction || "up", |
|
10441 vertical = rvertical.test( direction ), |
|
10442 ref = vertical ? "height" : "width", |
|
10443 ref2 = vertical ? "top" : "left", |
|
10444 motion = rpositivemotion.test( direction ), |
|
10445 animation = {}, |
|
10446 show = mode === "show", |
|
10447 wrapper, distance, margin; |
|
10448 |
|
10449 // if already wrapped, the wrapper's properties are my property. #6245 |
|
10450 if ( el.parent().is( ".ui-effects-wrapper" ) ) { |
|
10451 $.effects.save( el.parent(), props ); |
|
10452 } else { |
|
10453 $.effects.save( el, props ); |
|
10454 } |
|
10455 el.show(); |
|
10456 wrapper = $.effects.createWrapper( el ).css({ |
|
10457 overflow: "hidden" |
|
10458 }); |
|
10459 |
|
10460 distance = wrapper[ ref ](); |
|
10461 margin = parseFloat( wrapper.css( ref2 ) ) || 0; |
|
10462 |
|
10463 animation[ ref ] = show ? distance : 0; |
|
10464 if ( !motion ) { |
|
10465 el |
|
10466 .css( vertical ? "bottom" : "right", 0 ) |
|
10467 .css( vertical ? "top" : "left", "auto" ) |
|
10468 .css({ position: "absolute" }); |
|
10469 |
|
10470 animation[ ref2 ] = show ? margin : distance + margin; |
|
10471 } |
|
10472 |
|
10473 // start at 0 if we are showing |
|
10474 if ( show ) { |
|
10475 wrapper.css( ref, 0 ); |
|
10476 if ( ! motion ) { |
|
10477 wrapper.css( ref2, margin + distance ); |
|
10478 } |
|
10479 } |
|
10480 |
|
10481 // Animate |
|
10482 wrapper.animate( animation, { |
|
10483 duration: o.duration, |
|
10484 easing: o.easing, |
|
10485 queue: false, |
|
10486 complete: function() { |
|
10487 if ( mode === "hide" ) { |
|
10488 el.hide(); |
|
10489 } |
|
10490 $.effects.restore( el, props ); |
|
10491 $.effects.removeWrapper( el ); |
|
10492 done(); |
|
10493 } |
|
10494 }); |
|
10495 |
|
10496 }; |
|
10497 |
|
10498 })(jQuery); |
|
10499 |
|
10500 (function( $, undefined ) { |
|
10501 |
|
10502 $.effects.effect.bounce = function( o, done ) { |
|
10503 var el = $( this ), |
|
10504 props = [ "position", "top", "bottom", "left", "right", "height", "width" ], |
|
10505 |
|
10506 // defaults: |
|
10507 mode = $.effects.setMode( el, o.mode || "effect" ), |
|
10508 hide = mode === "hide", |
|
10509 show = mode === "show", |
|
10510 direction = o.direction || "up", |
|
10511 distance = o.distance, |
|
10512 times = o.times || 5, |
|
10513 |
|
10514 // number of internal animations |
|
10515 anims = times * 2 + ( show || hide ? 1 : 0 ), |
|
10516 speed = o.duration / anims, |
|
10517 easing = o.easing, |
|
10518 |
|
10519 // utility: |
|
10520 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", |
|
10521 motion = ( direction === "up" || direction === "left" ), |
|
10522 i, |
|
10523 upAnim, |
|
10524 downAnim, |
|
10525 |
|
10526 // we will need to re-assemble the queue to stack our animations in place |
|
10527 queue = el.queue(), |
|
10528 queuelen = queue.length; |
|
10529 |
|
10530 // Avoid touching opacity to prevent clearType and PNG issues in IE |
|
10531 if ( show || hide ) { |
|
10532 props.push( "opacity" ); |
|
10533 } |
|
10534 |
|
10535 $.effects.save( el, props ); |
|
10536 el.show(); |
|
10537 $.effects.createWrapper( el ); // Create Wrapper |
|
10538 |
|
10539 // default distance for the BIGGEST bounce is the outer Distance / 3 |
|
10540 if ( !distance ) { |
|
10541 distance = el[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3; |
|
10542 } |
|
10543 |
|
10544 if ( show ) { |
|
10545 downAnim = { opacity: 1 }; |
|
10546 downAnim[ ref ] = 0; |
|
10547 |
|
10548 // if we are showing, force opacity 0 and set the initial position |
|
10549 // then do the "first" animation |
|
10550 el.css( "opacity", 0 ) |
|
10551 .css( ref, motion ? -distance * 2 : distance * 2 ) |
|
10552 .animate( downAnim, speed, easing ); |
|
10553 } |
|
10554 |
|
10555 // start at the smallest distance if we are hiding |
|
10556 if ( hide ) { |
|
10557 distance = distance / Math.pow( 2, times - 1 ); |
|
10558 } |
|
10559 |
|
10560 downAnim = {}; |
|
10561 downAnim[ ref ] = 0; |
|
10562 // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here |
|
10563 for ( i = 0; i < times; i++ ) { |
|
10564 upAnim = {}; |
|
10565 upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; |
|
10566 |
|
10567 el.animate( upAnim, speed, easing ) |
|
10568 .animate( downAnim, speed, easing ); |
|
10569 |
|
10570 distance = hide ? distance * 2 : distance / 2; |
|
10571 } |
|
10572 |
|
10573 // Last Bounce when Hiding |
|
10574 if ( hide ) { |
|
10575 upAnim = { opacity: 0 }; |
|
10576 upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; |
|
10577 |
|
10578 el.animate( upAnim, speed, easing ); |
|
10579 } |
|
10580 |
|
10581 el.queue(function() { |
|
10582 if ( hide ) { |
|
10583 el.hide(); |
|
10584 } |
|
10585 $.effects.restore( el, props ); |
|
10586 $.effects.removeWrapper( el ); |
|
10587 done(); |
|
10588 }); |
|
10589 |
|
10590 // inject all the animations we just queued to be first in line (after "inprogress") |
|
10591 if ( queuelen > 1) { |
|
10592 queue.splice.apply( queue, |
|
10593 [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) ); |
|
10594 } |
|
10595 el.dequeue(); |
|
10596 |
|
10597 }; |
|
10598 |
|
10599 })(jQuery); |
|
10600 |
|
10601 (function( $, undefined ) { |
|
10602 |
|
10603 $.effects.effect.clip = function( o, done ) { |
|
10604 // Create element |
|
10605 var el = $( this ), |
|
10606 props = [ "position", "top", "bottom", "left", "right", "height", "width" ], |
|
10607 mode = $.effects.setMode( el, o.mode || "hide" ), |
|
10608 show = mode === "show", |
|
10609 direction = o.direction || "vertical", |
|
10610 vert = direction === "vertical", |
|
10611 size = vert ? "height" : "width", |
|
10612 position = vert ? "top" : "left", |
|
10613 animation = {}, |
|
10614 wrapper, animate, distance; |
|
10615 |
|
10616 // Save & Show |
|
10617 $.effects.save( el, props ); |
|
10618 el.show(); |
|
10619 |
|
10620 // Create Wrapper |
|
10621 wrapper = $.effects.createWrapper( el ).css({ |
|
10622 overflow: "hidden" |
|
10623 }); |
|
10624 animate = ( el[0].tagName === "IMG" ) ? wrapper : el; |
|
10625 distance = animate[ size ](); |
|
10626 |
|
10627 // Shift |
|
10628 if ( show ) { |
|
10629 animate.css( size, 0 ); |
|
10630 animate.css( position, distance / 2 ); |
|
10631 } |
|
10632 |
|
10633 // Create Animation Object: |
|
10634 animation[ size ] = show ? distance : 0; |
|
10635 animation[ position ] = show ? 0 : distance / 2; |
|
10636 |
|
10637 // Animate |
|
10638 animate.animate( animation, { |
|
10639 queue: false, |
|
10640 duration: o.duration, |
|
10641 easing: o.easing, |
|
10642 complete: function() { |
|
10643 if ( !show ) { |
|
10644 el.hide(); |
|
10645 } |
|
10646 $.effects.restore( el, props ); |
|
10647 $.effects.removeWrapper( el ); |
|
10648 done(); |
|
10649 } |
|
10650 }); |
|
10651 |
|
10652 }; |
|
10653 |
|
10654 })(jQuery); |
|
10655 |
|
10656 (function( $, undefined ) { |
|
10657 |
|
10658 $.effects.effect.drop = function( o, done ) { |
|
10659 |
|
10660 var el = $( this ), |
|
10661 props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ], |
|
10662 mode = $.effects.setMode( el, o.mode || "hide" ), |
|
10663 show = mode === "show", |
|
10664 direction = o.direction || "left", |
|
10665 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", |
|
10666 motion = ( direction === "up" || direction === "left" ) ? "pos" : "neg", |
|
10667 animation = { |
|
10668 opacity: show ? 1 : 0 |
|
10669 }, |
|
10670 distance; |
|
10671 |
|
10672 // Adjust |
|
10673 $.effects.save( el, props ); |
|
10674 el.show(); |
|
10675 $.effects.createWrapper( el ); |
|
10676 |
|
10677 distance = o.distance || el[ ref === "top" ? "outerHeight": "outerWidth" ]( true ) / 2; |
|
10678 |
|
10679 if ( show ) { |
|
10680 el |
|
10681 .css( "opacity", 0 ) |
|
10682 .css( ref, motion === "pos" ? -distance : distance ); |
|
10683 } |
|
10684 |
|
10685 // Animation |
|
10686 animation[ ref ] = ( show ? |
|
10687 ( motion === "pos" ? "+=" : "-=" ) : |
|
10688 ( motion === "pos" ? "-=" : "+=" ) ) + |
|
10689 distance; |
|
10690 |
|
10691 // Animate |
|
10692 el.animate( animation, { |
|
10693 queue: false, |
|
10694 duration: o.duration, |
|
10695 easing: o.easing, |
|
10696 complete: function() { |
|
10697 if ( mode === "hide" ) { |
|
10698 el.hide(); |
|
10699 } |
|
10700 $.effects.restore( el, props ); |
|
10701 $.effects.removeWrapper( el ); |
|
10702 done(); |
|
10703 } |
|
10704 }); |
|
10705 }; |
|
10706 |
|
10707 })(jQuery); |
|
10708 |
|
10709 (function( $, undefined ) { |
|
10710 |
|
10711 $.effects.effect.explode = function( o, done ) { |
|
10712 |
|
10713 var rows = o.pieces ? Math.round( Math.sqrt( o.pieces ) ) : 3, |
|
10714 cells = rows, |
|
10715 el = $( this ), |
|
10716 mode = $.effects.setMode( el, o.mode || "hide" ), |
|
10717 show = mode === "show", |
|
10718 |
|
10719 // show and then visibility:hidden the element before calculating offset |
|
10720 offset = el.show().css( "visibility", "hidden" ).offset(), |
|
10721 |
|
10722 // width and height of a piece |
|
10723 width = Math.ceil( el.outerWidth() / cells ), |
|
10724 height = Math.ceil( el.outerHeight() / rows ), |
|
10725 pieces = [], |
|
10726 |
|
10727 // loop |
|
10728 i, j, left, top, mx, my; |
|
10729 |
|
10730 // children animate complete: |
|
10731 function childComplete() { |
|
10732 pieces.push( this ); |
|
10733 if ( pieces.length === rows * cells ) { |
|
10734 animComplete(); |
|
10735 } |
|
10736 } |
|
10737 |
|
10738 // clone the element for each row and cell. |
|
10739 for( i = 0; i < rows ; i++ ) { // ===> |
|
10740 top = offset.top + i * height; |
|
10741 my = i - ( rows - 1 ) / 2 ; |
|
10742 |
|
10743 for( j = 0; j < cells ; j++ ) { // ||| |
|
10744 left = offset.left + j * width; |
|
10745 mx = j - ( cells - 1 ) / 2 ; |
|
10746 |
|
10747 // Create a clone of the now hidden main element that will be absolute positioned |
|
10748 // within a wrapper div off the -left and -top equal to size of our pieces |
|
10749 el |
|
10750 .clone() |
|
10751 .appendTo( "body" ) |
|
10752 .wrap( "<div></div>" ) |
|
10753 .css({ |
|
10754 position: "absolute", |
|
10755 visibility: "visible", |
|
10756 left: -j * width, |
|
10757 top: -i * height |
|
10758 }) |
|
10759 |
|
10760 // select the wrapper - make it overflow: hidden and absolute positioned based on |
|
10761 // where the original was located +left and +top equal to the size of pieces |
|
10762 .parent() |
|
10763 .addClass( "ui-effects-explode" ) |
|
10764 .css({ |
|
10765 position: "absolute", |
|
10766 overflow: "hidden", |
|
10767 width: width, |
|
10768 height: height, |
|
10769 left: left + ( show ? mx * width : 0 ), |
|
10770 top: top + ( show ? my * height : 0 ), |
|
10771 opacity: show ? 0 : 1 |
|
10772 }).animate({ |
|
10773 left: left + ( show ? 0 : mx * width ), |
|
10774 top: top + ( show ? 0 : my * height ), |
|
10775 opacity: show ? 1 : 0 |
|
10776 }, o.duration || 500, o.easing, childComplete ); |
|
10777 } |
|
10778 } |
|
10779 |
|
10780 function animComplete() { |
|
10781 el.css({ |
|
10782 visibility: "visible" |
|
10783 }); |
|
10784 $( pieces ).remove(); |
|
10785 if ( !show ) { |
|
10786 el.hide(); |
|
10787 } |
|
10788 done(); |
|
10789 } |
|
10790 }; |
|
10791 |
|
10792 })(jQuery); |
|
10793 |
|
10794 (function( $, undefined ) { |
|
10795 |
|
10796 $.effects.effect.fade = function( o, done ) { |
|
10797 var el = $( this ), |
|
10798 mode = $.effects.setMode( el, o.mode || "toggle" ); |
|
10799 |
|
10800 el.animate({ |
|
10801 opacity: mode |
|
10802 }, { |
|
10803 queue: false, |
|
10804 duration: o.duration, |
|
10805 easing: o.easing, |
|
10806 complete: done |
|
10807 }); |
|
10808 }; |
|
10809 |
|
10810 })( jQuery ); |
|
10811 |
|
10812 (function( $, undefined ) { |
|
10813 |
|
10814 $.effects.effect.fold = function( o, done ) { |
|
10815 |
|
10816 // Create element |
|
10817 var el = $( this ), |
|
10818 props = [ "position", "top", "bottom", "left", "right", "height", "width" ], |
|
10819 mode = $.effects.setMode( el, o.mode || "hide" ), |
|
10820 show = mode === "show", |
|
10821 hide = mode === "hide", |
|
10822 size = o.size || 15, |
|
10823 percent = /([0-9]+)%/.exec( size ), |
|
10824 horizFirst = !!o.horizFirst, |
|
10825 widthFirst = show !== horizFirst, |
|
10826 ref = widthFirst ? [ "width", "height" ] : [ "height", "width" ], |
|
10827 duration = o.duration / 2, |
|
10828 wrapper, distance, |
|
10829 animation1 = {}, |
|
10830 animation2 = {}; |
|
10831 |
|
10832 $.effects.save( el, props ); |
|
10833 el.show(); |
|
10834 |
|
10835 // Create Wrapper |
|
10836 wrapper = $.effects.createWrapper( el ).css({ |
|
10837 overflow: "hidden" |
|
10838 }); |
|
10839 distance = widthFirst ? |
|
10840 [ wrapper.width(), wrapper.height() ] : |
|
10841 [ wrapper.height(), wrapper.width() ]; |
|
10842 |
|
10843 if ( percent ) { |
|
10844 size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ]; |
|
10845 } |
|
10846 if ( show ) { |
|
10847 wrapper.css( horizFirst ? { |
|
10848 height: 0, |
|
10849 width: size |
|
10850 } : { |
|
10851 height: size, |
|
10852 width: 0 |
|
10853 }); |
|
10854 } |
|
10855 |
|
10856 // Animation |
|
10857 animation1[ ref[ 0 ] ] = show ? distance[ 0 ] : size; |
|
10858 animation2[ ref[ 1 ] ] = show ? distance[ 1 ] : 0; |
|
10859 |
|
10860 // Animate |
|
10861 wrapper |
|
10862 .animate( animation1, duration, o.easing ) |
|
10863 .animate( animation2, duration, o.easing, function() { |
|
10864 if ( hide ) { |
|
10865 el.hide(); |
|
10866 } |
|
10867 $.effects.restore( el, props ); |
|
10868 $.effects.removeWrapper( el ); |
|
10869 done(); |
|
10870 }); |
|
10871 |
|
10872 }; |
|
10873 |
|
10874 })(jQuery); |
|
10875 |
|
10876 (function( $, undefined ) { |
|
10877 |
|
10878 $.effects.effect.highlight = function( o, done ) { |
|
10879 var elem = $( this ), |
|
10880 props = [ "backgroundImage", "backgroundColor", "opacity" ], |
|
10881 mode = $.effects.setMode( elem, o.mode || "show" ), |
|
10882 animation = { |
|
10883 backgroundColor: elem.css( "backgroundColor" ) |
|
10884 }; |
|
10885 |
|
10886 if (mode === "hide") { |
|
10887 animation.opacity = 0; |
|
10888 } |
|
10889 |
|
10890 $.effects.save( elem, props ); |
|
10891 |
|
10892 elem |
|
10893 .show() |
|
10894 .css({ |
|
10895 backgroundImage: "none", |
|
10896 backgroundColor: o.color || "#ffff99" |
|
10897 }) |
|
10898 .animate( animation, { |
|
10899 queue: false, |
|
10900 duration: o.duration, |
|
10901 easing: o.easing, |
|
10902 complete: function() { |
|
10903 if ( mode === "hide" ) { |
|
10904 elem.hide(); |
|
10905 } |
|
10906 $.effects.restore( elem, props ); |
|
10907 done(); |
|
10908 } |
|
10909 }); |
|
10910 }; |
|
10911 |
|
10912 })(jQuery); |
|
10913 |
|
10914 (function( $, undefined ) { |
|
10915 |
|
10916 $.effects.effect.pulsate = function( o, done ) { |
|
10917 var elem = $( this ), |
|
10918 mode = $.effects.setMode( elem, o.mode || "show" ), |
|
10919 show = mode === "show", |
|
10920 hide = mode === "hide", |
|
10921 showhide = ( show || mode === "hide" ), |
|
10922 |
|
10923 // showing or hiding leaves of the "last" animation |
|
10924 anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ), |
|
10925 duration = o.duration / anims, |
|
10926 animateTo = 0, |
|
10927 queue = elem.queue(), |
|
10928 queuelen = queue.length, |
|
10929 i; |
|
10930 |
|
10931 if ( show || !elem.is(":visible")) { |
|
10932 elem.css( "opacity", 0 ).show(); |
|
10933 animateTo = 1; |
|
10934 } |
|
10935 |
|
10936 // anims - 1 opacity "toggles" |
|
10937 for ( i = 1; i < anims; i++ ) { |
|
10938 elem.animate({ |
|
10939 opacity: animateTo |
|
10940 }, duration, o.easing ); |
|
10941 animateTo = 1 - animateTo; |
|
10942 } |
|
10943 |
|
10944 elem.animate({ |
|
10945 opacity: animateTo |
|
10946 }, duration, o.easing); |
|
10947 |
|
10948 elem.queue(function() { |
|
10949 if ( hide ) { |
|
10950 elem.hide(); |
|
10951 } |
|
10952 done(); |
|
10953 }); |
|
10954 |
|
10955 // We just queued up "anims" animations, we need to put them next in the queue |
|
10956 if ( queuelen > 1 ) { |
|
10957 queue.splice.apply( queue, |
|
10958 [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) ); |
|
10959 } |
|
10960 elem.dequeue(); |
|
10961 }; |
|
10962 |
|
10963 })(jQuery); |
|
10964 |
|
10965 (function( $, undefined ) { |
|
10966 |
|
10967 $.effects.effect.puff = function( o, done ) { |
|
10968 var elem = $( this ), |
|
10969 mode = $.effects.setMode( elem, o.mode || "hide" ), |
|
10970 hide = mode === "hide", |
|
10971 percent = parseInt( o.percent, 10 ) || 150, |
|
10972 factor = percent / 100, |
|
10973 original = { |
|
10974 height: elem.height(), |
|
10975 width: elem.width(), |
|
10976 outerHeight: elem.outerHeight(), |
|
10977 outerWidth: elem.outerWidth() |
|
10978 }; |
|
10979 |
|
10980 $.extend( o, { |
|
10981 effect: "scale", |
|
10982 queue: false, |
|
10983 fade: true, |
|
10984 mode: mode, |
|
10985 complete: done, |
|
10986 percent: hide ? percent : 100, |
|
10987 from: hide ? |
|
10988 original : |
|
10989 { |
|
10990 height: original.height * factor, |
|
10991 width: original.width * factor, |
|
10992 outerHeight: original.outerHeight * factor, |
|
10993 outerWidth: original.outerWidth * factor |
|
10994 } |
|
10995 }); |
|
10996 |
|
10997 elem.effect( o ); |
|
10998 }; |
|
10999 |
|
11000 $.effects.effect.scale = function( o, done ) { |
|
11001 |
|
11002 // Create element |
|
11003 var el = $( this ), |
|
11004 options = $.extend( true, {}, o ), |
|
11005 mode = $.effects.setMode( el, o.mode || "effect" ), |
|
11006 percent = parseInt( o.percent, 10 ) || |
|
11007 ( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode === "hide" ? 0 : 100 ) ), |
|
11008 direction = o.direction || "both", |
|
11009 origin = o.origin, |
|
11010 original = { |
|
11011 height: el.height(), |
|
11012 width: el.width(), |
|
11013 outerHeight: el.outerHeight(), |
|
11014 outerWidth: el.outerWidth() |
|
11015 }, |
|
11016 factor = { |
|
11017 y: direction !== "horizontal" ? (percent / 100) : 1, |
|
11018 x: direction !== "vertical" ? (percent / 100) : 1 |
|
11019 }; |
|
11020 |
|
11021 // We are going to pass this effect to the size effect: |
|
11022 options.effect = "size"; |
|
11023 options.queue = false; |
|
11024 options.complete = done; |
|
11025 |
|
11026 // Set default origin and restore for show/hide |
|
11027 if ( mode !== "effect" ) { |
|
11028 options.origin = origin || ["middle","center"]; |
|
11029 options.restore = true; |
|
11030 } |
|
11031 |
|
11032 options.from = o.from || ( mode === "show" ? { |
|
11033 height: 0, |
|
11034 width: 0, |
|
11035 outerHeight: 0, |
|
11036 outerWidth: 0 |
|
11037 } : original ); |
|
11038 options.to = { |
|
11039 height: original.height * factor.y, |
|
11040 width: original.width * factor.x, |
|
11041 outerHeight: original.outerHeight * factor.y, |
|
11042 outerWidth: original.outerWidth * factor.x |
|
11043 }; |
|
11044 |
|
11045 // Fade option to support puff |
|
11046 if ( options.fade ) { |
|
11047 if ( mode === "show" ) { |
|
11048 options.from.opacity = 0; |
|
11049 options.to.opacity = 1; |
|
11050 } |
|
11051 if ( mode === "hide" ) { |
|
11052 options.from.opacity = 1; |
|
11053 options.to.opacity = 0; |
|
11054 } |
|
11055 } |
|
11056 |
|
11057 // Animate |
|
11058 el.effect( options ); |
|
11059 |
|
11060 }; |
|
11061 |
|
11062 $.effects.effect.size = function( o, done ) { |
|
11063 |
|
11064 // Create element |
|
11065 var original, baseline, factor, |
|
11066 el = $( this ), |
|
11067 props0 = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ], |
|
11068 |
|
11069 // Always restore |
|
11070 props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ], |
|
11071 |
|
11072 // Copy for children |
|
11073 props2 = [ "width", "height", "overflow" ], |
|
11074 cProps = [ "fontSize" ], |
|
11075 vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ], |
|
11076 hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ], |
|
11077 |
|
11078 // Set options |
|
11079 mode = $.effects.setMode( el, o.mode || "effect" ), |
|
11080 restore = o.restore || mode !== "effect", |
|
11081 scale = o.scale || "both", |
|
11082 origin = o.origin || [ "middle", "center" ], |
|
11083 position = el.css( "position" ), |
|
11084 props = restore ? props0 : props1, |
|
11085 zero = { |
|
11086 height: 0, |
|
11087 width: 0, |
|
11088 outerHeight: 0, |
|
11089 outerWidth: 0 |
|
11090 }; |
|
11091 |
|
11092 if ( mode === "show" ) { |
|
11093 el.show(); |
|
11094 } |
|
11095 original = { |
|
11096 height: el.height(), |
|
11097 width: el.width(), |
|
11098 outerHeight: el.outerHeight(), |
|
11099 outerWidth: el.outerWidth() |
|
11100 }; |
|
11101 |
|
11102 if ( o.mode === "toggle" && mode === "show" ) { |
|
11103 el.from = o.to || zero; |
|
11104 el.to = o.from || original; |
|
11105 } else { |
|
11106 el.from = o.from || ( mode === "show" ? zero : original ); |
|
11107 el.to = o.to || ( mode === "hide" ? zero : original ); |
|
11108 } |
|
11109 |
|
11110 // Set scaling factor |
|
11111 factor = { |
|
11112 from: { |
|
11113 y: el.from.height / original.height, |
|
11114 x: el.from.width / original.width |
|
11115 }, |
|
11116 to: { |
|
11117 y: el.to.height / original.height, |
|
11118 x: el.to.width / original.width |
|
11119 } |
|
11120 }; |
|
11121 |
|
11122 // Scale the css box |
|
11123 if ( scale === "box" || scale === "both" ) { |
|
11124 |
|
11125 // Vertical props scaling |
|
11126 if ( factor.from.y !== factor.to.y ) { |
|
11127 props = props.concat( vProps ); |
|
11128 el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from ); |
|
11129 el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to ); |
|
11130 } |
|
11131 |
|
11132 // Horizontal props scaling |
|
11133 if ( factor.from.x !== factor.to.x ) { |
|
11134 props = props.concat( hProps ); |
|
11135 el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from ); |
|
11136 el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to ); |
|
11137 } |
|
11138 } |
|
11139 |
|
11140 // Scale the content |
|
11141 if ( scale === "content" || scale === "both" ) { |
|
11142 |
|
11143 // Vertical props scaling |
|
11144 if ( factor.from.y !== factor.to.y ) { |
|
11145 props = props.concat( cProps ).concat( props2 ); |
|
11146 el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from ); |
|
11147 el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to ); |
|
11148 } |
|
11149 } |
|
11150 |
|
11151 $.effects.save( el, props ); |
|
11152 el.show(); |
|
11153 $.effects.createWrapper( el ); |
|
11154 el.css( "overflow", "hidden" ).css( el.from ); |
|
11155 |
|
11156 // Adjust |
|
11157 if (origin) { // Calculate baseline shifts |
|
11158 baseline = $.effects.getBaseline( origin, original ); |
|
11159 el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y; |
|
11160 el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x; |
|
11161 el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y; |
|
11162 el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x; |
|
11163 } |
|
11164 el.css( el.from ); // set top & left |
|
11165 |
|
11166 // Animate |
|
11167 if ( scale === "content" || scale === "both" ) { // Scale the children |
|
11168 |
|
11169 // Add margins/font-size |
|
11170 vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps); |
|
11171 hProps = hProps.concat([ "marginLeft", "marginRight" ]); |
|
11172 props2 = props0.concat(vProps).concat(hProps); |
|
11173 |
|
11174 el.find( "*[width]" ).each( function(){ |
|
11175 var child = $( this ), |
|
11176 c_original = { |
|
11177 height: child.height(), |
|
11178 width: child.width(), |
|
11179 outerHeight: child.outerHeight(), |
|
11180 outerWidth: child.outerWidth() |
|
11181 }; |
|
11182 if (restore) { |
|
11183 $.effects.save(child, props2); |
|
11184 } |
|
11185 |
|
11186 child.from = { |
|
11187 height: c_original.height * factor.from.y, |
|
11188 width: c_original.width * factor.from.x, |
|
11189 outerHeight: c_original.outerHeight * factor.from.y, |
|
11190 outerWidth: c_original.outerWidth * factor.from.x |
|
11191 }; |
|
11192 child.to = { |
|
11193 height: c_original.height * factor.to.y, |
|
11194 width: c_original.width * factor.to.x, |
|
11195 outerHeight: c_original.height * factor.to.y, |
|
11196 outerWidth: c_original.width * factor.to.x |
|
11197 }; |
|
11198 |
|
11199 // Vertical props scaling |
|
11200 if ( factor.from.y !== factor.to.y ) { |
|
11201 child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from ); |
|
11202 child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to ); |
|
11203 } |
|
11204 |
|
11205 // Horizontal props scaling |
|
11206 if ( factor.from.x !== factor.to.x ) { |
|
11207 child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from ); |
|
11208 child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to ); |
|
11209 } |
|
11210 |
|
11211 // Animate children |
|
11212 child.css( child.from ); |
|
11213 child.animate( child.to, o.duration, o.easing, function() { |
|
11214 |
|
11215 // Restore children |
|
11216 if ( restore ) { |
|
11217 $.effects.restore( child, props2 ); |
|
11218 } |
|
11219 }); |
|
11220 }); |
|
11221 } |
|
11222 |
|
11223 // Animate |
|
11224 el.animate( el.to, { |
|
11225 queue: false, |
|
11226 duration: o.duration, |
|
11227 easing: o.easing, |
|
11228 complete: function() { |
|
11229 if ( el.to.opacity === 0 ) { |
|
11230 el.css( "opacity", el.from.opacity ); |
|
11231 } |
|
11232 if( mode === "hide" ) { |
|
11233 el.hide(); |
|
11234 } |
|
11235 $.effects.restore( el, props ); |
|
11236 if ( !restore ) { |
|
11237 |
|
11238 // we need to calculate our new positioning based on the scaling |
|
11239 if ( position === "static" ) { |
|
11240 el.css({ |
|
11241 position: "relative", |
|
11242 top: el.to.top, |
|
11243 left: el.to.left |
|
11244 }); |
|
11245 } else { |
|
11246 $.each([ "top", "left" ], function( idx, pos ) { |
|
11247 el.css( pos, function( _, str ) { |
|
11248 var val = parseInt( str, 10 ), |
|
11249 toRef = idx ? el.to.left : el.to.top; |
|
11250 |
|
11251 // if original was "auto", recalculate the new value from wrapper |
|
11252 if ( str === "auto" ) { |
|
11253 return toRef + "px"; |
|
11254 } |
|
11255 |
|
11256 return val + toRef + "px"; |
|
11257 }); |
|
11258 }); |
|
11259 } |
|
11260 } |
|
11261 |
|
11262 $.effects.removeWrapper( el ); |
|
11263 done(); |
|
11264 } |
|
11265 }); |
|
11266 |
|
11267 }; |
|
11268 |
|
11269 })(jQuery); |
|
11270 |
|
11271 (function( $, undefined ) { |
|
11272 |
|
11273 $.effects.effect.shake = function( o, done ) { |
|
11274 |
|
11275 var el = $( this ), |
|
11276 props = [ "position", "top", "bottom", "left", "right", "height", "width" ], |
|
11277 mode = $.effects.setMode( el, o.mode || "effect" ), |
|
11278 direction = o.direction || "left", |
|
11279 distance = o.distance || 20, |
|
11280 times = o.times || 3, |
|
11281 anims = times * 2 + 1, |
|
11282 speed = Math.round(o.duration/anims), |
|
11283 ref = (direction === "up" || direction === "down") ? "top" : "left", |
|
11284 positiveMotion = (direction === "up" || direction === "left"), |
|
11285 animation = {}, |
|
11286 animation1 = {}, |
|
11287 animation2 = {}, |
|
11288 i, |
|
11289 |
|
11290 // we will need to re-assemble the queue to stack our animations in place |
|
11291 queue = el.queue(), |
|
11292 queuelen = queue.length; |
|
11293 |
|
11294 $.effects.save( el, props ); |
|
11295 el.show(); |
|
11296 $.effects.createWrapper( el ); |
|
11297 |
|
11298 // Animation |
|
11299 animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance; |
|
11300 animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2; |
|
11301 animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2; |
|
11302 |
|
11303 // Animate |
|
11304 el.animate( animation, speed, o.easing ); |
|
11305 |
|
11306 // Shakes |
|
11307 for ( i = 1; i < times; i++ ) { |
|
11308 el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing ); |
|
11309 } |
|
11310 el |
|
11311 .animate( animation1, speed, o.easing ) |
|
11312 .animate( animation, speed / 2, o.easing ) |
|
11313 .queue(function() { |
|
11314 if ( mode === "hide" ) { |
|
11315 el.hide(); |
|
11316 } |
|
11317 $.effects.restore( el, props ); |
|
11318 $.effects.removeWrapper( el ); |
|
11319 done(); |
|
11320 }); |
|
11321 |
|
11322 // inject all the animations we just queued to be first in line (after "inprogress") |
|
11323 if ( queuelen > 1) { |
|
11324 queue.splice.apply( queue, |
|
11325 [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) ); |
|
11326 } |
|
11327 el.dequeue(); |
|
11328 |
|
11329 }; |
|
11330 |
|
11331 })(jQuery); |
|
11332 |
|
11333 (function( $, undefined ) { |
|
11334 |
|
11335 $.effects.effect.slide = function( o, done ) { |
|
11336 |
|
11337 // Create element |
|
11338 var el = $( this ), |
|
11339 props = [ "position", "top", "bottom", "left", "right", "width", "height" ], |
|
11340 mode = $.effects.setMode( el, o.mode || "show" ), |
|
11341 show = mode === "show", |
|
11342 direction = o.direction || "left", |
|
11343 ref = (direction === "up" || direction === "down") ? "top" : "left", |
|
11344 positiveMotion = (direction === "up" || direction === "left"), |
|
11345 distance, |
|
11346 animation = {}; |
|
11347 |
|
11348 // Adjust |
|
11349 $.effects.save( el, props ); |
|
11350 el.show(); |
|
11351 distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ); |
|
11352 |
|
11353 $.effects.createWrapper( el ).css({ |
|
11354 overflow: "hidden" |
|
11355 }); |
|
11356 |
|
11357 if ( show ) { |
|
11358 el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance ); |
|
11359 } |
|
11360 |
|
11361 // Animation |
|
11362 animation[ ref ] = ( show ? |
|
11363 ( positiveMotion ? "+=" : "-=") : |
|
11364 ( positiveMotion ? "-=" : "+=")) + |
|
11365 distance; |
|
11366 |
|
11367 // Animate |
|
11368 el.animate( animation, { |
|
11369 queue: false, |
|
11370 duration: o.duration, |
|
11371 easing: o.easing, |
|
11372 complete: function() { |
|
11373 if ( mode === "hide" ) { |
|
11374 el.hide(); |
|
11375 } |
|
11376 $.effects.restore( el, props ); |
|
11377 $.effects.removeWrapper( el ); |
|
11378 done(); |
|
11379 } |
|
11380 }); |
|
11381 }; |
|
11382 |
|
11383 })(jQuery); |
|
11384 |
|
11385 (function( $, undefined ) { |
|
11386 |
|
11387 $.effects.effect.transfer = function( o, done ) { |
|
11388 var elem = $( this ), |
|
11389 target = $( o.to ), |
|
11390 targetFixed = target.css( "position" ) === "fixed", |
|
11391 body = $("body"), |
|
11392 fixTop = targetFixed ? body.scrollTop() : 0, |
|
11393 fixLeft = targetFixed ? body.scrollLeft() : 0, |
|
11394 endPosition = target.offset(), |
|
11395 animation = { |
|
11396 top: endPosition.top - fixTop , |
|
11397 left: endPosition.left - fixLeft , |
|
11398 height: target.innerHeight(), |
|
11399 width: target.innerWidth() |
|
11400 }, |
|
11401 startPosition = elem.offset(), |
|
11402 transfer = $( "<div class='ui-effects-transfer'></div>" ) |
|
11403 .appendTo( document.body ) |
|
11404 .addClass( o.className ) |
|
11405 .css({ |
|
11406 top: startPosition.top - fixTop , |
|
11407 left: startPosition.left - fixLeft , |
|
11408 height: elem.innerHeight(), |
|
11409 width: elem.innerWidth(), |
|
11410 position: targetFixed ? "fixed" : "absolute" |
|
11411 }) |
|
11412 .animate( animation, o.duration, o.easing, function() { |
|
11413 transfer.remove(); |
|
11414 done(); |
|
11415 }); |
|
11416 }; |
|
11417 |
|
11418 })(jQuery); |
|
11419 |
|
11420 (function( $, undefined ) { |
|
11421 |
|
11422 $.widget( "ui.menu", { |
9647 $.widget( "ui.menu", { |
11423 version: "1.10.3", |
9648 version: "1.10.4", |
11424 defaultElement: "<ul>", |
9649 defaultElement: "<ul>", |
11425 delay: 300, |
9650 delay: 300, |
11426 options: { |
9651 options: { |
11427 icons: { |
9652 icons: { |
11428 submenu: "ui-icon-carat-1-e" |
9653 submenu: "ui-icon-carat-1-e" |
12021 this._trigger( "select", event, ui ); |
10252 this._trigger( "select", event, ui ); |
12022 } |
10253 } |
12023 }); |
10254 }); |
12024 |
10255 |
12025 }( jQuery )); |
10256 }( jQuery )); |
12026 |
|
12027 (function( $, undefined ) { |
10257 (function( $, undefined ) { |
12028 |
10258 |
12029 $.ui = $.ui || {}; |
|
12030 |
|
12031 var cachedScrollbarWidth, |
|
12032 max = Math.max, |
|
12033 abs = Math.abs, |
|
12034 round = Math.round, |
|
12035 rhorizontal = /left|center|right/, |
|
12036 rvertical = /top|center|bottom/, |
|
12037 roffset = /[\+\-]\d+(\.[\d]+)?%?/, |
|
12038 rposition = /^\w+/, |
|
12039 rpercent = /%$/, |
|
12040 _position = $.fn.position; |
|
12041 |
|
12042 function getOffsets( offsets, width, height ) { |
|
12043 return [ |
|
12044 parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ), |
|
12045 parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 ) |
|
12046 ]; |
|
12047 } |
|
12048 |
|
12049 function parseCss( element, property ) { |
|
12050 return parseInt( $.css( element, property ), 10 ) || 0; |
|
12051 } |
|
12052 |
|
12053 function getDimensions( elem ) { |
|
12054 var raw = elem[0]; |
|
12055 if ( raw.nodeType === 9 ) { |
|
12056 return { |
|
12057 width: elem.width(), |
|
12058 height: elem.height(), |
|
12059 offset: { top: 0, left: 0 } |
|
12060 }; |
|
12061 } |
|
12062 if ( $.isWindow( raw ) ) { |
|
12063 return { |
|
12064 width: elem.width(), |
|
12065 height: elem.height(), |
|
12066 offset: { top: elem.scrollTop(), left: elem.scrollLeft() } |
|
12067 }; |
|
12068 } |
|
12069 if ( raw.preventDefault ) { |
|
12070 return { |
|
12071 width: 0, |
|
12072 height: 0, |
|
12073 offset: { top: raw.pageY, left: raw.pageX } |
|
12074 }; |
|
12075 } |
|
12076 return { |
|
12077 width: elem.outerWidth(), |
|
12078 height: elem.outerHeight(), |
|
12079 offset: elem.offset() |
|
12080 }; |
|
12081 } |
|
12082 |
|
12083 $.position = { |
|
12084 scrollbarWidth: function() { |
|
12085 if ( cachedScrollbarWidth !== undefined ) { |
|
12086 return cachedScrollbarWidth; |
|
12087 } |
|
12088 var w1, w2, |
|
12089 div = $( "<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ), |
|
12090 innerDiv = div.children()[0]; |
|
12091 |
|
12092 $( "body" ).append( div ); |
|
12093 w1 = innerDiv.offsetWidth; |
|
12094 div.css( "overflow", "scroll" ); |
|
12095 |
|
12096 w2 = innerDiv.offsetWidth; |
|
12097 |
|
12098 if ( w1 === w2 ) { |
|
12099 w2 = div[0].clientWidth; |
|
12100 } |
|
12101 |
|
12102 div.remove(); |
|
12103 |
|
12104 return (cachedScrollbarWidth = w1 - w2); |
|
12105 }, |
|
12106 getScrollInfo: function( within ) { |
|
12107 var overflowX = within.isWindow ? "" : within.element.css( "overflow-x" ), |
|
12108 overflowY = within.isWindow ? "" : within.element.css( "overflow-y" ), |
|
12109 hasOverflowX = overflowX === "scroll" || |
|
12110 ( overflowX === "auto" && within.width < within.element[0].scrollWidth ), |
|
12111 hasOverflowY = overflowY === "scroll" || |
|
12112 ( overflowY === "auto" && within.height < within.element[0].scrollHeight ); |
|
12113 return { |
|
12114 width: hasOverflowY ? $.position.scrollbarWidth() : 0, |
|
12115 height: hasOverflowX ? $.position.scrollbarWidth() : 0 |
|
12116 }; |
|
12117 }, |
|
12118 getWithinInfo: function( element ) { |
|
12119 var withinElement = $( element || window ), |
|
12120 isWindow = $.isWindow( withinElement[0] ); |
|
12121 return { |
|
12122 element: withinElement, |
|
12123 isWindow: isWindow, |
|
12124 offset: withinElement.offset() || { left: 0, top: 0 }, |
|
12125 scrollLeft: withinElement.scrollLeft(), |
|
12126 scrollTop: withinElement.scrollTop(), |
|
12127 width: isWindow ? withinElement.width() : withinElement.outerWidth(), |
|
12128 height: isWindow ? withinElement.height() : withinElement.outerHeight() |
|
12129 }; |
|
12130 } |
|
12131 }; |
|
12132 |
|
12133 $.fn.position = function( options ) { |
|
12134 if ( !options || !options.of ) { |
|
12135 return _position.apply( this, arguments ); |
|
12136 } |
|
12137 |
|
12138 // make a copy, we don't want to modify arguments |
|
12139 options = $.extend( {}, options ); |
|
12140 |
|
12141 var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, |
|
12142 target = $( options.of ), |
|
12143 within = $.position.getWithinInfo( options.within ), |
|
12144 scrollInfo = $.position.getScrollInfo( within ), |
|
12145 collision = ( options.collision || "flip" ).split( " " ), |
|
12146 offsets = {}; |
|
12147 |
|
12148 dimensions = getDimensions( target ); |
|
12149 if ( target[0].preventDefault ) { |
|
12150 // force left top to allow flipping |
|
12151 options.at = "left top"; |
|
12152 } |
|
12153 targetWidth = dimensions.width; |
|
12154 targetHeight = dimensions.height; |
|
12155 targetOffset = dimensions.offset; |
|
12156 // clone to reuse original targetOffset later |
|
12157 basePosition = $.extend( {}, targetOffset ); |
|
12158 |
|
12159 // force my and at to have valid horizontal and vertical positions |
|
12160 // if a value is missing or invalid, it will be converted to center |
|
12161 $.each( [ "my", "at" ], function() { |
|
12162 var pos = ( options[ this ] || "" ).split( " " ), |
|
12163 horizontalOffset, |
|
12164 verticalOffset; |
|
12165 |
|
12166 if ( pos.length === 1) { |
|
12167 pos = rhorizontal.test( pos[ 0 ] ) ? |
|
12168 pos.concat( [ "center" ] ) : |
|
12169 rvertical.test( pos[ 0 ] ) ? |
|
12170 [ "center" ].concat( pos ) : |
|
12171 [ "center", "center" ]; |
|
12172 } |
|
12173 pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center"; |
|
12174 pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center"; |
|
12175 |
|
12176 // calculate offsets |
|
12177 horizontalOffset = roffset.exec( pos[ 0 ] ); |
|
12178 verticalOffset = roffset.exec( pos[ 1 ] ); |
|
12179 offsets[ this ] = [ |
|
12180 horizontalOffset ? horizontalOffset[ 0 ] : 0, |
|
12181 verticalOffset ? verticalOffset[ 0 ] : 0 |
|
12182 ]; |
|
12183 |
|
12184 // reduce to just the positions without the offsets |
|
12185 options[ this ] = [ |
|
12186 rposition.exec( pos[ 0 ] )[ 0 ], |
|
12187 rposition.exec( pos[ 1 ] )[ 0 ] |
|
12188 ]; |
|
12189 }); |
|
12190 |
|
12191 // normalize collision option |
|
12192 if ( collision.length === 1 ) { |
|
12193 collision[ 1 ] = collision[ 0 ]; |
|
12194 } |
|
12195 |
|
12196 if ( options.at[ 0 ] === "right" ) { |
|
12197 basePosition.left += targetWidth; |
|
12198 } else if ( options.at[ 0 ] === "center" ) { |
|
12199 basePosition.left += targetWidth / 2; |
|
12200 } |
|
12201 |
|
12202 if ( options.at[ 1 ] === "bottom" ) { |
|
12203 basePosition.top += targetHeight; |
|
12204 } else if ( options.at[ 1 ] === "center" ) { |
|
12205 basePosition.top += targetHeight / 2; |
|
12206 } |
|
12207 |
|
12208 atOffset = getOffsets( offsets.at, targetWidth, targetHeight ); |
|
12209 basePosition.left += atOffset[ 0 ]; |
|
12210 basePosition.top += atOffset[ 1 ]; |
|
12211 |
|
12212 return this.each(function() { |
|
12213 var collisionPosition, using, |
|
12214 elem = $( this ), |
|
12215 elemWidth = elem.outerWidth(), |
|
12216 elemHeight = elem.outerHeight(), |
|
12217 marginLeft = parseCss( this, "marginLeft" ), |
|
12218 marginTop = parseCss( this, "marginTop" ), |
|
12219 collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width, |
|
12220 collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height, |
|
12221 position = $.extend( {}, basePosition ), |
|
12222 myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() ); |
|
12223 |
|
12224 if ( options.my[ 0 ] === "right" ) { |
|
12225 position.left -= elemWidth; |
|
12226 } else if ( options.my[ 0 ] === "center" ) { |
|
12227 position.left -= elemWidth / 2; |
|
12228 } |
|
12229 |
|
12230 if ( options.my[ 1 ] === "bottom" ) { |
|
12231 position.top -= elemHeight; |
|
12232 } else if ( options.my[ 1 ] === "center" ) { |
|
12233 position.top -= elemHeight / 2; |
|
12234 } |
|
12235 |
|
12236 position.left += myOffset[ 0 ]; |
|
12237 position.top += myOffset[ 1 ]; |
|
12238 |
|
12239 // if the browser doesn't support fractions, then round for consistent results |
|
12240 if ( !$.support.offsetFractions ) { |
|
12241 position.left = round( position.left ); |
|
12242 position.top = round( position.top ); |
|
12243 } |
|
12244 |
|
12245 collisionPosition = { |
|
12246 marginLeft: marginLeft, |
|
12247 marginTop: marginTop |
|
12248 }; |
|
12249 |
|
12250 $.each( [ "left", "top" ], function( i, dir ) { |
|
12251 if ( $.ui.position[ collision[ i ] ] ) { |
|
12252 $.ui.position[ collision[ i ] ][ dir ]( position, { |
|
12253 targetWidth: targetWidth, |
|
12254 targetHeight: targetHeight, |
|
12255 elemWidth: elemWidth, |
|
12256 elemHeight: elemHeight, |
|
12257 collisionPosition: collisionPosition, |
|
12258 collisionWidth: collisionWidth, |
|
12259 collisionHeight: collisionHeight, |
|
12260 offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ], |
|
12261 my: options.my, |
|
12262 at: options.at, |
|
12263 within: within, |
|
12264 elem : elem |
|
12265 }); |
|
12266 } |
|
12267 }); |
|
12268 |
|
12269 if ( options.using ) { |
|
12270 // adds feedback as second argument to using callback, if present |
|
12271 using = function( props ) { |
|
12272 var left = targetOffset.left - position.left, |
|
12273 right = left + targetWidth - elemWidth, |
|
12274 top = targetOffset.top - position.top, |
|
12275 bottom = top + targetHeight - elemHeight, |
|
12276 feedback = { |
|
12277 target: { |
|
12278 element: target, |
|
12279 left: targetOffset.left, |
|
12280 top: targetOffset.top, |
|
12281 width: targetWidth, |
|
12282 height: targetHeight |
|
12283 }, |
|
12284 element: { |
|
12285 element: elem, |
|
12286 left: position.left, |
|
12287 top: position.top, |
|
12288 width: elemWidth, |
|
12289 height: elemHeight |
|
12290 }, |
|
12291 horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", |
|
12292 vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" |
|
12293 }; |
|
12294 if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) { |
|
12295 feedback.horizontal = "center"; |
|
12296 } |
|
12297 if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) { |
|
12298 feedback.vertical = "middle"; |
|
12299 } |
|
12300 if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) { |
|
12301 feedback.important = "horizontal"; |
|
12302 } else { |
|
12303 feedback.important = "vertical"; |
|
12304 } |
|
12305 options.using.call( this, props, feedback ); |
|
12306 }; |
|
12307 } |
|
12308 |
|
12309 elem.offset( $.extend( position, { using: using } ) ); |
|
12310 }); |
|
12311 }; |
|
12312 |
|
12313 $.ui.position = { |
|
12314 fit: { |
|
12315 left: function( position, data ) { |
|
12316 var within = data.within, |
|
12317 withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, |
|
12318 outerWidth = within.width, |
|
12319 collisionPosLeft = position.left - data.collisionPosition.marginLeft, |
|
12320 overLeft = withinOffset - collisionPosLeft, |
|
12321 overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, |
|
12322 newOverRight; |
|
12323 |
|
12324 // element is wider than within |
|
12325 if ( data.collisionWidth > outerWidth ) { |
|
12326 // element is initially over the left side of within |
|
12327 if ( overLeft > 0 && overRight <= 0 ) { |
|
12328 newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset; |
|
12329 position.left += overLeft - newOverRight; |
|
12330 // element is initially over right side of within |
|
12331 } else if ( overRight > 0 && overLeft <= 0 ) { |
|
12332 position.left = withinOffset; |
|
12333 // element is initially over both left and right sides of within |
|
12334 } else { |
|
12335 if ( overLeft > overRight ) { |
|
12336 position.left = withinOffset + outerWidth - data.collisionWidth; |
|
12337 } else { |
|
12338 position.left = withinOffset; |
|
12339 } |
|
12340 } |
|
12341 // too far left -> align with left edge |
|
12342 } else if ( overLeft > 0 ) { |
|
12343 position.left += overLeft; |
|
12344 // too far right -> align with right edge |
|
12345 } else if ( overRight > 0 ) { |
|
12346 position.left -= overRight; |
|
12347 // adjust based on position and margin |
|
12348 } else { |
|
12349 position.left = max( position.left - collisionPosLeft, position.left ); |
|
12350 } |
|
12351 }, |
|
12352 top: function( position, data ) { |
|
12353 var within = data.within, |
|
12354 withinOffset = within.isWindow ? within.scrollTop : within.offset.top, |
|
12355 outerHeight = data.within.height, |
|
12356 collisionPosTop = position.top - data.collisionPosition.marginTop, |
|
12357 overTop = withinOffset - collisionPosTop, |
|
12358 overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, |
|
12359 newOverBottom; |
|
12360 |
|
12361 // element is taller than within |
|
12362 if ( data.collisionHeight > outerHeight ) { |
|
12363 // element is initially over the top of within |
|
12364 if ( overTop > 0 && overBottom <= 0 ) { |
|
12365 newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset; |
|
12366 position.top += overTop - newOverBottom; |
|
12367 // element is initially over bottom of within |
|
12368 } else if ( overBottom > 0 && overTop <= 0 ) { |
|
12369 position.top = withinOffset; |
|
12370 // element is initially over both top and bottom of within |
|
12371 } else { |
|
12372 if ( overTop > overBottom ) { |
|
12373 position.top = withinOffset + outerHeight - data.collisionHeight; |
|
12374 } else { |
|
12375 position.top = withinOffset; |
|
12376 } |
|
12377 } |
|
12378 // too far up -> align with top |
|
12379 } else if ( overTop > 0 ) { |
|
12380 position.top += overTop; |
|
12381 // too far down -> align with bottom edge |
|
12382 } else if ( overBottom > 0 ) { |
|
12383 position.top -= overBottom; |
|
12384 // adjust based on position and margin |
|
12385 } else { |
|
12386 position.top = max( position.top - collisionPosTop, position.top ); |
|
12387 } |
|
12388 } |
|
12389 }, |
|
12390 flip: { |
|
12391 left: function( position, data ) { |
|
12392 var within = data.within, |
|
12393 withinOffset = within.offset.left + within.scrollLeft, |
|
12394 outerWidth = within.width, |
|
12395 offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, |
|
12396 collisionPosLeft = position.left - data.collisionPosition.marginLeft, |
|
12397 overLeft = collisionPosLeft - offsetLeft, |
|
12398 overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, |
|
12399 myOffset = data.my[ 0 ] === "left" ? |
|
12400 -data.elemWidth : |
|
12401 data.my[ 0 ] === "right" ? |
|
12402 data.elemWidth : |
|
12403 0, |
|
12404 atOffset = data.at[ 0 ] === "left" ? |
|
12405 data.targetWidth : |
|
12406 data.at[ 0 ] === "right" ? |
|
12407 -data.targetWidth : |
|
12408 0, |
|
12409 offset = -2 * data.offset[ 0 ], |
|
12410 newOverRight, |
|
12411 newOverLeft; |
|
12412 |
|
12413 if ( overLeft < 0 ) { |
|
12414 newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset; |
|
12415 if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) { |
|
12416 position.left += myOffset + atOffset + offset; |
|
12417 } |
|
12418 } |
|
12419 else if ( overRight > 0 ) { |
|
12420 newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft; |
|
12421 if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) { |
|
12422 position.left += myOffset + atOffset + offset; |
|
12423 } |
|
12424 } |
|
12425 }, |
|
12426 top: function( position, data ) { |
|
12427 var within = data.within, |
|
12428 withinOffset = within.offset.top + within.scrollTop, |
|
12429 outerHeight = within.height, |
|
12430 offsetTop = within.isWindow ? within.scrollTop : within.offset.top, |
|
12431 collisionPosTop = position.top - data.collisionPosition.marginTop, |
|
12432 overTop = collisionPosTop - offsetTop, |
|
12433 overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, |
|
12434 top = data.my[ 1 ] === "top", |
|
12435 myOffset = top ? |
|
12436 -data.elemHeight : |
|
12437 data.my[ 1 ] === "bottom" ? |
|
12438 data.elemHeight : |
|
12439 0, |
|
12440 atOffset = data.at[ 1 ] === "top" ? |
|
12441 data.targetHeight : |
|
12442 data.at[ 1 ] === "bottom" ? |
|
12443 -data.targetHeight : |
|
12444 0, |
|
12445 offset = -2 * data.offset[ 1 ], |
|
12446 newOverTop, |
|
12447 newOverBottom; |
|
12448 if ( overTop < 0 ) { |
|
12449 newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset; |
|
12450 if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) { |
|
12451 position.top += myOffset + atOffset + offset; |
|
12452 } |
|
12453 } |
|
12454 else if ( overBottom > 0 ) { |
|
12455 newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop; |
|
12456 if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) { |
|
12457 position.top += myOffset + atOffset + offset; |
|
12458 } |
|
12459 } |
|
12460 } |
|
12461 }, |
|
12462 flipfit: { |
|
12463 left: function() { |
|
12464 $.ui.position.flip.left.apply( this, arguments ); |
|
12465 $.ui.position.fit.left.apply( this, arguments ); |
|
12466 }, |
|
12467 top: function() { |
|
12468 $.ui.position.flip.top.apply( this, arguments ); |
|
12469 $.ui.position.fit.top.apply( this, arguments ); |
|
12470 } |
|
12471 } |
|
12472 }; |
|
12473 |
|
12474 // fraction support test |
|
12475 (function () { |
|
12476 var testElement, testElementParent, testElementStyle, offsetLeft, i, |
|
12477 body = document.getElementsByTagName( "body" )[ 0 ], |
|
12478 div = document.createElement( "div" ); |
|
12479 |
|
12480 //Create a "fake body" for testing based on method used in jQuery.support |
|
12481 testElement = document.createElement( body ? "div" : "body" ); |
|
12482 testElementStyle = { |
|
12483 visibility: "hidden", |
|
12484 width: 0, |
|
12485 height: 0, |
|
12486 border: 0, |
|
12487 margin: 0, |
|
12488 background: "none" |
|
12489 }; |
|
12490 if ( body ) { |
|
12491 $.extend( testElementStyle, { |
|
12492 position: "absolute", |
|
12493 left: "-1000px", |
|
12494 top: "-1000px" |
|
12495 }); |
|
12496 } |
|
12497 for ( i in testElementStyle ) { |
|
12498 testElement.style[ i ] = testElementStyle[ i ]; |
|
12499 } |
|
12500 testElement.appendChild( div ); |
|
12501 testElementParent = body || document.documentElement; |
|
12502 testElementParent.insertBefore( testElement, testElementParent.firstChild ); |
|
12503 |
|
12504 div.style.cssText = "position: absolute; left: 10.7432222px;"; |
|
12505 |
|
12506 offsetLeft = $( div ).offset().left; |
|
12507 $.support.offsetFractions = offsetLeft > 10 && offsetLeft < 11; |
|
12508 |
|
12509 testElement.innerHTML = ""; |
|
12510 testElementParent.removeChild( testElement ); |
|
12511 })(); |
|
12512 |
|
12513 }( jQuery ) ); |
|
12514 |
|
12515 (function( $, undefined ) { |
|
12516 |
|
12517 $.widget( "ui.progressbar", { |
10259 $.widget( "ui.progressbar", { |
12518 version: "1.10.3", |
10260 version: "1.10.4", |
12519 options: { |
10261 options: { |
12520 max: 100, |
10262 max: 100, |
12521 value: 0, |
10263 value: 0, |
12522 |
10264 |
12523 change: null, |
10265 change: null, |
14999 }); |
12748 }); |
15000 } |
12749 } |
15001 }); |
12750 }); |
15002 |
12751 |
15003 }( jQuery ) ); |
12752 }( jQuery ) ); |
|
12753 (function($, undefined) { |
|
12754 |
|
12755 var dataSpace = "ui-effects-"; |
|
12756 |
|
12757 $.effects = { |
|
12758 effect: {} |
|
12759 }; |
|
12760 |
|
12761 /*! |
|
12762 * jQuery Color Animations v2.1.2 |
|
12763 * https://github.com/jquery/jquery-color |
|
12764 * |
|
12765 * Copyright 2013 jQuery Foundation and other contributors |
|
12766 * Released under the MIT license. |
|
12767 * http://jquery.org/license |
|
12768 * |
|
12769 * Date: Wed Jan 16 08:47:09 2013 -0600 |
|
12770 */ |
|
12771 (function( jQuery, undefined ) { |
|
12772 |
|
12773 var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", |
|
12774 |
|
12775 // plusequals test for += 100 -= 100 |
|
12776 rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, |
|
12777 // a set of RE's that can match strings and generate color tuples. |
|
12778 stringParsers = [{ |
|
12779 re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, |
|
12780 parse: function( execResult ) { |
|
12781 return [ |
|
12782 execResult[ 1 ], |
|
12783 execResult[ 2 ], |
|
12784 execResult[ 3 ], |
|
12785 execResult[ 4 ] |
|
12786 ]; |
|
12787 } |
|
12788 }, { |
|
12789 re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, |
|
12790 parse: function( execResult ) { |
|
12791 return [ |
|
12792 execResult[ 1 ] * 2.55, |
|
12793 execResult[ 2 ] * 2.55, |
|
12794 execResult[ 3 ] * 2.55, |
|
12795 execResult[ 4 ] |
|
12796 ]; |
|
12797 } |
|
12798 }, { |
|
12799 // this regex ignores A-F because it's compared against an already lowercased string |
|
12800 re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/, |
|
12801 parse: function( execResult ) { |
|
12802 return [ |
|
12803 parseInt( execResult[ 1 ], 16 ), |
|
12804 parseInt( execResult[ 2 ], 16 ), |
|
12805 parseInt( execResult[ 3 ], 16 ) |
|
12806 ]; |
|
12807 } |
|
12808 }, { |
|
12809 // this regex ignores A-F because it's compared against an already lowercased string |
|
12810 re: /#([a-f0-9])([a-f0-9])([a-f0-9])/, |
|
12811 parse: function( execResult ) { |
|
12812 return [ |
|
12813 parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ), |
|
12814 parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ), |
|
12815 parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ) |
|
12816 ]; |
|
12817 } |
|
12818 }, { |
|
12819 re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, |
|
12820 space: "hsla", |
|
12821 parse: function( execResult ) { |
|
12822 return [ |
|
12823 execResult[ 1 ], |
|
12824 execResult[ 2 ] / 100, |
|
12825 execResult[ 3 ] / 100, |
|
12826 execResult[ 4 ] |
|
12827 ]; |
|
12828 } |
|
12829 }], |
|
12830 |
|
12831 // jQuery.Color( ) |
|
12832 color = jQuery.Color = function( color, green, blue, alpha ) { |
|
12833 return new jQuery.Color.fn.parse( color, green, blue, alpha ); |
|
12834 }, |
|
12835 spaces = { |
|
12836 rgba: { |
|
12837 props: { |
|
12838 red: { |
|
12839 idx: 0, |
|
12840 type: "byte" |
|
12841 }, |
|
12842 green: { |
|
12843 idx: 1, |
|
12844 type: "byte" |
|
12845 }, |
|
12846 blue: { |
|
12847 idx: 2, |
|
12848 type: "byte" |
|
12849 } |
|
12850 } |
|
12851 }, |
|
12852 |
|
12853 hsla: { |
|
12854 props: { |
|
12855 hue: { |
|
12856 idx: 0, |
|
12857 type: "degrees" |
|
12858 }, |
|
12859 saturation: { |
|
12860 idx: 1, |
|
12861 type: "percent" |
|
12862 }, |
|
12863 lightness: { |
|
12864 idx: 2, |
|
12865 type: "percent" |
|
12866 } |
|
12867 } |
|
12868 } |
|
12869 }, |
|
12870 propTypes = { |
|
12871 "byte": { |
|
12872 floor: true, |
|
12873 max: 255 |
|
12874 }, |
|
12875 "percent": { |
|
12876 max: 1 |
|
12877 }, |
|
12878 "degrees": { |
|
12879 mod: 360, |
|
12880 floor: true |
|
12881 } |
|
12882 }, |
|
12883 support = color.support = {}, |
|
12884 |
|
12885 // element for support tests |
|
12886 supportElem = jQuery( "<p>" )[ 0 ], |
|
12887 |
|
12888 // colors = jQuery.Color.names |
|
12889 colors, |
|
12890 |
|
12891 // local aliases of functions called often |
|
12892 each = jQuery.each; |
|
12893 |
|
12894 // determine rgba support immediately |
|
12895 supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; |
|
12896 support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1; |
|
12897 |
|
12898 // define cache name and alpha properties |
|
12899 // for rgba and hsla spaces |
|
12900 each( spaces, function( spaceName, space ) { |
|
12901 space.cache = "_" + spaceName; |
|
12902 space.props.alpha = { |
|
12903 idx: 3, |
|
12904 type: "percent", |
|
12905 def: 1 |
|
12906 }; |
|
12907 }); |
|
12908 |
|
12909 function clamp( value, prop, allowEmpty ) { |
|
12910 var type = propTypes[ prop.type ] || {}; |
|
12911 |
|
12912 if ( value == null ) { |
|
12913 return (allowEmpty || !prop.def) ? null : prop.def; |
|
12914 } |
|
12915 |
|
12916 // ~~ is an short way of doing floor for positive numbers |
|
12917 value = type.floor ? ~~value : parseFloat( value ); |
|
12918 |
|
12919 // IE will pass in empty strings as value for alpha, |
|
12920 // which will hit this case |
|
12921 if ( isNaN( value ) ) { |
|
12922 return prop.def; |
|
12923 } |
|
12924 |
|
12925 if ( type.mod ) { |
|
12926 // we add mod before modding to make sure that negatives values |
|
12927 // get converted properly: -10 -> 350 |
|
12928 return (value + type.mod) % type.mod; |
|
12929 } |
|
12930 |
|
12931 // for now all property types without mod have min and max |
|
12932 return 0 > value ? 0 : type.max < value ? type.max : value; |
|
12933 } |
|
12934 |
|
12935 function stringParse( string ) { |
|
12936 var inst = color(), |
|
12937 rgba = inst._rgba = []; |
|
12938 |
|
12939 string = string.toLowerCase(); |
|
12940 |
|
12941 each( stringParsers, function( i, parser ) { |
|
12942 var parsed, |
|
12943 match = parser.re.exec( string ), |
|
12944 values = match && parser.parse( match ), |
|
12945 spaceName = parser.space || "rgba"; |
|
12946 |
|
12947 if ( values ) { |
|
12948 parsed = inst[ spaceName ]( values ); |
|
12949 |
|
12950 // if this was an rgba parse the assignment might happen twice |
|
12951 // oh well.... |
|
12952 inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ]; |
|
12953 rgba = inst._rgba = parsed._rgba; |
|
12954 |
|
12955 // exit each( stringParsers ) here because we matched |
|
12956 return false; |
|
12957 } |
|
12958 }); |
|
12959 |
|
12960 // Found a stringParser that handled it |
|
12961 if ( rgba.length ) { |
|
12962 |
|
12963 // if this came from a parsed string, force "transparent" when alpha is 0 |
|
12964 // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) |
|
12965 if ( rgba.join() === "0,0,0,0" ) { |
|
12966 jQuery.extend( rgba, colors.transparent ); |
|
12967 } |
|
12968 return inst; |
|
12969 } |
|
12970 |
|
12971 // named colors |
|
12972 return colors[ string ]; |
|
12973 } |
|
12974 |
|
12975 color.fn = jQuery.extend( color.prototype, { |
|
12976 parse: function( red, green, blue, alpha ) { |
|
12977 if ( red === undefined ) { |
|
12978 this._rgba = [ null, null, null, null ]; |
|
12979 return this; |
|
12980 } |
|
12981 if ( red.jquery || red.nodeType ) { |
|
12982 red = jQuery( red ).css( green ); |
|
12983 green = undefined; |
|
12984 } |
|
12985 |
|
12986 var inst = this, |
|
12987 type = jQuery.type( red ), |
|
12988 rgba = this._rgba = []; |
|
12989 |
|
12990 // more than 1 argument specified - assume ( red, green, blue, alpha ) |
|
12991 if ( green !== undefined ) { |
|
12992 red = [ red, green, blue, alpha ]; |
|
12993 type = "array"; |
|
12994 } |
|
12995 |
|
12996 if ( type === "string" ) { |
|
12997 return this.parse( stringParse( red ) || colors._default ); |
|
12998 } |
|
12999 |
|
13000 if ( type === "array" ) { |
|
13001 each( spaces.rgba.props, function( key, prop ) { |
|
13002 rgba[ prop.idx ] = clamp( red[ prop.idx ], prop ); |
|
13003 }); |
|
13004 return this; |
|
13005 } |
|
13006 |
|
13007 if ( type === "object" ) { |
|
13008 if ( red instanceof color ) { |
|
13009 each( spaces, function( spaceName, space ) { |
|
13010 if ( red[ space.cache ] ) { |
|
13011 inst[ space.cache ] = red[ space.cache ].slice(); |
|
13012 } |
|
13013 }); |
|
13014 } else { |
|
13015 each( spaces, function( spaceName, space ) { |
|
13016 var cache = space.cache; |
|
13017 each( space.props, function( key, prop ) { |
|
13018 |
|
13019 // if the cache doesn't exist, and we know how to convert |
|
13020 if ( !inst[ cache ] && space.to ) { |
|
13021 |
|
13022 // if the value was null, we don't need to copy it |
|
13023 // if the key was alpha, we don't need to copy it either |
|
13024 if ( key === "alpha" || red[ key ] == null ) { |
|
13025 return; |
|
13026 } |
|
13027 inst[ cache ] = space.to( inst._rgba ); |
|
13028 } |
|
13029 |
|
13030 // this is the only case where we allow nulls for ALL properties. |
|
13031 // call clamp with alwaysAllowEmpty |
|
13032 inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true ); |
|
13033 }); |
|
13034 |
|
13035 // everything defined but alpha? |
|
13036 if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) { |
|
13037 // use the default of 1 |
|
13038 inst[ cache ][ 3 ] = 1; |
|
13039 if ( space.from ) { |
|
13040 inst._rgba = space.from( inst[ cache ] ); |
|
13041 } |
|
13042 } |
|
13043 }); |
|
13044 } |
|
13045 return this; |
|
13046 } |
|
13047 }, |
|
13048 is: function( compare ) { |
|
13049 var is = color( compare ), |
|
13050 same = true, |
|
13051 inst = this; |
|
13052 |
|
13053 each( spaces, function( _, space ) { |
|
13054 var localCache, |
|
13055 isCache = is[ space.cache ]; |
|
13056 if (isCache) { |
|
13057 localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || []; |
|
13058 each( space.props, function( _, prop ) { |
|
13059 if ( isCache[ prop.idx ] != null ) { |
|
13060 same = ( isCache[ prop.idx ] === localCache[ prop.idx ] ); |
|
13061 return same; |
|
13062 } |
|
13063 }); |
|
13064 } |
|
13065 return same; |
|
13066 }); |
|
13067 return same; |
|
13068 }, |
|
13069 _space: function() { |
|
13070 var used = [], |
|
13071 inst = this; |
|
13072 each( spaces, function( spaceName, space ) { |
|
13073 if ( inst[ space.cache ] ) { |
|
13074 used.push( spaceName ); |
|
13075 } |
|
13076 }); |
|
13077 return used.pop(); |
|
13078 }, |
|
13079 transition: function( other, distance ) { |
|
13080 var end = color( other ), |
|
13081 spaceName = end._space(), |
|
13082 space = spaces[ spaceName ], |
|
13083 startColor = this.alpha() === 0 ? color( "transparent" ) : this, |
|
13084 start = startColor[ space.cache ] || space.to( startColor._rgba ), |
|
13085 result = start.slice(); |
|
13086 |
|
13087 end = end[ space.cache ]; |
|
13088 each( space.props, function( key, prop ) { |
|
13089 var index = prop.idx, |
|
13090 startValue = start[ index ], |
|
13091 endValue = end[ index ], |
|
13092 type = propTypes[ prop.type ] || {}; |
|
13093 |
|
13094 // if null, don't override start value |
|
13095 if ( endValue === null ) { |
|
13096 return; |
|
13097 } |
|
13098 // if null - use end |
|
13099 if ( startValue === null ) { |
|
13100 result[ index ] = endValue; |
|
13101 } else { |
|
13102 if ( type.mod ) { |
|
13103 if ( endValue - startValue > type.mod / 2 ) { |
|
13104 startValue += type.mod; |
|
13105 } else if ( startValue - endValue > type.mod / 2 ) { |
|
13106 startValue -= type.mod; |
|
13107 } |
|
13108 } |
|
13109 result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop ); |
|
13110 } |
|
13111 }); |
|
13112 return this[ spaceName ]( result ); |
|
13113 }, |
|
13114 blend: function( opaque ) { |
|
13115 // if we are already opaque - return ourself |
|
13116 if ( this._rgba[ 3 ] === 1 ) { |
|
13117 return this; |
|
13118 } |
|
13119 |
|
13120 var rgb = this._rgba.slice(), |
|
13121 a = rgb.pop(), |
|
13122 blend = color( opaque )._rgba; |
|
13123 |
|
13124 return color( jQuery.map( rgb, function( v, i ) { |
|
13125 return ( 1 - a ) * blend[ i ] + a * v; |
|
13126 })); |
|
13127 }, |
|
13128 toRgbaString: function() { |
|
13129 var prefix = "rgba(", |
|
13130 rgba = jQuery.map( this._rgba, function( v, i ) { |
|
13131 return v == null ? ( i > 2 ? 1 : 0 ) : v; |
|
13132 }); |
|
13133 |
|
13134 if ( rgba[ 3 ] === 1 ) { |
|
13135 rgba.pop(); |
|
13136 prefix = "rgb("; |
|
13137 } |
|
13138 |
|
13139 return prefix + rgba.join() + ")"; |
|
13140 }, |
|
13141 toHslaString: function() { |
|
13142 var prefix = "hsla(", |
|
13143 hsla = jQuery.map( this.hsla(), function( v, i ) { |
|
13144 if ( v == null ) { |
|
13145 v = i > 2 ? 1 : 0; |
|
13146 } |
|
13147 |
|
13148 // catch 1 and 2 |
|
13149 if ( i && i < 3 ) { |
|
13150 v = Math.round( v * 100 ) + "%"; |
|
13151 } |
|
13152 return v; |
|
13153 }); |
|
13154 |
|
13155 if ( hsla[ 3 ] === 1 ) { |
|
13156 hsla.pop(); |
|
13157 prefix = "hsl("; |
|
13158 } |
|
13159 return prefix + hsla.join() + ")"; |
|
13160 }, |
|
13161 toHexString: function( includeAlpha ) { |
|
13162 var rgba = this._rgba.slice(), |
|
13163 alpha = rgba.pop(); |
|
13164 |
|
13165 if ( includeAlpha ) { |
|
13166 rgba.push( ~~( alpha * 255 ) ); |
|
13167 } |
|
13168 |
|
13169 return "#" + jQuery.map( rgba, function( v ) { |
|
13170 |
|
13171 // default to 0 when nulls exist |
|
13172 v = ( v || 0 ).toString( 16 ); |
|
13173 return v.length === 1 ? "0" + v : v; |
|
13174 }).join(""); |
|
13175 }, |
|
13176 toString: function() { |
|
13177 return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString(); |
|
13178 } |
|
13179 }); |
|
13180 color.fn.parse.prototype = color.fn; |
|
13181 |
|
13182 // hsla conversions adapted from: |
|
13183 // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 |
|
13184 |
|
13185 function hue2rgb( p, q, h ) { |
|
13186 h = ( h + 1 ) % 1; |
|
13187 if ( h * 6 < 1 ) { |
|
13188 return p + (q - p) * h * 6; |
|
13189 } |
|
13190 if ( h * 2 < 1) { |
|
13191 return q; |
|
13192 } |
|
13193 if ( h * 3 < 2 ) { |
|
13194 return p + (q - p) * ((2/3) - h) * 6; |
|
13195 } |
|
13196 return p; |
|
13197 } |
|
13198 |
|
13199 spaces.hsla.to = function ( rgba ) { |
|
13200 if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) { |
|
13201 return [ null, null, null, rgba[ 3 ] ]; |
|
13202 } |
|
13203 var r = rgba[ 0 ] / 255, |
|
13204 g = rgba[ 1 ] / 255, |
|
13205 b = rgba[ 2 ] / 255, |
|
13206 a = rgba[ 3 ], |
|
13207 max = Math.max( r, g, b ), |
|
13208 min = Math.min( r, g, b ), |
|
13209 diff = max - min, |
|
13210 add = max + min, |
|
13211 l = add * 0.5, |
|
13212 h, s; |
|
13213 |
|
13214 if ( min === max ) { |
|
13215 h = 0; |
|
13216 } else if ( r === max ) { |
|
13217 h = ( 60 * ( g - b ) / diff ) + 360; |
|
13218 } else if ( g === max ) { |
|
13219 h = ( 60 * ( b - r ) / diff ) + 120; |
|
13220 } else { |
|
13221 h = ( 60 * ( r - g ) / diff ) + 240; |
|
13222 } |
|
13223 |
|
13224 // chroma (diff) == 0 means greyscale which, by definition, saturation = 0% |
|
13225 // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add) |
|
13226 if ( diff === 0 ) { |
|
13227 s = 0; |
|
13228 } else if ( l <= 0.5 ) { |
|
13229 s = diff / add; |
|
13230 } else { |
|
13231 s = diff / ( 2 - add ); |
|
13232 } |
|
13233 return [ Math.round(h) % 360, s, l, a == null ? 1 : a ]; |
|
13234 }; |
|
13235 |
|
13236 spaces.hsla.from = function ( hsla ) { |
|
13237 if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) { |
|
13238 return [ null, null, null, hsla[ 3 ] ]; |
|
13239 } |
|
13240 var h = hsla[ 0 ] / 360, |
|
13241 s = hsla[ 1 ], |
|
13242 l = hsla[ 2 ], |
|
13243 a = hsla[ 3 ], |
|
13244 q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s, |
|
13245 p = 2 * l - q; |
|
13246 |
|
13247 return [ |
|
13248 Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ), |
|
13249 Math.round( hue2rgb( p, q, h ) * 255 ), |
|
13250 Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ), |
|
13251 a |
|
13252 ]; |
|
13253 }; |
|
13254 |
|
13255 |
|
13256 each( spaces, function( spaceName, space ) { |
|
13257 var props = space.props, |
|
13258 cache = space.cache, |
|
13259 to = space.to, |
|
13260 from = space.from; |
|
13261 |
|
13262 // makes rgba() and hsla() |
|
13263 color.fn[ spaceName ] = function( value ) { |
|
13264 |
|
13265 // generate a cache for this space if it doesn't exist |
|
13266 if ( to && !this[ cache ] ) { |
|
13267 this[ cache ] = to( this._rgba ); |
|
13268 } |
|
13269 if ( value === undefined ) { |
|
13270 return this[ cache ].slice(); |
|
13271 } |
|
13272 |
|
13273 var ret, |
|
13274 type = jQuery.type( value ), |
|
13275 arr = ( type === "array" || type === "object" ) ? value : arguments, |
|
13276 local = this[ cache ].slice(); |
|
13277 |
|
13278 each( props, function( key, prop ) { |
|
13279 var val = arr[ type === "object" ? key : prop.idx ]; |
|
13280 if ( val == null ) { |
|
13281 val = local[ prop.idx ]; |
|
13282 } |
|
13283 local[ prop.idx ] = clamp( val, prop ); |
|
13284 }); |
|
13285 |
|
13286 if ( from ) { |
|
13287 ret = color( from( local ) ); |
|
13288 ret[ cache ] = local; |
|
13289 return ret; |
|
13290 } else { |
|
13291 return color( local ); |
|
13292 } |
|
13293 }; |
|
13294 |
|
13295 // makes red() green() blue() alpha() hue() saturation() lightness() |
|
13296 each( props, function( key, prop ) { |
|
13297 // alpha is included in more than one space |
|
13298 if ( color.fn[ key ] ) { |
|
13299 return; |
|
13300 } |
|
13301 color.fn[ key ] = function( value ) { |
|
13302 var vtype = jQuery.type( value ), |
|
13303 fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ), |
|
13304 local = this[ fn ](), |
|
13305 cur = local[ prop.idx ], |
|
13306 match; |
|
13307 |
|
13308 if ( vtype === "undefined" ) { |
|
13309 return cur; |
|
13310 } |
|
13311 |
|
13312 if ( vtype === "function" ) { |
|
13313 value = value.call( this, cur ); |
|
13314 vtype = jQuery.type( value ); |
|
13315 } |
|
13316 if ( value == null && prop.empty ) { |
|
13317 return this; |
|
13318 } |
|
13319 if ( vtype === "string" ) { |
|
13320 match = rplusequals.exec( value ); |
|
13321 if ( match ) { |
|
13322 value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 ); |
|
13323 } |
|
13324 } |
|
13325 local[ prop.idx ] = value; |
|
13326 return this[ fn ]( local ); |
|
13327 }; |
|
13328 }); |
|
13329 }); |
|
13330 |
|
13331 // add cssHook and .fx.step function for each named hook. |
|
13332 // accept a space separated string of properties |
|
13333 color.hook = function( hook ) { |
|
13334 var hooks = hook.split( " " ); |
|
13335 each( hooks, function( i, hook ) { |
|
13336 jQuery.cssHooks[ hook ] = { |
|
13337 set: function( elem, value ) { |
|
13338 var parsed, curElem, |
|
13339 backgroundColor = ""; |
|
13340 |
|
13341 if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) { |
|
13342 value = color( parsed || value ); |
|
13343 if ( !support.rgba && value._rgba[ 3 ] !== 1 ) { |
|
13344 curElem = hook === "backgroundColor" ? elem.parentNode : elem; |
|
13345 while ( |
|
13346 (backgroundColor === "" || backgroundColor === "transparent") && |
|
13347 curElem && curElem.style |
|
13348 ) { |
|
13349 try { |
|
13350 backgroundColor = jQuery.css( curElem, "backgroundColor" ); |
|
13351 curElem = curElem.parentNode; |
|
13352 } catch ( e ) { |
|
13353 } |
|
13354 } |
|
13355 |
|
13356 value = value.blend( backgroundColor && backgroundColor !== "transparent" ? |
|
13357 backgroundColor : |
|
13358 "_default" ); |
|
13359 } |
|
13360 |
|
13361 value = value.toRgbaString(); |
|
13362 } |
|
13363 try { |
|
13364 elem.style[ hook ] = value; |
|
13365 } catch( e ) { |
|
13366 // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit' |
|
13367 } |
|
13368 } |
|
13369 }; |
|
13370 jQuery.fx.step[ hook ] = function( fx ) { |
|
13371 if ( !fx.colorInit ) { |
|
13372 fx.start = color( fx.elem, hook ); |
|
13373 fx.end = color( fx.end ); |
|
13374 fx.colorInit = true; |
|
13375 } |
|
13376 jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) ); |
|
13377 }; |
|
13378 }); |
|
13379 |
|
13380 }; |
|
13381 |
|
13382 color.hook( stepHooks ); |
|
13383 |
|
13384 jQuery.cssHooks.borderColor = { |
|
13385 expand: function( value ) { |
|
13386 var expanded = {}; |
|
13387 |
|
13388 each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) { |
|
13389 expanded[ "border" + part + "Color" ] = value; |
|
13390 }); |
|
13391 return expanded; |
|
13392 } |
|
13393 }; |
|
13394 |
|
13395 // Basic color names only. |
|
13396 // Usage of any of the other color names requires adding yourself or including |
|
13397 // jquery.color.svg-names.js. |
|
13398 colors = jQuery.Color.names = { |
|
13399 // 4.1. Basic color keywords |
|
13400 aqua: "#00ffff", |
|
13401 black: "#000000", |
|
13402 blue: "#0000ff", |
|
13403 fuchsia: "#ff00ff", |
|
13404 gray: "#808080", |
|
13405 green: "#008000", |
|
13406 lime: "#00ff00", |
|
13407 maroon: "#800000", |
|
13408 navy: "#000080", |
|
13409 olive: "#808000", |
|
13410 purple: "#800080", |
|
13411 red: "#ff0000", |
|
13412 silver: "#c0c0c0", |
|
13413 teal: "#008080", |
|
13414 white: "#ffffff", |
|
13415 yellow: "#ffff00", |
|
13416 |
|
13417 // 4.2.3. "transparent" color keyword |
|
13418 transparent: [ null, null, null, 0 ], |
|
13419 |
|
13420 _default: "#ffffff" |
|
13421 }; |
|
13422 |
|
13423 })( jQuery ); |
|
13424 |
|
13425 |
|
13426 /******************************************************************************/ |
|
13427 /****************************** CLASS ANIMATIONS ******************************/ |
|
13428 /******************************************************************************/ |
|
13429 (function() { |
|
13430 |
|
13431 var classAnimationActions = [ "add", "remove", "toggle" ], |
|
13432 shorthandStyles = { |
|
13433 border: 1, |
|
13434 borderBottom: 1, |
|
13435 borderColor: 1, |
|
13436 borderLeft: 1, |
|
13437 borderRight: 1, |
|
13438 borderTop: 1, |
|
13439 borderWidth: 1, |
|
13440 margin: 1, |
|
13441 padding: 1 |
|
13442 }; |
|
13443 |
|
13444 $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) { |
|
13445 $.fx.step[ prop ] = function( fx ) { |
|
13446 if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) { |
|
13447 jQuery.style( fx.elem, prop, fx.end ); |
|
13448 fx.setAttr = true; |
|
13449 } |
|
13450 }; |
|
13451 }); |
|
13452 |
|
13453 function getElementStyles( elem ) { |
|
13454 var key, len, |
|
13455 style = elem.ownerDocument.defaultView ? |
|
13456 elem.ownerDocument.defaultView.getComputedStyle( elem, null ) : |
|
13457 elem.currentStyle, |
|
13458 styles = {}; |
|
13459 |
|
13460 if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) { |
|
13461 len = style.length; |
|
13462 while ( len-- ) { |
|
13463 key = style[ len ]; |
|
13464 if ( typeof style[ key ] === "string" ) { |
|
13465 styles[ $.camelCase( key ) ] = style[ key ]; |
|
13466 } |
|
13467 } |
|
13468 // support: Opera, IE <9 |
|
13469 } else { |
|
13470 for ( key in style ) { |
|
13471 if ( typeof style[ key ] === "string" ) { |
|
13472 styles[ key ] = style[ key ]; |
|
13473 } |
|
13474 } |
|
13475 } |
|
13476 |
|
13477 return styles; |
|
13478 } |
|
13479 |
|
13480 |
|
13481 function styleDifference( oldStyle, newStyle ) { |
|
13482 var diff = {}, |
|
13483 name, value; |
|
13484 |
|
13485 for ( name in newStyle ) { |
|
13486 value = newStyle[ name ]; |
|
13487 if ( oldStyle[ name ] !== value ) { |
|
13488 if ( !shorthandStyles[ name ] ) { |
|
13489 if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) { |
|
13490 diff[ name ] = value; |
|
13491 } |
|
13492 } |
|
13493 } |
|
13494 } |
|
13495 |
|
13496 return diff; |
|
13497 } |
|
13498 |
|
13499 // support: jQuery <1.8 |
|
13500 if ( !$.fn.addBack ) { |
|
13501 $.fn.addBack = function( selector ) { |
|
13502 return this.add( selector == null ? |
|
13503 this.prevObject : this.prevObject.filter( selector ) |
|
13504 ); |
|
13505 }; |
|
13506 } |
|
13507 |
|
13508 $.effects.animateClass = function( value, duration, easing, callback ) { |
|
13509 var o = $.speed( duration, easing, callback ); |
|
13510 |
|
13511 return this.queue( function() { |
|
13512 var animated = $( this ), |
|
13513 baseClass = animated.attr( "class" ) || "", |
|
13514 applyClassChange, |
|
13515 allAnimations = o.children ? animated.find( "*" ).addBack() : animated; |
|
13516 |
|
13517 // map the animated objects to store the original styles. |
|
13518 allAnimations = allAnimations.map(function() { |
|
13519 var el = $( this ); |
|
13520 return { |
|
13521 el: el, |
|
13522 start: getElementStyles( this ) |
|
13523 }; |
|
13524 }); |
|
13525 |
|
13526 // apply class change |
|
13527 applyClassChange = function() { |
|
13528 $.each( classAnimationActions, function(i, action) { |
|
13529 if ( value[ action ] ) { |
|
13530 animated[ action + "Class" ]( value[ action ] ); |
|
13531 } |
|
13532 }); |
|
13533 }; |
|
13534 applyClassChange(); |
|
13535 |
|
13536 // map all animated objects again - calculate new styles and diff |
|
13537 allAnimations = allAnimations.map(function() { |
|
13538 this.end = getElementStyles( this.el[ 0 ] ); |
|
13539 this.diff = styleDifference( this.start, this.end ); |
|
13540 return this; |
|
13541 }); |
|
13542 |
|
13543 // apply original class |
|
13544 animated.attr( "class", baseClass ); |
|
13545 |
|
13546 // map all animated objects again - this time collecting a promise |
|
13547 allAnimations = allAnimations.map(function() { |
|
13548 var styleInfo = this, |
|
13549 dfd = $.Deferred(), |
|
13550 opts = $.extend({}, o, { |
|
13551 queue: false, |
|
13552 complete: function() { |
|
13553 dfd.resolve( styleInfo ); |
|
13554 } |
|
13555 }); |
|
13556 |
|
13557 this.el.animate( this.diff, opts ); |
|
13558 return dfd.promise(); |
|
13559 }); |
|
13560 |
|
13561 // once all animations have completed: |
|
13562 $.when.apply( $, allAnimations.get() ).done(function() { |
|
13563 |
|
13564 // set the final class |
|
13565 applyClassChange(); |
|
13566 |
|
13567 // for each animated element, |
|
13568 // clear all css properties that were animated |
|
13569 $.each( arguments, function() { |
|
13570 var el = this.el; |
|
13571 $.each( this.diff, function(key) { |
|
13572 el.css( key, "" ); |
|
13573 }); |
|
13574 }); |
|
13575 |
|
13576 // this is guarnteed to be there if you use jQuery.speed() |
|
13577 // it also handles dequeuing the next anim... |
|
13578 o.complete.call( animated[ 0 ] ); |
|
13579 }); |
|
13580 }); |
|
13581 }; |
|
13582 |
|
13583 $.fn.extend({ |
|
13584 addClass: (function( orig ) { |
|
13585 return function( classNames, speed, easing, callback ) { |
|
13586 return speed ? |
|
13587 $.effects.animateClass.call( this, |
|
13588 { add: classNames }, speed, easing, callback ) : |
|
13589 orig.apply( this, arguments ); |
|
13590 }; |
|
13591 })( $.fn.addClass ), |
|
13592 |
|
13593 removeClass: (function( orig ) { |
|
13594 return function( classNames, speed, easing, callback ) { |
|
13595 return arguments.length > 1 ? |
|
13596 $.effects.animateClass.call( this, |
|
13597 { remove: classNames }, speed, easing, callback ) : |
|
13598 orig.apply( this, arguments ); |
|
13599 }; |
|
13600 })( $.fn.removeClass ), |
|
13601 |
|
13602 toggleClass: (function( orig ) { |
|
13603 return function( classNames, force, speed, easing, callback ) { |
|
13604 if ( typeof force === "boolean" || force === undefined ) { |
|
13605 if ( !speed ) { |
|
13606 // without speed parameter |
|
13607 return orig.apply( this, arguments ); |
|
13608 } else { |
|
13609 return $.effects.animateClass.call( this, |
|
13610 (force ? { add: classNames } : { remove: classNames }), |
|
13611 speed, easing, callback ); |
|
13612 } |
|
13613 } else { |
|
13614 // without force parameter |
|
13615 return $.effects.animateClass.call( this, |
|
13616 { toggle: classNames }, force, speed, easing ); |
|
13617 } |
|
13618 }; |
|
13619 })( $.fn.toggleClass ), |
|
13620 |
|
13621 switchClass: function( remove, add, speed, easing, callback) { |
|
13622 return $.effects.animateClass.call( this, { |
|
13623 add: add, |
|
13624 remove: remove |
|
13625 }, speed, easing, callback ); |
|
13626 } |
|
13627 }); |
|
13628 |
|
13629 })(); |
|
13630 |
|
13631 /******************************************************************************/ |
|
13632 /*********************************** EFFECTS **********************************/ |
|
13633 /******************************************************************************/ |
|
13634 |
|
13635 (function() { |
|
13636 |
|
13637 $.extend( $.effects, { |
|
13638 version: "1.10.4", |
|
13639 |
|
13640 // Saves a set of properties in a data storage |
|
13641 save: function( element, set ) { |
|
13642 for( var i=0; i < set.length; i++ ) { |
|
13643 if ( set[ i ] !== null ) { |
|
13644 element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] ); |
|
13645 } |
|
13646 } |
|
13647 }, |
|
13648 |
|
13649 // Restores a set of previously saved properties from a data storage |
|
13650 restore: function( element, set ) { |
|
13651 var val, i; |
|
13652 for( i=0; i < set.length; i++ ) { |
|
13653 if ( set[ i ] !== null ) { |
|
13654 val = element.data( dataSpace + set[ i ] ); |
|
13655 // support: jQuery 1.6.2 |
|
13656 // http://bugs.jquery.com/ticket/9917 |
|
13657 // jQuery 1.6.2 incorrectly returns undefined for any falsy value. |
|
13658 // We can't differentiate between "" and 0 here, so we just assume |
|
13659 // empty string since it's likely to be a more common value... |
|
13660 if ( val === undefined ) { |
|
13661 val = ""; |
|
13662 } |
|
13663 element.css( set[ i ], val ); |
|
13664 } |
|
13665 } |
|
13666 }, |
|
13667 |
|
13668 setMode: function( el, mode ) { |
|
13669 if (mode === "toggle") { |
|
13670 mode = el.is( ":hidden" ) ? "show" : "hide"; |
|
13671 } |
|
13672 return mode; |
|
13673 }, |
|
13674 |
|
13675 // Translates a [top,left] array into a baseline value |
|
13676 // this should be a little more flexible in the future to handle a string & hash |
|
13677 getBaseline: function( origin, original ) { |
|
13678 var y, x; |
|
13679 switch ( origin[ 0 ] ) { |
|
13680 case "top": y = 0; break; |
|
13681 case "middle": y = 0.5; break; |
|
13682 case "bottom": y = 1; break; |
|
13683 default: y = origin[ 0 ] / original.height; |
|
13684 } |
|
13685 switch ( origin[ 1 ] ) { |
|
13686 case "left": x = 0; break; |
|
13687 case "center": x = 0.5; break; |
|
13688 case "right": x = 1; break; |
|
13689 default: x = origin[ 1 ] / original.width; |
|
13690 } |
|
13691 return { |
|
13692 x: x, |
|
13693 y: y |
|
13694 }; |
|
13695 }, |
|
13696 |
|
13697 // Wraps the element around a wrapper that copies position properties |
|
13698 createWrapper: function( element ) { |
|
13699 |
|
13700 // if the element is already wrapped, return it |
|
13701 if ( element.parent().is( ".ui-effects-wrapper" )) { |
|
13702 return element.parent(); |
|
13703 } |
|
13704 |
|
13705 // wrap the element |
|
13706 var props = { |
|
13707 width: element.outerWidth(true), |
|
13708 height: element.outerHeight(true), |
|
13709 "float": element.css( "float" ) |
|
13710 }, |
|
13711 wrapper = $( "<div></div>" ) |
|
13712 .addClass( "ui-effects-wrapper" ) |
|
13713 .css({ |
|
13714 fontSize: "100%", |
|
13715 background: "transparent", |
|
13716 border: "none", |
|
13717 margin: 0, |
|
13718 padding: 0 |
|
13719 }), |
|
13720 // Store the size in case width/height are defined in % - Fixes #5245 |
|
13721 size = { |
|
13722 width: element.width(), |
|
13723 height: element.height() |
|
13724 }, |
|
13725 active = document.activeElement; |
|
13726 |
|
13727 // support: Firefox |
|
13728 // Firefox incorrectly exposes anonymous content |
|
13729 // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 |
|
13730 try { |
|
13731 active.id; |
|
13732 } catch( e ) { |
|
13733 active = document.body; |
|
13734 } |
|
13735 |
|
13736 element.wrap( wrapper ); |
|
13737 |
|
13738 // Fixes #7595 - Elements lose focus when wrapped. |
|
13739 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { |
|
13740 $( active ).focus(); |
|
13741 } |
|
13742 |
|
13743 wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element |
|
13744 |
|
13745 // transfer positioning properties to the wrapper |
|
13746 if ( element.css( "position" ) === "static" ) { |
|
13747 wrapper.css({ position: "relative" }); |
|
13748 element.css({ position: "relative" }); |
|
13749 } else { |
|
13750 $.extend( props, { |
|
13751 position: element.css( "position" ), |
|
13752 zIndex: element.css( "z-index" ) |
|
13753 }); |
|
13754 $.each([ "top", "left", "bottom", "right" ], function(i, pos) { |
|
13755 props[ pos ] = element.css( pos ); |
|
13756 if ( isNaN( parseInt( props[ pos ], 10 ) ) ) { |
|
13757 props[ pos ] = "auto"; |
|
13758 } |
|
13759 }); |
|
13760 element.css({ |
|
13761 position: "relative", |
|
13762 top: 0, |
|
13763 left: 0, |
|
13764 right: "auto", |
|
13765 bottom: "auto" |
|
13766 }); |
|
13767 } |
|
13768 element.css(size); |
|
13769 |
|
13770 return wrapper.css( props ).show(); |
|
13771 }, |
|
13772 |
|
13773 removeWrapper: function( element ) { |
|
13774 var active = document.activeElement; |
|
13775 |
|
13776 if ( element.parent().is( ".ui-effects-wrapper" ) ) { |
|
13777 element.parent().replaceWith( element ); |
|
13778 |
|
13779 // Fixes #7595 - Elements lose focus when wrapped. |
|
13780 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { |
|
13781 $( active ).focus(); |
|
13782 } |
|
13783 } |
|
13784 |
|
13785 |
|
13786 return element; |
|
13787 }, |
|
13788 |
|
13789 setTransition: function( element, list, factor, value ) { |
|
13790 value = value || {}; |
|
13791 $.each( list, function( i, x ) { |
|
13792 var unit = element.cssUnit( x ); |
|
13793 if ( unit[ 0 ] > 0 ) { |
|
13794 value[ x ] = unit[ 0 ] * factor + unit[ 1 ]; |
|
13795 } |
|
13796 }); |
|
13797 return value; |
|
13798 } |
|
13799 }); |
|
13800 |
|
13801 // return an effect options object for the given parameters: |
|
13802 function _normalizeArguments( effect, options, speed, callback ) { |
|
13803 |
|
13804 // allow passing all options as the first parameter |
|
13805 if ( $.isPlainObject( effect ) ) { |
|
13806 options = effect; |
|
13807 effect = effect.effect; |
|
13808 } |
|
13809 |
|
13810 // convert to an object |
|
13811 effect = { effect: effect }; |
|
13812 |
|
13813 // catch (effect, null, ...) |
|
13814 if ( options == null ) { |
|
13815 options = {}; |
|
13816 } |
|
13817 |
|
13818 // catch (effect, callback) |
|
13819 if ( $.isFunction( options ) ) { |
|
13820 callback = options; |
|
13821 speed = null; |
|
13822 options = {}; |
|
13823 } |
|
13824 |
|
13825 // catch (effect, speed, ?) |
|
13826 if ( typeof options === "number" || $.fx.speeds[ options ] ) { |
|
13827 callback = speed; |
|
13828 speed = options; |
|
13829 options = {}; |
|
13830 } |
|
13831 |
|
13832 // catch (effect, options, callback) |
|
13833 if ( $.isFunction( speed ) ) { |
|
13834 callback = speed; |
|
13835 speed = null; |
|
13836 } |
|
13837 |
|
13838 // add options to effect |
|
13839 if ( options ) { |
|
13840 $.extend( effect, options ); |
|
13841 } |
|
13842 |
|
13843 speed = speed || options.duration; |
|
13844 effect.duration = $.fx.off ? 0 : |
|
13845 typeof speed === "number" ? speed : |
|
13846 speed in $.fx.speeds ? $.fx.speeds[ speed ] : |
|
13847 $.fx.speeds._default; |
|
13848 |
|
13849 effect.complete = callback || options.complete; |
|
13850 |
|
13851 return effect; |
|
13852 } |
|
13853 |
|
13854 function standardAnimationOption( option ) { |
|
13855 // Valid standard speeds (nothing, number, named speed) |
|
13856 if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) { |
|
13857 return true; |
|
13858 } |
|
13859 |
|
13860 // Invalid strings - treat as "normal" speed |
|
13861 if ( typeof option === "string" && !$.effects.effect[ option ] ) { |
|
13862 return true; |
|
13863 } |
|
13864 |
|
13865 // Complete callback |
|
13866 if ( $.isFunction( option ) ) { |
|
13867 return true; |
|
13868 } |
|
13869 |
|
13870 // Options hash (but not naming an effect) |
|
13871 if ( typeof option === "object" && !option.effect ) { |
|
13872 return true; |
|
13873 } |
|
13874 |
|
13875 // Didn't match any standard API |
|
13876 return false; |
|
13877 } |
|
13878 |
|
13879 $.fn.extend({ |
|
13880 effect: function( /* effect, options, speed, callback */ ) { |
|
13881 var args = _normalizeArguments.apply( this, arguments ), |
|
13882 mode = args.mode, |
|
13883 queue = args.queue, |
|
13884 effectMethod = $.effects.effect[ args.effect ]; |
|
13885 |
|
13886 if ( $.fx.off || !effectMethod ) { |
|
13887 // delegate to the original method (e.g., .show()) if possible |
|
13888 if ( mode ) { |
|
13889 return this[ mode ]( args.duration, args.complete ); |
|
13890 } else { |
|
13891 return this.each( function() { |
|
13892 if ( args.complete ) { |
|
13893 args.complete.call( this ); |
|
13894 } |
|
13895 }); |
|
13896 } |
|
13897 } |
|
13898 |
|
13899 function run( next ) { |
|
13900 var elem = $( this ), |
|
13901 complete = args.complete, |
|
13902 mode = args.mode; |
|
13903 |
|
13904 function done() { |
|
13905 if ( $.isFunction( complete ) ) { |
|
13906 complete.call( elem[0] ); |
|
13907 } |
|
13908 if ( $.isFunction( next ) ) { |
|
13909 next(); |
|
13910 } |
|
13911 } |
|
13912 |
|
13913 // If the element already has the correct final state, delegate to |
|
13914 // the core methods so the internal tracking of "olddisplay" works. |
|
13915 if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) { |
|
13916 elem[ mode ](); |
|
13917 done(); |
|
13918 } else { |
|
13919 effectMethod.call( elem[0], args, done ); |
|
13920 } |
|
13921 } |
|
13922 |
|
13923 return queue === false ? this.each( run ) : this.queue( queue || "fx", run ); |
|
13924 }, |
|
13925 |
|
13926 show: (function( orig ) { |
|
13927 return function( option ) { |
|
13928 if ( standardAnimationOption( option ) ) { |
|
13929 return orig.apply( this, arguments ); |
|
13930 } else { |
|
13931 var args = _normalizeArguments.apply( this, arguments ); |
|
13932 args.mode = "show"; |
|
13933 return this.effect.call( this, args ); |
|
13934 } |
|
13935 }; |
|
13936 })( $.fn.show ), |
|
13937 |
|
13938 hide: (function( orig ) { |
|
13939 return function( option ) { |
|
13940 if ( standardAnimationOption( option ) ) { |
|
13941 return orig.apply( this, arguments ); |
|
13942 } else { |
|
13943 var args = _normalizeArguments.apply( this, arguments ); |
|
13944 args.mode = "hide"; |
|
13945 return this.effect.call( this, args ); |
|
13946 } |
|
13947 }; |
|
13948 })( $.fn.hide ), |
|
13949 |
|
13950 toggle: (function( orig ) { |
|
13951 return function( option ) { |
|
13952 if ( standardAnimationOption( option ) || typeof option === "boolean" ) { |
|
13953 return orig.apply( this, arguments ); |
|
13954 } else { |
|
13955 var args = _normalizeArguments.apply( this, arguments ); |
|
13956 args.mode = "toggle"; |
|
13957 return this.effect.call( this, args ); |
|
13958 } |
|
13959 }; |
|
13960 })( $.fn.toggle ), |
|
13961 |
|
13962 // helper functions |
|
13963 cssUnit: function(key) { |
|
13964 var style = this.css( key ), |
|
13965 val = []; |
|
13966 |
|
13967 $.each( [ "em", "px", "%", "pt" ], function( i, unit ) { |
|
13968 if ( style.indexOf( unit ) > 0 ) { |
|
13969 val = [ parseFloat( style ), unit ]; |
|
13970 } |
|
13971 }); |
|
13972 return val; |
|
13973 } |
|
13974 }); |
|
13975 |
|
13976 })(); |
|
13977 |
|
13978 /******************************************************************************/ |
|
13979 /*********************************** EASING ***********************************/ |
|
13980 /******************************************************************************/ |
|
13981 |
|
13982 (function() { |
|
13983 |
|
13984 // based on easing equations from Robert Penner (http://www.robertpenner.com/easing) |
|
13985 |
|
13986 var baseEasings = {}; |
|
13987 |
|
13988 $.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) { |
|
13989 baseEasings[ name ] = function( p ) { |
|
13990 return Math.pow( p, i + 2 ); |
|
13991 }; |
|
13992 }); |
|
13993 |
|
13994 $.extend( baseEasings, { |
|
13995 Sine: function ( p ) { |
|
13996 return 1 - Math.cos( p * Math.PI / 2 ); |
|
13997 }, |
|
13998 Circ: function ( p ) { |
|
13999 return 1 - Math.sqrt( 1 - p * p ); |
|
14000 }, |
|
14001 Elastic: function( p ) { |
|
14002 return p === 0 || p === 1 ? p : |
|
14003 -Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 ); |
|
14004 }, |
|
14005 Back: function( p ) { |
|
14006 return p * p * ( 3 * p - 2 ); |
|
14007 }, |
|
14008 Bounce: function ( p ) { |
|
14009 var pow2, |
|
14010 bounce = 4; |
|
14011 |
|
14012 while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {} |
|
14013 return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 ); |
|
14014 } |
|
14015 }); |
|
14016 |
|
14017 $.each( baseEasings, function( name, easeIn ) { |
|
14018 $.easing[ "easeIn" + name ] = easeIn; |
|
14019 $.easing[ "easeOut" + name ] = function( p ) { |
|
14020 return 1 - easeIn( 1 - p ); |
|
14021 }; |
|
14022 $.easing[ "easeInOut" + name ] = function( p ) { |
|
14023 return p < 0.5 ? |
|
14024 easeIn( p * 2 ) / 2 : |
|
14025 1 - easeIn( p * -2 + 2 ) / 2; |
|
14026 }; |
|
14027 }); |
|
14028 |
|
14029 })(); |
|
14030 |
|
14031 })(jQuery); |
|
14032 (function( $, undefined ) { |
|
14033 |
|
14034 var rvertical = /up|down|vertical/, |
|
14035 rpositivemotion = /up|left|vertical|horizontal/; |
|
14036 |
|
14037 $.effects.effect.blind = function( o, done ) { |
|
14038 // Create element |
|
14039 var el = $( this ), |
|
14040 props = [ "position", "top", "bottom", "left", "right", "height", "width" ], |
|
14041 mode = $.effects.setMode( el, o.mode || "hide" ), |
|
14042 direction = o.direction || "up", |
|
14043 vertical = rvertical.test( direction ), |
|
14044 ref = vertical ? "height" : "width", |
|
14045 ref2 = vertical ? "top" : "left", |
|
14046 motion = rpositivemotion.test( direction ), |
|
14047 animation = {}, |
|
14048 show = mode === "show", |
|
14049 wrapper, distance, margin; |
|
14050 |
|
14051 // if already wrapped, the wrapper's properties are my property. #6245 |
|
14052 if ( el.parent().is( ".ui-effects-wrapper" ) ) { |
|
14053 $.effects.save( el.parent(), props ); |
|
14054 } else { |
|
14055 $.effects.save( el, props ); |
|
14056 } |
|
14057 el.show(); |
|
14058 wrapper = $.effects.createWrapper( el ).css({ |
|
14059 overflow: "hidden" |
|
14060 }); |
|
14061 |
|
14062 distance = wrapper[ ref ](); |
|
14063 margin = parseFloat( wrapper.css( ref2 ) ) || 0; |
|
14064 |
|
14065 animation[ ref ] = show ? distance : 0; |
|
14066 if ( !motion ) { |
|
14067 el |
|
14068 .css( vertical ? "bottom" : "right", 0 ) |
|
14069 .css( vertical ? "top" : "left", "auto" ) |
|
14070 .css({ position: "absolute" }); |
|
14071 |
|
14072 animation[ ref2 ] = show ? margin : distance + margin; |
|
14073 } |
|
14074 |
|
14075 // start at 0 if we are showing |
|
14076 if ( show ) { |
|
14077 wrapper.css( ref, 0 ); |
|
14078 if ( ! motion ) { |
|
14079 wrapper.css( ref2, margin + distance ); |
|
14080 } |
|
14081 } |
|
14082 |
|
14083 // Animate |
|
14084 wrapper.animate( animation, { |
|
14085 duration: o.duration, |
|
14086 easing: o.easing, |
|
14087 queue: false, |
|
14088 complete: function() { |
|
14089 if ( mode === "hide" ) { |
|
14090 el.hide(); |
|
14091 } |
|
14092 $.effects.restore( el, props ); |
|
14093 $.effects.removeWrapper( el ); |
|
14094 done(); |
|
14095 } |
|
14096 }); |
|
14097 |
|
14098 }; |
|
14099 |
|
14100 })(jQuery); |
|
14101 (function( $, undefined ) { |
|
14102 |
|
14103 $.effects.effect.bounce = function( o, done ) { |
|
14104 var el = $( this ), |
|
14105 props = [ "position", "top", "bottom", "left", "right", "height", "width" ], |
|
14106 |
|
14107 // defaults: |
|
14108 mode = $.effects.setMode( el, o.mode || "effect" ), |
|
14109 hide = mode === "hide", |
|
14110 show = mode === "show", |
|
14111 direction = o.direction || "up", |
|
14112 distance = o.distance, |
|
14113 times = o.times || 5, |
|
14114 |
|
14115 // number of internal animations |
|
14116 anims = times * 2 + ( show || hide ? 1 : 0 ), |
|
14117 speed = o.duration / anims, |
|
14118 easing = o.easing, |
|
14119 |
|
14120 // utility: |
|
14121 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", |
|
14122 motion = ( direction === "up" || direction === "left" ), |
|
14123 i, |
|
14124 upAnim, |
|
14125 downAnim, |
|
14126 |
|
14127 // we will need to re-assemble the queue to stack our animations in place |
|
14128 queue = el.queue(), |
|
14129 queuelen = queue.length; |
|
14130 |
|
14131 // Avoid touching opacity to prevent clearType and PNG issues in IE |
|
14132 if ( show || hide ) { |
|
14133 props.push( "opacity" ); |
|
14134 } |
|
14135 |
|
14136 $.effects.save( el, props ); |
|
14137 el.show(); |
|
14138 $.effects.createWrapper( el ); // Create Wrapper |
|
14139 |
|
14140 // default distance for the BIGGEST bounce is the outer Distance / 3 |
|
14141 if ( !distance ) { |
|
14142 distance = el[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3; |
|
14143 } |
|
14144 |
|
14145 if ( show ) { |
|
14146 downAnim = { opacity: 1 }; |
|
14147 downAnim[ ref ] = 0; |
|
14148 |
|
14149 // if we are showing, force opacity 0 and set the initial position |
|
14150 // then do the "first" animation |
|
14151 el.css( "opacity", 0 ) |
|
14152 .css( ref, motion ? -distance * 2 : distance * 2 ) |
|
14153 .animate( downAnim, speed, easing ); |
|
14154 } |
|
14155 |
|
14156 // start at the smallest distance if we are hiding |
|
14157 if ( hide ) { |
|
14158 distance = distance / Math.pow( 2, times - 1 ); |
|
14159 } |
|
14160 |
|
14161 downAnim = {}; |
|
14162 downAnim[ ref ] = 0; |
|
14163 // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here |
|
14164 for ( i = 0; i < times; i++ ) { |
|
14165 upAnim = {}; |
|
14166 upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; |
|
14167 |
|
14168 el.animate( upAnim, speed, easing ) |
|
14169 .animate( downAnim, speed, easing ); |
|
14170 |
|
14171 distance = hide ? distance * 2 : distance / 2; |
|
14172 } |
|
14173 |
|
14174 // Last Bounce when Hiding |
|
14175 if ( hide ) { |
|
14176 upAnim = { opacity: 0 }; |
|
14177 upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; |
|
14178 |
|
14179 el.animate( upAnim, speed, easing ); |
|
14180 } |
|
14181 |
|
14182 el.queue(function() { |
|
14183 if ( hide ) { |
|
14184 el.hide(); |
|
14185 } |
|
14186 $.effects.restore( el, props ); |
|
14187 $.effects.removeWrapper( el ); |
|
14188 done(); |
|
14189 }); |
|
14190 |
|
14191 // inject all the animations we just queued to be first in line (after "inprogress") |
|
14192 if ( queuelen > 1) { |
|
14193 queue.splice.apply( queue, |
|
14194 [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) ); |
|
14195 } |
|
14196 el.dequeue(); |
|
14197 |
|
14198 }; |
|
14199 |
|
14200 })(jQuery); |
|
14201 (function( $, undefined ) { |
|
14202 |
|
14203 $.effects.effect.clip = function( o, done ) { |
|
14204 // Create element |
|
14205 var el = $( this ), |
|
14206 props = [ "position", "top", "bottom", "left", "right", "height", "width" ], |
|
14207 mode = $.effects.setMode( el, o.mode || "hide" ), |
|
14208 show = mode === "show", |
|
14209 direction = o.direction || "vertical", |
|
14210 vert = direction === "vertical", |
|
14211 size = vert ? "height" : "width", |
|
14212 position = vert ? "top" : "left", |
|
14213 animation = {}, |
|
14214 wrapper, animate, distance; |
|
14215 |
|
14216 // Save & Show |
|
14217 $.effects.save( el, props ); |
|
14218 el.show(); |
|
14219 |
|
14220 // Create Wrapper |
|
14221 wrapper = $.effects.createWrapper( el ).css({ |
|
14222 overflow: "hidden" |
|
14223 }); |
|
14224 animate = ( el[0].tagName === "IMG" ) ? wrapper : el; |
|
14225 distance = animate[ size ](); |
|
14226 |
|
14227 // Shift |
|
14228 if ( show ) { |
|
14229 animate.css( size, 0 ); |
|
14230 animate.css( position, distance / 2 ); |
|
14231 } |
|
14232 |
|
14233 // Create Animation Object: |
|
14234 animation[ size ] = show ? distance : 0; |
|
14235 animation[ position ] = show ? 0 : distance / 2; |
|
14236 |
|
14237 // Animate |
|
14238 animate.animate( animation, { |
|
14239 queue: false, |
|
14240 duration: o.duration, |
|
14241 easing: o.easing, |
|
14242 complete: function() { |
|
14243 if ( !show ) { |
|
14244 el.hide(); |
|
14245 } |
|
14246 $.effects.restore( el, props ); |
|
14247 $.effects.removeWrapper( el ); |
|
14248 done(); |
|
14249 } |
|
14250 }); |
|
14251 |
|
14252 }; |
|
14253 |
|
14254 })(jQuery); |
|
14255 (function( $, undefined ) { |
|
14256 |
|
14257 $.effects.effect.drop = function( o, done ) { |
|
14258 |
|
14259 var el = $( this ), |
|
14260 props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ], |
|
14261 mode = $.effects.setMode( el, o.mode || "hide" ), |
|
14262 show = mode === "show", |
|
14263 direction = o.direction || "left", |
|
14264 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", |
|
14265 motion = ( direction === "up" || direction === "left" ) ? "pos" : "neg", |
|
14266 animation = { |
|
14267 opacity: show ? 1 : 0 |
|
14268 }, |
|
14269 distance; |
|
14270 |
|
14271 // Adjust |
|
14272 $.effects.save( el, props ); |
|
14273 el.show(); |
|
14274 $.effects.createWrapper( el ); |
|
14275 |
|
14276 distance = o.distance || el[ ref === "top" ? "outerHeight": "outerWidth" ]( true ) / 2; |
|
14277 |
|
14278 if ( show ) { |
|
14279 el |
|
14280 .css( "opacity", 0 ) |
|
14281 .css( ref, motion === "pos" ? -distance : distance ); |
|
14282 } |
|
14283 |
|
14284 // Animation |
|
14285 animation[ ref ] = ( show ? |
|
14286 ( motion === "pos" ? "+=" : "-=" ) : |
|
14287 ( motion === "pos" ? "-=" : "+=" ) ) + |
|
14288 distance; |
|
14289 |
|
14290 // Animate |
|
14291 el.animate( animation, { |
|
14292 queue: false, |
|
14293 duration: o.duration, |
|
14294 easing: o.easing, |
|
14295 complete: function() { |
|
14296 if ( mode === "hide" ) { |
|
14297 el.hide(); |
|
14298 } |
|
14299 $.effects.restore( el, props ); |
|
14300 $.effects.removeWrapper( el ); |
|
14301 done(); |
|
14302 } |
|
14303 }); |
|
14304 }; |
|
14305 |
|
14306 })(jQuery); |
|
14307 (function( $, undefined ) { |
|
14308 |
|
14309 $.effects.effect.explode = function( o, done ) { |
|
14310 |
|
14311 var rows = o.pieces ? Math.round( Math.sqrt( o.pieces ) ) : 3, |
|
14312 cells = rows, |
|
14313 el = $( this ), |
|
14314 mode = $.effects.setMode( el, o.mode || "hide" ), |
|
14315 show = mode === "show", |
|
14316 |
|
14317 // show and then visibility:hidden the element before calculating offset |
|
14318 offset = el.show().css( "visibility", "hidden" ).offset(), |
|
14319 |
|
14320 // width and height of a piece |
|
14321 width = Math.ceil( el.outerWidth() / cells ), |
|
14322 height = Math.ceil( el.outerHeight() / rows ), |
|
14323 pieces = [], |
|
14324 |
|
14325 // loop |
|
14326 i, j, left, top, mx, my; |
|
14327 |
|
14328 // children animate complete: |
|
14329 function childComplete() { |
|
14330 pieces.push( this ); |
|
14331 if ( pieces.length === rows * cells ) { |
|
14332 animComplete(); |
|
14333 } |
|
14334 } |
|
14335 |
|
14336 // clone the element for each row and cell. |
|
14337 for( i = 0; i < rows ; i++ ) { // ===> |
|
14338 top = offset.top + i * height; |
|
14339 my = i - ( rows - 1 ) / 2 ; |
|
14340 |
|
14341 for( j = 0; j < cells ; j++ ) { // ||| |
|
14342 left = offset.left + j * width; |
|
14343 mx = j - ( cells - 1 ) / 2 ; |
|
14344 |
|
14345 // Create a clone of the now hidden main element that will be absolute positioned |
|
14346 // within a wrapper div off the -left and -top equal to size of our pieces |
|
14347 el |
|
14348 .clone() |
|
14349 .appendTo( "body" ) |
|
14350 .wrap( "<div></div>" ) |
|
14351 .css({ |
|
14352 position: "absolute", |
|
14353 visibility: "visible", |
|
14354 left: -j * width, |
|
14355 top: -i * height |
|
14356 }) |
|
14357 |
|
14358 // select the wrapper - make it overflow: hidden and absolute positioned based on |
|
14359 // where the original was located +left and +top equal to the size of pieces |
|
14360 .parent() |
|
14361 .addClass( "ui-effects-explode" ) |
|
14362 .css({ |
|
14363 position: "absolute", |
|
14364 overflow: "hidden", |
|
14365 width: width, |
|
14366 height: height, |
|
14367 left: left + ( show ? mx * width : 0 ), |
|
14368 top: top + ( show ? my * height : 0 ), |
|
14369 opacity: show ? 0 : 1 |
|
14370 }).animate({ |
|
14371 left: left + ( show ? 0 : mx * width ), |
|
14372 top: top + ( show ? 0 : my * height ), |
|
14373 opacity: show ? 1 : 0 |
|
14374 }, o.duration || 500, o.easing, childComplete ); |
|
14375 } |
|
14376 } |
|
14377 |
|
14378 function animComplete() { |
|
14379 el.css({ |
|
14380 visibility: "visible" |
|
14381 }); |
|
14382 $( pieces ).remove(); |
|
14383 if ( !show ) { |
|
14384 el.hide(); |
|
14385 } |
|
14386 done(); |
|
14387 } |
|
14388 }; |
|
14389 |
|
14390 })(jQuery); |
|
14391 (function( $, undefined ) { |
|
14392 |
|
14393 $.effects.effect.fade = function( o, done ) { |
|
14394 var el = $( this ), |
|
14395 mode = $.effects.setMode( el, o.mode || "toggle" ); |
|
14396 |
|
14397 el.animate({ |
|
14398 opacity: mode |
|
14399 }, { |
|
14400 queue: false, |
|
14401 duration: o.duration, |
|
14402 easing: o.easing, |
|
14403 complete: done |
|
14404 }); |
|
14405 }; |
|
14406 |
|
14407 })( jQuery ); |
|
14408 (function( $, undefined ) { |
|
14409 |
|
14410 $.effects.effect.fold = function( o, done ) { |
|
14411 |
|
14412 // Create element |
|
14413 var el = $( this ), |
|
14414 props = [ "position", "top", "bottom", "left", "right", "height", "width" ], |
|
14415 mode = $.effects.setMode( el, o.mode || "hide" ), |
|
14416 show = mode === "show", |
|
14417 hide = mode === "hide", |
|
14418 size = o.size || 15, |
|
14419 percent = /([0-9]+)%/.exec( size ), |
|
14420 horizFirst = !!o.horizFirst, |
|
14421 widthFirst = show !== horizFirst, |
|
14422 ref = widthFirst ? [ "width", "height" ] : [ "height", "width" ], |
|
14423 duration = o.duration / 2, |
|
14424 wrapper, distance, |
|
14425 animation1 = {}, |
|
14426 animation2 = {}; |
|
14427 |
|
14428 $.effects.save( el, props ); |
|
14429 el.show(); |
|
14430 |
|
14431 // Create Wrapper |
|
14432 wrapper = $.effects.createWrapper( el ).css({ |
|
14433 overflow: "hidden" |
|
14434 }); |
|
14435 distance = widthFirst ? |
|
14436 [ wrapper.width(), wrapper.height() ] : |
|
14437 [ wrapper.height(), wrapper.width() ]; |
|
14438 |
|
14439 if ( percent ) { |
|
14440 size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ]; |
|
14441 } |
|
14442 if ( show ) { |
|
14443 wrapper.css( horizFirst ? { |
|
14444 height: 0, |
|
14445 width: size |
|
14446 } : { |
|
14447 height: size, |
|
14448 width: 0 |
|
14449 }); |
|
14450 } |
|
14451 |
|
14452 // Animation |
|
14453 animation1[ ref[ 0 ] ] = show ? distance[ 0 ] : size; |
|
14454 animation2[ ref[ 1 ] ] = show ? distance[ 1 ] : 0; |
|
14455 |
|
14456 // Animate |
|
14457 wrapper |
|
14458 .animate( animation1, duration, o.easing ) |
|
14459 .animate( animation2, duration, o.easing, function() { |
|
14460 if ( hide ) { |
|
14461 el.hide(); |
|
14462 } |
|
14463 $.effects.restore( el, props ); |
|
14464 $.effects.removeWrapper( el ); |
|
14465 done(); |
|
14466 }); |
|
14467 |
|
14468 }; |
|
14469 |
|
14470 })(jQuery); |
|
14471 (function( $, undefined ) { |
|
14472 |
|
14473 $.effects.effect.highlight = function( o, done ) { |
|
14474 var elem = $( this ), |
|
14475 props = [ "backgroundImage", "backgroundColor", "opacity" ], |
|
14476 mode = $.effects.setMode( elem, o.mode || "show" ), |
|
14477 animation = { |
|
14478 backgroundColor: elem.css( "backgroundColor" ) |
|
14479 }; |
|
14480 |
|
14481 if (mode === "hide") { |
|
14482 animation.opacity = 0; |
|
14483 } |
|
14484 |
|
14485 $.effects.save( elem, props ); |
|
14486 |
|
14487 elem |
|
14488 .show() |
|
14489 .css({ |
|
14490 backgroundImage: "none", |
|
14491 backgroundColor: o.color || "#ffff99" |
|
14492 }) |
|
14493 .animate( animation, { |
|
14494 queue: false, |
|
14495 duration: o.duration, |
|
14496 easing: o.easing, |
|
14497 complete: function() { |
|
14498 if ( mode === "hide" ) { |
|
14499 elem.hide(); |
|
14500 } |
|
14501 $.effects.restore( elem, props ); |
|
14502 done(); |
|
14503 } |
|
14504 }); |
|
14505 }; |
|
14506 |
|
14507 })(jQuery); |
|
14508 (function( $, undefined ) { |
|
14509 |
|
14510 $.effects.effect.pulsate = function( o, done ) { |
|
14511 var elem = $( this ), |
|
14512 mode = $.effects.setMode( elem, o.mode || "show" ), |
|
14513 show = mode === "show", |
|
14514 hide = mode === "hide", |
|
14515 showhide = ( show || mode === "hide" ), |
|
14516 |
|
14517 // showing or hiding leaves of the "last" animation |
|
14518 anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ), |
|
14519 duration = o.duration / anims, |
|
14520 animateTo = 0, |
|
14521 queue = elem.queue(), |
|
14522 queuelen = queue.length, |
|
14523 i; |
|
14524 |
|
14525 if ( show || !elem.is(":visible")) { |
|
14526 elem.css( "opacity", 0 ).show(); |
|
14527 animateTo = 1; |
|
14528 } |
|
14529 |
|
14530 // anims - 1 opacity "toggles" |
|
14531 for ( i = 1; i < anims; i++ ) { |
|
14532 elem.animate({ |
|
14533 opacity: animateTo |
|
14534 }, duration, o.easing ); |
|
14535 animateTo = 1 - animateTo; |
|
14536 } |
|
14537 |
|
14538 elem.animate({ |
|
14539 opacity: animateTo |
|
14540 }, duration, o.easing); |
|
14541 |
|
14542 elem.queue(function() { |
|
14543 if ( hide ) { |
|
14544 elem.hide(); |
|
14545 } |
|
14546 done(); |
|
14547 }); |
|
14548 |
|
14549 // We just queued up "anims" animations, we need to put them next in the queue |
|
14550 if ( queuelen > 1 ) { |
|
14551 queue.splice.apply( queue, |
|
14552 [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) ); |
|
14553 } |
|
14554 elem.dequeue(); |
|
14555 }; |
|
14556 |
|
14557 })(jQuery); |
|
14558 (function( $, undefined ) { |
|
14559 |
|
14560 $.effects.effect.puff = function( o, done ) { |
|
14561 var elem = $( this ), |
|
14562 mode = $.effects.setMode( elem, o.mode || "hide" ), |
|
14563 hide = mode === "hide", |
|
14564 percent = parseInt( o.percent, 10 ) || 150, |
|
14565 factor = percent / 100, |
|
14566 original = { |
|
14567 height: elem.height(), |
|
14568 width: elem.width(), |
|
14569 outerHeight: elem.outerHeight(), |
|
14570 outerWidth: elem.outerWidth() |
|
14571 }; |
|
14572 |
|
14573 $.extend( o, { |
|
14574 effect: "scale", |
|
14575 queue: false, |
|
14576 fade: true, |
|
14577 mode: mode, |
|
14578 complete: done, |
|
14579 percent: hide ? percent : 100, |
|
14580 from: hide ? |
|
14581 original : |
|
14582 { |
|
14583 height: original.height * factor, |
|
14584 width: original.width * factor, |
|
14585 outerHeight: original.outerHeight * factor, |
|
14586 outerWidth: original.outerWidth * factor |
|
14587 } |
|
14588 }); |
|
14589 |
|
14590 elem.effect( o ); |
|
14591 }; |
|
14592 |
|
14593 $.effects.effect.scale = function( o, done ) { |
|
14594 |
|
14595 // Create element |
|
14596 var el = $( this ), |
|
14597 options = $.extend( true, {}, o ), |
|
14598 mode = $.effects.setMode( el, o.mode || "effect" ), |
|
14599 percent = parseInt( o.percent, 10 ) || |
|
14600 ( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode === "hide" ? 0 : 100 ) ), |
|
14601 direction = o.direction || "both", |
|
14602 origin = o.origin, |
|
14603 original = { |
|
14604 height: el.height(), |
|
14605 width: el.width(), |
|
14606 outerHeight: el.outerHeight(), |
|
14607 outerWidth: el.outerWidth() |
|
14608 }, |
|
14609 factor = { |
|
14610 y: direction !== "horizontal" ? (percent / 100) : 1, |
|
14611 x: direction !== "vertical" ? (percent / 100) : 1 |
|
14612 }; |
|
14613 |
|
14614 // We are going to pass this effect to the size effect: |
|
14615 options.effect = "size"; |
|
14616 options.queue = false; |
|
14617 options.complete = done; |
|
14618 |
|
14619 // Set default origin and restore for show/hide |
|
14620 if ( mode !== "effect" ) { |
|
14621 options.origin = origin || ["middle","center"]; |
|
14622 options.restore = true; |
|
14623 } |
|
14624 |
|
14625 options.from = o.from || ( mode === "show" ? { |
|
14626 height: 0, |
|
14627 width: 0, |
|
14628 outerHeight: 0, |
|
14629 outerWidth: 0 |
|
14630 } : original ); |
|
14631 options.to = { |
|
14632 height: original.height * factor.y, |
|
14633 width: original.width * factor.x, |
|
14634 outerHeight: original.outerHeight * factor.y, |
|
14635 outerWidth: original.outerWidth * factor.x |
|
14636 }; |
|
14637 |
|
14638 // Fade option to support puff |
|
14639 if ( options.fade ) { |
|
14640 if ( mode === "show" ) { |
|
14641 options.from.opacity = 0; |
|
14642 options.to.opacity = 1; |
|
14643 } |
|
14644 if ( mode === "hide" ) { |
|
14645 options.from.opacity = 1; |
|
14646 options.to.opacity = 0; |
|
14647 } |
|
14648 } |
|
14649 |
|
14650 // Animate |
|
14651 el.effect( options ); |
|
14652 |
|
14653 }; |
|
14654 |
|
14655 $.effects.effect.size = function( o, done ) { |
|
14656 |
|
14657 // Create element |
|
14658 var original, baseline, factor, |
|
14659 el = $( this ), |
|
14660 props0 = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ], |
|
14661 |
|
14662 // Always restore |
|
14663 props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ], |
|
14664 |
|
14665 // Copy for children |
|
14666 props2 = [ "width", "height", "overflow" ], |
|
14667 cProps = [ "fontSize" ], |
|
14668 vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ], |
|
14669 hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ], |
|
14670 |
|
14671 // Set options |
|
14672 mode = $.effects.setMode( el, o.mode || "effect" ), |
|
14673 restore = o.restore || mode !== "effect", |
|
14674 scale = o.scale || "both", |
|
14675 origin = o.origin || [ "middle", "center" ], |
|
14676 position = el.css( "position" ), |
|
14677 props = restore ? props0 : props1, |
|
14678 zero = { |
|
14679 height: 0, |
|
14680 width: 0, |
|
14681 outerHeight: 0, |
|
14682 outerWidth: 0 |
|
14683 }; |
|
14684 |
|
14685 if ( mode === "show" ) { |
|
14686 el.show(); |
|
14687 } |
|
14688 original = { |
|
14689 height: el.height(), |
|
14690 width: el.width(), |
|
14691 outerHeight: el.outerHeight(), |
|
14692 outerWidth: el.outerWidth() |
|
14693 }; |
|
14694 |
|
14695 if ( o.mode === "toggle" && mode === "show" ) { |
|
14696 el.from = o.to || zero; |
|
14697 el.to = o.from || original; |
|
14698 } else { |
|
14699 el.from = o.from || ( mode === "show" ? zero : original ); |
|
14700 el.to = o.to || ( mode === "hide" ? zero : original ); |
|
14701 } |
|
14702 |
|
14703 // Set scaling factor |
|
14704 factor = { |
|
14705 from: { |
|
14706 y: el.from.height / original.height, |
|
14707 x: el.from.width / original.width |
|
14708 }, |
|
14709 to: { |
|
14710 y: el.to.height / original.height, |
|
14711 x: el.to.width / original.width |
|
14712 } |
|
14713 }; |
|
14714 |
|
14715 // Scale the css box |
|
14716 if ( scale === "box" || scale === "both" ) { |
|
14717 |
|
14718 // Vertical props scaling |
|
14719 if ( factor.from.y !== factor.to.y ) { |
|
14720 props = props.concat( vProps ); |
|
14721 el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from ); |
|
14722 el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to ); |
|
14723 } |
|
14724 |
|
14725 // Horizontal props scaling |
|
14726 if ( factor.from.x !== factor.to.x ) { |
|
14727 props = props.concat( hProps ); |
|
14728 el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from ); |
|
14729 el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to ); |
|
14730 } |
|
14731 } |
|
14732 |
|
14733 // Scale the content |
|
14734 if ( scale === "content" || scale === "both" ) { |
|
14735 |
|
14736 // Vertical props scaling |
|
14737 if ( factor.from.y !== factor.to.y ) { |
|
14738 props = props.concat( cProps ).concat( props2 ); |
|
14739 el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from ); |
|
14740 el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to ); |
|
14741 } |
|
14742 } |
|
14743 |
|
14744 $.effects.save( el, props ); |
|
14745 el.show(); |
|
14746 $.effects.createWrapper( el ); |
|
14747 el.css( "overflow", "hidden" ).css( el.from ); |
|
14748 |
|
14749 // Adjust |
|
14750 if (origin) { // Calculate baseline shifts |
|
14751 baseline = $.effects.getBaseline( origin, original ); |
|
14752 el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y; |
|
14753 el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x; |
|
14754 el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y; |
|
14755 el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x; |
|
14756 } |
|
14757 el.css( el.from ); // set top & left |
|
14758 |
|
14759 // Animate |
|
14760 if ( scale === "content" || scale === "both" ) { // Scale the children |
|
14761 |
|
14762 // Add margins/font-size |
|
14763 vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps); |
|
14764 hProps = hProps.concat([ "marginLeft", "marginRight" ]); |
|
14765 props2 = props0.concat(vProps).concat(hProps); |
|
14766 |
|
14767 el.find( "*[width]" ).each( function(){ |
|
14768 var child = $( this ), |
|
14769 c_original = { |
|
14770 height: child.height(), |
|
14771 width: child.width(), |
|
14772 outerHeight: child.outerHeight(), |
|
14773 outerWidth: child.outerWidth() |
|
14774 }; |
|
14775 if (restore) { |
|
14776 $.effects.save(child, props2); |
|
14777 } |
|
14778 |
|
14779 child.from = { |
|
14780 height: c_original.height * factor.from.y, |
|
14781 width: c_original.width * factor.from.x, |
|
14782 outerHeight: c_original.outerHeight * factor.from.y, |
|
14783 outerWidth: c_original.outerWidth * factor.from.x |
|
14784 }; |
|
14785 child.to = { |
|
14786 height: c_original.height * factor.to.y, |
|
14787 width: c_original.width * factor.to.x, |
|
14788 outerHeight: c_original.height * factor.to.y, |
|
14789 outerWidth: c_original.width * factor.to.x |
|
14790 }; |
|
14791 |
|
14792 // Vertical props scaling |
|
14793 if ( factor.from.y !== factor.to.y ) { |
|
14794 child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from ); |
|
14795 child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to ); |
|
14796 } |
|
14797 |
|
14798 // Horizontal props scaling |
|
14799 if ( factor.from.x !== factor.to.x ) { |
|
14800 child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from ); |
|
14801 child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to ); |
|
14802 } |
|
14803 |
|
14804 // Animate children |
|
14805 child.css( child.from ); |
|
14806 child.animate( child.to, o.duration, o.easing, function() { |
|
14807 |
|
14808 // Restore children |
|
14809 if ( restore ) { |
|
14810 $.effects.restore( child, props2 ); |
|
14811 } |
|
14812 }); |
|
14813 }); |
|
14814 } |
|
14815 |
|
14816 // Animate |
|
14817 el.animate( el.to, { |
|
14818 queue: false, |
|
14819 duration: o.duration, |
|
14820 easing: o.easing, |
|
14821 complete: function() { |
|
14822 if ( el.to.opacity === 0 ) { |
|
14823 el.css( "opacity", el.from.opacity ); |
|
14824 } |
|
14825 if( mode === "hide" ) { |
|
14826 el.hide(); |
|
14827 } |
|
14828 $.effects.restore( el, props ); |
|
14829 if ( !restore ) { |
|
14830 |
|
14831 // we need to calculate our new positioning based on the scaling |
|
14832 if ( position === "static" ) { |
|
14833 el.css({ |
|
14834 position: "relative", |
|
14835 top: el.to.top, |
|
14836 left: el.to.left |
|
14837 }); |
|
14838 } else { |
|
14839 $.each([ "top", "left" ], function( idx, pos ) { |
|
14840 el.css( pos, function( _, str ) { |
|
14841 var val = parseInt( str, 10 ), |
|
14842 toRef = idx ? el.to.left : el.to.top; |
|
14843 |
|
14844 // if original was "auto", recalculate the new value from wrapper |
|
14845 if ( str === "auto" ) { |
|
14846 return toRef + "px"; |
|
14847 } |
|
14848 |
|
14849 return val + toRef + "px"; |
|
14850 }); |
|
14851 }); |
|
14852 } |
|
14853 } |
|
14854 |
|
14855 $.effects.removeWrapper( el ); |
|
14856 done(); |
|
14857 } |
|
14858 }); |
|
14859 |
|
14860 }; |
|
14861 |
|
14862 })(jQuery); |
|
14863 (function( $, undefined ) { |
|
14864 |
|
14865 $.effects.effect.shake = function( o, done ) { |
|
14866 |
|
14867 var el = $( this ), |
|
14868 props = [ "position", "top", "bottom", "left", "right", "height", "width" ], |
|
14869 mode = $.effects.setMode( el, o.mode || "effect" ), |
|
14870 direction = o.direction || "left", |
|
14871 distance = o.distance || 20, |
|
14872 times = o.times || 3, |
|
14873 anims = times * 2 + 1, |
|
14874 speed = Math.round(o.duration/anims), |
|
14875 ref = (direction === "up" || direction === "down") ? "top" : "left", |
|
14876 positiveMotion = (direction === "up" || direction === "left"), |
|
14877 animation = {}, |
|
14878 animation1 = {}, |
|
14879 animation2 = {}, |
|
14880 i, |
|
14881 |
|
14882 // we will need to re-assemble the queue to stack our animations in place |
|
14883 queue = el.queue(), |
|
14884 queuelen = queue.length; |
|
14885 |
|
14886 $.effects.save( el, props ); |
|
14887 el.show(); |
|
14888 $.effects.createWrapper( el ); |
|
14889 |
|
14890 // Animation |
|
14891 animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance; |
|
14892 animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2; |
|
14893 animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2; |
|
14894 |
|
14895 // Animate |
|
14896 el.animate( animation, speed, o.easing ); |
|
14897 |
|
14898 // Shakes |
|
14899 for ( i = 1; i < times; i++ ) { |
|
14900 el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing ); |
|
14901 } |
|
14902 el |
|
14903 .animate( animation1, speed, o.easing ) |
|
14904 .animate( animation, speed / 2, o.easing ) |
|
14905 .queue(function() { |
|
14906 if ( mode === "hide" ) { |
|
14907 el.hide(); |
|
14908 } |
|
14909 $.effects.restore( el, props ); |
|
14910 $.effects.removeWrapper( el ); |
|
14911 done(); |
|
14912 }); |
|
14913 |
|
14914 // inject all the animations we just queued to be first in line (after "inprogress") |
|
14915 if ( queuelen > 1) { |
|
14916 queue.splice.apply( queue, |
|
14917 [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) ); |
|
14918 } |
|
14919 el.dequeue(); |
|
14920 |
|
14921 }; |
|
14922 |
|
14923 })(jQuery); |
|
14924 (function( $, undefined ) { |
|
14925 |
|
14926 $.effects.effect.slide = function( o, done ) { |
|
14927 |
|
14928 // Create element |
|
14929 var el = $( this ), |
|
14930 props = [ "position", "top", "bottom", "left", "right", "width", "height" ], |
|
14931 mode = $.effects.setMode( el, o.mode || "show" ), |
|
14932 show = mode === "show", |
|
14933 direction = o.direction || "left", |
|
14934 ref = (direction === "up" || direction === "down") ? "top" : "left", |
|
14935 positiveMotion = (direction === "up" || direction === "left"), |
|
14936 distance, |
|
14937 animation = {}; |
|
14938 |
|
14939 // Adjust |
|
14940 $.effects.save( el, props ); |
|
14941 el.show(); |
|
14942 distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ); |
|
14943 |
|
14944 $.effects.createWrapper( el ).css({ |
|
14945 overflow: "hidden" |
|
14946 }); |
|
14947 |
|
14948 if ( show ) { |
|
14949 el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance ); |
|
14950 } |
|
14951 |
|
14952 // Animation |
|
14953 animation[ ref ] = ( show ? |
|
14954 ( positiveMotion ? "+=" : "-=") : |
|
14955 ( positiveMotion ? "-=" : "+=")) + |
|
14956 distance; |
|
14957 |
|
14958 // Animate |
|
14959 el.animate( animation, { |
|
14960 queue: false, |
|
14961 duration: o.duration, |
|
14962 easing: o.easing, |
|
14963 complete: function() { |
|
14964 if ( mode === "hide" ) { |
|
14965 el.hide(); |
|
14966 } |
|
14967 $.effects.restore( el, props ); |
|
14968 $.effects.removeWrapper( el ); |
|
14969 done(); |
|
14970 } |
|
14971 }); |
|
14972 }; |
|
14973 |
|
14974 })(jQuery); |
|
14975 (function( $, undefined ) { |
|
14976 |
|
14977 $.effects.effect.transfer = function( o, done ) { |
|
14978 var elem = $( this ), |
|
14979 target = $( o.to ), |
|
14980 targetFixed = target.css( "position" ) === "fixed", |
|
14981 body = $("body"), |
|
14982 fixTop = targetFixed ? body.scrollTop() : 0, |
|
14983 fixLeft = targetFixed ? body.scrollLeft() : 0, |
|
14984 endPosition = target.offset(), |
|
14985 animation = { |
|
14986 top: endPosition.top - fixTop , |
|
14987 left: endPosition.left - fixLeft , |
|
14988 height: target.innerHeight(), |
|
14989 width: target.innerWidth() |
|
14990 }, |
|
14991 startPosition = elem.offset(), |
|
14992 transfer = $( "<div class='ui-effects-transfer'></div>" ) |
|
14993 .appendTo( document.body ) |
|
14994 .addClass( o.className ) |
|
14995 .css({ |
|
14996 top: startPosition.top - fixTop , |
|
14997 left: startPosition.left - fixLeft , |
|
14998 height: elem.innerHeight(), |
|
14999 width: elem.innerWidth(), |
|
15000 position: targetFixed ? "fixed" : "absolute" |
|
15001 }) |
|
15002 .animate( animation, o.duration, o.easing, function() { |
|
15003 transfer.remove(); |
|
15004 done(); |
|
15005 }); |
|
15006 }; |
|
15007 |
|
15008 })(jQuery); |