This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
/
prefoptions.html
494 lines (471 loc) · 18.5 KB
/
prefoptions.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
## The contents of this file are subject to the Common Public Attribution
## License Version 1.0. (the "License"); you may not use this file except in
## compliance with the License. You may obtain a copy of the License at
## http://code.reddit.com/LICENSE. The License is based on the Mozilla Public
## License Version 1.1, but Sections 14 and 15 have been added to cover use of
## software over a computer network and provide for limited attribution for the
## Original Developer. In addition, Exhibit A has been modified to be
## consistent with Exhibit B.
##
## Software distributed under the License is distributed on an "AS IS" basis,
## WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
## the specific language governing rights and limitations under the License.
##
## The Original Code is reddit.
##
## The Original Developer is the Initial Developer. The Initial Developer of
## the Original Code is reddit Inc.
##
## All portions of the code written by reddit are Copyright (c) 2006-2015
## reddit Inc. All Rights Reserved.
###############################################################################
<%!
from r2.config import feature
from r2.lib.errors import error_list
from r2.lib.menus import CommentSortMenu
from r2.lib.template_helpers import add_sr, _wsf, format_html, make_url_protocol_relative
from r2.lib.utils import UrlParser
import random
%>
<%namespace file="utils.html" import="md, error_field, language_tool, plain_link"/>
<%def name="checkbox(text, name, disabled = False, disabled_text = '', prefix = 'pref_')">
<input name="${name}" id="${name}" type="checkbox"
%if getattr(c.user, prefix + name):
checked="checked"
%endif
%if disabled:
disabled="disabled"
%endif
/>
<label class="${'disabled' if disabled else ''}" for="${name}">
${text}
</label>
%if disabled and disabled_text:
 <span class="details">${disabled_text}</span>
%endif
</%def>
<%def name="link_options()">
<select name="numsites">
%for x in [10, 25, 50, 100]:
<option ${x == c.user.pref_numsites and "selected='selected'" or ""}>
${x}
</option>
%endfor
</select>
</%def>
<%def name="comment_sort_options()">
<% menu = CommentSortMenu() %>
<select name="default_comment_sort">
%for sort in menu.visible_options():
<option ${'selected="selected"' if sort == c.user.pref_default_comment_sort else ""}
value="${sort}">
${menu.make_title(sort)} ${_('(recommended)') if sort == menu._default else ''}
</option>
%endfor
</select>
</%def>
<%def name="media_radio(val, label)">
<input id="media_${val}" class="nomargin"
type="radio" value="${val}" name="media"
${"checked='checked'" if c.user.pref_media == val else ''} />
<label for="media_${val}">${label}</label>
<br/>
</%def>
<%def name="media_preview_radio(val, label)">
<input id="media_preview_${val}" class="nomargin"
type="radio" value="${val}" name="media_preview"
${"checked='checked'" if c.user.pref_media_preview == val else ''}>
<label for="media_preview_${val}">${label}</label>
<br/>
</%def>
<%def name="num_input(s, name)">
<input type="text" class="number" size="4" maxlength="4"
name="${name}" value="${s if s is not None else ''}">
</%def>
<%def name="text_input(s, name)">
<input type="text" class="text" size="20" maxlength="20"
name="${name}" value="${s if s is not None else ''}">
</%def>
%if c.user_is_loggedin:
%if thing.done:
<p class="green">${_("your preferences have been updated")}</p>
%elif thing.error_style_override:
<p class="error">${_("we couldn't save the custom stylesheet preference. please see the error below")}</p>
%elif thing.generic_error:
<p class="error">${_("your preferences couldn't be saved")}</p>
%endif
%endif
<%
if c.user_is_loggedin:
action = "/post/options"
else:
action = "/post/unlogged_options"
action = add_sr(action, sr_path=False)
%>
<form action="${action}" method="post" class="pretty-form short-text">
<input type="hidden" name="uh" value="${c.modhash}" />
<table class="content preftable">
<tr>
<th>${_("interface language")}</th>
<td class="prefright">
${language_tool(allow_blank = False, show_regions = True,
default_lang = c.user.pref_lang)}
 <span class="details hover">(*) ${_("incomplete")}
 <a href="https://www.reddit.com/r/i18n/wiki/getting_started">${_("volunteer to translate")}</a></span>
