try using different drag method for reply box
This commit is contained in:
		| @@ -244,7 +244,7 @@ DynReply.prototype.setRoot = function(roothash) { | ||||
|  | ||||
| DynReply.prototype.showError = function(msg) { | ||||
|   console.log("error in dynreply: "+msg); | ||||
|   this._error.setAttribute("class", "error"); | ||||
|   this._error.setAttribute("class", "error message"); | ||||
|   this._error.appendChild(document.createTextNode(msg)); | ||||
|   this.updateCaptcha(); | ||||
| } | ||||
| @@ -353,22 +353,18 @@ function init(prefix) { | ||||
|  | ||||
|   // position replyto widget | ||||
|   var e = rpl.elem; | ||||
|   e.setAttribute("draggable", "true"); | ||||
|   var mouseDownX, mouseDownY; | ||||
|  | ||||
|   var originalX = window.screenX - 150; | ||||
|   var originalX = window.screenX - 50; | ||||
|   var originalY = 10; | ||||
|   rpl.moveTo(originalX, originalY); | ||||
|  | ||||
|   e.addEventListener("dragstart", function(ev) { | ||||
|   e.addEventListener("mousedown", function(ev) { | ||||
|     mouseDownX = ev.clientX; | ||||
|     mouseDownY = ev.clientY; | ||||
|     if (!ev.ctrlKey) { | ||||
|       ev.preventDefault(); | ||||
|     } | ||||
|   }, false); | ||||
|    | ||||
|   e.addEventListener("dragend", function(ev) { | ||||
|   e.addEventListener("mouseup", function(ev) { | ||||
|     var x = originalX + ev.clientX - mouseDownX; | ||||
|     var y = originalY + ev.clientY - mouseDownY; | ||||
|     x -= window.screenLeft; | ||||
| @@ -377,7 +373,7 @@ function init(prefix) { | ||||
|     originalX = x; | ||||
|     originalY = y; | ||||
|   }, false); | ||||
|  | ||||
|    | ||||
|   // add replyto post handlers | ||||
|   e = document.getElementById("postform_submit"); | ||||
|   var postit = function() { | ||||
|   | ||||
| @@ -68,7 +68,7 @@ DynReply.prototype.setPrefix=function(prefix){this.prefix=prefix;} | ||||
| DynReply.prototype.hide=function(){this.elem.style.display='none';} | ||||
| DynReply.prototype.setBoard=function(boardname){if(boardname){this.board=boardname;}} | ||||
| DynReply.prototype.setRoot=function(roothash){if(roothash){this.roothash=roothash;}} | ||||
| DynReply.prototype.showError=function(msg){console.log("error in dynreply: "+msg);this._error.setAttribute("class","error");this._error.appendChild(document.createTextNode(msg));this.updateCaptcha();} | ||||
| DynReply.prototype.showError=function(msg){console.log("error in dynreply: "+msg);this._error.setAttribute("class","error message");this._error.appendChild(document.createTextNode(msg));this.updateCaptcha();} | ||||
| DynReply.prototype.showMessage=function(msg){this._error.setAttribute("class","message");this._error.innerHTML="";this._error.appendChild(document.createTextNode(msg));var e=this._error;setTimeout(function(){e.innerHTML="";},2000);} | ||||
| function nntpchan_reply(parent,shorthash){if(parent){var boardname=parent.getAttribute("boardname");var roothash=parent.getAttribute("root");var replyto=getReplyTo();replyto.setBoard(boardname);replyto.setRoot(roothash);replyto.show();} | ||||
| var elem=document.getElementById("postform_message");if(elem) | ||||
| @@ -81,7 +81,7 @@ parent.appendChild(wrapper);parent.backlink=false;},function(msg){var wrapper=do | ||||
| parent.backlink=true;}};parent.backlink=true;} | ||||
| function inject_hover_for_element(elem){var elems=elem.getElementsByClassName("backlink");var ls=[];var l=elems.length;for(var idx=0;idx<l;idx++){var e=elems[idx];ls.push(e);} | ||||
| for(var elem in ls){inject_hover(prefix,ls[elem]);}} | ||||
| function init(prefix){inject_hover_for_element(document);var rpl=getReplyTo();rpl.setPrefix(prefix);var e=rpl.elem;e.setAttribute("draggable","true");var mouseDownX,mouseDownY;var originalX=window.screenX-150;var originalY=10;rpl.moveTo(originalX,originalY);e.addEventListener("dragstart",function(ev){mouseDownX=ev.clientX;mouseDownY=ev.clientY;if(!ev.ctrlKey){ev.preventDefault();}},false);e.addEventListener("dragend",function(ev){var x=originalX+ev.clientX-mouseDownX;var y=originalY+ev.clientY-mouseDownY;x-=window.screenLeft;y-=window.screenTop;rpl.moveTo(x,y);originalX=x;originalY=y;},false);e=document.getElementById("postform_submit");var postit=function(){var f=document.querySelector("form");var r=getReplyTo();r.showMessage("posting... ");r.post(function(j){if(j.error){r.showError(j.error);}else{r.showMessage("posted :^)");r.updateCaptcha();r.clear();}},function(err){r.showError(err);r.clearSolution();});} | ||||
| function init(prefix){inject_hover_for_element(document);var rpl=getReplyTo();rpl.setPrefix(prefix);var e=rpl.elem;var mouseDownX,mouseDownY;var originalX=window.screenX-50;var originalY=10;rpl.moveTo(originalX,originalY);e.addEventListener("mousedown",function(ev){mouseDownX=ev.clientX;mouseDownY=ev.clientY;},false);e.addEventListener("mouseup",function(ev){var x=originalX+ev.clientX-mouseDownX;var y=originalY+ev.clientY-mouseDownY;x-=window.screenLeft;y-=window.screenTop;rpl.moveTo(x,y);originalX=x;originalY=y;},false);e=document.getElementById("postform_submit");var postit=function(){var f=document.querySelector("form");var r=getReplyTo();r.showMessage("posting... ");r.post(function(j){if(j.error){r.showError(j.error);}else{r.showMessage("posted :^)");r.updateCaptcha();r.clear();}},function(err){r.showError(err);r.clearSolution();});} | ||||
| var f=document.querySelector("form");f.onsubmit=function(){postit();return false;}} | ||||
| /* ./contrib/js/theme.js */ | ||||
| function enable_theme(prefix,name){if(prefix&&name){var theme=document.getElementById("current_theme");if(theme){theme.href=prefix+"static/"+name+".css";var st=get_storage();st.nntpchan_prefix=prefix;st.nntpchan_theme=name;}}} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user