protected void processTemplate(Request request, TemplateContext templateContext) throws RedirectException {
super.processTemplate(request, templateContext);
String postId = request.getHttpRequest().getParam("post");
+ boolean raw = request.getHttpRequest().getParam("raw").equals("true");
Post post = webInterface.getCore().getPost(postId);
templateContext.set("post", post);
+ templateContext.set("raw", raw);
}
/**
View.Post.Reply.DeleteLink=Delete
View.Post.LikeLink=Like
View.Post.UnlikeLink=Unlike
+View.Post.ShowSource=Toggle Parser
View.UpdateStatus.Text.ChooseSenderIdentity=Choose the sender identity
font-weight: bold;
}
-#sone .post .text {
+#sone .post .text, #sone .post .raw-text {
display: inline;
white-space: pre-wrap;
}
+#sone .post .text.hidden, #sone .post .raw-text.hidden {
+ display: none;
+}
+
#sone .post .status-line {
margin-top: 0.5ex;
font-size: 85%;
color: rgb(28, 131, 191);
}
+#sone .show-source, #sone .show-reply-source {
+ display: inline;
+}
+
#sone .post .bookmarks {
display: inline;
color: rgb(28, 131, 191);
return false;
});
+ /* convert “show source” link into javascript function. */
+ $(postElement).find(".show-source").each(function() {
+ $("a", this).click(function() {
+ $(".post-text.text", getPostElement(this)).toggleClass("hidden");
+ $(".post-text.raw-text", getPostElement(this)).toggleClass("hidden");
+ return false;
+ });
+ });
+
/* add “comment” link. */
addCommentLink(getPostId(postElement), postElement, $(postElement).find(".post-status-line .time"));
})(replyElement);
addCommentLink(getPostId(replyElement), replyElement, $(replyElement).find(".reply-status-line .time"));
+ /* convert “show source” link into javascript function. */
+ $(replyElement).find(".show-reply-source").each(function() {
+ $("a", this).click(function() {
+ $(".reply-text.text", getReplyElement(this)).toggleClass("hidden");
+ $(".reply-text.raw-text", getReplyElement(this)).toggleClass("hidden");
+ return false;
+ });
+ });
+
/* convert trust control buttons to javascript functions. */
$(replyElement).find(".reply-trust").submit(function() {
trustSone(getReplyAuthor(this));
<div class="recipient profile-link"><a href="viewSone.html?sone=<% post.recipient.id|html>"><% post.recipient.niceName|html></a></div>
<%/if>
<%/if>
- <div class="text"><% post.text|parse sone=post.sone></div>
+ <div class="post-text raw-text<%if !raw> hidden<%/if>"><% post.text|html></div>
+ <div class="post-text text<%if raw> hidden<%/if>"><% post.text|parse sone=post.sone></div>
</div>
<div class="post-status-line status-line">
<div class="bookmarks">
</div>
<span class='separator'>·</span>
<div class="time"><a href="viewPost.html?post=<% post.id|html>"><% post.time|date format="MMM d, yyyy, HH:mm:ss"></a></div>
+ <span class='separator'>·</span>
+ <div class="show-source"><a href="viewPost.html?post=<% post.id|html>&raw=<%if raw>false<%else>true<%/if>"><%= View.Post.ShowSource|l10n|html></a></div>
<div class="likes<%if post.likes.size|match value=0> hidden<%/if>">
<span class='separator'>·</span>
<span title="<% post.likes.soneNames|html>">↑<span class="like-count"><% post.likes.size></span></span>
<div class="inner-part">
<div>
<div class="author profile-link"><a href="viewSone.html?sone=<% reply.sone.id|html>"><% reply.sone.niceName|html></a></div>
- <div class="text"><% reply.text|parse sone=reply.sone></div>
+ <div class="reply-text raw-text<%if !raw> hidden<%/if>"><% reply.text|html></div>
+ <div class="reply-text text<%if raw> hidden<%/if>"><% reply.text|parse sone=reply.sone></div>
</div>
<div class="reply-status-line status-line">
<div class="time"><% reply.time|date format="MMM d, yyyy, HH:mm:ss"></div>
+ <span class='separator'>·</span>
+ <div class="show-reply-source"><a href="viewPost.html?post=<% post.id|html>&raw=<%if raw>false<%else>true<%/if>"><%= View.Post.ShowSource|l10n|html></a></div>
<div class="likes<%if reply.likes.size|match value=0> hidden<%/if>">
<span class='separator'>·</span>
<span title="<% reply.likes.soneNames|html>">↑<span class="like-count"><% reply.likes.size></span></span>