Desktop site dialog box can now move, #2841
Ylian Saint-Hilaire committed
Jul 2, 2021 at 14:32 UTC
b949fb63463fbc38f56973980b13460a119d2c76
2 files changed
+33
public/styles/style.css
+1
@@ -527,6 +527,7 @@ body {
527
color: #FFF;
528
border-radius: 5px 5px 0 0;
529
margin-bottom: 6px;
530
+ cursor: move;
531
}
532
533
#id_dialogclose {
views/default.handlebars
+32
@@ -1584,6 +1584,9 @@
1584
1585
// Override the collapse button text
1586
updateCollapseAllButton();
1587
+
1588
+ // Make the dialog box movable
1589
+ dialogBoxDrag();
1590
}
1591
1592
function refreshCookieSession() {
@@ -15742,6 +15745,35 @@
15745
if (closeDialog) { setDialogMode(0); }
15746
}
15747
15748
+ // Make the dialog box movable
15749
+ function dialogBoxDrag() {
15750
+ var elmnt = Q('dialog');
15751
+ var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
15752
+ Q('dialogHeader').onmousedown = dragMouseDown;
15753
+ function dragMouseDown(e) {
15754
+ e = e || window.event;
15755
+ e.preventDefault();
15756
+ pos3 = e.clientX;
15757
+ pos4 = e.clientY;
15758
+ document.onmouseup = closeDragElement;
15759
+ document.onmousemove = elementDrag;
15760
+ }
15761
+ function elementDrag(e) {
15762
+ e = e || window.event;
15763
+ e.preventDefault();
15764
+ pos1 = pos3 - e.clientX;
15765
+ pos2 = pos4 - e.clientY;
15766
+ pos3 = e.clientX;
15767
+ pos4 = e.clientY;
15768
+ elmnt.style.top = (elmnt.offsetTop - pos2) + 'px';
15769
+ elmnt.style.left = (elmnt.offsetLeft - pos1) + 'px';
15770
+ }
15771
+ function closeDragElement() {
15772
+ document.onmouseup = null;
15773
+ document.onmousemove = null;
15774
+ }
15775
+ }
15776
+
15777
</script>
15778
</body>
15779
</html>
\ No newline at end of file