diff options
Diffstat (limited to 'juick-www/src/main/java')
12 files changed, 65 insertions, 70 deletions
diff --git a/juick-www/src/main/java/com/juick/www/Discover.java b/juick-www/src/main/java/com/juick/www/Discover.java index e94d6e99..c1bcacc7 100644 --- a/juick-www/src/main/java/com/juick/www/Discover.java +++ b/juick-www/src/main/java/com/juick/www/Discover.java @@ -84,7 +84,7 @@ public class Discover { } else if (paramBefore > 0 || mids.size() < 5) { head = "<meta name=\"robots\" content=\"noindex\"/>"; } - PageTemplates.pageHead(out, title, head); + PageTemplates.pageHead(out, visitor, title, head); PageTemplates.pageNavigation(out, visitor, null); PageTemplates.pageHomeColumn(out, sql, visitor); diff --git a/juick-www/src/main/java/com/juick/www/Errors.java b/juick-www/src/main/java/com/juick/www/Errors.java index 45fa3d51..4ab10229 100644 --- a/juick-www/src/main/java/com/juick/www/Errors.java +++ b/juick-www/src/main/java/com/juick/www/Errors.java @@ -26,7 +26,7 @@ public class Errors { response.setStatus(404); response.setContentType("text/html; charset=UTF-8"); try (PrintWriter out = response.getWriter()) { - PageTemplates.pageHead(out, "404 Страница не найдена", null); + PageTemplates.pageHead(out, visitor, "404 Страница не найдена", null); PageTemplates.pageNavigation(out, visitor, null); PageTemplates.pageHomeColumn(out, sql, visitor); diff --git a/juick-www/src/main/java/com/juick/www/Help.java b/juick-www/src/main/java/com/juick/www/Help.java index e0ecab2b..a8bfaf3f 100644 --- a/juick-www/src/main/java/com/juick/www/Help.java +++ b/juick-www/src/main/java/com/juick/www/Help.java @@ -62,7 +62,7 @@ public class Help { response.setContentType("text/html; charset=UTF-8"); try (PrintWriter out = response.getWriter()) { - PageTemplates.pageHead(out, "Помощь", null); + PageTemplates.pageHead(out, visitor, "Помощь", null); PageTemplates.pageNavigation(out, visitor, null); out.println("<aside id=\"column\">"); diff --git a/juick-www/src/main/java/com/juick/www/Home.java b/juick-www/src/main/java/com/juick/www/Home.java index 769670c4..5a1aa6ab 100644 --- a/juick-www/src/main/java/com/juick/www/Home.java +++ b/juick-www/src/main/java/com/juick/www/Home.java @@ -106,7 +106,7 @@ public class Home { if (paramBefore > 0 || paramShow != null) { head = "<meta name=\"robots\" content=\"noindex\"/>"; } - PageTemplates.pageHead(out, title, head); + PageTemplates.pageHead(out, visitor, title, head); PageTemplates.pageNavigation(out, visitor, paramSearch); PageTemplates.pageHomeColumn(out, sql, visitor, paramShow == null && paramBefore == 0 && paramSearch == null && visitor.getUID() == 0); @@ -117,12 +117,15 @@ public class Home { } if (visitor.getUID() > 0) { - out.println("<form action=\"/post\" method=\"post\" enctype=\"multipart/form-data\" onsubmit=\"return onsubmitNewMessage()\">"); + out.println("<form action=\"/post\" method=\"post\" enctype=\"multipart/form-data\">"); out.println("<section id=\"newmessage\">"); - out.println(" <textarea name=\"body\" placeholder=\"Новое сообщение...\" onclick=\"$('#newmessage>div').css('display','block');$('#newmessage textarea').css('min-height','70px');\" onkeypress=\"postformListener(this.form,event)\"></textarea>"); + out.println(" <textarea name=\"body\" placeholder=\"Новое сообщение...\"></textarea>"); out.println(" <div>"); - out.println(" <input type=\"text\" class=\"img\" name=\"img\" placeholder=\"Ссылка на изображение (JPG/PNG, до 10Мб)\"/> или <a href=\"#\" onclick=\"return attachMessagePhoto(this)\">загрузить</a><br/>"); - out.println(" <input type=\"text\" class=\"tags\" name=\"tags\" placeholder=\"Теги (через пробел)\"/><br/>"); + out.println(" <input type=\"text\" class=\"img\" name=\"img\" " + + "placeholder=\"Ссылка на изображение (JPG/PNG, до 10Мб)\"/> " + + "или <a href=\"#\">загрузить</a><br/>"); + out.println(" <input type=\"text\" class=\"tags\" name=\"tags\" " + + "placeholder=\"Теги (через пробел)\"/><br/>"); out.println(" <input type=\"submit\" class=\"subm\" value=\"Отправить\"/>"); out.println(" </div>"); out.println("</section>"); diff --git a/juick-www/src/main/java/com/juick/www/NewMessage.java b/juick-www/src/main/java/com/juick/www/NewMessage.java index a179fac8..c6a1aae8 100644 --- a/juick-www/src/main/java/com/juick/www/NewMessage.java +++ b/juick-www/src/main/java/com/juick/www/NewMessage.java @@ -60,10 +60,11 @@ public class NewMessage { this.imgDir = imgDir; } - protected void doGetNewMessage(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response, com.juick.User visitor) throws ServletException, IOException { + protected void doGetNewMessage(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response, + com.juick.User visitor) throws ServletException, IOException { response.setContentType("text/html; charset=UTF-8"); try (PrintWriter out = response.getWriter()) { - PageTemplates.pageHead(out, "Написать", "<script src=\"//maps.google.com/maps?file=api&v=2&sensor=false&key=ABQIAAAAVVtPtxkw4soCEHg44FsNChRB4OFYjAXt73He16Zkp6a_0tPs2RTU6i6UlcMs4QvPBYvIY8rWvcxqOg\" type=\"text/javascript\"></script>" + PageTemplates.pageHead(out, visitor, "Написать", "<script src=\"//maps.google.com/maps?file=api&v=2&sensor=false&key=ABQIAAAAVVtPtxkw4soCEHg44FsNChRB4OFYjAXt73He16Zkp6a_0tPs2RTU6i6UlcMs4QvPBYvIY8rWvcxqOg\" type=\"text/javascript\"></script>" + "<script src=\"//static.juick.com/mc.js\" type=\"text/javascript\" defer=\"defer\"></script>" + "<script src=\"//static.juick.com/maps.js?2010111500\" type=\"text/javascript\" defer=\"defer\"></script>" + "<script src=\"//static.juick.com/post3.js\" type=\"text/javascript\" defer=\"defer\"></script>"); @@ -250,7 +251,7 @@ public class NewMessage { response.setContentType("text/html; charset=UTF-8"); try (PrintWriter out = response.getWriter()) { - PageTemplates.pageHead(out, "Сообщение опубликовано", null); + PageTemplates.pageHead(out, visitor, "Сообщение опубликовано", null); PageTemplates.pageNavigation(out, visitor, null); PageTemplates.pageHomeColumn(out, sql, visitor); @@ -277,14 +278,14 @@ public class NewMessage { out.println("<h1>Сообщение опубликовано</h1>"); out.println("<p>Поделитесь своим новым постом в социальных сетях:</p>"); if (CrosspostQueries.getTwitterTokens(sql, visitor.getUID()).isPresent()) { - out.println("<p><a href=\"https://twitter.com/intent/tweet?text=" + URLEncoder.encode(sharetwi, "utf-8") + "\" onclick=\"return openSocialWindow(this)\" class=\"ico32-twi sharenew\">Отправить в Twitter</a></p>"); + out.println("<p class=\"social\"><a href=\"https://twitter.com/intent/tweet?text=" + URLEncoder.encode(sharetwi, "utf-8") + "\" class=\"ico32-twi sharenew\">Отправить в Twitter</a></p>"); } - out.println("<p><a href=\"http://www.livejournal.com/update.bml?subject=" + URLEncoder.encode(hashtags, "utf-8") + "&event=" + sharelj + "&prop_taglist=" + URLEncoder.encode(tagscomma, "utf-8") + "\" target=\"_blank\" class=\"ico32-lj sharenew\">Отправить в LiveJournal</a></p>"); - out.println("<p><a href=\"https://vk.com/share.php?url=" + url + "\" onclick=\"return openSocialWindow(this)\" class=\"ico32-vk sharenew\">Отправить в ВКонтакте</a></p>"); + out.println("<p class=\"social\"><a href=\"http://www.livejournal.com/update.bml?subject=" + URLEncoder.encode(hashtags, "utf-8") + "&event=" + sharelj + "&prop_taglist=" + URLEncoder.encode(tagscomma, "utf-8") + "\" target=\"_blank\" class=\"ico32-lj sharenew\">Отправить в LiveJournal</a></p>"); + out.println("<p class=\"social\"><a href=\"https://vk.com/share.php?url=" + url + "\" class=\"ico32-vk sharenew\">Отправить в ВКонтакте</a></p>"); if (CrosspostQueries.getFacebookToken(sql, visitor.getUID()).isPresent()) { - out.println("<p><a href=\"https://www.facebook.com/sharer/sharer.php?u=" + url + "\" onclick=\"return openSocialWindow(this)\" class=\"ico32-fb sharenew\">Отправить в Facebook</a></p>"); + out.println("<p class=\"social\"><a href=\"https://www.facebook.com/sharer/sharer.php?u=" + url + "\" class=\"ico32-fb sharenew\">Отправить в Facebook</a></p>"); } - out.println("<p><a href=\"https://plus.google.com/share?url=" + url + "\" onclick=\"return openSocialWindow(this)\" class=\"ico32-gp sharenew\">Отправить в Google+</a></p>"); + out.println("<p class=\"social\"><a href=\"https://plus.google.com/share?url=" + url + "\" class=\"ico32-gp sharenew\">Отправить в Google+</a></p>"); out.println("<p>Ссылка на сообщение: <a href=\"http://juick.com/" + mid + "\">http://juick.com/" + mid + "</a></p>"); out.println("</section>"); diff --git a/juick-www/src/main/java/com/juick/www/PM.java b/juick-www/src/main/java/com/juick/www/PM.java index 5adef7b3..7c38d2a5 100644 --- a/juick-www/src/main/java/com/juick/www/PM.java +++ b/juick-www/src/main/java/com/juick/www/PM.java @@ -55,7 +55,7 @@ public class PM { response.setContentType("text/html; charset=UTF-8"); try (PrintWriter out = response.getWriter()) { - PageTemplates.pageHead(out, title, null); + PageTemplates.pageHead(out, visitor, title, null); PageTemplates.pageNavigation(out, visitor, null); PageTemplates.pageHomeColumn(out, sql, visitor); @@ -120,7 +120,7 @@ public class PM { response.setContentType("text/html; charset=UTF-8"); try (PrintWriter out = response.getWriter()) { - PageTemplates.pageHead(out, title, null); + PageTemplates.pageHead(out, visitor, title, null); PageTemplates.pageNavigation(out, visitor, null); PageTemplates.pageHomeColumn(out, sql, visitor); 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>"); diff --git a/juick-www/src/main/java/com/juick/www/Settings.java b/juick-www/src/main/java/com/juick/www/Settings.java index af1591bf..6364c869 100644 --- a/juick-www/src/main/java/com/juick/www/Settings.java +++ b/juick-www/src/main/java/com/juick/www/Settings.java @@ -37,7 +37,7 @@ public class Settings { response.setContentType("text/html; charset=UTF-8"); try (PrintWriter out = response.getWriter()) { - PageTemplates.pageHead(out, "Логин", ""); + PageTemplates.pageHead(out, visitor, "Логин", ""); PageTemplates.pageNavigation(out, visitor, null); out.println("<div id=\"topwrapper\">"); diff --git a/juick-www/src/main/java/com/juick/www/SignUp.java b/juick-www/src/main/java/com/juick/www/SignUp.java index 7dbfb6dc..865fc453 100644 --- a/juick-www/src/main/java/com/juick/www/SignUp.java +++ b/juick-www/src/main/java/com/juick/www/SignUp.java @@ -63,7 +63,7 @@ public class SignUp { response.setContentType("text/html; charset=UTF-8"); try (PrintWriter out = response.getWriter()) { - PageTemplates.pageHead(out, "Новый пользователь", null); + PageTemplates.pageHead(out, visitor, "Новый пользователь", null); PageTemplates.pageNavigation(out, visitor, null); out.println("<section id=\"content\">"); @@ -101,7 +101,7 @@ public class SignUp { out.println("<input type=\"hidden\" name=\"action\" value=\"new\"/>"); out.println("<input type=\"hidden\" name=\"type\" value=\"" + type + "\"/>"); out.println("<input type=\"hidden\" name=\"hash\" value=\"" + hash + "\"/>"); - out.println("<p>Имя пользователя: <input type=\"text\" name=\"username\" id=\"username\" onblur=\"checkUsername()\"/><br/><i>(От 2-х до 16-и латинских символов и/или цифр, дефис)</i></p>"); + out.println("<p>Имя пользователя: <input type=\"text\" name=\"username\" id=\"username\"/><br/><i>(От 2-х до 16-и латинских символов и/или цифр, дефис)</i></p>"); out.println("<p>Пароль: <input type=\"password\" name=\"password\"/><br/><i>(от 6-и до 32-х символов)</i></p>"); out.println("<p><input type=\"submit\" value=\" OK \"/></p>"); out.println("</form>"); diff --git a/juick-www/src/main/java/com/juick/www/User.java b/juick-www/src/main/java/com/juick/www/User.java index 0d0056ad..1c23864e 100644 --- a/juick-www/src/main/java/com/juick/www/User.java +++ b/juick-www/src/main/java/com/juick/www/User.java @@ -121,7 +121,7 @@ public class User { } else if (paramBefore > 0 || paramShow != null) { head += "<meta name=\"robots\" content=\"noindex\"/>"; } - PageTemplates.pageHead(out, title, head); + PageTemplates.pageHead(out, visitor, title, head); PageTemplates.pageNavigation(out, visitor, null); pageUserColumn(out, sql, user, visitor); @@ -168,7 +168,7 @@ public class User { response.setContentType("text/html; charset=UTF-8"); try (PrintWriter out = response.getWriter()) { String head = "<meta name=\"robots\" content=\"noindex,nofollow\"/>"; - PageTemplates.pageHead(out, "Теги " + user.getUName(), head); + PageTemplates.pageHead(out, visitor, "Теги " + user.getUName(), head); PageTemplates.pageNavigation(out, visitor, null); pageUserColumn(out, sql, user, visitor); @@ -191,7 +191,7 @@ public class User { response.setContentType("text/html; charset=UTF-8"); try (PrintWriter out = response.getWriter()) { String head = "<meta name=\"robots\" content=\"noindex\"/>"; - PageTemplates.pageHead(out, "Подписки " + user.getUName(), head); + PageTemplates.pageHead(out, visitor, "Подписки " + user.getUName(), head); PageTemplates.pageNavigation(out, visitor, null); pageUserColumn(out, sql, user, visitor); @@ -226,7 +226,7 @@ public class User { response.setContentType("text/html; charset=UTF-8"); try (PrintWriter out = response.getWriter()) { String head = "<meta name=\"robots\" content=\"noindex\"/>"; - PageTemplates.pageHead(out, "Читатели " + user.getUName(), head); + PageTemplates.pageHead(out, visitor, "Читатели " + user.getUName(), head); PageTemplates.pageNavigation(out, visitor, null); pageUserColumn(out, sql, user, visitor); diff --git a/juick-www/src/main/java/com/juick/www/UserThread.java b/juick-www/src/main/java/com/juick/www/UserThread.java index e3eb7186..d7193bc4 100644 --- a/juick-www/src/main/java/com/juick/www/UserThread.java +++ b/juick-www/src/main/java/com/juick/www/UserThread.java @@ -77,21 +77,16 @@ public class UserThread { if (msg.Hidden) { headers += "<meta name=\"robots\" content=\"noindex\"/>"; } - PageTemplates.pageHead(out, title, headers); + PageTemplates.pageHead(out, visitor, title, headers); PageTemplates.pageNavigation(out, visitor, null); - out.println("<section id=\"content\" style=\"margin-left: 0; width: 100%\">"); + out.println("<section id=\"content\" data-mid=\"" + msg.getMID() + "\" style=\"margin-left: 0; width: 100%\">"); printMessage(out, sql, msg, visitor); printReplies(out, sql, msg, visitor, listview); out.println("</section>"); PageTemplates.pageFooter(request, out, visitor, false); - out.println("<script type='text/javascript'>"); - out.println("var pageMID=" + msg.getMID() + ";"); - out.println("initWS();"); - out.println("</script>"); - PageTemplates.pageEnd(out); } } @@ -121,10 +116,10 @@ public class UserThread { } out.println("<ul>"); - out.println(" <li id=\"msg-" + msg.getMID() + "\" class=\"msg msgthread\">"); + out.println(" <li id=\"msg-" + msg.getMID() + "\" data-mid=\"" + msg.getMID() + "\" class=\"msg msgthread\">"); out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.getUser().getUName() + "/\"><img src=\"//i.juick.com/a/" + msg.getUser().getUID() + ".png\" alt=\"" + msg.getUser().getUName() + "\"/></a></div>"); out.println(" <div class=\"msg-cont\">"); - out.println(" <div class=\"msg-menu\"><a href=\"#\" onclick=\"showMessageLinksDialog(" + msg.getMID() + "); return false\"></a></div>"); + out.println(" <div class=\"msg-menu\"><a href=\"#\"></a></div>"); out.println(" <div class=\"msg-header\"><a href=\"/" + msg.getUser().getUName() + "/\">@" + msg.getUser().getUName() + "</a>:" + tagsStr + "</div>"); out.println(" <div class=\"msg-ts\">" + PageTemplates.formatJSLocalTime(msg.getDate()) + "</div>"); out.println(" <div class=\"msg-txt\">" + txt + "</div>"); @@ -243,7 +238,7 @@ public class UserThread { out.print("<a href=\"?view=tree\" rel=\"nofollow\">Показать деревом</a>"); } else { if (foldable) { - out.print("<span id=\"unfoldall\"><a href=\"#\" onclick=\"$('#replies>li').show(); $('#replies .msg-comments').hide(); $('#unfoldall').hide(); return false\">Раскрыть все</a> · </span>"); + out.print("<span id=\"unfoldall\"><a href=\"#\">Раскрыть все</a> · </span>"); } out.print("<a href=\"?view=list\" rel=\"nofollow\">Показать списком</a>"); } @@ -289,7 +284,7 @@ public class UserThread { out.println(" <div class=\"msg-avatar\"><img src=\"//i.juick.com/av-96.png\"/></div>"); } out.println(" <div class=\"msg-cont\">"); - out.println(" <div class=\"msg-menu\"><a href=\"#\" onclick=\"showMessageLinksDialog(" + msg.getMID() + "," + msg.getRID() + "); return false\"></a></div>"); + out.println(" <div class=\"msg-menu\"><a href=\"#\" class=\"a-thread-links\"></a></div>"); if (!msg.getUser().Banned) { out.println(" <div class=\"msg-header\"><a href=\"/" + msg.getUser().getUName() + "/\">@" + msg.getUser().getUName() + "</a>:</div>"); } else { @@ -301,16 +296,15 @@ public class UserThread { out.println(" <div class=\"msg-media\"><a href=\"//i.juick.com/p/" + msg.getMID() + "-" + msg.getRID() + "." + msg.AttachmentType + "\"><img src=\"//i.juick.com/photos-512/" + msg.getMID() + "-" + msg.getRID() + "." + msg.AttachmentType + "\" alt=\"\"/></a></div>"); } if (msg.VisitorCanComment) { - out.println(" <div class=\"msg-links\"><a href=\"#\" onclick=\"return showCommentForm(" + msg.getMID() + "," + msg.getRID() + ")\">Ответить</a></div>"); + out.println(" <div class=\"msg-links\"><a href=\"/post?body=%23" + msg.getMID() + "/" + msg.getRID() + "%20\" class=\"a-thread-comment\">Ответить</a></div>"); out.println(" <div class=\"msg-comment\" style=\"display: none\"></div>"); } else if (visitor == null) { - out.println(" <div class=\"msg-links\"><a href=\"#\" onclick=\"return openDialogLogin()\">Ответить</a></div>"); + out.println(" <div class=\"msg-links\"><a href=\"#\" class=\"a-login\">Ответить</a></div>"); } int childs = msg.getChildsCount(); if (ReplyTo == 0 && childs > 1 && replies.size() > 10) { - out.println(" <div class=\"msg-comments\"><a href=\"#\" onclick=\"return showMoreReplies(" + msg.getRID() + ")\">" + PageTemplates.formatReplies(childs) + "</a></div>"); - + out.println(" <div class=\"msg-comments\"><a href=\"#\" class=\"a-thread-comment\">" + PageTemplates.formatReplies(childs) + "</a></div>"); } out.println(" </div>"); out.println(" </li>"); @@ -333,7 +327,7 @@ public class UserThread { out.println(" <div class=\"msg-avatar\"><img src=\"//i.juick.com/av-96.png\"/></div>"); } out.println(" <div class=\"msg-cont\">"); - out.println(" <div class=\"msg-menu\"><a href=\"#\" onclick=\"showMessageLinksDialog(" + msg.getMID() + "," + msg.getRID() + "); return false\"></a></div>"); + out.println(" <div class=\"msg-menu\"><a href=\"#\" class=\"a-thread-links\"></a></div>"); if (!msg.getUser().Banned) { out.println(" <div class=\"msg-header\"><a href=\"/" + msg.getUser().getUName() + "/\">@" + msg.getUser().getUName() + "</a>:</div>"); } else { @@ -349,10 +343,10 @@ public class UserThread { out.print(" в ответ на <a href=\"#" + msg.ReplyTo + "\">/" + msg.ReplyTo + "</a>"); } if (msg.VisitorCanComment) { - out.println(" · <a href=\"#\" onclick=\"return showCommentForm(" + msg.getMID() + "," + msg.getRID() + ")\">Ответить</a></div>"); + out.println(" · <a href=\"#\" class=\"a-thread-comment\">Ответить</a></div>"); out.println(" <div class=\"msg-comment\" style=\"display: none\"></div>"); } else if (visitor.getUID() == 0) { - out.println(" <div class=\"msg-links\"><a href=\"#\" onclick=\"return openDialogLogin()\">Ответить</a></div>"); + out.println(" <div class=\"msg-links\"><a href=\"/post?body=%23" + msg.getMID() + "/" + msg.getRID() + "%20\" class=\"a-thread-comment\">Ответить</a></div>"); } out.println(" </div>"); out.println(" </li>"); diff --git a/juick-www/src/main/java/ru/sape/SapePageLinks.java b/juick-www/src/main/java/ru/sape/SapePageLinks.java index 498aeac0..458358b8 100644 --- a/juick-www/src/main/java/ru/sape/SapePageLinks.java +++ b/juick-www/src/main/java/ru/sape/SapePageLinks.java @@ -1,10 +1,6 @@ package ru.sape; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.Map; +import java.util.*; import javax.servlet.http.Cookie; public class SapePageLinks { @@ -28,7 +24,7 @@ public class SapePageLinks { } if (data.containsKey(requestUri)) { - pageLinks = new ArrayList<String>(((Map<Object, String>) data.get(requestUri)).values()); + pageLinks = new ArrayList<>(((Map<Object, String>) data.get(requestUri)).values()); } if (data.containsKey("__sape_new_url__")) { @@ -36,9 +32,9 @@ public class SapePageLinks { Object newUrl = data.get("__sape_new_url__"); if (newUrl instanceof Map) { - pageLinks = new ArrayList<String>(((Map<Object, String>) newUrl).values()); + pageLinks = new ArrayList<>(((Map<Object, String>) newUrl).values()); } else { - pageLinks = new ArrayList<String>(Arrays.asList((String) newUrl)); + pageLinks = new ArrayList<>(Collections.singletonList((String) newUrl)); } } } @@ -46,7 +42,7 @@ public class SapePageLinks { this.showCode = showCode; } private String linkDelimiter = "."; - private List<String> pageLinks = new ArrayList<String>(); + private List<String> pageLinks = new ArrayList<>(); public String render() { return render(-1); |