aboutsummaryrefslogtreecommitdiff
path: root/web/scripts3.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/scripts3.js')
-rw-r--r--web/scripts3.js25
1 files changed, 20 insertions, 5 deletions
diff --git a/web/scripts3.js b/web/scripts3.js
index 087a2d66..dc2cc330 100644
--- a/web/scripts3.js
+++ b/web/scripts3.js
@@ -117,7 +117,7 @@ function showGroup(gid) {
"</div>"+
"<div class=\"msg-txt\">"+item.body+"</div>"+
photo+
- "<div class=\"msg-comment\"><textarea id=\"tareply-"+item.mid+"\" name=\"body\" rows=\"1\" class=\"reply\" placeholder=\"Add a comment...\" onkeypress=\"postformListener(this.form,event)\"></textarea></div>"+
+ "<div class=\"msg-comment\"><div class=\"ta-wrapper\"><textarea id=\"tareply-"+item.mid+"\" name=\"body\" rows=\"1\" class=\"reply\" placeholder=\"Add a comment...\" onkeypress=\"postformListener(this.form,event)\"></textarea></div></div>"+
replies
);
ul.append(li);
@@ -173,7 +173,7 @@ function showMessages(param) {
"</div>"+
"<div class=\"msg-txt\">"+item.body+"</div>"+
photo+
- "<div class=\"msg-comment\"><textarea name=\"body\" rows=\"1\" class=\"reply\" placeholder=\"Add a comment...\" onkeypress=\"postformListener(this.form,event)\"></textarea></div>"+
+ "<div class=\"msg-comment\"><div class=\"ta-wrapper\"><textarea name=\"body\" rows=\"1\" class=\"reply\" placeholder=\"Add a comment...\" onkeypress=\"postformListener(this.form,event)\"></textarea></div></div>"+
replies
);
ul.append(li);
@@ -225,7 +225,7 @@ function showMessage(mid) {
"</div>"+
"<div class=\"msg-txt\">"+post.body+"</div>"+
photo+
- "<div class=\"msg-comment\"><textarea name=\"body\" rows=\"1\" class=\"reply\" placeholder=\"Add a comment...\" onkeypress=\"postformListener(this.form,event)\"></textarea></div>"
+ "<div class=\"msg-comment\"><div class=\"ta-wrapper\"><textarea name=\"body\" rows=\"1\" class=\"reply\" placeholder=\"Add a comment...\" onkeypress=\"postformListener(this.form,event)\"></textarea></div></div>"
);
ul.append(li);
@@ -423,7 +423,7 @@ function showCommentForm(mid,rid) {
var c=$('#replies #'+rid+' .msg-comment');
c.wrap('<form action="/post" method="POST" enctype="multipart/form-data"/>');
c.before('<input type="hidden" name="mid" value="'+mid+'"/><input type="hidden" name="rid" value="'+rid+'"/>');
- c.append('<textarea name="body" rows="1" class="reply narrow" placeholder="Add a comment..." onkeypress="postformListener(this.form,event)"></textarea><input type="submit" value="OK"/>');
+ 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"/>');
}
// $('#replies #'+rid+' .msg-links').hide();
$('#replies #'+rid+' .msg-comment').show();
@@ -435,6 +435,20 @@ function showCommentForm(mid,rid) {
return false;
}
+function attachCommentPhoto(div) {
+ if($(div).children().length===0) {
+ var inp=$('<input type="file" name="attach" accept="image/jpeg,image/png" style="visibility: hidden"/>');
+ inp.on('change',function() {
+ $(this).parent().attr('class','attach-photo-active');
+ });
+ inp.trigger('click');
+ $(div).append(inp);
+ } else {
+ $(div).empty();
+ $(div).attr('class','attach-photo');
+ }
+}
+
function unfoldReply() {
if((0+window.location.hash.substring(1))>0) {
var el=$(window.location.hash);
@@ -795,7 +809,8 @@ $(document).ready(function() {
});
tareply.click(function () {
$(this).addClass("narrow");
- $(this).after('<input type="submit" value="OK"/>');
+ $(this).after('<div class="attach-photo" onclick="attachCommentPhoto(this)"/>');
+ $(this).parent().after('<input type="submit" value="OK"/>');
$(this).off('click');
});