charbelmalo commited on
Commit
85da4c7
β€’
1 Parent(s): 81ad533

gradio 5.5.0 hover functional but not deleting

Browse files
Files changed (3) hide show
  1. app.py +74 -64
  2. debugsrc.html +118 -0
  3. shortcuts.json +1 -1
app.py CHANGED
@@ -98,7 +98,7 @@ def generate_cards_html(datafra):
98
  </div>
99
  """
100
  card_html = f"""
101
- <div style="{style}" onmouseover="handleHover(event, {idx})" onmouseout="handleHoverOut(event, {idx})">
102
  {labels_html}
103
  <div style='font-size: 40px; text-align: center;'>{shortcut['emojis']}</div>
104
  <h3 style='text-align: center;'>{shortcut['name']}</h3>
@@ -117,65 +117,7 @@ def generate_cards_html(datafra):
117
  cards_html += '</div>'
118
 
119
  # Add JavaScript for handling hover and command/control key
120
- cards_html += """
121
- <script>
122
- let isCmdOrCtrl = false;
123
-
124
- window.addEventListener('keydown', function(e) {
125
- if (e.key === 'Meta' || e.key === 'Control') {
126
- isCmdOrCtrl = true;
127
- showDeleteIcons();
128
- }
129
- });
130
-
131
- window.addEventListener('keyup', function(e) {
132
- if (e.key === 'Meta' || e.key === 'Control') {
133
- isCmdOrCtrl = false;
134
- hideDeleteIcons();
135
- }
136
- });
137
-
138
- function handleHover(event, idx) {
139
- if (isCmdOrCtrl) {
140
- document.getElementById(`delete-${idx}`).style.display = 'block';
141
- }
142
- }
143
-
144
- function handleHoverOut(event, idx) {
145
- document.getElementById(`delete-${idx}`).style.display = 'none';
146
- }
147
-
148
- function showDeleteIcons() {
149
- const deleteIcons = document.querySelectorAll('[id="delete-1"]');
150
- deleteIcons.forEach(icon => {
151
- icon.style.display = 'block';
152
- });
153
- }
154
-
155
- function hideDeleteIcons() {
156
- const deleteIcons = document.querySelectorAll('[id^="delete-"]');
157
- deleteIcons.forEach(icon => {
158
- icon.style.display = 'none';
159
- });
160
- }
161
-
162
- function deleteShortcut(idx) {
163
- // Implement the delete functionality, e.g., call an API endpoint
164
- fetch('/delete_shortcut', {
165
- method: 'POST',
166
- headers: {
167
- 'Content-Type': 'application/json'
168
- },
169
- body: JSON.stringify({ index: idx })
170
- })
171
- .then(response => response.json())
172
- .then(data => {
173
- // Update the grid display
174
- document.getElementById('grid_output').innerHTML = data.grid_html;
175
- });
176
- }
177
- </script>
178
- """
179
  return cards_html
180
 
181
  def update_display(sort_by='Recently Added', search_query='', filter_tags=[]):
@@ -200,8 +142,67 @@ def toggle_favorite(index):
200
 
201
  load_shortcuts()
202
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
  # Build the Gradio App
204
- with gr.Blocks(theme="charbelgrower/Crystal") as demo:
205
 
206
  gr.Markdown("## Website Shortcuts")
207
  with gr.Row():
@@ -242,8 +243,6 @@ with gr.Blocks(theme="charbelgrower/Crystal") as demo:
242
  inputs=[name, tags, link, emojis, color_from, color_to, short_description],
243
  outputs=grid_output
244
  )
245
-
246
-
247
  # Expose endpoints for toggle functions
248
  api = FastAPI()
249
 
@@ -254,6 +253,17 @@ async def toggle_pin_route(request: Request):
254
  grid_html = toggle_pin(index)
255
  return {'grid_html': grid_html}
256
 
 
 
 
 
 
 
 
 
 
 
 
257
  @api.post("/toggle_favorite")
258
  async def toggle_favorite_route(request: Request):
259
  data = await request.json()
@@ -267,4 +277,4 @@ app = gr.mount_gradio_app(api, demo, path="/")
267
  if __name__ == "__main__":
268
  import uvicorn
269
  load_shortcuts()
270
- uvicorn.run(app, host="0.0.0.0", port=7860)
 
98
  </div>
99
  """
100
  card_html = f"""
101
+ <div style="{style}" onmouseover="handleHover({idx})" id="card-{idx}" onmouseout="handleHoverOut({idx})">
102
  {labels_html}
103
  <div style='font-size: 40px; text-align: center;'>{shortcut['emojis']}</div>
104
  <h3 style='text-align: center;'>{shortcut['name']}</h3>
 
117
  cards_html += '</div>'
118
 
119
  # Add JavaScript for handling hover and command/control key
120
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  return cards_html
122
 
123
  def update_display(sort_by='Recently Added', search_query='', filter_tags=[]):
 
142
 
143
  load_shortcuts()
144
 