</td>
</tr>
%if c.user_is_loggedin:
%if not c.user.has_subscribed and (c.user.pref_use_global_defaults or c.user.pref_hide_locationbar):
<tr>
<th>${_("location options")}</th>
<td class="prefright">
${checkbox(_("use the global default subreddits for my front page"), "use_global_defaults")}
<br/>
${checkbox(_("hide the location information bar"), "hide_locationbar")}
</td>
</tr>
%endif
<tr>
<th>${_("clicking options")}</th>
<td class="prefright">
${checkbox(_("open links in a new window"), "newwindow")}
</td>
</tr>
%if thing.feature_autoexpand_media_previews:
<tr class="preferences-media">
%else:
<tr>
%endif
<th>${_("media")}</th>
<td class="prefright">
%if thing.feature_autoexpand_media_previews:
<h6>${_("thumbnails")}</h6>
%endif
%if not c.user.pref_compress:
${media_radio("on", _("show thumbnails next to links"))}
${media_radio("off", _("don't show thumbnails next to links"))}
${media_radio("subreddit", _("show thumbnails based on that subreddit's media preferences"))}
%else:
<p class="error">${_("to enable thumbnails, disable compressed link display")}</p>
<input type="hidden" name="media" value="${c.user.pref_media}"/>
%endif
%if thing.feature_autoexpand_media_previews:
<br>
<h6>${_("media previews")}</h6>
${media_preview_radio("on", _("auto-expand media previews"))}
${media_preview_radio("off", _("don't auto-expand media previews on comments pages"))}
${media_preview_radio("subreddit", _("expand media previews based on that subreddit's media preferences"))}
<br>
<h6>${_("NSFW content")}</h6>
${checkbox(_("hide images for NSFW/18+ content "), "no_profanity", disabled = not c.user.pref_over_18, disabled_text = "(requires over 18)")}
 
<span class="details">
${_("(Don't show thumbnails or media previews for anything labeled NSFW)")}
</span>
%else:
${checkbox(_("make safe(r) for work "), "no_profanity", disabled = not c.user.pref_over_18, disabled_text = "(requires over 18)")}
<span class="details">
${_("(Don't show thumbnails next to anything labeled NSFW)")}
</span>
%endif
</td>
</tr>
<tr>
<th>${_("link options")}</th>
<td class="prefright">
<p>
${checkbox(_("show the spotlight box on the front page"), "organic")}
 
<span class="details">
${_("(it shows new and promoted links, and gives you a say in what's spam and what isn't.)")}
</span>
</p>
<p>
${checkbox(_("show trending subreddits on the front page"), "show_trending")}
 
<span class="details">
${_("(a list of popular and notable subreddits to check out)")}
</span>
</p>
<p>${checkbox(_("show me links I've recently viewed"), "clickgadget")}</p>
<p>${checkbox(_("compress the link display"), "compress")}</p>
<p>${checkbox(_("show additional details in the domain text when available"), "domain_details")}
 
<span class="details">
${_("(such as the source subreddit or the content author's url/name)")}
</span>
</p>
<p>${checkbox(_("don't show me submissions after I've upvoted them"), "hide_ups")}
 
<span class="details">${_("(except my own)")}</span>
</p>
<p>${checkbox(_("don't show me submissions after I've downvoted them"), "hide_downs")}
 
<span class="details">${_("(except my own)")}</span>
</p>
<p>
${_wsf("display %(num)s links at once", num=unsafe(capture(link_options)))}
</p>
<%
input = unsafe(capture(num_input, c.user.pref_min_link_score,
'min_link_score'))
%>
<p>
${_wsf("don't show me submissions with a score less than %(num)s", num=input)}
 <span class="details">${_("(leave blank to show all submissions)")}</span>
</p>
</td>
</tr>
<tr>
<th>${_("comment options")}</th>
<td class="prefright">
<p>
${_wsf("sort comments by %(sort)s", sort=unsafe(capture(comment_sort_options)))}
</p>
<p>
${checkbox(_(u"ignore suggested sorts"), "ignore_suggested_sort")}
 <span class="details">${_("(suggested sorts may be set by community moderators for specific threads or subreddits, like Q&As)")}</span>
</p>
<p>
${checkbox(_(u"show a dagger (†) on comments voted controversial"), "highlight_controversial")}
 <span class="details">${_("(a controversial comment is one that's been both upvoted and downvoted significantly)")}</span>
