Fix Google Form Grid parser, survey display, and instant copy link button

This commit is contained in:
pongpon pitisuk
2026-09-12 15:08:23 +07:00
parent e01d01464a
commit 0e09259c9d
5 changed files with 188 additions and 65 deletions
+7 -9
View File
@@ -385,9 +385,9 @@ async function teacherGenerateLink(id) {
<div class="qr-link-container">
<div class="qr-link-section">
<div class="qr-link-label">🔗 ลิงก์แบบสอบถาม</div>
<div class="link-display">
<span class="flex-1" id="surveyLinkText">${fullUrl}</span>
<button class="copy-btn" onclick="copyTeacherLink()">📋 คัดลอก</button>
<div class="link-display" onclick="copyTeacherLink(this.querySelector('.copy-btn'))" style="cursor:pointer;" title="คลิกเพื่อคัดลอกลิงก์">
<span class="flex-1 select-all" id="surveyLinkText">${fullUrl}</span>
<button class="copy-btn" onclick="event.stopPropagation(); copyTeacherLink(this)">📋 คัดลอก</button>
</div>
</div>
<div class="qr-code-section">
@@ -425,13 +425,11 @@ async function teacherGenerateLink(id) {
}
}
function copyTeacherLink() {
const text = document.getElementById('surveyLinkText')?.textContent;
function copyTeacherLink(btnEl) {
const text = document.getElementById('surveyLinkText')?.textContent?.trim();
if (text) {
navigator.clipboard.writeText(text).then(() => Toast.success('คัดลอกแล้ว')).catch(() => {
const ta = document.createElement('textarea'); ta.value = text; document.body.appendChild(ta); ta.select(); document.execCommand('copy'); ta.remove();
Toast.success('คัดลอกแล้ว');
});
const btn = btnEl || document.querySelector('.link-display .copy-btn');
copyTextToClipboard(text, btn);
}
}