nodebb-plugin-poll 2.0.3 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/nodebb.js CHANGED
@@ -11,7 +11,7 @@ module.exports = {
11
11
  PluginSockets: require.main.require('./src/socket.io/plugins'),
12
12
  AdminSockets: require.main.require('./src/socket.io/admin').plugins,
13
13
  SocketIndex: require.main.require('./src/socket.io/index'),
14
- Translator: require.main.require('./public/src/modules/translator'),
14
+ Translator: require.main.require('./src/translator'),
15
15
  winston: require.main.require('winston'),
16
16
  app: null,
17
17
  };
package/lib/serializer.js CHANGED
@@ -1,3 +1,4 @@
1
1
  'use strict';
2
2
 
3
- module.exports = require('../public/js/poll/serializer');
3
+ const utils = require.main.require('./src/utils');
4
+ module.exports = require('../public/js/poll/serializer')(utils);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-poll",
3
- "version": "2.0.3",
3
+ "version": "2.0.6",
4
4
  "description": "NodeBB Poll Plugin",
5
5
  "main": "library.js",
6
6
  "scripts": {
@@ -26,7 +26,7 @@
26
26
  "cron": "^1.8.2"
27
27
  },
28
28
  "nbbpm": {
29
- "compatibility": "^1.17.0"
29
+ "compatibility": "^2.0.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "eslint": "^7.31.0",
package/plugin.json CHANGED
@@ -34,13 +34,13 @@
34
34
  ],
35
35
  "scripts": [
36
36
  "public/js/poll/main.js",
37
- "public/js/poll/serializer.js",
38
37
  "public/js/poll/sockets.js",
39
38
  "public/js/poll/creator.js",
40
39
  "public/js/poll/view.js"
41
40
  ],
42
41
  "modules": {
43
42
  "../admin/plugins/poll.js": "public/js/admin.js",
43
+ "poll/serializer.js": "public/js/poll/serializer.js",
44
44
  "dayjs.js": "vendor/dayjs.min.js",
45
45
  "flatpickr.js": "vendor/flatpickr.min.js",
46
46
  "flatpickr.i10n.js": "vendor/flatpickr.l10n.js"
@@ -1,8 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var Poll = {};
3
+ window.Poll = {};
4
4
 
5
5
  (function () {
6
+ require('poll/serializer')(window.utils);
6
7
  $(window).on('action:topic.loading', function () {
7
8
  if (ajaxify.data.posts.length > 0 && ajaxify.data.posts[0].hasOwnProperty('pollId')) {
8
9
  getPoll(ajaxify.data.posts[0].pollId);
@@ -1,15 +1,8 @@
1
1
  'use strict';
2
2
 
3
- (function (module) {
4
- var utils;
3
+ module.exports = function (utils) {
5
4
  var Serializer = {};
6
5
 
7
- if (typeof window === 'undefined') {
8
- utils = require.main.require('./src/utils');
9
- } else {
10
- utils = window.utils;
11
- }
12
-
13
6
  var pollRegex = /(?:(?:\[poll(?<settings>.*?)\])(?:\\n|\n|<br \/>)(?<content>(?:-.+?(?:\\n|\n|<br \/>))+)(?:\[\/poll\]))/g;
14
7
  var settingsRegex = /(?<key>.+?)=(?:"|&quot;|&#92;)(?<value>.+?)(?:"|&quot;|&#92;)/g;
15
8
  var settingsValidators = {
@@ -165,13 +158,8 @@
165
158
  return deserialized;
166
159
  }
167
160
 
168
- module.exports = Serializer;
169
-
170
161
  if (typeof window !== 'undefined') {
171
- window.Poll.serializer = module.exports;
162
+ window.Poll.serializer = Serializer;
172
163
  }
173
- }(typeof module === 'undefined' ? {
174
- module: {
175
- exports: {},
176
- },
177
- } : module));
164
+ return Serializer;
165
+ };