Download auto-excel-fix-loader.js from bep40/V.AISTUDIO: direct link, hf CLI and curl.
- Browser
- Download file 3.2 kB
-
https://huggingface.co/bep40/V.AISTUDIO/resolve/refs%2Fpr%2F21/auto-excel-fix-loader.js
- Command line
-
hf download hf://bep40/V.AISTUDIO@refs/pr/21/auto-excel-fix-loader.js
-
curl -L -o auto-excel-fix-loader.js https://huggingface.co/bep40/V.AISTUDIO/resolve/refs%2Fpr%2F21/auto-excel-fix-loader.js
3.2 kB
| /** | |
| * V.AI STUDIO - Auto Excel Fix Loader v2.0 | |
| * Tự động tải fix script nếu chưa có, inject vào cuối body | |
| * | |
| * CẬP NHẬT: Hỗ trợ cả fix v2.0 - multi-download hoàn hảo | |
| */ | |
| (function() { | |
| 'use strict'; | |
| // Kiểm tra xem file fix đã tồn tại chưa - ưu tiên v2 | |
| var fixFile = 'vai-excel-fix-v2.js'; | |
| var fixFileLegacy = 'vai-quote-excel-order-fix-v1050.js'; | |
| // Kiểm tra script đã load chưa | |
| function checkFixLoaded() { | |
| return (typeof window.VAI_EXCEL_FIX !== 'undefined') || | |
| (typeof window.VAI_FIX !== 'undefined') || | |
| document.querySelector('script[src*="vai-excel-fix"]'); | |
| } | |
| // Inject script tag | |
| function injectFix() { | |
| if (checkFixLoaded()) { | |
| console.log('[Auto Loader] Fix script already loaded'); | |
| return; | |
| } | |
| var script = document.createElement('script'); | |
| script.src = '/' + fixFile + '?v=' + Date.now(); | |
| script.onload = function() { | |
| console.log('[Auto Loader] Excel fix v2 loaded successfully - multi-download enabled'); | |
| }; | |
| script.onerror = function() { | |
| console.warn('[Auto Loader] v2 failed, trying legacy fix'); | |
| var legacy = document.createElement('script'); | |
| legacy.src = '/' + fixFileLegacy + '?v=' + Date.now(); | |
| legacy.onload = function() { | |
| console.log('[Auto Loader] Legacy fix loaded'); | |
| }; | |
| document.head.appendChild(legacy); | |
| }; | |
| document.head.appendChild(script); | |
| } | |
| // Inline fix fallback (backup) | |
| function applyInlineFix() { | |
| var originalRevoke = URL.revokeObjectURL; | |
| URL.revokeObjectURL = function(url) { | |
| if (!url || typeof url !== 'string') return originalRevoke.apply(this, arguments); | |
| if (url.startsWith('blob:')) { | |
| // Register but don't revoke immediately - blob persists until unload | |
| window.__VAI_BLOB_REGISTRY = window.__VAI_BLOB_REGISTRY || { blobs: [], isUnloading: false }; | |
| window.__VAI_BLOB_REGISTRY.blobs.push({ url: url, revoked: false }); | |
| window.addEventListener('beforeunload', function() { | |
| window.__VAI_BLOB_REGISTRY.isUnloading = true; | |
| window.__VAI_BLOB_REGISTRY.blobs.forEach(function(b) { | |
| if (!b.revoked) try { URL.revokeObjectURL(b.url); b.revoked = true; } catch(e) {} | |
| }); | |
| }); | |
| return; | |
| } | |
| return originalRevoke.apply(this, arguments); | |
| }; | |
| console.log('[Auto Loader] Inline fallback applied'); | |
| } | |
| // Chờ DOM ready | |
| if (document.readyState === 'loading') { | |
| document.addEventListener('DOMContentLoaded', injectFix); | |
| } else { | |
| injectFix(); | |
| } | |
| // Thử lại sau 2s nếu chưa load | |
| setTimeout(injectFix, 2000); | |
| setTimeout(injectFix, 5000); | |
| })(); | |
| // Legacy support for older fix loaders | |
| window.__VAI_BLOB_REGISTRY = window.__VAI_BLOB_REGISTRY || { blobs: [], registry: [], isUnloading: false }; |