Skip to content
Browse files

- Better IE 6 support. - Resolve occassional error when element remov…

…ed too early
  • Loading branch information...
1 parent 6dcd0c5 commit 958b17de5befcb7564f24ebe0bd2fd035554feff Jim Fiorato committed Feb 13, 2009
View
6 lib/growl.rb
@@ -7,7 +7,11 @@ module Growl4RailsHelper
def growl4rails_includes(duration = 5000, max_showing = 3)
javascript_tag("var growl4rails_duration = #{duration}; var growl4rails_max_showing = #{max_showing};") + "\n" +
javascript_include_tag("#{asset_path}growl4rails.js") + "\n" +
- stylesheet_link_tag("#{asset_path}growl4rails.css")
+ stylesheet_link_tag("#{asset_path}growl4rails.css") + "\n" +
+ "<!--[if lt IE 7]>\n" +
+ stylesheet_link_tag("#{asset_path}growl4rails_ie6.css") + "\n" +
+ "<![endif]-->"
+
end
def asset_path
View
BIN public/images/body.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/body_hi.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/bottom.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/bottom_hi.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/corner_ll.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/corner_ll_hi.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/corner_lr.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/corner_lr_hi.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/corner_ul.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/corner_ul_hi.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/corner_ur.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/corner_ur_hi.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/left.png
Deleted file not rendered
View
BIN public/images/left_hi.png
Deleted file not rendered
View
BIN public/images/right.png
Deleted file not rendered
View
BIN public/images/right_hi.png
Deleted file not rendered
View
BIN public/images/top.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN public/images/top_hi.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
32 public/javascripts/growl4rails.js
@@ -24,7 +24,7 @@ var templateHTML = '<div id="#{id}" class="growl4rails_cell" style="display:none
</table>\
</div>\
<div id="growl4rails_info_#{id}" class="growl4rails_info" style="display:none;">\
- <img src="#{img}" class="growl4rails_image" align="left" />\
+ <div class="growl4rails_image" style="#{img_style}"></div>\
<div class="growl4rails_title">#{title}</div>\
<div class="growl4rails_message">#{message}<div>\
</div>';
@@ -53,10 +53,18 @@ Growl4Rails.showGrowl = function(arguments) {
growl4rails_current_showing++;
//add it to the document
+
+ //IE6 PNG fix for icons
+ var img_path = $H(arguments).get('image_path');
+ var is_png = (img_path.substring(img_path.length-3, img_path.length).toUpperCase() == "PNG")
+ var img_style = 'background-image:url(' + img_path + ');background-repeat: no-repeat;';
+ if (Prototype.Browser.IE && navigator.userAgent.match(/MSIE [456]/) && is_png) {
+ img_style = 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + img_path + '\');';
+ }
var data = {
id:growl_cell_id,
title:$H(arguments).get('title'),
- img:$H(arguments).get('image_path'),
+ img_style:img_style,
message:$H(arguments).get('message')
};
@@ -119,19 +127,29 @@ Growl4Rails.showGrowl = function(arguments) {
Growl4Rails.hideGrowl = function(growl_cell_id) {
growl4rails_timer_hash.unset(growl_cell_id);
if(Prototype.Browser.IE) {
- $('growl4rails_info_' + growl_cell_id).hide();
- $(growl_cell_id).hide();
+ if($('growl4rails_info_' + growl_cell_id))
+ $('growl4rails_info_' + growl_cell_id).hide();
+
+ if($(growl_cell_id))
+ $(growl_cell_id).hide();
} else {
- Effect.Fade('growl4rails_info_' + growl_cell_id, { duration: 1.0 });
- Effect.Fade(growl_cell_id, { duration: 1.0 });
+ if($('growl4rails_info_' + growl_cell_id))
+ Effect.Fade('growl4rails_info_' + growl_cell_id, { duration: 1.0 });
+
+ if($(growl_cell_id))
+ Effect.Fade(growl_cell_id, { duration: 1.0 });
}
setTimeout("Growl4Rails.removeGrowl('" + growl_cell_id + "')", 1000);
};
Growl4Rails.removeGrowl = function(growl_cell_id) {
growl4rails_current_showing--;
- $(growl_cell_id).remove();
+ if($('growl4rails_info_' + growl_cell_id))
+ $('growl4rails_info_' + growl_cell_id).remove();
+
+ if($(growl_cell_id))
+ $(growl_cell_id).remove();
//if this is the last growl, fire an event so we can show more, if there are any
if(growl4rails_current_showing == 0) {
View
11 public/stylesheets/growl4rails.css
@@ -1,6 +1,7 @@
.growl4rails_cell {
position: absolute;
width: 379px;
+ cursor:hand;
cursor:pointer;
z-index: 99;
}
@@ -66,23 +67,31 @@
position: absolute;
width: 320px;
overflow: hidden;
+ cursor:hand;
cursor:pointer;
z-index: 99;
}
.growl4rails_image {
- padding: 2px;
+ background-position: center center;
+ padding: 2px 2px 0px 2px;
+ width:32px;
+ height:32px;
+ float:left;
+ cursor:hand;
cursor:pointer;
}
.growl4rails_title {
color: #FFF;
font-size: 11pt;
font-family: arial;
font-weight: bold;
+ cursor:hand;
cursor:pointer;
}
.growl4rails_message {
color: #FFF;
font-size: 10pt;
font-family: arial;
+ cursor:hand;
cursor:pointer;
}
View
42 public/stylesheets/growl4rails_ie6.css
@@ -0,0 +1,42 @@
+.growl4rails_corner_ul {
+ background-image: url(/images/growl4rails/corner_ul.gif);
+}
+.growl4rails_corner_ul_hi {
+ background-image: url(/images/growl4rails/corner_ul_hi.gif);
+}
+.growl4rails_corner_ur {
+ background-image: url(/images/growl4rails/corner_ur.gif);
+}
+.growl4rails_corner_ur_hi {
+ background-image: url(/images/growl4rails/corner_ur_hi.gif);
+}
+.growl4rails_corner_ll {
+ background-image: url(/images/growl4rails/corner_ll.gif);
+}
+.growl4rails_corner_ll_hi {
+ background-image: url(/images/growl4rails/corner_ll_hi.gif);
+}
+.growl4rails_corner_lr {
+ background-image: url(/images/growl4rails/corner_lr.gif);
+}
+.growl4rails_corner_lr_hi {
+ background-image: url(/images/growl4rails/corner_lr_hi.gif);
+}
+.growl4rails_top {
+ background-image: url(/images/growl4rails/top.gif);
+}
+.growl4rails_top_hi {
+ background-image: url(/images/growl4rails/top_hi.gif);
+}
+.growl4rails_body {
+ background-image: url(/images/growl4rails/body.gif);
+}
+.growl4rails_body_hi {
+ background-image: url(/images/growl4rails/body_hi.gif);
+}
+.growl4rails_bottom {
+ background-image: url(/images/growl4rails/bottom.gif);
+}
+.growl4rails_bottom_hi {
+ background-image: url(/images/growl4rails/bottom_hi.gif);
+}

0 comments on commit 958b17d

Please sign in to comment.
Something went wrong with that request. Please try again.