Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nodebb-theme-harmony

Package Overview
Dependencies
Maintainers
2
Versions
437
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodebb-theme-harmony - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

languages/en-GB/harmony.json

125

library.js
'use strict';
const meta = require.main.require('./src/meta');
const _ = require.main.require('lodash');
const user = require.main.require('./src/user');
const controllers = require('./lib/controllers');

@@ -24,29 +28,100 @@

library.defineWidgetAreas = async function (areas) {
// const locations = ['header', 'sidebar', 'footer'];
// const templates = [
// 'categories.tpl', 'category.tpl', 'topic.tpl', 'users.tpl',
// 'unread.tpl', 'recent.tpl', 'popular.tpl', 'top.tpl', 'tags.tpl', 'tag.tpl',
// 'login.tpl', 'register.tpl',
// ];
// function capitalizeFirst(str) {
// return str.charAt(0).toUpperCase() + str.slice(1);
// }
// templates.forEach((template) => {
// locations.forEach((location) => {
// areas.push({
// name: `${capitalizeFirst(template.split('.')[0])} ${capitalizeFirst(location)}`,
// template: template,
// location: location,
// });
// });
// });
const locations = ['header', 'sidebar', 'footer'];
const templates = [
'categories.tpl', 'category.tpl', 'topic.tpl', 'users.tpl',
'unread.tpl', 'recent.tpl', 'popular.tpl', 'top.tpl', 'tags.tpl', 'tag.tpl',
'login.tpl', 'register.tpl',
];
function capitalizeFirst(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
}
templates.forEach((template) => {
locations.forEach((location) => {
areas.push({
name: `${capitalizeFirst(template.split('.')[0])} ${capitalizeFirst(location)}`,
template: template,
location: location,
});
});
});
// areas = areas.concat([
// {
// name: 'Account Header',
// template: 'account/profile.tpl',
// location: 'header',
// },
// ]);
areas = areas.concat([
{
name: 'Sidebar Footer',
template: 'global',
location: 'sidebar-footer',
},
]);
return areas;
};
library.getThemeConfig = async function (config) {
const { enableQuickReply, centerHeaderElements } = await meta.settings.get('harmony');
config.enableQuickReply = enableQuickReply === 'on';
config.centerHeaderElements = centerHeaderElements === 'on';
return config;
};
library.addUserToTopic = async function (hookData) {
const { enableQuickReply } = await meta.settings.get('harmony');
if (enableQuickReply === 'on') {
if (hookData.req.user) {
const userData = await user.getUserData(hookData.req.user.uid);
hookData.templateData.loggedInUser = userData;
} else {
hookData.templateData.loggedInUser = {
uid: 0,
username: '[[global:guest]]',
picture: user.getDefaultAvatar(),
'icon:text': '?',
'icon:bgColor': '#aaa',
};
}
}
return hookData;
};
library.filterMiddlewareRenderHeader = async function (hookData) {
const userSettings = await user.getSettings(hookData.req.uid);
const lightSkins = [
'default', 'cerulean', 'cosmo', 'flatly', 'journal', 'litera',
'lumen', 'lux', 'materia', 'minty', 'morph', 'pulse', 'quartz', 'sandstone',
'simplex', 'sketchy', 'spacelab', 'united', 'yeti', 'zephyr',
];
const darkSkins = [
'cyborg', 'darkly', 'slate', 'solar', 'superhero', 'vapor',
];
function parseSkins(skins) {
skins = skins.map(skin => ({
name: _.capitalize(skin),
value: skin === 'default' ? '' : skin,
}));
skins.forEach((skin) => {
skin.selected = skin.value === userSettings.bootswatchSkin;
});
return skins;
}
hookData.templateData.bootswatchSkinOptions = {
light: parseSkins(lightSkins),
dark: parseSkins(darkSkins),
};
hookData.templateData.currentBSSkin = _.capitalize(hookData.templateData.bootswatchSkin);
return hookData;
};
library.removeFinalBreadcrumb = async (hookData) => {
const { templateData } = hookData;
const { breadcrumbs } = templateData;
const applyTo = ['category', 'topic'];
// Remove the last breadcrumb (the current page) as it is not part of Harmony's design
if (applyTo.includes(hookData.templateData.template.name) && breadcrumbs && breadcrumbs.length) {
breadcrumbs.pop();
}
return hookData;
};

7

package.json
{
"name": "nodebb-theme-harmony",
"version": "0.0.1",
"version": "0.0.2",
"nbbpm": {

@@ -39,3 +39,6 @@ "compatibility": "^3.0.0"

},
"dependencies": {},
"dependencies": {
"@fontsource/inter": "^4.5.14",
"@fontsource/poppins": "^4.5.10"
},
"devDependencies": {

@@ -42,0 +45,0 @@ "eslint": "^8.0.0",

@@ -6,7 +6,19 @@ {

{ "hook": "filter:admin.header.build", "method": "addAdminNavigation" },
{ "hook": "filter:widgets.getAreas", "method": "defineWidgetAreas" }
{ "hook": "filter:widgets.getAreas", "method": "defineWidgetAreas" },
{ "hook": "filter:config.get", "method": "getThemeConfig" },
{ "hook": "filter:topic.build", "method": "addUserToTopic" },
{ "hook": "filter:middleware.renderHeader", "method": "filterMiddlewareRenderHeader" },
{ "hook": "filter:middleware.render", "method": "removeFinalBreadcrumb" }
],
"scripts": [
"public/harmony.js"
],
"modules": {
"../admin/plugins/harmony.js": "public/admin.js"
}
},
"staticDirs": {
"inter": "node_modules/@fontsource/inter/files",
"poppins": "node_modules/@fontsource/poppins/files"
},
"languages": "languages"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc