nodebb-plugin-shoutbox
Advanced tools
Comparing version 2.0.8 to 2.1.0
@@ -21,10 +21,2 @@ 'use strict'; | ||
{ | ||
name: 'Archive', | ||
id: 'archive', | ||
description: 'View older posts', | ||
icon: 'fa-archive', | ||
button: 'View Archive', | ||
enabled: true, | ||
}, | ||
{ | ||
name: 'Bugs', | ||
@@ -59,3 +51,3 @@ id: 'bug', | ||
const userDefaults = { | ||
'toggles:sound': 1, | ||
'toggles:sound': 0, | ||
'toggles:notification': 1, | ||
@@ -62,0 +54,0 @@ 'toggles:hide': 0, |
@@ -17,5 +17,5 @@ 'use strict'; | ||
Shoutbox.init.load = function (params, callback) { | ||
const { router, middleware } = params; | ||
const { router } = params; | ||
const routeHelpers = require.main.require('./src/routes/helpers'); | ||
routeHelpers.setupPageRoute(router, `/${Config.plugin.id}`, middleware, [], async (req, res) => { | ||
routeHelpers.setupPageRoute(router, `/${Config.plugin.id}`, async (req, res) => { | ||
const data = Config.getTemplateData(); | ||
@@ -25,4 +25,5 @@ res.render(Config.plugin.id, data); | ||
routeHelpers.setupAdminPageRoute(router, `/admin/plugins/${Config.plugin.id}`, middleware, [], async (req, res) => { | ||
routeHelpers.setupAdminPageRoute(router, `/admin/plugins/${Config.plugin.id}`, async (req, res) => { | ||
const data = Config.getTemplateData(); | ||
data.title = Config.plugin.name; | ||
res.render(`admin/plugins/${Config.plugin.id}`, data); | ||
@@ -73,11 +74,6 @@ }); | ||
const settings = await Config.user.load(widget.uid); | ||
const data = Config.getTemplateData(); | ||
data.title = widget.data.title || ''; | ||
data.hiddenStyle = ''; | ||
data.features = data.features.filter(f => f && f.enabled); | ||
if (settings && parseInt(settings['shoutbox:toggles:hide'], 10) === 1) { | ||
data.hiddenStyle = 'display: none;'; | ||
} | ||
widget.html = await app.renderAsync('shoutbox/panel', data); | ||
@@ -84,0 +80,0 @@ return widget; |
{ | ||
"name": "nodebb-plugin-shoutbox", | ||
"version": "2.0.8", | ||
"version": "2.1.0", | ||
"description": "NodeBB Shoutbox Plugin", | ||
@@ -31,4 +31,4 @@ "main": "library.js", | ||
"nbbpm": { | ||
"compatibility": "^3.0.0" | ||
"compatibility": "^3.2.0" | ||
} | ||
} |
@@ -13,8 +13,3 @@ 'use strict'; | ||
var body = sbInstance.dom.container.find('.card-body'); | ||
if (value === 1) { | ||
body.slideUp(); | ||
} else { | ||
body.slideDown(); | ||
} | ||
body.toggleClass('hidden', value === 1); | ||
} | ||
@@ -21,0 +16,0 @@ }; |
@@ -207,34 +207,2 @@ 'use strict'; | ||
Instance.prototype.showUserPanel = function () { | ||
this.dom.onlineUsers.parent().removeClass('hidden'); | ||
}; | ||
Instance.prototype.hideUserPanel = function () { | ||
this.dom.onlineUsers.parent().addClass('hidden'); | ||
}; | ||
Instance.prototype.startUserPanelUpdater = function () { | ||
var self = this; | ||
update(); | ||
function update() { | ||
this.sockets.getUsers({ set: 'users:online', after: 0 }, function (err, data) { | ||
if (err) { | ||
return Shoutbox.alert('error', err); | ||
} | ||
var userCount = data.users.length; | ||
var usernames = data.users.map(function (i) { | ||
return (i.username === null ? 'Anonymous' : i.username); | ||
}); | ||
var userString = usernames.join('; '); | ||
self.dom.onlineUsers.find('.card-body').text(userString); | ||
self.dom.onlineUsers.find('.panel-title').text('Users (' + userCount + ')'); | ||
}); | ||
setInterval(update, 10000); | ||
} | ||
}; | ||
function setupDom(container) { | ||
@@ -249,8 +217,2 @@ this.dom = {}; | ||
this.dom.sendButton = container.find('.shoutbox-message-send-btn'); | ||
this.dom.onlineUsers = container.parents('.shoutbox-row').find('.shoutbox-users'); | ||
if (this.options.showUserPanel) { | ||
this.showUserPanel(); | ||
this.startUserPanelUpdater(); | ||
} | ||
} | ||
@@ -257,0 +219,0 @@ |
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
492526
46
1756