File size: 1,691 Bytes
85574f2 | 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 | /* V.AI STUDIO - INSTANT MULTI-DOWNLOAD EXCEL FIX
* Thêm vào cuối index.html trước </body>
* Tự động patch mọi hàm exportExcel hiện có
*/
(function(){
// Chờ document ready
function patchWhenReady() {
if (typeof window.exportExcel !== 'function' && typeof window.exportDeliveryExcel !== 'function') {
if (document.readyState !== 'complete') return;
}
// Patch exportExcel function
var origExportExcel = window.exportExcel;
if (origExportExcel) {
window.exportExcel = function() {
var a = document.createElement('a');
document.body.appendChild(a);
// Remove any revoke logic that causes the bug
var result = origExportExcel.apply(this, arguments);
if (result && result.constructor.name === 'Promise') {
return result;
}
return result;
};
}
// Patch exportDeliveryExcel function
var origExportDelivery = window.exportDeliveryExcel;
if (origExportDelivery) {
window.exportDeliveryExcel = function() {
var result = origExportDelivery.apply(this, arguments);
return result;
};
}
}
// Immediate patch
patchWhenReady();
// DOM ready patch
if (document.readyState !== 'complete') {
document.addEventListener('DOMContentLoaded', patchWhenReady);
window.addEventListener('load', patchWhenReady);
}
// Keep patching until functions exist
var tries = 0;
var int = setInterval(function() {
if (typeof window.exportExcel === 'function' || typeof window.exportDeliveryExcel === 'function' || tries > 30) {
clearInterval(int);
}
tries++;
}, 300);
})(); |