@tokioapp/adblock 0.0.0-stage → 0.1.0

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.
Files changed (143) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +72 -2
  3. package/THIRD_PARTY_NOTICES.md +50 -0
  4. package/dist/content/cosmetics.d.ts +22 -0
  5. package/dist/content/cosmetics.js +173 -0
  6. package/dist/content/mainWorld.d.ts +8 -0
  7. package/dist/content/mainWorld.js +10 -0
  8. package/dist/content/preload.d.ts +1 -0
  9. package/dist/content/preload.js +34 -0
  10. package/dist/content/procedural.d.ts +19 -0
  11. package/dist/content/procedural.js +212 -0
  12. package/dist/cosmetic/engine.d.ts +95 -0
  13. package/dist/cosmetic/engine.js +268 -0
  14. package/dist/electron/blocker.d.ts +84 -0
  15. package/dist/electron/blocker.js +320 -0
  16. package/dist/electron/channels.d.ts +10 -0
  17. package/dist/electron/channels.js +6 -0
  18. package/dist/electron/scheme.d.ts +21 -0
  19. package/dist/electron/scheme.js +21 -0
  20. package/dist/engine.d.ts +86 -0
  21. package/dist/engine.js +163 -0
  22. package/dist/index.d.ts +13 -0
  23. package/dist/index.js +12 -0
  24. package/dist/lists/defaults.d.ts +6 -0
  25. package/dist/lists/defaults.js +59 -0
  26. package/dist/lists/manager.d.ts +86 -0
  27. package/dist/lists/manager.js +154 -0
  28. package/dist/lists/preprocessor.d.ts +21 -0
  29. package/dist/lists/preprocessor.js +152 -0
  30. package/dist/lists/storage.d.ts +37 -0
  31. package/dist/lists/storage.js +66 -0
  32. package/dist/network/engine.d.ts +105 -0
  33. package/dist/network/engine.js +431 -0
  34. package/dist/network/filterIndex.d.ts +40 -0
  35. package/dist/network/filterIndex.js +343 -0
  36. package/dist/network/modifiers.d.ts +23 -0
  37. package/dist/network/modifiers.js +192 -0
  38. package/dist/network/pattern.d.ts +7 -0
  39. package/dist/network/pattern.js +145 -0
  40. package/dist/network/request.d.ts +50 -0
  41. package/dist/network/request.js +136 -0
  42. package/dist/network/tokens.d.ts +5 -0
  43. package/dist/network/tokens.js +150 -0
  44. package/dist/parser/cosmetic.d.ts +21 -0
  45. package/dist/parser/cosmetic.js +171 -0
  46. package/dist/parser/hosts.d.ts +20 -0
  47. package/dist/parser/hosts.js +143 -0
  48. package/dist/parser/index.d.ts +40 -0
  49. package/dist/parser/index.js +158 -0
  50. package/dist/parser/network.d.ts +6 -0
  51. package/dist/parser/network.js +474 -0
  52. package/dist/parser/selector.d.ts +25 -0
  53. package/dist/parser/selector.js +522 -0
  54. package/dist/parser/types.d.ts +175 -0
  55. package/dist/parser/types.js +75 -0
  56. package/dist/preload.cjs +1988 -0
  57. package/dist/psl/psl.d.ts +32 -0
  58. package/dist/psl/psl.js +119 -0
  59. package/dist/resources/binary.d.ts +9 -0
  60. package/dist/resources/binary.js +54 -0
  61. package/dist/resources/defusers.d.ts +29 -0
  62. package/dist/resources/defusers.js +180 -0
  63. package/dist/resources/documents.d.ts +12 -0
  64. package/dist/resources/documents.js +56 -0
  65. package/dist/resources/ima.d.ts +6 -0
  66. package/dist/resources/ima.js +313 -0
  67. package/dist/resources/index.d.ts +14 -0
  68. package/dist/resources/index.js +85 -0
  69. package/dist/resources/surrogates.d.ts +30 -0
  70. package/dist/resources/surrogates.js +486 -0
  71. package/dist/scriptlets/abort.d.ts +5 -0
  72. package/dist/scriptlets/abort.js +97 -0
  73. package/dist/scriptlets/dom/attributes.d.ts +5 -0
  74. package/dist/scriptlets/dom/attributes.js +92 -0
  75. package/dist/scriptlets/dom/click.d.ts +2 -0
  76. package/dist/scriptlets/dom/click.js +107 -0
  77. package/dist/scriptlets/dom/cookies.d.ts +16 -0
  78. package/dist/scriptlets/dom/cookies.js +194 -0
  79. package/dist/scriptlets/dom/createHtml.d.ts +2 -0
  80. package/dist/scriptlets/dom/createHtml.js +27 -0
  81. package/dist/scriptlets/dom/dialogs.d.ts +3 -0
  82. package/dist/scriptlets/dom/dialogs.js +21 -0
  83. package/dist/scriptlets/dom/hrefSanitizer.d.ts +2 -0
  84. package/dist/scriptlets/dom/hrefSanitizer.js +91 -0
  85. package/dist/scriptlets/dom/index.d.ts +3 -0
  86. package/dist/scriptlets/dom/index.js +38 -0
  87. package/dist/scriptlets/dom/navigation.d.ts +5 -0
  88. package/dist/scriptlets/dom/navigation.js +60 -0
  89. package/dist/scriptlets/dom/nodeText.d.ts +3 -0
  90. package/dist/scriptlets/dom/nodeText.js +98 -0
  91. package/dist/scriptlets/dom/spoofCss.d.ts +2 -0
  92. package/dist/scriptlets/dom/spoofCss.js +58 -0
  93. package/dist/scriptlets/dom/storage.d.ts +5 -0
  94. package/dist/scriptlets/dom/storage.js +50 -0
  95. package/dist/scriptlets/dom/watch.d.ts +8 -0
  96. package/dist/scriptlets/dom/watch.js +41 -0
  97. package/dist/scriptlets/events.d.ts +2 -0
  98. package/dist/scriptlets/events.js +42 -0
  99. package/dist/scriptlets/helpers.d.ts +58 -0
  100. package/dist/scriptlets/helpers.js +206 -0
  101. package/dist/scriptlets/index.d.ts +6 -0
  102. package/dist/scriptlets/index.js +47 -0
  103. package/dist/scriptlets/network/edit.d.ts +9 -0
  104. package/dist/scriptlets/network/edit.js +104 -0
  105. package/dist/scriptlets/network/eval.d.ts +3 -0
  106. package/dist/scriptlets/network/eval.js +22 -0
  107. package/dist/scriptlets/network/fetch.d.ts +10 -0
  108. package/dist/scriptlets/network/fetch.js +145 -0
  109. package/dist/scriptlets/network/index.d.ts +3 -0
  110. package/dist/scriptlets/network/index.js +43 -0
  111. package/dist/scriptlets/network/jsonPath.d.ts +13 -0
  112. package/dist/scriptlets/network/jsonPath.js +482 -0
  113. package/dist/scriptlets/network/media.d.ts +3 -0
  114. package/dist/scriptlets/network/media.js +97 -0
  115. package/dist/scriptlets/network/methods.d.ts +5 -0
  116. package/dist/scriptlets/network/methods.js +139 -0
  117. package/dist/scriptlets/network/prune.d.ts +13 -0
  118. package/dist/scriptlets/network/prune.js +194 -0
  119. package/dist/scriptlets/network/rendering.d.ts +4 -0
  120. package/dist/scriptlets/network/rendering.js +46 -0
  121. package/dist/scriptlets/network/replace.d.ts +5 -0
  122. package/dist/scriptlets/network/replace.js +168 -0
  123. package/dist/scriptlets/network/request.d.ts +19 -0
  124. package/dist/scriptlets/network/request.js +124 -0
  125. package/dist/scriptlets/network/util.d.ts +19 -0
  126. package/dist/scriptlets/network/util.js +80 -0
  127. package/dist/scriptlets/network/webrtc.d.ts +3 -0
  128. package/dist/scriptlets/network/webrtc.js +62 -0
  129. package/dist/scriptlets/network/windowOpen.d.ts +2 -0
  130. package/dist/scriptlets/network/windowOpen.js +28 -0
  131. package/dist/scriptlets/network/xhr.d.ts +9 -0
  132. package/dist/scriptlets/network/xhr.js +177 -0
  133. package/dist/scriptlets/runner.d.ts +8 -0
  134. package/dist/scriptlets/runner.js +19 -0
  135. package/dist/scriptlets/setConstant.d.ts +5 -0
  136. package/dist/scriptlets/setConstant.js +117 -0
  137. package/dist/scriptlets/timers.d.ts +5 -0
  138. package/dist/scriptlets/timers.js +66 -0
  139. package/dist/scriptlets/types.d.ts +32 -0
  140. package/dist/scriptlets/types.js +1 -0
  141. package/dist/util.d.ts +5 -0
  142. package/dist/util.js +16 -0
  143. package/package.json +83 -4