145
+ js_code = f"""
146
+ function my_func() {{
147
+ window.isCmdOrCtrl = false;
148
+
149
+ window.addEventListener('keydown', function(e) {{
150
+ if (e.key === 'Meta' || e.key === 'Control') {{
151
+ window.isCmdOrCtrl = true;
152
+ window.showDeleteIcons();
153
+ }}
154
+ }});
155
+
156
+ window.addEventListener('keyup', function(e) {{
157
+ if (e.key === 'Meta' || e.key === 'Control') {{
158
+ window.isCmdOrCtrl = false;
159
+ window.hideDeleteIcons();
160
+ }}
161
+ }});
162
+
163
+ window.handleHover = function(event, idx) {{
164
+ if (window.isCmdOrCtrl) {{
165
+ document.getElementById('card-' + idx).style.display = 'block';
166
+ }}
167
+ }};
168
+
169
+ window.handleHoverOut = function(event, idx) {{
170
+ document.getElementById('card-'+ idx).style.display = 'none';
171
+ }};
172
+
173
+ window.showDeleteIcons = function() {{
174
+ const deleteIcons = document.querySelectorAll('[id^="delete-"]');
175
+ deleteIcons.forEach(icon => {{
176
+ icon.style.display = 'block';
177
+ }});
178
+ }};
179
+
180
+ window.hideDeleteIcons = function() {{
181
+ const deleteIcons = document.querySelectorAll('[id^="delete-"]');
182
+ deleteIcons.forEach(icon => {{
183
+ icon.style.display = 'none';
184
+ }});
185
+ }};
186
+
187
+ window.deleteShortcut = function(idx) {{
188
+ // Implement the delete functionality, e.g., call an API endpoint
189
+ fetch('/delete_shortcut', {{
190
+ method: 'POST',
191
+ headers: {{
192
+ 'Content-Type': 'application/json'
193
+ }},
194
+ body: JSON.stringify({{ index: idx }})
195
+ }})
196
+ .then(response => response.json())
197
+ .then(data => {{
198
+ // Update the grid display
199
+ document.getElementById('grid_output').innerHTML = data.grid_html;
200
+ }});
201
+ }};
202
+ }}
203
+ """
204
  # Build the Gradio App
205
+ with gr.Blocks(theme="charbelgrower/Crystal",js=js_code) as demo:
206
 
207
  gr.Markdown("## Website Shortcuts")
208
  with gr.Row():
 
243
  inputs=[name, tags, link, emojis, color_from, color_to, short_description],
244
  outputs=grid_output
245
  )
 
 
246
  # Expose endpoints for toggle functions
247
  api = FastAPI()
248
 
 
253
  grid_html = toggle_pin(index)
254
  return {'grid_html': grid_html}
255
 
256
+ @api.post("/delete_shortcut")
257
+ async def delete_shortcut_route(request: Request):
258
+ data = await request.json()
259
+ index = int(data['index'])
260
+ if 0 <= index < len(shortcuts_list):
261
+ del shortcuts_list[index]
262
+ save_shortcuts()
263
+ # Return updated HTML
264
+ grid_html = update_display()
265
+ return {'grid_html': grid_html}
266
+
267
  @api.post("/toggle_favorite")
268
  async def toggle_favorite_route(request: Request):
269
  data = await request.json()
 
277
  if __name__ == "__main__":
278
  import uvicorn
279
  load_shortcuts()
