Spaces:
Running
Running
Update index.html
Browse files- index.html +34 -1
index.html
CHANGED
@@ -5,7 +5,40 @@
|
|
5 |
}
|
6 |
.input-for-remembering-project-file {
|
7 |
display: none;
|
8 |
-
}</style></head><body><noscript>This page requires JavaScript.</noscript><input type="file" class="input-for-remembering-project-file" autocomplete="on"><div id="app"></div
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
// This logic is only for the "splash" screen.
|
10 |
// It's used to prevent a momentary white screen while the page is loading in dark mode.
|
11 |
var theme = 'system';
|
|
|
5 |
}
|
6 |
.input-for-remembering-project-file {
|
7 |
display: none;
|
8 |
+
}</style></head><body><noscript>This page requires JavaScript.</noscript><input type="file" class="input-for-remembering-project-file" autocomplete="on"><div id="app"></div>
|
9 |
+
<script>
|
10 |
+
(async () => {
|
11 |
+
const links = document.querySelectorAll('a[href^="blob:"]');
|
12 |
+
for (const link of links) {
|
13 |
+
link.onclick = async (event) => {
|
14 |
+
event.preventDefault();
|
15 |
+
try {
|
16 |
+
const blobURL = link.href;
|
17 |
+
const blob = await fetch(blobURL).then(res => res.blob());
|
18 |
+
const handle = await window.showSaveFilePicker({
|
19 |
+
suggestedName: 'downloaded-file',
|
20 |
+
types: [{
|
21 |
+
description: 'All Files',
|
22 |
+
accept: { '*/*': ['.*'] }
|
23 |
+
}]
|
24 |
+
});
|
25 |
+
const writable = await handle.createWritable();
|
26 |
+
await writable.write(blob);
|
27 |
+
await writable.close();
|
28 |
+
alert('File saved successfully!');
|
29 |
+
} catch (error) {
|
30 |
+
console.error('Error saving file:', error);
|
31 |
+
alert('Failed to save the file.');
|
32 |
+
}
|
33 |
+
};
|
34 |
+
link.href = 'javascript:void(0)';
|
35 |
+
link.textContent += ' (Download)';
|
36 |
+
}
|
37 |
+
alert('Links replaced successfully!');
|
38 |
+
})();
|
39 |
+
|
40 |
+
</script>
|
41 |
+
<script>(function() {
|
42 |
// This logic is only for the "splash" screen.
|
43 |
// It's used to prevent a momentary white screen while the page is loading in dark mode.
|
44 |
var theme = 'system';
|