mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
feat(hooks): update action:ajaxify.end to use new hooks module
This commit is contained in:
@@ -30,9 +30,11 @@
|
||||
}, 3600000);
|
||||
}
|
||||
|
||||
$(window).on('action:ajaxify.end', function () {
|
||||
showCorrectNavTab();
|
||||
startLogoutTimer();
|
||||
require(['hooks'], (hooks) => {
|
||||
hooks.on('action:ajaxify.end', () => {
|
||||
showCorrectNavTab();
|
||||
startLogoutTimer();
|
||||
});
|
||||
});
|
||||
|
||||
function showCorrectNavTab() {
|
||||
@@ -66,12 +68,12 @@
|
||||
});
|
||||
|
||||
function setupNProgress() {
|
||||
require(['nprogress'], function (NProgress) {
|
||||
require(['nprogress', 'hooks'], function (NProgress, hooks) {
|
||||
$(window).on('action:ajaxify.start', function () {
|
||||
NProgress.set(0.7);
|
||||
});
|
||||
|
||||
$(window).on('action:ajaxify.end', function () {
|
||||
hooks.on('action:ajaxify.end', function () {
|
||||
NProgress.done();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -52,7 +52,9 @@ ajaxify = window.ajaxify || {};
|
||||
|
||||
// If any listeners alter url and set it to an empty string, abort the ajaxification
|
||||
if (url === null) {
|
||||
$(window).trigger('action:ajaxify.end', { url: url, tpl_url: ajaxify.data.template.name, title: ajaxify.data.title });
|
||||
require(['hooks'], function (hooks) {
|
||||
hooks.fire('action:ajaxify.end', { url: url, tpl_url: ajaxify.data.template.name, title: ajaxify.data.title });
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -281,7 +283,9 @@ ajaxify = window.ajaxify || {};
|
||||
window.scrollTo(0, 0);
|
||||
}
|
||||
ajaxify.loadScript(tpl_url, function done() {
|
||||
$(window).trigger('action:ajaxify.end', { url: url, tpl_url: tpl_url, title: ajaxify.data.title });
|
||||
require(['hooks'], function (hooks) {
|
||||
hooks.fire('action:ajaxify.end', { url: url, tpl_url: tpl_url, title: ajaxify.data.title });
|
||||
});
|
||||
});
|
||||
ajaxify.widgets.render(tpl_url);
|
||||
|
||||
|
||||
@@ -55,12 +55,14 @@ app.cacheBuster = null;
|
||||
}
|
||||
};
|
||||
document.body.addEventListener('click', earlyClick);
|
||||
$(window).on('action:ajaxify.end', function () {
|
||||
document.body.removeEventListener('click', earlyClick);
|
||||
earlyQueue.forEach(function (el) {
|
||||
el.click();
|
||||
require(['hooks'], function (hooks) {
|
||||
hooks.on('action:ajaxify.end', function () {
|
||||
document.body.removeEventListener('click', earlyClick);
|
||||
earlyQueue.forEach(function (el) {
|
||||
el.click();
|
||||
});
|
||||
earlyQueue = [];
|
||||
});
|
||||
earlyQueue = [];
|
||||
});
|
||||
} else {
|
||||
setTimeout(app.handleEarlyClicks, 50);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
define('navigator', ['forum/pagination', 'components'], function (pagination, components) {
|
||||
define('navigator', ['forum/pagination', 'components', 'hooks'], function (pagination, components, hooks) {
|
||||
var navigator = {};
|
||||
var index = 0;
|
||||
var count = 0;
|
||||
@@ -142,7 +142,7 @@ define('navigator', ['forum/pagination', 'components'], function (pagination, co
|
||||
}
|
||||
|
||||
var mouseDragging = false;
|
||||
$(window).on('action:ajaxify.end', function () {
|
||||
hooks.on('action:ajaxify.end', function () {
|
||||
renderPostIndex = null;
|
||||
});
|
||||
$('.pagination-block .dropdown-menu').parent().on('shown.bs.dropdown', function () {
|
||||
|
||||
Reference in New Issue
Block a user