280
+ uvicorn.run(app, host="127.0.0.1", port=7860)
debugsrc.html ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <!doctype html>
3
+ <html
4
+ lang="en"
5
+ style="
6
+ margin: 0;
7
+ padding: 0;
8
+ min-height: 100%;
9
+ display: flex;
10
+ flex-direction: column;
11
+ "
12
+ >
13
+ <head>
14
+ <meta charset="utf-8" />
15
+ <meta
16
+ name="viewport"
17
+ content="width=device-width, initial-scale=1, shrink-to-fit=no"
18
+ />
19
+
20
+ <style>
21
+ :root {
22
+ --bg: #00000;
23
+ --col: #27272a;
24
+ --bg-dark: #0f0f11;
25
+ --col-dark: #f4f4f5;
26
+ }
27
+
28
+
29
+ body {
30
+ background: var(--bg);
31
+ color: var(--col);
32
+ font-family: Arial, Helvetica, sans-serif;
33
+ }
34
+
35
+ @media (prefers-color-scheme: dark) {
36
+ body {
37
+ background: var(--bg-dark);
38
+ color: var(--col-dark);
39
+ }
40
+ }
41
+ </style>
42
+
43
+ <meta property="og:url" content="https://gradio.app/" />
44
+ <meta property="og:type" content="website" />
45
+ <meta property="og:image" content="" />
46
+ <meta property="og:title" content="Gradio" />
47
+ <meta
48
+ property="og:description"
49
+ content=""
50
+ />
51
+ <meta name="twitter:card" content="summary_large_image" />
52
+ <meta name="twitter:creator" content="@teamGradio" />
53
+ <meta name="twitter:title" content="Gradio" />
54
+ <meta
55
+ name="twitter:description"
56
+ content=""
57
+ />
58
+ <meta name="twitter:image" content="" />
59
+
60
+ <script data-gradio-mode>
61
+ window.__gradio_mode__ = "app";
62
+ window.iFrameResizer = {
63
+ heightCalculationMethod: "taggedElement"
64
+ };
65
+ window.parent?.postMessage(
66
+ { type: "SET_SCROLLING", enabled: false },
67
+ "*"
68
+ );
69
+ </script>
70
+
71
+ <script>
72
+ window.gradio_config = {"version":"5.5.0","api_prefix":"/gradio_api","mode":"blocks","app_id":15757525916552852410,"dev_mode":false,"analytics_enabled":true,"components":[{"id":1,"type":"markdown","props":{"value":"## Website Shortcuts","show_label":false,"rtl":false,"latex_delimiters":[{"left":"$$","right":"$$","display":true}],"visible":true,"elem_classes":[],"sanitize_html":true,"line_breaks":false,"header_links":false,"show_copy_button":false,"container":false,"name":"markdown","_selectable":false},"skip_api":false,"component_class_id":"47f4a7917d7d455055ddfb54d4147dec","key":null,"api_info":{"type":"string"},"api_info_as_input":{"type":"string"},"api_info_as_output":{"type":"string"},"example_inputs":"# Hello!"},{"id":2,"type":"row","props":{"variant":"default","visible":true,"equal_height":false,"show_progress":false,"name":"row"},"skip_api":true,"component_class_id":"313a53a4f76f80198b3414a1821e1fa2","key":null},{"id":3,"type":"textbox","props":{"lines":1,"max_lines":20,"label":"Search","show_label":true,"container":true,"min_width":160,"visible":true,"autofocus":false,"autoscroll":true,"elem_classes":[],"type":"text","rtl":false,"show_copy_button":false,"submit_btn":false,"stop_btn":false,"name":"textbox","_selectable":false},"skip_api":false,"component_class_id":"09c75848e5328f6330816b435be2b6cb","key":null,"api_info":{"type":"string"},"api_info_as_input":{"type":"string"},"api_info_as_output":{"type":"string"},"example_inputs":"Hello!!"},{"id":4,"type":"dropdown","props":{"choices":[["Recently Added","Recently Added"],["Alphabetical","Alphabetical"],["Favorites","Favorites"]],"value":"Recently Added","type":"value","allow_custom_value":false,"filterable":true,"label":"Sort By","show_label":true,"container":true,"min_width":160,"visible":true,"elem_classes":[],"name":"dropdown","_selectable":false},"skip_api":false,"component_class_id":"2fe3459ec05e4acfc97195632a045e7a","key":null,"api_info":{"type":"string","enum":["Recently Added","Alphabetical","Favorites"]},"api_info_as_input":{"type":"string","enum":["Recently Added","Alphabetical","Favorites"]},"api_info_as_output":{"type":"string","enum":["Recently Added","Alphabetical","Favorites"]},"example_inputs":"Recently Added"},{"id":5,"type":"form","props":{"scale":2,"min_width":320,"name":"form"},"skip_api":true,"component_class_id":"829df243394d805ac7679e56e074d9b8","key":null},{"id":6,"type":"checkboxgroup","props":{"choices":[["Main","Main"],["Grower","Grower"]],"value":[],"type":"value","label":"Filter Tags","show_label":true,"container":true,"min_width":160,"visible":true,"elem_classes":[],"name":"checkboxgroup","_selectable":false},"skip_api":false,"component_class_id":"9c13e838e2c274b81df4ed33732ec952","key":null,"api_info":{"items":{"enum":["Main","Grower"],"type":"string"},"title":"Checkbox Group","type":"array"},"api_info_as_input":{"items":{"enum":["Main","Grower"],"type":"string"},"title":"Checkbox Group","type":"array"},"api_info_as_output":{"items":{"enum":["Main","Grower"],"type":"string"},"title":"Checkbox Group","type":"array"},"example_inputs":["Main"]},{"id":7,"type":"html","props":{"value":"\u003cdiv style=\"display: flex; flex-wrap: wrap;\"\u003e\n \u003cdiv style=\"\n background: linear-gradient(135deg, #000000, #000000);\n padding: 20px;\n border-radius: 10px;\n position: relative;\n color: white;\n width: 300px;\n margin: 10px;\n cursor: pointer;\n \" onmouseover=\"handleHover(event, 0)\" onmouseout=\"handleHoverOut(event, 0)\"\u003e\n \n \u003cdiv style=\u0027font-size: 40px; text-align: center;\u0027\u003e\u003c/div\u003e\n \u003ch3 style=\u0027text-align: center;\u0027\u003e\u003c/h3\u003e\n \u003cp style=\u0027text-align: center;\u0027\u003e\u003c/p\u003e\n \u003cdiv style=\u0027text-align: center;\u0027\u003e\n \u003cbutton style=\"background: none; border: none; cursor: pointer; opacity: 0.3; text-decoration: line-through;\" onclick=\"togglePin(0)\"\u003eπŸ“\u003c/button\u003e\n \u003cbutton style=\"background: none; border: none; cursor: pointer;\" onclick=\"toggleFavorite(0)\"\u003e🀍\u003c/button\u003e\n \u003cbutton onclick=\"window.open(\u0027\u0027, \u0027_blank\u0027)\"\u003eπŸ”— Open\u003c/button\u003e\n \u003c/div\u003e\n \u003cdiv id=\"delete-0\" style=\"display: none; position: absolute; top: 10px; left: 10px; cursor: pointer;\" onclick=\"deleteShortcut(0)\"\u003e\n πŸ—‘οΈ\n \u003c/div\u003e\n \u003c/div\u003e\n \n \u003cdiv style=\"\n background: linear-gradient(135deg, #931010, #33417a);\n padding: 20px;\n border-radius: 10px;\n position: relative;\n color: white;\n width: 300px;\n margin: 10px;\n cursor: pointer;\n \" onmouseover=\"handleHover(event, 1)\" onmouseout=\"handleHoverOut(event, 1)\"\u003e\n \n \u003cdiv style=\u0027position: absolute; top: 10px; right: 10px; font-size: 24px;\u0027\u003e\n \n ❀️\n \u003c/div\u003e\n \n \u003cdiv style=\u0027font-size: 40px; text-align: center;\u0027\u003e⚑\u003c/div\u003e\n \u003ch3 style=\u0027text-align: center;\u0027\u003eCharbel\u003c/h3\u003e\n \u003cp style=\u0027text-align: center;\u0027\u003easdasfd\u003c/p\u003e\n \u003cdiv style=\u0027text-align: center;\u0027\u003e\n \u003cbutton style=\"background: none; border: none; cursor: pointer; opacity: 0.3; text-decoration: line-through;\" onclick=\"togglePin(1)\"\u003eπŸ“\u003c/button\u003e\n \u003cbutton style=\"background: none; border: none; cursor: pointer;\" onclick=\"toggleFavorite(1)\"\u003e❀️\u003c/button\u003e\n \u003cbutton onclick=\"window.open(\u0027http://example.com\u0027, \u0027_blank\u0027)\"\u003eπŸ”— Open\u003c/button\u003e\n \u003c/div\u003e\n \u003cdiv id=\"delete-1\" style=\"display: none; position: absolute; top: 10px; left: 10px; cursor: pointer;\" onclick=\"deleteShortcut(1)\"\u003e\n πŸ—‘οΈ\n \u003c/div\u003e\n \u003c/div\u003e\n \n \u003cdiv style=\"\n background: linear-gradient(135deg, #931010, #33417a);\n padding: 20px;\n border-radius: 10px;\n position: relative;\n color: white;\n width: 300px;\n margin: 10px;\n cursor: pointer;\n \" onmouseover=\"handleHover(event, 2)\" onmouseout=\"handleHoverOut(event, 2)\"\u003e\n \n \u003cdiv style=\u0027font-size: 40px; text-align: center;\u0027\u003e⚑\u003c/div\u003e\n \u003ch3 style=\u0027text-align: center;\u0027\u003eCharbel\u003c/h3\u003e\n \u003cp style=\u0027text-align: center;\u0027\u003easdasfd\u003c/p\u003e\n \u003cdiv style=\u0027text-align: center;\u0027\u003e\n \u003cbutton style=\"background: none; border: none; cursor: pointer; opacity: 0.3; text-decoration: line-through;\" onclick=\"togglePin(2)\"\u003eπŸ“\u003c/button\u003e\n \u003cbutton style=\"background: none; border: none; cursor: pointer;\" onclick=\"toggleFavorite(2)\"\u003e🀍\u003c/button\u003e\n \u003cbutton onclick=\"window.open(\u0027http://example.com\u0027, \u0027_blank\u0027)\"\u003eπŸ”— Open\u003c/button\u003e\n \u003c/div\u003e\n \u003cdiv id=\"delete-2\" style=\"display: none; position: absolute; top: 10px; left: 10px; cursor: pointer;\" onclick=\"deleteShortcut(2)\"\u003e\n πŸ—‘οΈ\n \u003c/div\u003e\n \u003c/div\u003e\n \u003c/div\u003e\n \u003cscript\u003e\n let isCmdOrCtrl = false;\n\n window.addEventListener(\u0027keydown\u0027, function(e) {\n if (e.key === \u0027Meta\u0027 || e.key === \u0027Control\u0027) {\n isCmdOrCtrl = true;\n showDeleteIcons();\n }\n });\n\n window.addEventListener(\u0027keyup\u0027, function(e) {\n if (e.key === \u0027Meta\u0027 || e.key === \u0027Control\u0027) {\n isCmdOrCtrl = false;\n hideDeleteIcons();\n }\n });\n\n function handleHover(event, idx) {\n if (isCmdOrCtrl) {\n document.getElementById(`delete-${idx}`).style.display = \u0027block\u0027;\n }\n }\n\n function handleHoverOut(event, idx) {\n document.getElementById(`delete-${idx}`).style.display = \u0027none\u0027;\n }\n\n function showDeleteIcons() {\n const deleteIcons = document.querySelectorAll(\u0027[id^=\"delete-\"]\u0027);\n deleteIcons.forEach(icon =\u003e {\n icon.style.display = \u0027block\u0027;\n });\n }\n\n function hideDeleteIcons() {\n const deleteIcons = document.querySelectorAll(\u0027[id^=\"delete-\"]\u0027);\n deleteIcons.forEach(icon =\u003e {\n icon.style.display = \u0027none\u0027;\n });\n }\n\n function deleteShortcut(idx) {\n fetch(\u0027/delete_shortcut\u0027, {\n method: \u0027POST\u0027,\n headers: {\n \u0027Content-Type\u0027: \u0027application/json\u0027\n },\n body: JSON.stringify({ index: idx })\n })\n .then(response =\u003e response.json())\n .then(data =\u003e {\n document.getElementById(\u0027grid_output\u0027).innerHTML = data.grid_html;\n });\n }\n \u003c/script\u003e\n ","show_label":false,"visible":true,"elem_id":"grid_output","elem_classes":[],"name":"html","_selectable":false},"skip_api":false,"component_class_id":"f8ae0fac356b5e9e9f5997c9f39381eb","key":null,"api_info":{"type":"string"},"api_info_as_input":{"type":"string"},"api_info_as_output":{"type":"string"},"example_inputs":"\u003cp\u003eHello\u003c/p\u003e"},{"id":8,"type":"markdown","props":{"value":"## Add a New Website Shortcut","show_label":false,"rtl":false,"latex_delimiters":[{"left":"$$","right":"$$","display":true}],"visible":true,"elem_classes":[],"sanitize_html":true,"line_breaks":false,"header_links":false,"show_copy_button":false,"container":false,"name":"markdown","_selectable":false},"skip_api":false,"component_class_id":"47f4a7917d7d455055ddfb54d4147dec","key":null,"api_info":{"type":"string"},"api_info_as_input":{"type":"string"},"api_info_as_output":{"type":"string"},"example_inputs":"# Hello!"},{"id":9,"type":"row","props":{"variant":"default","visible":true,"equal_height":false,"show_progress":false,"name":"row"},"skip_api":true,"component_class_id":"313a53a4f76f80198b3414a1821e1fa2","key":null},{"id":10,"type":"textbox","props":{"lines":1,"max_lines":20,"label":"Name","show_label":true,"container":true,"min_width":160,"visible":true,"autofocus":false,"autoscroll":true,"elem_classes":[],"type":"text","rtl":false,"show_copy_button":false,"submit_btn":false,"stop_btn":false,"name":"textbox","_selectable":false},"skip_api":false,"component_class_id":"09c75848e5328f6330816b435be2b6cb","key":null,"api_info":{"type":"string"},"api_info_as_input":{"type":"string"},"api_info_as_output":{"type":"string"},"example_inputs":"Hello!!"},{"id":11,"type":"textbox","props":{"lines":1,"max_lines":20,"label":"Link","show_label":true,"container":true,"min_width":160,"visible":true,"autofocus":false,"autoscroll":true,"elem_classes":[],"type":"text","rtl":false,"show_copy_button":false,"submit_btn":false,"stop_btn":false,"name":"textbox","_selectable":false},"skip_api":false,"component_class_id":"09c75848e5328f6330816b435be2b6cb","key":null,"api_info":{"type":"string"},"api_info_as_input":{"type":"string"},"api_info_as_output":{"type":"string"},"example_inputs":"Hello!!"},{"id":12,"type":"form","props":{"scale":2,"min_width":320,"name":"form"},"skip_api":true,"component_class_id":"829df243394d805ac7679e56e074d9b8","key":null},{"id":13,"type":"row","props":{"variant":"default","visible":true,"equal_height":false,"show_progress":false,"name":"row"},"skip_api":true,"component_class_id":"313a53a4f76f80198b3414a1821e1fa2","key":null},{"id":14,"type":"textbox","props":{"lines":1,"max_lines":20,"label":"Tags (separate levels with \u0027/\u0027)","show_label":true,"container":true,"min_width":160,"visible":true,"autofocus":false,"autoscroll":true,"elem_classes":[],"type":"text","rtl":false,"show_copy_button":false,"submit_btn":false,"stop_btn":false,"name":"textbox","_selectable":false},"skip_api":false,"component_class_id":"09c75848e5328f6330816b435be2b6cb","key":null,"api_info":{"type":"string"},"api_info_as_input":{"type":"string"},"api_info_as_output":{"type":"string"},"example_inputs":"Hello!!"},{"id":15,"type":"textbox","props":{"lines":1,"max_lines":20,"label":"Emojis","show_label":true,"container":true,"min_width":160,"visible":true,"autofocus":false,"autoscroll":true,"elem_classes":[],"type":"text","rtl":false,"show_copy_button":false,"submit_btn":false,"stop_btn":false,"name":"textbox","_selectable":false},"skip_api":false,"component_class_id":"09c75848e5328f6330816b435be2b6cb","key":null,"api_info":{"type":"string"},"api_info_as_input":{"type":"string"},"api_info_as_output":{"type":"string"},"example_inputs":"Hello!!"},{"id":16,"type":"colorpicker","props":{"label":"Gradient Color From","show_label":true,"container":true,"min_width":160,"visible":true,"elem_classes":[],"name":"colorpicker","_selectable":false},"skip_api":false,"component_class_id":"b6e29717f9da6f8ee9e68786bdcdf52b","key":null,"api_info":{"type":"string"},"api_info_as_input":{"type":"string"},"api_info_as_output":{"type":"string"},"example_inputs":"#000000"},{"id":17,"type":"colorpicker","props":{"label":"Gradient Color To","show_label":true,"container":true,"min_width":160,"visible":true,"elem_classes":[],"name":"colorpicker","_selectable":false},"skip_api":false,"component_class_id":"b6e29717f9da6f8ee9e68786bdcdf52b","key":null,"api_info":{"type":"string"},"api_info_as_input":{"type":"string"},"api_info_as_output":{"type":"string"},"example_inputs":"#000000"},{"id":18,"type":"form","props":{"scale":2,"min_width":320,"name":"form"},"skip_api":true,"component_class_id":"829df243394d805ac7679e56e074d9b8","key":null},{"id":19,"type":"textbox","props":{"lines":1,"max_lines":20,"label":"Short Description","show_label":true,"container":true,"min_width":160,"visible":true,"autofocus":false,"autoscroll":true,"elem_classes":[],"type":"text","rtl":false,"show_copy_button":false,"submit_btn":false,"stop_btn":false,"name":"textbox","_selectable":false},"skip_api":false,"component_class_id":"09c75848e5328f6330816b435be2b6cb","key":null,"api_info":{"type":"string"},"api_info_as_input":{"type":"string"},"api_info_as_output":{"type":"string"},"example_inputs":"Hello!!"},{"id":20,"type":"button","props":{"value":"Add Shortcut","variant":"secondary","visible":true,"interactive":true,"elem_classes":[],"name":"button","_selectable":false},"skip_api":true,"component_class_id":"2cef5886dcd05b2d9540cf332d83a683","key":null},{"id":21,"type":"form","props":{"scale":0,"min_width":0,"name":"form"},"skip_api":true,"component_class_id":"829df243394d805ac7679e56e074d9b8","key":null},{"id":22,"type":"form","props":{"scale":0,"min_width":0,"name":"form"},"skip_api":true,"component_class_id":"829df243394d805ac7679e56e074d9b8","key":null}],"css":"","connect_heartbeat":false,"js":"\n \u003cscript\u003e\n let isCmdOrCtrl = false;\n\n window.addEventListener(\u0027keydown\u0027, function(e) {\n if (e.key === \u0027Meta\u0027 || e.key === \u0027Control\u0027) {\n isCmdOrCtrl = true;\n showDeleteIcons();\n }\n });\n\n window.addEventListener(\u0027keyup\u0027, function(e) {\n if (e.key === \u0027Meta\u0027 || e.key === \u0027Control\u0027) {\n isCmdOrCtrl = false;\n hideDeleteIcons();\n }\n });\n\n function handleHover(idx) {\n if (isCmdOrCtrl) {\n document.getElementById(`delete-${idx}`).style.display = \u0027block\u0027;\n }\n }\n\n function handleHoverOut(event, idx) {\n document.getElementById(`delete-${idx}`).style.display = \u0027none\u0027;\n }\n\n function showDeleteIcons() {\n const deleteIcons = document.querySelectorAll(\u0027[id^=\"delete-\"]\u0027);\n deleteIcons.forEach(icon =\u003e {\n icon.style.display = \u0027block\u0027;\n });\n }\n\n function hideDeleteIcons() {\n const deleteIcons = document.querySelectorAll(\u0027[id^=\"delete-\"]\u0027);\n deleteIcons.forEach(icon =\u003e {\n icon.style.display = \u0027none\u0027;\n });\n }\n\n function deleteShortcut(idx) {\n // Implement the delete functionality, e.g., call an API endpoint\n fetch(\u0027/delete_shortcut\u0027, {\n method: \u0027POST\u0027,\n headers: {\n \u0027Content-Type\u0027: \u0027application/json\u0027\n },\n body: JSON.stringify({ index: idx })\n })\n .then(response =\u003e response.json())\n .then(data =\u003e {\n // Update the grid display\n document.getElementById(\u0027grid_output\u0027).innerHTML = data.grid_html;\n });\n }\n \u003c/script\u003e\n ","head":"","title":"Gradio","space_id":null,"enable_queue":true,"show_error":true,"show_api":true,"is_colab":false,"max_file_size":null,"stylesheets":["https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;600\u0026display=swap","https://fonts.googleapis.com/css2?family=Inter:wght@400;600\u0026display=swap"],"theme":"charbelgrower/Crystal","protocol":"sse_v3","body_css":{"body_background_fill":"#00000","body_text_color":"#27272a","body_background_fill_dark":"#0f0f11","body_text_color_dark":"#f4f4f5"},"fill_height":false,"fill_width":false,"theme_hash":"f322243f01b4f40698dc227c874ccdcbba613448116f2810abfd7c916537b3e9","layout":{"id":0,"children":[{"id":1},{"id":2,"children":[{"id":5,"children":[{"id":3},{"id":4}]}]},{"id":21,"children":[{"id":6}]},{"id":7},{"id":8},{"id":9,"children":[{"id":12,"children":[{"id":10},{"id":11}]}]},{"id":13,"children":[{"id":18,"children":[{"id":14},{"id":15}]},{"id":16},{"id":17}]},{"id":22,"children":[{"id":19}]},{"id":20}]},"dependencies":[{"id":0,"targets":[[3,"change"]],"inputs":[3,4,6],"outputs":[7],"backend_fn":true,"js":null,"queue":true,"api_name":"refresh_display","scroll_to_output":false,"show_progress":"full","batch":false,"max_batch_size":4,"cancels":[],"types":{"generator":false,"cancel":false},"collects_event_data":false,"trigger_after":null,"trigger_only_on_success":false,"trigger_mode":"always_last","show_api":true,"zerogpu":false,"rendered_in":null,"connection":"sse","time_limit":null,"stream_every":0.5,"like_user_message":false,"event_specific_args":null},{"id":1,"targets":[[4,"change"]],"inputs":[3,4,6],"outputs":[7],"backend_fn":true,"js":null,"queue":true,"api_name":"refresh_display_1","scroll_to_output":false,"show_progress":"full","batch":false,"max_batch_size":4,"cancels":[],"types":{"generator":false,"cancel":false},"collects_event_data":false,"trigger_after":null,"trigger_only_on_success":false,"trigger_mode":"always_last","show_api":true,"zerogpu":false,"rendered_in":null,"connection":"sse","time_limit":null,"stream_every":0.5,"like_user_message":false,"event_specific_args":null},{"id":2,"targets":[[6,"change"]],"inputs":[3,4,6],"outputs":[7],"backend_fn":true,"js":null,"queue":true,"api_name":"refresh_display_2","scroll_to_output":false,"show_progress":"full","batch":false,"max_batch_size":4,"cancels":[],"types":{"generator":false,"cancel":false},"collects_event_data":false,"trigger_after":null,"trigger_only_on_success":false,"trigger_mode":"always_last","show_api":true,"zerogpu":false,"rendered_in":null,"connection":"sse","time_limit":null,"stream_every":0.5,"like_user_message":false,"event_specific_args":null},{"id":3,"targets":[[20,"click"]],"inputs":[10,14,11,15,16,17,19],"outputs":[7],"backend_fn":true,"js":null,"queue":true,"api_name":"add_shortcut","scroll_to_output":false,"show_progress":"full","batch":false,"max_batch_size":4,"cancels":[],"types":{"generator":false,"cancel":false},"collects_event_data":false,"trigger_after":null,"trigger_only_on_success":false,"trigger_mode":"once","show_api":true,"zerogpu":false,"rendered_in":null,"connection":"sse","time_limit":null,"stream_every":0.5,"like_user_message":false,"event_specific_args":null}],"root":"http://127.0.0.1:7860","username":null};</script><script>window.gradio_api_info = {"named_endpoints":{"/refresh_display":{"parameters":[{"label":"Search","parameter_name":"search_query","parameter_has_default":false,"parameter_default":null,"type":{"type":"string"},"python_type":{"type":"str","description":""},"component":"Textbox","example_input":"Hello!!"},{"label":"Sort By","parameter_name":"sort_by","parameter_has_default":true,"parameter_default":"Recently Added","type":{"type":"string","enum":["Recently Added","Alphabetical","Favorites"]},"python_type":{"type":"Literal[\u0027Recently Added\u0027, \u0027Alphabetical\u0027, \u0027Favorites\u0027]","description":""},"component":"Dropdown","example_input":"Recently Added"},{"label":"Filter Tags","parameter_name":"filter_tags","parameter_has_default":true,"parameter_default":[],"type":{"items":{"enum":["Main","Grower"],"type":"string"},"title":"Checkbox Group","type":"array"},"python_type":{"type":"List[Literal[\u0027Main\u0027, \u0027Grower\u0027]]","description":""},"component":"Checkboxgroup","example_input":["Main"]}],"returns":[{"label":"value_7","type":{"type":"string"},"python_type":{"type":"str","description":""},"component":"Html"}],"show_api":true},"/refresh_display_1":{"parameters":[{"label":"Search","parameter_name":"search_query","parameter_has_default":false,"parameter_default":null,"type":{"type":"string"},"python_type":{"type":"str","description":""},"component":"Textbox","example_input":"Hello!!"},{"label":"Sort By","parameter_name":"sort_by","parameter_has_default":true,"parameter_default":"Recently Added","type":{"type":"string","enum":["Recently Added","Alphabetical","Favorites"]},"python_type":{"type":"Literal[\u0027Recently Added\u0027, \u0027Alphabetical\u0027, \u0027Favorites\u0027]","description":""},"component":"Dropdown","example_input":"Recently Added"},{"label":"Filter Tags","parameter_name":"filter_tags","parameter_has_default":true,"parameter_default":[],"type":{"items":{"enum":["Main","Grower"],"type":"string"},"title":"Checkbox Group","type":"array"},"python_type":{"type":"List[Literal[\u0027Main\u0027, \u0027Grower\u0027]]","description":""},"component":"Checkboxgroup","example_input":["Main"]}],"returns":[{"label":"value_7","type":{"type":"string"},"python_type":{"type":"str","description":""},"component":"Html"}],"show_api":true},"/refresh_display_2":{"parameters":[{"label":"Search","parameter_name":"search_query","parameter_has_default":false,"parameter_default":null,"type":{"type":"string"},"python_type":{"type":"str","description":""},"component":"Textbox","example_input":"Hello!!"},{"label":"Sort By","parameter_name":"sort_by","parameter_has_default":true,"parameter_default":"Recently Added","type":{"type":"string","enum":["Recently Added","Alphabetical","Favorites"]},"python_type":{"type":"Literal[\u0027Recently Added\u0027, \u0027Alphabetical\u0027, \u0027Favorites\u0027]","description":""},"component":"Dropdown","example_input":"Recently Added"},{"label":"Filter Tags","parameter_name":"filter_tags","parameter_has_default":true,"parameter_default":[],"type":{"items":{"enum":["Main","Grower"],"type":"string"},"title":"Checkbox Group","type":"array"},"python_type":{"type":"List[Literal[\u0027Main\u0027, \u0027Grower\u0027]]","description":""},"component":"Checkboxgroup","example_input":["Main"]}],"returns":[{"label":"value_7","type":{"type":"string"},"python_type":{"type":"str","description":""},"component":"Html"}],"show_api":true},"/add_shortcut":{"parameters":[{"label":"Name","parameter_name":"name","parameter_has_default":false,"parameter_default":null,"type":{"type":"string"},"python_type":{"type":"str","description":""},"component":"Textbox","example_input":"Hello!!"},{"label":"Tags (separate levels with \u0027/\u0027)","parameter_name":"tags","parameter_has_default":false,"parameter_default":null,"type":{"type":"string"},"python_type":{"type":"str","description":""},"component":"Textbox","example_input":"Hello!!"},{"label":"Link","parameter_name":"link","parameter_has_default":false,"parameter_default":null,"type":{"type":"string"},"python_type":{"type":"str","description":""},"component":"Textbox","example_input":"Hello!!"},{"label":"Emojis","parameter_name":"emojis","parameter_has_default":false,"parameter_default":null,"type":{"type":"string"},"python_type":{"type":"str","description":""},"component":"Textbox","example_input":"Hello!!"},{"label":"Gradient Color From","parameter_name":"color_from","parameter_has_default":false,"parameter_default":null,"type":{"type":"string"},"python_type":{"type":"str","description":""},"component":"Colorpicker","example_input":"#000000"},{"label":"Gradient Color To","parameter_name":"color_to","parameter_has_default":false,"parameter_default":null,"type":{"type":"string"},"python_type":{"type":"str","description":""},"component":"Colorpicker","example_input":"#000000"},{"label":"Short Description","parameter_name":"short_description","parameter_has_default":false,"parameter_default":null,"type":{"type":"string"},"python_type":{"type":"str","description":""},"component":"Textbox","example_input":"Hello!!"}],"returns":[{"label":"value_7","type":{"type":"string"},"python_type":{"type":"str","description":""},"component":"Html"}],"show_api":true}},"unnamed_endpoints":{}};
73
+
74
+ </script>
75
+
76
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
77
+ <link
78
+ rel="preconnect"
79
+ href="https://fonts.gstatic.com"
80
+ crossorigin="anonymous"
81
+ />
82
+ <script
83
+ src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.1/iframeResizer.contentWindow.min.js"
84
+ async
85
+ ></script>
86
+ <script type="module" crossorigin src="./assets/index-Ya43XIXp.js"></script>
87
+ <link rel="stylesheet" crossorigin href="./assets/index-_g6Rc0H7.css">
88
+ </head>
89
+
90
+ <body
91
+ style="
92
+ width: 100%;
93
+ margin: 0;
94
+ padding: 0;
95
+ display: flex;
96
+ flex-direction: column;
97
+ flex-grow: 1;
98
+ "
99
+ >
100
+ <gradio-app
101
+ control_page_title="true"
102
+ embed="false"
103
+ eager="true"
104
+ style="display: flex; flex-direction: column; flex-grow: 1"
105
+ >
106
+ </gradio-app>
107
+ <script>
108
+ const ce = document.getElementsByTagName("gradio-app");
109
+
110
+ if (ce[0]) {
111
+ ce[0].addEventListener("domchange", () => {
112
+ document.body.style.padding = "0";
113
+ });
114
+ document.body.style.padding = "0";
115
+ }
116
+ </script>
117
+ </body>
118
+ </html>
shortcuts.json CHANGED
@@ -1 +1 @@
1
- [{"name": "Charbel", "tags": ["Grower", "Main"], "link": "http://example.com", "emojis": "\u26a1", "color_from": "#931010", "color_to": "#33417a", "short_description": "asdasfd", "pinned": false, "favorited": false, "date_added": "2024-11-12T23:04:40.313478"}, {"name": "Charbel", "tags": ["Grower", "Main"], "link": "http://example.com", "emojis": "\u26a1", "color_from": "#931010", "color_to": "#33417a", "short_description": "asdasfd", "pinned": false, "favorited": true, "date_added": "2024-11-12T23:04:42.705989"}, {"name": "", "tags": [], "link": "", "emojis": "", "color_from": "#000000", "color_to": "#000000", "short_description": "", "pinned": false, "favorited": false, "date_added": "2024-11-12T23:05:43.625612"}]
 
1
+ [{"name": "", "tags": [], "link": "", "emojis": "", "color_from": "#000000", "color_to": "#000000", "short_description": "", "pinned": false, "favorited": false, "date_added": "2024-11-12 23:05:43.625612"}]