お知らせ– tag –

1...34567
document.addEventListener('DOMContentLoaded', function () { function addQuickButtons() { const chatBody = document.querySelector('.mwai-chat .mwai-messages'); if (!chatBody) return; if (document.querySelector('.takeru-quick-buttons')) return; const buttons = [ '診療時間を教えてください', '駐車場はありますか?', '初診の予約方法を教えてください', '飛蚊症とは何ですか?', ]; const container = document.createElement('div'); container.className = 'takeru-quick-buttons'; container.style.cssText = 'display:flex;flex-wrap:wrap;gap:8px;padding: 10px 12px;'; buttons.forEach(function (label) { const btn = document.createElement('button'); btn.textContent = label; btn.style.cssText = 'border:1px solid #00A04C;color:#00A04C;background:white;border-radius:16px;padding:4px 12px;font-size:12px;cursor:pointer;'; btn.addEventListener('click', function () { const input = document.querySelector('.mwai-chat .mwai-input textarea, .mwai-chat input[type="text"]'); const sendBtn = document.querySelector('.mwai-chat .mwai-send- button'); if (input && sendBtn) { input.value = label; input.dispatchEvent(new Event('input', { bubbles: true })); sendBtn.click(); container.remove(); } }); container.appendChild(btn); }); chatBody.prepend(container); } // Popup開閉を監視 const observer = new MutationObserver(function () { if (document.querySelector('.mwai-chat.mwai-open')) { setTimeout(addQuickButtons, 300); } }); observer.observe(document.body, { childList: true, subtree: true }); });