Create gradio_sidebar
Browse files- gradio_sidebar +59 -0
gradio_sidebar
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
head="""
|
2 |
+
<script>
|
3 |
+
function open_control() {
|
4 |
+
var panel = document.querySelector('#control_panel');
|
5 |
+
|
6 |
+
var split_json = []
|
7 |
+
var out_json = []
|
8 |
+
split_json = panel.classList.value.split(' ')
|
9 |
+
|
10 |
+
console.log(split_json.length)
|
11 |
+
if (split_json.length === 2 || panel.classList.value.includes(" ")) {
|
12 |
+
panel.classList.toggle('open');
|
13 |
+
console.log('clicked')
|
14 |
+
} else {
|
15 |
+
panel.classList = '.contain #control_panel'
|
16 |
+
console.log('panel is open, closing')
|
17 |
+
|
18 |
+
};
|
19 |
+
};
|
20 |
+
|
21 |
+
</script>
|
22 |
+
"""
|
23 |
+
css="""
|
24 |
+
.contain #control_panel {
|
25 |
+
position: fixed;
|
26 |
+
right: 100%;
|
27 |
+
z-index: 9999;
|
28 |
+
width: 40%;
|
29 |
+
top: 50px;
|
30 |
+
box-shadow: 0 0 12px 0px black;
|
31 |
+
transition: right 0.5s ease;
|
32 |
+
}
|
33 |
+
.contain #control_panel.open {
|
34 |
+
right: 60%;
|
35 |
+
}
|
36 |
+
#top_bar {
|
37 |
+
height: 50px;
|
38 |
+
width: 100%;
|
39 |
+
position: fixed;
|
40 |
+
background: #185991;
|
41 |
+
top: 0px;
|
42 |
+
left: 0px;
|
43 |
+
z-index: 99999;
|
44 |
+
}
|
45 |
+
#control_btn {
|
46 |
+
height: 20px;
|
47 |
+
padding: 10px;
|
48 |
+
cursor: pointer;
|
49 |
+
border-radius: 5px;
|
50 |
+
color: white;
|
51 |
+
position: fixed;
|
52 |
+
z-index: 9999999999999999;
|
53 |
+
top: 5px;
|
54 |
+
left: 10px;
|
55 |
+
background: #1e293b;
|
56 |
+
height: fit-content;
|
57 |
+
width: fit-content;
|
58 |
+
}
|
59 |
+
"""
|