Spaces:
Running
Running
Fix: add OG meta tags for share preview, enlarge quotation images (72px table, 80px PDF), increase Excel image column width
Browse files- index.html +41 -9
index.html
CHANGED
|
@@ -4,7 +4,17 @@
|
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width,initial-scale=1">
|
| 6 |
<title>V.AI STUDIO | Niềm tin khách hàng là tài sản của chúng tôi</title>
|
| 7 |
-
<meta name="description" content="V.AI STUDIO —
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
<link rel="icon" href="https://huggingface.co/spaces/bep40/V.AISTUDIO/resolve/main/logo/favicon.png">
|
| 9 |
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap" rel="stylesheet">
|
| 10 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
|
@@ -407,7 +417,7 @@ textarea.form-input{height:120px;resize:vertical}
|
|
| 407 |
.quote-table{width:100%;border-collapse:collapse;font-size:.78rem;margin-top:8px}
|
| 408 |
.quote-table th{background:var(--p);color:#fff;padding:8px 6px;font-weight:600;text-align:center;white-space:nowrap}
|
| 409 |
.quote-table td{padding:8px 6px;border-bottom:1px solid var(--gl);vertical-align:middle}
|
| 410 |
-
.quote-table .qt-img{width:
|
| 411 |
.quote-table .qt-name{font-weight:600;color:var(--d)}
|
| 412 |
.quote-table .qt-price{text-align:right;white-space:nowrap}
|
| 413 |
.quote-table .qt-disc{width:80px;padding:5px 6px;border:1.5px solid var(--gl);border-radius:6px;font-size:.78rem;text-align:right;font-family:inherit;outline:none}
|
|
@@ -816,7 +826,19 @@ let slugUrl='/san-pham/'+p.slug+'/index.html';
|
|
| 816 |
history.pushState({type:'product',idx:idx},'',slugUrl);
|
| 817 |
}
|
| 818 |
_skipHistory=false;
|
| 819 |
-
document.title=p.name+' | '+p.brand+' -
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 820 |
document.getElementById('listView').style.display='none';
|
| 821 |
document.querySelector('.hero').style.display='none';
|
| 822 |
let dv=document.getElementById('detailView');
|
|
@@ -905,6 +927,16 @@ document.getElementById('detailView').innerHTML='';
|
|
| 905 |
document.getElementById('listView').style.display='';
|
| 906 |
document.querySelector('.hero').style.display='';
|
| 907 |
document.title='V.AI STUDIO | Niềm tin khách hàng là tài sản của chúng tôi';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 908 |
history.pushState({type:'list'},'','/');
|
| 909 |
}
|
| 910 |
|
|
@@ -1339,8 +1371,8 @@ let _shareData={title:'',text:'',url:''};
|
|
| 1339 |
async function shareProduct(slug,name){
|
| 1340 |
let url=location.origin+'/san-pham/'+slug+'/index.html';
|
| 1341 |
let title=name||document.title;
|
| 1342 |
-
let text=title+' -
|
| 1343 |
-
// Try native share first
|
| 1344 |
if(navigator.share){
|
| 1345 |
try{await navigator.share({title,text,url});return}catch(e){if(e.name==='AbortError')return}
|
| 1346 |
}
|
|
@@ -1929,7 +1961,7 @@ let discStyle='width:80px;padding:5px 6px;border:1.5px solid var(--gl);border-ra
|
|
| 1929 |
discStyle+=locked?'background:var(--l);cursor:not-allowed':'background:#fff';
|
| 1930 |
return `<tr>
|
| 1931 |
<td style="text-align:center">${i+1}</td>
|
| 1932 |
-
<td><img class="qt-img" src="${c.image}" alt="" crossorigin="anonymous" onerror="this.style.display='none'"></td>
|
| 1933 |
<td class="qt-name">${c.name}</td>
|
| 1934 |
<td style="text-align:center">${model}</td>
|
| 1935 |
<td style="font-size:.72rem;color:var(--g);max-width:160px">${specs}</td>
|
|
@@ -1991,7 +2023,7 @@ wb.creator='Malloca Vietnam';
|
|
| 1991 |
let ws=wb.addWorksheet('Báo Giá');
|
| 1992 |
ws.columns=[
|
| 1993 |
{key:'stt',width:6},{key:'name',width:32},{key:'model',width:16},{key:'specs',width:28},
|
| 1994 |
-
{key:'image',width:
|
| 1995 |
{key:'total',width:18},{key:'note',width:18}
|
| 1996 |
];
|
| 1997 |
// Header
|
|
@@ -2046,7 +2078,7 @@ if(allSameRatio&&ratio<1&&ratio>0)discountPct=Math.round(ratio*100);
|
|
| 2046 |
|
| 2047 |
qd.items.forEach((item,idx)=>{
|
| 2048 |
let row=ws.getRow(r);
|
| 2049 |
-
row.height=
|
| 2050 |
// A: STT
|
| 2051 |
let cA=row.getCell(1);cA.value=item.stt;
|
| 2052 |
cA.alignment={horizontal:'center',vertical:'middle'};
|
|
@@ -2203,7 +2235,7 @@ div.id='pdfRender';
|
|
| 2203 |
div.style.cssText='position:fixed;top:-9999px;left:0;width:1100px;background:#fff;padding:40px;font-family:Inter,Arial,sans-serif';
|
| 2204 |
let itemsHtml=qd.items.map(it=>`<tr style="border-bottom:1px solid #e2e8f0">
|
| 2205 |
<td style="padding:10px 6px;text-align:center;font-size:13px">${it.stt}</td>
|
| 2206 |
-
<td style="padding:10px 6px"><img src="${it.image}" style="width:
|
| 2207 |
<td style="padding:10px 6px;font-size:12px;font-weight:600">${it.name}</td>
|
| 2208 |
<td style="padding:10px 6px;text-align:center;font-size:12px">${it.model}</td>
|
| 2209 |
<td style="padding:10px 6px;font-size:11px;color:#64748b;max-width:180px">${it.specs}</td>
|
|
|
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width,initial-scale=1">
|
| 6 |
<title>V.AI STUDIO | Niềm tin khách hàng là tài sản của chúng tôi</title>
|
| 7 |
+
<meta name="description" content="V.AI STUDIO — 8000+ sản phẩm thiết bị nhà bếp & điện máy. Malloca, Eurogold, Grob, Canzy, Demax & Điện Máy Xanh chính hãng.">
|
| 8 |
+
<meta property="og:type" content="website">
|
| 9 |
+
<meta property="og:site_name" content="V.AI STUDIO">
|
| 10 |
+
<meta property="og:title" id="ogTitle" content="V.AI STUDIO | Niềm tin khách hàng là tài sản của chúng tôi">
|
| 11 |
+
<meta property="og:description" id="ogDesc" content="8000+ sản phẩm thiết bị nhà bếp & điện máy chính hãng. Malloca, Eurogold, Grob, Canzy, Demax & Điện Máy Xanh.">
|
| 12 |
+
<meta property="og:image" id="ogImage" content="https://huggingface.co/spaces/bep40/V.AISTUDIO/resolve/main/logo/logo_600.png">
|
| 13 |
+
<meta property="og:url" id="ogUrl" content="https://bep40-v-aistudio.static.hf.space/">
|
| 14 |
+
<meta name="twitter:card" content="summary_large_image">
|
| 15 |
+
<meta name="twitter:title" id="twTitle" content="V.AI STUDIO">
|
| 16 |
+
<meta name="twitter:description" id="twDesc" content="8000+ sản phẩm thiết bị nhà bếp & điện máy chính hãng">
|
| 17 |
+
<meta name="twitter:image" id="twImage" content="https://huggingface.co/spaces/bep40/V.AISTUDIO/resolve/main/logo/logo_600.png">
|
| 18 |
<link rel="icon" href="https://huggingface.co/spaces/bep40/V.AISTUDIO/resolve/main/logo/favicon.png">
|
| 19 |
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap" rel="stylesheet">
|
| 20 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
|
|
|
| 417 |
.quote-table{width:100%;border-collapse:collapse;font-size:.78rem;margin-top:8px}
|
| 418 |
.quote-table th{background:var(--p);color:#fff;padding:8px 6px;font-weight:600;text-align:center;white-space:nowrap}
|
| 419 |
.quote-table td{padding:8px 6px;border-bottom:1px solid var(--gl);vertical-align:middle}
|
| 420 |
+
.quote-table .qt-img{width:72px;height:72px;object-fit:contain;border-radius:6px;background:var(--l);border:1px solid var(--gl)}
|
| 421 |
.quote-table .qt-name{font-weight:600;color:var(--d)}
|
| 422 |
.quote-table .qt-price{text-align:right;white-space:nowrap}
|
| 423 |
.quote-table .qt-disc{width:80px;padding:5px 6px;border:1.5px solid var(--gl);border-radius:6px;font-size:.78rem;text-align:right;font-family:inherit;outline:none}
|
|
|
|
| 826 |
history.pushState({type:'product',idx:idx},'',slugUrl);
|
| 827 |
}
|
| 828 |
_skipHistory=false;
|
| 829 |
+
document.title=p.name+' | '+p.brand+' - V.AI STUDIO';
|
| 830 |
+
// Update OG meta for sharing
|
| 831 |
+
var ogImg=p.image||p.images[0]||'';
|
| 832 |
+
if(ogImg.startsWith('//'))ogImg='https:'+ogImg;
|
| 833 |
+
var pUrl=location.origin+'/san-pham/'+p.slug+'/index.html';
|
| 834 |
+
var el;
|
| 835 |
+
if(el=document.getElementById('ogTitle'))el.content=p.name+' | '+p.brand;
|
| 836 |
+
if(el=document.getElementById('ogDesc'))el.content=(p.summary||p.desc||p.name).substring(0,200);
|
| 837 |
+
if(el=document.getElementById('ogImage'))el.content=ogImg;
|
| 838 |
+
if(el=document.getElementById('ogUrl'))el.content=pUrl;
|
| 839 |
+
if(el=document.getElementById('twTitle'))el.content=p.name+' | '+p.brand;
|
| 840 |
+
if(el=document.getElementById('twDesc'))el.content=(p.summary||p.desc||p.name).substring(0,200);
|
| 841 |
+
if(el=document.getElementById('twImage'))el.content=ogImg;
|
| 842 |
document.getElementById('listView').style.display='none';
|
| 843 |
document.querySelector('.hero').style.display='none';
|
| 844 |
let dv=document.getElementById('detailView');
|
|
|
|
| 927 |
document.getElementById('listView').style.display='';
|
| 928 |
document.querySelector('.hero').style.display='';
|
| 929 |
document.title='V.AI STUDIO | Niềm tin khách hàng là tài sản của chúng tôi';
|
| 930 |
+
// Reset OG meta
|
| 931 |
+
var defImg='https://huggingface.co/spaces/bep40/V.AISTUDIO/resolve/main/logo/logo_600.png';
|
| 932 |
+
var el;
|
| 933 |
+
if(el=document.getElementById('ogTitle'))el.content='V.AI STUDIO | Niềm tin khách hàng là tài sản của chúng tôi';
|
| 934 |
+
if(el=document.getElementById('ogDesc'))el.content='8000+ sản phẩm thiết bị nhà bếp & điện máy chính hãng';
|
| 935 |
+
if(el=document.getElementById('ogImage'))el.content=defImg;
|
| 936 |
+
if(el=document.getElementById('ogUrl'))el.content=location.origin+'/';
|
| 937 |
+
if(el=document.getElementById('twTitle'))el.content='V.AI STUDIO';
|
| 938 |
+
if(el=document.getElementById('twDesc'))el.content='8000+ sản phẩm thiết bị nhà bếp & điện máy chính hãng';
|
| 939 |
+
if(el=document.getElementById('twImage'))el.content=defImg;
|
| 940 |
history.pushState({type:'list'},'','/');
|
| 941 |
}
|
| 942 |
|
|
|
|
| 1371 |
async function shareProduct(slug,name){
|
| 1372 |
let url=location.origin+'/san-pham/'+slug+'/index.html';
|
| 1373 |
let title=name||document.title;
|
| 1374 |
+
let text=title+' - V.AI STUDIO';
|
| 1375 |
+
// Try native share first (includes image via OG tags already set by showDetail)
|
| 1376 |
if(navigator.share){
|
| 1377 |
try{await navigator.share({title,text,url});return}catch(e){if(e.name==='AbortError')return}
|
| 1378 |
}
|
|
|
|
| 1961 |
discStyle+=locked?'background:var(--l);cursor:not-allowed':'background:#fff';
|
| 1962 |
return `<tr>
|
| 1963 |
<td style="text-align:center">${i+1}</td>
|
| 1964 |
+
<td><img class="qt-img" src="${c.image}" alt="${c.name}" crossorigin="anonymous" onerror="this.style.display='none'" style="width:72px;height:72px;object-fit:contain"></td>
|
| 1965 |
<td class="qt-name">${c.name}</td>
|
| 1966 |
<td style="text-align:center">${model}</td>
|
| 1967 |
<td style="font-size:.72rem;color:var(--g);max-width:160px">${specs}</td>
|
|
|
|
| 2023 |
let ws=wb.addWorksheet('Báo Giá');
|
| 2024 |
ws.columns=[
|
| 2025 |
{key:'stt',width:6},{key:'name',width:32},{key:'model',width:16},{key:'specs',width:28},
|
| 2026 |
+
{key:'image',width:18},{key:'qty',width:8},{key:'price',width:16},{key:'disc',width:16},
|
| 2027 |
{key:'total',width:18},{key:'note',width:18}
|
| 2028 |
];
|
| 2029 |
// Header
|
|
|
|
| 2078 |
|
| 2079 |
qd.items.forEach((item,idx)=>{
|
| 2080 |
let row=ws.getRow(r);
|
| 2081 |
+
row.height=64;
|
| 2082 |
// A: STT
|
| 2083 |
let cA=row.getCell(1);cA.value=item.stt;
|
| 2084 |
cA.alignment={horizontal:'center',vertical:'middle'};
|
|
|
|
| 2235 |
div.style.cssText='position:fixed;top:-9999px;left:0;width:1100px;background:#fff;padding:40px;font-family:Inter,Arial,sans-serif';
|
| 2236 |
let itemsHtml=qd.items.map(it=>`<tr style="border-bottom:1px solid #e2e8f0">
|
| 2237 |
<td style="padding:10px 6px;text-align:center;font-size:13px">${it.stt}</td>
|
| 2238 |
+
<td style="padding:10px 6px"><img src="${it.image}" style="width:80px;height:80px;object-fit:contain;border-radius:6px;border:1px solid #e2e8f0;background:#f8fafc" crossorigin="anonymous" onerror="this.style.display='none'"></td>
|
| 2239 |
<td style="padding:10px 6px;font-size:12px;font-weight:600">${it.name}</td>
|
| 2240 |
<td style="padding:10px 6px;text-align:center;font-size:12px">${it.model}</td>
|
| 2241 |
<td style="padding:10px 6px;font-size:11px;color:#64748b;max-width:180px">${it.specs}</td>
|