aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2014-02-23 12:11:58 +0700
committerGravatar Ugnich Anton2014-02-23 12:11:58 +0700
commite67f01bb08125eae47c42965367dc96624e5f146 (patch)
tree416e60dc467ce78ec8584eda222c99204c4958a1
parent4c5feeaf06e2f160bd75bf1919cb9920835efc87 (diff)
isMobileRequest
-rw-r--r--src/java/com/juick/http/www/Discover.java11
-rw-r--r--src/java/com/juick/http/www/Home.java11
-rw-r--r--src/java/com/juick/http/www/NewMessage.java10
-rw-r--r--src/java/com/juick/http/www/PM.java11
-rw-r--r--src/java/com/juick/http/www/PageTemplates.java4
-rw-r--r--src/java/com/juick/http/www/User.java40
-rw-r--r--src/java/com/juick/http/www/UserThread.java10
-rw-r--r--src/java/com/juick/http/www/Utils.java5
-rw-r--r--web/style3.css2
9 files changed, 81 insertions, 23 deletions
diff --git a/src/java/com/juick/http/www/Discover.java b/src/java/com/juick/http/www/Discover.java
index 1db264f7..1ba6992a 100644
--- a/src/java/com/juick/http/www/Discover.java
+++ b/src/java/com/juick/http/www/Discover.java
@@ -73,9 +73,11 @@ public class Discover {
canonical = "<link rel=\"canonical\" href=\"http://juick.com/tag/" + URLEncoder.encode(paramTag.Name, "UTF-8") + "\"/>";
}
PageTemplates.pageHead(out, title, canonical);
- PageTemplates.pageNavigation(out, visitor, null);
- PageTemplates.pageHomeColumn(out, sql, visitor);
+ if (!Utils.isMobileRequest(request)) {
+ PageTemplates.pageNavigation(out, visitor, null);
+ PageTemplates.pageHomeColumn(out, sql, visitor);
+ }
out.println("<section id=\"content\">");
@@ -90,7 +92,10 @@ public class Discover {
out.println("</section>");
- PageTemplates.pageFooter(request, out, visitor, true);
+ if (!Utils.isMobileRequest(request)) {
+ PageTemplates.pageFooter(request, out, visitor, true);
+ }
+
PageTemplates.pageDialogTemplate(out);
PageTemplates.pageEnd(out);
} finally {
diff --git a/src/java/com/juick/http/www/Home.java b/src/java/com/juick/http/www/Home.java
index 1319a135..75eeb941 100644
--- a/src/java/com/juick/http/www/Home.java
+++ b/src/java/com/juick/http/www/Home.java
@@ -91,9 +91,11 @@ public class Home {
PrintWriter out = response.getWriter();
try {
PageTemplates.pageHead(out, title, null);
- PageTemplates.pageNavigation(out, visitor, paramSearch);
- PageTemplates.pageHomeColumn(out, sql, visitor);
+ if (!Utils.isMobileRequest(request)) {
+ PageTemplates.pageNavigation(out, visitor, paramSearch);
+ PageTemplates.pageHomeColumn(out, sql, visitor);
+ }
out.println("<section id=\"content\">");
@@ -135,7 +137,10 @@ public class Home {
out.println("</section>");
- PageTemplates.pageFooter(request, out, visitor, true);
+ if (!Utils.isMobileRequest(request)) {
+ PageTemplates.pageFooter(request, out, visitor, true);
+ }
+
PageTemplates.pageDialogTemplate(out);
PageTemplates.pageEnd(out);
} finally {
diff --git a/src/java/com/juick/http/www/NewMessage.java b/src/java/com/juick/http/www/NewMessage.java
index 2c8aed9c..895bfe91 100644
--- a/src/java/com/juick/http/www/NewMessage.java
+++ b/src/java/com/juick/http/www/NewMessage.java
@@ -43,7 +43,10 @@ public class NewMessage {
+ "<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>");
- PageTemplates.pageNavigation(out, visitor, null);
+
+ if (!Utils.isMobileRequest(request)) {
+ PageTemplates.pageNavigation(out, visitor, null);
+ }
out.println("<section id=\"content\" class=\"pagetext\">");
out.println("<form action=\"/post\" method=\"post\" id=\"postmsg\" enctype=\"multipart/form-data\">");
@@ -68,7 +71,10 @@ public class NewMessage {
printUserTags(sql, out, visitor);
out.println("</section>");
- PageTemplates.pageFooter(request, out, visitor, false);
+ if (!Utils.isMobileRequest(request)) {
+ PageTemplates.pageFooter(request, out, visitor, false);
+ }
+
PageTemplates.pageEnd(out);
} finally {
out.close();
diff --git a/src/java/com/juick/http/www/PM.java b/src/java/com/juick/http/www/PM.java
index 6d8e04ba..8dbe1036 100644
--- a/src/java/com/juick/http/www/PM.java
+++ b/src/java/com/juick/http/www/PM.java
@@ -56,9 +56,11 @@ public class PM {
PrintWriter out = response.getWriter();
try {
PageTemplates.pageHead(out, title, null);
- PageTemplates.pageNavigation(out, visitor, null);
- PageTemplates.pageHomeColumn(out, sql, visitor);
+ if (!Utils.isMobileRequest(request)) {
+ PageTemplates.pageNavigation(out, visitor, null);
+ PageTemplates.pageHomeColumn(out, sql, visitor);
+ }
out.println("<section id=\"content\">");
@@ -95,7 +97,10 @@ public class PM {
out.println("</section>");
- PageTemplates.pageFooter(request, out, visitor, true);
+ if (!Utils.isMobileRequest(request)) {
+ PageTemplates.pageFooter(request, out, visitor, true);
+ }
+
PageTemplates.pageDialogTemplate(out);
PageTemplates.pageEnd(out);
} finally {
diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java
index 228cff91..c76ded41 100644
--- a/src/java/com/juick/http/www/PageTemplates.java
+++ b/src/java/com/juick/http/www/PageTemplates.java
@@ -52,9 +52,9 @@ public class PageTemplates {
out.println("<!DOCTYPE html>");
out.print("<html>");
out.print("<head>");
- out.print("<link rel=\"stylesheet\" href=\"/style.2014021500.css\"/>");
+ out.print("<link rel=\"stylesheet\" href=\"/style.2014022100.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=\"/scripts.2014021400.js\" defer=\"defer\"></script>");
+ out.print("<script type=\"text/javascript\" src=\"/scripts.2014021500.js\" defer=\"defer\"></script>");
if (headers != null) {
out.print(headers);
}
diff --git a/src/java/com/juick/http/www/User.java b/src/java/com/juick/http/www/User.java
index 1e469a1d..c673edbd 100644
--- a/src/java/com/juick/http/www/User.java
+++ b/src/java/com/juick/http/www/User.java
@@ -109,7 +109,10 @@ public class User {
PrintWriter out = response.getWriter();
try {
PageTemplates.pageHead(out, title, "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"@" + user.UName + "\" href=\"//rss.juick.com/" + user.UName + "/blog\"/>");
- PageTemplates.pageNavigation(out, visitor, null);
+
+ if (!Utils.isMobileRequest(request)) {
+ PageTemplates.pageNavigation(out, visitor, null);
+ }
pageUserColumn(out, sql, user, visitor);
@@ -134,7 +137,10 @@ public class User {
out.println("</section>");
}
- PageTemplates.pageFooter(request, out, visitor, true);
+ if (!Utils.isMobileRequest(request)) {
+ PageTemplates.pageFooter(request, out, visitor, true);
+ }
+
PageTemplates.pageDialogTemplate(out);
PageTemplates.pageEnd(out);
} finally {
@@ -149,7 +155,10 @@ public class User {
PrintWriter out = response.getWriter();
try {
PageTemplates.pageHead(out, "Теги " + user.UName, null);
- PageTemplates.pageNavigation(out, visitor, null);
+
+ if (!Utils.isMobileRequest(request)) {
+ PageTemplates.pageNavigation(out, visitor, null);
+ }
pageUserColumn(out, sql, user, visitor);
@@ -157,7 +166,10 @@ public class User {
out.println("<p>" + pageUserTags(sql, user, visitor, 0) + "</p>");
out.println("</section>");
- PageTemplates.pageFooter(request, out, visitor, false);
+ if (!Utils.isMobileRequest(request)) {
+ PageTemplates.pageFooter(request, out, visitor, false);
+ }
+
PageTemplates.pageDialogTemplate(out);
PageTemplates.pageEnd(out);
} finally {
@@ -172,7 +184,10 @@ public class User {
PrintWriter out = response.getWriter();
try {
PageTemplates.pageHead(out, "Подписки " + user.UName, null);
- PageTemplates.pageNavigation(out, visitor, null);
+
+ if (!Utils.isMobileRequest(request)) {
+ PageTemplates.pageNavigation(out, visitor, null);
+ }
pageUserColumn(out, sql, user, visitor);
@@ -203,7 +218,10 @@ public class User {
out.println("</tr></table>");
out.println("</section>");
- PageTemplates.pageFooter(request, out, visitor, false);
+ if (!Utils.isMobileRequest(request)) {
+ PageTemplates.pageFooter(request, out, visitor, false);
+ }
+
PageTemplates.pageDialogTemplate(out);
PageTemplates.pageEnd(out);
} finally {
@@ -218,7 +236,10 @@ public class User {
PrintWriter out = response.getWriter();
try {
PageTemplates.pageHead(out, "Читатели " + user.UName, null);
- PageTemplates.pageNavigation(out, visitor, null);
+
+ if (!Utils.isMobileRequest(request)) {
+ PageTemplates.pageNavigation(out, visitor, null);
+ }
pageUserColumn(out, sql, user, visitor);
@@ -249,7 +270,10 @@ public class User {
out.println("</tr></table>");
out.println("</section>");
- PageTemplates.pageFooter(request, out, visitor, false);
+ if (!Utils.isMobileRequest(request)) {
+ PageTemplates.pageFooter(request, out, visitor, false);
+ }
+
PageTemplates.pageDialogTemplate(out);
PageTemplates.pageEnd(out);
} finally {
diff --git a/src/java/com/juick/http/www/UserThread.java b/src/java/com/juick/http/www/UserThread.java
index 095612d7..cf1ae76a 100644
--- a/src/java/com/juick/http/www/UserThread.java
+++ b/src/java/com/juick/http/www/UserThread.java
@@ -64,15 +64,21 @@ public class UserThread {
PrintWriter out = response.getWriter();
try {
PageTemplates.pageHead(out, title, "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"@" + msg.User.UName + "\" href=\"//rss.juick.com/" + msg.User.UName + "/blog\"/>");
- PageTemplates.pageNavigation(out, visitor, null);
+
+ if (!Utils.isMobileRequest(request)) {
+ PageTemplates.pageNavigation(out, visitor, null);
+ }
out.println("<section id=\"content\" style=\"margin-left: 0; width: 100%\">");
printMessage(out, sql, msg, visitor);
printReplies(out, sql, msg, visitor, listview);
out.println("</section>");
+ if (!Utils.isMobileRequest(request)) {
+ PageTemplates.pageFooter(request, out, visitor, false);
+ }
+
PageTemplates.pageDialogTemplate(out);
- PageTemplates.pageFooter(request, out, visitor, false);
PageTemplates.pageEnd(out);
} finally {
out.close();
diff --git a/src/java/com/juick/http/www/Utils.java b/src/java/com/juick/http/www/Utils.java
index 35b918b8..66450acd 100644
--- a/src/java/com/juick/http/www/Utils.java
+++ b/src/java/com/juick/http/www/Utils.java
@@ -61,6 +61,11 @@ public class Utils {
}
}
+ public static boolean isMobileRequest(HttpServletRequest request) {
+ String ua = request.getHeader("User-Agent");
+ return ua != null && ua.contains(" Juick/");
+ }
+
public static void sendTemporaryRedirect(HttpServletResponse response, String location) {
response.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
response.setHeader("Location", location);
diff --git a/web/style3.css b/web/style3.css
index 7ff489f2..1c13fab7 100644
--- a/web/style3.css
+++ b/web/style3.css
@@ -174,6 +174,8 @@ blockquote { border-left: 1px dashed #CCC; margin: 10px 0 10px 10px; padding-lef
article textarea { width: 205px; }
article footer { float: left; }
+ #content textarea { width: 100%; }
+
.msg,.msg-cont { width: auto; min-width: 280px; }
.msg-cont,.ads { margin-left: 0; }
.msg-avatar { margin: 10px 10px 0 10px; width: 40px; height: 40px; }