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

nodebb-plugin-poll

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodebb-plugin-poll - npm Package Compare versions

Comparing version 0.2.4 to 0.2.5

3

languages/en_GB/poll.json

@@ -29,4 +29,7 @@ {

"error.not_main": "Can only add poll in main post.",
"error.privilege.create": "You're not allowed to create a poll",
"warning.redactor": "You're using Redactor. Do <strong>not</strong> edit the markup manually. Instead, re-open the poll creator.",
"vote": "Vote",

@@ -33,0 +36,0 @@ "to_voting": "To Voting",

@@ -29,4 +29,7 @@ {

"error.not_main": "Can only add poll in main post.",
"error.privilege.create": "You're not allowed to create a poll",
"warning.redactor": "You're using Redactor. Do <strong>not</strong> edit the markup manually. Instead, re-open the poll creator.",
"vote": "Vote",

@@ -33,0 +36,0 @@ "to_voting": "To Voting",

2

package.json
{
"name": "nodebb-plugin-poll",
"version": "0.2.4",
"version": "0.2.5",
"description": "NodeBB Poll Plugin",

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

@@ -9,4 +9,14 @@ "use strict";

function init() {
$(window).on('action:composer.enhanced', function() {
initComposer();
$(window).on('action:composer.enhanced', initComposer);
$(window).on('action:redactor.load', initRedactor);
$(window).on('action:composer.loaded', function(ev, data) {
if ($.Redactor) {
if (data.composerData.isMain && $.Redactor.opts.plugins.indexOf('poll') === -1) {
$.Redactor.opts.plugins.push('poll');
} else if ($.Redactor.opts.plugins.indexOf('poll') !== -1) {
$.Redactor.opts.plugins.splice($.Redactor.opts.plugins.indexOf('poll'), 1);
}
}
});

@@ -25,6 +35,33 @@ }

function initRedactor() {
$.Redactor.prototype.poll = function () {
return {
init: function () {
var self = this;
translator.translate('[[poll:creator_title]]', function(translated) {
var button = self.button.add('poll', translated);
self.button.setAwesome('poll', 'fa fa-bar-chart-o');
self.button.addCallback(button, self.poll.onClick);
});
},
onClick: function () {
var self = this;
var code = this.code.get();
require(['composer'], function(composer) {
composerBtnHandle(composer, {
value: code,
redactor: function (code) {
self.code.set(code);
}
});
});
}
};
};
}
function composerBtnHandle(composer, textarea) {
var post = composer.posts[composer.active];
if (!post || !post.isMain || !post.cid || isNaN(parseInt(post.cid, 10))) {
return app.alertError('Can only add poll in main post.');
return app.alertError('[[poll:error.not_main]]');
}

@@ -64,2 +101,4 @@

textarea.value += markup;
if ($.Redactor) textarea.redactor('<p>' + textarea.value + '</p>');
});

@@ -75,3 +114,3 @@ });

app.parseAndTranslate('poll/creator', { poll: poll, config: config }, function(html) {
app.parseAndTranslate('poll/creator', { poll: poll, config: config, isRedactor: !!$.Redactor }, function(html) {
// Initialise modal

@@ -78,0 +117,0 @@ var modal = bootbox.dialog({

@@ -18,3 +18,3 @@ "use strict";

var pollRegex = XRegExp('(?:(?:\\[poll(?<settings>.*?)\\])\n(?<content>(?:-.+?\n)+)(?:\\[\/poll\\]))', 'g');
var settingsRegex = XRegExp('(?<key>.+?)="(?<value>.+?)"', 'g');
var settingsRegex = XRegExp('(?<key>.+?)=(?:"|&quot;)(?<value>.+?)(?:"|&quot;)', 'g');
var settingsValidators = {

@@ -21,0 +21,0 @@ title: {

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