Permalink
Browse files

Try waiting, so appending jQuery works first.

  • Loading branch information...
1 parent aaf907d commit b7f0bbb719ad681e9da8a0e053e5869de0b5f99d @nakajima committed Jun 20, 2010
Showing with 8 additions and 1 deletion.
  1. +8 −1 app/models/bookmarklet.rb
@@ -20,7 +20,14 @@ def code
document.getElementsByTagName('head')[0].appendChild(_jq);
JS
jquery.gsub!(/^\s*/, '')
- [jquery, self[:code]].join("\n")
+
+ wrapped_code = <<-JS
+ window.setTimeout(function() {
+ #{self[:code]}
+ }, 10);
+ JS
+
+ [jquery, wrapped_code].join("\n")
else
self[:code]
end

0 comments on commit b7f0bbb

Please sign in to comment.