Sha256: e12d30dcf5cf89a0b2751a4e528606ad922d5e2f5e97a34016cb25d75b2387fa

Contents?: true

Size: 1.81 KB

Versions: 1

Compression:

Stored size: 1.81 KB

Contents

/*
 * Smart event highlighting
 * Handles for when events span rows, or don't have a background color
 */
Event.observe(window, "load", function() {
  var highlight_color = "#2EAC6A";
  
  // highlight events that have a background color
  $$(".ec-event-bg").each(function(ele) {
    ele.observe("mouseover", function(evt) {
      event_id = ele.readAttribute("data-event-id");
      event_class_name = ele.readAttribute("data-event-class");
      $$(".ec-"+event_class_name+"-"+event_id).each(function(el) {
        el.setStyle({ backgroundColor: highlight_color });
      });
    });
    ele.observe("mouseout", function(evt) {
      event_id = ele.readAttribute("data-event-id");
      event_class_name = ele.readAttribute("data-event-class");
      event_color = ele.readAttribute("data-color");
      $$(".ec-"+event_class_name+"-"+event_id).each(function(el) {
        el.setStyle({ backgroundColor: event_color });
      });
    });
  });
  
  // highlight events that don't have a background color
  $$(".ec-event-no-bg").each(function(ele) {
    ele.observe("mouseover", function(evt) {
      ele.setStyle({ color: "white" });
      ele.select("a").each(function(link) {
        link.setStyle({ color: "white" });
      });
      ele.select(".ec-bullet").each(function(bullet) {
        bullet.setStyle({ backgroundColor: "white" });
      });
      ele.setStyle({ backgroundColor: highlight_color });
    });
    ele.observe("mouseout", function(evt) {
      event_color = ele.readAttribute("data-color");
      ele.setStyle({ color: event_color });
      ele.select("a").each(function(link) {
        link.setStyle({ color: event_color });
      });
      ele.select(".ec-bullet").each(function(bullet) {
        bullet.setStyle({ backgroundColor: event_color });
      });
      ele.setStyle({ backgroundColor: "transparent" });
    });
  });
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
event-calendar-2.3.3 lib/generators/event_calendar/templates/javascript.js