aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorr <r@freesoftwareextremist.com>2020-02-23 13:26:39 +0000
committerr <r@freesoftwareextremist.com>2020-02-23 18:01:50 +0000
commite9f5e0cab55a8a92575139788ffb003ed5d4f576 (patch)
treef6b858d4dc5a7eb623bd139713eacd2faea17ef1
parentdd23ac48678c704949074dd0e41bb8a3550cc33f (diff)
downloadbloat-e9f5e0cab55a8a92575139788ffb003ed5d4f576.tar.gz
bloat-e9f5e0cab55a8a92575139788ffb003ed5d4f576.zip
Use <base> element to set target
-rw-r--r--renderer/model.go1
-rw-r--r--service/service.go2
-rw-r--r--templates/header.tmpl3
-rw-r--r--templates/nav.tmpl16
-rw-r--r--templates/notification.tmpl12
-rw-r--r--templates/postform.tmpl2
-rw-r--r--templates/status.tmpl38
7 files changed, 40 insertions, 34 deletions
diff --git a/renderer/model.go b/renderer/model.go
index 45d3117..0d89af7 100644
--- a/renderer/model.go
+++ b/renderer/model.go
@@ -25,6 +25,7 @@ type CommonData struct {
CustomCSS string
CSRFToken string
AutoRefresh bool
+ Target string
}
type ErrorData struct {
diff --git a/service/service.go b/service/service.go
index 9e01509..4316f86 100644
--- a/service/service.go
+++ b/service/service.go
@@ -189,6 +189,7 @@ func (svc *service) ServeNavPage(ctx context.Context, c *model.Client) (err erro
}
commonData := svc.getCommonData(ctx, c, "Nav")
+ commonData.Target = "main"
data := &renderer.NavData{
User: u,
CommonData: commonData,
@@ -422,6 +423,7 @@ func (svc *service) ServeNotificationPage(ctx context.Context, c *model.Client,
commonData := svc.getCommonData(ctx, c, "notifications")
commonData.AutoRefresh = c.Session.Settings.AutoRefreshNotifications
+ commonData.Target = "main"
data := &renderer.NotificationData{
Notifications: notifications,
UnreadCount: unreadCount,
diff --git a/templates/header.tmpl b/templates/header.tmpl
index 76831f2..ca2986d 100644
--- a/templates/header.tmpl
+++ b/templates/header.tmpl
@@ -4,6 +4,9 @@
<head>
<meta charset='utf-8'>
<meta content='width=device-width, initial-scale=1' name='viewport'>
+ {{if .Target}}
+ <base href="" target="{{.Target}}">
+ {{end}}
{{if .CSRFToken}}
<meta name="csrf_token" content="{{.CSRFToken}}">
{{end}}
diff --git a/templates/nav.tmpl b/templates/nav.tmpl
index 620643e..8922ba7 100644
--- a/templates/nav.tmpl
+++ b/templates/nav.tmpl
@@ -2,24 +2,24 @@
{{template "header.tmpl" (WithContext .CommonData $.Ctx)}}
<div class="user-info">
<div class="user-info-img-container">
- <a class="img-link" href="/timeline/home" title="home" target="main">
+ <a class="img-link" href="/timeline/home" title="home">
<img class="user-info-img" src="{{.User.AvatarStatic}}" alt="profile-avatar" />
</a>
</div>
<div class="user-info-details-container">
<div>
<span class="status-dname"> {{EmojiFilter .User.DisplayName .User.Emojis}} </span>
- <a class="nav-link" href="/user/{{.User.ID}}" target="main">
+ <a class="nav-link" href="/user/{{.User.ID}}">
<span class="status-uname"> {{.User.Acct}} </span>
</a>
</div>
<div>
- <a class="nav-link" href="/timeline/home" target="main">home</a>
- <a class="nav-link" href="/timeline/direct" target="main">direct</a>
- <a class="nav-link" href="/timeline/local" target="main">local</a>
- <a class="nav-link" href="/timeline/twkn" target="main">twkn</a>
- <a class="nav-link" href="/search" target="main">search</a>
- <a class="nav-link" href="/about" target="main">about</a>
+ <a class="nav-link" href="/timeline/home">home</a>
+ <a class="nav-link" href="/timeline/direct">direct</a>
+ <a class="nav-link" href="/timeline/local">local</a>
+ <a class="nav-link" href="/timeline/twkn">twkn</a>
+ <a class="nav-link" href="/search">search</a>
+ <a class="nav-link" href="/about">about</a>
</div>
<div>
<a class="nav-link" href="/settings" target="_top">settings</a>
diff --git a/templates/notification.tmpl b/templates/notification.tmpl
index 9e1854c..02b3847 100644
--- a/templates/notification.tmpl
+++ b/templates/notification.tmpl
@@ -5,9 +5,9 @@
Notifications
{{if gt .UnreadCount 0}}({{.UnreadCount }}){{end}}
</div>
- <a class="notification-refresh" href="/notifications">refresh</a>
+ <a class="notification-refresh" href="/notifications" target="_self">refresh</a>
{{if .ReadID}}
- <form action="/notifications/read?max_id={{.ReadID}}" method="post">
+ <form action="/notifications/read?max_id={{.ReadID}}" method="post" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="submit" value="read" class="btn-link">
</form>
@@ -19,7 +19,7 @@
{{if eq .Type "follow"}}
<div class="notification-follow-container">
<div class="status-profile-img-container">
- <a class="img-link" href="/user/{{.Account.ID}}" target="main" >
+ <a class="img-link" href="/user/{{.Account.ID}}">
<img class="status-profile-img" src="{{.Account.AvatarStatic}}" alt="profile-avatar" />
</a>
</div>
@@ -42,7 +42,7 @@
{{else if eq .Type "reblog"}}
<div class="retweet-info">
- <a class="img-link" href="/user/{{.Account.ID}}" target="main">
+ <a class="img-link" href="/user/{{.Account.ID}}">
<img class="status-profile-img" src="{{.Account.AvatarStatic}}" alt="avatar" />
</a>
<span class="status-dname"> {{EmojiFilter .Account.DisplayName .Account.Emojis}} </span>
@@ -55,7 +55,7 @@
{{else if eq .Type "favourite"}}
<div class="retweet-info">
- <a class="img-link" href="/user/{{.Account.ID}}" target="main">
+ <a class="img-link" href="/user/{{.Account.ID}}">
<img class="status-profile-img" src="{{.Account.AvatarStatic}}" alt="avatar" />
</a>
<span class="status-dname"> {{EmojiFilter .Account.DisplayName .Account.Emojis}} </span>
@@ -71,7 +71,7 @@
<div class="pagination">
{{if .NextLink}}
- <a href="{{.NextLink}}">next</a>
+ <a href="{{.NextLink}}" target="_self">next</a>
{{end}}
</div>
diff --git a/templates/postform.tmpl b/templates/postform.tmpl
index d5c1fb9..9c674e9 100644
--- a/templates/postform.tmpl
+++ b/templates/postform.tmpl
@@ -1,5 +1,5 @@
{{with .Data}}
-<form class="post-form" action="/post" method="POST" enctype="multipart/form-data">
+<form class="post-form" action="/post" method="POST" enctype="multipart/form-data" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
{{if .ReplyContext}}
<input type="hidden" name="reply_to_id" value="{{.ReplyContext.InReplyToID}}" />
diff --git a/templates/status.tmpl b/templates/status.tmpl
index 536f515..0371a4e 100644
--- a/templates/status.tmpl
+++ b/templates/status.tmpl
@@ -2,7 +2,7 @@
<div id="status-{{.ID}}" class="status-container-container">
{{if .Reblog}}
<div class="retweet-info">
- <a class="img-link" href="/user/{{.Account.ID}}" target="main">
+ <a class="img-link" href="/user/{{.Account.ID}}">
<img class="status-profile-img" src="{{.Account.AvatarStatic}}" alt="avatar" />
</a>
<span class="status-dname"> {{EmojiFilter .Account.DisplayName .Account.Emojis}} </span>
@@ -14,14 +14,14 @@
{{with $s := .Data}}
<div class="status-container status-{{.ID}}" data-id="{{.ID}}">
<div class="status-profile-img-container">
- <a class="img-link" href="/user/{{.Account.ID}}" target="main">
+ <a class="img-link" href="/user/{{.Account.ID}}">
<img class="status-profile-img" src="{{.Account.AvatarStatic}}" alt="avatar" />
</a>
</div>
<div class="status">
<div class="status-name">
<span class="status-dname"> {{EmojiFilter .Account.DisplayName .Account.Emojis}} </span>
- <a href="/user/{{.Account.ID}}" target="main">
+ <a href="/user/{{.Account.ID}}">
<span class="status-uname"> {{.Account.Acct}} </span>
</a>
<div class="more-container">
@@ -33,18 +33,18 @@
source
</a>
{{if .Muted}}
- <form action="/unmuteconv/{{.ID}}" method="post">
+ <form action="/unmuteconv/{{.ID}}" method="post" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="submit" value="unmute" class="btn-link more-link">
</form>
{{else}}
- <form action="/muteconv/{{.ID}}" method="post">
+ <form action="/muteconv/{{.ID}}" method="post" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="submit" value="mute" class="btn-link more-link">
</form>
{{end}}
{{if eq $.Ctx.UserID .Account.ID}}
- <form action="/delete/{{.ID}}" method="post">
+ <form action="/delete/{{.ID}}" method="post" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="submit" value="delete" class="btn-link more-link">
</form>
@@ -55,7 +55,7 @@
<div class="status-reply-container">
{{if .InReplyToID}}
<div class="status-reply-to">
- <a class="status-reply-to-link" href="{{if not .ShowReplies}}/thread/{{.InReplyToID}}{{end}}#status-{{.InReplyToID}}" target="main">
+ <a class="status-reply-to-link" href="{{if not .ShowReplies}}/thread/{{.InReplyToID}}{{end}}#status-{{.InReplyToID}}">
reply to {{.Pleroma.InReplyToAccountAcct}}
</a>
</div>
@@ -103,7 +103,7 @@
{{end}}
</div>
{{if .Poll}}
- <form class="poll-form" action="/vote/{{.Poll.ID}}" method="POST">
+ <form class="poll-form" action="/vote/{{.Poll.ID}}" method="POST" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="status_id" value="{{$s.ID}}">
{{range $i, $o := .Poll.Options}}
@@ -139,58 +139,58 @@
{{end}}
<div class="status-action-container">
<div class="status-action">
- <a href="/thread/{{.ID}}?reply=true#status-{{.ID}}" target="main">
+ <a href="/thread/{{.ID}}?reply=true#status-{{.ID}}">
reply
</a>
- <a class="status-reply-count" href="/thread/{{.ID}}#status-{{.ID}}" target="{{if $.Ctx.ThreadInNewTab}}_blank{{else}}main{{end}}">
+ <a class="status-reply-count" href="/thread/{{.ID}}#status-{{.ID}}" {{if $.Ctx.ThreadInNewTab}}target="_blank"{{end}}>
{{if .RepliesCount}} ({{DisplayInteractionCount .RepliesCount}}) {{end}}
</a>
</div>
<div class="status-action">
{{if or (eq .Visibility "private") (eq .Visibility "direct")}}
- <a class="status-retweet" href="" title="this status cannot be retweeted" target="main">
+ <a class="status-retweet" href="" title="this status cannot be retweeted">
retweet
</a>
{{else}}
{{if .Reblogged}}
- <form class="status-retweet" data-action="unretweet" action="/unretweet/{{.ID}}" method="post">
+ <form class="status-retweet" data-action="unretweet" action="/unretweet/{{.ID}}" method="post" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="retweeted_by_id" value="{{.RetweetedByID}}">
<input type="submit" value="unretweet" class="btn-link">
</form>
{{else}}
- <form class="status-retweet" data-action="retweet" action="/retweet/{{.ID}}" method="post">
+ <form class="status-retweet" data-action="retweet" action="/retweet/{{.ID}}" method="post" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="retweeted_by_id" value="{{.RetweetedByID}}">
<input type="submit" value="retweet" class="btn-link">
</form>
{{end}}
{{end}}
- <a class="status-retweet-count" href="/retweetedby/{{.ID}}" title="click to see the the list" target="main">
+ <a class="status-retweet-count" href="/retweetedby/{{.ID}}" title="click to see the the list">
{{if .ReblogsCount}} ({{DisplayInteractionCount .ReblogsCount}}) {{end}}
</a>
</div>
<div class="status-action">
{{if .Favourited}}
- <form class="status-like" data-action="unlike" action="/unlike/{{.ID}}" method="post">
+ <form class="status-like" data-action="unlike" action="/unlike/{{.ID}}" method="post" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="retweeted_by_id" value="{{.RetweetedByID}}">
<input type="submit" value="unlike" class="btn-link">
</form>
{{else}}
- <form class="status-like" data-action="like" action="/like/{{.ID}}" method="post">
+ <form class="status-like" data-action="like" action="/like/{{.ID}}" method="post" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="retweeted_by_id" value="{{.RetweetedByID}}">
<input type="submit" value="like" class="btn-link">
</form>
{{end}}
- <a class="status-like-count" href="/likedby/{{.ID}}" title="click to see the the list" target="main">
+ <a class="status-like-count" href="/likedby/{{.ID}}" title="click to see the the list">
{{if .FavouritesCount}} ({{DisplayInteractionCount .FavouritesCount}}) {{end}}
</a>
</div>
<div class="status-action">
- <a class="status-time" href="{{if not .ShowReplies}}/thread/{{.ID}}{{end}}#status-{{.ID}}"
- target="{{if $.Ctx.ThreadInNewTab}}_blank{{else}}main{{end}}">
+ <a class="status-time" href="{{if not .ShowReplies}}/thread/{{.ID}}{{end}}#status-{{.ID}}"
+ {{if $.Ctx.ThreadInNewTab}}target="_blank"{{end}}>
<time datetime="{{FormatTimeRFC3339 .CreatedAt}}" title="{{FormatTimeRFC822 .CreatedAt}}">
{{TimeSince .CreatedAt}}
</time>