app/jquery/jquery-purr.js
author Mario Ferraro <fadinlight@gmail.com>
Sun, 15 Nov 2009 22:12:20 +0100
changeset 3093 d1be59b6b627
parent 1707 2e7b76f20878
permissions -rw-r--r--
GMaps related JS changed to use new google namespace. Google is going to change permanently in the future the way to load its services, so better stay safe. Also this commit shows uses of the new melange.js module. Fixes Issue 634.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1707
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     1
/**
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     2
 * jquery.purr.js
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     3
 * Copyright (c) 2008 Net Perspective (net-perspective.com)
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     4
 * Licensed under the MIT License (http://www.opensource.org/licenses/mit-license.php)
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     5
 *
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     6
 * @author R.A. Ray
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     7
 * @projectDescription	jQuery plugin for dynamically displaying unobtrusive messages in the browser. Mimics the behavior of the MacOS program "Growl."
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     8
 * @version 0.1.0
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     9
 *
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    10
 * @requires jquery.js (tested with 1.2.6)
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    11
 *
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    12
 * @param fadeInSpeed 					int - Duration of fade in animation in miliseconds
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    13
 * 													default: 500
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    14
 *	@param fadeOutSpeed  				int - Duration of fade out animationin miliseconds
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    15
														default: 500
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    16
 *	@param removeTimer  				int - Timeout, in miliseconds, before notice is removed once it is the top non-sticky notice in the list
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    17
														default: 4000
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    18
 *	@param isSticky 						bool - Whether the notice should fade out on its own or wait to be manually closed
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    19
														default: false
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    20
 *	@param usingTransparentPNG 	bool - Whether or not the notice is using transparent .png images in its styling
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    21
														default: false
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    22
 */
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    23
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    24
( function( $ ) {
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    25
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    26
	$.purr = function ( notice, options )
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    27
	{
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    28
		// Convert notice to a jQuery object
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    29
		notice = $( notice );
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    30
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    31
		// Add a class to denote the notice as not sticky
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    32
		if ( !options.isSticky )
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    33
		{
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    34
			notice.addClass( 'not-sticky' );
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    35
		};
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    36
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    37
		// Get the container element from the page
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    38
		var cont = document.getElementById( 'purr-container' );
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    39
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    40
		// If the container doesn't yet exist, we need to create it
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    41
		if ( !cont )
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    42
		{
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    43
			cont = '<div id="purr-container"></div>';
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    44
		}
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    45
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    46
		// Convert cont to a jQuery object
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    47
		cont = $( cont );
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    48
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    49
		// Add the container to the page
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    50
		$( 'body' ).append( cont );
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    51
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    52
		notify();
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    53
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    54
		function notify ()
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    55
		{
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    56
			// Set up the close button
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    57
			var close = document.createElement( 'a' );
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    58
			$( close ).attr(
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    59
				{
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    60
					className: 'close',
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    61
					href: '#close',
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    62
					innerHTML: 'Close'
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    63
				}
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    64
			)
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    65
				.appendTo( notice )
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    66
					.click( function ()
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    67
						{
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    68
							removeNotice();
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    69
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    70
							return false;
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    71
						}
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    72
					);
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    73
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    74
			// Add the notice to the page and keep it hidden initially
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    75
			notice.appendTo( cont )
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    76
				.hide();
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    77
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    78
			if ( jQuery.browser.msie && options.usingTransparentPNG )
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    79
			{
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    80
				// IE7 and earlier can't handle the combination of opacity and transparent pngs, so if we're using transparent pngs in our
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    81
				// notice style, we'll just skip the fading in.
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    82
				notice.show();
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    83
			}
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    84
			else
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    85
			{
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    86
				//Fade in the notice we just added
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    87
				notice.fadeIn( options.fadeInSpeed );
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    88
			}
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    89
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    90
			// Set up the removal interval for the added notice if that notice is not a sticky
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    91
			if ( !options.isSticky )
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    92
			{
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    93
				var topSpotInt = setInterval( function ()
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    94
				{
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    95
					// Check to see if our notice is the first non-sticky notice in the list
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    96
					if ( notice.prevAll( '.not-sticky' ).length == 0 )
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    97
					{
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    98
						// Stop checking once the condition is met
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    99
						clearInterval( topSpotInt );
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   100
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   101
						// Call the close action after the timeout set in options
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   102
						setTimeout( function ()
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   103
							{
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   104
								removeNotice();
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   105
							}, options.removeTimer
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   106
						);
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   107
					}
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   108
				}, 200 );
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   109
			}
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   110
		}
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   111
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   112
		function removeNotice ()
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   113
		{
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   114
			// IE7 and earlier can't handle the combination of opacity and transparent pngs, so if we're using transparent pngs in our
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   115
			// notice style, we'll just skip the fading out.
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   116
			if ( jQuery.browser.msie && options.usingTransparentPNG )
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   117
			{
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   118
				notice.css( { opacity: 0	} )
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   119
					.animate(
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   120
						{
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   121
							height: '0px'
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   122
						},
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   123
						{
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   124
							duration: options.fadeOutSpeed,
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   125
							complete:  function ()
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   126
								{
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   127
									notice.remove();
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   128
								}
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   129
							}
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   130
					);
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   131
			}
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   132
			else
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   133
			{
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   134
				// Fade the object out before reducing its height to produce the sliding effect
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   135
				notice.animate(
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   136
					{
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   137
						opacity: '0'
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   138
					},
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   139
					{
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   140
						duration: options.fadeOutSpeed,
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   141
						complete: function ()
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   142
							{
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   143
								notice.animate(
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   144
									{
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   145
										height: '0px'
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   146
									},
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   147
									{
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   148
										duration: options.fadeOutSpeed,
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   149
										complete: function ()
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   150
											{
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   151
												notice.remove();
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   152
											}
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   153
									}
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   154
								);
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   155
							}
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   156
					}
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   157
				);
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   158
			}
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   159
		};
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   160
	};
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   161
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   162
	$.fn.purr = function ( options )
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   163
	{
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   164
		options = options || {};
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   165
		options.fadeInSpeed = options.fadeInSpeed || 500;
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   166
		options.fadeOutSpeed = options.fadeOutSpeed || 500;
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   167
		options.removeTimer = options.removeTimer || 4000;
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   168
		options.isSticky = options.isSticky || false;
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   169
		options.usingTransparentPNG = options.usingTransparentPNG || false;
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   170
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   171
		this.each( function()
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   172
			{
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   173
				new $.purr( this, options );
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   174
			}
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   175
		);
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   176
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   177
		return this;
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   178
	};
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   179
})( jQuery );
2e7b76f20878 Add the jquery-purr plugin
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   180