Add V.AISTUDIO Quote bookmarklet - one-click activation
Browse files- BOOKMARKLET-GUIDE.md +113 -0
BOOKMARKLET-GUIDE.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## 🚀 CÁCH KÍCH HOẠT TÍNH NĂNG BÁO GIÁ (Không cần sửa index.html)
|
| 2 |
+
|
| 3 |
+
### ✅ Cách dùng (Chỉ 1 lần duy nhất):
|
| 4 |
+
|
| 5 |
+
1. **Mở Space:** https://bep40-v-aistudio.static.hf.space
|
| 6 |
+
2. **Thêm sản phẩm vào giỏ hàng**
|
| 7 |
+
3. **Kéo đoạn mã sau vào thanh bookmark của trình duyệt:**
|
| 8 |
+
|
| 9 |
+
```javascript
|
| 10 |
+
javascript:(function(){
|
| 11 |
+
if(window._vaiPatched)return alert('✅ Đã kích hoạt rồi!');
|
| 12 |
+
['vai-complete-quote.js','export-functions.js'].forEach(f=>{
|
| 13 |
+
if(!document.querySelector('script[src*="'+f+'"]')){
|
| 14 |
+
var s=document.createElement('script');
|
| 15 |
+
s.src=f+'?v='+Date.now();
|
| 16 |
+
document.body.appendChild(s);
|
| 17 |
+
}
|
| 18 |
+
});
|
| 19 |
+
setTimeout(function(){
|
| 20 |
+
var f=document.getElementById('cartFooter');
|
| 21 |
+
if(f&&!f.querySelector('[onclick*="saveOrder"]')){
|
| 22 |
+
f.insertAdjacentHTML('beforeend','<div style="display:flex;gap:6px;margin-top:6px"><button onclick="saveOrder()" style="flex:1;padding:10px;background:#059669;color:#fff;border:none;border-radius:10px;font-weight:700;cursor:pointer"><i class="fas fa-save"></i> Lưu</button><button onclick="openOrderPage()" style="flex:1;padding:10px;background:#7c3aed;color:#fff;border:none;border-radius:10px;font-weight:700;cursor:pointer"><i class="fas fa-receipt"></i> Đơn hàng</button><button onclick="exportDeliveryExcel()" style="flex:1;padding:10px;background:#217346;color:#fff;border:none;border-radius:10px;font-weight:700;cursor:pointer"><i class="fas fa-truck"></i> Excel Giao</button><button onclick="exportDeliveryPDF()" style="flex:1;padding:10px;background:#dc3545;color:#fff;border:none;border-radius:10px;font-weight:700;cursor:pointer"><i class="fas fa-file-pdf"></i> PDF Giao</button></div>');
|
| 23 |
+
}
|
| 24 |
+
alert('✅ Đã kích hoạt tính năng Báo Giá!\nNhấn OK để tải lại trang...');
|
| 25 |
+
location.reload();
|
| 26 |
+
},1500);
|
| 27 |
+
})();
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
### 📖 Các bước chi tiết:
|
| 31 |
+
|
| 32 |
+
#### Bước 1: Tạo Bookmark
|
| 33 |
+
1. Mở Chrome/Firefox
|
| 34 |
+
2. Nhấn `Ctrl+Shift+O` (Chrome) hoặc `Ctrl+Shift+B` (Firefox) để mở Bookmark Manager
|
| 35 |
+
3. Tạo bookmark mới
|
| 36 |
+
4. **Tên:** `VAI Quote Activate`
|
| 37 |
+
5. **URL:** Paste toàn bộ đoạn mã `javascript:` ở trên vào ô URL
|
| 38 |
+
|
| 39 |
+
#### Bước 2: Kích hoạt
|
| 40 |
+
1. Mở Space: https://bep40-v-aistudio.static.hf.space
|
| 41 |
+
2. **Nhấn bookmark `VAI Quote Activate`** trên thanh bookmark
|
| 42 |
+
3. Đợi 2-3 giây, trang sẽ tự động tải lại
|
| 43 |
+
4. **Hoàn tất!** Tính năng Báo Giá đã sẵn sàng
|
| 44 |
+
|
| 45 |
+
---
|
| 46 |
+
|
| 47 |
+
### 🧪 Cách khác: Chạy trực tiếp trong Console
|
| 48 |
+
|
| 49 |
+
1. Mở Space
|
| 50 |
+
2. Nhấn `F12` để mở DevTools
|
| 51 |
+
3. Chuyển sang tab `Console`
|
| 52 |
+
4. **Copy & Paste** toàn bộ mã sau vào Console và nhấn `Enter`:
|
| 53 |
+
|
| 54 |
+
```javascript
|
| 55 |
+
(function(){
|
| 56 |
+
if(window._vaiPatched)return console.log('✅ Already patched!');
|
| 57 |
+
console.log('🔧 Loading V.AISTUDIO quote dependencies...');
|
| 58 |
+
['vai-complete-quote.js','export-functions.js'].forEach(f=>{
|
| 59 |
+
if(!document.querySelector('script[src*="'+f+'"]')){
|
| 60 |
+
var s=document.createElement('script');
|
| 61 |
+
s.src=f+'?v='+Date.now();
|
| 62 |
+
s.onload=()=>console.log('✅ Loaded: '+f);
|
| 63 |
+
s.onerror=()=>console.error('❌ Failed: '+f);
|
| 64 |
+
document.body.appendChild(s);
|
| 65 |
+
}
|
| 66 |
+
});
|
| 67 |
+
setTimeout(function(){
|
| 68 |
+
var f=document.getElementById('cartFooter');
|
| 69 |
+
if(f&&!f.querySelector('[onclick*="saveOrder"]')){
|
| 70 |
+
f.insertAdjacentHTML('beforeend','<div style="display:flex;gap:6px;margin-top:6px"><button onclick="saveOrder()" style="flex:1;padding:10px;background:#059669;color:#fff;border:none;border-radius:10px;font-weight:700;cursor:pointer"><i class="fas fa-save"></i> Lưu</button><button onclick="openOrderPage()" style="flex:1;padding:10px;background:#7c3aed;color:#fff;border:none;border-radius:10px;font-weight:700;cursor:pointer"><i class="fas fa-receipt"></i> Đơn hàng</button><button onclick="exportDeliveryExcel()" style="flex:1;padding:10px;background:#217346;color:#fff;border:none;border-radius:10px;font-weight:700;cursor:pointer"><i class="fas fa-truck"></i> Excel Giao</button><button onclick="exportDeliveryPDF()" style="flex:1;padding:10px;background:#dc3545;color:#fff;border:none;border-radius:10px;font-weight:700;cursor:pointer"><i class="fas fa-file-pdf"></i> PDF Giao</button></div>');
|
| 71 |
+
console.log('✅ Added missing cart buttons!');
|
| 72 |
+
}
|
| 73 |
+
console.log('✅ V.AISTUDIO Quote System Activated!');
|
| 74 |
+
window._vaiPatched=true;
|
| 75 |
+
},1500);
|
| 76 |
+
})();
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
---
|
| 80 |
+
|
| 81 |
+
### ✅ Kiểm tra sau khi kích hoạt
|
| 82 |
+
|
| 83 |
+
1. Mở giỏ hàng (icon giỏ hàng trên header)
|
| 84 |
+
2. Nhấn **"Báo giá"**
|
| 85 |
+
3. Nhập mã **`V.AISTUDIO`**
|
| 86 |
+
4. Kiểm tra các nút:
|
| 87 |
+
- ✅ **"Lưu"** (saveOrder)
|
| 88 |
+
- ✅ **"Đơn hàng"** (openOrderPage)
|
| 89 |
+
- ✅ **"Excel Giao"** (exportDeliveryExcel)
|
| 90 |
+
- ✅ **"PDF Giao"** (exportDeliveryPDF)
|
| 91 |
+
|
| 92 |
+
---
|
| 93 |
+
|
| 94 |
+
### 🔗 Link tham khảo
|
| 95 |
+
|
| 96 |
+
- **Space đang chạy:** https://bep40-v-aistudio.static.hf.space
|
| 97 |
+
- **Source code:** https://huggingface.co/spaces/bep40/vaistudio-fixed
|
| 98 |
+
- **File JS đã tải:**
|
| 99 |
+
- `vai-complete-quote.js`: https://huggingface.co/spaces/bep40/V.AISTUDIO/blob/main/vai-complete-quote.js
|
| 100 |
+
- `export-functions.js`: https://huggingface.co/spaces/bep40/V.AISTUDIO/blob/main/export-functions.js
|
| 101 |
+
|
| 102 |
+
---
|
| 103 |
+
|
| 104 |
+
### ⚠️ Lưu ý
|
| 105 |
+
|
| 106 |
+
- Bookmarklet/Console method **không làm thay đổi file `index.html`**
|
| 107 |
+
- Tính năng sẽ mất khi tải lại trang (trừ khi nhấn bookmark lại)
|
| 108 |
+
- **Cách vĩnh viễn:** Cần thêm 1 dòng `<script src="quote-loader.js"></script>` vào `index.html`
|
| 109 |
+
- Để tự động hóa vĩnh viễn, bạn cần sửa `index.html` theo hướng dẫn trong `HUONG-DAN-CAP-NHAT.md`
|
| 110 |
+
|
| 111 |
+
---
|
| 112 |
+
|
| 113 |
+
**✅ Đã tạo xong bookmarklet! Chỉ cần kéo vào bookmark bar và nhấn 1 lần là xong! 🎉**
|