nodebb-plugin-ezoic-infinite 0.4.3 → 0.4.4

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/library.js CHANGED
@@ -60,7 +60,7 @@ plugin.addAdminNavigation = async (header) => {
60
60
  };
61
61
 
62
62
  plugin.init = async ({ router, middleware }) => {
63
- router.get('/admin/plugins/ezoic-infinite', middleware.admin.buildHeader, async (req, res) => {
63
+ async function render(req, res) {
64
64
  const settings = await getSettings();
65
65
  const allGroups = await getAllGroups();
66
66
 
@@ -71,21 +71,10 @@ plugin.init = async ({ router, middleware }) => {
71
71
  enableMessageAds_checked: settings.enableMessageAds ? 'checked' : '',
72
72
  allGroups,
73
73
  });
74
- });
75
-
76
- // Needed for ajaxify navigation in ACP (first click uses /api/admin/*)
77
- router.get('/api/admin/plugins/ezoic-infinite', middleware.admin.buildHeader, async (req, res) => {
78
- const settings = await getSettings();
79
- const allGroups = await getAllGroups();
74
+ }
80
75
 
81
- res.json({
82
- title: 'Ezoic Infinite Ads',
83
- ...settings,
84
- enableBetweenAds_checked: settings.enableBetweenAds ? 'checked' : '',
85
- enableMessageAds_checked: settings.enableMessageAds ? 'checked' : '',
86
- allGroups,
87
- });
88
- });
76
+ router.get('/admin/plugins/ezoic-infinite', middleware.admin.buildHeader, render);
77
+ router.get('/api/admin/plugins/ezoic-infinite', render);
89
78
 
90
79
  router.get('/api/plugins/ezoic-infinite/config', middleware.buildHeader, async (req, res) => {
91
80
  const settings = await getSettings();
@@ -93,11 +82,9 @@ plugin.init = async ({ router, middleware }) => {
93
82
 
94
83
  res.json({
95
84
  excluded,
96
-
97
85
  enableBetweenAds: settings.enableBetweenAds,
98
86
  placeholderIds: settings.placeholderIds,
99
87
  intervalPosts: settings.intervalPosts,
100
-
101
88
  enableMessageAds: settings.enableMessageAds,
102
89
  messagePlaceholderIds: settings.messagePlaceholderIds,
103
90
  messageIntervalPosts: settings.messageIntervalPosts,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "Ezoic ads with infinite scroll using a pool of placeholder IDs",
5
5
  "main": "library.js",
6
6
  "license": "MIT",
package/public/admin.js CHANGED
@@ -1,12 +1,7 @@
1
- /* globals app, ajaxify */
1
+ /* globals app */
2
2
  'use strict';
3
3
 
4
4
  (function () {
5
- function isOurPage(data) {
6
- const url = data?.url || ajaxify?.data?.url || window.location.pathname || '';
7
- return url.includes('admin/plugins/ezoic-infinite') || url.includes('/plugins/ezoic-infinite');
8
- }
9
-
10
5
  function init() {
11
6
  const $form = $('.ezoic-infinite-settings');
12
7
  if (!$form.length) return;
@@ -17,7 +12,6 @@
17
12
  $('#save').off('click.ezoicInfinite').on('click.ezoicInfinite', function (e) {
18
13
  e.preventDefault();
19
14
  Settings.save('ezoic-infinite', $form, function () {
20
- // Toast vert par défaut
21
15
  app.alertSuccess('Enregistré');
22
16
  });
23
17
  });
@@ -25,7 +19,5 @@
25
19
  }
26
20
 
27
21
  $(document).ready(init);
28
- $(window).on('action:ajaxify.end', function (ev, data) {
29
- if (isOurPage(data)) init();
30
- });
22
+ $(window).on('action:ajaxify.end', init);
31
23
  })();
package/README.md DELETED
@@ -1,18 +0,0 @@
1
- # nodebb-plugin-ezoic-infinite
2
-
3
- Plugin NodeBB 4.x pour intégrer Ezoic avec infinite scroll.
4
-
5
- ## Correctifs inclus
6
- - Route **/api/admin/plugins/ezoic-infinite** ajoutée (indispensable pour le 1er clic dans l'ACP via ajaxify)
7
- - Toast vert (app.alertSuccess) lors de l'enregistrement
8
- - package.json non-private (publication npm possible)
9
-
10
- ## Installation (local)
11
- ```bash
12
- cd /path/to/nodebb/node_modules
13
- unzip nodebb-plugin-ezoic-infinite.zip -d nodebb-plugin-ezoic-infinite
14
- cd /path/to/nodebb
15
- npm i ./node_modules/nodebb-plugin-ezoic-infinite
16
- ./nodebb build
17
- ./nodebb restart
18
- ```