diff options
author | Ugnich Anton | 2012-10-23 01:44:58 +0700 |
---|---|---|
committer | Ugnich Anton | 2012-10-23 01:44:58 +0700 |
commit | 9b94011a09685dec1b1b38fef8294c6ffa578079 (patch) | |
tree | ab6808f9f10a29628d9bb93905b1fcd3c2887b43 /src/java/com/juick/http | |
parent | adfc38138808eede6bcc29a706c9191e7d2d84fe (diff) |
JS/CSS optimization
Diffstat (limited to 'src/java/com/juick/http')
-rw-r--r-- | src/java/com/juick/http/www/PageTemplates.java | 14 | ||||
-rw-r--r-- | src/java/com/juick/http/www/UserThread.java | 26 |
2 files changed, 11 insertions, 29 deletions
diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java index a38b90f8..567bc639 100644 --- a/src/java/com/juick/http/www/PageTemplates.java +++ b/src/java/com/juick/http/www/PageTemplates.java @@ -54,12 +54,11 @@ public class PageTemplates { out.println("<head>"); out.println(" <meta charset=\"utf-8\"/>"); out.println(" <title>" + title + "</title>"); - out.println(" <link rel=\"stylesheet\" href=\"http://static.juick.com/style3.css?2012030601\"/>"); + out.println(" <link rel=\"stylesheet\" href=\"http://static.juick.com/style3.2012102203.css\"/>"); out.println(" <link rel=\"icon\" type=\"image/png\" href=\"http://static.juick.com/favicon.png\"/>"); - out.println(" <script type=\"text/javascript\" src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js\"></script>"); - out.println(" <script type=\"text/javascript\" src=\"https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js\"></script>"); - out.println(" <script type=\"text/javascript\" src=\"http://static.juick.com/scripts3.js?20120306\"></script>"); - out.println(" <script type=\"text/javascript\" src=\"http://static.juick.com/js/jquery.autoresize.js\"></script>"); + out.println(" <script type=\"text/javascript\" src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js\" defer=\"defer\"></script>"); + out.println(" <script type=\"text/javascript\" src=\"https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js\" defer=\"defer\" async=\"async\"></script>"); + out.println(" <script type=\"text/javascript\" src=\"http://static.juick.com/scripts3.2012102203.js\" defer=\"defer\"></script>"); if (headers != null) { out.println(headers); } @@ -332,10 +331,7 @@ public class PageTemplates { if (rs.getString(12).equals("jpg")) { out.println(" <div class=\"msg-media\"><a href=\"http://i.juick.com/photos-1024/" + mid + ".jpg\"><img src=\"http://i.juick.com/photos-512/" + mid + ".jpg\" alt=\"\"/></a></div>"); } else { - out.println(" <div class=\"msg-media\"><div id=\"video-" + mid + "\"><b>Attachment: <a href=\"http://i.juick.com/video/" + mid + ".mp4\">Video</a></b></div></div>"); - out.println(" <script type=\"text/javascript\">"); - out.println(" inlinevideo(" + mid + ");"); - out.println(" </script>"); + out.println(" <div class=\"msg-media\"><div id=\"video-" + mid + "\"><a href=\"http://i.juick.com/video/" + mid + ".mp4\" onclick=\"inlinevideo(" + mid + "); return false\"><img src=\"http://i.juick.com/thumbs/" + mid + ".jpg\" alt=\"\"/></a></div></div>"); } } diff --git a/src/java/com/juick/http/www/UserThread.java b/src/java/com/juick/http/www/UserThread.java index 320c62ba..c335fcb9 100644 --- a/src/java/com/juick/http/www/UserThread.java +++ b/src/java/com/juick/http/www/UserThread.java @@ -83,11 +83,6 @@ public class UserThread { out.println("</div>"); out.println("</div>"); // topwrapper - out.println("<script type=\"text/javascript\">"); - out.println("$(document).ready(unfoldReply);"); - out.println("$(window).bind('hashchange',unfoldReply);"); - out.println("</script>"); - PageTemplates.pageFooter(request, out, locale, visitor); } finally { out.close(); @@ -150,16 +145,13 @@ public class UserThread { if (rs.getString(11).equals("jpg")) { out.println(" <div class=\"msg-media\"><a href=\"http://i.juick.com/p/" + mid + ".jpg\"><img src=\"http://i.juick.com/photos-512/" + mid + ".jpg\" alt=\"\"/></a></div>"); } else { - out.println(" <div class=\"msg-media\"><div id=\"video-" + mid + "\"><b>Attachment: <a href=\"http://i.juick.com/video/" + mid + ".mp4\">Video</a></b></div></div>"); - out.println(" <script type=\"text/javascript\">"); - out.println(" inlinevideo(" + mid + ");"); - out.println(" </script>"); + out.println(" <div class=\"msg-media\"><div id=\"video-" + mid + "\"><a href=\"http://i.juick.com/video/" + mid + ".mp4\" onclick=\"inlinevideo(" + mid + "); return false\"><img src=\"http://i.juick.com/thumbs/" + mid + ".jpg\" alt=\"\"/></a></div></div>"); } } if (cancomment) { out.println(" <form action=\"/post\" method=\"POST\" enctype=\"multipart/form-data\"><input type=\"hidden\" name=\"mid\" value=\"" + mid + "\"/>"); - 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(" <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>"); } @@ -238,10 +230,10 @@ public class UserThread { if (listview) { out.print("<a href=\"?view=tree\">" + rbuser.getString("View as tree") + "</a>"); } else { - out.print("<a href=\"#\" onclick=\"$('#replies>li').show(); $('#replies .msg-comments').hide(); return false\">" + rbuser.getString("Expand all") + "</a> · <a href=\"?view=list\">" + rbuser.getString("View as list") + "</a>"); + out.print("<span id=\"unfoldall\"><a href=\"#\" onclick=\"$('#replies>li').show(); $('#replies .msg-comments').hide(); $('#unfoldall').hide(); return false\">" + rbuser.getString("Expand all") + "</a> · </span><a href=\"?view=list\">" + rbuser.getString("View as list") + "</a>"); } out.print("</div>"); - out.println(" <h2>"+rbuser.getString("Replies")+" (" + replies.size() + ")</h2>"); + out.println(" <h2>" + rbuser.getString("Replies") + " (" + replies.size() + ")</h2>"); out.println("</div>"); out.println("<ul id=\"replies\">"); @@ -282,10 +274,7 @@ public class UserThread { if (msg.AttachmentType.equals("jpg")) { out.println(" <div class=\"msg-media\"><img src=\"http://i.juick.com/photos-512/" + msg.MID + "-" + msg.RID + ".jpg\" alt=\"\"/></div>"); } else { - out.println(" <div class=\"msg-media\"><div id=\"video-" + msg.MID + "-" + msg.RID + "\"><b>Attachment: <a href=\"http://i.juick.com/video/" + msg.MID + "-" + msg.RID + ".mp4\">Video</a></b></div></div>"); - out.println(" <script type=\"text/javascript\">"); - out.println(" inlinevideo('" + msg.MID + "-" + msg.RID + "');"); - out.println(" </script>"); + out.println(" <div class=\"msg-media\"><div id=\"video-" + msg.MID + "-" + msg.RID + "\"><a href=\"http://i.juick.com/video/" + msg.MID + "-" + msg.RID + ".mp4\" onclick=\"inlinevideo(" + msg.MID + "-" + msg.RID + "); return false\"><img src=\"http://i.juick.com/thumbs/" + msg.MID + "-" + msg.RID + ".jpg\" alt=\"\"/></a></div></div>"); } } out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.User.UName + "/\"><img src=\"http://i.juick.com/a/" + msg.User.UID + ".png\" alt=\"" + msg.User.UName + "\"/></a></div>"); @@ -318,10 +307,7 @@ public class UserThread { if (msg.AttachmentType.equals("jpg")) { out.println(" <div class=\"msg-media\"><img src=\"http://i.juick.com/photos-512/" + msg.MID + "-" + msg.RID + ".jpg\" alt=\"\"/></div>"); } else { - out.println(" <div class=\"msg-media\"><div id=\"video-" + msg.MID + "-" + msg.RID + "\"><b>Attachment: <a href=\"http://i.juick.com/video/" + msg.MID + "-" + msg.RID + ".mp4\">Video</a></b></div></div>"); - out.println(" <script type=\"text/javascript\">"); - out.println(" inlinevideo('" + msg.MID + "-" + msg.RID + "');"); - out.println(" </script>"); + out.println(" <div class=\"msg-media\"><div id=\"video-" + msg.MID + "-" + msg.RID + "\"><a href=\"http://i.juick.com/video/" + msg.MID + "-" + msg.RID + ".mp4\" onclick=\"inlinevideo(" + msg.MID + "-" + msg.RID + "); return false\"><img src=\"http://i.juick.com/thumbs/" + msg.MID + "-" + msg.RID + ".jpg\" alt=\"\"/></a></div></div>"); } } out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.User.UName + "/\"><img src=\"http://i.juick.com/a/" + msg.User.UID + ".png\"></a></div>"); |