</p>
<%
input = unsafe(capture(num_input, c.user.pref_min_comment_score,
'min_comment_score'))
%>
<p>
${_wsf("don't show me comments with a score less than %(num)s", num=input)}
 <span class="details">${_("(leave blank to show all comments)")}</span>
</p>
<p>
<%
input = unsafe(capture(num_input, c.user.pref_num_comments,
'num_comments'))
%>
<% s = c.user.pref_num_comments %>
${_wsf("display %(num)s comments by default", num=input)}
 
<span class="details">
(1 - ${g.max_comments});
 
${_("the smaller the number, the faster your comments pages will load")}
</span>
</td>
</tr>
<tr>
<th>${_("messaging options")}</th>
<td class="prefright">
${checkbox(_("show message conversations in the inbox"), \
"threaded_messages")}
 <span class="details">
${_("(only applies when you go to the 'messages' panel)")}
</span>
<br/>
%if c.user.pref_threaded_messages:
${checkbox(_("collapse messages after I've read them"), \
"collapse_read_messages")}
 <span class="details">
${_("(otherwise, you'll have to collapse them yourself)")}
</span>
<br/>
%endif
${checkbox(_("mark messages as read when I open my inbox"), \
"mark_messages_read")}
 <span class="details">
${_("(otherwise, they will be marked as read when you click them)")}
</span>
<br>
${checkbox(_("notify me when people say my username"), "monitor_mentions")}
%if feature.is_enabled('orangereds_as_emails'):
<br>
${checkbox(_("send messages as emails"), "email_messages", disabled=(not c.user.email_verified), disabled_text=_("requires a verified email"))}
%endif
<br>
${checkbox(_("enable threaded modmail display"), "threaded_modmail")}
</td>
</tr>
<tr>
<th>${_("display options")}</th>
<td class="prefright">
${checkbox(_("allow subreddits to show me custom themes"), "show_stylesheets")}
%if feature.is_enabled('stylesheets_everywhere'):
 <span class="details reddit-gold">
${_("(you can also choose which subreddit themes to disable on an individual level)")}
</span>
%endif
<br/>
${checkbox(_("show user flair"), "show_flair")}
<br/>
${checkbox(_("show link flair"), "show_link_flair")}
%if c.user.pref_show_promote is not None:
<br/>
${checkbox(_("show self-serve advertising tab on front page"),
"show_promote")}
%endif
%if feature.is_enabled('legacy_search_pref'):
<br>
${checkbox(_("show legacy search page"), "legacy_search")}
%endif
</td>
</tr>
<tr>
<th>${_("content options")}</th>
<td class="prefright">
${checkbox(_("I am over eighteen years old and willing to view adult content"), "over_18")}
 <span class="details">(${_("required to view some subreddits")})</span>
<br/>
${checkbox(_("label posts that are not safe for work (NSFW)"), "label_nsfw", disabled = c.user.pref_no_profanity, disabled_text = "(requires not 'safer for work' mode)")}
<br/>
${checkbox(_("enable private RSS feeds"), "private_feeds")}
 <span class="details">
${_("(available from the 'RSS feed' tab in prefs)")}</span>
</td>
<tr>
<th>${_("privacy options")}</th>
<td class="prefright">
${checkbox(_("make my votes public"), "public_votes")}
 
<span class="details">
<%
link1 = format_html(' <a href="/user/%s/upvoted">/user/%s/upvoted</a> ', c.user.name, c.user.name)
link2 = format_html(' <a href="/user/%s/downvoted">/user/%s/downvoted</a>', c.user.name, c.user.name)
%>
(${_wsf("let everyone see %(link1)s and %(link2)s", link1=link1, link2=link2)})
</span>
<br/>
${checkbox(_("allow my data to be used for research purposes"), "research")}
 
<span class="details">
(
<a href="https://www.reddit.com/r/redditdev/comments/dtg4j/want_to_help_reddit_build_a_recommender_a_public/">
${_("details")}
</a>
)
</span>
<br />
${checkbox(_("don't allow search engines to index my user profile"), "hide_from_robots")}
 
<span class="details">
(
<a href="https://www.reddit.com/wiki/noindex">${_("details")}</a>
)
</span>
</td>
</tr>
% if feature.is_enabled('beta_opt_in'):
<tr>
<th>${_("beta options")}</th>
<td class="prefright">
${checkbox(_("I would like to beta test features for reddit"), "beta")}
 
