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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 { | 298 { |
299 switch (msg.type) | 299 switch (msg.type) |
300 { | 300 { |
301 case "get-selectors": | 301 case "get-selectors": |
302 var selectors = []; | 302 var selectors = []; |
303 | 303 |
304 if (!isFrameWhitelisted(sender.page, sender.frame, | 304 if (!isFrameWhitelisted(sender.page, sender.frame, |
305 RegExpFilter.typeMap.DOCUMENT | RegExpFilter.typeM
ap.ELEMHIDE)) | 305 RegExpFilter.typeMap.DOCUMENT | RegExpFilter.typeM
ap.ELEMHIDE)) |
306 { | 306 { |
307 var noStyleRules = false; | 307 var noStyleRules = false; |
| 308 var specificOnly = isFrameWhitelisted(sender.page, sender.frame, RegExpF
ilter.typeMap.GENERICHIDE); |
308 var host = extractHostFromFrame(sender.frame); | 309 var host = extractHostFromFrame(sender.frame); |
| 310 |
309 for (var i = 0; i < noStyleRulesHosts.length; i++) | 311 for (var i = 0; i < noStyleRulesHosts.length; i++) |
310 { | 312 { |
311 var noStyleHost = noStyleRulesHosts[i]; | 313 var noStyleHost = noStyleRulesHosts[i]; |
312 if (host == noStyleHost || (host.length > noStyleHost.length && | 314 if (host == noStyleHost || (host.length > noStyleHost.length && |
313 host.substr(host.length - noStyleHost.leng
th - 1) == "." + noStyleHost)) | 315 host.substr(host.length - noStyleHost.leng
th - 1) == "." + noStyleHost)) |
314 { | 316 { |
315 noStyleRules = true; | 317 noStyleRules = true; |
316 } | 318 } |
317 } | 319 } |
318 selectors = ElemHide.getSelectorsForDomain(host, false); | 320 selectors = ElemHide.getSelectorsForDomain(host, specificOnly); |
319 if (noStyleRules) | 321 if (noStyleRules) |
320 { | 322 { |
321 selectors = selectors.filter(function(s) | 323 selectors = selectors.filter(function(s) |
322 { | 324 { |
323 return !/\[style[\^\$]?=/.test(s); | 325 return !/\[style[\^\$]?=/.test(s); |
324 }); | 326 }); |
325 } | 327 } |
326 } | 328 } |
327 | 329 |
328 sendResponse(selectors); | 330 sendResponse(selectors); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 break; | 426 break; |
425 } | 427 } |
426 }); | 428 }); |
427 | 429 |
428 // update icon when page changes location | 430 // update icon when page changes location |
429 ext.pages.onLoading.addListener(function(page) | 431 ext.pages.onLoading.addListener(function(page) |
430 { | 432 { |
431 page.sendMessage({type: "clickhide-deactivate"}); | 433 page.sendMessage({type: "clickhide-deactivate"}); |
432 refreshIconAndContextMenu(page); | 434 refreshIconAndContextMenu(page); |
433 }); | 435 }); |
OLD | NEW |