PLUGIN: New API for decorating a post with jQuery
This commit is contained in:
parent
7c898f2e61
commit
59c3ca7e7b
|
@ -0,0 +1,12 @@
|
||||||
|
function decorate(klass, evt, cb) {
|
||||||
|
var mixin = {};
|
||||||
|
mixin["_decorate_" + new Date().getTime().toString()] = function($elem) { cb($elem); }.on(evt);
|
||||||
|
klass.reopen(mixin);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function decorateCooked(container, cb) {
|
||||||
|
decorate(Discourse.PostView, 'postViewInserted', cb);
|
||||||
|
decorate(container.lookupFactory('view:composer'), 'previewRefreshed', cb);
|
||||||
|
decorate(container.lookupFactory('view:embedded-post'), 'previewRefreshed', cb);
|
||||||
|
decorate(container.lookupFactory('view:user-stream'), 'didInsertElement', cb);
|
||||||
|
}
|
Loading…
Reference in New Issue