nodebb-plugin-ezoic-infinite 1.7.38 → 1.7.39
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 +10 -9
- package/package.json +1 -1
- package/plugin.json +9 -29
package/library.js
CHANGED
|
@@ -92,22 +92,23 @@ plugin.addAdminNavigation = async (header) => {
|
|
|
92
92
|
};
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
|
-
* Injecte les scripts Ezoic via
|
|
95
|
+
* Injecte les scripts Ezoic dans le <head> via templateData.customHTML.
|
|
96
96
|
*
|
|
97
|
-
* NodeBB v4
|
|
98
|
-
* (
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
97
|
+
* NodeBB v4 / thème Harmony : header.tpl contient {{customHTML}} dans le <head>
|
|
98
|
+
* (render.js ligne 232 : templateValues.customHTML = meta.config.customHTML).
|
|
99
|
+
* Le hook filter:middleware.renderHeader reçoit templateData = headerFooterData
|
|
100
|
+
* et est rendu via req.app.renderAsync('header', hookReturn.templateData).
|
|
101
|
+
* On préfixe customHTML pour que nos scripts passent AVANT le customHTML admin,
|
|
102
|
+
* tout en préservant ce dernier.
|
|
103
103
|
*/
|
|
104
|
-
plugin.
|
|
104
|
+
plugin.injectEzoicHead = async (data) => {
|
|
105
105
|
try {
|
|
106
106
|
const settings = await getSettings();
|
|
107
107
|
const uid = data.req?.uid ?? 0;
|
|
108
108
|
const excluded = await isUserExcluded(uid, settings.excludedGroups);
|
|
109
109
|
if (!excluded) {
|
|
110
|
-
|
|
110
|
+
// Préfixer : nos scripts d'abord, puis le customHTML existant de l'admin
|
|
111
|
+
data.templateData.customHTML = EZOIC_SCRIPTS + (data.templateData.customHTML || '');
|
|
111
112
|
}
|
|
112
113
|
} catch (_) {}
|
|
113
114
|
return data;
|
package/package.json
CHANGED
package/plugin.json
CHANGED
|
@@ -4,34 +4,14 @@
|
|
|
4
4
|
"description": "Ezoic ads with infinite scroll using a pool of placeholder IDs",
|
|
5
5
|
"library": "./library.js",
|
|
6
6
|
"hooks": [
|
|
7
|
-
{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
{
|
|
12
|
-
"hook": "filter:admin.header.build",
|
|
13
|
-
"method": "addAdminNavigation"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"hook": "action:settings.set",
|
|
17
|
-
"method": "onSettingsSet"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"hook": "filter:middleware.buildHeader",
|
|
21
|
-
"method": "injectEzoicScripts"
|
|
22
|
-
}
|
|
7
|
+
{ "hook": "static:app.load", "method": "init" },
|
|
8
|
+
{ "hook": "filter:admin.header.build", "method": "addAdminNavigation" },
|
|
9
|
+
{ "hook": "action:settings.set", "method": "onSettingsSet" },
|
|
10
|
+
{ "hook": "filter:middleware.renderHeader","method": "injectEzoicHead" }
|
|
23
11
|
],
|
|
24
|
-
"staticDirs": {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
],
|
|
30
|
-
"scripts": [
|
|
31
|
-
"public/client.js"
|
|
32
|
-
],
|
|
33
|
-
"templates": "public/templates",
|
|
34
|
-
"css": [
|
|
35
|
-
"public/style.css"
|
|
36
|
-
]
|
|
12
|
+
"staticDirs": { "public": "public" },
|
|
13
|
+
"acpScripts": [ "public/admin.js" ],
|
|
14
|
+
"scripts": [ "public/client.js" ],
|
|
15
|
+
"templates": "public/templates",
|
|
16
|
+
"css": [ "public/style.css" ]
|
|
37
17
|
}
|