Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

v1.7 added with bug fixes

  • Loading branch information...
commit 20bc6e0ea44689d4fa4cb9f7ea0adf42b313f7c8 1 parent f56704e
@jboesch authored
View
5 README.markdown
@@ -5,6 +5,11 @@ A small growl-like notification plugin for jQuery
## Change Log
+### Changes in 1.7 (March, 2011)
+
+* Fixed 404 issue in the css when fetching '.' as an image
+* Added callback parameter in before_close and after_close callbacks to determine whether it was closed manually by clicking the (X)
+
### Changes in 1.6 (December1, 2009)
* Commented code using JSDOC
View
2  css/jquery.gritter.css
@@ -30,7 +30,7 @@
.gritter-item-wrapper {
position:relative;
margin:0 0 10px 0;
- background:url('.'); /* ie7/8 fix */
+ background:url('../images/ie-spacer.gif'); /* ie7/8 fix */
}
.gritter-top {
background:url(../images/gritter.png) no-repeat left -30px;
View
BIN  images/ie-spacer.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
10 index.html
@@ -100,12 +100,14 @@
alert("I am called after it opens: \nI am passed the jQuery object for the created Gritter element...\n" + e);
},
// (function | optional) function called before it closes
- before_close: function(e){
- alert("I am called before it closes: I am passed the jQuery object for the Gritter element... \n" + e);
+ before_close: function(e, manual_close){
+ var manually = (manual_close) ? 'The "X" was clicked to close me!' : '';
+ alert("I am called before it closes: I am passed the jQuery object for the Gritter element... \n" + manually);
},
// (function | optional) function called after it closes
- after_close: function(){
- alert('I am called after it closes');
+ after_close: function(e, manual_close){
+ var manually = (manual_close) ? 'The "X" was clicked to close me!' : '';
+ alert('I am called after it closes. ' + manually);
}
});
View
20 js/jquery.gritter.js
@@ -5,7 +5,7 @@
* Copyright (c) 2009 Jordan Boesch
* Dual licensed under the MIT and GPL licenses.
*
- * Date: December 1, 2009
+ * Date: March, 2011
* Version: 1.6
*/
@@ -169,12 +169,13 @@
* @private
* @param {Integer} unique_id The ID of the element that was just deleted, use it for a callback
* @param {Object} e The jQuery element that we're going to perform the remove() action on
- */
- _countRemoveWrapper: function(unique_id, e){
+ * @param {Boolean} manual_close Did we close the gritter dialog with the (X) button
+ */
+ _countRemoveWrapper: function(unique_id, e, manual_close){
// Remove it then run the callback function
e.remove();
- this['_after_close_' + unique_id](e);
+ this['_after_close_' + unique_id](e, manual_close);
// Check if the wrapper is empty, if it is.. remove the wrapper
if($('.gritter-item-wrapper').length == 0){
@@ -192,12 +193,13 @@
* @param {Boolean} unbind_events Unbind the mouseenter/mouseleave events if they click (X)
*/
_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;
+ fade_out_speed = params.speed || this.fade_out_speed,
+ manual_close = unbind_events;
- this['_before_close_' + unique_id](e);
+ this['_before_close_' + unique_id](e, manual_close);
// If this is true, then we are coming from clicking the (X)
if(unbind_events){
@@ -211,7 +213,7 @@
opacity: 0
}, fade_out_speed, function(){
e.animate({ height: 0 }, 300, function(){
- Gritter._countRemoveWrapper(unique_id, e);
+ Gritter._countRemoveWrapper(unique_id, e, manual_close);
})
})
@@ -274,7 +276,7 @@
if(!e){
var e = $('#gritter-item-' + unique_id);
}
-
+
// We set the fourth param to let the _fade function know to
// unbind the "mouseleave" event. Once you click (X) there's no going back!
this._fade(e, unique_id, params || {}, unbind_events);
View
4 js/jquery.gritter.min.js
@@ -8,8 +8,8 @@ var user=params.title,text=params.text,image=params.image||'',sticky=params.stic
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);}
$(item).bind('mouseenter mouseleave',function(event){if(event.type=='mouseenter'){if(!sticky){Gritter._restoreItemIfFading($(this),number);}}
else{if(!sticky){Gritter._setFadeTimer($(this),number);}}
-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');}
-if(fade){e.animate({opacity:0},fade_out_speed,function(){e.animate({height:0},300,function(){Gritter._countRemoveWrapper(unique_id,e);})})}
+Gritter._hoverState($(this),event.type);});return number;},_countRemoveWrapper:function(unique_id,e,manual_close){e.remove();this['_after_close_'+unique_id](e,manual_close);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,manual_close=unbind_events;this['_before_close_'+unique_id](e,manual_close);if(unbind_events){e.unbind('mouseenter mouseleave');}
+if(fade){e.animate({opacity:0},fade_out_speed,function(){e.animate({height:0},300,function(){Gritter._countRemoveWrapper(unique_id,e,manual_close);})})}
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);});}
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);}
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];}
Please sign in to comment.
Something went wrong with that request. Please try again.