| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 * @return {Boolean} false if the request should be blocked | 63 * @return {Boolean} false if the request should be blocked |
| 64 */ | 64 */ |
| 65 function shouldAllow(window, node, contentType, location) | 65 function shouldAllow(window, node, contentType, location) |
| 66 { | 66 { |
| 67 let response = sendSyncMessage("AdblockPlus:ShouldAllow", { | 67 let response = sendSyncMessage("AdblockPlus:ShouldAllow", { |
| 68 contentType: contentType, | 68 contentType: contentType, |
| 69 location: location, | 69 location: location, |
| 70 frames: getFrames(window), | 70 frames: getFrames(window), |
| 71 isPrivate: isPrivate(window) | 71 isPrivate: isPrivate(window) |
| 72 }); | 72 }); |
| 73 if (response.length == 0) | 73 if (typeof response == "undefined") |
| 74 return true; | 74 return true; |
| 75 | 75 |
| 76 let {allow, collapse, hits} = response[0]; | 76 let {allow, collapse, hits} = response; |
| 77 for (let {frameIndex, contentType, docDomain, thirdParty, location, filter} of
hits) | 77 for (let {frameIndex, contentType, docDomain, thirdParty, location, filter} of
hits) |
| 78 { | 78 { |
| 79 let context = node; | 79 let context = node; |
| 80 if (typeof frameIndex == "number") | 80 if (typeof frameIndex == "number") |
| 81 { | 81 { |
| 82 context = window; | 82 context = window; |
| 83 for (let i = 0; i < frameIndex; i++) | 83 for (let i = 0; i < frameIndex; i++) |
| 84 context = context.parent; | 84 context = context.parent; |
| 85 context = context.document; | 85 context = context.document; |
| 86 } | 86 } |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 Utils.runAsync(postProcessNodes); | 309 Utils.runAsync(postProcessNodes); |
| 310 } | 310 } |
| 311 } | 311 } |
| 312 | 312 |
| 313 /** | 313 /** |
| 314 * Processes nodes scheduled for post-processing (typically hides them). | 314 * Processes nodes scheduled for post-processing (typically hides them). |
| 315 */ | 315 */ |
| 316 function postProcessNodes() | 316 function postProcessNodes() |
| 317 { | 317 { |
| 318 if (!collapsedClass) | 318 if (!collapsedClass) |
| 319 { | 319 collapsedClass = sendSyncMessage("AdblockPlus:GetCollapsedClass"); |
| 320 let response = sendSyncMessage("AdblockPlus:GetCollapsedClass"); | |
| 321 if (response.length) | |
| 322 collapsedClass = response[0]; | |
| 323 } | |
| 324 | 320 |
| 325 let nodes = scheduledNodes; | 321 let nodes = scheduledNodes; |
| 326 scheduledNodes = null; | 322 scheduledNodes = null; |
| 327 | 323 |
| 328 if (!collapsedClass) | 324 if (!collapsedClass) |
| 329 return; | 325 return; |
| 330 | 326 |
| 331 for (let node of nodes) | 327 for (let node of nodes) |
| 332 { | 328 { |
| 333 // adjust frameset's cols/rows for frames | 329 // adjust frameset's cols/rows for frames |
| (...skipping 12 matching lines...) Expand all Loading... |
| 346 let property = (hasCols ? "cols" : "rows"); | 342 let property = (hasCols ? "cols" : "rows"); |
| 347 let weights = parentNode[property].split(","); | 343 let weights = parentNode[property].split(","); |
| 348 weights[index] = "0"; | 344 weights[index] = "0"; |
| 349 parentNode[property] = weights.join(","); | 345 parentNode[property] = weights.join(","); |
| 350 } | 346 } |
| 351 } | 347 } |
| 352 else | 348 else |
| 353 node.classList.add(collapsedClass); | 349 node.classList.add(collapsedClass); |
| 354 } | 350 } |
| 355 } | 351 } |
| OLD | NEW |