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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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: |
57 { | 57 { |
58 type: "blockelement-finished", | 58 type: "composer.content.finished", |
59 remove: (typeof success == "boolean" ? success : false) | 59 remove: (typeof success == "boolean" ? success : false) |
60 } | 60 } |
61 }); | 61 }); |
62 window.close(); | 62 window.close(); |
63 } | 63 } |
64 | 64 |
65 function init() | 65 function init() |
66 { | 66 { |
67 // Attach event listeners | 67 // Attach event listeners |
68 window.addEventListener("keydown", onKeyDown, false); | 68 window.addEventListener("keydown", onKeyDown, false); |
69 | 69 |
70 document.getElementById("addButton").addEventListener("click", addFilters); | 70 document.getElementById("addButton").addEventListener("click", addFilters); |
71 document.getElementById("cancelButton").addEventListener( | 71 document.getElementById("cancelButton").addEventListener( |
72 "click", closeDialog.bind(null, false) | 72 "click", closeDialog.bind(null, false) |
73 ); | 73 ); |
74 | 74 |
75 // Apply jQuery UI styles | 75 // Apply jQuery UI styles |
76 $("button").button(); | 76 $("button").button(); |
77 | 77 |
78 document.getElementById("filters").focus(); | 78 document.getElementById("filters").focus(); |
79 | 79 |
80 ext.onMessage.addListener(function(msg, sender, sendResponse) | 80 ext.onMessage.addListener(function(msg, sender, sendResponse) |
81 { | 81 { |
82 switch (msg.type) | 82 switch (msg.type) |
83 { | 83 { |
84 case "blockelement-popup-init": | 84 case "composer.dialog.init": |
85 targetPageId = msg.sender; | 85 targetPageId = msg.sender; |
86 document.getElementById("filters").value = msg.filters.join("\n"); | 86 document.getElementById("filters").value = msg.filters.join("\n"); |
87 break; | 87 break; |
88 case "blockelement-close-popup": | 88 case "composer.dialog.close": |
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 |