Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/prefs.js

Issue 6648246944399360: Noissue - Document the prefs module (Closed)
Patch Set: Created April 15, 2015, 4 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 /** @module prefs */
19
18 const keyPrefix = "pref:"; 20 const keyPrefix = "pref:";
19 21
22 /** @lends module:prefs.Prefs */
20 let defaults = Object.create(null); 23 let defaults = Object.create(null);
21 let overrides = Object.create(null); 24 let overrides = Object.create(null);
22 25
26 /**
27 * Only for compatibility with core code. Please do not change!
28 *
29 * @type {boolean}
30 */
23 defaults.enabled = true; 31 defaults.enabled = true;
32 /**
33 * The application version as set during intilization. Used to detect updates.
kzar 2015/04/16 12:11:14 Nit: initialization
kzar 2015/04/16 13:32:34 What about these comments?
Sebastian Noack 2015/04/16 13:47:06 I didn't addressed them yet, or do you read "Done"
kzar 2015/04/16 13:48:55 You quite commonly say "What about this comment" o
Sebastian Noack 2015/04/16 13:51:43 Done.
Sebastian Noack 2015/04/16 13:51:43 Only if you uploaded a new patch set, and I have r
kzar 2015/04/16 13:54:50 You had uploaded a new patch set though...
Sebastian Noack 2015/04/16 13:57:02 ... before you published your comments. ;)
34 *
35 * @type {string}
36 */
24 defaults.currentVersion = ""; 37 defaults.currentVersion = "";
38 /**
39 * Only for compatibility with core code. Please do not change!
kzar 2015/04/16 12:11:14 It would be nice to add a little detail for all th
Sebastian Noack 2015/04/16 12:52:00 Those are already documented under https://adblock
kzar 2015/04/16 13:32:34 Fair enough but in that case how about adding a "@
Sebastian Noack 2015/04/16 13:47:06 I do for preferences that have an effect here. But
40 *
41 * @type {string}
42 */
25 defaults.data_directory = ""; 43 defaults.data_directory = "";
44 /**
45 * @see https://adblockplus.org/en/preferences#patternsbackups
46 * @type {number}
47 */
26 defaults.patternsbackups = 5; 48 defaults.patternsbackups = 5;
49 /**
50 * @see https://adblockplus.org/en/preferences#patternsbackupinterval
51 * @type {number}
52 */
27 defaults.patternsbackupinterval = 24; 53 defaults.patternsbackupinterval = 24;
54 /**
55 * Only for compatibility with core code. Please do not change!
56 *
57 * @type {boolean}
58 */
28 defaults.savestats = false; 59 defaults.savestats = false;
60 /**
61 * Only for compatibility with core code. Please do not change!
62 *
63 * @type {boolean}
64 */
29 defaults.privateBrowsing = false; 65 defaults.privateBrowsing = false;
66 /**
67 * @see https://adblockplus.org/en/preferences#subscriptions_fallbackerrors
68 * @type {number}
69 */
30 defaults.subscriptions_fallbackerrors = 5; 70 defaults.subscriptions_fallbackerrors = 5;
71 /**
72 * @see https://adblockplus.org/en/preferences#subscriptions_fallbackurl
73 * @type {string}
74 */
31 defaults.subscriptions_fallbackurl = "https://adblockplus.org/getSubscription?ve rsion=%VERSION%&url=%SUBSCRIPTION%&downloadURL=%URL%&error=%ERROR%&channelStatus =%CHANNELSTATUS%&responseStatus=%RESPONSESTATUS%"; 75 defaults.subscriptions_fallbackurl = "https://adblockplus.org/getSubscription?ve rsion=%VERSION%&url=%SUBSCRIPTION%&downloadURL=%URL%&error=%ERROR%&channelStatus =%CHANNELSTATUS%&responseStatus=%RESPONSESTATUS%";
76 /**
77 * @see https://adblockplus.org/en/preferences#subscriptions_autoupdate
78 * @type {boolean}
79 */
32 defaults.subscriptions_autoupdate = true; 80 defaults.subscriptions_autoupdate = true;
81 /**
82 * @see https://adblockplus.org/en/preferences#subscriptions_exceptionsurl
83 * @type {string}
84 */
33 defaults.subscriptions_exceptionsurl = "https://easylist-downloads.adblockplus.o rg/exceptionrules.txt"; 85 defaults.subscriptions_exceptionsurl = "https://easylist-downloads.adblockplus.o rg/exceptionrules.txt";
86 /**
87 * @see https://adblockplus.org/en/preferences#subscriptions_antiadblockurl
88 * @type {string}
89 */
34 defaults.subscriptions_antiadblockurl = "https://easylist-downloads.adblockplus. org/antiadblockfilters.txt"; 90 defaults.subscriptions_antiadblockurl = "https://easylist-downloads.adblockplus. org/antiadblockfilters.txt";
91 /**
92 * @see https://adblockplus.org/en/preferences#documentation_link
93 * @type {string}
94 */
35 defaults.documentation_link = "https://adblockplus.org/redirect?link=%LINK%&lang =%LANG%"; 95 defaults.documentation_link = "https://adblockplus.org/redirect?link=%LINK%&lang =%LANG%";
96 /**
97 * @see https://adblockplus.org/en/preferences#notificationdata
98 * @type {object}
99 */
36 defaults.notificationdata = {}; 100 defaults.notificationdata = {};
101 /**
102 * @see https://adblockplus.org/en/preferences#notificationurl
103 * @type {string}
104 */
37 defaults.notificationurl = "https://notification.adblockplus.org/notification.js on"; 105 defaults.notificationurl = "https://notification.adblockplus.org/notification.js on";
106 /**
107 * The total number of ads blocked on all pages.
108 *
109 * @type {object}
110 * @property {number} [blocked]
111 */
38 defaults.stats_total = {}; 112 defaults.stats_total = {};
113 /**
114 * Whether to show a badge in the toolbar icon indicating the number of blocked ads.
115 *
116 * @type {boolean}
117 */
39 defaults.show_statsinicon = true; 118 defaults.show_statsinicon = true;
119 /**
120 * Whether to show the number of blocked ads in the popup.
121 *
122 * @type {boolean}
123 */
40 defaults.show_statsinpopup = true; 124 defaults.show_statsinpopup = true;
125 /**
126 * Whether to show the "Block element" context menu entry.
127 *
128 * @type {boolean}
129 */
41 defaults.shouldShowBlockElementMenu = true; 130 defaults.shouldShowBlockElementMenu = true;
131 /**
132 * Whether to collapse placeholders for blocked elements.
133 *
134 * @type {boolean}
135 */
42 defaults.hidePlaceholders = true; 136 defaults.hidePlaceholders = true;
137 /**
138 * Whether to show the first run page. This preference isn't
139 * set by the extension but can be pre-configured externally.
140 *
141 * @type {boolean}
142 */
43 defaults.suppress_first_run_page = false; 143 defaults.suppress_first_run_page = false;
44 144
145 /**
146 * @namespace
147 * @static
148 */
45 let Prefs = exports.Prefs = { 149 let Prefs = exports.Prefs = {
150 /**
151 * Fired when the value of a preference changes.
152 *
153 * @event
154 * @property {string} pref The name of the preference that changed.
155 */
46 onChanged: new ext._EventTarget(), 156 onChanged: new ext._EventTarget(),
157
158 /**
159 * Fired when all preferences have been loaded. You must wait for
160 * this event before using preferences during extension intilization.
kzar 2015/04/16 12:11:14 Nit: initialization
Sebastian Noack 2015/04/16 13:51:43 Done.
161 *
162 * @event
163 */
47 onLoaded: new ext._EventTarget() 164 onLoaded: new ext._EventTarget()
48 }; 165 };
49 166
50 function keyToPref(key) 167 function keyToPref(key)
51 { 168 {
52 if (key.indexOf(keyPrefix) != 0) 169 if (key.indexOf(keyPrefix) != 0)
53 return null; 170 return null;
54 171
55 return key.substr(keyPrefix.length); 172 return key.substr(keyPrefix.length);
56 } 173 }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 }); 290 });
174 } 291 }
175 else 292 else
176 { 293 {
177 managedLoaded = true; 294 managedLoaded = true;
178 checkLoaded(); 295 checkLoaded();
179 } 296 }
180 } 297 }
181 298
182 init(); 299 init();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld