Ticket 103 (Open)
| Created: | by Jamie Orchard-Hays Mar 17, 2007 |
| Severity: | Enhancement Request (1 of 5) |
| Priority: | Low (1 of 4) |
| Attached: |
|
| Assigned: | to no one |
Speed Up JavaScript Effects
I don't like waiting for DHTML effects. I like things that slide open, but not when they do it slowly. For example, the Tags + button opens the tag input, but really slowly. That's frustrating. How about making it really fast?
Tags:
This ticket hasn't been tagged yet.
Comments:
Yeah. I like this idea too. Here's a patch.
Index: vendor/plugins/tagging/lib/extend_av.rb
===================================================================
--- vendor/plugins/tagging/lib/extend_av.rb (revision 659)
+++ vendor/plugins/tagging/lib/extend_av.rb (working copy)
@@ -38,6 +38,8 @@
# (default is :toggle_slide)
# * +:style+ Initial CSS style on the created div (default is 'display: none;')
# * +:text_field_class+ The CSS class to set on text fields (default is 'tag_editor')
+ # * +:effect_options+ Additional options for the effect to be passed to
+ # script.aculo.us.
#
# The form updates the HTML added to the page by the tag_cloud_for method,
# so you'll need to call that as well.
@@ -48,7 +50,9 @@
:visual_effect => :toggle_slide,
:style => 'display: none;',
:text_field_class => 'tag_editor',
-
+ :effect_options => {
+ :duration => 0.2
+ }
}.update(options)
suffix = record.class.to_s.underscore
@@ -72,7 +76,7 @@
page << "$('tags_#{action}_field_for_#{suffix}_#{record.id}').value = '';"
if configuration[:visual_effect]
- page << visual_effect(configuration[:visual_effect], html_ids[action])
+ page << visual_effect(configuration[:visual_effect], html_ids[action], configuration[:effect_options])
else
page[html_ids[action]].show
end
@@ -84,7 +88,7 @@
actions.each do |action|
form_complete =
if configuration[:visual_effect]
- visual_effect(configuration[:visual_effect], html_ids[action])
+ visual_effect(configuration[:visual_effect], html_ids[action], configuration[:effect_options])
else
nil
end
@@ -97,7 +101,7 @@
html << button_to_function("Cancel") do |page|
if configuration[:visual_effect]
- page << visual_effect(configuration[:visual_effect], html_ids[action])
+ page << visual_effect(configuration[:visual_effect], html_ids[action], configuration[:effect_options])
else
page[html_ids[action]].hide
end
Have something to say? Login to post a comment.
Peter Jones, Mar 22, 2007
Level 5 (Governator with 10,067 points)
Speeding up the effect is a good idea. I’ll commit it if someone sends me a patch. Otherwise it will have to wait.