Update index.html
Browse files- index.html +20 -60
index.html
CHANGED
@@ -1,61 +1,21 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
position: absolute;
|
19 |
-
top: 0;
|
20 |
-
left: 0;
|
21 |
-
width: 100%;
|
22 |
-
height: 100%;
|
23 |
}
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
height: 100%;
|
28 |
-
}
|
29 |
-
</style>
|
30 |
-
</head>
|
31 |
-
|
32 |
-
<body>
|
33 |
-
<div class="fullscreen-iframe">
|
34 |
-
<iframe id="dynamic-iframe" frameborder="0" allowfullscreen crossorigin allow="cross-origin-isolated"></iframe>
|
35 |
-
</div>
|
36 |
-
|
37 |
-
<script>
|
38 |
-
function onDOMContentLoaded() {
|
39 |
-
document.removeEventListener("DOMContentLoaded", onDOMContentLoaded);
|
40 |
-
|
41 |
-
var currentUrl = window.location.href;
|
42 |
-
|
43 |
-
var regex = /https:\/\/([\w]+)-([\w-]+)\.static\.hf\.space/;
|
44 |
-
var match = currentUrl.match(regex);
|
45 |
-
|
46 |
-
if (match) {
|
47 |
-
var repo = match[1];
|
48 |
-
var space = match[2];
|
49 |
-
var targetUrl = "https://huggingface.co/spaces/" + repo + "/" + space
|
50 |
-
console.log("targetUrl:", targetUrl)
|
51 |
-
document.getElementById("dynamic-iframe").src = targetUrl;
|
52 |
-
} else {
|
53 |
-
console.error("URL pattern does not match.");
|
54 |
-
}
|
55 |
-
}
|
56 |
-
document.addEventListener("DOMContentLoaded", onDOMContentLoaded);
|
57 |
-
|
58 |
-
</script>
|
59 |
-
</body>
|
60 |
-
|
61 |
-
</html>
|
|
|
1 |
+
<script>
|
2 |
+
function onDOMContentLoaded() {
|
3 |
+
document.removeEventListener("DOMContentLoaded", onDOMContentLoaded);
|
4 |
+
|
5 |
+
var currentUrl = window.location.href;
|
6 |
+
|
7 |
+
var regex = /https:\/\/([\w]+)-([\w-]+)\.static\.hf\.space/;
|
8 |
+
var match = currentUrl.match(regex);
|
9 |
+
|
10 |
+
if (match) {
|
11 |
+
var repo = match[1];
|
12 |
+
var space = match[2];
|
13 |
+
var targetUrl = "https://huggingface.co/spaces/" + repo + "/" + space;
|
14 |
+
console.log("Redirecting to:", targetUrl);
|
15 |
+
window.location.href = targetUrl;
|
16 |
+
} else {
|
17 |
+
console.error("URL pattern does not match.");
|
|
|
|
|
|
|
|
|
|
|
18 |
}
|
19 |
+
}
|
20 |
+
document.addEventListener("DOMContentLoaded", onDOMContentLoaded);
|
21 |
+
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|