| 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 17 matching lines...) Expand all Loading... |
| 28 { | 28 { |
| 29 event.preventDefault(); | 29 event.preventDefault(); |
| 30 addFilters(); | 30 addFilters(); |
| 31 } | 31 } |
| 32 } | 32 } |
| 33 | 33 |
| 34 function addFilters() | 34 function addFilters() |
| 35 { | 35 { |
| 36 ext.backgroundPage.sendMessage( | 36 ext.backgroundPage.sendMessage( |
| 37 { | 37 { |
| 38 type: "add-filters", | 38 type: "filters.importRaw", |
| 39 text: document.getElementById("filters").value | 39 text: document.getElementById("filters").value |
| 40 }, | 40 }, |
| 41 function(response) | 41 function(errors) |
| 42 { | 42 { |
| 43 if (response.status == "ok") | 43 if (errors.length > 0) |
| 44 alert(errors.join("\n")); |
| 45 else |
| 44 closeDialog(true); | 46 closeDialog(true); |
| 45 else | |
| 46 alert(response.error); | |
| 47 }); | 47 }); |
| 48 } | 48 } |
| 49 | 49 |
| 50 function closeDialog(success) | 50 function closeDialog(success) |
| 51 { | 51 { |
| 52 ext.backgroundPage.sendMessage( | 52 ext.backgroundPage.sendMessage( |
| 53 { | 53 { |
| 54 type: "forward", | 54 type: "forward", |
| 55 targetPageId: targetPageId, | 55 targetPageId: targetPageId, |
| 56 payload: | 56 payload: |
| (...skipping 30 matching lines...) Expand all Loading... |
| 87 break; | 87 break; |
| 88 case "blockelement-close-popup": | 88 case "blockelement-close-popup": |
| 89 window.close(); | 89 window.close(); |
| 90 break; | 90 break; |
| 91 } | 91 } |
| 92 }); | 92 }); |
| 93 | 93 |
| 94 window.removeEventListener("load", init); | 94 window.removeEventListener("load", init); |
| 95 } | 95 } |
| 96 window.addEventListener("load", init, false); | 96 window.addEventListener("load", init, false); |
| OLD | NEW |