Created
June 2, 2014 10:01
-
-
Save Piioo/d788f519eecd5259c398 to your computer and use it in GitHub Desktop.
Global Trigger
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Discourse.AdsenseTopicAfterPostsView = Discourse.AdsenseView.extend({ | |
templateName: "topic_after_posts", | |
location: null, | |
init: function(){ | |
var self = this; | |
var post_number = this.get('post_number'); | |
if ($.inArray(post_number, [1,3,8]) != -1 ) { | |
this.set('location', "topic_after_" + post_number + "_post"); | |
$('body').on('didInsertElement'+post_number, function(){ | |
self.didInsertElement(); | |
}) | |
} | |
this._super(); | |
} | |
}); | |
Ember.CloakedView.reopen({ | |
didInsertElement: function(){ | |
this._super(); | |
var post = this.get('containedView.post'); | |
if(post) { | |
$('body').trigger('didInsertElement'+post.get('post_number')); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment