import javax.annotation.Nullable;
import net.pterodactylus.sone.core.Core;
+import net.pterodactylus.sone.core.ImageLoader;
import net.pterodactylus.sone.core.event.ImageInsertAbortedEvent;
import net.pterodactylus.sone.core.event.ImageInsertFailedEvent;
import net.pterodactylus.sone.core.event.ImageInsertFinishedEvent;
import net.pterodactylus.sone.template.ImageAccessor;
import net.pterodactylus.sone.template.ImageLinkFilter;
import net.pterodactylus.sone.template.JavascriptFilter;
+import net.pterodactylus.sone.template.LinkedImagesFilter;
import net.pterodactylus.sone.template.ParserFilter;
import net.pterodactylus.sone.template.PostAccessor;
import net.pterodactylus.sone.template.ProfileAccessor;
* The Sone plugin
*/
@Inject
- public WebInterface(SonePlugin sonePlugin, Loaders loaders, ListNotificationFilter listNotificationFilter, PostVisibilityFilter postVisibilityFilter, ReplyVisibilityFilter replyVisibilityFilter) {
+ public WebInterface(SonePlugin sonePlugin, Loaders loaders, ListNotificationFilter listNotificationFilter, PostVisibilityFilter postVisibilityFilter, ReplyVisibilityFilter replyVisibilityFilter, ImageLoader imageLoader) {
this.sonePlugin = sonePlugin;
this.loaders = loaders;
this.listNotificationFilter = listNotificationFilter;
templateContextFactory.addFilter("parse", parserFilter = new ParserFilter(getCore(), soneTextParser));
templateContextFactory.addFilter("shorten", shortenFilter = new ShortenFilter());
templateContextFactory.addFilter("render", renderFilter = new RenderFilter(getCore(), templateContextFactory));
+ templateContextFactory.addFilter("linked-images", new LinkedImagesFilter(imageLoader));
templateContextFactory.addFilter("reparse", new ReparseFilter());
templateContextFactory.addFilter("unknown", new UnknownDateFilter(getL10n(), "View.Sone.Text.UnknownDate"));
templateContextFactory.addFilter("format", new FormatFilter());
color: green;
}
+#sone .post .linked-images {
+ margin-top: 1ex;
+}
+
+#sone .post .linked-image {
+ display: inline-block;
+ border: solid 1px black;
+ width: 160px;
+ height: 120px;
+ background-size: cover;
+ background-position: center;
+ margin-right: 1ex;
+ margin-bottom: 1ex;
+}
+
#sone .post .replies {
clear: both;
padding-top: 0.2ex;
font-size: inherit;
}
+#sone .post .reply .linked-images {
+ margin-top: 1ex;
+}
+
+#sone .post .reply .linked-image {
+ display: inline-block;
+ border: solid 1px black;
+ width: 120px;
+ height: 90px;
+ background-size: cover;
+ background-position: center;
+ margin-right: 1ex;
+ margin-bottom: 1ex;
+}
+
#sone .post .show-reply-form {
display: inline;
}
<div class="post-text short-text<%if raw> hidden<%/if><%if shortText|match key=renderedText> hidden<%/if>"><% shortText></div>
<%if !shortText|match value=renderedText><%if !raw><a class="expand-post-text" href="viewPost.html?post=<% post.id|html>&raw=true"><%= View.Post.ShowMore|l10n|html></a><%/if><%/if>
<%if !shortText|match value=renderedText><%if !raw><a class="shrink-post-text hidden"><%= View.Post.ShowLess|l10n|html></a><%/if><%/if>
+ <% parsedText|linked-images|store key==linkedImages>
+ <% foreach linkedImages linkedImage>
+ <% first>
+ <div class="linked-images">
+ <%/first>
+ <a href="/<% linkedImage.link|html>">
+ <span class="linked-image" title="<% linkedImage.link|html>" style="background-image: url('/<% linkedImage.link|html>')"/>
+ </a>
+ <% last>
+ </div>
+ <%/last>
+ <%/foreach>
</div>
<div class="post-status-line status-line<%if !post.loaded> hidden<%/if>">
<div class="bookmarks">
<div class="reply-text short-text<%if raw> hidden<%/if><%if shortText|match key=renderedText> hidden<%/if>"><% shortText></div>
<%if !shortText|match value=renderedText><%if !raw><a class="expand-reply-text" href="viewPost.html?post=<% reply.postId|html>&raw=true"><%= View.Post.ShowMore|l10n|html></a><%/if><%/if>
<%if !shortText|match value=renderedText><%if !raw><a class="shrink-reply-text hidden"><%= View.Post.ShowLess|l10n|html></a><%/if><%/if>
+ <% parsedText|linked-images|store key==linkedImages>
+ <% foreach linkedImages linkedImage>
+ <% first>
+ <div class="linked-images">
+ <%/first>
+ <a href="/<% linkedImage.link|html>">
+ <span class="linked-image" title="<% linkedImage.link|html>" style="background-image: url('/<% linkedImage.link|html>')"/>
+ </a>
+ <% last>
+ </div>
+ <%/last>
+ <%/foreach>
</div>
<div class="reply-status-line status-line">
<div class="time"><% reply.time|date format=="MMM d, yyyy, HH:mm:ss"></div>