Fix Google Form Grid parser, survey display, and instant copy link button
This commit is contained in:
+7
-16
@@ -809,9 +809,9 @@ async function generateLink(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="copyLink()">📋 คัดลอก</button>
|
||||
<div class="link-display" onclick="copyLink(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(); copyLink(this)">📋 คัดลอก</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="qr-code-section">
|
||||
@@ -849,20 +849,11 @@ async function generateLink(id) {
|
||||
}
|
||||
}
|
||||
|
||||
function copyLink() {
|
||||
const text = document.getElementById('surveyLinkText')?.textContent;
|
||||
function copyLink(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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user