diff options
author | 2012-12-31 16:33:35 +0700 | |
---|---|---|
committer | 2012-12-31 16:33:35 +0700 | |
commit | ed2f70f338bbed7b608fcc5b07f751d5b99d4f53 (patch) | |
tree | a498f07b87338faeb1ffb11eb81e433f2e7c2876 | |
parent | 6b1dafc1cc3a610fc2aa5c4562fb19e3dd0798f8 (diff) |
Mobile CSS
-rw-r--r-- | src/java/com/juick/http/www/Blogs.java | 2 | ||||
-rw-r--r-- | src/java/com/juick/http/www/Help.java | 2 | ||||
-rw-r--r-- | src/java/com/juick/http/www/PageTemplates.java | 29 | ||||
-rw-r--r-- | src/java/com/juick/http/www/User.java | 2 | ||||
-rw-r--r-- | src/java/com/juick/http/www/UserThread.java | 6 | ||||
-rw-r--r-- | web/scripts3.js | 17 | ||||
-rw-r--r-- | web/style3.css | 76 |
7 files changed, 82 insertions, 52 deletions
diff --git a/src/java/com/juick/http/www/Blogs.java b/src/java/com/juick/http/www/Blogs.java index a84c562c..756088e2 100644 --- a/src/java/com/juick/http/www/Blogs.java +++ b/src/java/com/juick/http/www/Blogs.java @@ -192,7 +192,7 @@ public class Blogs { out.println("</div>"); // wrapper - out.println("<div id=\"column\" class=\"stickya\">"); + out.println("<div id=\"column\" class=\"abs\">"); if (visitor != null) { out.println(" <ul>"); out.println(" <li><a href=\"/?show=my\">" + rb.getString("My feed") + "</a></li>"); diff --git a/src/java/com/juick/http/www/Help.java b/src/java/com/juick/http/www/Help.java index 9954194c..a67b3929 100644 --- a/src/java/com/juick/http/www/Help.java +++ b/src/java/com/juick/http/www/Help.java @@ -84,7 +84,7 @@ public class Help { out.println("</div>"); out.println("</div>"); - out.println("<div id=\"column\" class=\"stickya\">"); + out.println("<div id=\"column\" class=\"abs\">"); printFile(out, new File("/var/www/juick.com/help3/" + path[2] + "/navigation")); out.println("<hr/>"); printFile(out, new File("/var/www/juick.com/help3/langs")); diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java index 4bfbd98d..a22f198e 100644 --- a/src/java/com/juick/http/www/PageTemplates.java +++ b/src/java/com/juick/http/www/PageTemplates.java @@ -55,14 +55,15 @@ public class PageTemplates { out.println("<html>"); out.println("<head>"); out.println(" <title>" + title + "</title>"); - out.println(" <link rel=\"stylesheet\" href=\"//static.juick.com/style3.2012122601.css\"/>"); + out.println(" <link rel=\"stylesheet\" href=\"//static.juick.com/style3.2012123100.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.2012111101.js\" defer=\"defer\"></script>"); + out.println(" <script type=\"text/javascript\" src=\"//static.juick.com/scripts3.2012122701.js\" defer=\"defer\"></script>"); if (headers != null) { out.println(headers); } + out.println(" <meta name=\"viewport\" content=\"width=device-width,initial-scale=1,user-scalable=no\">"); out.println("</head>"); out.println(); out.println("<body>"); @@ -71,22 +72,18 @@ public class PageTemplates { public static void pageNavigation(PrintWriter out, Locale loc, com.juick.User user) { ResourceBundle rb = ResourceBundle.getBundle("Global", loc); out.println("<div id=\"hwrapper\">"); - out.println("<div id=\"header\">"); - out.println(" <div id=\"logo\"><a href=\"" + (user != null ? "/?show=my" : "/") + "\"><img src=\"//static.juick.com/logo3.png\" width=\"120\" height=\"40\" alt=\"Juick\"/></a></div>"); - out.println(" <form action=\"/\">"); - out.println(" <div id=\"search\"><input type=\"text\" name=\"search\" class=\"text\" placeholder=\"" + rb.getString("Search") + "\"/></div>"); - out.println(" </form>"); - out.println(" <ul id=\"nav-right\">"); + out.println("<ul id=\"header\">"); + out.println(" <li id=\"logo\"><a href=\"" + (user != null ? "/?show=my" : "/") + "\"><div class=\"head-ico\" id=\"hi-logo\"></div></a></li>"); + out.println(" <li id=\"search\"><form action=\"/\"><input type=\"text\" name=\"search\" class=\"text\" placeholder=\"" + rb.getString("Search") + "\"/></form></li>"); if (user != null) { - out.println(" <li><a href=\"/post\" class=\"wide\">" + rb.getString("Post") + "</a></li>"); - out.println(" <li><a href=\"/" + user.UName + "\" class=\"wide\"><img src=\"//i.juick.com/as/" + user.UID + ".png\" alt=\"" + user.UName + "\"/>" + user.UName + "</a></li>"); - out.println(" <li><a href=\"/settings\"><div class=\"ico24\" style=\"background-position: 0 11px\"></div></a></li>"); - out.println(" <li><a href=\"/logout\"><div class=\"ico24\" style=\"background-position: -24px 11px\"></div></a></li>"); + out.println(" <li class=\"right\"><a href=\"/logout\"><div class=\"head-ico\" id=\"hi-logout\"></div></a></li>"); + out.println(" <li class=\"right\"><a href=\"/settings\"><div class=\"head-ico\" id=\"hi-settings\"></div></a></li>"); + out.println(" <li class=\"right\"><a href=\"/" + user.UName + "\" class=\"wide\"><img src=\"//i.juick.com/as/" + user.UID + ".png\" alt=\"" + user.UName + "\"/><label>" + user.UName + "</label></a></li>"); + out.println(" <li class=\"right\"><a href=\"/post\" class=\"wide\"><div class=\"head-ico\" id=\"hi-post\"></div><label>" + rb.getString("Post") + "</label></a></li>"); } else { - out.println(" <li><a href=\"/login\" class=\"wide\">" + rb.getString("Login") + "</a></li>"); + out.println(" <li class=\"right\"><a href=\"/login\" class=\"wide\">" + rb.getString("Login") + "</a></li>"); } - out.println(" </ul>"); - out.println("</div>"); + out.println("</ul>"); out.println("</div>"); } /* @@ -347,8 +344,8 @@ 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-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-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>"); 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/User.java b/src/java/com/juick/http/www/User.java index 3ebbdc80..03d50059 100644 --- a/src/java/com/juick/http/www/User.java +++ b/src/java/com/juick/http/www/User.java @@ -278,7 +278,7 @@ public class User { public static void pageUserColumn(PrintWriter out, Connection sql, com.juick.User user, com.juick.User visitor, Locale locale) { ResourceBundle rb = ResourceBundle.getBundle("User", locale); - out.println("<div id=\"column\" class=\"stickya\">"); + out.println("<div id=\"column\" class=\"abs\">"); out.println(" <div id=\"ctitle\"><a href=\"./\"><img src=\"//i.juick.com/as/" + user.UID + ".png\" alt=\"\"/>" + user.UName + "</a></div>"); if (visitor != null && visitor.UID > 0 && visitor.UID != user.UID) { out.println(" <ul id=\"ctoolbar\">"); diff --git a/src/java/com/juick/http/www/UserThread.java b/src/java/com/juick/http/www/UserThread.java index 18ae4d9a..38c08ef8 100644 --- a/src/java/com/juick/http/www/UserThread.java +++ b/src/java/com/juick/http/www/UserThread.java @@ -117,8 +117,8 @@ public class UserThread { out.println("<ul>"); 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-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-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>"); if (msg.Place != null) { out.println(" <div class=\"msg-place\"><a href=\"/places/" + msg.Place.pid + "\">" + msg.Place.name + "</a></div>"); } @@ -297,8 +297,8 @@ 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-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-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-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>"); @@ -336,8 +336,8 @@ 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-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-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-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 a1afb433..8a33351e 100644 --- a/web/scripts3.js +++ b/web/scripts3.js @@ -386,16 +386,19 @@ $(document).ready(function() { $(this).off('click'); }); - if(!!$('.stickya').offset()) { - var stickyTop = $('.stickya').offset().top; + if(!!$('#column').offset()) { + var stickyTop = $('#column').offset().top; $(window).scroll(function() { var windowTop = $(window).scrollTop(); + var column=$('#column'); if (stickyTop < windowTop) { - $('.stickya').css({ - position:'fixed' - }); - } else { - $('.stickya').css('position','absolute'); + if(column.hasClass('fix')==false) { + column.removeClass('abs'); + column.addClass('fix'); + } + } else if(column.hasClass('fix')==true) { + column.removeClass('fix'); + column.addClass('abs'); } }); } diff --git a/web/style3.css b/web/style3.css index 23a6d124..8e8e82e8 100644 --- a/web/style3.css +++ b/web/style3.css @@ -12,25 +12,23 @@ hr { height: 1px; background: #CCC; } /********/ -#hwrapper { width: 100%; background: #333; } -#header { height: 48px; } -#logo { float: left; margin: 3px 0 0 30px; } -#header a { font-size: 18px; } - -#search { float: left; margin: 10px 0 0 51px; } -#search .text { width: 285px; padding: 4px; border: none; background: #EEE; } - -#nav-right { float: right; } -#nav-right li { float: left; } -#nav-right a { display: block; line-height: 48px; padding: 0 15px; color: #AAA; } -#nav-right a:hover { background: #444; } -#nav-right .wide { padding: 0 20px; } -#nav-right img { max-width: 32px; max-height: 32px; vertical-align: middle; margin: 0 4px 0 0; } -#nav-right .ico24 { width: 24px; height: 24px; padding: 12px 0; background: url(//static.juick.com/icons24.png) no-repeat; } +#hwrapper { float: left; width: 100%; background: #333; padding-bottom: 2px; } +#header li { float: left; line-height: 48px; } +#header .text { margin-left: 15px; width: 285px; padding: 4px; border: none; background: #EEE; } +#header>.right { float: right; } +#header a { display: block; font-size: 18px; padding: 0 10px; color: #AAA; } +#header .wide { padding: 0 20px; } +#header img { max-width: 32px; max-height: 32px; vertical-align: middle; margin-right: 4px; } + +.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; } +#hi-logo { width: 110px; margin: 0 28px; } +#hi-post { background-position: -142px 0; margin: 0 5px 0 -5px; } +#hi-settings { background-position: -174px 0; } +#hi-logout { background-position: -206px 0; } /********/ -#topwrapper { position: relative; } +#topwrapper { position: relative; clear: both; } #wrapper { width: 100%; float: left; } /********/ @@ -39,16 +37,16 @@ hr { height: 1px; background: #CCC; } .msg { padding: 15px; margin: 8px 0 16px 0; width: 570px; border: 1px solid #EEE; background: #FFF; } .msgthread { margin-bottom: 0; border-bottom-color: #CCC; } -.msg-avatar { float: left; } +.msg-avatar { float: left; height: 1px; overflow: visible; } .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-header { margin-left: 58px; overflow: hidden; } -.msg-place { font-size: small; margin: 8px 0 8px 58px; } +.msg-header { float: left; margin: 0 0 8px 10px; overflow: hidden; } +.msg-place { clear: both; font-size: small; margin: 8px 0 8px 58px; } .msg-place>a { color: #999; } -.msg-txt { margin: 8px 0 8px 58px; overflow: hidden; } +.msg-txt { clear: both; margin: 8px 0 8px 58px; overflow: hidden; } .msg-media { text-align: center; margin: 8px 0 0px 58px; } .msg-links { font-size: small; margin: 8px 0 0 68px; color: #999; } .msg-comments { margin: 8px 0 0 58px; padding: 5px 0 0 10px; overflow: hidden; font-size: small; border-top: 1px solid #DDD; color: #AAA; } @@ -77,7 +75,7 @@ hr { height: 1px; background: #CCC; } /********/ -#column { width: 185px; position: absolute; top: 0; padding-top: 10px; overflow: hidden; } +#column { width: 185px; top: 0; padding-top: 10px; overflow: hidden; } #column ul, #column p, #column hr { margin: 10px 0; } #column li { margin: 6px 0; } #column p { font-size: small; line-height: 140%; } @@ -89,6 +87,8 @@ hr { height: 1px; background: #CCC; } #ctoolbar a { padding: 5px 10px;} #ctoolbar div { display: inline-block; width: 16px; height: 16px; background: url(//static.juick.com/toolbar-icons.png) no-repeat; vertical-align: middle; margin: 5px 0; } #ustats li { margin: 3px 0; font-size: smaller; } +.abs { position: absolute; } +.fix { position: fixed; } /********/ @@ -96,8 +96,8 @@ hr { height: 1px; background: #CCC; } /********/ -#dialogb { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; opacity: 0.5; background: #000; } -#dialogw { display: none; position: fixed; top: 40%; left: 30%; width: 350px; padding: 20px; background: #EEEEE5; border: 1px solid #999; } +#dialogb { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; opacity: 0.5; background: #000; z-index: 10; } +#dialogw { display: none; position: fixed; top: 40%; left: 30%; width: 350px; padding: 20px; background: #EEEEE5; border: 1px solid #999; z-index: 11; } #dialogl,#dialogn { padding: 5px; margin: 3px 0 20px; border: 1px solid #DDD; background: #F5F5E9; } #dialogw li { float: left; margin: 5px 10px 0 0; } #dialogw a { display: block; width: 32px; height: 32px; background-image: url(//static.juick.com/sharesocial.png); } @@ -109,3 +109,33 @@ hr { height: 1px; background: #CCC; } #footer { clear: both; font-size: small; padding: 10px 0; color: #999; } #footer-right { float: right; } + +/******************************************************************************/ + +@media screen and (max-width: 800px) { + #header,#topwrapper,#content,#footer,#mtoolbar { width: auto; min-width: 320px; } + + #hwrapper { position: fixed; top: 0; z-index: 1; } + #topwrapper { margin-top: 3em; } + + #header li { line-height: 42px; } + #search { position: absolute; left: 42px; right: 222px; min-width: 55px; } + #header a { padding: 0 7px; } + #header .text { width: 100%; } + #header label { display: none; } + #header img { margin: 0; } + #header .wide { padding: 0 10px; } + + #hi-logo { width: 32px; background-position: -110px 0; margin: 0; } + #hi-post { margin: 0; } + + .msg { width: auto; min-width: 280px; } + .msg-comment textarea { width: 100%; } + .msg-header { margin-bottom: 6px; } + .msg-ts { clear: both; float: none; margin: 0 0 4px 58px; } + .msg-txt { clear: both; margin: 8px 0 0 0; } + .msg-media,.msg-links,.msg-comment,.msg-comments,.msg-recomms { margin-left: 0px; } + + .fix,.abs { position: static; } + #column { clear: both; margin: 0 auto; width: 50%; } +}
\ No newline at end of file |