mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 12:36:02 +01:00
* feat: #8734, jquery-ui, jquery-form, timeago get rid of forum/footer.js move that code to app.js & wait for app to load before calling ajaxify.end make sockets.js a requirejs module move jquery-ui to node_modules and load via requirejs move jquery-form to node_modules and load via requirejs move timeago to node_modules and load via requirejs only include the css for needed jquery-ui widgets * feat: keep socket/io global for backwards compat * refactor: move socket listener to chat
This commit is contained in:
committed by
GitHub
parent
666064bf46
commit
fda2aedfd8
@@ -68,6 +68,7 @@ async function generateHeader(req, res, data) {
|
||||
user: user.getUserData(req.uid),
|
||||
isEmailConfirmSent: (!meta.config.requireEmailConfirmation || req.uid <= 0) ? false : await db.get('uid:' + req.uid + ':confirm:email:sent'),
|
||||
languageDirection: translator.translate('[[language:dir]]', res.locals.config.userLang),
|
||||
timeagoCode: languages.userTimeagoCode(res.locals.config.userLang),
|
||||
browserTitle: translator.translate(controllers.helpers.buildTitle(translator.unescape(data.title))),
|
||||
navigation: navigation.get(req.uid),
|
||||
banned: user.bans.isBanned(req.uid),
|
||||
@@ -95,6 +96,7 @@ async function generateHeader(req, res, data) {
|
||||
results.user.isGlobalMod = results.isGlobalMod;
|
||||
results.user.isMod = !!results.isModerator;
|
||||
results.user.privileges = results.privileges;
|
||||
results.user.timeagoCode = results.timeagoCode;
|
||||
results.user[results.user.status] = true;
|
||||
|
||||
results.user.email = String(results.user.email);
|
||||
@@ -189,25 +191,9 @@ middleware.renderFooter = async function renderFooter(req, res, templateValues)
|
||||
templateValues: templateValues,
|
||||
});
|
||||
|
||||
const results = await utils.promiseParallel({
|
||||
scripts: plugins.fireHook('filter:scripts.get', []),
|
||||
timeagoLocale: (async () => {
|
||||
const languageCodes = await languages.listCodes();
|
||||
const userLang = res.locals.config.userLang;
|
||||
const timeagoCode = utils.userLangToTimeagoCode(userLang);
|
||||
const scripts = await plugins.fireHook('filter:scripts.get', []);
|
||||
|
||||
if (languageCodes.includes(userLang) && languages.timeagoCodes.includes(timeagoCode)) {
|
||||
const pathToLocaleFile = '/vendor/jquery/timeago/locales/jquery.timeago.' + timeagoCode + '.js';
|
||||
return res.locals.config.assetBaseUrl + pathToLocaleFile;
|
||||
}
|
||||
return false;
|
||||
})(),
|
||||
});
|
||||
|
||||
if (results.timeagoLocale) {
|
||||
results.scripts.push(results.timeagoLocale);
|
||||
}
|
||||
data.templateValues.scripts = results.scripts.map(function (script) {
|
||||
data.templateValues.scripts = scripts.map(function (script) {
|
||||
return { src: script };
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user