Ember AdSense

An attempt to solve http://stackoverflow.com/questions/15897597/ember-template-and-google-adsense

HTML

<script src="https://s3.amazonaws.com/kiddsoftware-jsfiddle/handlebars-1.0.0-rc.3.js"></script>
<script src="https://s3.amazonaws.com/kiddsoftware-jsfiddle/ember-1.0.0-rc.2.js"></script>
<script src="https://s3.amazonaws.com/kiddsoftware-jsfiddle/ember-data-a29070da.js"></script>
<script type="text/x-handlebars">
    <h1>Ember AdSense</h1>
    {{outlet}}
    <div id="ads"></div>
</script>

<script type="text/x-handlebars" data-template-name="index">
    <p>Hello, world!</p>
</script>

JavaScript

window.App = Ember.Application.create();

// Explicitly declare the view class for our application view.
App.ApplicationView = Ember.View.extend({
    // Called once the view is rendered.
    didInsertElement: function () {
        // Google appears to want these on the window.
        window.google_ad_client = "pub-4692540724014628";
        window.google_ad_slot = "4735142851";
        // There's probably a better way to do this.
        this.$("#ads").html('<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">');
    }
});