New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nodebb-plugin-shoutbox

Package Overview
Dependencies
Maintainers
2
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodebb-plugin-shoutbox - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

8

lib/shouts.js

@@ -44,3 +44,9 @@ 'use strict';

return await getShouts(sids);
const shoutData = await getShouts(sids);
shoutData.forEach((s, index) => {
if (s) {
s.index = start + index;
}
});
return shoutData;
};

@@ -47,0 +53,0 @@

2

lib/sockets.js

@@ -34,3 +34,3 @@ 'use strict';

start = parsedStart;
end = start + shoutLimit;
end = start + shoutLimit - 1;
}

@@ -37,0 +37,0 @@ }

{
"name": "nodebb-plugin-shoutbox",
"version": "1.0.6",
"version": "1.0.7",
"description": "NodeBB Shoutbox Plugin",

@@ -5,0 +5,0 @@ "main": "library.js",

@@ -14,8 +14,28 @@ 'use strict';

this.settings.load();
getShouts();
this.createAutoComplete();
const shoutsPerPage = config.shoutbox.settings['shoutbox:shoutLimit'];
if (this.dom.shoutsContainer) {
const container = $(this.dom.shoutsContainer)
$(this.dom.shoutsContainer).on('scroll', utils.debounce(function () {
const st = container.scrollTop();
if (st < 150) {
const first = container.find('.shoutbox-shout[data-index]');
if (first.length) {
const index = parseInt(first.attr('data-index'), 10) - shoutsPerPage;
getShouts(index, 'before');
}
}
}, 500));
}
getShouts(-shoutsPerPage);
window.sb = this;
function getShouts() {
self.sockets.getShouts(function (err, shouts) {
function getShouts(start, direction) {
self.sockets.getShouts({
start: start,
}, function (err, shouts) {
if (err) {

@@ -31,3 +51,3 @@ return app.alertError(err);

} else {
self.addShouts(shouts);
self.addShouts(shouts, direction);
}

@@ -46,3 +66,3 @@ });

Instance.prototype.addShouts = function (shouts) {
Instance.prototype.addShouts = function (shouts, direction = 'after') {
if (!shouts.length) {

@@ -99,5 +119,9 @@ return;

}, function (html) {
self.dom.shoutsContainer.append(html);
if (direction === 'before') {
self.dom.shoutsContainer.prepend(html);
} else {
self.dom.shoutsContainer.append(html);
self.utils.scrollToBottom(shouts.length > 1);
}
html.find('.timeago').timeago();
self.utils.scrollToBottom(shouts.length > 1);
});

@@ -150,2 +174,31 @@ };

Instance.prototype.createAutoComplete = function () {
if (!this.dom.textInput) {
return;
}
const element = $(this.dom.textInput);
require(['composer/autocomplete'], function (autocomplete) {
const data = {
element: element,
strategies: [],
options: {
style: {
'z-index': 20000,
flex: 0,
top: 'inherit',
},
placement: 'bottom',
},
};
$(window).trigger('chat:autocomplete:init', data);
if (data.strategies.length) {
const autoComplete = autocomplete.setup(data);
$(window).one('action:ajaxify.start', () => {
autoComplete.destroy();
});
}
});
};
Instance.prototype.showUserPanel = function () {

@@ -152,0 +205,0 @@ this.dom.onlineUsers.parent().removeClass('hidden');

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