browser-extension-manager 1.0.3 → 1.0.5
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/dist/defaults/src/assets/js/background.js +5 -1
- package/dist/defaults/src/assets/js/content.js +5 -1
- package/dist/defaults/src/assets/js/options.js +5 -1
- package/dist/defaults/src/assets/js/popup.js +5 -1
- package/dist/gulp/tasks/package.js +1 -3
- package/dist/lib/affiliatizer.js +30 -4
- package/package.json +1 -1
|
@@ -7,5 +7,9 @@ const Manager = new (require('browser-extension-manager/background'));
|
|
|
7
7
|
// Initialize
|
|
8
8
|
Manager.initialize()
|
|
9
9
|
.then(() => {
|
|
10
|
-
|
|
10
|
+
// Do other initialization tasks here
|
|
11
|
+
// ...
|
|
12
|
+
|
|
13
|
+
// Log the initialization
|
|
14
|
+
Manager.log('Initialized!');
|
|
11
15
|
});
|
|
@@ -4,5 +4,9 @@ const Manager = new (require('browser-extension-manager/content'));
|
|
|
4
4
|
// Initialize
|
|
5
5
|
Manager.initialize()
|
|
6
6
|
.then(() => {
|
|
7
|
-
|
|
7
|
+
// Do other initialization tasks here
|
|
8
|
+
// ...
|
|
9
|
+
|
|
10
|
+
// Log the initialization
|
|
11
|
+
Manager.log('Initialized!');
|
|
8
12
|
});
|
|
@@ -6,5 +6,9 @@ const bootstrap = require('/node_modules/browser-extension-manager/dist/assets/t
|
|
|
6
6
|
|
|
7
7
|
// Initialize
|
|
8
8
|
Manager.initialize(() => {
|
|
9
|
-
|
|
9
|
+
// Do other initialization tasks here
|
|
10
|
+
// ...
|
|
11
|
+
|
|
12
|
+
// Log the initialization
|
|
13
|
+
Manager.log('Initialized!');
|
|
10
14
|
})
|
|
@@ -6,5 +6,9 @@ const bootstrap = require('/node_modules/browser-extension-manager/dist/assets/t
|
|
|
6
6
|
|
|
7
7
|
// Initialize
|
|
8
8
|
Manager.initialize(() => {
|
|
9
|
-
|
|
9
|
+
// Do other initialization tasks here
|
|
10
|
+
// ...
|
|
11
|
+
|
|
12
|
+
// Log the initialization
|
|
13
|
+
Manager.log('Initialized!');
|
|
10
14
|
})
|
|
@@ -59,9 +59,7 @@ async function compileManifest(outputDir) {
|
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
// Add package version to manifest
|
|
62
|
-
|
|
63
|
-
manifest.version = project.version;
|
|
64
|
-
}
|
|
62
|
+
manifest.version = project.version;
|
|
65
63
|
|
|
66
64
|
// Save as regular JSON
|
|
67
65
|
jetpack.write(outputPath, JSON.stringify(manifest, null, 2));
|
package/dist/lib/affiliatizer.js
CHANGED
|
@@ -116,18 +116,44 @@ Affiliatizer.get = function () {
|
|
|
116
116
|
Affiliatizer.initialize = async function (parent) {
|
|
117
117
|
// Parse the URL
|
|
118
118
|
const url = new URL(window.location.href);
|
|
119
|
+
const query = url.searchParams;
|
|
119
120
|
|
|
120
|
-
//
|
|
121
|
-
|
|
121
|
+
// Get query parameters
|
|
122
|
+
const qsStatus = query.get('affiliatizerStatus');
|
|
123
|
+
|
|
124
|
+
// Check if the URL has the affiliatizerStatus parameter
|
|
125
|
+
if (qsStatus === 'reset') {
|
|
122
126
|
// Log
|
|
123
127
|
parent.log('Resetting affiliatizer data...');
|
|
124
128
|
|
|
125
129
|
// Reset the data
|
|
126
|
-
await storage.set({ affiliatizer: null })
|
|
127
|
-
|
|
130
|
+
await storage.set({ affiliatizer: null });
|
|
131
|
+
query.delete('affiliatizerStatus');
|
|
128
132
|
|
|
129
133
|
// Log
|
|
130
134
|
parent.log('Reset!');
|
|
135
|
+
} else if (qsStatus === 'block') {
|
|
136
|
+
// Log
|
|
137
|
+
parent.log('Affiliatizer is blocked.');
|
|
138
|
+
|
|
139
|
+
// Set affiliatizer to 'block' in storage
|
|
140
|
+
await storage.set({ affiliatizer: 'block' });
|
|
141
|
+
} else if (qsStatus === 'allow') {
|
|
142
|
+
// Log
|
|
143
|
+
parent.log('Affiliatizer is allowed.');
|
|
144
|
+
|
|
145
|
+
// Set affiliatizer to 'allow' in storage
|
|
146
|
+
await storage.set({ affiliatizer: 'allow' });
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Check if affiliatizer is blocked
|
|
150
|
+
const data = await storage.get() || {};
|
|
151
|
+
const status = data.affiliatizer || 'allow';
|
|
152
|
+
|
|
153
|
+
// Check if it's blocked
|
|
154
|
+
if (status === 'block') {
|
|
155
|
+
parent.log('Affiliatizer is blocked.');
|
|
156
|
+
return;
|
|
131
157
|
}
|
|
132
158
|
|
|
133
159
|
// Loop through the map
|