adgo back to drag events
This commit is contained in:
parent
3fdda45425
commit
def0a4a5c5
@ -359,26 +359,23 @@ function init(prefix) {
|
|||||||
var originalY = 10;
|
var originalY = 10;
|
||||||
rpl.moveTo(originalX, originalY);
|
rpl.moveTo(originalX, originalY);
|
||||||
|
|
||||||
var mousedown = false;
|
e.setAttribute("draggable", "true");
|
||||||
|
|
||||||
e.addEventListener("mousedown", function(ev) {
|
e.addEventListener("dragstart", function(ev) {
|
||||||
console.log(ev);
|
console.log(ev);
|
||||||
mousedown = true;
|
mousedown = true;
|
||||||
mouseDownX = ev.clientX;
|
mouseDownX = ev.clientX;
|
||||||
mouseDownY = ev.clientY;
|
mouseDownY = ev.clientY;
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
e.addEventListener("mouseup", function(ev) {
|
e.addEventListener("dragend", function(ev) {
|
||||||
var x = originalX + ev.clientX - mouseDownX;
|
var x = originalX + ev.clientX - mouseDownX;
|
||||||
var y = originalY + ev.clientY - mouseDownY;
|
var y = originalY + ev.clientY - mouseDownY;
|
||||||
x -= window.screenLeft;
|
x -= window.screenLeft;
|
||||||
y -= window.screenTop;
|
y -= window.screenTop;
|
||||||
if (mousedown) {
|
|
||||||
rpl.moveTo(x, y);
|
rpl.moveTo(x, y);
|
||||||
originalX = x;
|
originalX = x;
|
||||||
originalY = y;
|
originalY = y;
|
||||||
mousedown = false;
|
|
||||||
}
|
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
// add replyto post handlers
|
// add replyto post handlers
|
||||||
|
@ -81,7 +81,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 originalX=window.screenX-50;var originalY=10;rpl.moveTo(originalX,originalY);var mousedown=false;e.addEventListener("mousedown",function(ev){console.log(ev);mousedown=true;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;if(mousedown){rpl.moveTo(x,y);originalX=x;originalY=y;mousedown=false;}},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.setAttribute("draggable","true");e.addEventListener("dragstart",function(ev){console.log(ev);mousedown=true;mouseDownX=ev.clientX;mouseDownY=ev.clientY;},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();});}
|
||||||
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;}}}
|
||||||
|
Reference in New Issue
Block a user