| |
| |
| |
| |
|
|
| (function(){ |
| 'use strict'; |
| |
| console.log('[VAI EXCEL FIX] Starting...'); |
| |
| |
| window._excelBlobRegistry = window._excelBlobRegistry || []; |
| |
| |
| function cleanupBlobs() { |
| window._excelBlobRegistry.forEach(function(e){ |
| try { URL.revokeObjectURL(e.url); } catch(err) {} |
| }); |
| window._excelBlobRegistry = []; |
| } |
| |
| window.addEventListener('pagehide', cleanupBlobs); |
| window.addEventListener('beforeunload', cleanupBlobs); |
| window.addEventListener('unload', cleanupBlobs); |
| |
| |
| var origRevoke = URL.revokeObjectURL; |
| URL.revokeObjectURL = function(url) { |
| if (!url || typeof url !== 'string' || !url.startsWith('blob:')) { |
| return origRevoke.call(this, url); |
| } |
| var exists = window._excelBlobRegistry.find(function(e){ return e.url === url; }); |
| if (!exists) { |
| window._excelBlobRegistry.push({url: url, created: Date.now()}); |
| return; |
| } |
| return origRevoke.call(this, url); |
| }; |
| |
| |
| var origSetTimeout = window.setTimeout; |
| window.setTimeout = function(fn, delay) { |
| try { |
| var fnStr = fn.toString(); |
| if (fnStr.includes('revokeObjectURL') && delay === 60000) { |
| console.log('[FIX] Blocked 60s revoke timeout'); |
| return null; |
| } |
| } catch(e) {} |
| return origSetTimeout.apply(this, arguments); |
| }; |
| |
| |
| if (typeof window.exportExcel !== 'function' || typeof window._doExportExcel !== 'function') { |
| var s = document.createElement('script'); |
| s.src = 'https://huggingface.co/spaces/bep40/V.AISTUDIO/resolve/main/qr-payment-v1039.js?_t=' + Date.now(); |
| document.head.appendChild(s); |
| } |
| |
| console.log('[VAI EXCEL FIX] Applied successfully - Excel multi-download ready'); |
| alert('✅ Excel multi-download fix đã áp dụng!\nBây giờ bạn có thể tải Excel nhiều lần.'); |
| })(); |