aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/java/com/juick/http/www/Home.java13
-rw-r--r--src/java/com/juick/http/www/PageTemplates.java6
-rw-r--r--web/scripts3.js39
-rw-r--r--web/style3.css15
4 files changed, 57 insertions, 16 deletions
diff --git a/src/java/com/juick/http/www/Home.java b/src/java/com/juick/http/www/Home.java
index c3a93107..41e85c0d 100644
--- a/src/java/com/juick/http/www/Home.java
+++ b/src/java/com/juick/http/www/Home.java
@@ -106,6 +106,19 @@ public class Home {
out.println("<!--noindex-->");
}
+ if (visitor != null) {
+ out.println("<form action=\"/post\" method=\"post\" enctype=\"multipart/form-data\" onsubmit=\"return onsubmitNewMessage()\">");
+ out.println("<section id=\"newmessage\">");
+ out.println(" <textarea name=\"body\" placeholder=\"Новое сообщение...\" onclick=\"$('#newmessage>div').css('display','block')\" onkeypress=\"postformListener(this.form,event)\"></textarea>");
+ out.println(" <div>");
+ out.println(" <input type=\"text\" class=\"tags\" name=\"tags\" placeholder=\"Теги (через пробел)\"/>");
+ out.println(" <div class=\"attach-photo\" onclick=\"attachCommentPhoto(this)\"></div>");
+ out.println(" <input type=\"submit\" class=\"subm\" value=\"Отправить\"/>");
+ out.println(" </div>");
+ out.println("</section>");
+ out.println("</form>");
+ }
+
if (mids.size() > 0) {
int ad_mid = 0;
if (visitor != null && (paramShow == null || paramShow.equals("top") || paramShow.equals("all"))) {
diff --git a/src/java/com/juick/http/www/PageTemplates.java b/src/java/com/juick/http/www/PageTemplates.java
index bb89ea4d..a6d278bf 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.2014030803.css\"/>");
+ out.print("<link rel=\"stylesheet\" href=\"/style.2014031100.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.2014030801.js\" defer=\"defer\"></script>");
+ out.print("<script type=\"text/javascript\" src=\"/scripts.2014031200.js\" defer=\"defer\"></script>");
if (headers != null) {
out.print(headers);
}
@@ -87,7 +87,7 @@ public class PageTemplates {
out.print("<li><a href=\"/?show=recommended\">Рекомендации</a></li>");
out.println("</ul></nav>");
out.print(" <nav id=\"actions\"><ul>");
- out.print("<li><a href=\"/post\">Написать</a></li>");
+ out.print("<li><a href=\"/#post\">Написать</a></li>");
out.print("<li><a href=\"/" + visitor.UName + "\">@" + visitor.UName + "</a></li>");
out.print("<li><a href=\"/logout\">Выйти</a></li>");
out.println("</ul></nav>");
diff --git a/web/scripts3.js b/web/scripts3.js
index 3ad5a5cf..626c4020 100644
--- a/web/scripts3.js
+++ b/web/scripts3.js
@@ -44,7 +44,29 @@ function wsSendKeepAlive() {
/******************************************************************************/
function postformListener(formEl,ev) {
- if(ev.ctrlKey && (ev.keyCode==10 || ev.keyCode==13)) formEl.submit();
+ if(ev.ctrlKey && (ev.keyCode==10 || ev.keyCode==13)) {
+ if(!formEl.onsubmit || formEl.onsubmit()) {
+ formEl.submit();
+ }
+ }
+}
+
+function unfoldPostForm() {
+ if(window.location.pathname==="/" && window.location.hash==="#post") {
+ $('#newmessage>div').css('display','block');
+ $('#newmessage textarea')[0].focus();
+ }
+}
+
+function onsubmitNewMessage() {
+ if($('#newmessage .tags').val().length==0) {
+ openDialog('<p class="dialogtxt">Пожалуйста, введите теги сообщения</p>');
+ return false;
+ } else if($('#newmessage textarea').val().length==0) {
+ openDialog('<p class="dialogtxt">Пожалуйста, введите текст сообщения</p>');
+ return false;
+ }
+ return true;
}
function showMoreReplies(id) {
@@ -490,29 +512,26 @@ jQuery.fn.selectText = function(){
/******************************************************************************/
$(document).ready(function() {
- var tareply=$('textarea.reply');
- tareply.autoResize({
+ $('textarea').autoResize({
extraSpace: 0,
minHeight: 1
});
- tareply.click(function () {
+
+ $('textarea.reply').click(function () {
$(this).addClass("narrow");
$(this).after('<div class="attach-photo" onclick="attachCommentPhoto(this)"/>');
$(this).parent().after('<input type="submit" value="OK"/>');
$(this).off('click');
});
- var pmreply=$('textarea.replypm');
- pmreply.autoResize({
- extraSpace: 0,
- minHeight: 1
- });
- pmreply.click(function () {
+ $('textarea.replypm').click(function () {
$(this).addClass("narrowpm");
$(this).parent().after('<input type="submit" value="OK"/>');
$(this).off('click');
});
+ unfoldPostForm();
unfoldReply();
+ $(window).bind('hashchange',unfoldPostForm);
$(window).bind('hashchange',unfoldReply);
});
diff --git a/web/style3.css b/web/style3.css
index 2fdcb5e3..b90d849e 100644
--- a/web/style3.css
+++ b/web/style3.css
@@ -1,5 +1,5 @@
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,input,textarea { font-family: sans-serif; font-size: 12pt; }
html { background: #EEEEE5; color: #000; }
body { width: 1010px; margin: 0 auto; }
h1,h2 { font-weight: normal; }
@@ -38,6 +38,14 @@ body>header p { color: #000; font-size: 13pt; margin: 12px 0; text-align: center
#content>p, #content>h1, #content>h2 { margin: 1em 0; }
+#newmessage { background: #E5E5E0; padding: 15px; margin-bottom: 20px; text-align: right; }
+#newmessage textarea { border: 1px solid #CCC; padding: 4px; width: 660px; resize: vertical; min-height: 14pt; height: 14pt; }
+#newmessage>div { display: none; margin-top: 8px; }
+#newmessage input { border: 1px solid #CCC; padding: 2px 4px; }
+#newmessage .tags { width: 400px; float: left; }
+#newmessage .attach-photo, #newmessage .attach-photo-active { margin-right: 10px; }
+#newmessage .subm { width: 120px; background: #EEEEE5; }
+
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; }
@@ -84,8 +92,8 @@ article input { width: 50px; margin-left: 6px; vertical-align: top; border: 1px
.msg-comment textarea { width: 604px; padding: 2px; resize: vertical; vertical-align: top; min-height: 12pt; height: 12pt; border: 0; }
.msg-comment .narrow { width: 524px; }
.msg-comment .narrowpm { width: 550px; }
-.attach-photo { display: inline-block; padding: 2px 4px; cursor: pointer; width: 16px; height: 13px; background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAANCAQAAAAKsiavAAAAAXNSR0IArs4c6QAAAKRJREFUGNNjZICC6Q5M+xlQwD/HzAMMDEwwLnM9AxqAiDDO/M+AFzCh8B4zhrDwsfAxBjHcggkhm/CY2SDlHYQ5TZD5EoMMmgmMhSnvZnrPfDLzyQyvrPf/CzGs+L2TgYFhBoM0gzTjDAaGX7uwuQG/I1ldGRj+pzM8YXjMmMrAwOGK6cibfy2z3sMdeYpBBTMcHjMU/9zJzsjo8r8DIk1yQGEBAFzpL+AuTCqZAAAAAElFTkSuQmCC") no-repeat 3px 4px; }
-.attach-photo-active { display: inline-block; padding: 2px 4px; cursor: pointer; width: 16px; height: 13px; background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAANCAMAAACXZR4WAAAAAXNSR0IArs4c6QAAAEVQTFRFAAAAAJUAAJ0AAJIAAJkAAJYAAJwAAJcAAJoAAJgAAJkAAJoAAJoAAJgAAJkAAJoAAJkAAJkAAJkAAJkAAJkAAJkAAJkA9z3GXQAAABZ0Uk5TAAwNDg8REkBHSktRU1RVv9jZ2+Lj5OeV7PgAAABSSURBVAhbdcjBFkAgFADRIUlE9Or9/6daUC0cs5pzAXD65niKFSJQv/aChHHcrg4yA9jcILCW4tkbDGRVwfzDhs+yEBqcFsCmBiqHmULSDr0P3JdgDbuscEckAAAAAElFTkSuQmCC") no-repeat 3px 4px; }
+.attach-photo { display: inline-block; padding: 2px 4px; cursor: pointer; width: 16px; height: 13px; overflow: hidden; background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAANCAQAAAAKsiavAAAAAXNSR0IArs4c6QAAAKRJREFUGNNjZICC6Q5M+xlQwD/HzAMMDEwwLnM9AxqAiDDO/M+AFzCh8B4zhrDwsfAxBjHcggkhm/CY2SDlHYQ5TZD5EoMMmgmMhSnvZnrPfDLzyQyvrPf/CzGs+L2TgYFhBoM0gzTjDAaGX7uwuQG/I1ldGRj+pzM8YXjMmMrAwOGK6cibfy2z3sMdeYpBBTMcHjMU/9zJzsjo8r8DIk1yQGEBAFzpL+AuTCqZAAAAAElFTkSuQmCC") no-repeat 3px 4px; }
+.attach-photo-active { display: inline-block; padding: 2px 4px; cursor: pointer; width: 16px; height: 13px; overflow: hidden; background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAANCAMAAACXZR4WAAAAAXNSR0IArs4c6QAAAEVQTFRFAAAAAJUAAJ0AAJIAAJkAAJYAAJwAAJcAAJoAAJgAAJkAAJoAAJoAAJgAAJkAAJoAAJkAAJkAAJkAAJkAAJkAAJkAAJkA9z3GXQAAABZ0Uk5TAAwNDg8REkBHSktRU1RVv9jZ2+Lj5OeV7PgAAABSSURBVAhbdcjBFkAgFADRIUlE9Or9/6daUC0cs5pzAXD65niKFSJQv/aChHHcrg4yA9jcILCW4tkbDGRVwfzDhs+yEBqcFsCmBiqHmULSDr0P3JdgDbuscEckAAAAAElFTkSuQmCC") no-repeat 3px 4px; }
.msg-comment input { width: 50px; margin-left: 6px; vertical-align: top; border: 1px solid #CCC; background: #EEE; color: #999; }
.msg-recomms { margin-top: 10px; overflow: hidden; font-size: small; color: #AAA; text-indent: 10px; }
blockquote { border-left: 1px dashed #CCC; margin: 10px 0 10px 10px; padding-left: 10px; }
@@ -149,6 +157,7 @@ blockquote { border-left: 1px dashed #CCC; margin: 10px 0 10px 10px; padding-lef
.dialogshare li { float: left; margin: 5px 10px 0 0; }
.dialogshare a { display: block; width: 32px; height: 32px; background-image: url(//static.juick.com/sharesocial.png); }
+.dialogtxt { background: #EEEEE5; padding: 20px; }
/********/
#footer { clear: both; font-size: 10pt; padding: 10px 0; color: #999; }