fixes various js bugs with firefox

git-svn-id: https://dev.finn.de/svn/cockpit/branches/reporting_merge@1798 7926756e-e54e-46e6-9721-ed318f58905e
pull/6827/head
j.wollert 14 years ago
parent dae7363fdf
commit a18872ae2a
  1. 69
      assets/javascripts/reporting.js

@ -69,8 +69,8 @@ function hide_category(tr_field) {
function register_remove_hover(field) { function register_remove_hover(field) {
table = $('tr_' + field); table = $('tr_' + field);
Event.observe(table, 'mouseover', function(event) { set_remove_button_visibility(field, true) }); Event.observe(table, 'mouseover', function() { set_remove_button_visibility(field, true) });
Event.observe(table, 'mouseout', function(event) { set_remove_button_visibility(field, false) }); Event.observe(table, 'mouseout', function() { set_remove_button_visibility(field, false) });
} }
@ -268,10 +268,11 @@ function remove_group_by(arrow) {
group_by = arrow.up(); group_by = arrow.up();
enable_select_option($('group_by_columns'), group_by.getAttribute('value')); enable_select_option($('group_by_columns'), group_by.getAttribute('value'));
enable_select_option($('group_by_rows'), group_by.getAttribute('value')); enable_select_option($('group_by_rows'), group_by.getAttribute('value'));
if (!first_in_row(group_by)) { previous = group_by.previous();
update_arrow(prev);
}
group_by.remove(); group_by.remove();
if (previous !== null) {
update_arrow(previous);
}
} }
function init_arrow(group_by) { function init_arrow(group_by) {
@ -285,22 +286,27 @@ function init_arrow(group_by) {
function init_arrow_hover_effects(arrow) { function init_arrow_hover_effects(arrow) {
Event.observe(arrow, 'mouseover', function() { arrow_start_removal_hover(arrow) }); Event.observe(arrow, 'mouseover', function() { arrow_start_removal_hover(arrow) });
Event.observe(arrow, 'mouseout', function() { arrow_end_removal_hover(arrow) }); Event.observe(arrow, 'mouseout', function() { arrow_end_removal_hover(arrow) });
Event.observe(arrow, 'mousedown', function() { remove_group_by(arrow) }); Event.observe(arrow, 'click', function() { remove_group_by(arrow) });
} }
function arrow_start_removal_hover(arrow) { function arrow_start_removal_hover(arrow) {
group_by_start_hover(arrow.up());
update_arrow(arrow.up());
arrow.className = arrow.className + "_remove"; arrow.className = arrow.className + "_remove";
} }
function arrow_end_removal_hover(arrow) { function arrow_end_removal_hover(arrow) {
arrow.className = arrow.className.replace(/\_remove/g, ""); group_by_end_hover(arrow.up());
arrow.className = arrow.className.replace(/\_remove/, "");
} }
function update_arrow(group_by) { function update_arrow(group_by) {
arrow = $(group_by.id + "_arrow");
if (arrow == null) return;
if (last_in_row(group_by)) { if (last_in_row(group_by)) {
$(group_by.id + "_arrow").className = "arrow in_row arrow_left"; arrow.className = "arrow in_row arrow_left";
} else { } else {
$(group_by.id + "_arrow").className = "arrow in_row arrow_both"; arrow.className = "arrow in_row arrow_both";
} }
} }
@ -325,37 +331,15 @@ function init_group_by(field) {
} }
function init_group_by_hover_effects(group_by_label) { function init_group_by_hover_effects(group_by_label) {
Event.observe(group_by_label, 'mouseover', function(event) { Event.observe(group_by_label, 'mouseover', function() {
group_by_start_hover(group_by_label); group_by_start_hover(group_by_label.up());
}); });
Event.observe(group_by_label, 'mouseout', function(event) { Event.observe(group_by_label, 'mouseout', function() {
group_by_end_hover(group_by_label); group_by_end_hover(group_by_label.up());
}); });
} }
function checked_event_target(event_target, event) { function group_by_start_hover(group_by) {
var target = event_target;
var mouse_over_element;
//So let's check to see what the mouse is now over, and assign it to mouse_over_element...
console.log(event_target)
console.log(event.toElement);
if(event.toElement) {
mouse_over_element = event.toElement;
} else {
console.log(event.relatedTarget);
if(event.relatedTarget) {
mouse_over_element = event.relatedTarget;
}
}
//In the event that the mouse is over something outside the DOM (like an alert window)...
if(mouse_over_element == null) {
return;
}
return event_target == mouse_over_element;
}
function group_by_start_hover(group_by_label) {
group_by = group_by_label.up();
arrow = $(group_by.id + '_arrow'); arrow = $(group_by.id + '_arrow');
if (last_in_row(group_by)) { if (last_in_row(group_by)) {
arrow.className = 'arrow in_row arrow_left_hover'; arrow.className = 'arrow in_row arrow_left_hover';
@ -367,13 +351,14 @@ function group_by_start_hover(group_by_label) {
} }
} }
function group_by_end_hover(group_by_label) { function group_by_end_hover(group_by) {
group_by = group_by_label.up();
arrow = $(group_by.id + '_arrow'); arrow = $(group_by.id + '_arrow');
if (last_in_row(group_by)) { if (arrow !== null) {
arrow.className = 'arrow in_row arrow_left'; if (last_in_row(group_by)) {
} else { arrow.className = 'arrow in_row arrow_left';
arrow.className = 'arrow in_row arrow_both'; } else {
arrow.className = 'arrow in_row arrow_both';
}
} }
if (!(first_in_row(group_by))) { if (!(first_in_row(group_by))) {
$(group_by.previous().id + '_arrow').className = 'arrow in_row arrow_both'; $(group_by.previous().id + '_arrow').className = 'arrow in_row arrow_both';

Loading…
Cancel
Save