more
This commit is contained in:
		| @@ -88,6 +88,7 @@ function ReplyBox() { | ||||
|     table.appendChild(tbody); | ||||
|     this.elem.appendChild(table); | ||||
|     document.body.appendChild(this.elem); | ||||
|     this._open = false; | ||||
| } | ||||
|  | ||||
| ReplyBox.prototype.result = function(msg, color) { | ||||
| @@ -102,6 +103,10 @@ ReplyBox.prototype.result = function(msg, color) { | ||||
|     }, 1000); | ||||
| } | ||||
|  | ||||
| ReplyBox.prototype.visible = function() { | ||||
|     return this._open != false; | ||||
| } | ||||
|  | ||||
|  | ||||
| ReplyBox.prototype.makePost = function(info) { | ||||
|     var self = this; | ||||
| @@ -130,8 +135,10 @@ ReplyBox.prototype.reload = function() { | ||||
| } | ||||
|  | ||||
| ReplyBox.prototype.show = function(info) { | ||||
|     console.log("reply box show for "+info.reference); | ||||
|     var self = this; | ||||
|     self.reload(); | ||||
|     self._open = true; | ||||
|     console.log("reply box show for "+info.reference); | ||||
|     $(self.elem).css("display", "inline-block"); | ||||
|     $(self.elem).css("position", "fixed"); | ||||
|     var off = $(info.elem).offset(); | ||||
| @@ -149,7 +156,9 @@ ReplyBox.prototype.show = function(info) { | ||||
|             if(xhr.statusCode == 201) { | ||||
|                 self.result("posted as "+data.message_id, "green"); | ||||
|                 self.clear(); | ||||
|                 self.submit.onclick = function(ev) {}; | ||||
|                 setTimeout(1000, function() { | ||||
|                     self.hide(); | ||||
|                 }); | ||||
|             } else { | ||||
|                 self.result("error: " + data.error, "red"); | ||||
|             } | ||||
| @@ -163,13 +172,17 @@ ReplyBox.prototype.show = function(info) { | ||||
|  | ||||
| ReplyBox.prototype.hide = function() { | ||||
|     var self = this; | ||||
|     $(self.elem).css("display", "none"); | ||||
|     if(!self.visible()) return; | ||||
|     self._open = false; | ||||
|     $(self.elem).fadeout(400, function() { | ||||
|         self.submit.onclick = function(ev) {}; | ||||
|     }); | ||||
| } | ||||
|  | ||||
| onready(function(){ | ||||
|     var replyBox = new ReplyBox(); | ||||
|     replyBox.hide(); | ||||
|     document.reply = replyBox; | ||||
|     $(".post").each(function(_, elem) { | ||||
|         var replyInfo = { | ||||
|             show: false, | ||||
|   | ||||
| @@ -11,7 +11,13 @@ function nntpchan_reply(parent, shorthash) { | ||||
|         // show it | ||||
|         replyto.show(); | ||||
|     } | ||||
|     var elem = document.getElementById("postform_message"); | ||||
|      | ||||
|     var elem; | ||||
|     if(document.reply && document.reply.visible()) { | ||||
|         elem = document.reply.message; | ||||
|     } else { | ||||
|         elem = document.getElementById("postform_message"); | ||||
|     } | ||||
|     if ( elem ) | ||||
|     { | ||||
|         elem.value += ">>" + shorthash.substr(0,10) + "\n"; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user