Archived
1
0
This commit is contained in:
Jeff 2016-05-03 14:36:18 -04:00
parent 23c4f455d5
commit f6f84f25c8
2 changed files with 4 additions and 4 deletions

View File

@ -159,7 +159,7 @@ DynReply.prototype.translate = function(dx, dy) {
DynReply.prototype.moveTo = function(x,y) { DynReply.prototype.moveTo = function(x,y) {
console.log("moveto",x,y); console.log("moveto",x,y);
if(x && y) { if(x && y && x > 0 && y > 0) {
var nx = document.body.clientLeft - x ; var nx = document.body.clientLeft - x ;
if (nx > 0 && y > 0 && nx < document.body.clientWidth && y < document.body.clientHeight ) { if (nx > 0 && y > 0 && nx < document.body.clientWidth && y < document.body.clientHeight ) {
this.elem.setAttribute("style", "top: "+y+"px; right: "+nx+"px;"); this.elem.setAttribute("style", "top: "+y+"px; right: "+nx+"px;");
@ -400,7 +400,7 @@ function init(prefix) {
e.addEventListener("dragend", function(ev) { e.addEventListener("dragend", function(ev) {
var rpl = getReplyTo(); var rpl = getReplyTo();
console.log(mouseDownX, mouseDownY); console.log(mouseDownX, mouseDownY, rpl);
var ox = rpl.getX(); var ox = rpl.getX();
var oy = rpl.getY(); var oy = rpl.getY();
var dx = ox + ev.screenX - mouseDownX; var dx = ox + ev.screenX - mouseDownX;

View File

@ -56,7 +56,7 @@ table.appendChild(tbody);this.form.appendChild(table);this.elem.appendChild(this
DynReply.prototype.getX=function(){return this.x;} DynReply.prototype.getX=function(){return this.x;}
DynReply.prototype.getY=function(){return this.y;} DynReply.prototype.getY=function(){return this.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);};} 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);};}
DynReply.prototype.moveTo=function(x,y){console.log("moveto",x,y);if(x&&y){var nx=document.body.clientLeft-x;if(nx>0&&y>0&&nx<document.body.clientWidth&&y<document.body.clientHeight){this.elem.setAttribute("style","top: "+y+"px; right: "+nx+"px;");this.x=x;this.y=y;}}else{console.log("!!",x,y);}} DynReply.prototype.moveTo=function(x,y){console.log("moveto",x,y);if(x&&y&&x>0&&y>0){var nx=document.body.clientLeft-x;if(nx>0&&y>0&&nx<document.body.clientWidth&&y<document.body.clientHeight){this.elem.setAttribute("style","top: "+y+"px; right: "+nx+"px;");this.x=x;this.y=y;}}else{console.log("!!",x,y);}}
DynReply.prototype.update=function(){if(this.prefix){this.updateCaptcha();if(this.board&&this.roothash){var ref=document.getElementById("postform_reference");ref.setAttribute("value",this.roothash);this.url=this.prefix+"post/"+this.board+"?t=json";}}} DynReply.prototype.update=function(){if(this.prefix){this.updateCaptcha();if(this.board&&this.roothash){var ref=document.getElementById("postform_reference");ref.setAttribute("value",this.roothash);this.url=this.prefix+"post/"+this.board+"?t=json";}}}
DynReply.prototype.show=function(){console.log("show dynreply");this.update();this.elem.style.display='inline';} DynReply.prototype.show=function(){console.log("show dynreply");this.update();this.elem.style.display='inline';}
DynReply.prototype.hide=function(){console.log("hide dynreply");this.elem.style.display="none";} DynReply.prototype.hide=function(){console.log("hide dynreply");this.elem.style.display="none";}
@ -84,7 +84,7 @@ parent.appendChild(wrapper);parent.backlink=false;},function(msg){var wrapper=do
parent.backlink=true;}};parent.backlink=true;} 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);} 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]);}} 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;var mouseDownX,mouseDownY;var ox=document.body.clientWidth-50;var oy=10;rpl.moveTo(ox,oy);e.setAttribute("draggable","true");e.addEventListener("dragstart",function(ev){console.log(ev);mouseDownX=ev.screenX;mouseDownY=ev.screenY;if(!ev.shiftKey){ev.preventDefault();}},false);e.addEventListener("dragend",function(ev){var rpl=getReplyTo();console.log(mouseDownX,mouseDownY);var ox=rpl.getX();var oy=rpl.getY();var dx=ox+ev.screenX-mouseDownX;var dy=oy+ev.screenY-mouseDownY;console.log(ox,oy,dx,dy);rpl.translate(dx,dy);},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 ox=document.body.clientWidth-50;var oy=10;rpl.moveTo(ox,oy);e.setAttribute("draggable","true");e.addEventListener("dragstart",function(ev){console.log(ev);mouseDownX=ev.screenX;mouseDownY=ev.screenY;if(!ev.shiftKey){ev.preventDefault();}},false);e.addEventListener("dragend",function(ev){var rpl=getReplyTo();console.log(mouseDownX,mouseDownY,rpl);var ox=rpl.getX();var oy=rpl.getY();var dx=ox+ev.screenX-mouseDownX;var dy=oy+ev.screenY-mouseDownY;console.log(ox,oy,dx,dy);rpl.translate(dx,dy);},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;}} var f=document.querySelector("form");f.onsubmit=function(){postit();return false;}}
/* ./contrib/js/theme.js */ /* ./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;}}} 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;}}}