mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: script failure if client-side page script does not exist
This commit is contained in:
@@ -320,14 +320,17 @@ ajaxify = window.ajaxify || {};
|
||||
location = '';
|
||||
}
|
||||
|
||||
require(['hooks', location + tpl_url], (hooks, module) => {
|
||||
const proceed = (hooks, module) => {
|
||||
if (module && module.init) {
|
||||
module.init();
|
||||
}
|
||||
|
||||
hooks.fire('static:script.init', { tpl_url }).then(ajaxify.loadExtraScripts.bind(null, tpl_url, callback));
|
||||
}, function () {
|
||||
// ignore 404 error
|
||||
};
|
||||
|
||||
require(['hooks', location + tpl_url], proceed, () => {
|
||||
// Module doesn't exist or didn't load, proceed without it
|
||||
require(['hooks'], proceed);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user