diff options
Diffstat (limited to 'src/java/com/juick/http')
-rw-r--r-- | src/java/com/juick/http/www/PageTemplates.java | 15 | ||||
-rw-r--r-- | src/java/com/juick/http/www/UserThread.java | 32 |
2 files changed, 33 insertions, 14 deletions
diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java index f83713c9..fc9bb1d5 100644 --- a/src/java/com/juick/http/www/PageTemplates.java +++ b/src/java/com/juick/http/www/PageTemplates.java @@ -50,7 +50,7 @@ public class PageTemplates { out.println("<!DOCTYPE html>"); out.print("<html>"); out.print("<head>"); - out.print("<link rel=\"stylesheet\" href=\"/style.2013100900.css\"/>"); + out.print("<link rel=\"stylesheet\" href=\"/style.2013102203.css\"/>"); out.print("<script type=\"text/javascript\" src=\"//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js\" defer=\"defer\"></script>"); out.print("<script type=\"text/javascript\" src=\"//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js\" defer=\"defer\" async=\"async\"></script>"); out.print("<script type=\"text/javascript\" src=\"/scripts.2013072200.js\" defer=\"defer\"></script>"); @@ -209,7 +209,7 @@ public class PageTemplates { if (user == null) { ret += "/tag/"; } else { - ret += "./?tag="; + ret += "/" + user.UName + "/?tag="; } ret += URLEncoder.encode(tags.get(i), "utf-8") + "\">" + tag + "</a>"; } catch (UnsupportedEncodingException e) { @@ -400,7 +400,7 @@ public class PageTemplates { com.juick.Message msg = msgs.get(i); - String tags = msg.Tags.isEmpty() ? "" : formatTags(msg.Tags, user); + String tags = msg.Tags.isEmpty() ? "" : formatTags(msg.Tags, msg.User); if (msg.ReadOnly) { tags += " *readonly"; } @@ -426,10 +426,16 @@ public class PageTemplates { txt = formatMessage(msg.Text); } + if (!tags.isEmpty()) { + tags = "<span class=\"msg-tags\">" + tags + "</span>"; + } + out.println(" <li id=\"msg-" + msg.MID + "\" class=\"msg\">"); out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.User.UName + "/\"><img src=\"//i.juick.com/a/" + msg.User.UID + ".png\" alt=\"" + msg.User.UName + "\"/></a></div>"); + out.println(" <div class=\"msg-cont\">"); + out.println(" <div class=\"msg-menu\"><a href=\"#\" onclick=\"showMessageLinksDialog(" + msg.MID + "); return false\"></a></div>"); out.println(" <div class=\"msg-header\"><a href=\"/" + msg.User.UName + "/\">@" + msg.User.UName + "</a>:" + tags + "</div>"); - out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.User.UName + "/" + msg.MID + "\" title=\"" + msg.TimestampString + " GMT\">" + formatDate(msg.TimeAgo, msg.TimestampString, locale) + "</a><a href=\"#\" onclick=\"showMessageLinksDialog(" + msg.MID + "); return false\" class=\"msg-menu\"></a></div>"); + out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.User.UName + "/" + msg.MID + "\" title=\"" + msg.TimestampString + " GMT\">" + formatDate(msg.TimeAgo, msg.TimestampString, locale) + "</a></div>"); if (msg.Place != null) { out.println(" <div class=\"msg-place\"><a href=\"/places/" + msg.Place.pid + "\">" + msg.Place.name + "</a></div>"); } @@ -453,6 +459,7 @@ public class PageTemplates { out.println(" <div class=\"msg-comment\"><textarea name=\"body\" rows=\"1\" class=\"reply\" placeholder=\"" + rb.getString("Add a comment") + "\" onkeypress=\"postformListener(this.form,event)\"></textarea></div>"); out.println(" </form>"); } + out.println(" </div>"); out.println(" </li>"); } } diff --git a/src/java/com/juick/http/www/UserThread.java b/src/java/com/juick/http/www/UserThread.java index 6fb63209..0d096aa1 100644 --- a/src/java/com/juick/http/www/UserThread.java +++ b/src/java/com/juick/http/www/UserThread.java @@ -95,7 +95,7 @@ public class UserThread { msg.VisitorCanComment = visitor != null; - String tags = (msg.Tags.isEmpty()) ? "" : PageTemplates.formatTags(msg.Tags, user); + String tags = (msg.Tags.isEmpty()) ? "" : PageTemplates.formatTags(msg.Tags, msg.User); if (msg.ReadOnly) { tags += " *readonly"; msg.VisitorCanComment = false; @@ -122,9 +122,14 @@ public class UserThread { txt = PageTemplates.formatMessage(msg.Text); } + if (!tags.isEmpty()) { + tags = "<span class=\"msg-tags\">" + tags + "</span>"; + } + out.println("<ul>"); out.println(" <li id=\"msg-" + mid + "\" class=\"msg msgthread\">"); out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.User.UName + "/\"><img src=\"//i.juick.com/a/" + msg.User.UID + ".png\" alt=\"" + msg.User.UName + "\"/></a></div>"); + out.println(" <div class=\"msg-cont\">"); out.println(" <div class=\"msg-header\"><a href=\"/" + msg.User.UName + "/\">@" + msg.User.UName + "</a>:" + tags + "</div>"); out.println(" <div class=\"msg-ts\">" + PageTemplates.formatJSLocalTime(msg.TimestampString) + "<a href=\"#\" onclick=\"showMessageLinksDialog(" + msg.MID + "); return false\" class=\"msg-menu\"></a></div>"); if (msg.Place != null) { @@ -169,8 +174,9 @@ public class UserThread { } out.println("</div>"); } - + out.println(" </div>"); out.println(" </li>"); + out.println(" <li id=\"mtoolbar\"><ul>"); out.println(" <li><a href=\"/" + mid + "\"><div style=\"background-position: -64px 0\"></div>" + mid + "</a></li>"); if (visitor != null) { @@ -294,6 +300,12 @@ public class UserThread { out.print("display:none;"); } out.println("\">"); + out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.User.UName + "/\"><img src=\"//i.juick.com/a/" + msg.User.UID + ".png\" alt=\"" + msg.User.UName + "\"/></a></div>"); + out.println(" <div class=\"msg-cont\">"); + out.println(" <div class=\"msg-menu\"><a href=\"#\" onclick=\"showMessageLinksDialog(" + msg.MID + "," + msg.RID + "); return false\"></a></div>"); + out.println(" <div class=\"msg-header\"><a href=\"/" + msg.User.UName + "/\">@" + msg.User.UName + "</a>:</div>"); + out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.MID + "#" + msg.RID + "\" title=\"" + msg.TimestampString + " GMT\">" + PageTemplates.formatDate(msg.TimeAgo, msg.TimestampString, locale) + "</a></div>"); + out.println(" <div class=\"msg-txt\">" + PageTemplates.formatMessage(msg.Text) + "</div>"); if (msg.AttachmentType != null) { if (msg.AttachmentType.equals("mp4")) { out.println(" <div class=\"msg-media\"><div id=\"video-" + msg.MID + "-" + msg.RID + "\"><a href=\"//i.juick.com/video/" + msg.MID + "-" + msg.RID + ".mp4\" onclick=\"inlinevideo('" + msg.MID + "-" + msg.RID + "'); return false\"><img src=\"//i.juick.com/thumbs/" + msg.MID + "-" + msg.RID + ".jpg\" alt=\"\"/></a></div></div>"); @@ -301,10 +313,6 @@ public class UserThread { out.println(" <div class=\"msg-media\"><a href=\"//i.juick.com/p/" + msg.MID + "-" + msg.RID + "." + msg.AttachmentType + "\"><img src=\"//i.juick.com/photos-512/" + msg.MID + "-" + msg.RID + "." + msg.AttachmentType + "\" alt=\"\"/></a></div>"); } } - out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.User.UName + "/\"><img src=\"//i.juick.com/a/" + msg.User.UID + ".png\" alt=\"" + msg.User.UName + "\"/></a></div>"); - out.println(" <div class=\"msg-header\"><a href=\"/" + msg.User.UName + "/\">@" + msg.User.UName + "</a>:</div>"); - out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.MID + "#" + msg.RID + "\" title=\"" + msg.TimestampString + " GMT\">" + PageTemplates.formatDate(msg.TimeAgo, msg.TimestampString, locale) + "</a><a href=\"#\" onclick=\"showMessageLinksDialog(" + msg.MID + "," + msg.RID + "); return false\" class=\"msg-menu\"></a></div>"); - out.println(" <div class=\"msg-txt\">" + PageTemplates.formatMessage(msg.Text) + "</div>"); if (msg.VisitorCanComment) { out.println(" <div class=\"msg-links\"><a href=\"#\" onclick=\"return showCommentForm(" + msg.MID + "," + msg.RID + ")\">" + rb.getString("Comment") + "</a></div>"); out.println(" <div class=\"msg-comment\" style=\"display: none\"></div>"); @@ -315,6 +323,7 @@ public class UserThread { out.println(" <div class=\"msg-comments\"><a href=\"#\" onclick=\"return showMoreReplies(" + msg.RID + ")\">" + PageTemplates.formatReplies(childs, locale) + " more</a></div>"); } + out.println(" </div>"); out.println(" </li>"); if (ReplyTo == 0 && childs > 1 && replies.size() > 10) { @@ -333,6 +342,12 @@ public class UserThread { com.juick.Message msg = replies.get(i); out.print(" <li id=\"" + msg.RID + "\" class=\"msg\">"); + out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.User.UName + "/\"><img src=\"//i.juick.com/a/" + msg.User.UID + ".png\"></a></div>"); + out.println(" <div class=\"msg-cont\">"); + out.println(" <div class=\"msg-menu\"><a href=\"#\" onclick=\"showMessageLinksDialog(" + msg.MID + "," + msg.RID + "); return false\"></a></div>"); + out.println(" <div class=\"msg-header\"><a href=\"/" + msg.User.UName + "/\">@" + msg.User.UName + "</a>:</div>"); + out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.MID + "#" + msg.RID + "\" title=\"" + msg.TimestampString + " GMT\">" + PageTemplates.formatDate(msg.TimeAgo, msg.TimestampString, locale) + "</a></div>"); + out.println(" <div class=\"msg-txt\">" + PageTemplates.formatMessage(msg.Text) + "</div>"); if (msg.AttachmentType != null) { if (msg.AttachmentType.equals("mp4")) { out.println(" <div class=\"msg-media\"><div id=\"video-" + msg.MID + "-" + msg.RID + "\"><a href=\"//i.juick.com/video/" + msg.MID + "-" + msg.RID + ".mp4\" onclick=\"inlinevideo('" + msg.MID + "-" + msg.RID + "'); return false\"><img src=\"//i.juick.com/thumbs/" + msg.MID + "-" + msg.RID + ".jpg\" alt=\"\"/></a></div></div>"); @@ -340,10 +355,6 @@ public class UserThread { out.println(" <div class=\"msg-media\"><a href=\"//i.juick.com/p/" + msg.MID + "-" + msg.RID + "." + msg.AttachmentType + "\"><img src=\"//i.juick.com/photos-512/" + msg.MID + "-" + msg.RID + "." + msg.AttachmentType + "\" alt=\"\"/></a></div>"); } } - out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.User.UName + "/\"><img src=\"//i.juick.com/a/" + msg.User.UID + ".png\"></a></div>"); - out.println(" <div class=\"msg-header\"><a href=\"/" + msg.User.UName + "/\">@" + msg.User.UName + "</a>:</div>"); - out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.MID + "#" + msg.RID + "\" title=\"" + msg.TimestampString + " GMT\">" + PageTemplates.formatDate(msg.TimeAgo, msg.TimestampString, locale) + "</a><a href=\"#\" onclick=\"showMessageLinksDialog(" + msg.MID + "," + msg.RID + "); return false\" class=\"msg-menu\"></a></div>"); - out.println(" <div class=\"msg-txt\">" + PageTemplates.formatMessage(msg.Text) + "</div>"); out.print(" <div class=\"msg-links\">/" + msg.RID); if (msg.ReplyTo > 0) { out.print(" " + rb.getString("in reply to") + " <a href=\"#" + msg.ReplyTo + "\">/" + msg.ReplyTo + "</a>"); @@ -352,6 +363,7 @@ public class UserThread { out.println(" · <a href=\"#\" onclick=\"return showCommentForm(" + msg.MID + "," + msg.RID + ")\">" + rb.getString("Comment") + "</a></div>"); out.println(" <div class=\"msg-comment\" style=\"display: none\"></div>"); } + out.println(" </div>"); out.println(" </li>"); } } |