Fix the bookmarklet when using paramters

... because setting values without waiting for the browser to finish the DOM rendering is evil ...
This commit is contained in:
Dennis Schubert 2012-07-26 23:57:28 +03:00
parent b3554ec1aa
commit 15b7ee0cf8

View file

@ -48,13 +48,15 @@
window.setTimeout(window.close, 2000, true); window.setTimeout(window.close, 2000, true);
}); });
var contents = "#{escape_javascript params[:title]} - #{escape_javascript params[:url]}"; $(document).ready(function(){
var notes = "#{escape_javascript params[:notes]}"; var contents = "#{escape_javascript params[:title]} - #{escape_javascript params[:url]}";
if (notes.length > 0){ var notes = "#{escape_javascript params[:notes]}";
contents = contents + " - " + notes; if (notes.length > 0){
} contents = contents + " - " + notes;
}
$("#publisher #status_message_fake_text").val(contents); $("#publisher #status_message_fake_text").val(contents);
$("#publisher #status_message_text").val(contents); $("#publisher #status_message_text").val(contents);
$('input.button')[0].removeAttribute('disabled'); $('input.button')[0].removeAttribute('disabled');
});