yuchenlin commited on
Commit
05080c5
1 Parent(s): ea254dd

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +59 -0
index.html CHANGED
@@ -4,6 +4,49 @@
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>Gradio App Iframe</title>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  </head>
8
  <body>
9
  <iframe src="https://7f935803acb1c81b86.gradio.live/" width="100%" height="100%" style="border:none;">
@@ -11,3 +54,19 @@
11
  </iframe>
12
  </body>
13
  </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>Gradio App Iframe</title>
7
+ <script>
8
+ // This script sets up drag-and-drop event listeners
9
+ document.addEventListener('DOMContentLoaded', (event) => {
10
+ // Prevent default drag behaviors
11
+ ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
12
+ document.body.addEventListener(eventName, preventDefaults, false)
13
+ });
14
+
15
+ function preventDefaults(e) {
16
+ e.preventDefault();
17
+ e.stopPropagation();
18
+ }
19
+
20
+ // Highlight effect when dragging files over
21
+ ['dragenter', 'dragover'].forEach(eventName => {
22
+ document.body.addEventListener(eventName, highlight, false)
23
+ });
24
+
25
+ ['dragleave', 'drop'].forEach(eventName => {
26
+ document.body.addEventListener(eventName, unhighlight, false)
27
+ });
28
+
29
+ function highlight(e) {
30
+ document.body.style.backgroundColor = 'lightgrey';
31
+ }
32
+
33
+ function unhighlight(e) {
34
+ document.body.style.backgroundColor = '';
35
+ }
36
+
37
+ // Handle dropped files
38
+ document.body.addEventListener('drop', handleDrop, false);
39
+
40
+ function handleDrop(e) {
41
+ let dt = e.dataTransfer;
42
+ let files = dt.files;
43
+
44
+ // Process the files here
45
+ // Note: You won't be able to pass these files directly to the iframe due to CORS policies.
46
+ console.log(files);
47
+ }
48
+ });
49
+ </script>
50
  </head>
51
  <body>
52
  <iframe src="https://7f935803acb1c81b86.gradio.live/" width="100%" height="100%" style="border:none;">
 
54
  </iframe>
55
  </body>
56
  </html>
57
+
58
+
59
+ <!-- <!DOCTYPE html>
60
+ <html lang="en">
61
+ <head>
62
+ <meta charset="UTF-8">
63
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
64
+ <title>Gradio App Iframe</title>
65
+ </head>
66
+ <body>
67
+ <iframe src="https://7f935803acb1c81b86.gradio.live/" width="100%" height="100%" style="border:none;">
68
+ Your browser does not support iframes. Please click this <a href="https://7f935803acb1c81b86.gradio.live/">url</a>.
69
+ </iframe>
70
+ </body>
71
+ </html>
72
+ -->