Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
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) { } });
This paste will be private.
From the Design Piracy series on my blog: