broadfield-dev commited on
Commit
90d757e
·
verified ·
1 Parent(s): e78e1d7

Update gradio_sidebar.py

Browse files
Files changed (1) hide show
  1. gradio_sidebar.py +84 -18
gradio_sidebar.py CHANGED
@@ -1,48 +1,67 @@
1
  head="""
2
  <script>
3
  function open_control() {
4
- var panel = document.querySelector('#gs_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 #gs_control_panel'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  console.log('panel is open, closing')
17
-
18
  };
19
  };
20
-
21
  </script>
22
  """
23
  css="""
24
- .contain #gs_control_panel {
25
  position: fixed;
26
- right: 110%;
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 #gs_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;
@@ -55,6 +74,53 @@ css="""
55
  background: #1e293b;
56
  height: fit-content;
57
  width: fit-content;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  }
59
  """
60
- topbar="""<div id='top_bar'><div class='control_btn' name='control_btn' id='control_btn' onclick='open_control()'>Controls</div></div>"""
 
 
 
1
  head="""
2
  <script>
3
  function open_control() {
4
+ var panel = document.querySelector('#gs_top_control_panel');
 
5
  var split_json = []
6
  var out_json = []
7
  split_json = panel.classList.value.split(' ')
 
8
  console.log(split_json.length)
9
  if (split_json.length === 2 || panel.classList.value.includes(" ")) {
10
  panel.classList.toggle('open');
11
  console.log('clicked')
12
  } else {
13
+ panel.classList = '.contain #gs_top_control_panel'
14
+ console.log('panel is open, closing')
15
+ };
16
+ };
17
+ function left_open_control() {
18
+ var panel = document.querySelector('#gs_left_control_panel');
19
+ var left_bar = document.querySelector('#gs_left_bar');
20
+ var left_btn = document.querySelector('#left_control_btn');
21
+ var split_json = []
22
+ var out_json = []
23
+ split_json = panel.classList.value.split(' ')
24
+ console.log(split_json.length)
25
+ if (split_json.length === 2 || panel.classList.value.includes(" ")) {
26
+ panel.classList.toggle('open');
27
+ left_bar.classList.toggle('open');
28
+ left_btn.classList.toggle('open');
29
+ console.log('clicked')
30
+ } else {
31
+ panel.classList = '.contain #gs_left_control_panel'
32
+ left_bar.classList = '#gs_left_bar'
33
+ left_btn.classList = '#left_control_btn'
34
  console.log('panel is open, closing')
 
35
  };
36
  };
 
37
  </script>
38
  """
39
  css="""
40
+ .contain #gs_top_control_panel {
41
  position: fixed;
42
+ right: 100%;
43
  z-index: 9999;
44
  width: 40%;
45
  top: 50px;
46
  box-shadow: 0 0 12px 0px black;
47
  transition: right 0.5s ease;
48
  }
49
+ .contain #gs_top_control_panel.open {
50
  right: 60%;
51
  }
52
+ .contain #gs_left_control_panel {
 
 
53
  position: fixed;
54
+ right: 100%;
55
+ z-index: 9999;
56
+ width: 40%;
57
+ top: 50px;
58
+ box-shadow: 0 0 12px 0px black;
59
+ transition: right 0.5s linear;
60
+ }
61
+ .contain #gs_left_control_panel.open {
62
+ right: 60%;
63
  }
64
+ #top_control_btn {
65
  height: 20px;
66
  padding: 10px;
67
  cursor: pointer;
 
74
  background: #1e293b;
75
  height: fit-content;
76
  width: fit-content;
77
+ }
78
+ #left_control_btn {
79
+ padding: 10px;
80
+ cursor: pointer;
81
+ border-radius: 5px;
82
+ color: white;
83
+ position: fixed;
84
+ z-index: 2147483647;
85
+ top: 45px;
86
+ left: -20px;
87
+ background: rgb(30, 41, 59);
88
+ height: fit-content;
89
+ width: fit-content;
90
+ transition: left 0.5s linear;
91
+ transform: rotate(90deg);
92
+
93
+ }
94
+ #left_control_btn.open{
95
+ left:340px;
96
+ }
97
+ .contain #gs_top_bar {
98
+ height: 50px;
99
+ width: 100%;
100
+ position: fixed;
101
+ background: #185991;
102
+ top: 0px;
103
+ left: 0px;
104
+ z-index: 99999;
105
+ }
106
+ .contain #gs_top_bar.open {
107
+ left:350px;
108
+ }
109
+ #gs_left_bar {
110
+ height: 100%;
111
+ width: 360px;
112
+ position: fixed;
113
+ background: rgb(24, 89, 145);
114
+ top: 0px;
115
+ left: -370px;
116
+ z-index: 9999;
117
+ transition: left 0.5s linear;
118
+
119
+ }
120
+ #gs_left_bar.open {
121
+ left: 0px;
122
  }
123
  """
124
+ topbar="""<div id='gs_top_bar'><div id='top_control_btn' onclick='open_control()'>Controls</div></div>"""
125
+ leftbar="""<div id='gs_left_bar'><div id='left_control_btn' onclick='left_open_control()'>Controls</div></div>"""
126
+ rightbar="""<div id='gs_top_bar'><div id='right_control_btn' onclick='open_control()'>Controls</div></div>"""