bep40 commited on
Commit
94e690d
·
verified ·
1 Parent(s): 41709e3

Upload EXCEL_FIX_BOOKMARK.js

Browse files
Files changed (1) hide show
  1. EXCEL_FIX_BOOKMARK.js +62 -0
EXCEL_FIX_BOOKMARK.js ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* === V.AI STUDIO EXCEL MULTI-DOWNLOAD FIX ===
2
+ * Copy toàn bộ nội dung này vào Bookmark URL (bookmarklet)
3
+ * Hoặc paste vào Console (F12) để chạy ngay
4
+ */
5
+
6
+ (function(){
7
+ 'use strict';
8
+
9
+ console.log('[VAI EXCEL FIX] Starting...');
10
+
11
+ // Blob registry để không revoke ngay
12
+ window._excelBlobRegistry = window._excelBlobRegistry || [];
13
+
14
+ // Cleanup khi đóng tab
15
+ function cleanupBlobs() {
16
+ window._excelBlobRegistry.forEach(function(e){
17
+ try { URL.revokeObjectURL(e.url); } catch(err) {}
18
+ });
19
+ window._excelBlobRegistry = [];
20
+ }
21
+
22
+ window.addEventListener('pagehide', cleanupBlobs);
23
+ window.addEventListener('beforeunload', cleanupBlobs);
24
+ window.addEventListener('unload', cleanupBlobs);
25
+
26
+ // Override URL.revokeObjectURL - không revoke blob URL
27
+ var origRevoke = URL.revokeObjectURL;
28
+ URL.revokeObjectURL = function(url) {
29
+ if (!url || typeof url !== 'string' || !url.startsWith('blob:')) {
30
+ return origRevoke.call(this, url);
31
+ }
32
+ var exists = window._excelBlobRegistry.find(function(e){ return e.url === url; });
33
+ if (!exists) {
34
+ window._excelBlobRegistry.push({url: url, created: Date.now()});
35
+ return;
36
+ }
37
+ return origRevoke.call(this, url);
38
+ };
39
+
40
+ // Override setTimeout - chặn revoke 60s
41
+ var origSetTimeout = window.setTimeout;
42
+ window.setTimeout = function(fn, delay) {
43
+ try {
44
+ var fnStr = fn.toString();
45
+ if (fnStr.includes('revokeObjectURL') && delay === 60000) {
46
+ console.log('[FIX] Blocked 60s revoke timeout');
47
+ return null;
48
+ }
49
+ } catch(e) {}
50
+ return origSetTimeout.apply(this, arguments);
51
+ };
52
+
53
+ // Load script fix nếu chưa có
54
+ if (typeof window.exportExcel !== 'function' || typeof window._doExportExcel !== 'function') {
55
+ var s = document.createElement('script');
56
+ s.src = 'https://huggingface.co/spaces/bep40/V.AISTUDIO/resolve/main/qr-payment-v1039.js?_t=' + Date.now();
57
+ document.head.appendChild(s);
58
+ }
59
+
60
+ console.log('[VAI EXCEL FIX] Applied successfully - Excel multi-download ready');
61
+ alert('✅ Excel multi-download fix đã áp dụng!\nBây giờ bạn có thể tải Excel nhiều lần.');
62
+ })();