Create split
Browse files
split
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
/*
|
3 |
+
© 2023 Samuel Bradshaw
|
4 |
+
https://github.com/samuelbradshaw/transcript-tracer-js
|
5 |
+
*/
|
6 |
+
|
7 |
+
|
8 |
+
if (window.addEventListener) {
|
9 |
+
window.addEventListener("resize", browserResize);
|
10 |
+
} else if (window.attachEvent) {
|
11 |
+
window.attachEvent("onresize", browserResize);
|
12 |
+
}
|
13 |
+
|
14 |
+
function browserResize() {
|
15 |
+
fixDragBtn();
|
16 |
+
}
|
17 |
+
|
18 |
+
var dragging = false;
|
19 |
+
var stack;
|
20 |
+
function fixDragBtn() {
|
21 |
+
var leftpadding, dragleft, buttonwidth
|
22 |
+
|
23 |
+
var containertop = Number(w3_getStyleValue(document.getElementById("container"), "top").replace("px", ""));
|
24 |
+
|
25 |
+
leftareasize = Number(w3_getStyleValue(document.getElementById("left-area-wrapper"), "width").replace("px", ""));
|
26 |
+
leftpadding = Number(w3_getStyleValue(document.getElementById("left-area"), "padding-left").replace("px", ""));
|
27 |
+
buttonwidth = Number(w3_getStyleValue(document.getElementById("dragbar"), "width").replace("px", ""));
|
28 |
+
leftareaheight = w3_getStyleValue(document.getElementById("left-area-wrapper"), "height");
|
29 |
+
|
30 |
+
dragleft = leftareasize + leftpadding + (leftpadding / 2) - (buttonwidth / 2);
|
31 |
+
|
32 |
+
document.getElementById("dragbar").style.width = "5px";
|
33 |
+
document.getElementById("dragbar").style.top = containertop + "px";
|
34 |
+
document.getElementById("dragbar").style.left = dragleft + "px";
|
35 |
+
document.getElementById("dragbar").style.height = leftareaheight;
|
36 |
+
document.getElementById("dragbar").style.cursor = "col-resize";
|
37 |
+
}
|
38 |
+
|
39 |
+
function dragstart(e) {
|
40 |
+
e.preventDefault();
|
41 |
+
dragging = true;
|
42 |
+
}
|
43 |
+
|
44 |
+
function dragmove(e) {
|
45 |
+
if (dragging)
|
46 |
+
{
|
47 |
+
document.getElementById("shield").style.display = "block";
|
48 |
+
|
49 |
+
var percentage = (e.pageX / window.innerWidth) * 100;
|
50 |
+
if (percentage > 5 && percentage < 98) {
|
51 |
+
var mainPercentage = 100-percentage;
|
52 |
+
document.getElementById("left-area-container").style.width = percentage + "%";
|
53 |
+
document.getElementById("right-area-container").style.width = mainPercentage + "%";
|
54 |
+
fixDragBtn();
|
55 |
+
}
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
function dragend() {
|
60 |
+
document.getElementById("shield").style.display = "none";
|
61 |
+
dragging = false;
|
62 |
+
}
|
63 |
+
|
64 |
+
if (window.addEventListener) {
|
65 |
+
document.getElementById("dragbar").addEventListener("mousedown", function(e) {dragstart(e);});
|
66 |
+
document.getElementById("dragbar").addEventListener("touchstart", function(e) {dragstart(e);});
|
67 |
+
window.addEventListener("mousemove", function(e) {dragmove(e);});
|
68 |
+
window.addEventListener("touchmove", function(e) {dragmove(e);});
|
69 |
+
window.addEventListener("mouseup", dragend);
|
70 |
+
window.addEventListener("touchend", dragend);
|
71 |
+
window.addEventListener("load", fixDragBtn);
|
72 |
+
}
|
73 |
+
|
74 |
+
function w3_getStyleValue(elmnt,style) {
|
75 |
+
if (window.getComputedStyle) {
|
76 |
+
return window.getComputedStyle(elmnt,null).getPropertyValue(style);
|
77 |
+
} else {
|
78 |
+
return elmnt.currentStyle[style];
|
79 |
+
}
|
80 |
+
}
|