From df02630b257738154574563e2b7f278af246de6f Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 18 Aug 2021 10:26:21 -0400 Subject: [PATCH] fix: filter:taskbar.push to use hooks module --- package.json | 2 +- public/persona.js | 34 ++++++++++++++++++---------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index fa590c8..a04e022 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "nodebb-theme-persona", "version": "11.1.3", "nbbpm": { - "compatibility": "^1.17.0" + "compatibility": "^1.18.0" }, "description": "Persona theme for NodeBB", "main": "library.js", diff --git a/public/persona.js b/public/persona.js index 2100d9c..32cf6b0 100644 --- a/public/persona.js +++ b/public/persona.js @@ -95,24 +95,26 @@ $(document).ready(function () { } function setupTaskbar() { - $(window).on('filter:taskbar.push', function (ev, data) { - data.options.className = 'taskbar-' + data.module; - if (data.module === 'composer') { - data.options.icon = 'fa-commenting-o'; - } else if (data.module === 'chat') { - if (data.element.length && !data.element.hasClass('active')) { - increaseChatCount(data.element); + require(['hooks'], (hooks) => { + hooks.on('filter:taskbar.push', (data) => { + data.options.className = 'taskbar-' + data.module; + if (data.module === 'composer') { + data.options.icon = 'fa-commenting-o'; + } else if (data.module === 'chat') { + if (data.element.length && !data.element.hasClass('active')) { + increaseChatCount(data.element); + } } - } - }); - $(window).on('action:taskbar.pushed', function (ev, data) { - if (data.module === 'chat') { - createChatIcon(data); - var elData = data.element.data(); - if (elData && elData.options && !elData.options.isSelf) { - increaseChatCount(data.element); + }); + hooks.on('action:taskbar.pushed', (data) => { + if (data.module === 'chat') { + createChatIcon(data); + var elData = data.element.data(); + if (elData && elData.options && !elData.options.isSelf) { + increaseChatCount(data.element); + } } - } + }); }); socket.on('event:chats.markedAsRead', function (data) {