| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 throw new Error("Attempt to change preference type"); | 61 throw new Error("Attempt to change preference type"); |
| 62 | 62 |
| 63 if (value == defaults[key]) | 63 if (value == defaults[key]) |
| 64 delete values[key]; | 64 delete values[key]; |
| 65 else | 65 else |
| 66 values[key] = value; | 66 values[key] = value; |
| 67 save(); | 67 save(); |
| 68 | 68 |
| 69 for (let listener of listeners) | 69 for (let listener of listeners) |
| 70 listener(key); | 70 listener(key); |
| 71 } | 71 }, |
|
Wladimir Palant
2015/04/30 08:30:24
enumerable: true please, otherwise debugging will
Felix Dahlke
2015/04/30 13:17:38
Done.
| |
| 72 enumerable: true | |
| 72 }); | 73 }); |
| 73 } | 74 } |
| 74 | 75 |
| 75 function load() | 76 function load() |
| 76 { | 77 { |
| 77 _fileSystem.read(path, function(result) | 78 _fileSystem.read(path, function(result) |
| 78 { | 79 { |
| 79 // prefs.json is expected to be missing, ignore errors reading file | 80 // prefs.json is expected to be missing, ignore errors reading file |
| 80 if (!result.error) | 81 if (!result.error) |
| 81 { | 82 { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 let index = listeners.indexOf(listener); | 128 let index = listeners.indexOf(listener); |
| 128 if (index >= 0) | 129 if (index >= 0) |
| 129 listeners.splice(index, 1); | 130 listeners.splice(index, 1); |
| 130 }, | 131 }, |
| 131 }; | 132 }; |
| 132 | 133 |
| 133 for (let key in defaults) | 134 for (let key in defaults) |
| 134 defineProperty(key); | 135 defineProperty(key); |
| 135 | 136 |
| 136 load(); | 137 load(); |
| LEFT | RIGHT |