@@ -0,0 +1,313 @@
1
+ /**
2
+ * The IMA SDK for HTML5 (`google.ima`), from its public reference: every
3
+ * ad request fails with "VAST empty response", so players play the content.
4
+ * Runs in pages on its own: no imports, nothing from outside its body.
5
+ */
6
+ export function googleIma() {
7
+ const w = window;
8
+ if (w.google?.ima?.AdsLoader !== undefined)
9
+ return;
10
+ class Target {
11
+ #listeners = [];
12
+ addEventListener(types, listener, _capture, scope) {
13
+ for (const type of [].concat(types))
14
+ this.#listeners.push([type, listener, scope]);
15
+ }
16
+ removeEventListener(types, listener) {
17
+ const removed = [].concat(types);
18
+ this.#listeners = this.#listeners.filter(([type, fn]) => fn !== listener || !removed.includes(type));
19
+ }
20
+ dispatchEvent(event) {
21
+ for (const [type, listener, scope] of this.#listeners.slice()) {
22
+ if (type === event.type)
23
+ listener.call(scope, event);
24
+ }
25
+ }
26
+ }
27
+ const ErrorCode = {
28
+ ADS_REQUEST_NETWORK_ERROR: 1012,
29
+ ASSET_FALLBACK_FAILED: 1021,
30
+ AUTOPLAY_DISALLOWED: 1205,
31
+ COMPANION_AD_LOADING_FAILED: 603,
32
+ COMPANION_REQUIRED_ERROR: 602,
33
+ CONSENT_MANAGEMENT_PROVIDER_NOT_READY: 1300,
34
+ FAILED_TO_REQUEST_ADS: 1005,
35
+ INVALID_AD_TAG: 1013,
36
+ INVALID_ARGUMENTS: 1101,
37
+ NONLINEAR_DIMENSIONS_ERROR: 501,
38
+ OVERLAY_AD_LOADING_FAILED: 502,
39
+ OVERLAY_AD_PLAYING_FAILED: 500,
40
+ PROTECTED_AUDIENCE_API_ERROR: 1014,
41
+ STREAM_AUTHORIZATION_FAILED: 1024,
42
+ STREAM_INITIALIZATION_FAILED: 1020,
43
+ STREAM_INITIALIZATION_TIMEOUT: 1023,
44
+ UNKNOWN_AD_RESPONSE: 1010,
45
+ UNKNOWN_ERROR: 900,
46
+ UNSUPPORTED_URL: 1022,
47
+ VAST_ASSET_NOT_FOUND: 1007,
48
+ VAST_EMPTY_RESPONSE: 1009,
49
+ VAST_LINEAR_ASSET_MISMATCH: 403,
50
+ VAST_LOAD_TIMEOUT: 301,
51
+ VAST_MALFORMED_RESPONSE: 100,
52
+ VAST_MEDIA_LOAD_TIMEOUT: 402,
53
+ VAST_NO_ADS_AFTER_WRAPPER: 303,
54
+ VAST_NONLINEAR_ASSET_MISMATCH: 503,
55
+ VAST_PROBLEM_DISPLAYING_MEDIA_FILE: 405,
56
+ VAST_SCHEMA_VALIDATION_ERROR: 101,
57
+ VAST_TOO_MANY_REDIRECTS: 302,
58
+ VAST_TRAFFICKING_ERROR: 200,
59
+ VAST_UNEXPECTED_DURATION_ERROR: 202,
60
+ VAST_UNEXPECTED_LINEARITY: 201,
61
+ VAST_UNSUPPORTED_VERSION: 102,
62
+ VAST_WRAPPER_ERROR: 300,
63
+ VIDEO_PLAY_ERROR: 400,
64
+ VPAID_ERROR: 901,
65
+ };
66
+ class AdError {
67
+ static ErrorCode = ErrorCode;
68
+ static Type = { AD_LOAD: "adLoadError", AD_PLAY: "adPlayError" };
69
+ #code;
70
+ #message;
71
+ #type;
72
+ constructor(code, message, type) {
73
+ this.#code = code;
74
+ this.#message = message;
75
+ this.#type = type;
76
+ }
77
+ getErrorCode() {
78
+ return this.#code;
79
+ }
80
+ getInnerError() {
81
+ return null;
82
+ }
83
+ getMessage() {
84
+ return this.#message;
85
+ }
86
+ getType() {
87
+ return this.#type;
88
+ }
89
+ getVastErrorCode() {
90
+ return 303;
91
+ }
92
+ toString() {
93
+ return `AdError ${this.#code}: ${this.#message}`;
94
+ }
95
+ }
96
+ class AdErrorEvent {
97
+ static Type = { AD_ERROR: "adError" };
98
+ type = "adError";
99
+ #error;
100
+ #context;
101
+ constructor(error, context) {
102
+ this.#error = error;
103
+ this.#context = context;
104
+ }
105
+ getError() {
106
+ return this.#error;
107
+ }
108
+ getUserRequestContext() {
109
+ return this.#context ?? null;
110
+ }
111
+ }
112
+ class AdEvent {
113
+ static Type = {
114
+ AD_BREAK_FETCH_ERROR: "adBreakFetchError",
115
+ AD_BREAK_READY: "adBreakReady",
116
+ AD_BUFFERING: "adBuffering",
117
+ AD_CAN_PLAY: "adCanPlay",
118
+ AD_METADATA: "adMetadata",
119
+ AD_PROGRESS: "adProgress",
120
+ ALL_ADS_COMPLETED: "allAdsCompleted",
121
+ CLICK: "click",
122
+ COMPLETE: "complete",
123
+ CONTENT_PAUSE_REQUESTED: "contentPauseRequested",
124
+ CONTENT_RESUME_REQUESTED: "contentResumeRequested",
125
+ DURATION_CHANGE: "durationChange",
126
+ FIRST_QUARTILE: "firstQuartile",
127
+ IMPRESSION: "impression",
128
+ INTERACTION: "interaction",
129
+ LINEAR_CHANGED: "linearChanged",
130
+ LOADED: "loaded",
131
+ LOG: "log",
132
+ MIDPOINT: "midpoint",
133
+ PAUSED: "pause",
134
+ RESUMED: "resume",
135
+ SKIPPABLE_STATE_CHANGED: "skippableStateChanged",
136
+ SKIPPED: "skip",
137
+ STARTED: "start",
138
+ THIRD_QUARTILE: "thirdQuartile",
139
+ USER_CLOSE: "userClose",
140
+ VIDEO_CLICKED: "videoClicked",
141
+ VIDEO_ICON_CLICKED: "videoIconClicked",
142
+ VOLUME_CHANGED: "volumeChange",
143
+ VOLUME_MUTED: "mute",
144
+ };
145
+ type;
146
+ constructor(type) {
147
+ this.type = type;
148
+ }
149
+ getAd() {
150
+ return null;
151
+ }
152
+ getAdData() {
153
+ return null;
154
+ }
155
+ }
156
+ class AdsManager extends Target {
157
+ collapse() { }
158
+ configureAdsManager() { }
159
+ destroy() { }
160
+ discardAdBreak() { }
161
+ expand() { }
162
+ focus() { }
163
+ getAdSkippableState() {
164
+ return false;
165
+ }
166
+ getCuePoints() {
167
+ return [];
168
+ }
169
+ getRemainingTime() {
170
+ return 0;
171
+ }
172
+ getVolume() {
173
+ return 1;
174
+ }
175
+ init() { }
176
+ isCustomClickTrackingUsed() {
177
+ return false;
178
+ }
179
+ isCustomPlaybackUsed() {
180
+ return false;
181
+ }
182
+ pause() { }
183
+ resize() { }
184
+ resume() { }
185
+ setVolume() { }
186
+ skip() { }
187
+ start() { }
188
+ stop() { }
189
+ updateAdsRenderingSettings() { }
190
+ }
191
+ class AdsManagerLoadedEvent {
192
+ static Type = { ADS_MANAGER_LOADED: "adsManagerLoaded" };
193
+ type = "adsManagerLoaded";
194
+ getAdsManager() {
195
+ return new AdsManager();
196
+ }
197
+ getUserRequestContext() {
198
+ return null;
199
+ }
200
+ }
201
+ class ImaSdkSettings {
202
+ static CompanionBackfillMode = {
203
+ ALWAYS: "always",
204
+ ON_MASTER_AD: "on_master_ad",
205
+ };
206
+ static VpaidMode = { DISABLED: 0, ENABLED: 1, INSECURE: 2 };
207
+ #values = {
208
+ CompanionBackfill: "always",
209
+ DisableCustomPlaybackForIOS10Plus: false,
210
+ FeatureFlags: {},
211
+ Locale: "en",
212
+ NumRedirects: 4,
213
+ PlayerType: "",
214
+ PlayerVersion: "",
215
+ Ppid: "",
216
+ PreloadTimeSeconds: 0,
217
+ };
218
+ constructor() {
219
+ for (const name of [
220
+ ...Object.keys(this.#values),
221
+ "AutoPlayAdBreaks",
222
+ "SessionId",
223
+ "VpaidAllowed",
224
+ "VpaidMode",
225
+ ]) {
226
+ const self = this;
227
+ self[`set${name}`] = (value) => {
228
+ this.#values[name] = value;
229
+ };
230
+ if (name in this.#values)
231
+ self[`get${name}`] = () => this.#values[name];
232
+ }
233
+ }
234
+ }
235
+ const settings = new ImaSdkSettings();
236
+ const VERSION = "3.0.0";
237
+ class AdsLoader extends Target {
238
+ contentComplete() { }
239
+ destroy() { }
240
+ getSettings() {
241
+ return settings;
242
+ }
243
+ getVersion() {
244
+ return VERSION;
245
+ }
246
+ requestAds(_request, context) {
247
+ setTimeout(() => {
248
+ const error = new AdError(ErrorCode.VAST_EMPTY_RESPONSE, "No ads in the VAST response.", AdError.Type.AD_LOAD);
249
+ this.dispatchEvent(new AdErrorEvent(error, context));
250
+ }, 0);
251
+ }
252
+ }
253
+ class AdDisplayContainer {
254
+ initialize() { }
255
+ destroy() { }
256
+ }
257
+ class AdsRequest {
258
+ setAdWillAutoPlay() { }
259
+ setAdWillPlayMuted() { }
260
+ setContinuousPlayback() { }
261
+ }
262
+ class AdsRenderingSettings {
263
+ }
264
+ class CompanionAdSelectionSettings {
265
+ static CreativeType = { ALL: "All", FLASH: "Flash", IMAGE: "Image" };
266
+ static ResourceType = {
267
+ ALL: "All",
268
+ HTML: "Html",
269
+ IFRAME: "IFrame",
270
+ STATIC: "Static",
271
+ };
272
+ static SizeCriteria = {
273
+ IGNORE: "IgnoreSize",
274
+ SELECT_EXACT_MATCH: "SelectExactMatch",
275
+ SELECT_NEAR_MATCH: "SelectNearMatch",
276
+ };
277
+ }
278
+ const ima = {
279
+ AdDisplayContainer,
280
+ AdError,
281
+ AdErrorEvent,
282
+ AdEvent,
283
+ AdsLoader,
284
+ AdsManager,
285
+ AdsManagerLoadedEvent,
286
+ AdsRenderingSettings,
287
+ AdsRequest,
288
+ CompanionAdSelectionSettings,
289
+ ImaSdkSettings,
290
+ OmidAccessMode: { DOMAIN: "domain", FULL: "full", LIMITED: "limited" },
291
+ // Values aren't documented: pages only use them as keys.
292
+ OmidVerificationVendor: {
293
+ COMSCORE: 1,
294
+ DOUBLEVERIFY: 2,
295
+ GOOGLE: 3,
296
+ HUMAN: 4,
297
+ INTEGRAL_AD_SCIENCE: 5,
298
+ MEETRICS: 6,
299
+ MOAT: 7,
300
+ MOBIAN: 8,
301
+ NIELSEN: 9,
302
+ OTHER: 10,
303
+ PIXELATE: 11,
304
+ },
305
+ UiElements: { AD_ATTRIBUTION: "adAttribution", COUNTDOWN: "countdown" },
306
+ ViewMode: { FULLSCREEN: "fullscreen", NORMAL: "normal" },
307
+ VERSION,
308
+ settings,
309
+ };
310
+ if (typeof w.google !== "object" || w.google === null)
311
+ w.google = {};
312
+ w.google.ima = Object.assign(w.google.ima ?? {}, ima);
313
+ }
@@ -0,0 +1,14 @@
1
+ export interface RedirectResource {
2
+ /** Its own name, as the wiki lists it: `noop.js`, `1x1.gif`, `google-ima.js`. */
3
+ name: string;
4
+ /** Other names filters use for it. */
5
+ aliases: readonly string[];
6
+ /** The Content-Type it is served with. */
7
+ mime: string;
8
+ /** Text, or bytes for an image, a sound or a video. */
9
+ body: string | Uint8Array;
10
+ }
11
+ export declare const RESOURCES: readonly RedirectResource[];
12
+ /** The resource a `redirect=` value names, by its name or an alias, or undefined. */
13
+ export declare function findResource(token: string): RedirectResource | undefined;
14
+ export { DEFUSERS } from "./defusers.js";
@@ -0,0 +1,85 @@
1
+ import { gif, mp3, png } from "./binary.js";
2
+ import { ampprojectV0, fingerprint2, fingerprint3, nobab, nobab2, nofab, popads, popadsDummy, prebidAds, } from "./defusers.js";
3
+ import { CLICK2LOAD, NOOP_HTML, VMAP, vast } from "./documents.js";
4
+ import { googleIma } from "./ima.js";
5
+ import { addthisWidget, amazonAds, amazonApstag, chartbeat, doubleclickInstreamAdStatus, googleAnalytics, googleAnalyticsCxApi, googleAnalyticsGa, googlesyndicationAdsbygoogle, googletagManager, googletagServices, ligatusAngularTag, outbrainWidget, scorecardresearchBeacon, sensorsAnalytics, } from "./surrogates.js";
6
+ // Bodies are built on first read: the module loads at the host's startup.
7
+ function resource(name, aliases, mime, build) {
8
+ let body;
9
+ return {
10
+ name,
11
+ aliases,
12
+ mime,
13
+ get body() {
14
+ return (body ??= build());
15
+ },
16
+ };
17
+ }
18
+ const JS = "text/javascript";
19
+ const script = (fn) => () => `(${fn.toString()})();\n`;
20
+ const empty = () => "";
21
+ export const RESOURCES = [
22
+ resource("1x1.gif", ["1x1-transparent-gif"], "image/gif", gif),
23
+ resource("2x2.png", ["2x2-transparent-png"], "image/png", () => png(2, 2)),
24
+ resource("3x2.png", ["3x2-transparent-png"], "image/png", () => png(3, 2)),
25
+ resource("32x32.png", ["32x32-transparent-png"], "image/png", () => png(32, 32)),
26
+ resource("noop.css", ["noopcss", "blank-css"], "text/css", empty),
27
+ resource("noop.html", ["noopframe", "blank-html"], "text/html", () => NOOP_HTML),
28
+ resource("noop.js", ["noopjs", "blank-js"], JS, empty),
29
+ resource("noop.json", ["noopjson"], "application/json", () => "{}"),
30
+ resource("noop.txt", ["nooptext", "blank-text", "empty"], "text/plain", empty),
31
+ resource("noop-0.1s.mp3", ["noopmp3-0.1s", "blank-mp3"], "audio/mpeg", () => mp3(0.1)),
32
+ resource("noop-0.5s.mp3", ["noopmp3-0.5s"], "audio/mpeg", () => mp3(0.5)),
33
+ // shortcut: an empty body, the element errors instead of playing; a real one-second file needs an encoder, generate one when a site needs it
34
+ resource("noop-1s.mp4", ["noopmp4-1s", "blank-mp4"], "video/mp4", () => new Uint8Array()),
35
+ resource("noop-vast2.xml", ["noopvast-2.0"], "application/xml", () => vast("2.0")),
36
+ resource("noop-vast3.xml", ["noopvast-3.0"], "application/xml", () => vast("3.0")),
37
+ resource("noop-vast4.xml", ["noopvast-4.0"], "application/xml", () => vast("4.0")),
38
+ resource("noop-vmap1.xml", ["noopvmap-1.0"], "application/xml", () => VMAP),
39
+ resource("click2load.html", [], "text/html", () => CLICK2LOAD),
40
+ resource("ampproject_v0.js", ["ampproject.org/v0.js"], JS, script(ampprojectV0)),
41
+ resource("fingerprint2.js", [], JS, script(fingerprint2)),
42
+ resource("fingerprint3.js", [], JS, script(fingerprint3)),
43
+ resource("nobab.js", ["bab-defuser.js"], JS, script(nobab)),
44
+ resource("nobab2.js", [], JS, script(nobab2)),
45
+ resource("nofab.js", ["fuckadblock.js-3.2.0"], JS, script(nofab)),
46
+ resource("popads-dummy.js", [], JS, script(popadsDummy)),
47
+ resource("popads.js", ["popads.net.js"], JS, script(popads)),
48
+ resource("prebid-ads.js", [], JS, script(prebidAds)),
49
+ resource("amazon_ads.js", ["amazon-adsystem.com/aax2/amzn_ads.js"], JS, script(amazonAds)),
50
+ resource("amazon_apstag.js", [], JS, script(amazonApstag)),
51
+ resource("doubleclick_instream_ad_status.js", ["doubleclick.net/instream/ad_status.js"], JS, script(doubleclickInstreamAdStatus)),
52
+ resource("google-analytics_ga.js", ["google-analytics.com/ga.js"], JS, script(googleAnalyticsGa)),
53
+ resource("google-analytics_analytics.js", ["google-analytics.com/analytics.js"], JS, script(googleAnalytics)),
54
+ // A ga.js plugin that adds nothing a page calls.
55
+ resource("google-analytics_inpage_linkid.js", ["google-analytics.com/inpage_linkid.js"], JS, empty),
56
+ resource("google-analytics_cx_api.js", ["google-analytics.com/cx/api.js"], JS, script(googleAnalyticsCxApi)),
57
+ resource("google-ima.js", ["google-ima3"], JS, script(googleIma)),
58
+ resource("googletagservices_gpt.js", ["googletagservices.com/gpt.js"], JS, script(googletagServices)),
59
+ resource("googletagmanager_gtm.js", ["googletagmanager.com/gtm.js"], JS, script(googletagManager)),
60
+ resource("googlesyndication_adsbygoogle.js", ["googlesyndication.com/adsbygoogle.js"], JS, script(googlesyndicationAdsbygoogle)),
61
+ resource("scorecardresearch_beacon.js", ["scorecardresearch.com/beacon.js"], JS, script(scorecardresearchBeacon)),
62
+ resource("outbrain-widget.js", ["widgets.outbrain.com/outbrain.js"], JS, script(outbrainWidget)),
63
+ // No public documentation says what these define: an empty script.
64
+ resource("hd-main.js", [], JS, empty),
65
+ // In uBlock Origin's lists but not in its wiki: an empty script still
66
+ // answers the request, where no resource would discard the filter.
67
+ resource("adthrive_abd.js", [], JS, empty),
68
+ resource("nitropay_ads.js", [], JS, empty),
69
+ resource("monkeybroker.js", ["d3pkae9owd2lcf.cloudfront.net/mb105.js"], JS, empty),
70
+ resource("chartbeat.js", ["static.chartbeat.com/chartbeat.js"], JS, script(chartbeat)),
71
+ resource("ligatus_angular-tag.js", ["ligatus.com/*/angular-tag.js"], JS, script(ligatusAngularTag)),
72
+ resource("addthis_widget.js", ["addthis.com/addthis_widget.js"], JS, script(addthisWidget)),
73
+ resource("sensors-analytics.js", [], JS, script(sensorsAnalytics)),
74
+ ];
75
+ const byName = new Map();
76
+ for (const each of RESOURCES) {
77
+ for (const name of [each.name, ...each.aliases])
78
+ byName.set(name, each);
79
+ }
80
+ /** The resource a `redirect=` value names, by its name or an alias, or undefined. */
81
+ export function findResource(token) {
82
+ return (byName.get(token) ??
83
+ byName.get(token.endsWith(".js") ? token.slice(0, -3) : `${token}.js`));
84
+ }
85
+ export { DEFUSERS } from "./defusers.js";
@@ -0,0 +1,30 @@
1
+ /** Google Publisher Tag (`googletag`): every slot renders empty. */
2
+ export declare function googletagServices(): void;
3
+ /** Google Tag Manager: `dataLayer` pushes get their `eventCallback` called. */
4
+ export declare function googletagManager(): void;
5
+ /** Google Analytics `analytics.js` (`ga`): commands are dropped, callbacks called. */
6
+ export declare function googleAnalytics(): void;
7
+ /** Google Analytics `ga.js` (`_gaq`, `_gat`): trackers whose methods do nothing. */
8
+ export declare function googleAnalyticsGa(): void;
9
+ /** Google Analytics Content Experiments (`cxApi`): always the original. */
10
+ export declare function googleAnalyticsCxApi(): void;
11
+ /** AdSense (`adsbygoogle`): every ad unit is marked as done and unfilled. */
12
+ export declare function googlesyndicationAdsbygoogle(): void;
13
+ /** Amazon Publisher Services (`apstag`): bid requests come back empty. */
14
+ export declare function amazonApstag(): void;
15
+ /** Amazon's older `amzn_ads.js` (`amznads`): no ads, callbacks called. */
16
+ export declare function amazonAds(): void;
17
+ /** comScore (`COMSCORE`, `_comscore`): beacons go nowhere. */
18
+ export declare function scorecardresearchBeacon(): void;
19
+ /** Outbrain (`OBR`): widgets never load. */
20
+ export declare function outbrainWidget(): void;
21
+ /** Chartbeat (`pSUPERFLY`). */
22
+ export declare function chartbeat(): void;
23
+ /** Ligatus: its ad block detection flags. */
24
+ export declare function ligatusAngularTag(): void;
25
+ /** AddThis (`addthis`): share buttons that do nothing. */
26
+ export declare function addthisWidget(): void;
27
+ /** Google's ad status check for IMA: ads can play. */
28
+ export declare function doubleclickInstreamAdStatus(): void;
29
+ /** The Sensors Analytics web SDK (`sensors`): events go nowhere. */
30
+ export declare function sensorsAnalytics(): void;