source: branches/2.4/prototype/plugins/freeow/jquery.freeow.min.js @ 6754

Revision 6754, 2.3 KB checked in by niltonneto, 12 years ago (diff)

Ticket #0000 - Copiadas as alterações do Trunk. Versão final da 2.4.1.

  • Property svn:executable set to *
Line 
1/**
2 * Freeow!
3 * Stylish, Growl-like message boxes
4 *
5 * Copyright (c) 2012 PJ Dietz
6 * Version: 1.0.2
7 * Modified: 2012-05-03
8 * Licensed under the MIT license:
9 * http://www.opensource.org/licenses/mit-license.php
10 *
11 * http://pjdietz.com/jquery-plugins/freeow/
12 */
13(function($){"use strict";var Freeow;Freeow=function(title,message,options){var startStyle,i,u;this.options=$.extend({},$.fn.freeow.defaults,options);this.element=$(this.options.template(title,message));if(this.options.startStyle){startStyle=this.options.startStyle;}
14else{startStyle=this.options.hideStyle;}
15this.element.css(startStyle);this.element.data("freeow",this);for(i=0,u=this.options.classes.length;i<u;i+=1){this.element.addClass(this.options.classes[i]);}
16this.element.click(this.options.onClick);this.element.hover(this.options.onHover);this.autoHide=false;};Freeow.prototype={attach:function(container){if(this.options.prepend){$(container).prepend(this.element);}else{$(container).append(this.element);}
17this.show();},show:function(){var opts,self,fn,delay;opts={duration:this.showDuration};if(this.options.autoHide&&this.options.autoHideDelay>0){this.autoHide=true;self=this;delay=this.options.autoHideDelay;fn=function(){if(self.autoHide){self.hide();}};opts.complete=function(){setTimeout(fn,delay);};}
18this.element.animate(this.options.showStyle,opts);},hide:function(){var self=this;this.element.animate(this.options.hideStyle,{duration:this.options.hideDuration,complete:function(){self.destroy();}});},destroy:function(){this.element.data("freeow",undefined);this.element.remove();}};if(typeof $.fn.freeow==="undefined"){$.fn.extend({freeow:function(title,message,options){return this.each(function(){var f;f=new Freeow(title,message,options);f.attach(this);});}});$.fn.freeow.defaults={autoHide:true,autoHideDelay:3000,classes:[],prepend:true,startStyle:null,showStyle:{opacity:1.0},showDuration:250,hideStyle:{opacity:0.0},hideDuration:500,onClick:function(event){$(this).data("freeow").hide();},onHover:function(event){$(this).data("freeow").autoHide=false;},template:function(title,message){var e;e=['<div>','<div class="background">','<div class="content">','<h2>'+title+'</h2>','<p>'+message+'</p>','</div>','</div>','<span class="icon"></span>','<span class="close"></span>','</div>'].join("");return e;}};}}(jQuery));
Note: See TracBrowser for help on using the repository browser.