client/player/js/ui/jquery.effects.pulsate.js
changeset 51 2d6866072851
child 57 3a3c15c462f8
equal deleted inserted replaced
50:1ecfe4720da7 51:2d6866072851
       
     1 /*
       
     2  * jQuery UI Effects Pulsate 1.8.1
       
     3  *
       
     4  * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
       
     5  * Dual licensed under the MIT (MIT-LICENSE.txt)
       
     6  * and GPL (GPL-LICENSE.txt) licenses.
       
     7  *
       
     8  * http://docs.jquery.com/UI/Effects/Pulsate
       
     9  *
       
    10  * Depends:
       
    11  *	jquery.effects.core.js
       
    12  */
       
    13 (function($) {
       
    14 
       
    15 $.effects.pulsate = function(o) {
       
    16 	return this.queue(function() {
       
    17 		var elem = $(this),
       
    18 			mode = $.effects.setMode(elem, o.options.mode || 'show');
       
    19 			times = ((o.options.times || 5) * 2) - 1;
       
    20 			duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2,
       
    21 			isVisible = elem.is(':visible'),
       
    22 			animateTo = 0;
       
    23 
       
    24 		if (!isVisible) {
       
    25 			elem.css('opacity', 0).show();
       
    26 			animateTo = 1;
       
    27 		}
       
    28 
       
    29 		if ((mode == 'hide' && isVisible) || (mode == 'show' && !isVisible)) {
       
    30 			times--;
       
    31 		}
       
    32 
       
    33 		for (var i = 0; i < times; i++) {
       
    34 			elem.animate({ opacity: animateTo }, duration, o.options.easing);
       
    35 			animateTo = (animateTo + 1) % 2;
       
    36 		}
       
    37 
       
    38 		elem.animate({ opacity: animateTo }, duration, o.options.easing, function() {
       
    39 			if (animateTo == 0) {
       
    40 				elem.hide();
       
    41 			}
       
    42 			(o.callback && o.callback.apply(this, arguments));
       
    43 		});
       
    44 
       
    45 		elem
       
    46 			.queue('fx', function() { elem.dequeue(); })
       
    47 			.dequeue();
       
    48 	});
       
    49 };
       
    50 
       
    51 })(jQuery);