| 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 | 
| 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
| 12  * GNU General Public License for more details. | 12  * GNU General Public License for more details. | 
| 13  * | 13  * | 
| 14  * You should have received a copy of the GNU General Public License | 14  * You should have received a copy of the GNU General Public License | 
| 15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 
| 16  */ | 16  */ | 
| 17 | 17 | 
|  | 18 /* globals $ */ | 
|  | 19 | 
| 18 "use strict"; | 20 "use strict"; | 
| 19 | 21 | 
| 20 let targetPageId = null; | 22 let targetPageId = null; | 
| 21 | 23 | 
| 22 function onKeyDown(event) | 24 function onKeyDown(event) | 
| 23 { | 25 { | 
| 24   if (event.keyCode == 27) | 26   if (event.keyCode == 27) | 
| 25   { | 27   { | 
| 26     event.preventDefault(); | 28     event.preventDefault(); | 
| 27     closeDialog(); | 29     closeDialog(); | 
| 28   } | 30   } | 
| 29   else if (event.keyCode == 13 && !event.shiftKey && !event.ctrlKey) | 31   else if (event.keyCode == 13 && !event.shiftKey && !event.ctrlKey) | 
| 30   { | 32   { | 
| 31     event.preventDefault(); | 33     event.preventDefault(); | 
| 32     addFilters(); | 34     addFilters(); | 
| 33   } | 35   } | 
| 34 } | 36 } | 
| 35 | 37 | 
| 36 function addFilters() | 38 function addFilters() | 
| 37 { | 39 { | 
| 38   ext.backgroundPage.sendMessage( | 40   ext.backgroundPage.sendMessage({ | 
| 39   { |  | 
| 40     type: "filters.importRaw", | 41     type: "filters.importRaw", | 
| 41     text: document.getElementById("filters").value | 42     text: document.getElementById("filters").value | 
| 42   }, | 43   }, | 
| 43   errors => | 44   errors => | 
| 44   { | 45   { | 
| 45     if (errors.length > 0) | 46     if (errors.length > 0) | 
| 46       alert(errors.join("\n")); | 47       alert(errors.join("\n")); | 
| 47     else | 48     else | 
| 48       closeDialog(true); | 49       closeDialog(true); | 
| 49   }); | 50   }); | 
| 50 } | 51 } | 
| 51 | 52 | 
| 52 function closeDialog(success) | 53 function closeDialog(success) | 
| 53 { | 54 { | 
| 54   ext.backgroundPage.sendMessage( | 55   ext.backgroundPage.sendMessage({ | 
| 55   { |  | 
| 56     type: "forward", | 56     type: "forward", | 
| 57     targetPageId: 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 } | 
| 66 | 66 | 
| 67 function init() | 67 function init() | 
| (...skipping 21 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 | 
|---|