Skip to content
Browse files

a few javascript fixes

git-svn-id: https://svn.thoughtbot.com/plugins/mile_marker/trunk@156 7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
  • Loading branch information...
1 parent 39b4d45 commit 4b2d23ea906fdef7be06d316c6e1ac401f2a593e cpytel committed Aug 2, 2007
Showing with 5 additions and 6 deletions.
  1. +5 −6 lib/mile_marker.rb
View
11 lib/mile_marker.rb
@@ -45,34 +45,33 @@ def self.initialize_mile_marker()
}
function init_miles() {
$$('*[mile]').each(function(block, index) {
- html = '<div id="mile_'+index+'" style="display: none; z-index: 1000; position: absolute; background-color: #000; opacity: 0.4; filter: alpha(opacity=40); color: #eee; font-family: Lucida Sans, Helvetica; font-size: 16px; font-weight: bold; white-space: nowrap; overflow: hidden;"><p style="padding: 3px 5px; background-color: #000; opacity: 1.0; filter: alpha(opacity=100); display: inline; color: #f3f3f3;">'+block.getAttribute('mile')+'</p></div>'
+ html = '<div id="mile_'+index+'" style="display: none; z-index: 1000; position: absolute; background-color: #000; opacity: 0.4; filter: alpha(opacity=40); color: #eee; font-family: Lucida Sans, Helvetica; font-size: 10px; font-weight: bold; white-space: nowrap; overflow: hidden;"><p style="padding: 3px 5px; background-color: #000; opacity: 1.0; filter: alpha(opacity=100); display: inline; color: #f3f3f3;">'+block.getAttribute('mile')+'</p></div>'
new Insertion.Before($(block), html);
Position.clone($(block), $('mile_'+index));
- if($('mile_'+index).getHeight() <= 25) { $('mile_'+index).setStyle({fontSize: '10px'}); }
$('mile_'+index).observe("mouseover", function(event) {
element = Event.element(event);
if(element.immediateDescendants()[0])
{
element.setStyle({opacity: 0.75});
- element.style.filters.alpha.opacity=75;
+ if(element.style.filters) element.style.filters.alpha.opacity=75;
}
else
{
element.up().setStyle({opacity: 0.75});
- element.up().style.filters.alpha.opacity=75;
+ if(element.up().style.filters) element.up().style.filters.alpha.opacity=75;
}
});
$('mile_'+index).observe("mouseout", function(event) {
element = Event.element(event);
if(element.immediateDescendants()[0])
{
element.setStyle({opacity: 0.4});
- element.style.filters.alpha.opacity=40;
+ if(element.style.filters) element.style.filters.alpha.opacity=40;
}
else
{
element.up().setStyle({opacity: 0.4});
- element.up().style.filters.alpha.opacity=40;
+ if(element.up().style.filters) element.up().style.filters.alpha.opacity=40;
}
});
$('mile_'+index).toggle();

0 comments on commit 4b2d23e

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