gritter 0.6.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,19 +0,0 @@
1
- (function($){$.gritter={};$.gritter.options={fade_in_speed:'medium',fade_out_speed:1000,time:6000}
2
- $.gritter.add=function(params){try{return Gritter.add(params||{});}catch(e){var err='Gritter Error: '+e;(typeof(console)!='undefined'&&console.error)?console.error(err,params):alert(err);}}
3
- $.gritter.remove=function(id,params){Gritter.removeSpecific(id,params||{});}
4
- $.gritter.removeAll=function(params){Gritter.stop(params||{});}
5
- var Gritter={fade_in_speed:'',fade_out_speed:'',time:'',_custom_timer:0,_item_count:0,_is_setup:0,_tpl_close:'<div class="gritter-close"></div>',_tpl_item:'<div id="gritter-item-[[number]]" class="gritter-item-wrapper [[item_class]]" style="display:none"><div class="gritter-top"></div><div class="gritter-item">[[image]]<div class="[[class_name]]"><span class="gritter-title">[[username]]</span><p>[[text]]</p></div><div style="clear:both"></div></div><div class="gritter-bottom"></div></div>',_tpl_wrap:'<div id="gritter-notice-wrapper"></div>',add:function(params){if(!params.title||!params.text){throw'You need to fill out the first 2 params: "title" and "text"';}
6
- if(!this._is_setup){this._runSetup();}
7
- var user=params.title,text=params.text,image=params.image||'',sticky=params.sticky||false,item_class=params.class_name||'',time_alive=params.time||'';this._verifyWrapper();this._item_count++;var number=this._item_count,tmp=this._tpl_item;$(['before_open','after_open','before_close','after_close']).each(function(i,val){Gritter['_'+val+'_'+number]=($.isFunction(params[val]))?params[val]:function(){}});this._custom_timer=0;if(time_alive){this._custom_timer=time_alive;}
8
- var image_str=(image!='')?'<img src="'+image+'" class="gritter-image" />':'',class_name=(image!='')?'gritter-with-image':'gritter-without-image';tmp=this._str_replace(['[[username]]','[[text]]','[[image]]','[[number]]','[[class_name]]','[[item_class]]'],[user,text,image_str,this._item_count,class_name,item_class],tmp);this['_before_open_'+number]();$('#gritter-notice-wrapper').append(tmp);var item=$('#gritter-item-'+this._item_count);item.fadeIn(this.fade_in_speed,function(){Gritter['_after_open_'+number]($(this));});if(!sticky){this._setFadeTimer(item,number);}
9
- $(item).bind('mouseenter mouseleave',function(event){if(event.type=='mouseenter'){if(!sticky){Gritter._restoreItemIfFading($(this),number);}}
10
- else{if(!sticky){Gritter._setFadeTimer($(this),number);}}
11
- Gritter._hoverState($(this),event.type);});return number;},_countRemoveWrapper:function(unique_id,e){e.remove();this['_after_close_'+unique_id](e);if($('.gritter-item-wrapper').length==0){$('#gritter-notice-wrapper').remove();}},_fade:function(e,unique_id,params,unbind_events){var params=params||{},fade=(typeof(params.fade)!='undefined')?params.fade:true;fade_out_speed=params.speed||this.fade_out_speed;this['_before_close_'+unique_id](e);if(unbind_events){e.unbind('mouseenter mouseleave');}
12
- if(fade){e.animate({opacity:0},fade_out_speed,function(){e.animate({height:0},300,function(){Gritter._countRemoveWrapper(unique_id,e);})})}
13
- else{this._countRemoveWrapper(unique_id,e);}},_hoverState:function(e,type){if(type=='mouseenter'){e.addClass('hover');var find_img=e.find('img');(find_img.length)?find_img.before(this._tpl_close):e.find('span').before(this._tpl_close);e.find('.gritter-close').click(function(){var unique_id=e.attr('id').split('-')[2];Gritter.removeSpecific(unique_id,{},e,true);});}
14
- else{e.removeClass('hover');e.find('.gritter-close').remove();}},removeSpecific:function(unique_id,params,e,unbind_events){if(!e){var e=$('#gritter-item-'+unique_id);}
15
- this._fade(e,unique_id,params||{},unbind_events);},_restoreItemIfFading:function(e,unique_id){clearTimeout(this['_int_id_'+unique_id]);e.stop().css({opacity:''});},_runSetup:function(){for(opt in $.gritter.options){this[opt]=$.gritter.options[opt];}
16
- this._is_setup=1;},_setFadeTimer:function(e,unique_id){var timer_str=(this._custom_timer)?this._custom_timer:this.time;this['_int_id_'+unique_id]=setTimeout(function(){Gritter._fade(e,unique_id);},timer_str);},stop:function(params){var before_close=($.isFunction(params.before_close))?params.before_close:function(){};var after_close=($.isFunction(params.after_close))?params.after_close:function(){};var wrap=$('#gritter-notice-wrapper');before_close(wrap);wrap.fadeOut(function(){$(this).remove();after_close();});},_str_replace:function(search,replace,subject,count){var i=0,j=0,temp='',repl='',sl=0,fl=0,f=[].concat(search),r=[].concat(replace),s=subject,ra=r instanceof Array,sa=s instanceof Array;s=[].concat(s);if(count){this.window[count]=0;}
17
- for(i=0,sl=s.length;i<sl;i++){if(s[i]===''){continue;}
18
- for(j=0,fl=f.length;j<fl;j++){temp=s[i]+'';repl=ra?(r[j]!==undefined?r[j]:''):r[0];s[i]=(temp).split(f[j]).join(repl);if(count&&s[i]!==temp){this.window[count]+=(temp.length-s[i].length)/f[j].length;}}}
19
- return sa?s:s[0];},_verifyWrapper:function(){if($('#gritter-notice-wrapper').length==0){$('body').append(this._tpl_wrap);}}}})(jQuery);
@@ -1,94 +0,0 @@
1
- /* ie6 trash */
2
- * html #gritter-notice-wrapper {
3
- position:absolute;
4
- }
5
- * html .gritter-top {
6
- margin-bottom:-10px;
7
- }
8
- * html .gritter-item {
9
- padding-bottom:0;
10
- }
11
- * html .gritter-bottom {
12
- margin-bottom:0;
13
- }
14
- * html .gritter-close {
15
- background:url(/images/gritter/gritter-close-ie6.gif);
16
- width:22px;
17
- height:22px;
18
- top:7px;
19
- left:7px;
20
- }
21
-
22
- /* the norm */
23
- #gritter-notice-wrapper {
24
- position:fixed;
25
- text-align:left;
26
- top:20px;
27
- right:20px;
28
- width:301px;
29
- z-index:9999;
30
- }
31
- .gritter-item-wrapper {
32
- position:relative;
33
- margin:0 0 10px 0;
34
- /* background:url('.'); /* ie7/8 fix */
35
- }
36
- .gritter-top {
37
- background:url(/images/gritter/gritter.png) no-repeat left -30px;
38
- height:10px;
39
- }
40
- .hover .gritter-top {
41
- background-position:right -30px;
42
- }
43
- .gritter-bottom {
44
- background:url(/images/gritter/gritter.png) no-repeat left bottom;
45
- height:8px;
46
- margin:0;
47
- }
48
- .hover .gritter-bottom {
49
- background-position: bottom right;
50
- }
51
- .gritter-item {
52
- display:block;
53
- background:url(/images/gritter/gritter.png) no-repeat left -40px;
54
- color:#eee;
55
- padding:2px 11px 8px 11px;
56
- font-size: 11px;
57
- font-family:verdana;
58
- }
59
- .hover .gritter-item {
60
- background-position:right -40px;
61
- }
62
- .gritter-item p {
63
- padding:0;
64
- margin:0;
65
- }
66
- .gritter-close {
67
- position:absolute;
68
- top:5px;
69
- left:3px;
70
- background:url(/images/gritter/gritter.png) no-repeat left top;
71
- cursor:pointer;
72
- width:30px;
73
- height:30px;
74
- }
75
- .gritter-title {
76
- font-size:14px;
77
- font-weight:bold;
78
- padding:0 0 7px 0;
79
- display:block;
80
- text-shadow:1px 1px #000; /* Not supported by IE :( */
81
- }
82
- .gritter-image {
83
- width:48px;
84
- height:48px;
85
- float:left;
86
- }
87
- .gritter-with-image,
88
- .gritter-without-image {
89
- padding:0 0 5px 0;
90
- }
91
- .gritter-with-image {
92
- width:220px;
93
- float:right;
94
- }
@@ -1,6 +0,0 @@
1
- namespace :gritter do
2
- desc 'Install the gritter sources'
3
- task :install => :environment do
4
- Gritter.install_gritter
5
- end
6
- end