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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 // The browser action popup asks us this. | 363 // The browser action popup asks us this. |
364 if(sender.page) | 364 if(sender.page) |
365 { | 365 { |
366 sendResponse({enabled: !isPageWhitelisted(sender.page)}); | 366 sendResponse({enabled: !isPageWhitelisted(sender.page)}); |
367 return; | 367 return; |
368 } | 368 } |
369 break; | 369 break; |
370 case "add-filters": | 370 case "add-filters": |
371 var result = parseFilters(msg.text); | 371 var result = parseFilters(msg.text); |
372 | 372 |
373 if (result.error) | 373 if (result.errors.length > 0) |
374 { | 374 { |
375 sendResponse({status: "invalid", error: result.error}); | 375 sendResponse({status: "invalid", error: result.errors.join("\n")}); |
376 break; | 376 break; |
377 } | 377 } |
378 | 378 |
379 for (var i = 0; i < result.filters.length; i++) | 379 for (var i = 0; i < result.filters.length; i++) |
380 FilterStorage.addFilter(result.filters[i]); | 380 FilterStorage.addFilter(result.filters[i]); |
381 | 381 |
382 sendResponse({status: "ok"}); | 382 sendResponse({status: "ok"}); |
383 break; | 383 break; |
384 case "add-subscription": | 384 case "add-subscription": |
385 ext.showOptions(function(page) | 385 ext.showOptions(function(page) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 break; | 422 break; |
423 } | 423 } |
424 }); | 424 }); |
425 | 425 |
426 // update icon when page changes location | 426 // update icon when page changes location |
427 ext.pages.onLoading.addListener(function(page) | 427 ext.pages.onLoading.addListener(function(page) |
428 { | 428 { |
429 page.sendMessage({type: "clickhide-deactivate"}); | 429 page.sendMessage({type: "clickhide-deactivate"}); |
430 refreshIconAndContextMenu(page); | 430 refreshIconAndContextMenu(page); |
431 }); | 431 }); |
OLD | NEW |