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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 19 matching lines...) Expand all Loading... |
30 } | 30 } |
31 else if (event.keyCode == 13 && !event.shiftKey && !event.ctrlKey) | 31 else if (event.keyCode == 13 && !event.shiftKey && !event.ctrlKey) |
32 { | 32 { |
33 event.preventDefault(); | 33 event.preventDefault(); |
34 addFilters(); | 34 addFilters(); |
35 } | 35 } |
36 } | 36 } |
37 | 37 |
38 function addFilters() | 38 function addFilters() |
39 { | 39 { |
40 chrome.runtime.sendMessage({ | 40 browser.runtime.sendMessage({ |
41 type: "filters.importRaw", | 41 type: "filters.importRaw", |
42 text: document.getElementById("filters").value | 42 text: document.getElementById("filters").value |
43 }, | 43 }, |
44 errors => | 44 errors => |
45 { | 45 { |
46 if (errors.length > 0) | 46 if (errors.length > 0) |
47 alert(errors.join("\n")); | 47 alert(errors.join("\n")); |
48 else | 48 else |
49 closeDialog(true); | 49 closeDialog(true); |
50 }); | 50 }); |
51 } | 51 } |
52 | 52 |
53 function closeDialog(success) | 53 function closeDialog(success) |
54 { | 54 { |
55 chrome.runtime.sendMessage({ | 55 browser.runtime.sendMessage({ |
56 type: "forward", | 56 type: "forward", |
57 targetPageId, | 57 targetPageId, |
58 payload: | 58 payload: |
59 { | 59 { |
60 type: "composer.content.finished", | 60 type: "composer.content.finished", |
61 remove: (typeof success == "boolean" ? success : false) | 61 remove: (typeof success == "boolean" ? success : false) |
62 } | 62 } |
63 }); | 63 }); |
64 window.close(); | 64 window.close(); |
65 } | 65 } |
(...skipping 23 matching lines...) Expand all Loading... |
89 break; | 89 break; |
90 case "composer.dialog.close": | 90 case "composer.dialog.close": |
91 window.close(); | 91 window.close(); |
92 break; | 92 break; |
93 } | 93 } |
94 }); | 94 }); |
95 | 95 |
96 window.removeEventListener("load", init); | 96 window.removeEventListener("load", init); |
97 } | 97 } |
98 window.addEventListener("load", init, false); | 98 window.addEventListener("load", init, false); |
OLD | NEW |