/* domucgiare - SEO ky thuat (v2, 12/10/2026) 1) Ban http:// va www. tu chuyen ve https://mayinlongbien.vn (cho den khi Cong ty URL cai 301 tren may chu) 2) The canonical: doi http -> https, bo www; them canonical cho trang chu neu thieu 4) Trang san pham co gia: them du lieu Product (gia, tinh trang) cho Google 3) Moi trang dung 1 the H1: trang danh muc thieu H1 thi lay H2 tieu de dau tien; H1 thua trong noi dung doi thanh H2 */ (function () { var HOST = 'mayinlongbien.vn', BASE = 'https://' + HOST; if (location.hostname === 'www.' + HOST || (location.protocol === 'http:' && location.hostname === HOST)) { location.replace(BASE + location.pathname + location.search + location.hash); return; } try { var c = document.querySelector('link[rel="canonical"]'); if (c) { var h = c.getAttribute('href') || ''; var n = h.replace(/^https?:\/\/(www\.)?mayinlongbien\.vn/i, BASE); if (n !== h) c.setAttribute('href', n); } else if (location.pathname === '/' || location.pathname === '/index.html') { c = document.createElement('link'); c.rel = 'canonical'; c.href = BASE + '/'; document.head.appendChild(c); } } catch (e) {} try { var all = [].slice.call(document.querySelectorAll('h1')).filter(function (x) { return !x.closest('.modal'); }); function swap(el, tag) { var n = document.createElement(tag); for (var i = 0; i < el.attributes.length; i++) n.setAttribute(el.attributes[i].name, el.attributes[i].value); while (el.firstChild) n.appendChild(el.firstChild); el.parentNode.replaceChild(n, el); return n; } if (!all.length) { var h2 = document.querySelector('#content .des h2, #content .box_info_page h2, #content article h2'); if (h2 && h2.textContent.trim().length > 5) swap(h2, 'h1').classList.add('tvh1'); } else if (all.length > 1) { for (var k = 1; k < all.length; k++) swap(all[k], 'h2'); } if (!document.getElementById('tvh1-css')) { var st = document.createElement('style'); st.id = 'tvh1-css'; st.textContent = 'h1.tvh1{font-size:22px;line-height:1.3;font-weight:700;color:#14284b;margin:0 0 12px}'; document.head.appendChild(st); } } catch (e) {} try { var pe = document.querySelector('.product-essential'); var pn = pe && document.querySelector('#content .price .new-price'); var nm = (document.querySelector('h1:not(.modal-title)') || {}).textContent || ''; nm = nm.trim(); var price = pn ? parseInt((pn.textContent || '').replace(/[^\d]/g, ''), 10) : 0; if (pe && price > 0 && nm && !/^(sửa|thay|đổ mực|cài|vệ sinh|nâng cấp|khắc phục|dịch vụ|bảo trì|lắp đặt|nạp mực)/i.test(nm) && !document.getElementById('tvprod-ld')) { var im = pe.querySelector('img'); var src = im ? (im.getAttribute('data-src') || im.getAttribute('src') || '') : ''; if (src && src.charAt(0) === '/') src = BASE + src; var bm = nm.match(/\b(Canon|Epson|HP|Brother|Samsung|Ricoh|Xerox|Toshiba|Sharp|Kyocera|Konica Minolta|Panasonic|Dell|Lenovo|Asus|Acer|Fujitsu|Pantum)\b/i); var md = document.querySelector('meta[name="description"]'); var cn = document.querySelector('link[rel="canonical"]'); var p = { '@context': 'https://schema.org', '@type': 'Product', name: nm, image: src ? [src] : undefined, description: md ? md.getAttribute('content') : undefined, brand: bm ? { '@type': 'Brand', name: bm[1] } : undefined, offers: { '@type': 'Offer', url: cn ? cn.getAttribute('href') : BASE + location.pathname, priceCurrency: 'VND', price: price, availability: 'https://schema.org/InStock', itemCondition: /cũ|bóc máy|đã qua sử dụng|thanh lý/i.test(nm) ? 'https://schema.org/UsedCondition' : 'https://schema.org/NewCondition', seller: { '@type': 'Organization', name: 'Máy In Mực In Thần Vũ' } } }; var sc = document.createElement('script'); sc.type = 'application/ld+json'; sc.id = 'tvprod-ld'; sc.textContent = JSON.stringify(p); document.head.appendChild(sc); } } catch (e) {} })();