diff --git a/plemp.rb b/plemp.rb index 277493d..43e856b 100644 --- a/plemp.rb +++ b/plemp.rb @@ -129,7 +129,7 @@ module Plemp::Views "init_plemp();" end end - body do + body(:onLoad => "return setup_draggables();") do self << yield end end @@ -202,8 +202,8 @@ module Plemp::Views em "#{d.file}: Unsupported file type!" end end - script(:type => "text/javascript") { "setup_draggable('#{d.file}')" } end end end + end diff --git a/public/dragreg.js b/public/dragreg.js index e42229c..7170f79 100644 --- a/public/dragreg.js +++ b/public/dragreg.js @@ -5,6 +5,10 @@ function init_plemp(base_url) { } // Creates a Draggable for each div with the given ID. +function setup_draggables() { + $$('.draggable').each(function(d) { setup_draggable(d.id); }); +} + function setup_draggable(id) { drag = new Draggable(id, { scroll: window }); old_endeffect = drag.options.endeffect;