Report abuse

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var MrJustin = Class.create();
MrJustin.prototype = {
  initialize: function(options){
    this.options = Object.extend({
    }, options || {});

    this.links = $A(document.getElementsByTagName('dd'));
    this.draggables = {};
    
    this.links.each(function(dd){
      var my_link = $A(dd.getElementsByTagName('a')).first();
      this.draggables[my_link.getAttribute('href')] = new MrJustin.Draggable(dd);
      Event.observe(my_link, 'click', this.itemClicked.bindAsEventListener(this));
      Event.observe(my_link, 'mouseup', this.itemMouseUp.bindAsEventListener(this));
    }.bind(this));
    
    new MrJustin.Draggable(this.helpers);
  },
  itemMouseUp: function(event){
  },
  itemClicked: function(event){
    var link = Event.findElement(event, 'a');
    var dragger = this.draggables[link.href];

    if (dragger.dragging){
      dragger.stopScrolling();
      dragger.finishDrag(event, true);
      Event.stop(event);
    }
  }
};

MrJustin.Draggable = Class.create();
Object.extend(Object.extend(MrJustin.Draggable.prototype, Draggable.prototype), {
  endDrag: function(event) {
  }
});