How to aggregate document.ready actions? This may be as much a style question as anything, but:  I'm building a site that uses the Bootstrap theme and a bunch of Bootstrap features -- popovers, dialogs, and the like. This means that I often need to run little bits of initialization code when the page loads; I'm doing these by using drupal_add_js to add the needed bits of jQuery, wrapped in a document.ready() handler.  The usual sort of thing, I think.

This works fine, but they are all being added to the page in their own SCRIPT and document.ready blocks.  Thus the page looks like:

&lt;script&gt;(function ($) {
        $(document).ready(function() {
            somejQueryCode();
        });
    })(jQuery);
&lt;/script&gt;
&lt;script&gt;(function ($) {
        $(document).ready(function() {
            someMorejQueryCode();
        });
    })(jQuery);
&lt;/script&gt;
&lt;script&gt;(function ($) {
        $(document).ready(function() {
            stillSomeMorejQueryCode();
        });
    })(jQuery);
&lt;/script&gt;


as to what it seems like it might be:

&lt;script&gt;(function ($) {
        $(document).ready(function() {
            somejQueryCode();
            someMorejQueryCode();
            stillSomeMorejQueryCode();
        });
    })(jQuery);
&lt;/script&gt;


You get the idea.  Like I said, the individual blocks are working, but it seems a little wrong -- you'd surely never write the code by hand like that.  I've explored various arguments to drupal_add_js, and have started experimenting with the AdvAgg module, but haven't found anything that works.  Is there a better way to do this?  Comments to the effect of "this isn't a big deal, don't worry about it" will also be accepted...  Thanks!
In Drupal, $(document).ready() is not used. The Drupal API uses Drupal.behaviors.

You didn't mention your version of Drupal. But you can read about the Drupal 7 JavaScript API here: https://www.drupal.org/node/756722

Here is Drupal 8: https://www.drupal.org/node/2269515

And here is a pretty comprehensive breakdown/tutorial I wrote on using the D7 API: http://www.jaypan.com/tutorial/high-performance-javascript-using-drupal-7s-javascript-api