From 9e68e626c90b92c63192bea215ac47adf281d725 Mon Sep 17 00:00:00 2001 From: Jeff Date: Tue, 3 May 2016 14:13:48 -0400 Subject: [PATCH] try fix --- contrib/js/reply.js | 12 ++++++++---- contrib/static/nntpchan.js | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/contrib/js/reply.js b/contrib/js/reply.js index 46ba233..0e46e7b 100644 --- a/contrib/js/reply.js +++ b/contrib/js/reply.js @@ -140,9 +140,13 @@ function DynReply(existingElem) { DynReply.prototype.translate = function(dx, dy) { - var x = this.x + dx; - var y = this.y + dy; - this.moveTo(x, y); + if (this.x && this.y) { + var x = this.x + dx; + var y = this.y + dy; + this.moveTo(x, y); + } else { + this.moveTo(dx, dy); + } } DynReply.prototype.moveTo = function(x,y) { @@ -371,7 +375,7 @@ function init(prefix) { var e = rpl.elem; var mouseDownX, mouseDownY; - var ox = window.screenX - 50; + var ox = document.body.clientWidth - 50; var oy = 10; rpl.moveTo(ox, oy); diff --git a/contrib/static/nntpchan.js b/contrib/static/nntpchan.js index 7222744..8a30d69 100644 --- a/contrib/static/nntpchan.js +++ b/contrib/static/nntpchan.js @@ -53,7 +53,7 @@ function DynReply(existingElem){if(existingElem){this.elem=existingElem;this.for var elem=document.createElement("div");elem.setAttribute("id","postform_container");this.elem=elem;this.form=document.createElement("form");this.form.enctype="multipart/form-data";this.form.name="post";this.form.method="post";elem=document.createElement("input");elem.setAttribute("id","postform_reference");elem.name="reference";elem.type="hidden";this.form.appendChild(elem);var table=document.createElement("table");table.setAttribute("class","postform");var tbody=document.createElement("tbody");var span=document.createElement("span");elem=document.createElement("input");elem.setAttribute("name","name");elem.setAttribute("value","Anonymous");elem.setAttribute("id","postform_name");span.appendChild(elem);var err_elem=document.createElement("span");err_elem.setAttribute("id","postform_msg");span.appendChild(err_elem);this._error=err_elem;table_insert_row(tbody,document.createTextNode("Name"),[span]) elem=document.createElement("input");elem.setAttribute("name","subject");elem.setAttribute("value","");elem.setAttribute("id","postform_subject");var submit=document.createElement("input");submit.setAttribute("value","reply");submit.setAttribute("class","button");submit.setAttribute("type","submit");submit.setAttribute("id","postform_submit");table_insert_row(tbody,document.createTextNode("Subject"),[elem,submit]);elem=document.createElement("textarea");elem.setAttribute("id","postform_message");elem.setAttribute("name","message");elem.setAttribute("cols","40");elem.setAttribute("rows","5");table_insert_row(tbody,document.createTextNode("Comment"),[elem]);elem=document.createElement("input");elem.setAttribute("class","postform_attachment");elem.setAttribute("id","postform_attachments");elem.setAttribute("type","file");elem.setAttribute("name","attachment_uploaded");elem.setAttribute("multiple","multiple");table_insert_row(tbody,document.createTextNode("Files"),[elem]);elem=document.createElement("input");elem.setAttribute("type","checkbox");elem.setAttribute("name","dubs");table_insert_row(tbody,document.createTextNode("Get Dubs"),[elem]);elem=document.createElement("img");elem.setAttribute("id","captcha_img");elem.alt="captcha";table_insert_row(tbody,document.createTextNode("Captcha"),[elem]);elem=document.createElement("input");elem.name="captcha";elem.autocomplete="off";elem.setAttribute("id","captcha_solution");table_insert_row(tbody,document.createTextNode("Solution"),[elem]) table.appendChild(tbody);this.form.appendChild(table);this.elem.appendChild(this.form);document.body.appendChild(this.elem);this.board=null;this.roothash=null;this.prefix=null;this.url=null;} -DynReply.prototype.translate=function(dx,dy){var x=this.x+dx;var y=this.y+dy;this.moveTo(x,y);} +DynReply.prototype.translate=function(dx,dy){if(this.x&&this.y){var x=this.x+dx;var y=this.y+dy;this.moveTo(x,y);}else{this.moveTo(dx,dy);}} DynReply.prototype.moveTo=function(x,y){if(x&&y){var nx=document.body.clientLeft-x;if(nx>0&&y>0&&nx