| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 } | 57 } |
| 58 else if (event.keyCode == 13 && !event.shiftKey && !event.ctrlKey) | 58 else if (event.keyCode == 13 && !event.shiftKey && !event.ctrlKey) |
| 59 { | 59 { |
| 60 event.preventDefault(); | 60 event.preventDefault(); |
| 61 addFilters(); | 61 addFilters(); |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 function addFilters() | 65 function addFilters() |
| 66 { | 66 { |
| 67 // Tell the background page to add the filters | 67 ext.backgroundPage.sendMessage( |
| 68 var filters = document.getElementById("filters").value.split(/[\r\n]+/) | 68 { |
| 69 .map(function(f) {return f.replace(/^\s+/, "").replace(/
\s+$/, "");}) | 69 type: "add-filters", |
| 70 .filter(function(f) {return f != "";}); | 70 text: document.getElementById("filters").value |
| 71 ext.backgroundPage.sendMessage({type: "add-filters", filters: filters}); | 71 }, |
| 72 closeDialog(true); | 72 |
| 73 function(response) |
| 74 { |
| 75 if (response.status == "ok") |
| 76 closeDialog(true); |
| 77 else |
| 78 alert(response.error); |
| 79 } |
| 80 ); |
| 73 } | 81 } |
| 74 | 82 |
| 75 function closeDialog(success) | 83 function closeDialog(success) |
| 76 { | 84 { |
| 77 ext.backgroundPage.sendMessage( | 85 ext.backgroundPage.sendMessage( |
| 78 { | 86 { |
| 79 type: "forward", | 87 type: "forward", |
| 80 payload: | 88 payload: |
| 81 { | 89 { |
| 82 type: "clickhide-close", | 90 type: "clickhide-close", |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 ); | 124 ); |
| 117 dragCoords = [event.screenX, event.screenY]; | 125 dragCoords = [event.screenX, event.screenY]; |
| 118 } | 126 } |
| 119 } | 127 } |
| 120 | 128 |
| 121 function onDragEnd(event) | 129 function onDragEnd(event) |
| 122 { | 130 { |
| 123 onDrag(event); | 131 onDrag(event); |
| 124 dragCoords = null; | 132 dragCoords = null; |
| 125 } | 133 } |
| OLD | NEW |