aboutsummaryrefslogtreecommitdiff
path: root/web/scripts3.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/scripts3.js')
-rw-r--r--web/scripts3.js19
1 files changed, 17 insertions, 2 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);