% content_for :head do %> <%= stylesheet_link_tag :time_machine %> <%= javascript_include_tag :time_machine %> <%= javascript_tag " var guiWindow = opener.parent; var myCalendar; var mySlider; var today = new Date(); today.setMilliseconds(0); today.setSeconds(0); today.setMinutes(0); today.setHours(0);" %> <% end %>
<%= javascript_tag %Q| function displayValue(v) { if (v == 0) { return 'Heute'; } else if (v == 1) { return 'Morgen'; } else { return v + ' Tage in der Zukunft'; } } mySlider = new Control.Slider('handle','track', { range: $R(0,60), values: [0, 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, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60], onSlide: function(v) { $('display').innerHTML = displayValue(v); }, onChange: function(v) { $('display').innerHTML = displayValue(v); myCalendar.setDate(new Date(today.getTime() + v * 86400000)); updatePreview(myCalendar); } }); mySlider.setValue(daysFromToday(myCalendar.date));| %>