File size: 2,180 Bytes
94e690d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | /* === V.AI STUDIO EXCEL MULTI-DOWNLOAD FIX ===
* Copy toàn bộ nội dung này vào Bookmark URL (bookmarklet)
* Hoặc paste vào Console (F12) để chạy ngay
*/
(function(){
'use strict';
console.log('[VAI EXCEL FIX] Starting...');
// Blob registry để không revoke ngay
window._excelBlobRegistry = window._excelBlobRegistry || [];
// Cleanup khi đóng tab
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);
// Override URL.revokeObjectURL - không revoke blob URL
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);
};
// Override setTimeout - chặn revoke 60s
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);
};
// Load script fix nếu chưa có
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.');
})(); |