From 48b7aa72126b1a75e470077de48408d24fb1b546 Mon Sep 17 00:00:00 2001 From: Ugnich Anton Date: Sat, 15 Feb 2014 13:13:04 +0700 Subject: New message layout (article); Google Analytics; small bugfixes --- src/java/com/juick/http/www/Discover.java | 2 - src/java/com/juick/http/www/Home.java | 8 +- src/java/com/juick/http/www/Main.java | 2 +- src/java/com/juick/http/www/PageTemplates.java | 157 ++++++++++--------------- src/java/com/juick/http/www/User.java | 42 ++++--- web/scripts3.js | 13 ++ web/style3.css | 60 +++++++--- 7 files changed, 147 insertions(+), 137 deletions(-) diff --git a/src/java/com/juick/http/www/Discover.java b/src/java/com/juick/http/www/Discover.java index 4e4a6b3d..1db264f7 100644 --- a/src/java/com/juick/http/www/Discover.java +++ b/src/java/com/juick/http/www/Discover.java @@ -80,9 +80,7 @@ public class Discover { out.println("
"); if (mids.size() > 0) { - out.println(""); } if (mids.size() >= 20) { diff --git a/src/java/com/juick/http/www/Home.java b/src/java/com/juick/http/www/Home.java index 1240e62e..1319a135 100644 --- a/src/java/com/juick/http/www/Home.java +++ b/src/java/com/juick/http/www/Home.java @@ -57,10 +57,10 @@ public class Home { title = "Поиск: " + Utils.encodeHTML(paramSearch); mids = MessagesQueries.getSearch(sql, sqlSearch, Utils.encodeSphinx(paramSearch), paramBefore); } else if (paramShow == null || paramShow.equals("top")) { - if(visitor!=null) { - title = "Популярные"; + if (visitor != null) { + title = "Популярные"; } else { - title="Микроблоги Juick: популярные записи"; + title = "Микроблоги Juick: популярные записи"; } mids = MessagesQueries.getPopular(sql, paramBefore); } else if (paramShow.equals("my") && visitor != null) { @@ -114,9 +114,7 @@ public class Home { } } - out.println(""); } if (mids.size() >= 20) { diff --git a/src/java/com/juick/http/www/Main.java b/src/java/com/juick/http/www/Main.java index 66237ebe..98034359 100644 --- a/src/java/com/juick/http/www/Main.java +++ b/src/java/com/juick/http/www/Main.java @@ -238,7 +238,7 @@ public class Main extends HttpServlet implements Stream.StreamListener { if (!author.UName.equals(user.UName)) { Utils.sendPermanentRedirect(response, "/" + author.UName + "/" + mid); } else { - pagesUserThread.doGetThread(sql, request, response, user, mid); + pagesUserThread.doGetThread(sql, request, response, mid); } } else { response.sendError(404); diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java index 32e77239..228cff91 100644 --- a/src/java/com/juick/http/www/PageTemplates.java +++ b/src/java/com/juick/http/www/PageTemplates.java @@ -46,16 +46,15 @@ public class PageTemplates { private static final SimpleDateFormat sdfSQL = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); private static SimpleDateFormat sdfSimple = new SimpleDateFormat("d MMM"); private static SimpleDateFormat sdfFull = new SimpleDateFormat("d MMM yyyy"); - private static SimpleDateFormat sdfJS = new SimpleDateFormat("yyyy,MM,dd,HH,mm,ss"); private static String tagsHTML = null; public static void pageHead(PrintWriter out, String title, String headers) { out.println(""); out.print(""); out.print(""); - out.print(""); + out.print(""); out.print(""); - out.print(""); + out.print(""); if (headers != null) { out.print(headers); } @@ -70,11 +69,10 @@ public class PageTemplates { public static void pageNavigation(PrintWriter out, com.juick.User visitor, String search) { out.println("
"); out.println(" "); - out.println(" "); + out.print(" "); out.print("
"); out.println("
"); if (visitor != null) { - out.println(" "); - out.println(" "); + out.print(" "); + out.print(" "); } else { out.println("

Чтобы добавлять сообщения и комментарии, представьтесь.

"); } @@ -105,21 +98,21 @@ public class PageTemplates { out.println("
"); } - public static void pageYandexAd(PrintWriter out, int stat_id) { - out.println("
"); + public static void pageYandexAd(PrintWriter out, int YandexID) { + out.println("
"); out.println(""); + } + + out.println(""); } public static void pageEnd(PrintWriter out) { @@ -448,34 +456,7 @@ public class PageTemplates { for (int i = 0; i < msgs.size(); i++) { if (i == 1 && YandexID > 0 && ad_mid == 0) { - out.println("
  • "); - out.println(""); + pageYandexAd(out, YandexID); } com.juick.Message msg = msgs.get(i); @@ -484,19 +465,11 @@ public class PageTemplates { if (msg.ReadOnly) { tags += " *readonly"; } - switch (msg.Privacy) { - case 2: - tags += " *public"; - break; - case -1: - tags += " *friends"; - break; - case -2: - tags += " *friends"; - break; - case -3: - tags += " *private"; - break; + if (msg.Privacy < 0) { + tags += " *friends"; + } + if (msg.MID == ad_mid) { + tags += " *реклама"; } String txt; @@ -506,40 +479,32 @@ public class PageTemplates { txt = formatMessage(msg.Text); } - if (!tags.isEmpty()) { - tags = "" + tags + ""; - } - - out.println("
  • "); - out.println("
    \""
    "); - out.println("
    "); - out.println("
    "); - out.println(" "); - out.print("
    " + formatDate(msg.TimeAgo, msg.TimestampString) + ""); - if (msg.MID == ad_mid) { - out.print(" · Реклама"); - } - out.println("
    "); - - out.print("
    " + txt + "
    "); - + out.println("
    "); + out.println(" "); + out.println("
    @" + msg.User.UName + ":" + tags + "
    "); + out.println("
    "); + out.println("

    " + txt + "

    "); if (msg.AttachmentType != null) { - out.println("
    \"\"/
    "); + out.println("

    \"\"/

    "); } + out.print(" "); + + out.print("
    "); - out.println("
  • "); + out.println(""); + out.println(""); } } } diff --git a/src/java/com/juick/http/www/User.java b/src/java/com/juick/http/www/User.java index 71b9ae16..1e469a1d 100644 --- a/src/java/com/juick/http/www/User.java +++ b/src/java/com/juick/http/www/User.java @@ -49,8 +49,14 @@ public class User { com.juick.Tag paramTag = null; String paramTagStr = request.getParameter("tag"); - if (paramTagStr != null && paramTagStr.length() < 64) { - paramTag = TagQueries.getTag(sql, paramTagStr, false); + if (paramTagStr != null) { + if (paramTagStr.length() < 64) { + paramTag = TagQueries.getTag(sql, paramTagStr, false); + } + if (paramTag == null) { + response.sendError(404); + return; + } } int paramBefore = 0; @@ -107,28 +113,26 @@ public class User { pageUserColumn(out, sql, user, visitor); - out.println("
    "); - out.println(""); - if (mids.size() >= 20) { - String nextpage = "?before=" + mids.get(mids.size() - 1); - if (paramShow != null) { - nextpage += "&show=" + paramShow; - } - if (paramTag != null) { - nextpage += "&tag=" + URLEncoder.encode(paramTag.Name, "UTF-8"); - } - if (paramSearch != null) { - nextpage += "&search=" + URLEncoder.encode(paramSearch, "UTF-8"); + if (mids.size() >= 20) { + String nextpage = "?before=" + mids.get(mids.size() - 1); + if (paramShow != null) { + nextpage += "&show=" + paramShow; + } + if (paramTag != null) { + nextpage += "&tag=" + URLEncoder.encode(paramTag.Name, "UTF-8"); + } + if (paramSearch != null) { + nextpage += "&search=" + URLEncoder.encode(paramSearch, "UTF-8"); + } + out.println("

    Older →

    "); } - out.println("

    Older →

    "); - } - out.println("
    "); + out.println("
    "); + } PageTemplates.pageFooter(request, out, visitor, true); PageTemplates.pageDialogTemplate(out); diff --git a/web/scripts3.js b/web/scripts3.js index 723e3d76..8445ee19 100644 --- a/web/scripts3.js +++ b/web/scripts3.js @@ -443,6 +443,19 @@ function showCommentForm(mid,rid) { return false; } +function showCommentFooter(e) { + var a=$(e).closest("article"); + if(a.find("footer.comm").length==0) { + a.append('
    '); + a.find('textarea').autoResize({ + extraSpace: 0, + minHeight: 1 + }); + } + a.find('textarea')[0].focus(); + return false; +} + function attachCommentPhoto(div) { if($(div).children().length===0) { var inp=$(''); diff --git a/web/style3.css b/web/style3.css index e44627a5..7ff489f2 100644 --- a/web/style3.css +++ b/web/style3.css @@ -1,4 +1,4 @@ -html,body,div,h1,h2,ul,li,form,input,textarea,pre { margin: 0; padding: 0; } +html,body,div,h1,h2,ul,li,p,form,input,textarea,pre { margin: 0; padding: 0; } html,input { font-family: sans-serif; font-size: 12pt; } html { background: #EEEEE5; color: #000; } body { width: 1010px; margin: 0 auto; } @@ -8,31 +8,52 @@ a { text-decoration: none; color: #069; } img,hr { border: none; } hr { height: 1px; background: #CCC; margin: 10px 0; } pre { white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word; } -.u { text-decoration: underline; } +span.u { text-decoration: underline; } #content, #footer { width: 700px; margin: 15px 0 0 300px; } #topwrapper { position: relative; clear: both; } /********/ -header { width: 1010px; color: #AAA; } -header a { color: #000; border-bottom: 1px dotted #666; font-size: 13pt; } +body>header { width: 1010px; } +body>header a { color: #000; border-bottom: 1px dotted #666; font-size: 13pt; } #logo { float: left; width: 110px; height: 36px; margin: 7px 25px 0 20px; } #logo a { display: block; width: 110px; height: 36px; text-indent: 100%; white-space: nowrap; overflow: hidden; border: 0; background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAG4AAAAkCAYAAABomA/xAAAAAXNSR0IArs4c6QAABPZJREFUaN7tml1sFUUUx3+UFhEROyBFURERFT+qrV8xxqgvSBBjSBMnii+aGKMmmBg1E60alYRk1JjwRIz4ojHq0qi88EI0EGN4QFopYERaxCraRMJYRFErvT50istme2dm9257Q/afNPfunbNztuc/Z87HLJQoUaJEiRIlStQRpuSdQKjoSWBdFZEdRsubJ/ofEyraDCyvIrLWaNlZkO52oNsh9qzR8o2sOhpq8Jw3Osa/mqRFeYNjfEeBug96yHydR8FpSZxQ0QKgZRKJO6euiRMqmglcUYce51pMvxgtDxWov9UxfshoeTiPgsY8NxstjwFT6y1wGy0/rkX8zoH2Ir2tVltliUkgLrPHCRU1AkPAjCpinxgtO6z8i8CrjmmvMVruTehZA7zguG+x0bLfyi8HNjvkHzNavpXQswx4CLgFOB84I9AkrxgtX7bf20KJEyo6G/gJmJUY+gvYAKwzWvblJs5o+a9Q0QCwpIpYPCX+2THlceDbtHjkuO8ocCBAD0BPzGAzgPeAjpxO8LedrxlYGEKcUFGDJSdJWhfwjNHyh5rGOGCOYzxO3GyH7B6j5YmU35tdRjBaVgL0nAB2x6431IC0k8R5eNvvQH+MtNnAu8CKuF8Ajxotu4rYKucBcwOIu9LXCxK4KnDbcenZZ7Q8HiuUH3DIvwN8CPw2jv3mAUut5/sQ1zu20ISKbgfeBy5M2KHDaHmwqKzyJo+UezAevzISd13gfSF67nXVekbLRzxssSkgMdklVDQVeAnoTMnKv3eRljervN7X22wi0xroOQgVTXfE0DTi2gPkXYvvswx2cXncEWCrJS6tlLpHqGhOkcS1+xJnjT+9iuwI0DtOIVttV/gH+CYR5K8NIK6mabtQ0TSPrboTuK3K+DRgVV14nIeB9hkt/8ywOPYaLYdj15c7ypOTZAgVtQDzM27f4+FqoMkh49MYeLgQ4mwmtCCAuLaMK7st0LAuogeMlkc8ZY8BfTXehbznESpqLcLjXN522Gg5kDHukOO+EKJdc/caLUdqHN8qwHqb/ufyuqzE1dqgaYlJaLwKfa6siykPcc8bLZ/wJO5Bm9RNKHHxjHI+IDJslUsc8aoC7MqxQGqdmEzxKF2+sJ9bAdfpQAtw90RvlfH4dqlDdtho+WvK70sd9/XZ04kxw13g0RDoiZUZix2yBwIySYBFKS2r5ELbDWA7RJ/m2S6DC3ChorOAywKIm+WQbRIqegr40pYFjTY7dL1WsDNx7TqDi8fdMz2yu9VCRcQ6Iqc8s+123AXsB14DXK9n7DdaxufqAlzF/QqhorlpCztL56TN4alDxHpxwKDHnG9meI49ies7fOWNlkao6EfgoiryK+2fC2MHyXcGPu/njPYkq4WRJuBxUk5VsmyVztiQaPr2pMQiH/Q7xgcT8WWlr7zF04w2nPOg22j5nVBRE+722Smea+vPTR46VgsViYkgrjvxgCPAMpsG9/N/F328ODBk938XEfHYeR9wSYA8RsuNwK2MNpAHgOEMtvjAfq4CznPILkz5baOHjnMZPcEIruKTMa6X6n3H+42WH1GiUDQkSGl2kHYx1bvvFWBbadbikUxOdgoVrbcx6WgsBjTYQP6cw0u3JY5yShRNnK1HFgGv55hvbWnSife4mTnmqQBrjJZbSpPWN3EV4A9G30raDrxttNxemrNEiRKnJ/4DSe9ztdhLwS4AAAAASUVORK5CYII=") no-repeat; } nav#global { float: left; } -nav#global li { display: inline-block; margin: 14px 8px 0 0; } +nav#global li { display: inline-block; margin: 14px 12px 0 0; } #search { float: right; margin: 12px 20px 12px 0; } #search input { background: #FFF; border: 1px solid #DDDDD5; padding: 4px; } #headdiv { clear: both; margin: 0 0 5px 0; padding: 0 20px; background: #DDDDD5; border-top: 1px solid #D5D5D0; border-bottom: 1px solid #D5D5D0; position: relative; } -#headdiv li { display: inline-block; margin: 12px 8px 12px 0; } -nav#actions { top: 0; right: 12px; position: absolute; } +#headdiv li { display: inline-block; margin: 12px 12px 12px 0; } +nav#actions { top: 0; right: 8px; position: absolute; } -header p { color: #000; font-size: 13pt; margin: 12px 0; text-align: center; } +body>header nav li:after { display: inline-block; content: "/"; margin-left: 12px; color: #AAA; } +body>header nav li:last-child:after { display: none; } + +body>header p { color: #000; font-size: 13pt; margin: 12px 0; text-align: center; } /********/ +article { margin: 10px 0 20px 58px; background: #FFF; padding: 12px 13px; } +article>aside { margin: -12px 0 0 -71px; width: 48px; height: 48px; float: left; } +article>aside img { width: 48px; height: 48px; } +article>header.u { overflow: hidden; display: inline-block; width: 460px; } +article>header.t { width: 140px; text-align: right; float: right; } +article time { color: #999; font-size: 10pt; border-bottom: 1px dotted #999; } +article p { overflow: hidden; margin: 10px 0 15px 0; } +article p.i { text-align: center; } +article>nav.l { display: inline-block; font-size: 10pt; } +article>nav.l a { color: #888; border-bottom: 1px dotted #AAA; margin-right: 15px; } +article>nav.s { display: inline-block; text-align: right; float: right; } +article>nav.s a { font-weight: bold; color: #222; } +article a.likes { padding-left: 20px; background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAAXNSR0IArs4c6QAAAMRJREFUGBmtwbsuQ2EAAOCPX6LlKSRGD2E0YCKRGDqLQReDSVhIjI1r49bRdiZJn0GIQcPSxFO4HPHLOe1J2rpMvo//MaMl1batZNSWtlTLrK4JL5qqTqQO1aTqqppeTcrtexRklkTRskzw4Eju1rmOIIqCjrp7uRsNhQWLCmfu5C48Kxk05MmV3JR3xwatiaZ1rYg29Zr34VSPHdG6wpw3iaDPnmhDpiKVKPtmV7Sq4tOlET86EEUNw34RJK4Ffxgzrs8XpvA41+ECiwcAAAAASUVORK5CYII=") no-repeat 0px 1px; } +article a.replies { margin-left: 18px; padding-left: 20px; background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAANdJREFUOMvN069OgmEUBvAfSCUxNicFKTQ3bkCLyRvwDrgHZ5Q7MFlobAY3G9UrsOi0iIGNBIGgG00o53PvCMAHBJ7thPecPc/5+3IoKKKDIeZrbIi74CiFQBs3eMTbmmRnuMUID5nzG90cFXcxyEqHU3zlEBigkQoUor9N8Recf4Gdpr8XgV+Uc/DK+Ekdz/hAcwNyE594Sp0NTJYOZobriB/FjUwjNkE9m36GKq5wHO9zXOICtch4j1f0Q2QlSnjBGL10dXlQxXvSVmWbTZ3E/5ijtRxcAIj4MflVC0WJAAAAAElFTkSuQmCC") no-repeat 0px 1px; } +article footer.comm { margin: 13px 0 0 0; } +article textarea { width: 530px; padding: 2px; resize: vertical; vertical-align: top; min-height: 12pt; height: 12pt; border: 0; } +article input { width: 50px; margin-left: 6px; vertical-align: top; border: 1px solid #CCC; background: #EEE; color: #999; } + #geomap { width: 700px; height: 300px; margin-top: 1em; overflow: hidden; } .msg { margin: 10px 0 20px 0; } @@ -98,7 +119,7 @@ blockquote { border-left: 1px dashed #CCC; margin: 10px 0 10px 10px; padding-lef #column ul, #column p, #column hr { margin: 10px 0; } #column li { margin: 6px 0; } #column .margtop { margin-top: 15px; } -#column p { font-size: small; line-height: 140%; } +#column p { font-size: 10pt; line-height: 140%; } #column .tags { text-align: justify; } #column .inp { width: 222px; padding: 3px; border: 1px solid #CCC; border-radius: 3px; background: #F5F5E9; } #ctitle { font-size: 14pt; } @@ -107,7 +128,7 @@ blockquote { border-left: 1px dashed #CCC; margin: 10px 0 10px 10px; padding-lef #ctoolbar li { display: inline; } #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; } +#ustats li { margin: 3px 0; font-size: 10pt; } /********/ @@ -122,16 +143,16 @@ blockquote { border-left: 1px dashed #CCC; margin: 10px 0 10px 10px; padding-lef /********/ -#footer { clear: both; font-size: small; padding: 10px 0; color: #999; } +#footer { clear: both; font-size: 10pt; padding: 10px 0; color: #999; } #footer-right { float: right; } /******************************************************************************/ @media screen and (max-width: 850px) { - body,header,#topwrapper,#content,#footer,#mtoolbar { width: auto; min-width: 310px; margin: 0 auto; } + body,body>header,#topwrapper,#content,#footer,#mtoolbar { width: auto; min-width: 310px; margin: 0 auto; } - header { margin-bottom: 15px; } - header a { font-size: 12pt; } + body>header { margin-bottom: 15px; } + body>header a { font-size: 12pt; } #logo { display: none; } nav#global { margin-left: 10px; } nav#global li { margin-right: 10px; } @@ -141,6 +162,17 @@ blockquote { border-left: 1px dashed #CCC; margin: 10px 0 10px 10px; padding-lef nav#actions { position: relative; right: auto; } #column { float: none; padding-top: 0; width: auto; margin: 0 10px; } + + article { margin-left: 0; overflow: auto; } + article>aside { margin: 0 10px 0 0; width: 40px; height: 40px; } + article>aside img { width: 40px; height: 40px; } + article>header.u { margin: 0; width: auto; display: block; } + article>header.t { float: none; text-align: left; margin: 0; width: auto; display: block; } + article p { margin: 10px 0 8px 0; } + article>nav.l { display: block; float: left; width: 65%; line-height: 15pt; } + article>nav.s { display: block; } + article textarea { width: 205px; } + article footer { float: left; } .msg,.msg-cont { width: auto; min-width: 280px; } .msg-cont,.ads { margin-left: 0; } -- cgit v1.2.3