| 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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 break; | 370 break; |
| 371 case "get-domain-enabled-state": | 371 case "get-domain-enabled-state": |
| 372 // Returns whether this domain is in the exclusion list. | 372 // Returns whether this domain is in the exclusion list. |
| 373 // The browser action popup asks us this. | 373 // The browser action popup asks us this. |
| 374 if(sender.page) | 374 if(sender.page) |
| 375 { | 375 { |
| 376 sendResponse({enabled: !checkWhitelisted(sender.page)}); | 376 sendResponse({enabled: !checkWhitelisted(sender.page)}); |
| 377 return; | 377 return; |
| 378 } | 378 } |
| 379 break; | 379 break; |
| 380 case "add-filters": | |
| 381 var result = parseFilters(msg.text); | |
| 382 | |
| 383 if (result.errors.length > 0) | |
| 384 { | |
| 385 sendResponse({status: "invalid", error: result.errors.join("\n")}); | |
| 386 break; | |
| 387 } | |
| 388 | |
| 389 for (var i = 0; i < result.filters.length; i++) | |
| 390 FilterStorage.addFilter(result.filters[i]); | |
| 391 | |
| 392 sendResponse({status: "ok"}); | |
| 393 break; | |
| 394 case "add-sitekey": | 380 case "add-sitekey": |
| 395 processKey(msg.token, sender.page, sender.frame); | 381 processKey(msg.token, sender.page, sender.frame); |
| 396 break; | 382 break; |
| 397 case "report-html-page": | 383 case "report-html-page": |
| 398 htmlPages.set(sender.page, null); | 384 htmlPages.set(sender.page, null); |
| 399 refreshIconAndContextMenu(sender.page); | 385 refreshIconAndContextMenu(sender.page); |
| 400 break; | 386 break; |
| 401 case "compose-filters": | 387 case "compose-filters": |
| 402 sendResponse(composeFilters({ | 388 sendResponse(composeFilters({ |
| 403 tagName: msg.tagName, | 389 tagName: msg.tagName, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 } | 426 } |
| 441 }); | 427 }); |
| 442 | 428 |
| 443 // update icon when page changes location | 429 // update icon when page changes location |
| 444 ext.pages.onLoading.addListener(function(page) | 430 ext.pages.onLoading.addListener(function(page) |
| 445 { | 431 { |
| 446 page.sendMessage({type: "blockelement-finished"}); | 432 page.sendMessage({type: "blockelement-finished"}); |
| 447 refreshIconAndContextMenu(page); | 433 refreshIconAndContextMenu(page); |
| 448 showNextNotificationForUrl(page.url); | 434 showNextNotificationForUrl(page.url); |
| 449 }); | 435 }); |
| OLD | NEW |