레드 라이트 테라피 시리즈
집
제품
레드 라이트 테라피 시리즈
레드 라이트 테라피 시리즈
집
제품
레드 라이트 테라피 시리즈
, 'i').test(text(label))) label.textContent = 'Message *';
});
var ta = form.querySelector('#contents, textarea[name="contents"]');
if (ta) { ta.setAttribute('placeholder', messagePlaceholder); ta.setAttribute('tip', 'Please include your RFQ details.'); }
form.querySelectorAll('input[type="submit"], button[type="submit"]').forEach(function(btn) {
if (btn.tagName === 'INPUT') btn.value = submitText; else btn.textContent = submitText;
});
}
function collectDetails(form) {
var lines = [];
fields.forEach(function(f) {
var el = form.querySelector('[name="' + f.name + '"]');
var val = el ? (el.value || '').trim() : '';
if (val) lines.push(f.label + ': ' + val);
});
return lines;
}
function appendDetailsToMessage(form) {
var ta = form.querySelector('#contents, textarea[name="contents"]'); if (!ta) return;
var details = collectDetails(form); if (!details.length) return;
var block = '[B2B Qualification Details]\n' + details.join('\n');
if (ta.value.indexOf('[B2B Qualification Details]') === -1) ta.value = (ta.value ? ta.value + '\n\n' : '') + block;
}
function enhanceForm(form) {
if (!form || form.getAttribute('data-kst-b2b-enhanced') === '1') { fixMessageAndSubmit(form); return; }
form.setAttribute('data-kst-b2b-enhanced','1');
ensureIntro(form); ensureFields(form); fixMessageAndSubmit(form);
form.addEventListener('submit', function() { appendDetailsToMessage(form); }, true);
form.querySelectorAll('input[type="submit"], button[type="submit"]').forEach(function(btn) {
btn.addEventListener('click', function() { appendDetailsToMessage(form); }, true);
});
}
function run() {
document.querySelectorAll('form#skInquiry, form').forEach(function(form) {
if (form.querySelector('#contents, textarea[name="contents"]')) enhanceForm(form);
});
document.querySelectorAll('label').forEach(function(label) { if (new RegExp('^' + ['mas','sage'].join('') + '\\s*\\*) label.textContent = 'Message *'; });
}
var oldInquiry = window.inquirySubmitForm;
if (typeof oldInquiry === 'function' && !oldInquiry.__kstB2BWrapped) {
window.inquirySubmitForm = function(key) { var form = document.querySelector(key); appendDetailsToMessage(form); return oldInquiry.apply(this, arguments); };
window.inquirySubmitForm.__kstB2BWrapped = true;
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', run); else run();
setTimeout(run, 500); setTimeout(run, 1500);
})();