bep40 commited on
Commit
2db3d6b
·
verified ·
1 Parent(s): ed22b21

Upload vai-excel-images-auto-inject.js

Browse files
Files changed (1) hide show
  1. vai-excel-images-auto-inject.js +47 -0
vai-excel-images-auto-inject.js ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * V.AI STUDIO - Auto Inject Excel Images Fix
3
+ * Tự động tải script có hỗ trợ hình ảnh Excel
4
+ */
5
+
6
+ (function() {
7
+ 'use strict';
8
+
9
+ var IMAGE_FIX_URL = '/vai-export-fixed-v6.js?v=' + Date.now();
10
+
11
+ function hasImageFix() {
12
+ return !!document.querySelector('script[src*="vai-export-fixed-v6.js"], script[src*="vai-excel-images-fix-v2.js"]');
13
+ }
14
+
15
+ function removeOldScripts() {
16
+ var oldScripts = document.querySelectorAll('script[src*="vai-export-fixed.js"]:not([src*="v6"]):not([src*="images"])');
17
+ oldScripts.forEach(function(s) { s.remove(); });
18
+ }
19
+
20
+ function injectImageFix() {
21
+ if (hasImageFix()) return;
22
+
23
+ var s = document.createElement('script');
24
+ s.src = IMAGE_FIX_URL;
25
+ s.onload = function() {
26
+ console.log('[VAI Injector] ✅ Excel images fix loaded');
27
+ };
28
+ s.onerror = function() {
29
+ console.warn('[VAI Injector] ❌ Could not load images fix');
30
+ };
31
+ document.head.appendChild(s);
32
+ }
33
+
34
+ function init() {
35
+ removeOldScripts();
36
+ injectImageFix();
37
+ }
38
+
39
+ if (document.readyState === 'loading') {
40
+ document.addEventListener('DOMContentLoaded', init);
41
+ } else {
42
+ init();
43
+ }
44
+
45
+ setTimeout(init, 1000);
46
+
47
+ })();