diff options
author | 2014-04-17 15:40:27 +0700 | |
---|---|---|
committer | 2014-04-17 15:40:27 +0700 | |
commit | 29a8f0ae0fdc27a03b723c7a9ad3be7f35db7b23 (patch) | |
tree | 400e8b4924b979cab2fe1f44641cd32eb02d62d2 /web | |
parent | 52e058a98e496a4e5a2372420d9dd8308881c384 (diff) |
NewMessage complete rewrite
Diffstat (limited to 'web')
-rw-r--r-- | web/scripts3.js | 19 | ||||
-rw-r--r-- | web/style3.css | 14 |
2 files changed, 24 insertions, 9 deletions
diff --git a/web/scripts3.js b/web/scripts3.js index ca111020..c5fb472c 100644 --- a/web/scripts3.js +++ b/web/scripts3.js @@ -93,7 +93,7 @@ function showMoreReplies(id) { function showCommentForm(mid,rid) { if($('#replies #'+rid+' textarea').length==0) { var c=$('#replies #'+rid+' .msg-comment'); - c.wrap('<form action="/post" method="POST" enctype="multipart/form-data"/>'); + c.wrap('<form action="/comment" method="POST" enctype="multipart/form-data"/>'); c.before('<input type="hidden" name="mid" value="'+mid+'"/><input type="hidden" name="rid" value="'+rid+'"/>'); c.append('<div class="ta-wrapper"><textarea name="body" rows="1" class="reply narrow" placeholder="Add a comment..." onkeypress="postformListener(this.form,event)"></textarea><div class="attach-photo" onclick="attachCommentPhoto(this)"/></div><input type="submit" value="OK"/>'); } @@ -110,7 +110,7 @@ function showCommentForm(mid,rid) { function showCommentFooter(e) { var a=$(e).closest("article"); if(a.find("footer.comm").length==0) { - a.append('<form action="/post" method="POST" enctype="multipart/form-data"><input type="hidden" name="mid" value="'+a.data('mid')+'"/><footer class="comm"><div class="ta-wrapper"><textarea name="body" rows="1" class="reply narrow" placeholder="Написать комментарий..." onkeypress="postformListener(this.form,event)"></textarea><div class="attach-photo" onclick="attachCommentPhoto(this)"/></div><input type="submit" value="OK"/></footer></form>'); + a.append('<form action="/comment" method="POST" enctype="multipart/form-data"><input type="hidden" name="mid" value="'+a.data('mid')+'"/><footer class="comm"><div class="ta-wrapper"><textarea name="body" rows="1" class="reply narrow" placeholder="Написать комментарий..." onkeypress="postformListener(this.form,event)"></textarea><div class="attach-photo" onclick="attachCommentPhoto(this)"/></div><input type="submit" value="OK"/></footer></form>'); a.find('textarea').autoResize({ extraSpace: 0, minHeight: 1 @@ -134,6 +134,21 @@ function attachCommentPhoto(div) { } } +function attachMessagePhoto(div) { + var f=$(div).closest('form'); + if(f.find('input:file').length===0) { + var inp=$('<input type="file" name="attach" accept="image/jpeg,image/png" style="float: left; width: 0; height: 0; visibility: hidden"/>'); + inp.on('change',function() { + $(div).text("загрузить (✓)"); + }); + f.append(inp); + inp.trigger('click'); + } else { + f.find('input:file').remove(); + $(div).text("загрузить"); + } +} + function unfoldReply() { if((0+window.location.hash.substring(1))>0) { var el=$(window.location.hash); diff --git a/web/style3.css b/web/style3.css index b8903e47..9c6eb890 100644 --- a/web/style3.css +++ b/web/style3.css @@ -38,13 +38,13 @@ 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: 688px; 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; } +#newmessage { background: #E5E5E0; padding: 15px; margin-bottom: 20px; } +#newmessage textarea { border: 1px solid #CCC; padding: 4px; width: 688px; resize: vertical; min-height: 14pt; height: 14pt; margin: 0 0 5px 0; } +#newmessage input { border: 1px solid #CCC; padding: 2px 4px; margin: 5px 0; } +#newmessage>div { display: none; } +#newmessage .img { width: 500px; } +#newmessage .tags { width: 500px; } +#newmessage .subm { width: 150px; 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; } |