When inserting media into a post, is there a way to change the default-view of the Media-Library from “All media items” to “Uploaded to this post”?

There is another thread where this question was extracted from:
How to manage attachment relationships
There were two minor mistakes in my previous answer:
- I forgot to trigger the
change
event for the parent.
- I called the function on every AJAX call, making other selections impossible.
Here is the fixed code:
<?php
/**
* Plugin Name: Pre-select post specific attachments
*/
add_action( 'admin_footer-post-new.php', 'wpse_76048_script' );
add_action( 'admin_footer-post.php', 'wpse_76048_script' );
function wpse_76048_script()
{
?>
<script>
jQuery(function($) {
var called = 0;
$('#wpcontent').ajaxStop(function() {
if ( 0 == called ) {
$('[value="uploaded"]').attr( 'selected', true ).parent().trigger('change');
called = 1;
}
});
});
</script>
<?php
}