<span class="details">
<%
beta_sr_link = format_html(' <a href="/r/%s">/r/%s</a> ', g.beta_sr, g.beta_sr)
%>
(${_wsf("by enabling you'll be subscribed to %(beta_sr_link)s automatically.", beta_sr_link=beta_sr_link)}
 
<a href="/r/${g.beta_sr}/wiki">${_("details on the /r/{beta_sr} wiki").format(beta_sr=g.beta_sr)}</a>)
</span>
</td>
</tr>
%endif
%endif
%if c.user.gold:
<tr class="gold-accent">
<th>${_("gold options")}</th>
<td class="prefright">
${checkbox(_("hide ads"), "hide_ads")}
<br>
${checkbox(_("remember what links I've visited"), "store_visits")}
 <span class="details">(${_("we'll remember and mark what links you've already read, even between computers")})</span>
<br>
${checkbox(_("highlight new comments"), "highlight_new_comments")}
 <span class="details">
(${_("we'll remember your visits for 48 hours and show you which comments you haven't seen yet")})
</span>
<br>
${checkbox(_("show gold expiration"), "show_gold_expiration")}
 <span class="details">
(${_("show how much gold you have remaining on your userpage")})
</span>
<br>
<% creddit_link = unsafe(' <a href="/creddits">creddit</a> ') %>
${checkbox(_wsf("use a %(creddit_link)s to automatically renew my gold if it expires", creddit_link=creddit_link), "creddit_autorenew")}
</td>
</tr>
%elif c.user.is_moderator_somewhere:
<tr class="gold-accent">
<th>${_("gold options")}</th>
<td class="prefright">
${checkbox(_("highlight new comments"), "highlight_new_comments")}
<% gold_link = unsafe(' <a href="/gold/about">' + _("reddit gold") + '</a>') %>
 <span class="details">
(${_wsf("since you don't have %(gold_link)s, this will only apply in subreddits you moderate", gold_link=gold_link)})
</span>
</td>
</tr>
%endif
%if feature.is_enabled('stylesheets_everywhere'):
<tr class="gold-accent">
<th>${_("reddit themes")}</th>
<td class="prefright">
<div class="reddit-themes-description">
<span>
${_("reddit themes change the appearance of reddit. They are used anywhere another custom theme is not present.")}
</span>
<br />
<span class="details">
(${_("Note: For security reasons this page will not be changed by themes")})
</span>
</div>
${checkbox(_("use reddit theme"), "enable_default_themes")}
 <span class="details">(${_("hover to preview")})</span>
<div class="container reddit-themes">
% if thing.themes:
% for theme in thing.themes:
${theme_item(
thumbnail_url=theme.thumbnail_url,
preview_url=theme.preview_url,
id=theme.id,
tagline=theme.tagline,
checked=theme.checked,
)}
% endfor
% endif
<div class="theme select-custom-theme">
<label><input type="radio" name="theme_selector" id="other_theme_selector" value="" ${"checked" if thing.use_other_theme else ""}>use theme from /r/</label>
<input type="text" class="text" size="21" maxlength="21" name="other_theme" placeholder="subreddit" ${"value=" + c.user.pref_default_theme_sr if thing.use_other_theme and c.user.pref_default_theme_sr else ""}>
<span class="details">
(${_("warning: use non-featured themes at your own risk")})
</span>
</div>
</div>
</div>
%if thing.error_style_override:
<p class="error">${_(error_list[thing.error_style_override])}</p>
%endif
</td>
</tr>
%endif
<tr>
<td>
<input type="submit" class="btn" value="${_('save options')}"/>
</td>
</tr>
</table>
</form>
<%def name="theme_item(thumbnail_url, preview_url, id, tagline, checked)">
<div class="theme ${'selected' if checked else ''}" id="${id}">
<div class="theme-container">
<div class="theme-thumbnail">
<img src="${make_url_protocol_relative(thumbnail_url)}"/>
<div class="theme-preview">
<img src="${make_url_protocol_relative(preview_url)}"/>
</div>
</div>
<label><input type="radio" name="theme_selector" value="${id}" ${"checked" if checked else ""}>
${md(tagline)}</label>
</div>
</div>
</%def>