mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 09:06:15 +01:00
fix: convert some hooks to use hooks module
re: julianlam/nodebb-plugin-markdown#130
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
||||||
define('forum/account/posts', ['forum/account/header', 'forum/infinitescroll'], function (header, infinitescroll) {
|
define('forum/account/posts', ['forum/account/header', 'forum/infinitescroll', 'hooks'], function (header, infinitescroll, hooks) {
|
||||||
var AccountPosts = {};
|
var AccountPosts = {};
|
||||||
|
|
||||||
var template;
|
var template;
|
||||||
@@ -47,7 +47,7 @@ define('forum/account/posts', ['forum/account/header', 'forum/infinitescroll'],
|
|||||||
html.find('.timeago').timeago();
|
html.find('.timeago').timeago();
|
||||||
app.createUserTooltips();
|
app.createUserTooltips();
|
||||||
utils.makeNumbersHumanReadable(html.find('.human-readable-number'));
|
utils.makeNumbersHumanReadable(html.find('.human-readable-number'));
|
||||||
$(window).trigger('action:posts.loaded', { posts: posts });
|
hooks.fire('action:posts.loaded', { posts: posts });
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
||||||
define('forum/categories', ['components', 'categorySelector'], function (components, categorySelector) {
|
define('forum/categories', ['components', 'categorySelector', 'hooks'], function (components, categorySelector, hooks) {
|
||||||
var categories = {};
|
var categories = {};
|
||||||
|
|
||||||
$(window).on('action:ajaxify.start', function (ev, data) {
|
$(window).on('action:ajaxify.start', function (ev, data) {
|
||||||
@@ -63,7 +63,7 @@ define('forum/categories', ['components', 'categorySelector'], function (compone
|
|||||||
recentPosts.last().remove();
|
recentPosts.last().remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
$(window).trigger('action:posts.loaded', { posts: [post] });
|
hooks.fire('action:posts.loaded', { posts: [post] });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,12 @@ define('forum/topic', [
|
|||||||
'sort',
|
'sort',
|
||||||
'components',
|
'components',
|
||||||
'storage',
|
'storage',
|
||||||
], function (infinitescroll, threadTools, postTools, events, posts, images, navigator, sort, components, storage) {
|
'hooks',
|
||||||
|
], function (
|
||||||
|
infinitescroll, threadTools, postTools,
|
||||||
|
events, posts, images, navigator, sort,
|
||||||
|
components, storage, hooks
|
||||||
|
) {
|
||||||
var Topic = {};
|
var Topic = {};
|
||||||
var currentUrl = '';
|
var currentUrl = '';
|
||||||
|
|
||||||
@@ -70,7 +75,7 @@ define('forum/topic', [
|
|||||||
|
|
||||||
handleTopicSearch();
|
handleTopicSearch();
|
||||||
|
|
||||||
$(window).trigger('action:topic.loaded', ajaxify.data);
|
hooks.fire('action:topic.loaded', ajaxify.data);
|
||||||
};
|
};
|
||||||
|
|
||||||
function handleTopicSearch() {
|
function handleTopicSearch() {
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ define('forum/topic/posts', [
|
|||||||
'navigator',
|
'navigator',
|
||||||
'components',
|
'components',
|
||||||
'translator',
|
'translator',
|
||||||
], function (pagination, infinitescroll, postTools, images, navigator, components, translator) {
|
'hooks',
|
||||||
|
], function (pagination, infinitescroll, postTools, images, navigator, components, translator, hooks) {
|
||||||
var Posts = { };
|
var Posts = { };
|
||||||
|
|
||||||
Posts.onNewPost = function (data) {
|
Posts.onNewPost = function (data) {
|
||||||
@@ -226,7 +227,7 @@ define('forum/topic/posts', [
|
|||||||
|
|
||||||
infinitescroll.removeExtra($('[component="post"]'), direction, Math.max(20, config.postsPerPage * 2));
|
infinitescroll.removeExtra($('[component="post"]'), direction, Math.max(20, config.postsPerPage * 2));
|
||||||
|
|
||||||
$(window).trigger('action:posts.loaded', { posts: data.posts });
|
hooks.fire('action:posts.loaded', { posts: data.posts });
|
||||||
|
|
||||||
Posts.onNewPostsAddedToDom(html);
|
Posts.onNewPostsAddedToDom(html);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
||||||
define('forum/topic/replies', ['navigator', 'components', 'forum/topic/posts'], function (navigator, components, posts) {
|
define('forum/topic/replies', ['navigator', 'components', 'forum/topic/posts', 'hooks'], function (navigator, components, posts, hooks) {
|
||||||
var Replies = {};
|
var Replies = {};
|
||||||
|
|
||||||
Replies.init = function (button) {
|
Replies.init = function (button) {
|
||||||
@@ -43,7 +43,7 @@ define('forum/topic/replies', ['navigator', 'components', 'forum/topic/posts'],
|
|||||||
|
|
||||||
repliesEl.slideDown('fast');
|
repliesEl.slideDown('fast');
|
||||||
posts.onNewPostsAddedToDom(html);
|
posts.onNewPostsAddedToDom(html);
|
||||||
$(window).trigger('action:posts.loaded', { posts: data });
|
hooks.fire('action:posts.loaded', { posts: data });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else if (close.is(':not(.hidden)')) {
|
} else if (close.is(':not(.hidden)')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user