Make links in comments and submitter/subreddit button links open in new tab based on preference

This commit is contained in:
Sanil Mohandas
2012-02-05 03:01:49 +02:00
committed by bsimpson63
parent 714f4481b7
commit 1088fe73db
4 changed files with 6 additions and 4 deletions

View File

@@ -158,7 +158,8 @@ ${parent.thing_css_class(what)} ${"over18" if thing.over_18 else ""}
<%def name="subreddit()" buffered="True">
${plain_link(thing.subreddit.name, thing.subreddit_path, sr_path = False,
cname = False, _class = "subreddit hover")}
cname = False, _class = "subreddit hover",
target='_blank' if thing.newwindow else '')}
<script type="text/javascript">
reddit.sr['${thing._fullname}'] = '${thing.subreddit._fullname}';
</script>

View File

@@ -40,7 +40,8 @@
<td class="button">${thing.button}</td>
<td class="description">${thing.text}&#32;
%if hasattr(thing, 'target_text'):
${plain_link(thing.target_text, thing.target_path, title=thing.target_title, sr_path=False, cname=False, _class="subreddit hover")}&#32;
${plain_link(thing.target_text, thing.target_path, title=thing.target_title, sr_path=False, cname=False, _class="subreddit hover",
target='_blank' if c.user.pref_newwindow else '')}&#32;
%elif hasattr(thing, 'target_wrapped_user'):
${thing.target_wrapped_user}&#32;
%endif

View File

@@ -50,7 +50,7 @@
<div class="usertext-body">
% if not thing.expunged:
${unsafe(safemarkdown(thing.text, nofollow = thing.nofollow,
target = thing.target))}
target = '_blank' if c.user.pref_newwindow else thing.target))}
% else:
<em>${_("[removed]")}</em>&#32;
% endif

View File

@@ -49,7 +49,7 @@
%>
${plain_link(thing.name + thing.karma, "/user/%s" % thing.name,
_class = ' '.join(classes),
_sr_path = False, target=target, title=thing.author_title)}
_sr_path = False, target='_blank' if c.user.pref_newwindow else target, title=thing.author_title)}
%if thing.flair_position == 'right':
${flair(thing, enabled=thing.force_show_flair)}
%endif