From 15b7ee0cf83ac662e5e20b8b59c99af606930023 Mon Sep 17 00:00:00 2001 From: Dennis Schubert Date: Thu, 26 Jul 2012 23:57:28 +0300 Subject: [PATCH] Fix the bookmarklet when using paramters ... because setting values without waiting for the browser to finish the DOM rendering is evil ... --- .../status_messages/bookmarklet.html.haml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/views/status_messages/bookmarklet.html.haml b/app/views/status_messages/bookmarklet.html.haml index b310d8cbe..4d901b944 100644 --- a/app/views/status_messages/bookmarklet.html.haml +++ b/app/views/status_messages/bookmarklet.html.haml @@ -48,13 +48,15 @@ window.setTimeout(window.close, 2000, true); }); - var contents = "#{escape_javascript params[:title]} - #{escape_javascript params[:url]}"; - var notes = "#{escape_javascript params[:notes]}"; - if (notes.length > 0){ - contents = contents + " - " + notes; - } + $(document).ready(function(){ + var contents = "#{escape_javascript params[:title]} - #{escape_javascript params[:url]}"; + var notes = "#{escape_javascript params[:notes]}"; + if (notes.length > 0){ + contents = contents + " - " + notes; + } - $("#publisher #status_message_fake_text").val(contents); - $("#publisher #status_message_text").val(contents); - $('input.button')[0].removeAttribute('disabled'); + $("#publisher #status_message_fake_text").val(contents); + $("#publisher #status_message_text").val(contents); + $('input.button')[0].removeAttribute('disabled'); + });