aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main/java/com/juick/www/PageTemplates.java
diff options
context:
space:
mode:
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/PageTemplates.java')
-rw-r--r--juick-www/src/main/java/com/juick/www/PageTemplates.java37
1 files changed, 19 insertions, 18 deletions
diff --git a/juick-www/src/main/java/com/juick/www/PageTemplates.java b/juick-www/src/main/java/com/juick/www/PageTemplates.java
index c570ae7f..6e13bcc2 100644
--- a/juick-www/src/main/java/com/juick/www/PageTemplates.java
+++ b/juick-www/src/main/java/com/juick/www/PageTemplates.java
@@ -54,13 +54,12 @@ public class PageTemplates {
private static SimpleDateFormat sdfFull = new SimpleDateFormat("d MMM yyyy");
private static String tagsHTML = null;
- public static void pageHead(PrintWriter out, String title, String headers) {
+ public static void pageHead(PrintWriter out, com.juick.User visitor, String title, String headers) {
out.println("<!DOCTYPE html>");
out.print("<html>");
out.print("<head>");
out.println("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">");
out.print("<link rel=\"stylesheet\" href=\"/style.css\"/>");
- out.print("<script type=\"text/javascript\" src=\"//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js\"></script>");
out.print("<script type=\"text/javascript\" src=\"/scripts.js\"></script>");
if (headers != null) {
out.print(headers);
@@ -73,7 +72,11 @@ public class PageTemplates {
out.println("<![endif]-->");
out.println("</head>");
out.flush();
- out.println("<body>");
+ if (visitor.getUID() > 0) {
+ out.println("<body id=\"body\" data-hash=\"" + visitor.getAuthHash() + "\">");
+ } else {
+ out.println("<body id=\"body\">");
+ }
}
public static void pageNavigation(PrintWriter out, com.juick.User visitor, String search) {
@@ -103,7 +106,7 @@ public class PageTemplates {
out.print("<li><a href=\"/logout\">Выйти</a></li>");
out.println("</ul></nav>");
} else {
- out.println("<p>Чтобы добавлять сообщения и комментарии, <a href=\"#\" onclick=\"return openDialogLogin()\">представьтесь</a>.</p>");
+ out.println("<p>Чтобы добавлять сообщения и комментарии, <a href=\"#\" class=\"a-login\">представьтесь</a>.</p>");
}
out.println(" </section>");
out.println("</header>");
@@ -158,12 +161,6 @@ public class PageTemplates {
out.println("</div>");
out.println("</div>");
- if (visitor.getUID() > 0) {
- out.println("<script type=\"text/javascript\">");
- out.println("var hash=\"" + visitor.getAuthHash() + "\";");
- out.println("</script>");
- }
-
out.println("<script>");
out.println("(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){");
out.println("(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),");
@@ -442,7 +439,7 @@ public class PageTemplates {
out.println(" <header class=\"t\"><a href=\"/" + msg.getUser().getUName() + "/" + msg.getMID() + "\"><time datetime=\"" + sdfSQL.format(msg.getDate()) + "Z\" title=\"" + sdfSQL.format(msg.getDate()) + " GMT\">" + formatDate(msg.TimeAgo, msg.getDate()) + "</time></a></header>");
if (msg.AttachmentType != null) {
String fname = msg.getMID() + "." + msg.AttachmentType;
- out.println(" <p class=\"ir\"><a href=\"//i.juick.com/photos-512/" + fname + "\" onclick=\"return showPhotoDialog('" + fname + "')\"><img src=\"//i.juick.com/photos-512/" + fname + "\" alt=\"\"/></a></p>");
+ out.println(" <p class=\"ir\"><a href=\"//i.juick.com/photos-512/" + fname + "\" data-fname=\"" + fname + "\"><img src=\"//i.juick.com/photos-512/" + fname + "\" alt=\"\"/></a></p>");
}
out.println(" <p>" + txt + "</p>");
if (msg.AttachmentType != null) {
@@ -450,19 +447,23 @@ public class PageTemplates {
}
out.print(" <nav class=\"l\">");
msg.ReadOnly |= blUIDs.contains(msg.getUser().getUID());
- out.print("<a href=\"#\" onclick=\"return likeMessage(this," + msg.getMID() + ")\">Мне нравится</a>");
+ if (visitor.getUID() == 0) {
+ out.print("<a href=\"#\" class=\"a-login\">Мне нравится</a>");
+ } else {
+ out.print("<a href=\"/post?body=!+%23" + msg.getMID() + "\" class=\"a-like\">Мне нравится</a>");
+ }
if (visitor.getUID() == 0 && !msg.ReadOnly) {
- out.print("<a href=\"#\" onclick=\"return openDialogLogin()\">Комментировать</a> ");
+ out.print("<a href=\"/"+ msg.getMID() + "\" class=\"a-login\">Комментировать</a> ");
} else if (visitor.getUID() > 0 && (!msg.ReadOnly || visitor.getUID() == msg.getUser().getUID())) {
- out.print("<a href=\"#\" onclick=\"return showCommentFooter(this)\">Комментировать</a> ");
+ out.print("<a class=\"a-comment\" href=\"/" + msg.getMID() + "\">Комментировать</a> ");
}
if (visitor.getUID() > 0 && msg.Privacy < 0 && msg.getUser().getUID() == visitor.getUID()) {
- out.print(" <a href=\"#\" onclick=\"return setPrivacy(this," + msg.getMID() + ")\">Открыть доступ</a>");
+ out.print(" <a href=\"#\" class=\"a-privacy\">Открыть доступ</a>");
}
if (visitor.getUID() > 0 && visitor.getUID() == 3694) {
- out.print(" <a href=\"#\" onclick=\"return setPopular(this," + msg.getMID() + ",2)\">+</a>");
- out.print(" <a href=\"#\" onclick=\"return setPopular(this," + msg.getMID() + ",-1)\">-</a>");
- out.print(" <a href=\"#\" onclick=\"return setPopular(this," + msg.getMID() + ",-2)\">x</a>");
+ out.print(" <a href=\"#\" class=\"a-popular-plus\">+</a>");
+ out.print(" <a href=\"#\" class=\"a-popular-minus\">-</a>");
+ out.print(" <a href=\"#\" class=\"a-popular-delete\">x</a>");
}
out.println("</nav>");