Skip to content

Instantly share code, notes, and snippets.

@Luke-23ae
Created July 9, 2010 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Luke-23ae/469290 to your computer and use it in GitHub Desktop.
Save Luke-23ae/469290 to your computer and use it in GitHub Desktop.
document.observe("dom:loaded", function() {
var customsPage = Class.create({
initialize: function(page, draggable_obj) {
if(draggable_obj)
this.draggableObject = new Draggable(draggable_obj);
Object.extend(page, this);
},
deactivate_draggable: function() {
if(this.draggableObject)
Draggables.unregister(this.draggableObject);
}
});
$$('.customizations_page').each(function(page) {
var object_to_drag = null;
switch(page.readAttribute("id")) {
case "pagetitle":
object_to_drag = $$("#header h1").first();
break;
}
new customsPage(page, object_to_drag);
page.observe("layout:show", function(event) {
var last_active_page = $$('#customizations_menu li.active').first();
this.deactivate_draggable(); // works like a charm
last_active_page.deactivate_draggable(); // fails. TypeError: Result of expression 'last_active_page.deactivate_draggable' [undefined] is not a function.
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment