mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-10-05 01:44:18 +00:00
Just a quick touch to update to new internal effects object API
This commit is contained in:
parent
5fd1f17393
commit
a370d1ffc8
13
ui/jquery.effects.clip.js
vendored
13
ui/jquery.effects.clip.js
vendored
@ -17,11 +17,10 @@ $.effects.clip = function(o) {
|
|||||||
return this.queue(function() {
|
return this.queue(function() {
|
||||||
|
|
||||||
// Create element
|
// Create element
|
||||||
var el = $(this), props = ['position','top','bottom','left','right','height','width'];
|
var el = $( this ),
|
||||||
|
props = ['position','top','bottom','left','right','height','width'],
|
||||||
// Set options
|
mode = $.effects.setMode( el, o.mode || 'hide' ),
|
||||||
var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
|
direction = o.direction || 'vertical'; // Default direction
|
||||||
var direction = o.options.direction || 'vertical'; // Default direction
|
|
||||||
|
|
||||||
// Adjust
|
// Adjust
|
||||||
$.effects.save(el, props); el.show(); // Save & Show
|
$.effects.save(el, props); el.show(); // Save & Show
|
||||||
@ -40,10 +39,10 @@ $.effects.clip = function(o) {
|
|||||||
animation[ref.position] = mode == 'show' ? 0 : distance / 2;
|
animation[ref.position] = mode == 'show' ? 0 : distance / 2;
|
||||||
|
|
||||||
// Animate
|
// Animate
|
||||||
animate.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
|
animate.animate(animation, { queue: false, duration: o.duration, easing: o.easing, complete: function() {
|
||||||
if(mode == 'hide') el.hide(); // Hide
|
if(mode == 'hide') el.hide(); // Hide
|
||||||
$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
|
$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
|
||||||
if(o.callback) o.callback.apply(el[0], arguments); // Callback
|
if(o.complete) o.complete.apply(el[0], arguments); // Callback
|
||||||
el.dequeue();
|
el.dequeue();
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
15
ui/jquery.effects.drop.js
vendored
15
ui/jquery.effects.drop.js
vendored
@ -17,18 +17,17 @@ $.effects.drop = function(o) {
|
|||||||
return this.queue(function() {
|
return this.queue(function() {
|
||||||
|
|
||||||
// Create element
|
// Create element
|
||||||
var el = $(this), props = ['position','top','bottom','left','right','opacity'];
|
var el = $( this ),
|
||||||
|
props = ['position','top','bottom','left','right','opacity'],
|
||||||
// Set options
|
mode = $.effects.setMode(el, o.mode || 'hide'),
|
||||||
var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
|
direction = o.direction || 'left'; // Default Direction
|
||||||
var direction = o.options.direction || 'left'; // Default Direction
|
|
||||||
|
|
||||||
// Adjust
|
// Adjust
|
||||||
$.effects.save(el, props); el.show(); // Save & Show
|
$.effects.save(el, props); el.show(); // Save & Show
|
||||||
$.effects.createWrapper(el); // Create Wrapper
|
$.effects.createWrapper(el); // Create Wrapper
|
||||||
var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
|
var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
|
||||||
var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
|
var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
|
||||||
var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 2 : el.outerWidth({margin:true}) / 2);
|
var distance = o.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 2 : el.outerWidth({margin:true}) / 2);
|
||||||
if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
|
if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
|
||||||
|
|
||||||
// Animation
|
// Animation
|
||||||
@ -36,10 +35,10 @@ $.effects.drop = function(o) {
|
|||||||
animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
|
animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
|
||||||
|
|
||||||
// Animate
|
// Animate
|
||||||
el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
|
el.animate(animation, { queue: false, duration: o.duration, easing: o.easing, complete: function() {
|
||||||
if(mode == 'hide') el.hide(); // Hide
|
if(mode == 'hide') el.hide(); // Hide
|
||||||
$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
|
$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
|
||||||
if(o.callback) o.callback.apply(this, arguments); // Callback
|
if(o.complete) o.complete.apply(this, arguments); // Callback
|
||||||
el.dequeue();
|
el.dequeue();
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
22
ui/jquery.effects.explode.js
vendored
22
ui/jquery.effects.explode.js
vendored
@ -16,10 +16,10 @@ $.effects.explode = function(o) {
|
|||||||
|
|
||||||
return this.queue(function() {
|
return this.queue(function() {
|
||||||
|
|
||||||
var rows = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
|
var rows = o.pieces ? Math.round(Math.sqrt(o.pieces)) : 3;
|
||||||
var cells = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
|
var cells = o.pieces ? Math.round(Math.sqrt(o.pieces)) : 3;
|
||||||
|
|
||||||
o.options.mode = o.options.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.options.mode;
|
o.mode = o.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.mode;
|
||||||
var el = $(this).show().css('visibility', 'hidden');
|
var el = $(this).show().css('visibility', 'hidden');
|
||||||
var offset = el.offset();
|
var offset = el.offset();
|
||||||
|
|
||||||
@ -49,13 +49,13 @@ $.effects.explode = function(o) {
|
|||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
width: width/cells,
|
width: width/cells,
|
||||||
height: height/rows,
|
height: height/rows,
|
||||||
left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? (j-Math.floor(cells/2))*(width/cells) : 0),
|
left: offset.left + j*(width/cells) + (o.mode == 'show' ? (j-Math.floor(cells/2))*(width/cells) : 0),
|
||||||
top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? (i-Math.floor(rows/2))*(height/rows) : 0),
|
top: offset.top + i*(height/rows) + (o.mode == 'show' ? (i-Math.floor(rows/2))*(height/rows) : 0),
|
||||||
opacity: o.options.mode == 'show' ? 0 : 1
|
opacity: o.mode == 'show' ? 0 : 1
|
||||||
}).animate({
|
}).animate({
|
||||||
left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? 0 : (j-Math.floor(cells/2))*(width/cells)),
|
left: offset.left + j*(width/cells) + (o.mode == 'show' ? 0 : (j-Math.floor(cells/2))*(width/cells)),
|
||||||
top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? 0 : (i-Math.floor(rows/2))*(height/rows)),
|
top: offset.top + i*(height/rows) + (o.mode == 'show' ? 0 : (i-Math.floor(rows/2))*(height/rows)),
|
||||||
opacity: o.options.mode == 'show' ? 1 : 0
|
opacity: o.mode == 'show' ? 1 : 0
|
||||||
}, o.duration || 500);
|
}, o.duration || 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,8 +63,8 @@ $.effects.explode = function(o) {
|
|||||||
// Set a timeout, to call the callback approx. when the other animations have finished
|
// Set a timeout, to call the callback approx. when the other animations have finished
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
|
||||||
o.options.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide();
|
o.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide();
|
||||||
if(o.callback) o.callback.apply(el[0]); // Callback
|
if(o.complete) o.complete.apply(el[0]); // Callback
|
||||||
el.dequeue();
|
el.dequeue();
|
||||||
|
|
||||||
$('div.ui-effects-explode').remove();
|
$('div.ui-effects-explode').remove();
|
||||||
|
12
ui/jquery.effects.fold.js
vendored
12
ui/jquery.effects.fold.js
vendored
@ -20,9 +20,9 @@ $.effects.fold = function(o) {
|
|||||||
var el = $(this), props = ['position','top','bottom','left','right'];
|
var el = $(this), props = ['position','top','bottom','left','right'];
|
||||||
|
|
||||||
// Set options
|
// Set options
|
||||||
var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
|
var mode = $.effects.setMode(el, o.mode || 'hide'); // Set Mode
|
||||||
var size = o.options.size || 15; // Default fold size
|
var size = o.size || 15; // Default fold size
|
||||||
var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value
|
var horizFirst = !(!o.horizFirst); // Ensure a boolean value
|
||||||
var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2;
|
var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2;
|
||||||
|
|
||||||
// Adjust
|
// Adjust
|
||||||
@ -41,11 +41,11 @@ $.effects.fold = function(o) {
|
|||||||
animation2[ref[1]] = mode == 'show' ? distance[1] : 0;
|
animation2[ref[1]] = mode == 'show' ? distance[1] : 0;
|
||||||
|
|
||||||
// Animate
|
// Animate
|
||||||
wrapper.animate(animation1, duration, o.options.easing)
|
wrapper.animate(animation1, duration, o.easing)
|
||||||
.animate(animation2, duration, o.options.easing, function() {
|
.animate(animation2, duration, o.easing, function() {
|
||||||
if(mode == 'hide') el.hide(); // Hide
|
if(mode == 'hide') el.hide(); // Hide
|
||||||
$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
|
$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
|
||||||
if(o.callback) o.callback.apply(el[0], arguments); // Callback
|
if(o.complete) o.complete.apply(el[0], arguments); // Callback
|
||||||
el.dequeue();
|
el.dequeue();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
8
ui/jquery.effects.highlight.js
vendored
8
ui/jquery.effects.highlight.js
vendored
@ -16,7 +16,7 @@ $.effects.highlight = function(o) {
|
|||||||
return this.queue(function() {
|
return this.queue(function() {
|
||||||
var elem = $(this),
|
var elem = $(this),
|
||||||
props = ['backgroundImage', 'backgroundColor', 'opacity'],
|
props = ['backgroundImage', 'backgroundColor', 'opacity'],
|
||||||
mode = $.effects.setMode(elem, o.options.mode || 'show'),
|
mode = $.effects.setMode(elem, o.mode || 'show'),
|
||||||
animation = {
|
animation = {
|
||||||
backgroundColor: elem.css('backgroundColor')
|
backgroundColor: elem.css('backgroundColor')
|
||||||
};
|
};
|
||||||
@ -30,17 +30,17 @@ $.effects.highlight = function(o) {
|
|||||||
.show()
|
.show()
|
||||||
.css({
|
.css({
|
||||||
backgroundImage: 'none',
|
backgroundImage: 'none',
|
||||||
backgroundColor: o.options.color || '#ffff99'
|
backgroundColor: o.color || '#ffff99'
|
||||||
})
|
})
|
||||||
.animate(animation, {
|
.animate(animation, {
|
||||||
queue: false,
|
queue: false,
|
||||||
duration: o.duration,
|
duration: o.duration,
|
||||||
easing: o.options.easing,
|
easing: o.easing,
|
||||||
complete: function() {
|
complete: function() {
|
||||||
(mode == 'hide' && elem.hide());
|
(mode == 'hide' && elem.hide());
|
||||||
$.effects.restore(elem, props);
|
$.effects.restore(elem, props);
|
||||||
(mode == 'show' && !$.support.opacity && this.style.removeAttribute('filter'));
|
(mode == 'show' && !$.support.opacity && this.style.removeAttribute('filter'));
|
||||||
(o.callback && o.callback.apply(this, arguments));
|
(o.complete && o.complete.apply(this, arguments));
|
||||||
elem.dequeue();
|
elem.dequeue();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
10
ui/jquery.effects.pulsate.js
vendored
10
ui/jquery.effects.pulsate.js
vendored
@ -15,8 +15,8 @@
|
|||||||
$.effects.pulsate = function(o) {
|
$.effects.pulsate = function(o) {
|
||||||
return this.queue(function() {
|
return this.queue(function() {
|
||||||
var elem = $(this),
|
var elem = $(this),
|
||||||
mode = $.effects.setMode(elem, o.options.mode || 'show'),
|
mode = $.effects.setMode(elem, o.mode || 'show'),
|
||||||
times = ((o.options.times || 5) * 2) - 1,
|
times = ((o.times || 5) * 2) - 1,
|
||||||
duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2,
|
duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2,
|
||||||
isVisible = elem.is(':visible'),
|
isVisible = elem.is(':visible'),
|
||||||
animateTo = 0;
|
animateTo = 0;
|
||||||
@ -31,15 +31,15 @@ $.effects.pulsate = function(o) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < times; i++) {
|
for (var i = 0; i < times; i++) {
|
||||||
elem.animate({ opacity: animateTo }, duration, o.options.easing);
|
elem.animate({ opacity: animateTo }, duration, o.easing);
|
||||||
animateTo = (animateTo + 1) % 2;
|
animateTo = (animateTo + 1) % 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
elem.animate({ opacity: animateTo }, duration, o.options.easing, function() {
|
elem.animate({ opacity: animateTo }, duration, o.easing, function() {
|
||||||
if (animateTo == 0) {
|
if (animateTo == 0) {
|
||||||
elem.hide();
|
elem.hide();
|
||||||
}
|
}
|
||||||
(o.callback && o.callback.apply(this, arguments));
|
(o.complete && o.complete.apply(this, arguments));
|
||||||
});
|
});
|
||||||
|
|
||||||
elem
|
elem
|
||||||
|
20
ui/jquery.effects.shake.js
vendored
20
ui/jquery.effects.shake.js
vendored
@ -20,11 +20,11 @@ $.effects.shake = function(o) {
|
|||||||
var el = $(this), props = ['position','top','bottom','left','right'];
|
var el = $(this), props = ['position','top','bottom','left','right'];
|
||||||
|
|
||||||
// Set options
|
// Set options
|
||||||
var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
|
var mode = $.effects.setMode(el, o.mode || 'effect'); // Set Mode
|
||||||
var direction = o.options.direction || 'left'; // Default direction
|
var direction = o.direction || 'left'; // Default direction
|
||||||
var distance = o.options.distance || 20; // Default distance
|
var distance = o.distance || 20; // Default distance
|
||||||
var times = o.options.times || 3; // Default # of times
|
var times = o.times || 3; // Default # of times
|
||||||
var speed = o.duration || o.options.duration || 140; // Default speed per shake
|
var speed = o.duration || o.duration || 140; // Default speed per shake
|
||||||
|
|
||||||
// Adjust
|
// Adjust
|
||||||
$.effects.save(el, props); el.show(); // Save & Show
|
$.effects.save(el, props); el.show(); // Save & Show
|
||||||
@ -39,14 +39,14 @@ $.effects.shake = function(o) {
|
|||||||
animation2[ref] = (motion == 'pos' ? '-=' : '+=') + distance * 2;
|
animation2[ref] = (motion == 'pos' ? '-=' : '+=') + distance * 2;
|
||||||
|
|
||||||
// Animate
|
// Animate
|
||||||
el.animate(animation, speed, o.options.easing);
|
el.animate(animation, speed, o.easing);
|
||||||
for (var i = 1; i < times; i++) { // Shakes
|
for (var i = 1; i < times; i++) { // Shakes
|
||||||
el.animate(animation1, speed, o.options.easing).animate(animation2, speed, o.options.easing);
|
el.animate(animation1, speed, o.easing).animate(animation2, speed, o.easing);
|
||||||
};
|
};
|
||||||
el.animate(animation1, speed, o.options.easing).
|
el.animate(animation1, speed, o.easing).
|
||||||
animate(animation, speed / 2, o.options.easing, function(){ // Last shake
|
animate(animation, speed / 2, o.easing, function(){ // Last shake
|
||||||
$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
|
$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
|
||||||
if(o.callback) o.callback.apply(this, arguments); // Callback
|
if(o.complete) o.complete.apply(this, arguments); // Callback
|
||||||
});
|
});
|
||||||
el.queue('fx', function() { el.dequeue(); });
|
el.queue('fx', function() { el.dequeue(); });
|
||||||
el.dequeue();
|
el.dequeue();
|
||||||
|
10
ui/jquery.effects.slide.js
vendored
10
ui/jquery.effects.slide.js
vendored
@ -20,15 +20,15 @@ $.effects.slide = function(o) {
|
|||||||
var el = $(this), props = ['position','top','bottom','left','right'];
|
var el = $(this), props = ['position','top','bottom','left','right'];
|
||||||
|
|
||||||
// Set options
|
// Set options
|
||||||
var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
|
var mode = $.effects.setMode(el, o.mode || 'show'); // Set Mode
|
||||||
var direction = o.options.direction || 'left'; // Default Direction
|
var direction = o.direction || 'left'; // Default Direction
|
||||||
|
|
||||||
// Adjust
|
// Adjust
|
||||||
$.effects.save(el, props); el.show(); // Save & Show
|
$.effects.save(el, props); el.show(); // Save & Show
|
||||||
$.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
|
$.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
|
||||||
var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
|
var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
|
||||||
var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
|
var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
|
||||||
var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true}));
|
var distance = o.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true}));
|
||||||
if (mode == 'show') el.css(ref, motion == 'pos' ? (isNaN(distance) ? "-" + distance : -distance) : distance); // Shift
|
if (mode == 'show') el.css(ref, motion == 'pos' ? (isNaN(distance) ? "-" + distance : -distance) : distance); // Shift
|
||||||
|
|
||||||
// Animation
|
// Animation
|
||||||
@ -36,10 +36,10 @@ $.effects.slide = function(o) {
|
|||||||
animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
|
animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
|
||||||
|
|
||||||
// Animate
|
// Animate
|
||||||
el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
|
el.animate(animation, { queue: false, duration: o.duration, easing: o.easing, complete: function() {
|
||||||
if(mode == 'hide') el.hide(); // Hide
|
if(mode == 'hide') el.hide(); // Hide
|
||||||
$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
|
$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
|
||||||
if(o.callback) o.callback.apply(this, arguments); // Callback
|
if(o.complete) o.complete.apply(this, arguments); // Callback
|
||||||
el.dequeue();
|
el.dequeue();
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
8
ui/jquery.effects.transfer.js
vendored
8
ui/jquery.effects.transfer.js
vendored
@ -15,7 +15,7 @@
|
|||||||
$.effects.transfer = function(o) {
|
$.effects.transfer = function(o) {
|
||||||
return this.queue(function() {
|
return this.queue(function() {
|
||||||
var elem = $(this),
|
var elem = $(this),
|
||||||
target = $(o.options.to),
|
target = $(o.to),
|
||||||
endPosition = target.offset(),
|
endPosition = target.offset(),
|
||||||
animation = {
|
animation = {
|
||||||
top: endPosition.top,
|
top: endPosition.top,
|
||||||
@ -26,7 +26,7 @@ $.effects.transfer = function(o) {
|
|||||||
startPosition = elem.offset(),
|
startPosition = elem.offset(),
|
||||||
transfer = $('<div class="ui-effects-transfer"></div>')
|
transfer = $('<div class="ui-effects-transfer"></div>')
|
||||||
.appendTo(document.body)
|
.appendTo(document.body)
|
||||||
.addClass(o.options.className)
|
.addClass(o.className)
|
||||||
.css({
|
.css({
|
||||||
top: startPosition.top,
|
top: startPosition.top,
|
||||||
left: startPosition.left,
|
left: startPosition.left,
|
||||||
@ -34,9 +34,9 @@ $.effects.transfer = function(o) {
|
|||||||
width: elem.innerWidth(),
|
width: elem.innerWidth(),
|
||||||
position: 'absolute'
|
position: 'absolute'
|
||||||
})
|
})
|
||||||
.animate(animation, o.duration, o.options.easing, function() {
|
.animate(animation, o.duration, o.easing, function() {
|
||||||
transfer.remove();
|
transfer.remove();
|
||||||
(o.callback && o.callback.apply(elem[0], arguments));
|
(o.complete && o.complete.apply(elem[0], arguments));
|
||||||
elem.dequeue();
|
elem.dequeue();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user