LEFT | RIGHT |
1 "use strict"; | 1 "use strict"; |
2 | 2 |
3 let readline = require("readline"); | 3 let readline = require("readline"); |
4 let punycode = require("punycode"); | 4 let punycode = require("punycode"); |
5 let tldjs = require("tldjs"); | 5 let tldjs = require("tldjs"); |
6 let filterClasses = require("./adblockplus.js"); | 6 let filterClasses = require("./adblockplus.js"); |
7 | 7 |
8 let typeMap = filterClasses.RegExpFilter.typeMap; | 8 let typeMap = filterClasses.RegExpFilter.typeMap; |
9 | 9 |
10 const selectorLimit = 5000; | 10 const selectorLimit = 5000; |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 groupedElemhideFilters.set(matchDomain, group); | 281 groupedElemhideFilters.set(matchDomain, group); |
282 } | 282 } |
283 } | 283 } |
284 | 284 |
285 groupedElemhideFilters.forEach((selectors, matchDomain) => | 285 groupedElemhideFilters.forEach((selectors, matchDomain) => |
286 { | 286 { |
287 while (selectors.length) | 287 while (selectors.length) |
288 { | 288 { |
289 addRule({ | 289 addRule({ |
290 trigger: {"url-filter": matchDomain}, | 290 trigger: {"url-filter": matchDomain}, |
291 action: {type: "css-display-none"}, | 291 action: {type: "css-display-none", |
292 selector: selectors.splice(0, selectorLimit).join(", ") | 292 selector: selectors.splice(0, selectorLimit).join(", ")} |
293 }); | 293 }); |
294 } | 294 } |
295 }); | 295 }); |
296 | 296 |
297 for (let filter of elemhideExceptions) | 297 for (let filter of elemhideExceptions) |
298 addRule(convertFilter(filter, "ignore-previous-rules", false)); | 298 addRule(convertFilter(filter, "ignore-previous-rules", false)); |
299 | 299 |
300 for (let filter of requestFilters) | 300 for (let filter of requestFilters) |
301 addRule(convertFilter(filter, "block", true)); | 301 addRule(convertFilter(filter, "block", true)); |
302 for (let filter of requestExceptions) | 302 for (let filter of requestExceptions) |
303 addRule(convertFilter(filter, "ignore-previous-rules", true)); | 303 addRule(convertFilter(filter, "ignore-previous-rules", true)); |
304 | 304 |
305 console.log(JSON.stringify(rules, null, "\t")); | 305 console.log(JSON.stringify(rules, null, "\t")); |
306 } | 306 } |
307 | 307 |
308 let rl = readline.createInterface({input: process.stdin, terminal: false}); | 308 let rl = readline.createInterface({input: process.stdin, terminal: false}); |
309 rl.on("line", parseFilter); | 309 rl.on("line", parseFilter); |
310 rl.on("close", logRules); | 310 rl.on("close", logRules); |
LEFT | RIGHT |