aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2013-04-14 06:38:03 +0700
committerGravatar Ugnich Anton2013-04-14 06:38:03 +0700
commit3692155bcddc13886bbbc0fd89bb4a4e3a24c88d (patch)
tree814753be28a156559d38d09c5f9b3e0fab832f47
parent29150ebc65d0d4cf90da3f437999395a86609504 (diff)
HTML/CSS optimization
-rw-r--r--src/java/com/juick/http/www/Login.java11
-rw-r--r--src/java/com/juick/http/www/PageTemplates.java24
-rw-r--r--src/java/com/juick/http/www/UserThread.java6
-rw-r--r--web/scripts3.js14
-rw-r--r--web/style3.css7
5 files changed, 25 insertions, 37 deletions
diff --git a/src/java/com/juick/http/www/Login.java b/src/java/com/juick/http/www/Login.java
index 7ad921e0..f693b97c 100644
--- a/src/java/com/juick/http/www/Login.java
+++ b/src/java/com/juick/http/www/Login.java
@@ -91,12 +91,6 @@ public class Login {
Cookie c = new Cookie("hash", hash);
c.setMaxAge(365 * 24 * 60 * 60);
response.addCookie(c);
-
- Cookie c2 = new Cookie("hash", "-");
- c2.setDomain(".juick.com");
- c2.setMaxAge(0);
- response.addCookie(c2);
-
response.sendRedirect("/");
} else {
response.sendError(403);
@@ -118,11 +112,6 @@ public class Login {
c.setMaxAge(365 * 24 * 60 * 60);
response.addCookie(c);
- Cookie c2 = new Cookie("hash", "-");
- c2.setDomain(".juick.com");
- c2.setMaxAge(0);
- response.addCookie(c2);
-
String referer = request.getHeader("Referer");
if (referer != null && referer.startsWith("http://juick.com/") && !referer.equals("http://juick.com/login")) {
response.sendRedirect(referer);
diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java
index 16e7818c..b5b187a0 100644
--- a/src/java/com/juick/http/www/PageTemplates.java
+++ b/src/java/com/juick/http/www/PageTemplates.java
@@ -49,20 +49,20 @@ public class PageTemplates {
public static void pageHead(PrintWriter out, String title, String headers) {
out.println("<!DOCTYPE html>");
- out.println("<html>");
- out.println("<head>");
- out.println(" <title>" + title + "</title>");
- out.println(" <link rel=\"stylesheet\" href=\"//static.juick.com/style3.2013032901.css\"/>");
- out.println(" <link rel=\"icon\" type=\"image/png\" href=\"//static.juick.com/favicon.png\"/>");
- out.println(" <script type=\"text/javascript\" src=\"//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js\" defer=\"defer\"></script>");
- out.println(" <script type=\"text/javascript\" src=\"//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js\" defer=\"defer\" async=\"async\"></script>");
- out.println(" <script type=\"text/javascript\" src=\"//static.juick.com/scripts3.2013032900.js\" defer=\"defer\"></script>");
+ out.print("<html>");
+ out.print("<head>");
+ out.print("<link rel=\"stylesheet\" href=\"/style.2013041001.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.2013032900.js\" defer=\"defer\"></script>");
if (headers != null) {
- out.println(headers);
+ out.print(headers);
}
- out.println(" <meta name=\"viewport\" content=\"width=device-width,initial-scale=1,user-scalable=no\"/>");
+ out.print("<title>" + title + "</title>");
+ out.print("<meta name=\"viewport\" content=\"width=device-width,initial-scale=1,user-scalable=no\"/>");
+ out.print("<link rel=\"icon\" href=\"//i.juick.com/favicon.png\"/>");
out.println("</head>");
- out.println();
+ out.flush();
out.println("<body>");
}
@@ -428,7 +428,7 @@ public class PageTemplates {
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-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\"><img src=\"http://static.juick.com/message-menu-icon.png\" alt=\"\"/></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><a href=\"#\" onclick=\"showMessageLinksDialog(" + msg.MID + "); return false\" class=\"msg-menu\"></a></div>");
if (msg.Place != null) {
out.println(" <div class=\"msg-place\"><a href=\"/places/" + msg.Place.pid + "\">" + msg.Place.name + "</a></div>");
}
diff --git a/src/java/com/juick/http/www/UserThread.java b/src/java/com/juick/http/www/UserThread.java
index aba97a85..22914e54 100644
--- a/src/java/com/juick/http/www/UserThread.java
+++ b/src/java/com/juick/http/www/UserThread.java
@@ -126,7 +126,7 @@ public class UserThread {
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-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\"><img src=\"http://static.juick.com/message-menu-icon.png\" alt=\"\"/></a></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) {
out.println(" <div class=\"msg-place\"><a href=\"/places/" + msg.Place.pid + "\">" + msg.Place.name + "</a></div>");
}
@@ -303,7 +303,7 @@ public class UserThread {
}
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\"><img src=\"http://static.juick.com/message-menu-icon.png\" alt=\"\"/></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>");
@@ -342,7 +342,7 @@ public class UserThread {
}
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\"><img src=\"http://static.juick.com/message-menu-icon.png\" alt=\"\"/></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) {
diff --git a/web/scripts3.js b/web/scripts3.js
index f4a21da3..e1cc5952 100644
--- a/web/scripts3.js
+++ b/web/scripts3.js
@@ -108,17 +108,15 @@ function checkUsername() {
/******************************************************************************/
jQuery.fn.selectText = function(){
- var doc = document;
- var element = this[0];
- console.log(this, element);
- if (doc.body.createTextRange) {
- var range = document.body.createTextRange();
- range.moveToElementText(element);
+ var d = document;
+ if (d.body.createTextRange) {
+ var range = d.body.createTextRange();
+ range.moveToElementText(this[0]);
range.select();
} else if (window.getSelection) {
var selection = window.getSelection();
- var range = document.createRange();
- range.selectNodeContents(element);
+ var range = d.createRange();
+ range.selectNodeContents(this[0]);
selection.removeAllRanges();
selection.addRange(range);
}
diff --git a/web/style3.css b/web/style3.css
index 4a79e4ed..db4efd7f 100644
--- a/web/style3.css
+++ b/web/style3.css
@@ -23,7 +23,8 @@ pre { white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap;
#header img { max-width: 32px; max-height: 32px; vertical-align: middle; margin-right: 4px; }
#header label { cursor: pointer; }
-.head-ico { width: 32px; height: 32px; background: url(//static.juick.com/head-ico-24.png) no-repeat; display: inline-block; vertical-align: middle; margin-bottom: 2px; }
+.head-ico { width: 32px; height: 32px; display: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lpK0fztExm8VczlZBditcV4KE0LjbR5N5w3fjsdt1ZRI4EKSIxPS84lFXxWMnSPpS3qqwNbhbHrQv0mmpu9a53zEzGXg1PZUpquoBvHio2XTWih9wy1XVHqAxwRcD0TykiYxeXrYC/QgeXZbPJTkCslsrjGUBZJ+BbAbGvHf4/NfHnC2717gtgQwC5NvqjWMRptEe/RzNdPehQe4Tk/QBwNxtlNw/0TXPztYjz9vvs+W9+EZY/aDtdvgl+vW8YVoNd7230M5pOQxmZHmgttL48LlZwmRxP9qSw3FrykoJm37oaiwrnY4KSjNrvmvZXc9jzSRvZ4u1lcvvZ4q4P9PFGQp9t4/MchVSRtt/+1mh/bMlonCLVca/PTK4Pfdbtu9qKeCwWX3QELwPLTq3JdKArmnbt7j+8+tBn2yY5s1tFTr+j5Zo+YmdL1+X2s2Gu6aOI6+KJlrk5/m+S+0yfU/sX6duvvdmCePkAAAAASUVORK5CYII=") no-repeat; }
#hi-logo { width: 110px; margin: 0 28px; }
#hi-post { background-position: -142px 0; margin: 0 5px 0 -5px; }
#hi-settings { background-position: -174px 0; }
@@ -45,8 +46,8 @@ pre { white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap;
.msg-avatar img { width: 48px; height: 48px; vertical-align: top; }
.msg-ts { float: right; font-size: small; vertical-align: top; }
.msg-ts, .msg-ts>a { color: #999; }
-.msg-menu { margin: 0 0 0 6px; padding: 2px 0; }
-.msg-menu img { vertical-align: top; }
+.msg-menu { width: 16px; height: 16px; display: inline-block; vertical-align: top; margin: 0 0 0 6px;
+ background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAAXNSR0IArs4c6QAAALRQTFRFAAAAldX/ncT/ksj/ltL/nMb/lMn/mcz/l9H/lcr/mZmZmcz/m83/mJiYmZmZmcz/mM7/mpqamsr/l8v/m83/mJiYmM7/l8v/mZmZmcz/mpqamMv/mcz/mM3/ms3/msv/mMv/mMz/mcz/msz/mc3/mMz/mcz/msz/mc3/mcv/mc3/mcv/mcz/mcz/mcz/mcz/mZmZmZmZmcz/mcz/mcz/mcz/mcz/mcz/mcz/mcz/mcz/mZmZiZsGCAAAADx0Uk5TAAwNDhESExQWGC0tLi8yMjQ1NTY4OTk7PDxESktNUVNUd3h5eoGCg4mKmMvMzc7P29zd3uLj7O3u8vT2+A5wCAAAAJFJREFUGBkFwQlCgkAAAMDRxEySkryyzDxSAc+gkvX//2oGAAB42J5COG46AJ+/+SiKxvl1DsyqJyCtZnBXxgDxdxPrHQDZCvvUNIFkalAgtCSXHr1LIqpRt+ifu91zn6hG8YLh7TbEoMAyg8kEsgWaZQzwWDbgvXoG0p83YH7Nx+32a/73AdDZHEIovu4BAMA/t6QMuyHliCkAAAAASUVORK5CYII=") no-repeat; }
.msg-header { float: left; margin: 0 0 8px 10px; max-width: 350px; overflow: hidden; }
.msg-place { clear: both; font-size: small; margin: 8px 0 8px 58px; }
.msg-place>a { color: #999; }